Create shared PAL module and change all the debugger modules and coreclr to use it.
authorMike McLaughlin <mikem@microsoft.com>
Tue, 14 Apr 2015 19:29:13 +0000 (12:29 -0700)
committerMike McLaughlin <mikem@microsoft.com>
Tue, 14 Apr 2015 23:13:37 +0000 (16:13 -0700)
src/ToolBox/SOS/Strike/CMakeLists.txt
src/dlls/mscordbi/CMakeLists.txt
src/dlls/mscoree/coreclr/CMakeLists.txt
src/pal/src/CMakeLists.txt
src/pal/src/loader/module.cpp

index 9c05c30..8040f5b 100644 (file)
@@ -89,10 +89,11 @@ else(WIN32)
   )
 
   set(SOS_LIBRARY
+    CoreClrPal
     corguids
-    mscordaccore
     debugshim
     dbgutil
+    palrt
   )
 endif(WIN32)
 
index 0e90b16..d123170 100644 (file)
@@ -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
index c49b5e7..e8a0ac8 100644 (file)
@@ -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)
index 1023ae1..fd2c4ad 100644 (file)
@@ -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
index dfc4b30..0c894bb 100644 (file)
@@ -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;