On Fri, Apr 25, 2025 at 12:43 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > Eduard Zingerman <eddyz87@xxxxxxxxx> writes: > > > Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> writes: > > > >> Hi All, > >> > >> Looks like pahole fails to deduplicate BTF when kernel and > >> kernel module are built with gcc-14. > >> I see this issue with various kernel .config-s on bpf and > >> bpf-next trees. > >> I tried pahole 1.28 and the latest master. Same issues. > >> > >> BTF in bpf_testmod.ko built with gcc-14 has 2849 types. > >> When built with gcc-13 it has 454 types. > >> So something is confusing dedup logic. > >> Would be great if dedup experts can take a look, > >> since this dedup issue is breaking a lot of selftests/bpf. > > > > It does not look like the problem is with dedup. > > Quick glance at structure definitions does not show any duplications, > > just much more structs compared to clang: > > Or maybe it is. > For example, task_struct is added to .ko BTF generated by gcc, but not > clang. This can only happen if dedup fails to merge structures in base > and module btf, right? > > Here is an interesting observation: > > $ bpftool btf dump file ~/tmp/objs-gcc/bpf_testmod.ko format c | awk '/struct task_struct \{/ {s=1} s {print $0} /^\}/ {s=0}' > ~/tmp/task_struct.ko.c > > $ bpftool btf dump file ~/tmp/objs-gcc/vmlinux format c | awk '/struct task_struct \{/ {s=1} s {print $0} /^\}/ {s=0}' > ~/tmp/task_struct.vmlinux.c > > $ diff -pruN ~/tmp/task_struct.ko.c ~/tmp/task_struct.vmlinux.c > --- /home/ezingerman/tmp/task_struct.ko.c 2025-04-25 12:37:48.312480603 -0700 > +++ /home/ezingerman/tmp/task_struct.vmlinux.c 2025-04-25 12:38:03.096644654 -0700 > @@ -18,7 +18,6 @@ struct task_struct { > int static_prio; > int normal_prio; > unsigned int rt_priority; > - long: 0; > struct sched_entity se; I reproed this issue with default .ko build that includes: --btf_features=distilled_base Once I disabled it and did bpftool btf dump file ./bpf_testmod.ko --base-btf .../vmlinux format c the task_struct from vmlinux.h and from testmod.h became exactly the same. So it sounds like the 3rd issue :) bpftool dump of distilled btf needs work.