1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[Triple][Driver] Add muslx32 environment and use /lib/ld-musl-x32.so.1 for -dynamic-linker

Differential Revision: https://reviews.llvm.org/D99308
This commit is contained in:
Fangrui Song 2021-03-25 16:25:47 -07:00
parent 4bd3f42304
commit 02c14a6e9e
3 changed files with 11 additions and 1 deletions

View File

@ -218,6 +218,7 @@ public:
Musl,
MuslEABI,
MuslEABIHF,
MuslX32,
MSVC,
Itanium,
@ -688,7 +689,8 @@ public:
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).

View File

@ -250,6 +250,7 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
case Musl: return "musl";
case MuslEABI: return "musleabi";
case MuslEABIHF: return "musleabihf";
case MuslX32: return "muslx32";
case Simulator: return "simulator";
}
@ -555,6 +556,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
.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)

View File

@ -111,6 +111,12 @@ TEST(TripleTest, ParsedIDs) {
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());