[PATCH] D40459: [cmake] Pass -Wl, -z, nodelete on Linux to prevent unloading

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 10:35:13 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL319069: [cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D40459?vs=124267&id=124418#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40459

Files:
  llvm/trunk/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
@@ -151,6 +151,14 @@
   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})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40459.124418.patch
Type: text/x-patch
Size: 779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171127/0276d9fe/attachment.bin>


More information about the llvm-commits mailing list