bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: bpf <bpf@vger.kernel.org>, Andrii Nakryiko <andriin@fb.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>, Martin Lau <kafai@fb.com>,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	john fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>,
	Networking <netdev@vger.kernel.org>
Subject: Re: [PATCH bpf] libbpf: Fix BTF-to-C conversion of noreturn function pointers
Date: Mon, 8 Jun 2020 16:50:37 -0700	[thread overview]
Message-ID: <CAEf4BzaNaHGBxNLdA1RA7VPou7ypO3Z5XBRG5gpkePx4g27yWA@mail.gmail.com> (raw)
In-Reply-To: <20200608152052.898491-1-jean-philippe@linaro.org>

On Mon, Jun 8, 2020 at 8:23 AM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> When trying to convert the BTF for a function pointer marked "noreturn"
> to C code, bpftool currently generates a syntax error. This happens with
> the exit() pointer in drivers/firmware/efi/libstub/efistub.h, in an
> arm64 vmlinux. When dealing with this declaration:
>
>         efi_status_t __noreturn (__efiapi *exit)(...);
>
> bpftool produces the following output:
>
>         efi_status_tvolatile  (*exit)(...);


I'm curious where this volatile is coming from, I don't see it in
__efiapi. But even if it's there, shouldn't it be inside parens
instead:

efi_status_t (volatile *exit)(...);

?

>
> Fix the error by inserting the space before the function modifier.
>
> Fixes: 351131b51c7a ("libbpf: add btf_dump API for BTF-to-C conversion")
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> ---

Can you please add tests for this case into selftests (probably
progs/btf_dump_test_case_syntax.c?) So it's clear what's the input and
what's the expected output.

>  tools/lib/bpf/btf_dump.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
>

[...]

  reply	other threads:[~2020-06-08 23:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 15:20 [PATCH bpf] libbpf: Fix BTF-to-C conversion of noreturn function pointers Jean-Philippe Brucker
2020-06-08 23:50 ` Andrii Nakryiko [this message]
2020-06-09 14:05   ` Jean-Philippe Brucker
2020-06-10  5:26     ` Andrii Nakryiko

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=CAEf4BzaNaHGBxNLdA1RA7VPou7ypO3Z5XBRG5gpkePx4g27yWA@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jean-philippe@linaro.org \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /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;
as well as URLs for NNTP newsgroup(s).