2022-03-31 14:01:43 +02:00
|
|
|
--- a/clang/lib/Driver/ToolChains/Linux.cpp
|
|
|
|
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
|
|
|
|
@@ -162,8 +162,8 @@
|
2021-11-07 03:51:52 +01:00
|
|
|
// FIXME: This is a bit of a hack. We should really unify this code for
|
|
|
|
// reasoning about oslibdir spellings with the lib dir spellings in the
|
|
|
|
// GCCInstallationDetector, but that is a more significant refactoring.
|
|
|
|
- if (Triple.getArch() == llvm::Triple::x86 || Triple.isPPC32() ||
|
|
|
|
- Triple.getArch() == llvm::Triple::sparc)
|
|
|
|
+ if (!Triple.isAndroid() && (Triple.getArch() == llvm::Triple::x86 || Triple.isPPC32() ||
|
|
|
|
+ Triple.getArch() == llvm::Triple::sparc))
|
|
|
|
return "lib32";
|
|
|
|
|
|
|
|
if (Triple.getArch() == llvm::Triple::x86_64 && Triple.isX32())
|
2022-03-31 14:01:43 +02:00
|
|
|
@@ -287,7 +287,7 @@
|
2020-03-28 16:53:46 +01:00
|
|
|
if (Triple.getVendor() == llvm::Triple::OpenEmbedded &&
|
|
|
|
Triple.isArch64Bit())
|
|
|
|
addPathIfExists(D, SysRoot + "/usr/" + OSLibDir, Paths);
|
|
|
|
- else
|
|
|
|
+ else if (!IsAndroid)
|
|
|
|
addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
|
|
|
|
if (IsRISCV) {
|
|
|
|
StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
|
2022-03-31 14:01:43 +02:00
|
|
|
@@ -302,7 +302,7 @@
|
2020-04-13 12:42:54 +02:00
|
|
|
// searched.
|
|
|
|
// FIXME: It's not clear whether we should use the driver's installed
|
|
|
|
// directory ('Dir' below) or the ResourceDir.
|
2022-03-31 14:01:43 +02:00
|
|
|
- if (StringRef(D.Dir).startswith(SysRoot)) {
|
|
|
|
+ if (StringRef(D.Dir).startswith(SysRoot) && !IsAndroid) {
|
|
|
|
// Even if OSLibDir != "lib", this is needed for Clang in the build
|
|
|
|
// directory (not installed) to find libc++.
|
2020-03-28 16:53:46 +01:00
|
|
|
addPathIfExists(D, D.Dir + "/../lib", Paths);
|
2022-03-31 14:01:43 +02:00
|
|
|
@@ -311,7 +311,15 @@
|
|
|
|
}
|
2019-03-28 02:42:04 +01:00
|
|
|
|
2020-03-28 16:53:46 +01:00
|
|
|
addPathIfExists(D, SysRoot + "/lib", Paths);
|
|
|
|
- addPathIfExists(D, SysRoot + "/usr/lib", Paths);
|
2020-12-17 17:16:26 +01:00
|
|
|
+ bool nativeBuild = MultiarchTriple == getMultiarchTriple(D, llvm::Triple(llvm::sys::getDefaultTargetTriple()), SysRoot);
|
2020-03-28 16:53:46 +01:00
|
|
|
+ if (nativeBuild || !IsAndroid)
|
|
|
|
+ addPathIfExists(D, SysRoot + "/usr/lib", Paths);
|
2019-09-06 18:03:46 +02:00
|
|
|
+
|
2020-03-28 16:53:46 +01:00
|
|
|
+ if (IsAndroid) {
|
|
|
|
+ addPathIfExists(D, SysRoot + "/usr/" + MultiarchTriple + "/lib", Paths);
|
|
|
|
+ addPathIfExists(D, "/system/" + OSLibDir, Paths);
|
|
|
|
+ ExtraOpts.push_back("-rpath=" + SysRoot + "/usr/lib");
|
2019-03-14 04:46:10 +01:00
|
|
|
+ }
|
2020-03-28 16:53:46 +01:00
|
|
|
}
|
2019-03-14 04:46:10 +01:00
|
|
|
|
2022-03-31 14:01:43 +02:00
|
|
|
ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
|