Currently, if `bpftool gen object` tries to link two objects that contains the same extern function prototype, libbpf will try to get their (non-existent) size by calling bpf__resolve_size like extern variables and fail with: libbpf: global 'whatever': failed to resolve size of underlying type: -22 This should not be the case, and this series adds conditions to update size only when the BTF kind is not function. Fixes: a46349227cd8 ("libbpf: Add linker extern resolution support for functions and global variables") Signed-off-by: Eric Long <i@xxxxxxxxxx> --- Eric Long (2): libbpf: do not resolve size on duplicate FUNCs selftests/bpf: make sure linking objects with duplicate extern functions doesn't fail tools/lib/bpf/linker.c | 24 +++++++++++++--------- tools/testing/selftests/bpf/Makefile | 3 ++- .../selftests/bpf/prog_tests/dup_extern_funcs.c | 9 ++++++++ .../selftests/bpf/progs/dup_extern_funcs1.c | 20 ++++++++++++++++++ .../selftests/bpf/progs/dup_extern_funcs2.c | 18 ++++++++++++++++ 5 files changed, 63 insertions(+), 11 deletions(-) --- base-commit: 93eeaab4563cc7fc0309bc1c4d301139762bbd60 change-id: 20240929-libbpf-dup-extern-funcs-871f4bad2122 Best regards, -- Eric Long <i@xxxxxxxxxx>