From: Kefu Chai Date: Mon, 30 Jul 2018 11:55:51 +0000 (+0800) Subject: cmake: always prefer local symbols X-Git-Tag: v14.0.1~689^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=38e344659980dded622322d42a7742c0e50107f8;p=ceph-ci.git cmake: always prefer local symbols Fixes: http://tracker.ceph.com/issues/25154 Signed-off-by: Kefu Chai --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ec089119484..07f11dc17cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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})