summaryrefslogtreecommitdiffstats
path: root/clang/test/Driver/print-libgcc-file-name-libgcc.c
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2016-10-10 12:23:40 +0000
committerMichal Gorny <mgorny@gentoo.org>2016-10-10 12:23:40 +0000
commit7cfe480122b81a3b19f0a0d9a4d22f68da161f08 (patch)
tree038749703bfcdafcc2f0d69252a8528149cfdf78 /clang/test/Driver/print-libgcc-file-name-libgcc.c
parentc9edc2ee8d97618ebb0702f66202720b3b8cb29a (diff)
downloadbcm5719-llvm-7cfe480122b81a3b19f0a0d9a4d22f68da161f08.tar.gz
bcm5719-llvm-7cfe480122b81a3b19f0a0d9a4d22f68da161f08.zip
[Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Make the -print-libgcc-file-name option print an appropriate compiler runtime library, that is libgcc.a if gcc runtime is used and an appropriate compiler-rt library if that runtime is used. The main use for this is to allow linking executables built with -nodefaultlibs (e.g. to avoid linking to the standard C++ library) to the compiler runtime library, e.g. using: clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name) in which case currently a program built like this linked to the gcc runtime unconditionally. The patch fixes it to use compiler-rt libraries instead when compiler-rt is the active runtime. Differential Revision: https://reviews.llvm.org/D25338 llvm-svn: 283746
Diffstat (limited to 'clang/test/Driver/print-libgcc-file-name-libgcc.c')
-rw-r--r--clang/test/Driver/print-libgcc-file-name-libgcc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/Driver/print-libgcc-file-name-libgcc.c b/clang/test/Driver/print-libgcc-file-name-libgcc.c
new file mode 100644
index 00000000000..3ca8fb900e3
--- /dev/null
+++ b/clang/test/Driver/print-libgcc-file-name-libgcc.c
@@ -0,0 +1,7 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=libgcc.
+
+// REQUIRES: libgcc
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
OpenPOWER on IntegriCloud