Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
llvm_11: patch to recognize Genode platform triples
This patch does not add Genode support to the Clang frontend or LLVM runtime libraries, only the LLVM code generator and optimizer.
- Loading branch information
Showing
2 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake | ||
index 5ef22eb493ba..f40625c7eed2 100644 | ||
--- a/cmake/modules/HandleLLVMOptions.cmake | ||
+++ b/cmake/modules/HandleLLVMOptions.cmake | ||
@@ -132,7 +132,7 @@ if(WIN32) | ||
set(LLVM_ON_UNIX 0) | ||
endif(CYGWIN) | ||
else(WIN32) | ||
- if(FUCHSIA OR UNIX) | ||
+ if(FUCHSIA OR GENODE OR UNIX) | ||
set(LLVM_ON_WIN32 0) | ||
set(LLVM_ON_UNIX 1) | ||
if(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX") | ||
@@ -140,9 +140,9 @@ else(WIN32) | ||
else() | ||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) | ||
endif() | ||
- else(FUCHSIA OR UNIX) | ||
+ else(FUCHSIA OR GENODE OR UNIX) | ||
MESSAGE(SEND_ERROR "Unable to determine platform") | ||
- endif(FUCHSIA OR UNIX) | ||
+ endif(FUCHSIA OR GENODE OR UNIX) | ||
endif(WIN32) | ||
|
||
set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) | ||
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h | ||
index 6bad18f19244..95459ca997c5 100644 | ||
--- a/include/llvm/ADT/Triple.h | ||
+++ b/include/llvm/ADT/Triple.h | ||
@@ -166,6 +166,7 @@ public: | ||
DragonFly, | ||
FreeBSD, | ||
Fuchsia, | ||
+ Genode, | ||
IOS, | ||
KFreeBSD, | ||
Linux, | ||
@@ -502,6 +503,8 @@ public: | ||
|
||
bool isOSDragonFly() const { return getOS() == Triple::DragonFly; } | ||
|
||
+ bool isOSGenode() const { return getOS() == Triple::Genode; } | ||
+ | ||
bool isOSSolaris() const { | ||
return getOS() == Triple::Solaris; | ||
} | ||
diff --git a/include/llvm/BinaryFormat/ELF.h b/include/llvm/BinaryFormat/ELF.h | ||
index bdcf10fd1640..46ed8e56cc31 100644 | ||
--- a/include/llvm/BinaryFormat/ELF.h | ||
+++ b/include/llvm/BinaryFormat/ELF.h | ||
@@ -348,6 +348,7 @@ enum { | ||
ELFOSABI_AROS = 15, // AROS | ||
ELFOSABI_FENIXOS = 16, // FenixOS | ||
ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI | ||
+ ELFOSABI_GENODE = 63, // Genode (temporary) | ||
ELFOSABI_FIRST_ARCH = 64, // First architecture-specific OS ABI | ||
ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime | ||
ELFOSABI_AMDGPU_PAL = 65, // AMD PAL runtime | ||
diff --git a/include/llvm/MC/MCELFObjectWriter.h b/include/llvm/MC/MCELFObjectWriter.h | ||
index 8f78b99d3794..7a1d1981f60d 100644 | ||
--- a/include/llvm/MC/MCELFObjectWriter.h | ||
+++ b/include/llvm/MC/MCELFObjectWriter.h | ||
@@ -74,6 +74,8 @@ public: | ||
switch (OSType) { | ||
case Triple::CloudABI: | ||
return ELF::ELFOSABI_CLOUDABI; | ||
+ case Triple::Genode: | ||
+ return ELF::ELFOSABI_GENODE; | ||
case Triple::HermitCore: | ||
return ELF::ELFOSABI_STANDALONE; | ||
case Triple::PS4: | ||
diff --git a/lib/ObjectYAML/ELFYAML.cpp b/lib/ObjectYAML/ELFYAML.cpp | ||
index 2353b34f188b..e93f53c40888 100644 | ||
--- a/lib/ObjectYAML/ELFYAML.cpp | ||
+++ b/lib/ObjectYAML/ELFYAML.cpp | ||
@@ -268,6 +268,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration( | ||
ECase(ELFOSABI_AROS); | ||
ECase(ELFOSABI_FENIXOS); | ||
ECase(ELFOSABI_CLOUDABI); | ||
+ ECase(ELFOSABI_GENODE); | ||
ECase(ELFOSABI_AMDGPU_HSA); | ||
ECase(ELFOSABI_AMDGPU_PAL); | ||
ECase(ELFOSABI_AMDGPU_MESA3D); | ||
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp | ||
index fec1985ccaca..1f3e4f07fb8e 100644 | ||
--- a/lib/Support/Triple.cpp | ||
+++ b/lib/Support/Triple.cpp | ||
@@ -197,6 +197,7 @@ StringRef Triple::getOSTypeName(OSType Kind) { | ||
case Emscripten: return "emscripten"; | ||
case FreeBSD: return "freebsd"; | ||
case Fuchsia: return "fuchsia"; | ||
+ case Genode: return "genode"; | ||
case Haiku: return "haiku"; | ||
case HermitCore: return "hermit"; | ||
case Hurd: return "hurd"; | ||
@@ -494,6 +495,7 @@ static Triple::OSType parseOS(StringRef OSName) { | ||
.StartsWith("dragonfly", Triple::DragonFly) | ||
.StartsWith("freebsd", Triple::FreeBSD) | ||
.StartsWith("fuchsia", Triple::Fuchsia) | ||
+ .StartsWith("genode", Triple::Genode) | ||
.StartsWith("ios", Triple::IOS) | ||
.StartsWith("kfreebsd", Triple::KFreeBSD) | ||
.StartsWith("linux", Triple::Linux) | ||
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp | ||
index 15076f1f8933..b0636e7eb196 100644 | ||
--- a/tools/llvm-readobj/ELFDumper.cpp | ||
+++ b/tools/llvm-readobj/ELFDumper.cpp | ||
@@ -1334,6 +1334,7 @@ static const EnumEntry<unsigned> ElfOSABI[] = { | ||
{"AROS", "AROS", ELF::ELFOSABI_AROS}, | ||
{"FenixOS", "FenixOS", ELF::ELFOSABI_FENIXOS}, | ||
{"CloudABI", "CloudABI", ELF::ELFOSABI_CLOUDABI}, | ||
+ {"Genode", "Genode", ELF::ELFOSABI_GENODE}, | ||
{"Standalone", "Standalone App", ELF::ELFOSABI_STANDALONE} | ||
}; | ||
|
||
diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp | ||
index dc7a28c72f20..eb62772c1dda 100644 | ||
--- a/unittests/ADT/TripleTest.cpp | ||
+++ b/unittests/ADT/TripleTest.cpp | ||
@@ -248,6 +248,12 @@ TEST(TripleTest, ParsedIDs) { | ||
EXPECT_EQ(Triple::Fuchsia, T.getOS()); | ||
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); | ||
|
||
+ T = Triple("x86_64-unknown-genode"); | ||
+ EXPECT_EQ(Triple::x86_64, T.getArch()); | ||
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); | ||
+ EXPECT_EQ(Triple::Genode, T.getOS()); | ||
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); | ||
+ | ||
T = Triple("x86_64-unknown-hermit"); | ||
EXPECT_EQ(Triple::x86_64, T.getArch()); | ||
EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); | ||
diff --git a/utils/benchmark/src/internal_macros.h b/utils/benchmark/src/internal_macros.h | ||
index f2d54bfcbd9d..e20f891d435b 100644 | ||
--- a/utils/benchmark/src/internal_macros.h | ||
+++ b/utils/benchmark/src/internal_macros.h | ||
@@ -65,6 +65,8 @@ | ||
#define BENCHMARK_OS_FUCHSIA 1 | ||
#elif defined (__SVR4) && defined (__sun) | ||
#define BENCHMARK_OS_SOLARIS 1 | ||
+#elif defined(__GENODE__) | ||
+ #define BENCHMARK_OS_GENODE 1 | ||
#endif | ||
|
||
#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \ | ||
diff --git a/utils/gn/secondary/clang/lib/Driver/BUILD.gn b/utils/gn/secondary/clang/lib/Driver/BUILD.gn | ||
index 04d483a12eed..e487a9a9a016 100644 | ||
--- a/utils/gn/secondary/clang/lib/Driver/BUILD.gn | ||
+++ b/utils/gn/secondary/clang/lib/Driver/BUILD.gn | ||
@@ -66,6 +66,7 @@ static_library("Driver") { | ||
"ToolChains/Flang.cpp", | ||
"ToolChains/FreeBSD.cpp", | ||
"ToolChains/Fuchsia.cpp", | ||
+ "ToolChains/Genode.cpp", | ||
"ToolChains/Gnu.cpp", | ||
"ToolChains/HIP.cpp", | ||
"ToolChains/Haiku.cpp", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters