]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: always prefer local symbols
authorKefu Chai <kchai@redhat.com>
Mon, 30 Jul 2018 11:55:51 +0000 (19:55 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 23 Oct 2018 06:08:23 +0000 (08:08 +0200)
Fixes: http://tracker.ceph.com/issues/25154
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 38e344659980dded622322d42a7742c0e50107f8)

src/CMakeLists.txt

index 0f08c2dae4e3a50d0447ffb89ad64b2795641e65..212658a064706707a995e1db3a62f95b71c06517 100644 (file)
@@ -701,6 +701,20 @@ target_link_libraries(ceph-common ${ceph_common_deps})
 set_target_properties(ceph-common PROPERTIES
   SOVERSION 0
   INSTALL_RPATH "")
+if(NOT APPLE)
+  # Apple uses Mach-O, not ELF. so this option does not apply to APPLE.
+  #
+  # prefer the local symbol definitions when binding references to global
+  # symbols. otherwise we could reference the symbols defined by the application
+  # with the same name, instead of using the one defined in libceph-common.
+  # in other words, we require libceph-common to use local symbols, even if redefined
+  # in application".
+  set_property(
+    TARGET ceph-common
+    APPEND APPEND_STRING
+    PROPERTY LINK_FLAGS "-Wl,-Bsymbolic -Wl,-Bsymbolic-functions")
+endif()
+
 install(TARGETS ceph-common DESTINATION ${CMAKE_INSTALL_PKGLIBDIR})
 
 add_library(common_utf8 STATIC common/utf8.c)