[PATCH] D26244: [Driver] Prefer libraries installed next to Clang over those from GCC
Jonas Hahnfeld via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 2 07:17:36 PDT 2016
Hahnfeld created this revision.
Hahnfeld added reviewers: mgorny, rsmith, EricWF.
Hahnfeld added a subscriber: cfe-commits.
This is for example needed to make sure we get LLVM's `libunwind.so.1` and don't end up with the system default non-GNU `libunwind.so.8` as reported in https://reviews.llvm.org/D25008.
https://reviews.llvm.org/D26244
Files:
lib/Driver/ToolChains.cpp
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -4222,6 +4222,17 @@
const std::string OSLibDir = getOSLibDir(Triple, Args);
const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
+ // Similar to the logic for GCC below, if we currently running Clang inside
+ // of the requested system root, add its parent library paths to those
+ // 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)) {
+ addPathIfExists(D, D.Dir + "/../lib/" + MultiarchTriple, Paths);
+ addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
+ addPathIfExists(D, D.Dir + "/../lib", Paths);
+ }
+
// Add the multilib suffixed paths where they are available.
if (GCCInstallation.isValid()) {
const llvm::Triple &GCCTriple = GCCInstallation.getTriple();
@@ -4275,16 +4286,6 @@
}
}
- // Similar to the logic for GCC above, if we currently running Clang inside
- // of the requested system root, add its parent library paths to
- // those 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)) {
- addPathIfExists(D, D.Dir + "/../lib/" + MultiarchTriple, Paths);
- addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
- }
-
addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
@@ -4321,14 +4322,6 @@
addPathIfExists(D, LibPath, Paths);
}
- // Similar to the logic for GCC above, if we are currently running Clang
- // inside of the requested system root, add its parent library path to those
- // 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))
- addPathIfExists(D, D.Dir + "/../lib", Paths);
-
addPathIfExists(D, SysRoot + "/lib", Paths);
addPathIfExists(D, SysRoot + "/usr/lib", Paths);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26244.76700.patch
Type: text/x-patch
Size: 2298 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161102/2a7aa317/attachment.bin>
More information about the cfe-commits
mailing list