October 23, 2025 at 11:42, "Yonghong Song" <[email protected] mailto:[email protected]?to=%22Yonghong%20Song%22%20%3Cyonghong.song%40linux.dev%3E > wrote:
> > On 10/22/25 8:33 PM, Jiayuan Chen wrote: > > > > > October 22, 2025 at 23:33, "Yonghong Song" <[email protected] > > mailto:[email protected]?to=%22Yonghong%20Song%22%20%3Cyonghong.song%40linux.dev%3E > > > wrote: > > > > > > > > On 10/22/25 12:18 AM, Jiayuan Chen wrote: > > > > > When compiling the BPF selftests with Clang versions that do not support > > > > > > > > If you are really using llvm18, then I found there are some other > > > build failures as well, e.g., > > > > > Yes i'm using llvm18 > > > > > > > > /home/yhs/work/bpf-next/tools/testing/selftests/bpf/bpf_arena_common.h:47:15: > > > error: conflicting types for 'bpf_arena_alloc_pages' > > > 47 | void __arena* bpf_arena_alloc_pages(void *map, void __arena *addr, > > > __u32 page_cnt, > > > | ^ > > > > > > /home/yhs/work/bpf-next/tools/testing/selftests/bpf/tools/include/vmlinux.h:160636:48: > > > note: previous declaration is here > > > 160636 | extern void __attribute__((address_space(1))) > > > *bpf_arena_alloc_pages(void *p__map, void > > > __attribute__((address_space(1))) *addr__ign, u32 page_cnt, int node_id, > > > u64 flags) __weak __ksym; > > > | ^ > > > > > I hadn't encountered this error before, but it started appearing after I > > upgraded LLVM to version 20. > > > > $ make V=1 > > > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool > > btf dump file /home/chenjiayuan/code/upstream/bpf-next/vmlinux format c > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include/.vmlinux.h.tmp > > cmp -s > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include/.vmlinux.h.tmp > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include/vmlinux.h > > || mv > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include/.vmlinux.h.tmp > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include/vmlinux.h > > clang -g -Wall -Werror -D__TARGET_ARCH_x86 -mlittle-endian > > -I/home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include > > -I/home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf > > -I/home/chenjiayuan/code/upstream/bpf-next/tools/include/uapi > > -I/home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/usr/include > > -std=gnu11 -fno-strict-aliasing -Wno-compare-distinct-pointer-types > > -idirafter /usr/lib/llvm-20/lib/clang/20/include -idirafter > > /usr/local/include -idirafter /usr/include/x86_64-linux-gnu -idirafter > > /usr/include -DENABLE_ATOMICS_TESTS -O2 --target=bpfel -c progs/stream.c > > -mcpu=v3 -o > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/stream.bpf.o > > In file included from progs/stream.c:8: > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/bpf_arena_common.h:47:15: > > error: conflicting types for 'bpf_arena_alloc_pages' > > 47 | void __arena* bpf_arena_alloc_pages(void *map, void __arena *addr, > > __u32 page_cnt, > > | ^ > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include/vmlinux.h:152158:14: > > note: previous declaration is here > > 152158 | extern void *bpf_arena_alloc_pages(void *p__map, void *addr__ign, > > u32 page_cnt, int node_id, u64 flags) __weak __ksym; > > | ^ > > In file included from progs/stream.c:8: > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/bpf_arena_common.h:49:5: > > error: conflicting types for 'bpf_arena_reserve_pages' > > 49 | int bpf_arena_reserve_pages(void *map, void __arena *addr, __u32 > > page_cnt) __ksym __weak; > > | ^ > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include/vmlinux.h:152160:12: > > note: previous declaration is here > > 152160 | extern int bpf_arena_reserve_pages(void *p__map, void *ptr__ign, > > u32 page_cnt) __weak __ksym; > > | ^ > > In file included from progs/stream.c:8: > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/bpf_arena_common.h:50:6: > > error: conflicting types for 'bpf_arena_free_pages' > > 50 | void bpf_arena_free_pages(void *map, void __arena *ptr, __u32 > > page_cnt) __ksym __weak; > > | ^ > > > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/tools/include/vmlinux.h:152159:13: > > note: previous declaration is here > > 152159 | extern void bpf_arena_free_pages(void *p__map, void *ptr__ign, > > u32 page_cnt) __weak __ksym; > > | ^ > > 3 errors generated. > > make: *** [Makefile:761: > > /home/chenjiayuan/code/upstream/bpf-next/tools/testing/selftests/bpf/stream.bpf.o] > > Error 1 > > > > $ clang --version > > Ubuntu clang version 20.1.8 > > (++20250804090239+87f0227cb601-1~exp1~20250804210352.139) > > Target: x86_64-pc-linux-gnu > > Thread model: posix > > InstalledDir: /usr/lib/llvm-20/bin > > > > $ pahole --version > > v1.29 > > > Please try pahole version 1.30. > > > > > I updated LLVM via https://apt.llvm.org/. Could this be caused by some > > binaries or libraries still using LLVM 18? > > > thanks, but version 1.30 didn't work in my tests - even pahole's master branch fails, only the next branch works... It seems that the 'old' pahole parses some kfuncs incorrectly, for example bpf_dynptr_slice(). ./tools/sbin/bpftool btf dump file ../../../../vmlinux | grep bpf_dynptr_slice -A 2 'KF_bpf_dynptr_slice' val=23 'KF_bpf_dynptr_slice_rdwr' val=24 'KF_bpf_dynptr_clone' val=25 'KF_bpf_percpu_obj_new_impl' val=26 -- [68242] FUNC 'bpf_dynptr_slice' type_id=68241 linkage=static <- missing corresponding DECL_TAG ? [68243] FUNC 'bpf_dynptr_slice_rdwr' type_id=68241 linkage=static [68244] DECL_TAG 'bpf_kfunc' type_id=68243 component_idx=-1 [68245] FUNC_PROTO '(anon)' ret_type_id=38 vlen=5

