mirror of
https://codeberg.org/kiss-community/repo
synced 2024-12-21 23:00:06 -07:00
clang: add aliases for musl targets
This commit is contained in:
parent
ec680dd75e
commit
09ad265b60
@ -2,6 +2,8 @@
|
||||
|
||||
export DESTDIR="$1"
|
||||
|
||||
patch -p1 < musl-targets.patch
|
||||
|
||||
cd clang
|
||||
cmake -B build \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
|
@ -1,2 +1,3 @@
|
||||
3d677cb5a0258ae910719528e463a59cf270a3414e3e4807e9fefc36437474e0a5
|
||||
78c57fd0ae1cf67b61210b2d6be58aa51372161e8de66efa78a268dcdb348520b3
|
||||
b6e513e411ec87051b9211cf91e27f16109606b930ed11ef8ad4a418f818d474e9
|
||||
|
110
extra/clang/patches/musl-targets.patch
Normal file
110
extra/clang/patches/musl-targets.patch
Normal file
@ -0,0 +1,110 @@
|
||||
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
index e5e1b1d..7ee093f 100644
|
||||
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
@@ -2538,8 +2538,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
"powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
|
||||
static const char *const PPCLELibDirs[] = {"/lib32", "/lib"};
|
||||
static const char *const PPCLETriples[] = {"powerpcle-linux-gnu",
|
||||
- "powerpcle-unknown-linux-gnu",
|
||||
- "powerpcle-linux-musl"};
|
||||
+ "powerpcle-unknown-linux-gnu"};
|
||||
|
||||
static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
|
||||
static const char *const PPC64Triples[] = {
|
||||
@@ -2616,6 +2615,95 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (TargetTriple.isMusl()) {
|
||||
+ static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
|
||||
+ static const char *const ARMHFMuslTriples[] = {
|
||||
+ "arm-linux-musleabihf", "armv7l-linux-musleabihf"
|
||||
+ };
|
||||
+ static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
|
||||
+ static const char *const X86_64MuslTriples[] = {
|
||||
+ "x86_64-linux-musl",
|
||||
+ "x86_64-pc-linux-musl", "x86_64-unknown-linux-musl"
|
||||
+ };
|
||||
+ static const char *const X86MuslTriples[] = {"i686-linux-musl"};
|
||||
+ static const char *const MIPSMuslTriples[] = {
|
||||
+ "mips-linux-musl", "mipsel-linux-musl",
|
||||
+ "mipsel-linux-muslhf", "mips-linux-muslhf"
|
||||
+ };
|
||||
+ static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
|
||||
+ static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"};
|
||||
+ static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
|
||||
+ static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
|
||||
+ static const char *const RISCV64MuslTriples[] = {"riscv64-linux-musl"};
|
||||
+
|
||||
+ switch (TargetTriple.getArch()) {
|
||||
+ case llvm::Triple::aarch64:
|
||||
+ LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
|
||||
+ TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
|
||||
+ BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
|
||||
+ BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::arm:
|
||||
+ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
|
||||
+ if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
|
||||
+ TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
|
||||
+ } else {
|
||||
+ TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
|
||||
+ }
|
||||
+ break;
|
||||
+ case llvm::Triple::x86_64:
|
||||
+ LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
|
||||
+ TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
|
||||
+ BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
|
||||
+ BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::x86:
|
||||
+ LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
|
||||
+ TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
|
||||
+ BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
|
||||
+ BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::mips:
|
||||
+ LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
|
||||
+ TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::ppc:
|
||||
+ LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
|
||||
+ TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
|
||||
+ BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
|
||||
+ BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::ppcle:
|
||||
+ LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
|
||||
+ TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
|
||||
+ BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
|
||||
+ BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::ppc64:
|
||||
+ LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
|
||||
+ TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
|
||||
+ BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
|
||||
+ BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::ppc64le:
|
||||
+ LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
|
||||
+ TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
|
||||
+ BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
|
||||
+ BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
|
||||
+ break;
|
||||
+ case llvm::Triple::riscv64:
|
||||
+ LibDirs.append(begin(RISCV64LibDirs), end(RISCV64LibDirs));
|
||||
+ TripleAliases.append(begin(RISCV64MuslTriples), end(RISCV64MuslTriples));
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ TripleAliases.push_back(TargetTriple.str());
|
||||
+ if (TargetTriple.str() != BiarchTriple.str())
|
||||
+ BiarchTripleAliases.push_back(BiarchTriple.str());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
// Android targets should not use GNU/Linux tools or libraries.
|
||||
if (TargetTriple.isAndroid()) {
|
||||
static const char *const AArch64AndroidTriples[] = {
|
@ -1,2 +1,3 @@
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.2/clang-18.1.2.src.tar.xz clang
|
||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.2/cmake-18.1.2.src.tar.xz cmake
|
||||
patches/musl-targets.patch
|
||||
|
Loading…
Reference in New Issue
Block a user