llvm/clang/test/Driver/print-libgcc-file-name-libgcc.c
Michal Gorny 7cfe480122 [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
2016-10-10 12:23:40 +00:00

8 lines
232 B
C

// 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