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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to