From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org
Cc: schwab@linux-m68k.org
Subject: [PATCH v3] ld: Support LD_UNDER_TEST environment variable
Date: Sat, 16 Mar 2024 09:42:43 -0700 [thread overview]
Message-ID: <20240316164243.410885-1-hjl.tools@gmail.com> (raw)
Support LD_UNDER_TEST environment variable to test a different linker.
Issue an error if LD_UNDER_TEST isn't an absolute full path.
* testsuite/config/default.exp: If LD_UNDER_TEST environment
variable exists, set ld and LD to it and set up tmpdir/ld/ld.
Issue an error if LD_UNDER_TEST isn't an absolute full path.
---
ld/testsuite/config/default.exp | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index 705543054c2..0ce81e13784 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -21,6 +21,18 @@
# Written by Jeffrey Wheat (cassidy@cygnus.com)
#
+if [info exists env(LD_UNDER_TEST)] {
+ # LD_UNDER_TEST must be an absolute full path.
+ if {[file pathtype $env(LD_UNDER_TEST)] ne "absolute"} {
+ perror "**************************************************"
+ perror "$env(LD_UNDER_TEST) isn't an absolute full path."
+ perror "**************************************************"
+ exit 1
+ }
+ set ld "$env(LD_UNDER_TEST)"
+ set LD "$ld"
+}
+
if ![info exists ld] then {
set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
}
@@ -64,9 +76,16 @@ remote_exec host "mkdir -p tmpdir"
if {[info exists ld_testsuite_bindir]} {
set gcc_B_opt "-B$ld_testsuite_bindir/"
} else {
+ # Delete tmpdir/ld first to remove tmpdir/ld/ld created by the
+ # previous LD_UNDER_TEST runs.
+ file delete -force tmpdir/ld
if {![file isdirectory tmpdir/ld]} then {
catch "exec mkdir tmpdir/ld" status
- catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
+ if [info exists env(LD_UNDER_TEST)] {
+ catch "exec ln -s $env(LD_UNDER_TEST) tmpdir/ld/ld" status
+ } else {
+ 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
}
--
2.44.0
reply other threads:[~2024-03-16 16:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240316164243.410885-1-hjl.tools@gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).