From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC6D139EF11 for ; Tue, 28 Apr 2026 23:45:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777419953; cv=none; b=QQDZ5RCyL3LKs87ndukfLvluPOFOwv1hPiXJ70W0u6cNwPA0Fzl21G8BUJwA4X0jyDjKb7l1J796MunFoIzBZYWmCZgi9dOZhOrX6eSiB19eQPVtxPFXpNYaIxL6cz9QQzm+e+e4mJfXYrOr1aR7ApYNJUOK4SwAwUIY3wdOFNg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777419953; c=relaxed/simple; bh=bp6nwxzrFREUgn01pCEsReac6kfcDYuXiYr9ESZXpIc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gkVX5PGDXq3kShjWsEcfkN76GBqC/6JpyF0yColwRmLBdLKWvLd7cvRjfbn5zGXAIk+sOVZmzuYKoWPH20+0h2unhMdwjmFaJ3M0uHDd1GUszrIhnmwZ3LeA9dqD+5O/J1Yrabh7nymp/axLsdm+FVEtFlWc1ZXyyLnC/4cwdrg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=DJ10wR5y; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="DJ10wR5y" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-48334ee0aeaso123492535e9.1 for ; Tue, 28 Apr 2026 16:45:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1777419950; x=1778024750; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6hdu595jYeB1D4K1cw+a/FSX5Nhp2ZnO92G/7aUFiPw=; b=DJ10wR5yT1PwTWCFYOwseh7crUIJ38vKaGLIi1g2W+5CSnE3FtZfEfk7p0KIf2SQSk 9VXfdLyD3dgifX/YhmrH5hcEO5AEKxUPCexxx48YEmia+ExBkn+yA8TcNG9OMNsTbpGV cA+Fj++xhwZHjoIgPB6yq9siHtgtiWNqiETX4PI9dM2U9xbFADsi4JWfQt3SLJ+N8ie1 ToIWM2/B2qWeOZqBVcCF8JHewmn/Hs//0qb6/8ixJOeONjaJzmvVzMEuxb8VeKTsFhwM k0dQlXavw5/OIQ4cK4uSEVr4bOR+hGdak2/9XPAa5IyI6wkAdiCWcF1M6aBhipE03FBL taOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777419950; x=1778024750; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6hdu595jYeB1D4K1cw+a/FSX5Nhp2ZnO92G/7aUFiPw=; b=WY2APmb+XuF/h77kV+3uJ7QISuNDorA3+dwrqPdxp3BhQ7vJNzO1ncga1bunAfZ6sx KziK6MMBrk9oYucLpQPfNBsFfOfR7z23Y0YXVteh2OZmaAuQf0PcTur8Xka0jrtBth4G twqwnzk+u6cxeIdXz3HisyiXa9KZRAb/bbQZBv5F6hWOcnEPdYqGmKuDkJt3+6gJLfqI 8vDCVuga0stsQdA8pwEk2nZHjLqdX8mtPAsifZj4NM67aA2iy+KpL1BSTuzjHg9GSAYP eojqqE/nYOLYDR2DDeobU14WFXcnVFlPpejF8JIpaBMlh+WDl1FrTtYWhGk12+l576Ut 9GEQ== X-Forwarded-Encrypted: i=1; AFNElJ9aY8FFWFpo6Jb8SK9XrGOESnyL/fOxKPWa4Mw3TdakFFPKYyhTwfMsWzAm8bQ26RnCpEixdXQybn+AEfc=@vger.kernel.org X-Gm-Message-State: AOJu0YyO+glfVCvbaQ4l0bJDcEnvvKXo0cKDORrfUCbmBU8m1wwpbaKq puKBvGJcNGQKq9GQWtu6Q4yWj7ZVr9zVXTU9ZqGtuxudW9Lsc9pNNwdiRbVJFBergnE= X-Gm-Gg: AeBDieupc90JBAkHNiE4D5EjHP3zRhcEvryMsMezV+fEn35DJYlMqTighSzvxACfoDE 4hgzLq/77o7wwLMuGhpG2MOC6JIhQ2vcKzvzkbDLWi6oKQBsc+68c4vMKroNt6wZq2ZILlWO1xk 7ennVP/5yPoZmGVtu+YiZk2gKA6eZPtwIp1YxvHa72Q/eQzfsUIwONBbCfvGbECN01WzuHmI1l2 I3ykgugebdtdOYpeNaZoiNdBVTgJIn2+zNTa4OSvM4XJho/eL46QRVHfmz9+rC/NKx9n6jf0dWs rDxP5dqHJ7O/sR0Vpn6fTI99QEAX+fkJPzLS41FmfoRQz/nTK7tFA+6/hzigT+7G06bJFAcdEBR CqWm2aSEdY5ZhC8LWQ9/Qvd5SC9BKzqazWgUpbF3uvolqqv8VkYQwy+hjBQUjwqwo2yolA/rWhT 4WLHGHtKZuWDIMwPm5kEQ8bLh8zX32H6/1A8k= X-Received: by 2002:a05:600c:828c:b0:489:1ca2:eafd with SMTP id 5b1f17b1804b1-48a7b51bcf7mr25090455e9.11.1777419950411; Tue, 28 Apr 2026 16:45:50 -0700 (PDT) Received: from localhost ([2804:7f0:b765:105d:ce28:aaff:fe86:149c]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-95cb7831df4sm131316241.12.2026.04.28.16.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2026 16:45:48 -0700 (PDT) From: =?utf-8?q?Ricardo_B=2E_Marli=C3=A8re?= Date: Tue, 28 Apr 2026 20:45:09 -0300 Subject: [PATCH bpf-next v8 08/11] selftests/bpf: Allow test_progs to link with a partial object set Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20260428-selftests-bpf_misconfig-v8-8-bf02cf97dbcb@suse.com> References: <20260428-selftests-bpf_misconfig-v8-0-bf02cf97dbcb@suse.com> In-Reply-To: <20260428-selftests-bpf_misconfig-v8-0-bf02cf97dbcb@suse.com> To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Alan Maguire , "Ricardo B. Marliere" X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openssh-sha256; t=1777419912; l=3164; i=rbm@suse.com; h=from:subject:message-id; bh=bp6nwxzrFREUgn01pCEsReac6kfcDYuXiYr9ESZXpIc=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgguRCc5X8/UX9M40lkMnr//aFGOhce x5ezt8MFNUFlqYAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QI0hxMH5mboGWDH9N3nD/FcQJitJcEB3D5vN43cKT82ONg6T2bIh0WA3f2tOXEcc0QmwtCIFLlr kbZw83cM8Bwo= X-Developer-Key: i=rbm@suse.com; a=openssh; fpr=SHA256:pzhe0fJpYLz+3cZ33FFPhIfaUElk9CXPFFXmalIH+1g When individual test files are skipped due to compilation failures, their .test.o files are absent. The linker step currently lists all expected .test.o files as explicit prerequisites, so make considers any missing one an error. In permissive mode, declare the test objects that already exist on disk (via parse-time $(wildcard ...)) as normal prerequisites of the binary so that modifications to a test source still trigger a relink, and keep the full TRUNNER_TEST_OBJS list as order-only prerequisites so that initial fresh builds still produce them and missing objects do not abort the link. The recipe filter is split per mode: in permissive mode it combines a recipe-time $(wildcard ...) (which catches objects freshly produced via the order-only path on a fresh build) with $(filter-out $(TRUNNER_TEST_OBJS),$^) (which keeps the non-test inputs from $^ but drops the parse-time wildcard duplicates). This avoids passing the same .test.o twice to the linker while still presenting test objects before libbpf.a so that GNU ld, which scans static archives left-to-right, pulls in archive members referenced exclusively by test objects (e.g. ring_buffer__new from ringbuf.c). In default (strict) mode the recipe remains the simple $(filter %.a %.o,$^) since TRUNNER_TEST_OBJS is part of $^ exactly once. Note: adding a brand-new test_*.c file in permissive mode requires removing the binary (or a clean rebuild) before the new test is linked in, because the parse-time $(wildcard ...) is evaluated when the Makefile is read and will not yet see the new .test.o. This is acceptable since permissive mode targets tolerant CI builds rather than incremental development. Signed-off-by: Ricardo B. Marlière --- tools/testing/selftests/bpf/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index f0545ee6b32a..9a5177455f0a 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -767,14 +767,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),$$(wildcard $(TRUNNER_TEST_OBJS)),$(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)) $$(call msg,BINARY,,$$@) - $(Q)$$(CC) $$(CFLAGS) $$(filter %.a %.o,$$^) $$(LDLIBS) $$(LLVM_LDLIBS) $$(LDFLAGS) $$(LLVM_LDFLAGS) -o $$@ + $(Q)$$(CC) $$(CFLAGS) $(if $(PERMISSIVE),$$(filter %.a %.o,$$(wildcard $(TRUNNER_TEST_OBJS)) $$(filter-out $(TRUNNER_TEST_OBJS),$$^)),$$(filter %.a %.o,$$^)) $$(LDLIBS) $$(LLVM_LDLIBS) $$(LDFLAGS) $$(LLVM_LDFLAGS) -o $$@ $(Q)ln -sf $(if $2,..,.)/tools/build/bpftool/$(USE_BOOTSTRAP)bpftool \ $(OUTPUT)/$(if $2,$2/)bpftool -- 2.54.0