From cc28bf9b7760908d1087227177762cd4fdf9cc13 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sun, 30 Oct 2016 23:26:13 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285525 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index efc6445fb6..4beaba3743 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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 /../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"); -- 2.40.0