Re: [PATCH bpf-next v6 08/11] selftests/bpf: Allow test_progs to link with a partial object set
From: bot+bpf-ci
Date: Thu Apr 16 2026 - 09:06:13 EST
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 5ad50d3ff2f8..79991dc98ddd 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
[ ... ]
> -$(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS) \
> +$(OUTPUT)/$(TRUNNER_BINARY): $(if $(PERMISSIVE),,$(TRUNNER_TEST_OBJS)) \
> $(TRUNNER_EXTRA_OBJS) $$(BPFOBJ) \
[ ... ]
> - $(Q)$$(CC) $$(CFLAGS) $$(filter %.a %.o,$$^) $$(LDLIBS) $$(LLVM_LDLIBS) $$(LDFLAGS) $$(LLVM_LDFLAGS) -o $$@
> + $(Q)$$(CC) $$(CFLAGS) $$(filter %.a %.o,$(if $(PERMISSIVE),$$(wildcard $(TRUNNER_TEST_OBJS)),$(TRUNNER_TEST_OBJS)) $$^) $$(LDLIBS) $$(LLVM_LDLIBS) $$(LDFLAGS) $$(LLVM_LDFLAGS) -o $$@
Does this duplicate every test object on the linker command line in
the default (non-PERMISSIVE) build?
When PERMISSIVE is not set, the $(if) on the prerequisite line
resolves to $(TRUNNER_TEST_OBJS), keeping them as normal
prerequisites. That means $^ already contains all test objects.
The $(if) in the recipe also resolves to $(TRUNNER_TEST_OBJS),
which is prepended before $$^. After expansion, the $(filter)
input becomes:
$(TRUNNER_TEST_OBJS) $^
^^^^^^^^^^^^^^^^^^^^^
already present in $^ as normal prerequisites
$(filter) does not deduplicate, so every .test.o file appears
twice in the linker arguments. With the default BPF_STRICT_BUILD=1
this would cause "multiple definition" errors from the linker for
all test entry points (test_arena_atomics, test_ringbuf, etc.).
The PERMISSIVE path looks correct because test objects are
order-only there and are excluded from $^, so the
$(wildcard ...) expansion is the only source.
One possible fix would be to omit the explicit
$(TRUNNER_TEST_OBJS) from the filter text in the non-PERMISSIVE
case, since $^ already carries them in the right order:
$(filter %.a %.o,$(if $(PERMISSIVE),$(wildcard $(TRUNNER_TEST_OBJS))) $^)
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/24510378997