commit b4d06b0e6b23ba1c8e9beb2984cd60d3a2b9b0ba
parent 0020b5f053b3a35f58311f7b21268d108ad774c4
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Wed, 27 May 2026 12:16:24 -0700
test: depend on cross-target rt archive for JIT-path harnesses
The parse/asm/macho harnesses link the JIT against the linux rt archive
matching CFREE_TEST_ARCH (default aa64 -> aarch64-linux), but test-parse-ok
depended on the native `rt` target (host variant only) and test-asm/test-macho
had no rt dep at all. On a host whose native variant differs from the test
target, the archive was absent, so the JIT linker couldn't resolve
compiler-rt-style helpers (e.g. __cfree_sext64ti for __int128) and every case
needing them failed with an undefined reference.
Add a CFREE_TEST_ARCH -> rt-<triple> mapping (mirroring the _LIBC_RT_* pattern,
including the aliases run.sh accepts) and depend on $(TEST_RT_DEP) from all
three JIT-path harnesses.
Diffstat:
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/test/test.mk b/test/test.mk
@@ -480,10 +480,26 @@ test-coff-mingw-import: lib $(COFF_IMPORT_MINGW_BIN)
test-coff-windows-ucrt: bin rt-aarch64-windows
bash test/coff/windows-ucrt-hosted-smoke.sh
+# The parse/asm/macho harnesses select a cross-target via CFREE_TEST_ARCH (default
+# aa64; values aa64/x64/rv64 plus the aliases run.sh accepts). The JIT path (J)
+# links the matching linux rt archive to resolve compiler-rt-style helpers
+# (e.g. __cfree_sext64ti for __int128), so depend on that variant rather than
+# the native `rt` target, which builds only the host's own variant.
+CFREE_TEST_ARCH ?= aa64
+_TEST_RT_aa64 = rt-aarch64-linux
+_TEST_RT_aarch64 = rt-aarch64-linux
+_TEST_RT_arm64 = rt-aarch64-linux
+_TEST_RT_x64 = rt-x86_64-linux
+_TEST_RT_x86_64 = rt-x86_64-linux
+_TEST_RT_amd64 = rt-x86_64-linux
+_TEST_RT_rv64 = rt-riscv64-linux
+_TEST_RT_riscv64 = rt-riscv64-linux
+TEST_RT_DEP = $(_TEST_RT_$(CFREE_TEST_ARCH))
+
test-link: lib $(ROUNDTRIP_BIN) $(ROUNDTRIP_BIN_MACHO) $(LINK_EXE_RUNNER) $(JIT_RUNNER)
bash test/link/run.sh
-test-macho: lib $(ROUNDTRIP_BIN_MACHO) $(LINK_EXE_RUNNER) $(JIT_RUNNER)
+test-macho: lib $(TEST_RT_DEP) $(ROUNDTRIP_BIN_MACHO) $(LINK_EXE_RUNNER) $(JIT_RUNNER)
CFREE_TEST_OBJ=macho \
CFREE_TEST_ARCH=$${CFREE_TEST_ARCH:-aa64} \
CFREE_TEST_PATHS=$${CFREE_TEST_PATHS:-RJ} \
@@ -501,7 +517,7 @@ $(OPT_TEST_BIN): test/opt/cg_ir_lower_test.c $(LIB_OBJS)
test-parse: test-parse-ok test-parse-err
-test-parse-ok: lib rt $(PARSE_RUNNER) $(ROUNDTRIP_BIN) $(LINK_EXE_RUNNER) $(JIT_RUNNER)
+test-parse-ok: lib $(TEST_RT_DEP) $(PARSE_RUNNER) $(ROUNDTRIP_BIN) $(LINK_EXE_RUNNER) $(JIT_RUNNER)
bash test/parse/run.sh
test-parse-err: lib $(PARSE_RUNNER)
@@ -509,7 +525,7 @@ test-parse-err: lib $(PARSE_RUNNER)
# test-asm: the Makefile owns harness binaries so they inherit host flags
# consistently with the rest of the test suite.
-test-asm: lib $(ASM_RUNNER) $(LINK_EXE_RUNNER) $(JIT_RUNNER)
+test-asm: lib $(TEST_RT_DEP) $(ASM_RUNNER) $(LINK_EXE_RUNNER) $(JIT_RUNNER)
bash test/asm/run.sh
test-wasm: test-wasm-front test-wasm-target test-wasm-toy