Re: libbpf error: unknown register name 'r0' in asm

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

 



‫בתאריך יום ו׳, 9 באוק׳ 2020 ב-19:27 מאת ‪Daniel Borkmann‬‏
<‪daniel@xxxxxxxxxxxxx‬‏>:‬
>
> [ Cc +Yonghong ]
>
> On 10/9/20 6:05 PM, Yaniv Agman wrote:
> > Pulling the latest changes of libbpf and compiling my application with it,
> > I see the following error:
> >
> > ../libbpf/src//root/usr/include/bpf/bpf_helpers.h:99:10: error:
> > unknown register name 'r0' in asm
> >                       : "r0", "r1", "r2", "r3", "r4", "r5");
> >
> > The commit which introduced this change is:
> > 80c7838600d39891f274e2f7508b95a75e4227c1
> >
> > I'm not sure if I'm doing something wrong (missing include?), or this
> > is a genuine error
>
> Seems like your clang/llvm version might be too old.

I'm using clang 10.0.1

>
> Yonghong, do you happen to know from which version onwards there is proper support
> for bpf inline asm? We could potentially wrap this around like this:
>
> diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
> index 2bdb7d6dbad2..0d6abc91bfc6 100644
> --- a/tools/lib/bpf/bpf_helpers.h
> +++ b/tools/lib/bpf/bpf_helpers.h
> @@ -72,6 +72,7 @@
>   /*
>    * Helper function to perform a tail call with a constant/immediate map slot.
>    */
> +#if __clang_major__ >= 10
>   static __always_inline void
>   bpf_tail_call_static(void *ctx, const void *map, const __u32 slot)
>   {
> @@ -98,6 +99,7 @@ bpf_tail_call_static(void *ctx, const void *map, const __u32 slot)
>                       :: [ctx]"r"(ctx), [map]"r"(map), [slot]"i"(slot)
>                       : "r0", "r1", "r2", "r3", "r4", "r5");
>   }
> +#endif /* __clang_major__ >= 10 */
>
>   /*
>    * Helper structure used by eBPF C program
>
>
>
> > Yaniv
> >
>




[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