Driver: adjust linker invocation for GNUTools
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 7 Feb 2016 06:03:38 +0000 (06:03 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 7 Feb 2016 06:03:38 +0000 (06:03 +0000)
commitf56c6d85ae8fe9892889f8737665e981592c90d9
tree000c20bcfb611f8eda3de334931bf152d7eaf62f
parentc917c7a7b19ffe618ded71b83d70f8abe68f4114
Driver: adjust linker invocation for GNUTools

Adjust the driver to invoke the linker more similar to gcc.  -dynamic-linker is
only passed if -static and -shared are not part of the compiler (driver)
invocation.  Replicate the passing of -export-rdynamic as per the GCC link spec:

  %{!static: %{rdynamic:-export-dynamic} %{!shared:-dynamic-linker ...}}

This behaviour is consistent across all the targets that are supported, so no
need to conditionalise it on the target.

Resolves PR24245.

llvm-svn: 260019
clang/lib/Driver/Tools.cpp
clang/test/Driver/dynamic-linker.c [new file with mode: 0644]