[PATCH] D48964: Add support for writing HermitCore (https://hermitcore.org) ELF binaries.

Colin Finck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 15 04:29:11 PDT 2018


ColinFinck updated this revision to Diff 160767.
ColinFinck added a comment.

After a reply from SCO/Xinuos and an explanation regarding the ELFOSABI constants, we came to the conclusion that the existing ELFOSABI_STANDALONE suits our needs.
Therefore, the patch has been updated to use ELFOSABI_STANDALONE for HermitCore applications.


https://reviews.llvm.org/D48964

Files:
  include/llvm/ADT/Triple.h
  include/llvm/MC/MCELFObjectWriter.h
  lib/Support/Triple.cpp
  unittests/ADT/TripleTest.cpp


Index: unittests/ADT/TripleTest.cpp
===================================================================
--- unittests/ADT/TripleTest.cpp
+++ unittests/ADT/TripleTest.cpp
@@ -235,6 +235,12 @@
   EXPECT_EQ(Triple::Fuchsia, 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());
+  EXPECT_EQ(Triple::HermitCore, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
   T = Triple("wasm32-unknown-unknown");
   EXPECT_EQ(Triple::wasm32, T.getArch());
   EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp
+++ lib/Support/Triple.cpp
@@ -208,6 +208,7 @@
   case Mesa3D: return "mesa3d";
   case Contiki: return "contiki";
   case AMDPAL: return "amdpal";
+  case HermitCore: return "hermit";
   }
 
   llvm_unreachable("Invalid OSType");
@@ -500,6 +501,7 @@
     .StartsWith("mesa3d", Triple::Mesa3D)
     .StartsWith("contiki", Triple::Contiki)
     .StartsWith("amdpal", Triple::AMDPAL)
+    .StartsWith("hermit", Triple::HermitCore)
     .Default(Triple::UnknownOS);
 }
 
Index: include/llvm/MC/MCELFObjectWriter.h
===================================================================
--- include/llvm/MC/MCELFObjectWriter.h
+++ include/llvm/MC/MCELFObjectWriter.h
@@ -73,6 +73,8 @@
     switch (OSType) {
       case Triple::CloudABI:
         return ELF::ELFOSABI_CLOUDABI;
+      case Triple::HermitCore:
+        return ELF::ELFOSABI_STANDALONE;
       case Triple::PS4:
       case Triple::FreeBSD:
         return ELF::ELFOSABI_FREEBSD;
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -181,7 +181,8 @@
     Mesa3D,
     Contiki,
     AMDPAL,     // AMD PAL Runtime
-    LastOSType = AMDPAL
+    HermitCore, // HermitCore Unikernel/Multikernel
+    LastOSType = HermitCore
   };
   enum EnvironmentType {
     UnknownEnvironment,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48964.160767.patch
Type: text/x-patch
Size: 2147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180815/43a8ed15/attachment.bin>


More information about the llvm-commits mailing list