[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bza2zZK2m4fmDUXKoURxMmUcfr8gvLR9wxF1vFPBmc2gHA@mail.gmail.com>
Date: Tue, 27 Jul 2021 14:43:39 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Pavo Banicevic <pavo.banicevic@...tura.hr>,
Arnd Bergmann <arnd@...aro.org>, linux@...linux.org.uk,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
john fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
open list <linux-kernel@...r.kernel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
matt.redfearn@...s.com, Ingo Molnar <mingo@...nel.org>,
dvlasenk@...hat.com, Juraj Vijtiuk <juraj.vijtiuk@...tura.hr>,
robert.marko@...tura.hr, Luka Perkov <luka.perkov@...tura.hr>,
Jakov Petrina <jakov.petrina@...tura.hr>
Subject: Re: [PATCH 1/3] arm: include: asm: swab: mask rev16 instruction for clang
On Tue, Jul 27, 2021 at 10:53 AM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
>
> On Tue, Jul 27, 2021 at 7:12 AM Pavo Banicevic
> <pavo.banicevic@...tura.hr> 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.
>
> NACK
>
> The way to fix these is to sort out the header includes, not turning
> off arbitrary things that are used by the actual kernel build for 32b
> ARM.
Would it be too horrible to just get rid of `clang -emit-llvm` and use
vmlinux.h (we don't need to do CO-RE, btw, just generate vmlinux.h
from the matching kernel)? Kumar has already started moving in that
direction in his recent patch set ([0]). Would that get rid of all
these issues?
[0] https://patchwork.kernel.org/project/netdevbpf/list/?series=519281&state=*
>
> >
> > 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
> >
> > static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
> > {
> > --
> > 2.32.0
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
Powered by blists - more mailing lists