Add a new tc-get-c-rtlib() that attempts to get the runtime used
by the current C compiler. Currently it supports compiler-rt
and libgcc.
Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/tests/toolchain-funcs.sh | 10 ++++++++++
eclass/toolchain-funcs.eclass | 28 ++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index 5a35a44ce018..d8a357fb24fe 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -202,6 +202,10 @@ 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
@@ -218,6 +222,12 @@ if type -P clang &>/dev/null; then
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
d