diff options
Diffstat (limited to 'cmake/modules/HandleLLVMOptions.cmake')
-rw-r--r-- | cmake/modules/HandleLLVMOptions.cmake | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index c5390371845..b5059a8a60e 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -151,6 +151,14 @@ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") endif() +# Pass -Wl,-z,nodelete. This makes sure our shared libraries are not unloaded +# by dlclose(). We need that since the CLI API relies on cross-references +# between global objects which became horribly broken when one of the libraries +# is unloaded. +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,nodelete") +endif() + function(append value) foreach(variable ${ARGN}) |