r285525 - Fix clang installed path to handle case where clang is invoked through a symlink

Mehdi Amini via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 30 16:26:14 PDT 2016


Author: mehdi_amini
Date: Sun Oct 30 18:26:13 2016
New Revision: 285525

URL: http://llvm.org/viewvc/llvm-project?rev=285525&view=rev
Log:
Fix clang installed path to handle case where clang is invoked through a symlink

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

Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=285525&r1=285524&r2=285525&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Oct 30 18:26:13 2016
@@ -8208,7 +8208,7 @@ void darwin::Linker::AddLinkArgs(Compila
   // 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");




More information about the cfe-commits mailing list