From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: Andrii Nakryiko <andriin@fb.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@fb.com,
daniel@iogearbox.net, andrii.nakryiko@gmail.com,
kernel-team@fb.com
Subject: Re: [PATCH bpf] libbpf: handle GCC noreturn-turned-volatile quirk
Date: Wed, 10 Jun 2020 10:46:05 +0200 [thread overview]
Message-ID: <20200610084605.GB6844@myrica> (raw)
In-Reply-To: <20200610052335.2862559-1-andriin@fb.com>
On Tue, Jun 09, 2020 at 10:23:35PM -0700, Andrii Nakryiko wrote:
> Handle a GCC quirk of emitting extra volatile modifier in DWARF (and
> subsequently preserved in BTF by pahole) for function pointers marked as
> __attribute__((noreturn)). This was the way to mark such functions before GCC
> 2.5 added noreturn attribute. Drop such func_proto modifiers, similarly to how
> it's done for array (also to handle GCC quirk/bug).
>
> Such volatile attribute is emitted by GCC only, so existing selftests can't
> express such test. Simple repro is like this (compiled with GCC + BTF
> generated by pahole):
>
> struct my_struct {
> void __attribute__((noreturn)) (*fn)(int);
> };
> struct my_struct a;
>
> Without this fix, output will be:
>
> struct my_struct {
> voidvolatile (*fn)(int);
> };
>
> With the fix:
>
> struct my_struct {
> void (*fn)(int);
> };
>
> Reported-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> Fixes: 351131b51c7a ("libbpf: add btf_dump API for BTF-to-C conversion")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Thanks, this fixes the issue I was seeing with the arm64 vmlinux
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
next prev parent reply other threads:[~2020-06-10 8:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 5:23 [PATCH bpf] libbpf: handle GCC noreturn-turned-volatile quirk Andrii Nakryiko
2020-06-10 8:46 ` Jean-Philippe Brucker [this message]
2020-06-10 11:38 ` Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200610084605.GB6844@myrica \
--to=jean-philippe@linaro.org \
--cc=andrii.nakryiko@gmail.com \
--cc=andriin@fb.com \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox