[PATCH v5 1/6] selftests/x86: fix Makefile dependencies

From: Bill Roberts

Date: Mon Nov 09 2026 - 13:36:40 EST


The amx_64, avx_64, and apx_64 tests compile xstate.c as an
additional source file. However, their Makefile rules add xstate.c
directly to EXTRA_FILES without registering it as a prerequisite.

As a result, modifying xstate.c does not trigger a rebuild of the
affected test binaries, potentially leaving stale test executables.

Use the existing extra-files macro to register xstate.c as both
an additional compilation input and a build dependency.

Signed-off-by: Bill Roberts <bill.roberts@xxxxxxx>
---
tools/testing/selftests/x86/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 7565d2cf6a3c..407f52ac2628 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -125,6 +125,9 @@ $(eval $(call extra-files,test_syscall_vdso_32,thunks_32.S))
$(eval $(call extra-files,fsgsbase_restore_64,clang_helpers_64.S))
$(eval $(call extra-files,fsgsbase_restore_32,clang_helpers_32.S))
$(eval $(call extra-files,sysret_rip_64,clang_helpers_64.S))
+$(eval $(call extra-files,amx_64,xstate.c))
+$(eval $(call extra-files,avx_64,xstate.c))
+$(eval $(call extra-files,apx_64,xstate.c))

# check_initial_reg_state is special: it needs a custom entry, and it
# needs to be static so that its interpreter doesn't destroy its initial
@@ -136,8 +139,5 @@ $(OUTPUT)/nx_stack_32: CFLAGS += -Wl,-z,noexecstack
$(OUTPUT)/nx_stack_64: CFLAGS += -Wl,-z,noexecstack

$(OUTPUT)/avx_64: CFLAGS += -mno-avx -mno-avx512f
-$(OUTPUT)/amx_64: EXTRA_FILES += xstate.c
-$(OUTPUT)/avx_64: EXTRA_FILES += xstate.c
-$(OUTPUT)/apx_64: EXTRA_FILES += xstate.c

$(OUTPUT)/sigframe_fpu_portability_64: CFLAGS += -mno-avx -mno-avx512f
--
2.55.0