]> granicus.if.org Git - clang/commitdiff
Fix clang installed path to handle case where clang is invoked through a symlink
authorMehdi Amini <mehdi.amini@apple.com>
Sun, 30 Oct 2016 23:26:13 +0000 (23:26 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Sun, 30 Oct 2016 23:26:13 +0000 (23:26 +0000)
This code path is used when generating the path to libLTO.dylib, which
is passed to the linker as `-lto_library'.
Without this, if clang is invoked through a symlink, libLTO is
searched in a path relative to where the symlink is instead of
where clang is actually installed.

Fix PR30811.

Patch by: Jack Howarth

Differential Revision: https://reviews.llvm.org/D26116

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285525 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp

index efc6445fb662a55c21fdb16fce68c88823ed9fb3..4beaba37432c06345c7c67ae31a1cfd047cb197e 100644 (file)
@@ -8208,7 +8208,7 @@ void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args,
   // and 'ld' will use its default mechanism to search for libLTO.dylib.
   if (Version[0] >= 133) {
     // Search for libLTO in <InstalledDir>/../lib/libLTO.dylib
-    StringRef P = llvm::sys::path::parent_path(D.getInstalledDir());
+    StringRef P = llvm::sys::path::parent_path(D.Dir);
     SmallString<128> LibLTOPath(P);
     llvm::sys::path::append(LibLTOPath, "lib");
     llvm::sys::path::append(LibLTOPath, "libLTO.dylib");