termux-packages/packages/emscripten/llvm-project-clang-lib-Driver-ToolChains-Linux.cpp.patch.diff
Jia Yuan Lo cefee4f432
emscripten: update to 2.0.32 (#7905)
* emscripten: update to 2.0.32

* emscripten: drop debianutils

Upstream has replaced "which" usage with POSIX "command -v"

* emscripten: subpackage third party test suite

* emscripten: add detail run test suite instruction

* emscripten: use TERMUX_PKG_RM_AFTER_INSTALL

* emscripten: split patch to separate diff files

* emscripten-llvm: switch to use LLD
2021-11-02 02:11:44 +05:30

39 lines
1.7 KiB
Diff

diff -uNr llvm-project/clang/lib/Driver/ToolChains/Linux.cpp llvm-project.mod/clang/lib/Driver/ToolChains/Linux.cpp
--- llvm-project/clang/lib/Driver/ToolChains/Linux.cpp 2021-10-20 02:24:04.000000000 +0800
+++ llvm-project.mod/clang/lib/Driver/ToolChains/Linux.cpp 2021-10-29 14:39:16.043930634 +0800
@@ -287,7 +287,7 @@
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);
@@ -302,7 +302,7 @@
// 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) {
// Even if OSLibDir != "lib", this is needed for Clang in the build
// directory (not installed) to find libc++.
addPathIfExists(D, D.Dir + "/../lib", Paths);
@@ -311,7 +311,15 @@
}
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");
+ }
}
ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {