Skip to content

Commit 5eccb0f

Browse files
authored
Update libc++abi to LLVM 14 (#16993)
No major conflicts or changes required.
1 parent 22e3b04 commit 5eccb0f

37 files changed

+1232
-1229
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ See docs/process.md for more on how version tagging works.
2828
and therefore was renamed to `EMTEST_BUILD_VERBOSE`. (#16904)
2929
- compiler-rt updated to LLVM 14. (#16991)
3030
- libc++ updated to LLVM 14. (#17000)
31+
- libc++abi updated to LLVM 14. (#16993)
3132

3233
3.1.10 - 05/02/2022
3334
-------------------

system/lib/libcxxabi/include/__cxxabi_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-------------------------- __cxxabi_config.h -------------------------===//
1+
//===----------------------------------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -93,7 +93,7 @@
9393
# if !__has_feature(cxx_exceptions)
9494
# define _LIBCXXABI_NO_EXCEPTIONS
9595
# endif
96-
#elif defined(_LIBCXXABI_COMPILER_GCC) && !__EXCEPTIONS
96+
#elif defined(_LIBCXXABI_COMPILER_GCC) && !defined(__EXCEPTIONS)
9797
# define _LIBCXXABI_NO_EXCEPTIONS
9898
#endif
9999

system/lib/libcxxabi/include/cxxabi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--------------------------- cxxabi.h ---------------------------------===//
1+
//===----------------------------------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

system/lib/libcxxabi/readme.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
llvm's libcxxabi
22
----------------
33

4-
These files are from the llvm-project based on release 13.0.0.
4+
These files are from the llvm-project based on release 14.0.0.
55

66
We maintain a local fork of llvm-project that contains any emscripten
77
specific patches:
@@ -10,8 +10,8 @@ specific patches:
1010

1111
The current patch is based on:
1212

13-
tag: llvmorg-13.0.0
14-
git: d7b669b3a30345cfcdb2fde2af6f48aa4b94845d
13+
tag: llvmorg-14.0.0
14+
git: 329fda39c507e8740978d10458451dcdb21563be
1515

1616
Update Instructions
1717
-------------------
@@ -23,4 +23,4 @@ Modifications
2323

2424
For a list of changes from upstream see the libcxxabi files that are part of:
2525

26-
https://github.com/llvm/llvm-project/compare/llvmorg-13.0.0...emscripten-core:emscripten-libs-13.0.0
26+
https://github.com/llvm/llvm-project/compare/llvmorg-14.0.0...emscripten-core:emscripten-libs-14.0.0

system/lib/libcxxabi/src/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ if (MSVC_IDE OR XCODE)
5656
endif()
5757
endif()
5858

59-
# stdlib_stdexcept.cpp depends on libc++ internals.
60-
include_directories("${LIBCXXABI_LIBCXX_PATH}")
59+
# Some files depend on libc++ internals.
60+
include_directories("${LIBCXXABI_LIBCXX_PATH}/src")
6161

6262
if (LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
6363
add_definitions(-DHAVE___CXA_THREAD_ATEXIT_IMPL)
@@ -136,7 +136,8 @@ if ( APPLE )
136136
message(WARNING "LLVM_USE_SANITIZER=${LLVM_USE_SANITIZER} is not supported on OS X")
137137
endif()
138138
if (LIBFILE)
139-
find_compiler_rt_dir(LIBDIR)
139+
find_compiler_rt_library(builtins LIBCXXABI_BUILTINS_LIBRARY)
140+
get_filename_component(LIBDIR "${LIBCXXABI_BUILTINS_LIBRARY}" DIRECTORY)
140141
if (NOT IS_DIRECTORY "${LIBDIR}")
141142
message(FATAL_ERROR "Cannot find compiler-rt directory on OS X required for LLVM_USE_SANITIZER")
142143
endif()
@@ -191,7 +192,6 @@ if (LIBCXXABI_ENABLE_SHARED)
191192
SOVERSION "1"
192193
VERSION "${LIBCXXABI_LIBRARY_VERSION}"
193194
DEFINE_SYMBOL ""
194-
POSITION_INDEPENDENT_CODE ON
195195
)
196196

197197
list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared")
@@ -244,7 +244,6 @@ if (LIBCXXABI_ENABLE_STATIC)
244244
COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}"
245245
LINK_FLAGS "${LIBCXXABI_LINK_FLAGS}"
246246
OUTPUT_NAME "c++abi"
247-
POSITION_INDEPENDENT_CODE ON
248247
)
249248

250249
if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
@@ -294,6 +293,7 @@ if (LIBCXXABI_INSTALL_LIBRARY)
294293
install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
295294
LIBRARY DESTINATION ${LIBCXXABI_INSTALL_LIBRARY_DIR} COMPONENT cxxabi
296295
ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_LIBRARY_DIR} COMPONENT cxxabi
296+
RUNTIME DESTINATION ${LIBCXXABI_INSTALL_RUNTIME_DIR} COMPONENT cxxabi
297297
)
298298
endif()
299299

system/lib/libcxxabi/src/abort_message.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===------------------------- abort_message.cpp --------------------------===//
1+
//===----------------------------------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

system/lib/libcxxabi/src/abort_message.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-------------------------- abort_message.h-----------------------------===//
1+
//===----------------------------------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

system/lib/libcxxabi/src/cxa_aux_runtime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===------------------------ cxa_aux_runtime.cpp -------------------------===//
1+
//===----------------------------------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

system/lib/libcxxabi/src/cxa_default_handlers.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
//===------------------------- cxa_default_handlers.cpp -------------------===//
1+
//===----------------------------------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//
8-
// This file implements the default terminate_handler and unexpected_handler.
8+
// This file implements the default terminate_handler, unexpected_handler and
9+
// new_handler.
910
//===----------------------------------------------------------------------===//
1011

1112
#include <exception>
@@ -15,7 +16,7 @@
1516
#include "cxa_handlers.h"
1617
#include "cxa_exception.h"
1718
#include "private_typeinfo.h"
18-
#include "include/atomic_support.h"
19+
#include "include/atomic_support.h" // from libc++
1920

2021
#if !defined(LIBCXXABI_SILENT_TERMINATE)
2122

@@ -104,6 +105,9 @@ _LIBCPP_SAFE_STATIC std::terminate_handler __cxa_terminate_handler = default_ter
104105
_LIBCXXABI_DATA_VIS
105106
_LIBCPP_SAFE_STATIC std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler;
106107

108+
_LIBCXXABI_DATA_VIS
109+
_LIBCPP_SAFE_STATIC std::new_handler __cxa_new_handler = 0;
110+
107111
namespace std
108112
{
109113

@@ -125,4 +129,10 @@ set_terminate(terminate_handler func) noexcept
125129
_AO_Acq_Rel);
126130
}
127131

