From: Mehdi Amini Date: Sun, 30 Oct 2016 23:26:13 +0000 (+0000) Subject: Fix clang installed path to handle case where clang is invoked through a symlink X-Git-Tag: llvmorg-4.0.0-rc1~5914 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2461ce33acdd68eb611ef4c204b000aa3b49338;p=platform%2Fupstream%2Fllvm.git 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 llvm-svn: 285525 --- diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index efc6445fb662..4beaba37432c 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/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");