From 470693f405c1ae29005612f6920eb85a0ae3f430 Mon Sep 17 00:00:00 2001 From: Steve Harter Date: Mon, 5 Mar 2018 09:50:41 -0600 Subject: [PATCH] Turn off symbol export to prevent method\data collisions when loading dlls dynamically (dotnet/core-setup#3769) Commit migrated from https://github.com/dotnet/core-setup/commit/a28fbb812d99243c3b574ca67ed0c1c2d6061ffb --- src/installer/corehost/cli/dll/CMakeLists.txt | 2 ++ src/installer/corehost/cli/exe/apphost/CMakeLists.txt | 2 ++ src/installer/corehost/cli/exe/dotnet/CMakeLists.txt | 1 + src/installer/corehost/cli/fxr/CMakeLists.txt | 2 ++ src/installer/corehost/common/pal.h | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/installer/corehost/cli/dll/CMakeLists.txt b/src/installer/corehost/cli/dll/CMakeLists.txt index 46ddc40..f342313 100644 --- a/src/installer/corehost/cli/dll/CMakeLists.txt +++ b/src/installer/corehost/cli/dll/CMakeLists.txt @@ -12,6 +12,8 @@ else() add_compile_options(-fPIC) endif() +add_compile_options(-fvisibility=hidden) + include(../setup.cmake) # Include directories diff --git a/src/installer/corehost/cli/exe/apphost/CMakeLists.txt b/src/installer/corehost/cli/exe/apphost/CMakeLists.txt index 0dd8585..617d88d 100644 --- a/src/installer/corehost/cli/exe/apphost/CMakeLists.txt +++ b/src/installer/corehost/cli/exe/apphost/CMakeLists.txt @@ -5,6 +5,8 @@ cmake_minimum_required (VERSION 2.6) project(apphost) set(DOTNET_HOST_EXE_NAME "apphost") +add_compile_options(-fvisibility=hidden) + # Add RPATH to the apphost binary that allows using local copies of shared libraries # dotnet core depends on for special scenarios when system wide installation of such # dependencies is not possible for some reason. diff --git a/src/installer/corehost/cli/exe/dotnet/CMakeLists.txt b/src/installer/corehost/cli/exe/dotnet/CMakeLists.txt index b8b0763..a0de6e1 100644 --- a/src/installer/corehost/cli/exe/dotnet/CMakeLists.txt +++ b/src/installer/corehost/cli/exe/dotnet/CMakeLists.txt @@ -4,6 +4,7 @@ cmake_minimum_required (VERSION 2.6) project(dotnet) set(DOTNET_HOST_EXE_NAME "dotnet") +add_compile_options(-fvisibility=hidden) set(SOURCES ../../fxr/fx_ver.cpp) include(../exe.cmake) diff --git a/src/installer/corehost/cli/fxr/CMakeLists.txt b/src/installer/corehost/cli/fxr/CMakeLists.txt index ec666f8..822f236 100644 --- a/src/installer/corehost/cli/fxr/CMakeLists.txt +++ b/src/installer/corehost/cli/fxr/CMakeLists.txt @@ -12,6 +12,8 @@ else() add_compile_options(-fPIC) endif() +add_compile_options(-fvisibility=hidden) + include(../setup.cmake) # Include directories diff --git a/src/installer/corehost/common/pal.h b/src/installer/corehost/common/pal.h index 87c7379..7cdb2ff 100644 --- a/src/installer/corehost/common/pal.h +++ b/src/installer/corehost/common/pal.h @@ -139,7 +139,7 @@ namespace pal #else #ifdef COREHOST_MAKE_DLL - #define SHARED_API extern "C" + #define SHARED_API extern "C" __attribute__((__visibility__("default"))) #else #define SHARED_API #endif -- 2.7.4