Re: [PATCH v4] bpf/scripts: Generate GCC compatible helper defs header

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

 



On Fri, Aug 5, 2022 at 1:18 AM James Hilliard <james.hilliard1@xxxxxxxxx> wrote:
>
> The current bpf_helper_defs.h helpers are llvm specific and don't work
> correctly with gcc.
>
> GCC requires kernel helper funcs to have the following attribute set:
> __attribute__((kernel_helper(NUM)))
>
> Generate gcc compatible headers based on the format in bpf-helpers.h.
>
> This leaves the bpf_helper_defs.h entirely unchanged and generates a
> fully separate GCC compatible bpf_helper_defs_attr.h header file
> which is conditionally included if the GCC kernel_helper attribute
> is supported.
>
> This adds GCC attribute style kernel helpers in bpf_helper_defs_attr.h:
>         void *bpf_map_lookup_elem(void *map, const void *key) __attribute__((kernel_helper(1)));
>
>         long bpf_map_update_elem(void *map, const void *key, const void *value, __u64 flags) __attribute__((kernel_helper(2)));
>
> See:
> https://github.com/gcc-mirror/gcc/blob/releases/gcc-12.1.0/gcc/config/bpf/bpf-helpers.h#L24-L27
>
> This fixes the following build error:
> error: indirect call in function, which are not supported by eBPF
>
> Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>
> ---
> Changes v3 -> v4:
>   - don't modify bpf_helper_defs.h
>   - generate bpf_helper_defs_attr.h for GCC
>   - check __has_attribute(kernel_helper) for selecting GCC defs

Great job ignoring the feedback.
Applied.
Just kidding.



[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