[PATCH] D99308: [Triple][Driver] Add muslx32 environment and use /lib/ld-musl-x32.so.1 for -dynamic-linker
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 25 16:26:09 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGed956554f96c: [Triple][Driver] Add muslx32 environment and use /lib/ld-musl-x32.so.1 for… (authored by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99308/new/
https://reviews.llvm.org/D99308
Files:
clang/lib/Driver/ToolChains/Linux.cpp
clang/test/Driver/linux-cross.cpp
llvm/include/llvm/ADT/Triple.h
llvm/lib/Support/Triple.cpp
llvm/unittests/ADT/TripleTest.cpp
Index: llvm/unittests/ADT/TripleTest.cpp
===================================================================
--- llvm/unittests/ADT/TripleTest.cpp
+++ llvm/unittests/ADT/TripleTest.cpp
@@ -111,6 +111,12 @@
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::Musl, T.getEnvironment());
+ T = Triple("x86_64-pc-linux-muslx32");
+ EXPECT_EQ(Triple::x86_64, T.getArch());
+ EXPECT_EQ(Triple::PC, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
+ EXPECT_EQ(Triple::MuslX32, T.getEnvironment());
+
// PS4 has two spellings for the vendor.
T = Triple("x86_64-scei-ps4");
EXPECT_EQ(Triple::x86_64, T.getArch());
Index: llvm/lib/Support/Triple.cpp
===================================================================
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -250,6 +250,7 @@
case Musl: return "musl";
case MuslEABI: return "musleabi";
case MuslEABIHF: return "musleabihf";
+ case MuslX32: return "muslx32";
case Simulator: return "simulator";
}
@@ -555,6 +556,7 @@
.StartsWith("android", Triple::Android)
.StartsWith("musleabihf", Triple::MuslEABIHF)
.StartsWith("musleabi", Triple::MuslEABI)
+ .StartsWith("muslx32", Triple::MuslX32)
.StartsWith("musl", Triple::Musl)
.StartsWith("msvc", Triple::MSVC)
.StartsWith("itanium", Triple::Itanium)
Index: llvm/include/llvm/ADT/Triple.h
===================================================================
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -218,6 +218,7 @@
Musl,
MuslEABI,
MuslEABIHF,
+ MuslX32,
MSVC,
Itanium,
@@ -688,7 +689,8 @@
bool isMusl() const {
return getEnvironment() == Triple::Musl ||
getEnvironment() == Triple::MuslEABI ||
- getEnvironment() == Triple::MuslEABIHF;
+ getEnvironment() == Triple::MuslEABIHF ||
+ getEnvironment() == Triple::MuslX32;
}
/// Tests whether the target is SPIR (32- or 64-bit).
Index: clang/test/Driver/linux-cross.cpp
===================================================================
--- clang/test/Driver/linux-cross.cpp
+++ clang/test/Driver/linux-cross.cpp
@@ -75,3 +75,7 @@
// RUN: %clang -### %s --target=i686-linux-musl --sysroot= \
// RUN: --stdlib=platform --rtlib=platform 2>&1 | FileCheck %s --check-prefix=MUSL_I686
// MUSL_I686: "-dynamic-linker" "/lib/ld-musl-i386.so.1"
+
+// RUN: %clang -### %s --target=x86_64-linux-muslx32 --sysroot= \
+// RUN: --stdlib=platform --rtlib=platform 2>&1 | FileCheck %s --check-prefix=MUSL_X32
+// MUSL_X32: "-dynamic-linker" "/lib/ld-musl-x32.so.1"
Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -401,6 +401,11 @@
case llvm::Triple::x86:
ArchName = "i386";
break;
+ case llvm::Triple::x86_64:
+ ArchName = Triple.getEnvironment() == llvm::Triple::MuslX32
+ ? "x32"
+ : Triple.getArchName().str();
+ break;
default:
ArchName = Triple.getArchName().str();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99308.333459.patch
Type: text/x-patch
Size: 3178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210325/f63c34b4/attachment.bin>
More information about the cfe-commits
mailing list