Author: Lin Sun Date: 2021-08-25T23:50:17-07:00 New Revision: d280a76908e841da9e956a113d219e35247272bf
URL: https://github.com/llvm/llvm-project/commit/d280a76908e841da9e956a113d219e35247272bf DIFF: https://github.com/llvm/llvm-project/commit/d280a76908e841da9e956a113d219e35247272bf.diff LOG: [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 Added: Modified: clang/lib/Driver/ToolChains/Linux.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index caebab3a9aeb..3604a222ba4b 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits