Re: [PATCH bpf] libbpf: Fix BTF-to-C conversion of noreturn function pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 8, 2020 at 8:23 AM Jean-Philippe Brucker
<jean-philippe@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---

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(-)
>

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux