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.nihei@espressif.com>
This commit is contained in:
Gustavo Henrique Nihei 2022-03-25 15:55:33 -03:00 committed by Xiang Xiao
parent 8a215b60af
commit 0bd436c8db
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,38 @@
From ff00346174831ec01bc6b85c39c19d502cfa2093 Mon Sep 17 00:00:00 2001
From: Brian Cain <bcain@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

View File

@ -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