Hi Jason,

On 2025-09-17 12:32:09-0300, Jason Gunthorpe wrote:
> On Wed, Feb 26, 2025 at 12:44:55PM +0100, Thomas Weißschuh wrote:
> 
> > -$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.c
> > -$(OUTPUT)/vdso_standalone_test_x86: CFLAGS +=-nostdlib 
> > -fno-asynchronous-unwind-tables -fno-stack-protector
> > +$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c 
> > parse_vdso.c | headers
> > +$(OUTPUT)/vdso_standalone_test_x86: CFLAGS:=$(CFLAGS_NOLIBC) $(CFLAGS)
> 
> This addition of "| headers" breaks O=build builds. ie this:
> 
> $ make O=build-x86 allnoconfig -s -j 14
> $ make O=build-x86 -s -j 14
> $ make O=build-x86 kselftest-all -s -j 16 &> /dev/null || true
> $ make O=build-x86 -s -j 14
> 
> Fails with:
> 
> ***
> *** The source tree is not clean, please run 'make mrproper'
> *** in /home/jgg/oss/wip/kselftests_dirty
> ***
> 
> Because the build now spews stuff outside the build directory that it
> should not do.. Bisection points to this patch and removing the "|
> headers" makes it stop doing that..

Sorry for the breakage and thanks for the report.

> Any idea how to fix it?

Care to try this:

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 530390033929..a448fae57831 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -228,7 +228,10 @@ $(OUTPUT)/%:%.S
        $(LINK.S) $^ $(LDLIBS) -o $@
 endif

+# Extract the expected header directory
+khdr_output := $(patsubst %/usr/include,%,$(filter 
%/usr/include,$(KHDR_INCLUDES)))
+
 headers:
-       $(Q)$(MAKE) -C $(top_srcdir) headers
+       $(Q)$(MAKE) -f $(top_srcdir)/Makefile -C $(khdr_output) headers

 .PHONY: run_tests all clean install emit_tests gen_mods_dir clean_mods_dir 
headers


Thomas

Reply via email to