[libcxx-commits] [libcxx] [libcxx] Add OHOS support (PR #73114)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 22 05:10:18 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Pavel Kosov (kpdev)

<details>
<summary>Changes</summary>

Add support for OpenHarmony OS (OHOS)

OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. It targets IoT, and already used on production devices.

General OpenHarmony OS discussion on discourse thread:
  "Add support for OpenHarmony OS"
  https://discourse.llvm.org/t/rfc-add-support-for-openharmony-os/66656

LLVM and clang parts of OHOS support: D138202, D145227

Phabricator review: D146804

~~

Huawei RRI, OS Lab

---
Full diff: https://github.com/llvm/llvm-project/pull/73114.diff


6 Files Affected:

- (modified) libcxx/cmake/config-ix.cmake (+2) 
- (modified) libcxx/include/__config (+3-2) 
- (modified) libcxx/include/__locale (+3) 
- (modified) libcxx/src/include/config_elast.h (+2) 
- (modified) libcxx/utils/ci/BOT_OWNERS.txt (+5) 
- (modified) libcxx/utils/ci/buildkite-pipeline.yml (+11) 


``````````diff
diff --git a/libcxx/cmake/config-ix.cmake b/libcxx/cmake/config-ix.cmake
index a365517936e7565..c92fd0f8762ea98 100644
--- a/libcxx/cmake/config-ix.cmake
+++ b/libcxx/cmake/config-ix.cmake
@@ -103,6 +103,8 @@ elseif(APPLE)
   set(LIBCXX_HAS_PTHREAD_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_PTHREAD_LIB NO)
   set(LIBCXX_HAS_RT_LIB NO)
diff --git a/libcxx/include/__config b/libcxx/include/__config
index e8da358bb8d7cd5..da5613fe189b8cb 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1098,7 +1098,8 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
         defined(__APPLE__) ||                                                                                          \
         defined(__MVS__) ||                                                                                            \
         defined(_AIX) ||                                                                                               \
-        defined(__EMSCRIPTEN__)
+        defined(__EMSCRIPTEN__) ||                                                                                     \
+        defined(__OHOS_FAMILY__)
 // clang-format on
 #      define _LIBCPP_HAS_THREAD_API_PTHREAD
 #    elif defined(__Fuchsia__)
@@ -1176,7 +1177,7 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
 #  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
 
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index b1502dd71edadf6..c5d8fe72cdf9631 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -48,6 +48,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
diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h
index a772ea7a01bcefb..64a548f63c98282 100644
--- a/libcxx/src/include/config_elast.h
+++ b/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)
diff --git a/libcxx/utils/ci/BOT_OWNERS.txt b/libcxx/utils/ci/BOT_OWNERS.txt
index 721b19e52d8bcb1..1e624257d3dfd40 100644
--- a/libcxx/utils/ci/BOT_OWNERS.txt
+++ b/libcxx/utils/ci/BOT_OWNERS.txt
@@ -20,3 +20,8 @@ N: Android libc++
 E: rprichard at google.com
 H: rprichard
 D: Emulator-based x86[-64] libc++ CI testing
+
+N: OpenHarmony libc++
+E: kosov.pavel at huawei.com
+H: kpdev42
+D: AArch64
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 39db2bfc473813a..a72700c6d83add8 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -82,6 +82,10 @@ agents_definitions:
     agents:
       queue: libcxx-builders
       os: android
+  _ohos_agent: &ohos_agent
+    agents:
+      queue: libcxx-builders
+      os: ohos
 
 
 environment_definitions:
@@ -274,6 +278,13 @@ steps:
     <<: *android_agent
     <<: *common
 
+- group: ':ohos: OpenHarmony'
+  steps:
+  - label: OpenHarmony Aarch64
+    command: libcxx/utils/ci/run-buildbot aarch64-linux-ohos
+    soft_fail: true
+    <<: *ohos_agent
+    <<: *common
 
     # TODO: Re-enable this once we've figured out how to run back-deployment testing on arm64 on recent OSes
     # - label: "Apple back-deployment macosx11.0 arm64"

``````````

</details>


https://github.com/llvm/llvm-project/pull/73114


More information about the libcxx-commits mailing list