[libcxx-commits] [libcxxabi] 372f7dd - [libc++abi] Add temporary workaround to unblock Chrome

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 31 09:58:05 PST 2024


Author: Louis Dionne
Date: 2024-01-31T12:53:33-05:00
New Revision: 372f7dd48f0165c6a7cdc819516132c617ef6f45

URL: https://github.com/llvm/llvm-project/commit/372f7dd48f0165c6a7cdc819516132c617ef6f45
DIFF: https://github.com/llvm/llvm-project/commit/372f7dd48f0165c6a7cdc819516132c617ef6f45.diff

LOG: [libc++abi] Add temporary workaround to unblock Chrome

Chrome rolls libc++ and libc++abi as separate projects. As a result, they
may not always be updated in lockstep, and this can lead to build failures
when mixing libc++ that doesn't have <__thread/support.h> with libc++abi
that requires it.

This patch adds a workaround to make libc++abi work with both versions.
While Chrome's setup is not supported, this workaround will allow them
to go back to green and do the required work needed to roll libc++ and
libc++abi in lockstep. This workaround will be short-lived -- I have a
reminder to go back and remove it by EOW.

Added: 
    

Modified: 
    libcxxabi/src/cxa_exception_storage.cpp
    libcxxabi/src/cxa_guard_impl.h
    libcxxabi/src/cxa_thread_atexit.cpp
    libcxxabi/src/fallback_malloc.cpp
    libcxxabi/test/test_fallback_malloc.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxxabi/src/cxa_exception_storage.cpp b/libcxxabi/src/cxa_exception_storage.cpp
index 2479f550e09ef..b2a31f8d509b5 100644
--- a/libcxxabi/src/cxa_exception_storage.cpp
+++ b/libcxxabi/src/cxa_exception_storage.cpp
@@ -12,7 +12,12 @@
 
 #include "cxa_exception.h"
 
-#include <__thread/support.h>
+// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
+#if __has_include(<__thread/support.h>)
+#  include <__thread/support.h>
+#else
+#  include <__threading_support>
+#endif
 
 #if defined(_LIBCXXABI_HAS_NO_THREADS)
 

diff  --git a/libcxxabi/src/cxa_guard_impl.h b/libcxxabi/src/cxa_guard_impl.h
index 7b140d3c36045..197eb788d5b0c 100644
--- a/libcxxabi/src/cxa_guard_impl.h
+++ b/libcxxabi/src/cxa_guard_impl.h
@@ -55,7 +55,13 @@
 #  endif
 #endif
 
-#include <__thread/support.h>
+// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
+#if __has_include(<__thread/support.h>)
+#  include <__thread/support.h>
+#else
+#  include <__threading_support>
+#endif
+
 #include <cstdint>
 #include <cstring>
 #include <limits.h>

diff  --git a/libcxxabi/src/cxa_thread_atexit.cpp b/libcxxabi/src/cxa_thread_atexit.cpp
index c6bd0aa323f2e..55025130932e9 100644
--- a/libcxxabi/src/cxa_thread_atexit.cpp
+++ b/libcxxabi/src/cxa_thread_atexit.cpp
@@ -8,7 +8,12 @@
 
 #include "abort_message.h"
 #include "cxxabi.h"
-#include <__thread/support.h>
+// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
+#if __has_include(<__thread/support.h>)
+#  include <__thread/support.h>
+#else
+#  include <__threading_support>
+#endif
 #ifndef _LIBCXXABI_HAS_NO_THREADS
 #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
 #pragma comment(lib, "pthread")

diff  --git a/libcxxabi/src/fallback_malloc.cpp b/libcxxabi/src/fallback_malloc.cpp
index 76bd2e9bcd9f7..8ff40f615d4d1 100644
--- a/libcxxabi/src/fallback_malloc.cpp
+++ b/libcxxabi/src/fallback_malloc.cpp
@@ -9,7 +9,12 @@
 #include "fallback_malloc.h"
 #include "abort_message.h"
 
-#include <__thread/support.h>
+// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
+#if __has_include(<__thread/support.h>)
+#  include <__thread/support.h>
+#else
+#  include <__threading_support>
+#endif
 #ifndef _LIBCXXABI_HAS_NO_THREADS
 #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
 #pragma comment(lib, "pthread")

diff  --git a/libcxxabi/test/test_fallback_malloc.pass.cpp b/libcxxabi/test/test_fallback_malloc.pass.cpp
index c8a6a0797510d..885960ddb4b00 100644
--- a/libcxxabi/test/test_fallback_malloc.pass.cpp
+++ b/libcxxabi/test/test_fallback_malloc.pass.cpp
@@ -11,7 +11,12 @@
 #include <cassert>
 #include <inttypes.h>
 
-#include <__thread/support.h>
+// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
+#if __has_include(<__thread/support.h>)
+#  include <__thread/support.h>
+#else
+#  include <__threading_support>
+#endif
 
 // UNSUPPORTED: c++03
 // UNSUPPORTED: modules-build && no-threads


        


More information about the libcxx-commits mailing list