Re: [PATCH bpf] lib: bpf: tracing: fail compilation if target arch is missing

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

 



On Tue, Jun 15, 2021 at 3:11 AM Lorenz Bauer <lmb@xxxxxxxxxxxxxx> wrote:
>
> On Tue, 15 Jun 2021 at 00:27, Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote:
> >
> > It doesn't seem avoidable. But I'm surprised you are satisfied with
> > your patch, it doesn't seem to solve your problem, because you'll
> > never trigger those _Pragmas as you'll just fallback to using your
> > host architecture. Isn't that right? How did you test your patch?
>
> I tested the patch by removing -D__TARGET_ARCH_$(SRCARCH) from
> BPF_CFLAGS in the Makefile. The pragmas are triggered because the
> testsuite compiles with -target bpf. This prevents the "host arch"
> fallback from activating. bpf2go specifies -target bpf(el|eb) as well,
> so any users will get the _Pragma if they use a new enough
> bpf_tracing.h.

Oh, I didn't realize  -target bpf will prevent host architecture
fallback. In that case we don't need a new #define, cool.

>
> > >
> > > Without it we sometimes get an integer cast warning, something about
> > > an int to void* cast I think?
> >
> > hmm.. ok
>
> This is the error I get:
>
> progs/lsm.c:166:14: warning: cast to 'void *' from smaller integer
> type 'int' [-Wint-to-void-pointer-cast]
>         void *ptr = (void *)PT_REGS_PARM1(regs);
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

oh, ok, but then those zeros probably best to mark as longs, not long
longs (even thought for BPF it's the same), as (unsigned) long is a
logical equivalent of a pointer, right?

>
> --
> Lorenz Bauer  |  Systems Engineer
> 6th Floor, County Hall/The Riverside Building, SE1 7PB, UK
>
> www.cloudflare.com



[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