summaryrefslogtreecommitdiff
path: root/eclass/tests
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-11 01:37:01 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-10-11 01:37:01 +0100
commit179be85ade6b2b47bf362865b5c375969ab5ddc8 (patch)
tree073bcd19b7e1bb84acd2f683936671ee88860970 /eclass/tests
parent948f9476d6a417da6048d4291bf36b0507293d63 (diff)
gentoo auto-resync : 11:10:2022 - 01:37:00
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/toolchain-funcs.sh96
1 files changed, 66 insertions, 30 deletions
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index 56379b10cded..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
@@ -198,4 +202,36 @@ for compiler in gcc clang not-really-a-compiler; do
fi
done
+if type -P gcc &>/dev/null; then
+ tbegin "tc-get-cxx-stdlib (gcc)"
+ [[ $(CXX=g++ tc-get-cxx-stdlib) == libstdc++ ]]
+ tend $?
+
+ tbegin "tc-get-c-rtlib (gcc)"
+ [[ $(CC=gcc tc-get-c-rtlib) == libgcc ]]
+ tend $?
+fi
+
+if type -P clang &>/dev/null; then
+ for stdlib in libc++ libstdc++; do
+ if clang++ -stdlib=${stdlib} -x c++ -E -P - &>/dev/null \
+ <<<'#include <ciso646>'
+ then
+ tbegin "tc-get-cxx-stdlib (clang, ${stdlib})"
+ [[ $(CXX=clang++ CXXFLAGS="-stdlib=${stdlib}" tc-get-cxx-stdlib) == ${stdlib} ]]
+ tend $?
+ fi
+ done
+
+ tbegin "tc-get-cxx-stdlib (clang, invalid)"
+ ! CXX=clang++ CXXFLAGS="-stdlib=invalid" tc-get-cxx-stdlib
+ tend $?
+
+ for rtlib in compiler-rt libgcc; do
+ tbegin "tc-get-c-rtlib (clang, ${rtlib})"
+ [[ $(CC=clang CFLAGS="--rtlib=${rtlib}" tc-get-c-rtlib) == ${rtlib} ]]
+ tend $?
+ done
+fi
+
texit