[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <424add3f-d79a-79dd-2e6a-dbb966bf7349@fb.com>
Date: Tue, 27 Jul 2021 08:46:23 -0700
From: Yonghong Song <yhs@...com>
To: Pavo Banicevic <pavo.banicevic@...tura.hr>,
<linux@...linux.org.uk>, <ast@...nel.org>, <daniel@...earbox.net>,
<andrii@...nel.org>, <kafai@...com>, <songliubraving@...com>,
<john.fastabend@...il.com>, <kpsingh@...nel.org>,
<nathan@...nel.org>, <ndesaulniers@...gle.com>,
<ivan.khoronzhuk@...aro.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<bpf@...r.kernel.org>, <clang-built-linux@...glegroups.com>,
<matt.redfearn@...s.com>, <mingo@...nel.org>,
<dvlasenk@...hat.com>, <juraj.vijtiuk@...tura.hr>,
<robert.marko@...tura.hr>, <luka.perkov@...tura.hr>,
<jakov.petrina@...tura.hr>
Subject: Re: [PATCH 1/3] arm: include: asm: swab: mask rev16 instruction for
clang
On 7/27/21 7:11 AM, Pavo Banicevic wrote:
> From: Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>
>
> The samples/bpf with clang -emit-llvm reuses linux headers to build
> bpf samples, and this w/a only for samples (samples/bpf/Makefile
> CLANG-bpf).
>
> It allows to build samples/bpf for arm bpf using clang.
> In another way clang -emit-llvm generates errors like:
>
> CLANG-bpf samples/bpf/tc_l2_redirect_kern.o
> <inline asm>:1:2: error: invalid register/token name
> rev16 r3, r0
>
> This decision is arguable, probably there is another way, but
> it doesn't have impact on samples/bpf, so it's easier just ignore
> it for clang, at least for now.
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>
> ---
> arch/arm/include/asm/swab.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/include/asm/swab.h b/arch/arm/include/asm/swab.h
> index c6051823048b..a9fd9cd33d5e 100644
> --- a/arch/arm/include/asm/swab.h
> +++ b/arch/arm/include/asm/swab.h
> @@ -25,8 +25,11 @@ static inline __attribute_const__ __u32 __arch_swahb32(__u32 x)
> __asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x));
> return x;
> }
> +
> +#ifndef __clang__
> #define __arch_swahb32 __arch_swahb32
> #define __arch_swab16(x) ((__u16)__arch_swahb32(x))
> +#endif
What if the kernel is compiled with clang compiler?
Does this still work?
To workaround samples/bpf issue, I think you can use
__BPF_TRACING__ macro.
>
> static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
> {
>
Powered by blists - more mailing lists