[PATCH] D41073: Wasm: add support in libcxx

Nicholas Wilson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 16 07:06:19 PST 2017


ncw updated this revision to Diff 127242.
ncw added a comment.
Herald added a subscriber: krytarowski.

Although Dan has already reviewed, I've sneakily added in another change here to help compilation against Musl.

Musl is Linux-only, or rather, provides the linux ABI. For Wasm, `__linux` isn't defined but if we're using Musl then we can provide ELAST and get rid of the associated warnings. Musl is definitely wedded to the 4096 errno limit that's part of the Linux ABI, so I believe this change is safe.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41073

Files:
  include/__config
  src/include/config_elast.h


Index: src/include/config_elast.h
===================================================================
--- src/include/config_elast.h
+++ src/include/config_elast.h
@@ -24,7 +24,7 @@
 #define _LIBCPP_ELAST __ELASTERROR
 #elif defined(__Fuchsia__)
 // No _LIBCPP_ELAST needed on Fuchsia
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 #define _LIBCPP_ELAST 4095
 #elif defined(__APPLE__)
 // No _LIBCPP_ELAST needed on Apple
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -45,6 +45,8 @@
 #define _LIBCPP_OBJECT_FORMAT_MACHO 1
 #elif defined(_WIN32)
 #define _LIBCPP_OBJECT_FORMAT_COFF  1
+#elif defined(__wasm__)
+#define _LIBCPP_OBJECT_FORMAT_WASM  1
 #else
 #error Unknown object file format
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41073.127242.patch
Type: text/x-patch
Size: 829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171216/a277f3c6/attachment.bin>


More information about the cfe-commits mailing list