[PATCH] D47469: Unittests: Change linker flags of dynamic library tests

Mikhail Maltsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 03:51:55 PDT 2018


miyuki created this revision.
miyuki added reviewers: philip.pfaffe, thakis.
Herald added a subscriber: mgorny.

A recent change https://reviews.llvm.org/D46898 which had no intended
behavior change, actually modified the linker flags used when linking
the dynamic libraries used by the DynamicLibraryTests unit test. This
made the test fail in our testing environment which runs the tests
from an NFS share. Prior to https://reviews.llvm.org/D46898 the two libraries used by the test
were different (because the library name used to be embedded into the
binary), and after the change they became bit-to-bit identical. This
causes dlopen to return the same handle when these two libraries are
loaded from an NFS share, and the test expects two different handles.

This patch reverts the part of https://reviews.llvm.org/D46898 that is responsible for
changing the linker flags.


https://reviews.llvm.org/D47469

Files:
  Support/DynamicLibrary/CMakeLists.txt


Index: Support/DynamicLibrary/CMakeLists.txt
===================================================================
--- Support/DynamicLibrary/CMakeLists.txt
+++ Support/DynamicLibrary/CMakeLists.txt
@@ -15,7 +15,7 @@
 export_executable_symbols(DynamicLibraryTests)
 
 function(dynlib_add_module NAME)
-  add_library(${NAME} MODULE
+  add_library(${NAME} SHARED
     PipSqueak.cpp
     )
   set_target_properties(${NAME} PROPERTIES FOLDER "Tests")
@@ -33,5 +33,12 @@
   add_dependencies(DynamicLibraryTests ${NAME})
 endfunction(dynlib_add_module)
 
+# Revert -Wl,-z,nodelete on this test since it relies on the file
+# being unloaded.
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+  string(REPLACE "-Wl,-z,nodelete" "" CMAKE_SHARED_LINKER_FLAGS
+    ${CMAKE_SHARED_LINKER_FLAGS})
+endif()
+
 dynlib_add_module(PipSqueak)
 dynlib_add_module(SecondLib)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47469.148878.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180529/fd13ff7a/attachment.bin>


More information about the llvm-commits mailing list