aboutsummaryrefslogtreecommitdiff
path: root/libcxxabi
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2023-08-24 15:49:54 -0700
committerShoaib Meenai <smeenai@fb.com>2023-08-28 17:34:45 -0700
commit3789c236bbda9dda6e927cb0fff9da67f1eebc70 (patch)
tree075ed524a78b0bc96eebaf6facbea26b5f0b31d8 /libcxxabi
parent2e53e15480746ab83be8f0afd64f7badd0540c91 (diff)
downloadllvm-3789c236bbda9dda6e927cb0fff9da67f1eebc70.zip
llvm-3789c236bbda9dda6e927cb0fff9da67f1eebc70.tar.gz
llvm-3789c236bbda9dda6e927cb0fff9da67f1eebc70.tar.bz2
[libcxxabi] Automatically use static libunwind when required
If we attempt to use unwind_shared when LIBUNWIND_ENABLE_SHARED is OFF, we'll get link errors. LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY avoids that, but it seems redundant to have to specify it manually. Automatically switch libunwind statically when its shared build is disabled, which also matches compiler-rt [1]. [1] https://github.com/llvm/llvm-project/blob/71bfec762bd970e7834f58c158ddc15f93402d7a/compiler-rt/CMakeLists.txt#L238-L240 Reviewed By: #libc_abi, phosek Differential Revision: https://reviews.llvm.org/D158789
Diffstat (limited to 'libcxxabi')
-rw-r--r--libcxxabi/src/CMakeLists.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 54002ba..3ad75580 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -160,7 +160,8 @@ include(WarningFlags)
add_library(cxxabi_shared_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
cxx_add_warning_flags(cxxabi_shared_objects ${LIBCXXABI_ENABLE_WERROR} ${LIBCXXABI_ENABLE_PEDANTIC})
if (LIBCXXABI_USE_LLVM_UNWINDER)
- if (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY)
+ if (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY OR
+ (DEFINED LIBUNWIND_ENABLE_SHARED AND NOT LIBUNWIND_ENABLE_SHARED))
target_link_libraries(cxxabi_shared_objects PUBLIC unwind_shared_objects) # propagate usage requirements
target_sources(cxxabi_shared_objects PUBLIC $<TARGET_OBJECTS:unwind_shared_objects>)
else()