]> granicus.if.org Git - clang/commit
[DarwinDriver] Reapply: Use -lto_library to specify the path for libLTO.dylib
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 2 Oct 2015 15:10:33 +0000 (15:10 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 2 Oct 2015 15:10:33 +0000 (15:10 +0000)
commitfd64a767855aba42b9812ec945a8ca996d9a3937
treeaa57bdf17198865e01f689f8ee3b4da3088b5ff1
parentba662f9db79a8118cc14b28529ac5883e9e20c56
[DarwinDriver] Reapply: Use -lto_library to specify the path for libLTO.dylib

Reapply r248935.

Usually, when using LTO with a clang installation newer than the
system's one, there's a libLTO.dylib version mismatch and LTO fails. One
solution to this is to make ld point to the right libLTO.dylib by
changing DYLD_LIBRARY_PATH.

However, ld64 supports specifying the complete path to the desired
libLTO.dylib through the -lto_library option. This commit adds support
for the clang driver to use this option whenever it's capable of finding
a libLTO.dylib in clang's installed library directory. This way, we
don't need to rely on DYLD_LIBRARY_PATH nor get caught by version
mismatches.

Differential Revision: http://reviews.llvm.org/D13117

rdar://problem/7363476

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249143 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticDriverKinds.td
include/clang/Basic/DiagnosticGroups.td
lib/Driver/Tools.cpp
test/Driver/darwin-ld-lto.c [new file with mode: 0644]