From 8c486908a829b08dc6a455e706735be7fa09e5fa Mon Sep 17 00:00:00 2001 From: Senthil Date: Thu, 17 Mar 2016 18:25:02 -0700 Subject: [PATCH] Add bsymbolic flags to linux linker The problem with not having these flags are: `libhostfxr.so` and `libhostpolicy.so` would still keep using common functions that are defined in `dotnet.exe` effectively void a servicing override. Of course, servicing of common code would service both `dotnet.exe` and `libhostpolicy.so`, but this is needed to match Windows for consistency and is easier to reason about. --- src/corehost/cli/setup.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corehost/cli/setup.cmake b/src/corehost/cli/setup.cmake index d3e65f55d..9f7d15d44 100644 --- a/src/corehost/cli/setup.cmake +++ b/src/corehost/cli/setup.cmake @@ -37,6 +37,12 @@ else() add_compile_options(-Wno-unused-local-typedef) endif() +# This is required to map a symbol reference to a matching definition local to the module (.so) +# containing the reference instead of using definitions from other modules. +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions") +endif() + if(CLI_CMAKE_PLATFORM_ARCH_I386) add_definitions(-D_TARGET_X86_=1) elseif(CLI_CMAKE_PLATFORM_ARCH_AMD64)