]> granicus.if.org Git - clang/commit
[Driver] Make -print-libgcc-file-name print compiler-rt lib when used
authorMichal Gorny <mgorny@gentoo.org>
Mon, 10 Oct 2016 12:23:40 +0000 (12:23 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Mon, 10 Oct 2016 12:23:40 +0000 (12:23 +0000)
commit4f4e33e183779265333ddd99d5e7be130b1fadd7
tree08eef9101226c241be33b7ca6d7a3eeff1807496
parent79a4de8436af04936268d60119450cc05f75eb36
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283746 91177308-0d34-0410-b5e6-96231b3b80d8
docs/CommandGuide/clang.rst
include/clang/Driver/Options.td
lib/Driver/Driver.cpp
test/Driver/montavista-gcc-toolchain.c
test/Driver/print-libgcc-file-name-clangrt.c [new file with mode: 0644]
test/Driver/print-libgcc-file-name-libgcc.c [new file with mode: 0644]
test/lit.cfg