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
// 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");