termux-packages/packages/libllvm/clang-lib-Driver-ToolChains-Linux.cpp.patch

45 lines
2.1 KiB
Diff
Raw Normal View History

--- a/clang/lib/Driver/ToolChains/Linux.cpp 2019-12-21 22:30:03.676720096 +0000
+++ b/clang/lib/Driver/ToolChains/Linux.cpp 2019-12-21 22:34:42.941719383 +0000
@@ -162,8 +162,8 @@ static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) {
// 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())
@@ -403,7 +403,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
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);
@@ -447,11 +447,19 @@
// 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) && !IsAndroid)
addPathIfExists(D, D.Dir + "/../lib", Paths);
2019-03-28 02:42:04 +01:00
addPathIfExists(D, SysRoot + "/lib", Paths);
- addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+ bool nativeBuild = MultiarchTriple == getMultiarchTriple(D, llvm::Triple(llvm::sys::getDefaultTargetTriple()), SysRoot);
+ if (nativeBuild || !IsAndroid)
+ addPathIfExists(D, SysRoot + "/usr/lib", Paths);
+
+ 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
+ }
}
2019-03-14 04:46:10 +01:00
ToolChain::CXXStdlibType Linux::GetDefaultCXXStdlibType() const {