public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v6 08/11] selftests/bpf: Allow test_progs to link with a partial object set
Date: Thu, 16 Apr 2026 18:11:03 +0000	[thread overview]
Message-ID: <20260416181103.B8090C2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260416-selftests-bpf_misconfig-v6-8-7efeab504af1@suse.com>

Sashiko AI review found 2 potential issue(s):
- [Medium] In permissive mode, moving test objects to order-only prerequisites breaks incremental builds.
- [Low] In the default non-permissive mode, the linker command duplicates all test object files, causing 'multiple definition' linker errors.
--

commit 9ee39343705c1b6b0ebaf3f229944fadafcd695b
Author: Ricardo B. Marlière <rbm@suse.com>

selftests/bpf: Allow test_progs to link with a partial object set

This commit modifies the Makefile to support a PERMISSIVE mode, shifting
TRUNNER_TEST_OBJS to an order-only prerequisite when enabled. It also alters
the linker command to filter built objects.

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 5ad50d3ff2f8c..79991dc98ddda 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
[ ... ]
> @@ -758,14 +758,15 @@ endif
>  # some X.test.o files have runtime dependencies on Y.bpf.o files
>  $(OUTPUT)/$(TRUNNER_BINARY): | $(TRUNNER_BPF_OBJS)
>  
> -$(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS)			\
> +$(OUTPUT)/$(TRUNNER_BINARY): $(if $(PERMISSIVE),,$(TRUNNER_TEST_OBJS))	\
>  			     $(TRUNNER_EXTRA_OBJS) $$(BPFOBJ)		\
>  			     $(TRUNNER_LIB_OBJS)			\
>  			     $(TRUNNER_BPFTOOL)				\
>  			     $(OUTPUT)/veristat				\
> -			     | $(TRUNNER_BINARY)-extras
> +			     | $(TRUNNER_BINARY)-extras			\
> +			     $(if $(PERMISSIVE),$(TRUNNER_TEST_OBJS))

When PERMISSIVE is set, $(TRUNNER_TEST_OBJS) are moved exclusively to the
order-only prerequisites list.

Since order-only prerequisites do not trigger a rebuild if they are newer than
the target, could this regression break incremental builds? If a test C file
is modified, the .test.o object file will be properly recompiled, but it
appears the test binary will not be relinked because none of its normal
prerequisites have changed.

>  	$$(call msg,BINARY,,$$@)
> -	$(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 $$@

When PERMISSIVE is empty (the default behavior), $(TRUNNER_TEST_OBJS) is added
as a normal prerequisite, appearing at the beginning of the $$^ variable.

The modified recipe prepends $(TRUNNER_TEST_OBJS) to $$^ in the filter
command, making the expression evaluate to:

$$(filter %.a %.o, $(TRUNNER_TEST_OBJS) $$^)

Because Make's filter function retains all matched words and does not
deduplicate them, will this regression pass every .test.o file twice to the
linker and cause multiple definition errors?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260416-selftests-bpf_misconfig-v6-0-7efeab504af1@suse.com?part=8

  parent reply	other threads:[~2026-04-16 18:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16 12:21 [PATCH bpf-next v6 00/11] selftests/bpf: Tolerate partial builds across kernel configs Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 01/11] selftests/bpf: Add BPF_STRICT_BUILD toggle Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels Ricardo B. Marlière
2026-04-16 12:53   ` sashiko-bot
2026-04-16 12:21 ` [PATCH bpf-next v6 03/11] selftests/bpf: Tolerate BPF and skeleton generation failures Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 04/11] selftests/bpf: Avoid rebuilds when running emit_tests Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 05/11] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 06/11] selftests/bpf: Tolerate test file compilation failures Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 07/11] selftests/bpf: Skip tests whose objects were not built Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 08/11] selftests/bpf: Allow test_progs to link with a partial object set Ricardo B. Marlière
2026-04-16 13:03   ` bot+bpf-ci
2026-04-16 18:11   ` sashiko-bot [this message]
2026-04-16 12:21 ` [PATCH bpf-next v6 09/11] selftests/bpf: Tolerate benchmark build failures Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 10/11] selftests/bpf: Provide weak definitions for cross-test functions Ricardo B. Marlière
2026-04-16 12:21 ` [PATCH bpf-next v6 11/11] selftests/bpf: Tolerate missing files during install Ricardo B. Marlière

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260416181103.B8090C2BCAF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=rbm@suse.com \
    --cc=sashiko@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox