selftests/bpf: Test linking with duplicate extern functions
authorEric Long <i@hack3r.moe>
Wed, 2 Oct 2024 06:25:07 +0000 (14:25 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 8 Oct 2024 03:28:53 +0000 (20:28 -0700)
commit3c591de2854381e313ec149bc1bbd8360f9ed53b
treec28120e0e644495f7e481267a12db2132fa0f8b7
parent4b146e95da87bf0fe64502aaafebeb622dfff653
selftests/bpf: Test linking with duplicate extern functions

Previously when multiple BPF object files referencing the same extern
function (usually kfunc) are statically linked using `bpftool gen
object`, libbpf tries to get the nonexistent size of BTF_KIND_FUNC_PROTO
and fails. This test ensures it is fixed.

Signed-off-by: Eric Long <i@hack3r.moe>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20241002-libbpf-dup-extern-funcs-v4-2-560eb460ff90@hack3r.moe
tools/testing/selftests/bpf/progs/linked_funcs1.c
tools/testing/selftests/bpf/progs/linked_funcs2.c