[PATCH] D146804: [libcxx] Add OHOS support

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 04:42:18 PDT 2023


kpdev42 created this revision.
kpdev42 added reviewers: phosek, ldionne, thesamesam.
kpdev42 added projects: libc++, LLVM.
Herald added a subscriber: krytarowski.
Herald added a project: All.
kpdev42 requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

LLVM and clang parts of OHOS support: D138202 <https://reviews.llvm.org/D138202>, D145227 <https://reviews.llvm.org/D145227>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146804

Files:
  libcxx/cmake/config-ix.cmake
  libcxx/include/__config
  libcxx/include/__locale
  libcxx/src/include/config_elast.h


Index: libcxx/src/include/config_elast.h
===================================================================
--- libcxx/src/include/config_elast.h
+++ libcxx/src/include/config_elast.h
@@ -29,6 +29,8 @@
 // No _LIBCPP_ELAST needed on Fuchsia
 #elif defined(__wasi__)
 // No _LIBCPP_ELAST needed on WASI
+#elif defined(__OHOS_FAMILY__)
+// No _LIBCPP_ELAST needed on OHOS
 #elif defined(__EMSCRIPTEN__)
 // No _LIBCPP_ELAST needed on Emscripten
 #elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC)
Index: libcxx/include/__locale
===================================================================
--- libcxx/include/__locale
+++ libcxx/include/__locale
@@ -42,6 +42,9 @@
 #elif defined(__wasi__)
 // WASI libc uses musl's locales support.
 # include <__support/musl/xlocale.h>
+#elif defined(__OHOS_FAMILY__)
+// LiteOS libc uses musl's locales support.
+# include <__support/musl/xlocale.h>
 #elif defined(_LIBCPP_HAS_MUSL_LIBC)
 # include <__support/musl/xlocale.h>
 #endif
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -932,7 +932,8 @@
         defined(__sun__) ||                                                                                            \
         defined(__MVS__) ||                                                                                            \
         defined(_AIX) ||                                                                                               \
-        defined(__EMSCRIPTEN__)
+        defined(__EMSCRIPTEN__) ||                                                                                     \
+        defined(__OHOS_FAMILY__)
 // clang-format on
 #      define _LIBCPP_HAS_THREAD_API_PTHREAD
 #    elif defined(__Fuchsia__)
@@ -1010,7 +1011,7 @@
 #  endif
 
 #  if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) ||                        \
-      defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__)
+      defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) || defined(__OHOS_FAMILY__)
 #    define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #  endif
 
Index: libcxx/cmake/config-ix.cmake
===================================================================
--- libcxx/cmake/config-ix.cmake
+++ libcxx/cmake/config-ix.cmake
@@ -118,6 +118,8 @@
   set(LIBCXX_HAS_M_LIB NO)
   set(LIBCXX_HAS_RT_LIB NO)
   set(LIBCXX_HAS_ATOMIC_LIB NO)
+elseif(OHOS)
+  set(LIBCXX_HAS_ATOMIC_LIB NO)
 elseif(FUCHSIA)
   set(LIBCXX_HAS_M_LIB NO)
   set(LIBCXX_HAS_PTHREAD_LIB NO)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146804.508047.patch
Type: text/x-patch
Size: 2585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230324/8c8e1481/attachment.bin>


More information about the llvm-commits mailing list