From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 3/3] eclass/tests/toolchain-funcs.sh: Handle missing ld.gold gracefully
Date: Sat, 8 Oct 2022 11:43:29 +0200 [thread overview]
Message-ID: <20221008094329.316318-4-mgorny@gentoo.org> (raw)
In-Reply-To: <20221008094329.316318-1-mgorny@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/tests/toolchain-funcs.sh | 64 +++++++++++++++++----------------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index d8a357fb24fe..08cfd74611aa 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -60,20 +60,22 @@ tbegin "tc-ld-is-gold (ld=bfd cc=bfd)"
LD=ld.bfd LDFLAGS=-fuse-ld=bfd tc-ld-is-gold && ret=1 || ret=0
tend ${ret}
-tbegin "tc-ld-is-gold (ld=gold cc=default)"
-LD=ld.gold tc-ld-is-gold
-ret=$?
-tend ${ret}
-
-tbegin "tc-ld-is-gold (ld=gold cc=bfd)"
-LD=ld.gold LDFLAGS=-fuse-ld=bfd tc-ld-is-gold
-ret=$?
-tend ${ret}
-
-tbegin "tc-ld-is-gold (ld=bfd cc=gold)"
-LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold
-ret=$?
-tend ${ret}
+if type -P ld.gold &>/dev/null; then
+ tbegin "tc-ld-is-gold (ld=gold cc=default)"
+ LD=ld.gold tc-ld-is-gold
+ ret=$?
+ tend ${ret}
+
+ tbegin "tc-ld-is-gold (ld=gold cc=bfd)"
+ LD=ld.gold LDFLAGS=-fuse-ld=bfd tc-ld-is-gold
+ ret=$?
+ tend ${ret}
+
+ tbegin "tc-ld-is-gold (ld=bfd cc=gold)"
+ LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold
+ ret=$?
+ tend ${ret}
+fi
#
# TEST: tc-ld-disable-gold
@@ -87,23 +89,25 @@ tc-ld-disable-gold
)
tend $?
-tbegin "tc-ld-disable-gold (ld=gold)"
-(
-export LD=ld.gold LDFLAGS=
-ewarn() { :; }
-tc-ld-disable-gold
-[[ ${LD} == "ld.bfd" || ${LDFLAGS} == *"-fuse-ld=bfd"* ]]
-)
-tend $?
+if type -P ld.gold &>/dev/null; then
+ tbegin "tc-ld-disable-gold (ld=gold)"
+ (
+ export LD=ld.gold LDFLAGS=
+ ewarn() { :; }
+ tc-ld-disable-gold
+ [[ ${LD} == "ld.bfd" || ${LDFLAGS} == *"-fuse-ld=bfd"* ]]
+ )
+ tend $?
-tbegin "tc-ld-disable-gold (cc=gold)"
-(
-export LD= LDFLAGS="-fuse-ld=gold"
-ewarn() { :; }
-tc-ld-disable-gold
-[[ ${LD} == *"/ld.bfd" || ${LDFLAGS} == "-fuse-ld=gold -fuse-ld=bfd" ]]
-)
-tend $?
+ tbegin "tc-ld-disable-gold (cc=gold)"
+ (
+ export LD= LDFLAGS="-fuse-ld=gold"
+ ewarn() { :; }
+ tc-ld-disable-gold
+ [[ ${LD} == *"/ld.bfd" || ${LDFLAGS} == "-fuse-ld=gold -fuse-ld=bfd" ]]
+ )
+ tend $?
+fi
unset CPP
--
2.38.0
next prev parent reply other threads:[~2022-10-08 9:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-08 9:43 [gentoo-dev] [PATCH 0/3] toolchain-funcs.eclass: support for querying C++ stdlib and compiler runtime Michał Górny
2022-10-08 9:43 ` [gentoo-dev] [PATCH 1/3] toolchain-funcs.eclass: Add tc-get-cxx-stdlib() to get C++ stdlib Michał Górny
2022-10-08 9:43 ` [gentoo-dev] [PATCH 2/3] toolchain-funcs.eclass: Add tc-get-c-rtlib() to get CC runtime Michał Górny
2022-10-08 9:43 ` Michał Górny [this message]
2022-10-09 21:30 ` [gentoo-dev] [PATCH 0/3] toolchain-funcs.eclass: support for querying C++ stdlib and compiler runtime Sam James
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=20221008094329.316318-4-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.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