Skip to content

Commit 8f90e69

Browse files
authored
[runtimes] Use LLVM libunwind from libc++abi by default (llvm#77687)
I recently came across LIBCXXABI_USE_LLVM_UNWINDER and was surprised to notice it was disabled by default. Since we build libunwind by default and ship it in the LLVM toolchain, it would seem to make sense that libc++ and libc++abi rely on libunwind for unwinding instead of using the system-provided unwinding library (if any). Most importantly, using the system unwinder implies that libc++abi is ABI compatible with that system unwinder, which is not necessarily the case. Hence, it makes a lot more sense to instead default to using the known-to-be-compatible LLVM unwinder, and let vendors manually select a different unwinder if desired. As a follow-up change, we should probably apply the same default to compiler-rt. Differential Revision: https://reviews.llvm.org/D150897 Fixes llvm#77662 rdar://120801778
1 parent 3b3ee1f commit 8f90e69

19 files changed

+16
-18
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ jobs:
163163
'generic-no-rtti',
164164
'generic-optimized-speed',
165165
'generic-static',
166-
'generic-with_llvm_unwinder',
167166
# TODO Find a better place for the benchmark and bootstrapping builds to live. They're either very expensive
168167
# or don't provide much value since the benchmark run results are too noise on the bots.
169168
'benchmarks',

libcxx/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ option(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
274274
libc++abi. Doing otherwise is an ODR violation." OFF)
275275
# Build libc++abi with libunwind. We need this option to determine whether to
276276
# link with libunwind or libgcc_s while running the test cases.
277-
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
277+
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." ON)
278278

279279
# Target options --------------------------------------------------------------
280280
option(LIBCXX_BUILD_32_BITS "Build 32 bit multilib libc++. This option is not supported anymore when building the runtimes. Please specify a full triple instead." ${LLVM_BUILD_32_BITS})

libcxx/cmake/caches/AArch64.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
21
set(CMAKE_CXX_COMPILER_TARGET "aarch64-linux-gnu" CACHE STRING "")

libcxx/cmake/caches/AIX.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ set(LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
1313
set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "")
1414
set(LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
1515
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
16-
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
1716
set(LIBUNWIND_ENABLE_SHARED ON CACHE BOOL "")
1817
set(LIBUNWIND_ENABLE_STATIC OFF CACHE BOOL "")

libcxx/cmake/caches/AndroidNDK.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
2222
set(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY ON CACHE BOOL "")
2323
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
2424

25+
# Android uses its own unwinder library
26+
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
27+
2528
# Clang links libc++ by default, but it doesn't exist yet. The libc++ CMake
2629
# files specify -nostdlib++ to avoid this problem, but CMake's default "compiler
2730
# works" testing doesn't pass that flag, so force those tests to pass.

libcxx/cmake/caches/Apple.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
1414

1515
set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "")
1616
set(LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST ON CACHE BOOL "")
17+
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "") # libunwind is built separately
1718

1819
set(LIBCXX_TEST_CONFIG "apple-libc++-shared.cfg.in" CACHE STRING "")
1920
set(LIBCXXABI_TEST_CONFIG "apple-libc++abi-shared.cfg.in" CACHE STRING "")

libcxx/cmake/caches/Armv7Arm.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
21
set(CMAKE_CXX_COMPILER_TARGET "armv7l-linux-gnueabihf" CACHE STRING "")
32
set(CMAKE_CXX_FLAGS "-marm" CACHE STRING "")
43
set(CMAKE_C_FLAGS "-marm" CACHE STRING "")

libcxx/cmake/caches/Armv7M-picolibc.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ set(LIBCXXABI_ENABLE_STATIC ON CACHE BOOL "")
1919
set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
2020
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
2121
set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
22-
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
2322
set(LIBCXX_ENABLE_EXCEPTIONS ON CACHE BOOL "")
2423
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE STRING "")
2524
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")

libcxx/cmake/caches/Armv7Thumb-no-exceptions.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
21
set(CMAKE_CXX_COMPILER_TARGET "armv7l-linux-gnueabihf" CACHE STRING "")
32
set(CMAKE_CXX_FLAGS "-mthumb" CACHE STRING "")
43
set(CMAKE_C_FLAGS "-mthumb" CACHE STRING "")

libcxx/cmake/caches/Armv8Arm.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
21
set(CMAKE_CXX_COMPILER_TARGET "armv8l-linux-gnueabihf" CACHE STRING "")
32
set(CMAKE_CXX_FLAGS "-marm" CACHE STRING "")
43
set(CMAKE_C_FLAGS "-marm" CACHE STRING "")

0 commit comments

Comments
 (0)