mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-13 11:25:04 -04:00
btf2btf() adds new types to the BTF: the KF_IMPLICIT_ARGS transform synthesizes an _impl FUNC together with its FUNC_PROTO and copies of the kfunc's decl tags. Nothing deduplicates them afterwards. pahole runs btf__dedup() on its own output, but that happens before resolve_btfids sees the BTF, so any type the tool itself creates is emitted as-is, even when a structurally identical type is already present. Call btf__dedup() at the start of finalize_btf(), so that base distillation and the by-name sort both operate on the canonical set of types. On an x86_64 build with the BPF selftests config this removes 17 duplicate FUNC_PROTOs from vmlinux BTF. The dedup call increases runtime of resolve_btfids on vmlinux by 30-40%. The performance hit is an acceptable cost to keep kernel BTF deduped [1]. [1] https://lore.kernel.org/bpf/986e6f4e-4b51-4440-a37c-9624906d7370@linux.dev/ Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev> Link: https://patch.msgid.link/20260807032029.78092-2-ihor.solodrai@linux.dev Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>