Line 0
Link Here
|
|
|
1 |
--- /CMakeLists.txt |
2 |
+++ /CMakeLists.txt |
3 |
@@ -335,6 +335,7 @@ if(LLVM_ENABLE_BACKTRACES) |
4 |
endif() |
5 |
|
6 |
option(LLVM_ENABLE_UNWIND_TABLES "Emit unwind tables for the libraries" ON) |
7 |
+set(UNWIND_LIBRARIES "" CACHE STRING "Additional libraries needed for unwind functions") |
8 |
|
9 |
option(LLVM_ENABLE_CRASH_OVERRIDES "Enable crash overrides." ON) |
10 |
if(LLVM_ENABLE_CRASH_OVERRIDES) |
11 |
--- /cmake/modules/AddLLVM.cmake |
12 |
+++ /cmake/modules/AddLLVM.cmake |
13 |
@@ -641,6 +641,9 @@ function(llvm_add_library name) |
14 |
${lib_deps} |
15 |
${llvm_libs} |
16 |
) |
17 |
+ if(UNWIND_LIBRARIES) |
18 |
+ target_link_libraries(${name} PRIVATE -Wl,--push-state -Wl,--as-needed ${UNWIND_LIBRARIES} -Wl,--pop-state) |
19 |
+ endif() |
20 |
|
21 |
if(LLVM_COMMON_DEPENDS) |
22 |
add_dependencies(${name} ${LLVM_COMMON_DEPENDS}) |
23 |
@@ -868,6 +871,9 @@ macro(add_llvm_executable name) |
24 |
# API for all shared libaries loaded by this executable. |
25 |
target_link_libraries(${name} PRIVATE ${LLVM_PTHREAD_LIB}) |
26 |
endif() |
27 |
+ if(UNWIND_LIBRARIES) |
28 |
+ target_link_libraries(${name} PRIVATE -Wl,--push-state -Wl,--as-needed ${UNWIND_LIBRARIES} -Wl,--pop-state) |
29 |
+ endif() |
30 |
|
31 |
llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} BUNDLE_PATH ${ARG_BUNDLE_PATH}) |
32 |
endmacro(add_llvm_executable name) |
33 |
--- /unittests/Support/DynamicLibrary/CMakeLists.txt |
34 |
+++ /unittests/Support/DynamicLibrary/CMakeLists.txt |
35 |
@@ -26,6 +26,9 @@ function(dynlib_add_module NAME) |
36 |
PipSqueak.cpp |
37 |
) |
38 |
set_target_properties(${NAME} PROPERTIES FOLDER "Tests") |
39 |
+ if(UNWIND_LIBRARIES) |
40 |
+ target_link_libraries(${NAME} PRIVATE -Wl,--push-state -Wl,--as-needed ${UNWIND_LIBRARIES} -Wl,--pop-state) |
41 |
+ endif() |
42 |
|
43 |
set_output_directory(${NAME} |
44 |
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} |