From: Mike McLaughlin Date: Tue, 14 Apr 2015 19:29:13 +0000 (-0700) Subject: Create shared PAL module and change all the debugger modules and coreclr to use it. X-Git-Tag: accepted/tizen/base/20180629.140029~6848^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19d0282409003e113f1ca1dfa672cd53f061e6a8;p=platform%2Fupstream%2Fcoreclr.git Create shared PAL module and change all the debugger modules and coreclr to use it. --- diff --git a/src/ToolBox/SOS/Strike/CMakeLists.txt b/src/ToolBox/SOS/Strike/CMakeLists.txt index 9c05c30..8040f5b 100644 --- a/src/ToolBox/SOS/Strike/CMakeLists.txt +++ b/src/ToolBox/SOS/Strike/CMakeLists.txt @@ -89,10 +89,11 @@ else(WIN32) ) set(SOS_LIBRARY + CoreClrPal corguids - mscordaccore debugshim dbgutil + palrt ) endif(WIN32) diff --git a/src/dlls/mscordbi/CMakeLists.txt b/src/dlls/mscordbi/CMakeLists.txt index 0e90b16..d123170 100644 --- a/src/dlls/mscordbi/CMakeLists.txt +++ b/src/dlls/mscordbi/CMakeLists.txt @@ -57,7 +57,8 @@ if(WIN32) elseif(CLR_CMAKE_PLATFORM_UNIX) list(APPEND COREDBI_LIBRARIES mdhotdata_full - mscordaccore + CoreClrPal + palrt ) # COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt index c49b5e7..e8a0ac8 100644 --- a/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -94,9 +94,7 @@ if(WIN32) ) else() list(APPEND CORECLR_LIBRARIES - ${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available CoreClrPal - ${END_WHOLE_ARCHIVE} palrt ) endif(WIN32) diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 1023ae1..fd2c4ad 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -150,18 +150,18 @@ set(SOURCES ) add_library(CoreClrPal - STATIC + SHARED ${SOURCES} ${PLATFORM_SOURCES} ) if(CMAKE_SYSTEM_NAME STREQUAL Linux) -target_link_libraries(CoreClrPal - pthread - rt - dl - unwind -) + target_link_libraries(CoreClrPal + pthread + rt + dl + unwind + ) endif(CMAKE_SYSTEM_NAME STREQUAL Linux) if(CMAKE_SYSTEM_NAME STREQUAL Darwin) @@ -178,3 +178,5 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin) endif(CMAKE_SYSTEM_NAME STREQUAL Darwin) add_subdirectory(examples) + +install(TARGETS CoreClrPal DESTINATION .) \ No newline at end of file diff --git a/src/pal/src/loader/module.cpp b/src/pal/src/loader/module.cpp index dfc4b30..0c894bb 100644 --- a/src/pal/src/loader/module.cpp +++ b/src/pal/src/loader/module.cpp @@ -1397,7 +1397,11 @@ static HMODULE LOADLoadLibrary(LPCSTR ShortAsciiName, BOOL fDynamic) { // See GetProcAddress for an explanation why we leave the PAL. PAL_LeaveHolder holder; - dl_handle = dlopen(ShortAsciiName, RTLD_LAZY); + dl_handle = dlopen(ShortAsciiName, RTLD_LAZY | RTLD_NOLOAD); + if (!dl_handle) + { + dl_handle = dlopen(ShortAsciiName, RTLD_LAZY); + } // P/Invoke calls are often defined without an extension in the name of the // target library. So if we failed to load the specified library, try adding @@ -1406,7 +1410,11 @@ static HMODULE LOADLoadLibrary(LPCSTR ShortAsciiName, BOOL fDynamic) { if (snprintf(fullLibraryName, MAX_PATH, "%s%s", ShortAsciiName, PAL_SHLIB_SUFFIX) < MAX_PATH) { - dl_handle = dlopen(fullLibraryName, RTLD_LAZY); + dl_handle = dlopen(fullLibraryName, RTLD_LAZY | RTLD_NOLOAD); + if (!dl_handle) + { + dl_handle = dlopen(fullLibraryName, RTLD_LAZY); + } if (dl_handle) { ShortAsciiName = fullLibraryName;