aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorClément Chigot <chigot@adacore.com>2022-09-14 15:53:18 +0200
committerClément Chigot <chigot@adacore.com>2022-09-22 09:23:18 +0200
commitb59f8a90ba0866a8605106fdb09389833c7fe8ad (patch)
treeddd8d0259c67918a09017ec8ff4cad17bf2ebdc9 /ld
parent3581ae2d450f2c885d9d964668b56ba0cffc83fa (diff)
downloadgdb-b59f8a90ba0866a8605106fdb09389833c7fe8ad.zip
gdb-b59f8a90ba0866a8605106fdb09389833c7fe8ad.tar.gz
gdb-b59f8a90ba0866a8605106fdb09389833c7fe8ad.tar.bz2
ld/testsuite: allow to force another directory for gcc linker
Add a new variable "ld_testsuite_tmpdir" to enable manual configuration of the -B flag added to gcc calls. This flag ensure that gcc is invoking the linker and the assembler we want to test. When launching the testsuite outside of the build tree, the links made by the testsuite in tmpdir/ld will point to nothing. Thus, even with the PATH correctly setup towards the linker directory, gcc might end up falling back to its default linker. Hence this variable to ensure that gcc, whatever happens, is using the linker we want. ld/ChangeLog: * testsuite/config/default.exp: Allow to change -B flag with ld_testsuite_bindir variable.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/config/default.exp23
1 files changed, 15 insertions, 8 deletions
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index 103b426..c1175c4 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -57,14 +57,21 @@ remote_exec host "mkdir -p tmpdir"
# Make symlinks from tmpdir/ld to the linker and assembler in the
# build tree, so that we can use a -B option to gcc to force it to use
-# the newly built linker and assembler.
-if {![file isdirectory tmpdir/ld]} then {
- catch "exec mkdir tmpdir/ld" status
- catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
- catch "exec ln -s ld tmpdir/ld/collect-ld" status
- catch "exec ln -s ../../../gas/as-new tmpdir/ld/as" status
-}
-set gcc_B_opt "-B[pwd]/tmpdir/ld/"
+# the newly built linker and assembler.
+# The variable ld_testsuite_bindir allows to provide another directory
+# for -B option. This can be useful when launching the testsuite outside
+# the build tree as the symlinks will be wrong in this case.
+if {[info exists ld_testsuite_bindir]} {
+ set gcc_B_opt "-B$ld_testsuite_bindir/"
+} else {
+ if {![file isdirectory tmpdir/ld]} then {
+ catch "exec mkdir tmpdir/ld" status
+ catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
+ catch "exec ln -s ld tmpdir/ld/collect-ld" status
+ catch "exec ln -s ../../../gas/as-new tmpdir/ld/as" status
+ }
+ set gcc_B_opt "-B[pwd]/tmpdir/ld/"
+}
# load the linker path
set ld_L_opt ""