libllvm: make clang++ order -lm after -lgcc
Without this patch, libm will be linked before libgcc (which is a linker script that links to both libunwind and libgcc_real); as libm.so in our system exports unwind symbols, it prevents the built objects from being linked to the unwinders properly. Since libm is a part of bionic, we can't ship it like we do for libc++_shared or zlib. Therefore, patching clang++ is probably the only way.
This commit is contained in:
parent
e575b73cc2
commit
1e1167bc1f
@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://clang.llvm.org/
|
||||
TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
|
||||
TERMUX_PKG_LICENSE="NCSA"
|
||||
TERMUX_PKG_VERSION=8.0.0
|
||||
TERMUX_PKG_REVISION=3
|
||||
TERMUX_PKG_REVISION=4
|
||||
TERMUX_PKG_SHA256=(8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
|
||||
084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
|
||||
9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
|
||||
|
22
packages/libllvm/cxx-libm.patch
Normal file
22
packages/libllvm/cxx-libm.patch
Normal file
@ -0,0 +1,22 @@
|
||||
diff --git a/tools/clang/lib/Driver/ToolChains/Gnu.cpp~ b/tools/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
index 2ad4509..4d0b060 100644
|
||||
--- a/tools/clang/lib/Driver/ToolChains/Gnu.cpp~
|
||||
+++ b/tools/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
@@ -483,7 +483,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
if (OnlyLibstdcxxStatic)
|
||||
CmdArgs.push_back("-Bdynamic");
|
||||
}
|
||||
- CmdArgs.push_back("-lm");
|
||||
}
|
||||
// Silence warnings when linking C code with a C++ '-stdlib' argument.
|
||||
Args.ClaimAllArgs(options::OPT_stdlib_EQ);
|
||||
@@ -513,6 +512,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
||||
AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
|
||||
|
||||
+ if (D.CCCIsCXX())
|
||||
+ CmdArgs.push_back("-lm");
|
||||
+
|
||||
if (WantPthread && !isAndroid)
|
||||
CmdArgs.push_back("-lpthread");
|
||||
|
Loading…
Reference in New Issue
Block a user