On Sun, Jan 22, 2023, at 10:48 AM, Daniel Xu wrote: > Hi, > > I'm getting the following error during build: > > $ ./tools/testing/selftests/bpf/vmtest.sh -j30 > [...] > BTF .btf.vmlinux.bin.o > btf_encoder__encode: btf__dedup failed! > Failed to encode BTF > LD .tmp_vmlinux.kallsyms1 > NM .tmp_vmlinux.kallsyms1.syms > KSYMS .tmp_vmlinux.kallsyms1.S > AS .tmp_vmlinux.kallsyms1.S > LD .tmp_vmlinux.kallsyms2 > NM .tmp_vmlinux.kallsyms2.syms > KSYMS .tmp_vmlinux.kallsyms2.S > AS .tmp_vmlinux.kallsyms2.S > LD .tmp_vmlinux.kallsyms3 > NM .tmp_vmlinux.kallsyms3.syms > KSYMS .tmp_vmlinux.kallsyms3.S > AS .tmp_vmlinux.kallsyms3.S > LD vmlinux > BTFIDS vmlinux > FAILED: load BTF from vmlinux: No such file or directory > make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 255 > make[1]: *** Deleting file 'vmlinux' > make: *** [Makefile:1264: vmlinux] Error 2 > > This happens on both bpf-next/master (84150795a49) and 6.2-rc5 > (2241ab53cb). > > I've also tried arch linux pahole 1:1.24+r29+g02d67c5-1 as well as > upstream pahole on master (02d67c5176) and upstream pahole on > next (2ca56f4c6f659). > > Of the above 6 combinations, I think I've tried all of them (maybe > missing 1 or 2). > > Looks like GCC got updated recently on my machine, so perhaps > it's related? > > CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230111" > > I'll try some debugging, but just wanted to report it first. > > Thanks, > Daniel Applying the following diff: diff --git a/src/btf.c b/src/btf.c index ae1520f..8a2fa36 100644 --- a/src/btf.c +++ b/src/btf.c @@ -4576,8 +4576,11 @@ static int btf_dedup_ref_type(struct btf_dedup *d, __u32 type_id) int ref_type_id; long h; - if (d->map[type_id] == BTF_IN_PROGRESS_ID) + if (d->map[type_id] == BTF_IN_PROGRESS_ID) { + struct btf_type *t = btf_type_by_id(d->btf, type_id); + pr_warn("eloop type_id=%d, kind=%d, type=%d\n", type_id, btf_kind(t), t->type); return -ELOOP; + } if (d->map[type_id] <= BTF_MAX_NR_TYPES) return resolve_type_id(d, type_id); Yields: BTF .btf.vmlinux.bin.o libbpf: eloop type_id=2, kind=10, type=2 btf_encoder__encode: btf__dedup failed! Failed to encode BTF So it's a CONST pointing to itself? I'm somewhat out of ideas here.