[llvm] r226828 - Pass -Wl, -z, defs when building shared libraries, but not with the sanitizers.

Rafael Espindola rafael.espindola at gmail.com
Thu Jan 22 06:06:52 PST 2015


Author: rafael
Date: Thu Jan 22 08:06:51 2015
New Revision: 226828

URL: http://llvm.org/viewvc/llvm-project?rev=226828&view=rev
Log:
Pass -Wl,-z,defs when building shared libraries, but not with the sanitizers.

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

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=226828&r1=226827&r2=226828&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Jan 22 08:06:51 2015
@@ -104,6 +104,14 @@ if(APPLE)
   set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
 endif()
 
+# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
+# build might work on ELF but fail on MachO/COFF.
+if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32) AND
+  NOT LLVM_USE_SANITIZER)
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
+endif()
+
+
 function(append value)
   foreach(variable ${ARGN})
     set(${variable} "${${variable}} ${value}" PARENT_SCOPE)





More information about the llvm-commits mailing list