diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-10-08 11:41:05 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-10-10 22:52:36 +0200 |
commit | bcce21e5e6b31aca6b2f8edb15328edc8f078d52 (patch) | |
tree | 774ea4a7cbf6799b209e3ea5ead07a9d3a0512db /eclass/tests | |
parent | toolchain-funcs.eclass: Add tc-get-c-rtlib() to get CC runtime (diff) | |
download | gentoo-bcce21e5e6b31aca6b2f8edb15328edc8f078d52.tar.gz gentoo-bcce21e5e6b31aca6b2f8edb15328edc8f078d52.tar.bz2 gentoo-bcce21e5e6b31aca6b2f8edb15328edc8f078d52.zip |
eclass/tests/toolchain-funcs.sh: Handle missing ld.gold gracefully
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/tests')
-rwxr-xr-x | eclass/tests/toolchain-funcs.sh | 64 |
1 files 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 |