aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2023-06-28 01:25:55 -0300
committerAlexandre Oliva <oliva@gnu.org>2023-06-28 01:25:55 -0300
commita6065b9cbcde458dd944392ea259e5e1114d2b16 (patch)
tree7bb7f1cc8155e04753fe1e2d4fbebc4fe95a5db0
parenta1c6e9631ca33990a2b7411060ca4d18db081a7d (diff)
downloadgcc-a6065b9cbcde458dd944392ea259e5e1114d2b16.zip
gcc-a6065b9cbcde458dd944392ea259e5e1114d2b16.tar.gz
gcc-a6065b9cbcde458dd944392ea259e5e1114d2b16.tar.bz2
[testsuite] note pitfall in how outputs.exp sets gld
This patch documents a glitch in gcc.misc-tests/outputs.exp: it checks whether the linker is GNU ld, and uses that to decide whether to expect collect2 to create .ld1_args files under -save-temps, but collect2 bases that decision on whether HAVE_GNU_LD is set, which may be false zero if the linker in use is GNU ld. Configuring --with-gnu-ld fixes this misalignment. Without that, atsave tests are likely to fail, because without HAVE_GNU_LD, collect2 won't use @file syntax to run the linker (so it won't create .ld1_args files). Long version: HAVE_GNU_LD is set when (i) DEFAULT_LINKER is set during configure, pointing at GNU ld; (ii) --with-gnu-ld is passed to configure; or (iii) config.gcc sets gnu_ld=yes. If a port doesn't set gnu_ld, and the toolchain isn't configured so as to assume GNU ld, configure and thus collect2 conservatively assume the linker doesn't support @file arguments. But outputs.exp can't see how configure set HAVE_GNU_LD (it may be used to test an installed compiler), and upon finding that the linker used by the compiler is GNU ld, it will expect collect2 to use @file arguments when running the linker. If that assumption doesn't hold, atsave tests will fail. for gcc/testsuite/ChangeLog * gcc.misc-tests/outputs.exp (gld): Note a known mismatch and record a workaround.
-rw-r--r--gcc/testsuite/gcc.misc-tests/outputs.exp10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp
index 7ee3550..9f44cbd 100644
--- a/gcc/testsuite/gcc.misc-tests/outputs.exp
+++ b/gcc/testsuite/gcc.misc-tests/outputs.exp
@@ -50,7 +50,15 @@ if !$skip_lto {
set ltop [check_linker_plugin_available]
}
-# Check for GNU LD. Some files like .ld1_args depend on this.
+# Check for GNU LD. Some files like .ld1_args depend on this. This
+# should really be testing whether HAVE_GNU_LD was set by configure.
+# If we find GNU ld here, but the compiler wasn't configured
+# --with-gnu-ld or with DEFAULT_LINKER pointing at GNU ld, on a target
+# that doesn't set gnu_ld=yes unconditionally, configure and thus
+# collect2 will conservatively assume there's no support for @file in
+# the linker, but our atfile tests will expect ld1_args files to be
+# created, and thus fail. Configuring the compiler --with-gnu-ld
+# fixes this.
set gld [check_effective_target_gld]
# Prepare additional options to be used for linking.