This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 0bd436c8dbea8806b43be87ce826fc8a0a3c2d92 Author: Gustavo Henrique Nihei <gustavo.ni...@espressif.com> AuthorDate: Fri Mar 25 15:55:33 2022 -0300 libcxx: Fix libc++ for archs without conditional load/store support This commit brings a patch already merged to upstream LLVM project: https://reviews.llvm.org/D118391 Signed-off-by: Gustavo Henrique Nihei <gustavo.ni...@espressif.com> --- ...tomic_-un-signed_lock_free-if-unsupported.patch | 38 ++++++++++++++++++++++ libs/libxx/libcxx.defs | 3 ++ 2 files changed, 41 insertions(+) diff --git a/libs/libxx/0002-Omit-atomic_-un-signed_lock_free-if-unsupported.patch b/libs/libxx/0002-Omit-atomic_-un-signed_lock_free-if-unsupported.patch new file mode 100644 index 0000000..d5020f1 --- /dev/null +++ b/libs/libxx/0002-Omit-atomic_-un-signed_lock_free-if-unsupported.patch @@ -0,0 +1,38 @@ +From ff00346174831ec01bc6b85c39c19d502cfa2093 Mon Sep 17 00:00:00 2001 +From: Brian Cain <bc...@quicinc.com> +Date: Thu, 27 Jan 2022 08:09:11 -0800 +Subject: [PATCH 2/2] Omit atomic_{,un}signed_lock_free if unsupported + +On targets that have limited atomic support, e.g. ones that define +ATOMIC_*_LOCK_FREE to '1' ("sometimes lock free"), we would end up +referencing yet-undefined __libcpp_{,un}signed_lock_free. + +This commit adds a guard to prevent these references for such +targets. + +Differential Revision: https://reviews.llvm.org/D118391 +--- + libcxx/include/atomic | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libcxx/include/atomic b/libcxx/include/atomic +index 0fc799a24319..57d01ad2791a 100644 +--- a/libcxx/include/atomic ++++ b/libcxx/include/atomic +@@ -2791,10 +2791,13 @@ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::typ + typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free; + #else + // No signed/unsigned lock-free types ++#define _LIBCPP_NO_LOCK_FREE_TYPES + #endif + ++#if !defined(_LIBCPP_NO_LOCK_FREE_TYPES) + typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free; + typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free; ++#endif + + #define ATOMIC_FLAG_INIT {false} + #define ATOMIC_VAR_INIT(__v) {__v} +-- +2.32.0 + diff --git a/libs/libxx/libcxx.defs b/libs/libxx/libcxx.defs index e0f6cb8..8ce3667 100644 --- a/libs/libxx/libcxx.defs +++ b/libs/libxx/libcxx.defs @@ -30,6 +30,9 @@ libcxx: libcxx-$(LIBCXX_VERSION).src.tar.xz $(Q) patch -p0 < 0001-Remove-the-locale-fallback-for-NuttX.patch $(Q) patch -p0 < 0001-libc-avoid-the-waring-__EXCEPTIONS-is-not-defined-ev.patch $(Q) patch -p1 < 0001-libcxx-Rename-PS-macro-to-avoid-clashing-with-Xtensa.patch +ifeq ($(CONFIG_LIBC_ARCH_ATOMIC),y) + $(Q) patch -p1 < 0002-Omit-atomic_-un-signed_lock_free-if-unsupported.patch +endif $(Q) touch $@ $(TOPDIR)/include/libcxx: libcxx