[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQJ2LSrviYX++K8YQCc7B6yNapJ+MA9jCiFw=UQ3dQYMLw@mail.gmail.com>
Date: Fri, 5 Aug 2022 08:28:01 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: James Hilliard <james.hilliard1@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, LKML <linux-kernel@...r.kernel.org>,
llvm@...ts.linux.dev
Subject: Re: [PATCH v4] bpf/scripts: Generate GCC compatible helper defs header
On Fri, Aug 5, 2022 at 1:18 AM James Hilliard <james.hilliard1@...il.com> 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@...il.com>
> ---
> 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.
Powered by blists - more mailing lists