public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ld/testsuite: skip bootstrap.exp when OFILES are missing
@ 2022-09-15  8:50 Clément Chigot
  2022-09-15  8:50 ` [PATCH 2/2] ld/testsuite: allow to force another directory for gcc linker Clément Chigot
  2022-09-20 16:31 ` [PATCH 1/2] ld/testsuite: skip bootstrap.exp when OFILES are missing Nick Clifton
  0 siblings, 2 replies; 4+ messages in thread
From: Clément Chigot @ 2022-09-15  8:50 UTC (permalink / raw)
  To: binutils; +Cc: Clément Chigot

OFILES are normally provided through an environment variable set by
Makefiles. However, when launching the testsuite directly through
runtest outside the build tree, it can be hard to retrieve them.
Thus, they can be missing.
Instead of letting tcl raise an error when trying to access this
OFILES variable, skip bootstrap.exp if it doesn't exist.

ld/ChangeLog:

	* testsuite/ld-bootstrap/bootstrap.exp: Skip if OFILES is
	missing
---
 ld/testsuite/ld-bootstrap/bootstrap.exp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp
index f6d38af5d40..52a91fc554e 100644
--- a/ld/testsuite/ld-bootstrap/bootstrap.exp
+++ b/ld/testsuite/ld-bootstrap/bootstrap.exp
@@ -29,6 +29,12 @@ if ![isnative] {
     return
 }
 
+# Skip if OFILES aren't provided, it can happen when lauching
+# the testsuites outside the build directory.
+if {![info exists OFILES]} {
+    return
+}
+
 # Skip for -fprofile-generate=.
 catch "exec $nm $plug_opt $OFILES" exec_output
 send_log "foo: $exec_output"
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ld/testsuite: allow to force another directory for gcc linker
  2022-09-15  8:50 [PATCH 1/2] ld/testsuite: skip bootstrap.exp when OFILES are missing Clément Chigot
@ 2022-09-15  8:50 ` Clément Chigot
  2022-09-20 16:32   ` Nick Clifton
  2022-09-20 16:31 ` [PATCH 1/2] ld/testsuite: skip bootstrap.exp when OFILES are missing Nick Clifton
  1 sibling, 1 reply; 4+ messages in thread
From: Clément Chigot @ 2022-09-15  8:50 UTC (permalink / raw)
  To: binutils; +Cc: Clément Chigot

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.
---
 ld/testsuite/config/default.exp | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index 103b426bbd8..c1175c42760 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 ""
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ld/testsuite: skip bootstrap.exp when OFILES are missing
  2022-09-15  8:50 [PATCH 1/2] ld/testsuite: skip bootstrap.exp when OFILES are missing Clément Chigot
  2022-09-15  8:50 ` [PATCH 2/2] ld/testsuite: allow to force another directory for gcc linker Clément Chigot
@ 2022-09-20 16:31 ` Nick Clifton
  1 sibling, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2022-09-20 16:31 UTC (permalink / raw)
  To: Clément Chigot, binutils

Hi Clément,

> ld/ChangeLog:
> 
> 	* testsuite/ld-bootstrap/bootstrap.exp: Skip if OFILES is
> 	missing

Approved - please apply.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ld/testsuite: allow to force another directory for gcc linker
  2022-09-15  8:50 ` [PATCH 2/2] ld/testsuite: allow to force another directory for gcc linker Clément Chigot
@ 2022-09-20 16:32   ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2022-09-20 16:32 UTC (permalink / raw)
  To: Clément Chigot, binutils

Hi Clément,

> ld/ChangeLog:
> 
> 	* testsuite/config/default.exp: Allow to change -B flag with
> 	ld_testsuite_bindir variable.

Approved - please apply.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-20 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15  8:50 [PATCH 1/2] ld/testsuite: skip bootstrap.exp when OFILES are missing Clément Chigot
2022-09-15  8:50 ` [PATCH 2/2] ld/testsuite: allow to force another directory for gcc linker Clément Chigot
2022-09-20 16:32   ` Nick Clifton
2022-09-20 16:31 ` [PATCH 1/2] ld/testsuite: skip bootstrap.exp when OFILES are missing Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).