[PATCH] Makerules: run test-container helper through the built loader

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Jul 1 13:40:04 GMT 2026


The tests-container rule launches support/test-container, which is always
dynamically linked, through $(test-via-rtld-prefix).  That prefix is empty
for tests listed in tests-static/xtests-static, so for a static container
test the helper ran under the system loader/libc instead of the newly
built one.
---
 Makeconfig | 9 +++++++++
 Rules      | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Makeconfig b/Makeconfig
index 8fe7217dd7c..da0172a6e5f 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -815,8 +815,15 @@ $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
 run-via-rtld-prefix =							      \
   $(if $(strip $(filter $(notdir $(built-program-file)),		      \
 			$(tests-static) $(xtests-static))),, $(rtld-prefix))
+# $(container-via-rtld-prefix) is like $(run-via-rtld-prefix), but for the
+# support/test-container helper, which is always dynamically linked even
+# when the test it launches is static.  It must therefore always run
+# through the newly built loader, unlike $(run-via-rtld-prefix) which is
+# empty for tests listed in tests-static or xtests-static.
+container-via-rtld-prefix = $(rtld-prefix)
 else
 run-via-rtld-prefix =
+container-via-rtld-prefix =
 endif
 # $(run-program-env) is the default environment variable settings to
 # use when running a program built with the newly built library.
@@ -883,6 +890,7 @@ endif
 
 ifeq (yes,$(build-hardcoded-path-in-tests))
 test-via-rtld-prefix =
+test-container-via-rtld-prefix =
 test-program-prefix-before-env = $(test-wrapper-env)
 test-program-prefix-after-env =
 test-program-prefix = $(test-program-prefix-before-env) $(run-program-env) \
@@ -894,6 +902,7 @@ test-program-cmd = $(test-program-cmd-before-env) $(run-program-env) \
 host-test-program-cmd = $(built-program-file)
 else
 test-via-rtld-prefix = $(run-via-rtld-prefix)
+test-container-via-rtld-prefix = $(container-via-rtld-prefix)
 test-program-prefix-before-env = $(run-program-prefix-before-env)
 test-program-prefix-after-env = $(run-program-prefix-after-env)
 test-program-prefix = $(run-program-prefix)
diff --git a/Rules b/Rules
index 385246f07df..736edf46d80 100644
--- a/Rules
+++ b/Rules
@@ -413,7 +413,7 @@ $(objpfx)%.out: /dev/null $(objpfx)%	# Make it 2nd arg for canned sequence.
 # and pid namespaces) in which to run, should be added to
 # tests-container.
 $(tests-container:%=$(objpfx)%.out): $(objpfx)%.out : $(if $(wildcard $(objpfx)%.files),$(objpfx)%.files,/dev/null) $(objpfx)%
-	$(test-wrapper-env) $(run-program-env) $(test-via-rtld-prefix) \
+	$(test-wrapper-env) $(run-program-env) $(test-container-via-rtld-prefix) \
 	  $(common-objpfx)support/test-container env $(run-program-env) $($*-ENV) $(test-tunables) \
 	  $(host-test-program-cmd) $($*-ARGS) > $@; \
 	$(evaluate-test)
-- 
2.43.0



More information about the Libc-alpha mailing list