https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106773

--- Comment #8 from David Faust <david.faust at oracle dot com> ---
(In reply to James Hilliard from comment #5)
> (In reply to David Faust from comment #4)
> > Created attachment 53993 [details]
> > proposed patch
> > 
> > Should fix the remaining issues with 'extern' linkage and the missing
> > 'const' modifier (and includes the earlier partial fixes in this bug)
> 
> Fixes the reported test failure but some others(unclear if related to this
> bug) are still failing such as tailcall_bpf2bpf3.c:

Thanks for testing and confirming.

> $ /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool
> --debug gen object
> /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/
> tailcall_bpf2bpf3.bpf.linked1.o
> /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/
> tailcall_bpf2bpf3.bpf.o
> libbpf: linker: adding object file
> '/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/
> tailcall_bpf2bpf3.bpf.o'...
> libbpf: failed to find BTF info for global/extern symbol 'llvm.bpf.load.word'
> Error: failed to link

> https://github.com/torvalds/linux/blob/v6.1-rc7/tools/testing/selftests/bpf/bpf_legacy.h
unsigned long long load_word(void *skb,
                             unsigned long long off) asm("llvm.bpf.load.word");

Looks like LLVM-specific inline asm to use their llvm.bpf.load.word intrinsic.

GCC has equivalent __builtin_load_{byte,half,word} target builtins.

> There's also this error during skeleton generation for kfunc_call_test.c:
> ...
> libbpf: failed to find BTF for extern 'bpf_kfunc_call_test2': -22

Hm, looks like we are OK for extern variables but are mis-generating something
(or missing something) for extern funcs still. Will look into this.

Reply via email to