]> 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)
committerKefu Chai <kchai@redhat.com>
Fri, 3 Aug 2018 02:02:34 +0000 (10:02 +0800)
Fixes: http://tracker.ceph.com/issues/25154
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/CMakeLists.txt

index ec089119484115fc18847816f02163a20717de36..07f11dc17ccf7e954ff210a515e7e6838d273a5e 100644 (file)
@@ -414,6 +414,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})
 
 if(${WITH_LTTNG})