[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYrT1VGj43A3Xg60cSMSX658iL2+yp8a5Xk=8Ez3sj_Ew@mail.gmail.com>
Date: Fri, 2 Dec 2022 16:23:56 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: James Hilliard <james.hilliard1@...il.com>
Cc: bpf@...r.kernel.org,
"Jose E . Marchesi" <jose.marchesi@...cle.com>,
David Faust <david.faust@...cle.com>,
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>,
Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] selftests/bpf: add GCC compatible builtins to bpf_legacy.h
On Thu, Dec 1, 2022 at 11:10 AM James Hilliard
<james.hilliard1@...il.com> wrote:
>
> The bpf_legacy.h header uses llvm specific load functions, add
> GCC compatible variants as well to fix tests using these functions
> under GCC.
>
> Signed-off-by: James Hilliard <james.hilliard1@...il.com>
> Cc: Jose E. Marchesi <jose.marchesi@...cle.com>
> Cc: David Faust <david.faust@...cle.com>
> ---
Please use [PATCH bpf-next] prefix to target patches for bpf-next
tree. This helps some of our automation.
> tools/testing/selftests/bpf/bpf_legacy.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/bpf_legacy.h b/tools/testing/selftests/bpf/bpf_legacy.h
> index 845209581440..256c2a90aa20 100644
> --- a/tools/testing/selftests/bpf/bpf_legacy.h
> +++ b/tools/testing/selftests/bpf/bpf_legacy.h
> @@ -2,6 +2,15 @@
> #ifndef __BPF_LEGACY__
> #define __BPF_LEGACY__
>
> +#if __GNUC__ && !__clang__
> +/* Functions to emit BPF_LD_ABS and BPF_LD_IND instructions. We
> + * provide the "standard" names as synonyms of the corresponding GCC
> + * builtins. Note how the SKB argument is ignored.
> + */
> +#define load_byte(skb,off) __builtin_bpf_load_byte((off))
> +#define load_half(skb,off) __builtin_bpf_load_half((off))
> +#define load_word(skb,off) __builtin_bpf_load_word((off))
added space between skb, and off. And we don't need those extra ()
around off, right? I stripped them away, but let me know if that's
wrong.
> +#else
> /* llvm builtin functions that eBPF C program may use to
> * emit BPF_LD_ABS and BPF_LD_IND instructions
> */
> @@ -11,6 +20,7 @@ unsigned long long load_half(void *skb,
> unsigned long long off) asm("llvm.bpf.load.half");
> unsigned long long load_word(void *skb,
> unsigned long long off) asm("llvm.bpf.load.word");
> +#endif
>
> #endif
>
> --
> 2.34.1
>
Powered by blists - more mailing lists