132+
new_handler
133+
set_new_handler(new_handler handler) noexcept
134+
{
135+
return __libcpp_atomic_exchange(&__cxa_new_handler, handler, _AO_Acq_Rel);
136+
}
137+
128138
}

system/lib/libcxxabi/src/cxa_demangle.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-------------------------- cxa_demangle.cpp --------------------------===//
1+
//===----------------------------------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -342,21 +342,21 @@ __cxa_demangle(const char *MangledName, char *Buf, size_t *N, int *Status) {
342342

343343
int InternalStatus = demangle_success;
344344
Demangler Parser(MangledName, MangledName + std::strlen(MangledName));
345-
OutputStream S;
345+
OutputBuffer O;
346346

347347
Node *AST = Parser.parse();
348348

349349
if (AST == nullptr)
350350
InternalStatus = demangle_invalid_mangled_name;
351-
else if (!initializeOutputStream(Buf, N, S, 1024))
351+
else if (!initializeOutputBuffer(Buf, N, O, 1024))
352352
InternalStatus = demangle_memory_alloc_failure;
353353
else {
354354
assert(Parser.ForwardTemplateRefs.empty());
355-
AST->print(S);
356-
S += '\0';
355+
AST->print(O);
356+
O += '\0';
357357
if (N != nullptr)
358-
*N = S.getCurrentPosition();
359-
Buf = S.getBuffer();
358+
*N = O.getCurrentPosition();
359+
Buf = O.getBuffer();
360360
}
361361

362362
if (Status)

0 commit comments

Comments
 (0)