Add support for Nuxi CloudABI.
authorEd Schouten <ed@80386.nl>
Mon, 9 Mar 2015 18:40:45 +0000 (18:40 +0000)
committerEd Schouten <ed@80386.nl>
Mon, 9 Mar 2015 18:40:45 +0000 (18:40 +0000)
CloudABI is a POSIX-like runtime environment built around the concept of
capability-based security. More details:

https://github.com/NuxiNL/cloudlibc

CloudABI uses its own ELFOSABI number. This number has been allocated by
the maintainers of ELF a couple of days ago.

Reviewed by: echristo

llvm-svn: 231681

llvm/include/llvm/ADT/Triple.h
llvm/include/llvm/MC/MCELFObjectWriter.h
llvm/include/llvm/Support/ELF.h
llvm/lib/Object/ELFYAML.cpp
llvm/lib/Support/Triple.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/unittests/ADT/TripleTest.cpp

index 886f6fb..535e0cc 100644 (file)
@@ -120,6 +120,7 @@ public:
   enum OSType {
     UnknownOS,
 
+    CloudABI,
     Darwin,
     DragonFly,
     FreeBSD,
index 9763635..7493507 100644 (file)
@@ -41,6 +41,8 @@ protected:
 public:
   static uint8_t getOSABI(Triple::OSType OSType) {
     switch (OSType) {
+      case Triple::CloudABI:
+        return ELF::ELFOSABI_CLOUDABI;
       case Triple::PS4:
       case Triple::FreeBSD:
         return ELF::ELFOSABI_FREEBSD;
index fc6f314..d7f1533 100644 (file)
@@ -344,6 +344,7 @@ enum {
   ELFOSABI_NSK = 14,          // Hewlett-Packard Non-Stop Kernel
   ELFOSABI_AROS = 15,         // AROS
   ELFOSABI_FENIXOS = 16,      // FenixOS
+  ELFOSABI_CLOUDABI = 17,     // Nuxi CloudABI
   ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
   ELFOSABI_C6000_LINUX = 65,  // Linux TMS320C6000
   ELFOSABI_ARM = 97,          // ARM
index cce05cf..19527e2 100644 (file)
@@ -235,6 +235,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
   ECase(ELFOSABI_NSK)
   ECase(ELFOSABI_AROS)
   ECase(ELFOSABI_FENIXOS)
+  ECase(ELFOSABI_CLOUDABI)
   ECase(ELFOSABI_C6000_ELFABI)
   ECase(ELFOSABI_C6000_LINUX)
   ECase(ELFOSABI_ARM)
index 33472e5..59a7ba1 100644 (file)
@@ -141,6 +141,7 @@ const char *Triple::getOSTypeName(OSType Kind) {
   switch (Kind) {
   case UnknownOS: return "unknown";
 
+  case CloudABI: return "cloudabi";
   case Darwin: return "darwin";
   case DragonFly: return "dragonfly";
   case FreeBSD: return "freebsd";
@@ -345,6 +346,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
 
 static Triple::OSType parseOS(StringRef OSName) {
   return StringSwitch<Triple::OSType>(OSName)
+    .StartsWith("cloudabi", Triple::CloudABI)
     .StartsWith("darwin", Triple::Darwin)
     .StartsWith("dragonfly", Triple::DragonFly)
     .StartsWith("freebsd", Triple::FreeBSD)
index e4b7601..39fb065 100644 (file)
@@ -207,6 +207,7 @@ static const EnumEntry<unsigned> ElfOSABI[] = {
   { "NSK",          ELF::ELFOSABI_NSK          },
   { "AROS",         ELF::ELFOSABI_AROS         },
   { "FenixOS",      ELF::ELFOSABI_FENIXOS      },
+  { "CloudABI",     ELF::ELFOSABI_CLOUDABI     },
   { "C6000_ELFABI", ELF::ELFOSABI_C6000_ELFABI },
   { "C6000_LINUX" , ELF::ELFOSABI_C6000_LINUX  },
   { "ARM",          ELF::ELFOSABI_ARM          },
index 1f9aa32..230f2ab 100644 (file)
@@ -159,6 +159,12 @@ TEST(TripleTest, ParsedIDs) {
   EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
   EXPECT_EQ(Triple::UnknownOS, T.getOS());
 
+  T = Triple("x86_64-unknown-cloudabi");
+  EXPECT_EQ(Triple::x86_64, T.getArch());
+  EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+  EXPECT_EQ(Triple::CloudABI, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
   T = Triple("huh");
   EXPECT_EQ(Triple::UnknownArch, T.getArch());
 }