diff options
author | Mike McLaughlin <mikem8361@users.noreply.github.com> | 2015-04-14 16:57:21 -0700 |
---|---|---|
committer | Mike McLaughlin <mikem8361@users.noreply.github.com> | 2015-04-14 16:57:21 -0700 |
commit | 1020bf6a491a61311c687d2a60059b6493175aa0 (patch) | |
tree | 6cda5351b9e93172518ba49d7ccc1e927f12399d /src/pal | |
parent | 94515766880d4c3fba367d5925ccfe9a2c1c5d33 (diff) | |
parent | 19d0282409003e113f1ca1dfa672cd53f061e6a8 (diff) | |
download | coreclr-1020bf6a491a61311c687d2a60059b6493175aa0.tar.gz coreclr-1020bf6a491a61311c687d2a60059b6493175aa0.tar.bz2 coreclr-1020bf6a491a61311c687d2a60059b6493175aa0.zip |
Merge pull request #704 from mikem8361/sharepal
Create shared PAL module and change all the modules to use it
Diffstat (limited to 'src/pal')
-rw-r--r-- | src/pal/src/CMakeLists.txt | 16 | ||||
-rw-r--r-- | src/pal/src/loader/module.cpp | 12 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 1023ae1242..fd2c4ad093 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 dfc4b30738..0c894bbf66 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; |