[Driver][Linux] Fix regression when -DLIBCXX_LIBDIR_SUFFIX=64

This patch allows an installed (`ninja install-clang`) Clang to find
`../lib64/libc++.so`

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D108286
This commit is contained in:
Lin Sun 2021-08-25 23:50:17 -07:00 committed by Fangrui Song
parent 6da811fd5c
commit d280a76908
1 changed files with 6 additions and 1 deletions

View File

@ -303,8 +303,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// searched.
// FIXME: It's not clear whether we should use the driver's installed
// directory ('Dir' below) or the ResourceDir.
if (StringRef(D.Dir).startswith(SysRoot))
if (StringRef(D.Dir).startswith(SysRoot)) {
// Even if OSLibDir != "lib", this is needed for Clang in the build
// directory (not installed) to find libc++.
addPathIfExists(D, D.Dir + "/../lib", Paths);
if (OSLibDir != "lib")
addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
}
addPathIfExists(D, SysRoot + "/lib", Paths);
addPathIfExists(D, SysRoot + "/usr/lib", Paths);