Skip to content

Commit 372f7dd

Browse files
committed
[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.
1 parent 2542876 commit 372f7dd

5 files changed

+31
-5
lines changed

libcxxabi/src/cxa_exception_storage.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212

1313
#include "cxa_exception.h"
1414

15-
#include <__thread/support.h>
15+
// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
16+
#if __has_include(<__thread/support.h>)
17+
# include <__thread/support.h>
18+
#else
19+
# include <__threading_support>
20+
#endif
1621

1722
#if defined(_LIBCXXABI_HAS_NO_THREADS)
1823

libcxxabi/src/cxa_guard_impl.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@
5555
# endif
5656
#endif
5757

58-
#include <__thread/support.h>
58+
// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
59+
#if __has_include(<__thread/support.h>)
60+
# include <__thread/support.h>
61+
#else
62+
# include <__threading_support>
63+
#endif
64+
5965
#include <cstdint>
6066
#include <cstring>
6167
#include <limits.h>

libcxxabi/src/cxa_thread_atexit.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88

99
#include "abort_message.h"
1010
#include "cxxabi.h"
11-
#include <__thread/support.h>
11+
// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
12+
#if __has_include(<__thread/support.h>)
13+
# include <__thread/support.h>
14+
#else
15+
# include <__threading_support>
16+
#endif
1217
#ifndef _LIBCXXABI_HAS_NO_THREADS
1318
#if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
1419
#pragma comment(lib, "pthread")

libcxxabi/src/fallback_malloc.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
#include "fallback_malloc.h"
1010
#include "abort_message.h"
1111

12-
#include <__thread/support.h>
12+
// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
13+
#if __has_include(<__thread/support.h>)
14+
# include <__thread/support.h>
15+
#else
16+
# include <__threading_support>
17+
#endif
1318
#ifndef _LIBCXXABI_HAS_NO_THREADS
1419
#if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
1520
#pragma comment(lib, "pthread")

libcxxabi/test/test_fallback_malloc.pass.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
#include <cassert>
1212
#include <inttypes.h>
1313

14-
#include <__thread/support.h>
14+
// TODO: Temporary workaround, see https://github.com/llvm/llvm-project/pull/79654#issuecomment-1919397302
15+
#if __has_include(<__thread/support.h>)
16+
# include <__thread/support.h>
17+
#else
18+
# include <__threading_support>
19+
#endif
1520

1621
// UNSUPPORTED: c++03
1722
// UNSUPPORTED: modules-build && no-threads

0 commit comments

Comments
 (0)