Fix CLRDataCreateInstance export. This was breaking SOS. (dotnet/coreclr#22701)
authorMike McLaughlin <mikem@microsoft.com>
Wed, 20 Feb 2019 07:16:25 +0000 (23:16 -0800)
committerGitHub <noreply@github.com>
Wed, 20 Feb 2019 07:16:25 +0000 (23:16 -0800)
Fix CLRDataCreateInstance export. This was breaking SOS.

Added the right cmake magic so the function is exported properly.

Commit migrated from https://github.com/dotnet/coreclr/commit/e0c2cc567cb7b5072eb71b0ff788da2ffde63a7d

src/coreclr/src/debug/daccess/daccess.cpp
src/coreclr/src/debug/daccess/dacdbiimpl.cpp
src/coreclr/src/debug/daccess/dacdbiimpl.h
src/coreclr/src/dlls/mscordac/CMakeLists.txt
src/coreclr/src/dlls/mscordac/mscordac.cpp

index 6fbeea8..9b2b3ad 100644 (file)
@@ -40,7 +40,7 @@ HINSTANCE g_thisModule;
 
 extern VOID STDMETHODCALLTYPE TLS_FreeMasterSlotIndex();
 
-#if FEATURE_PAL
+#ifdef FEATURE_PAL
 DLLEXPORT // For Win32 PAL LoadLibrary emulation
 #endif
 EXTERN_C BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
@@ -7506,6 +7506,7 @@ STDAPI CLRDataAccessCreateInstance(ICLRDataTarget * pLegacyTarget,
 // This is the legacy entrypoint to DAC, used by dbgeng/dbghelp (windbg, SOS, watson, etc).
 //
 //----------------------------------------------------------------------------
+DLLEXPORT 
 STDAPI
 CLRDataCreateInstance(REFIID iid,
                       ICLRDataTarget * pLegacyTarget,
index 8ffbe2b..828f639 100644 (file)
@@ -184,6 +184,7 @@ template<class T> void DeleteDbiMemory(T *p)
 //    Must call Destroy to on interface to free its resources.
 //
 //---------------------------------------------------------------------------------------
+DLLEXPORT 
 STDAPI
 DacDbiInterfaceInstance(
     ICorDebugDataTarget * pTarget,
index cd1b7ad..e27fe0b 100644 (file)
 #ifndef _DACDBI_IMPL_H_
 #define _DACDBI_IMPL_H_
 
-// Prototype for creation function
+// Prototype for creation functions
+
+DLLEXPORT 
+STDAPI
+CLRDataCreateInstance(REFIID iid,
+    ICLRDataTarget * pLegacyTarget,
+    void ** iface);
+
+DLLEXPORT 
 STDAPI
-DLLEXPORT
 DacDbiInterfaceInstance(
     ICorDebugDataTarget * pTarget,
     CORDB_ADDRESS baseAddress,
index 99a011d..e065eba 100644 (file)
@@ -124,8 +124,10 @@ set(COREDAC_LIBRARIES
     ${START_LIBRARY_GROUP} # Start group of libraries that have circular references
     cee_dac
     cordbee_dac
+    ${START_WHOLE_ARCHIVE} # force all exports to be available  
     corguids
     daccess
+    ${END_WHOLE_ARCHIVE}
     dbgutil
     mdcompiler_dac
     mdhotdata_dac
@@ -177,8 +179,8 @@ else(WIN32)
         mscorrc_debug
         ${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available  
         coreclrpal
-        ${END_WHOLE_ARCHIVE}
         palrt
+        ${END_WHOLE_ARCHIVE}
     )
 endif(WIN32)
 
index d126704..45274ba 100644 (file)
@@ -1,21 +1,3 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
-
-#ifdef FEATURE_PAL
-
-#include <clrdata.h>
-
-//
-// This dummy reference to CLRDataCreateInstance prevents the LLVM toolchain from optimizing this important export out.
-//
-#ifdef __GNUC__
-__attribute__((used))
-#endif // __GNUC__
-void
-DummyReferenceToExportedAPI()
-{
-    CLRDataCreateInstance(IID_ICLRDataTarget, NULL, NULL);
-}
-
-#endif // FEATURE_PAL