[Patch] Support for Nuxi CloudABI

Ed Schouten ed at nuxi.nl
Fri Mar 6 11:17:57 PST 2015


The last couple of months my company (Nuxi) has been working on a
POSIX-like programming environment built on the concept of
capability-based security called CloudABI. The intent behind CloudABI
is that it can be used as a building block for large-scale
cluster/cloud computing environments.

Applications observe the operating system as a black box that only
grants them access to just the small number of resources (read: file
descriptors) that they require for execution. For example, a simple
web server will only have access to its network connection and its web
root directory. The idea behind this is that security flaws will only
allow the single process to be compromised -- not the system the
process is running on. (Live) migration of processes should also be
simpler, as the resources they require can be derived easily.

CloudABI uses BSD/MIT-licensed components as much as possible. I have
released an initial version of the C library under a 2-clause BSD


CloudABI uses a lot of LLVM components, namely LLVM itself, Clang,
libc++, libc++abi and compiler-rt. For most of these components we had
to write small patches to get them to work. My plan is to have them

Attached are the changes we made to LLVM itself. The changes are trivial:

1. Add support for "cloudabi" in target triples. Support for this has
already been added to config.sub/config.guess:


2. Let CloudABI use its own ABI number: ELFOSABI_CLOUDABI (== 17).
This number has been allocated properly and will be part of the
upcoming ELF specification draft. If needed, I can provide the
approval email I received from SCO/XinuOS.

I'll push in this change in a couple of days from now. Once submitted,
I will also send out patches for the other LLVM components.

Ed Schouten <ed at nuxi.nl>
-------------- next part --------------
Index: include/llvm/ADT/Triple.h
--- include/llvm/ADT/Triple.h	(revision 231492)
+++ include/llvm/ADT/Triple.h	(working copy)
@@ -120,6 +120,7 @@
   enum OSType {
+    CloudABI,
Index: include/llvm/MC/MCELFObjectWriter.h
--- include/llvm/MC/MCELFObjectWriter.h	(revision 231492)
+++ include/llvm/MC/MCELFObjectWriter.h	(working copy)
@@ -41,6 +41,8 @@
   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: include/llvm/Support/ELF.h
--- include/llvm/Support/ELF.h	(revision 231492)
+++ include/llvm/Support/ELF.h	(working copy)
@@ -344,6 +344,7 @@
   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: lib/Object/ELFYAML.cpp
--- lib/Object/ELFYAML.cpp	(revision 231492)
+++ lib/Object/ELFYAML.cpp	(working copy)
@@ -235,6 +235,7 @@
Index: lib/Support/Triple.cpp
--- lib/Support/Triple.cpp	(revision 231492)
+++ lib/Support/Triple.cpp	(working copy)
@@ -141,6 +141,7 @@
   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::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: tools/llvm-readobj/ELFDumper.cpp
--- tools/llvm-readobj/ELFDumper.cpp	(revision 231492)
+++ tools/llvm-readobj/ELFDumper.cpp	(working copy)
@@ -207,6 +207,7 @@
   { "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          },

More information about the llvm-commits mailing list