From 387613639c271615abae6c69c3344caedfca13b3 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Wed, 9 Nov 2016 17:28:29 -0800 Subject: [PATCH] Fix missing exports in mscordaccore.so (#8058) I have recently added some exports to the mscordaccore.so and it was found that they were not honored and libsos.so got some unresolved symbols. I have found that the issue is that unlike for libcoreclr.so, we were not asking linker to include the whole PAL and so it has eliminated those functions due to the fact they were not called from the PAL itself. This change fixes it. --- src/dlls/mscordac/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt index 02bba4a..8780db9 100644 --- a/src/dlls/mscordac/CMakeLists.txt +++ b/src/dlls/mscordac/CMakeLists.txt @@ -45,6 +45,10 @@ if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD OR CLR_CMAKE_PLATFORM_ set(START_LIBRARY_GROUP -Wl,--start-group) set(END_LIBRARY_GROUP -Wl,--end-group) + # These options are used to force every object to be included even if it's unused. + set(START_WHOLE_ARCHIVE -Wl,--whole-archive) + set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) + # Add linker exports file option set(EXPORTS_LINKER_OPTION -Wl,--version-script=${EXPORTS_FILE}) endif(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD OR CLR_CMAKE_PLATFORM_NETBSD) @@ -112,7 +116,9 @@ if(WIN32) else(WIN32) list(APPEND COREDAC_LIBRARIES mscorrc_debug + ${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available coreclrpal + ${END_WHOLE_ARCHIVE} palrt ) endif(WIN32) @@ -120,4 +126,4 @@ endif(WIN32) target_link_libraries(mscordaccore PRIVATE ${COREDAC_LIBRARIES}) # add the install targets -install_clr(mscordaccore) \ No newline at end of file +install_clr(mscordaccore) -- 2.7.4