Delete PAL_RegisterModule from the JIT (#263)
authorJan Kotas <jkotas@microsoft.com>
Wed, 27 Nov 2019 02:01:42 +0000 (18:01 -0800)
committerGitHub <noreply@github.com>
Wed, 27 Nov 2019 02:01:42 +0000 (18:01 -0800)
* Delete PAL_RegisterModule from the JIT

* I have deleted some other dead code too while I was on it.

14 files changed:
src/coreclr/src/dlls/mscoree/CMakeLists.txt
src/coreclr/src/dlls/mscoree/comcallunmarshal.cpp [deleted file]
src/coreclr/src/dlls/mscoree/comcallunmarshal.h [deleted file]
src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt
src/coreclr/src/dlls/mscoree/mscoree.cpp
src/coreclr/src/dlls/mscoree/mscorwks_ntdef.src
src/coreclr/src/dlls/mscoree/mscorwks_unixexports.src
src/coreclr/src/ilasm/assem.cpp
src/coreclr/src/ilasm/assembler.h
src/coreclr/src/ilasm/writer.cpp
src/coreclr/src/jit/ClrJit.PAL.exports
src/coreclr/src/jit/ee_il_dll.cpp
src/coreclr/src/pal/src/loader/module.cpp
src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs

index 36f6c9886a36fe696f8dae2ffe48e042663a57c6..dc5d2c86c6b9a0d50c3a7d036d0710abd98602ad 100644 (file)
@@ -11,7 +11,6 @@ set(CLR_SOURCES
 
 if(WIN32)
 list(APPEND CLR_SOURCES
-    comcallunmarshal.cpp
     delayloadhook.cpp
     Native.rc
 )
diff --git a/src/coreclr/src/dlls/mscoree/comcallunmarshal.cpp b/src/coreclr/src/dlls/mscoree/comcallunmarshal.cpp
deleted file mode 100644 (file)
index 854213b..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-// 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.
-//
-// File: ComCallUnmarshal.cpp
-//
-
-//
-// Classes used to unmarshal all COM call wrapper IPs.
-//
-
-
-#include "stdafx.h"                     // Standard header.
-
-#ifdef FEATURE_COMINTEROP
-
-#include "ComCallUnmarshal.h"
-#include <utilcode.h>                   // Utility helpers.
-
-// For free-threaded marshaling, we must not be spoofed by out-of-process or cross-runtime marshal data.
-// Only unmarshal data that comes from our own runtime.
-extern BYTE         g_UnmarshalSecret[sizeof(GUID)];
-extern bool         g_fInitedUnmarshalSecret;
-
-STDMETHODIMP ComCallUnmarshal::QueryInterface(REFIID iid, void **ppv)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_NOTRIGGER;
-        PRECONDITION(CheckPointer(ppv, NULL_OK));
-    } CONTRACTL_END;
-
-    if (!ppv)
-        return E_POINTER;
-
-    *ppv = NULL;
-    if (iid == IID_IUnknown)
-    {
-        *ppv = (IUnknown *)this;
-        AddRef();
-    } else if (iid == IID_IMarshal)
-    {
-        *ppv = (IMarshal *)this;
-        AddRef();
-    }
-    return (*ppv != NULL) ? S_OK : E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) ComCallUnmarshal::AddRef(void)
-{
-    LIMITED_METHOD_CONTRACT;
-    return 2;
-}
-
-STDMETHODIMP_(ULONG) ComCallUnmarshal::Release(void)
-{
-    LIMITED_METHOD_CONTRACT;
-    return 1;
-}
-
-STDMETHODIMP ComCallUnmarshal::GetUnmarshalClass (REFIID riid, void * pv, ULONG dwDestContext,
-                                                  void * pvDestContext, ULONG mshlflags,
-                                                  LPCLSID pclsid)
-{
-    LIMITED_METHOD_CONTRACT;
-    // Marshal side only.
-    _ASSERTE(FALSE);
-    return E_NOTIMPL;
-}
-
-STDMETHODIMP ComCallUnmarshal::GetMarshalSizeMax (REFIID riid, void * pv, ULONG dwDestContext,
-                                                  void * pvDestContext, ULONG mshlflags,
-                                                  ULONG * pSize)
-{
-    LIMITED_METHOD_CONTRACT;
-    // Marshal side only.
-    _ASSERTE(FALSE);
-    return E_NOTIMPL;
-}
-
-STDMETHODIMP ComCallUnmarshal::MarshalInterface (LPSTREAM pStm, REFIID riid, void * pv,
-                                                 ULONG dwDestContext, LPVOID pvDestContext,
-                                                 ULONG mshlflags)
-{
-    LIMITED_METHOD_CONTRACT;
-    // Marshal side only.
-    _ASSERTE(FALSE);
-    return E_NOTIMPL;
-}
-
-STDMETHODIMP ComCallUnmarshal::UnmarshalInterface (LPSTREAM pStm, REFIID riid, void ** ppvObj)
-{
-    CONTRACTL {
-        NOTHROW;
-        GC_NOTRIGGER;
-        STATIC_CONTRACT_MODE_PREEMPTIVE;
-        PRECONDITION(CheckPointer(pStm));
-        PRECONDITION(CheckPointer(ppvObj));
-    } CONTRACTL_END;
-
-    ULONG bytesRead;
-    ULONG mshlflags;
-    HRESULT hr = E_FAIL;
-
-    // The marshal code added a reference to the object, but we return a
-    // reference to the object as well, so don't change the ref count on the
-    // success path. Need to release on error paths though (if we manage to
-    // retrieve the IP, that is). If the interface was marshalled
-    // TABLESTRONG or TABLEWEAK, there is going to be a ReleaseMarshalData
-    // in the future, so we should AddRef the IP we're about to give out.
-    // Note also that OLE32 requires us to advance the stream pointer even
-    // in failure cases.
-
-    // Read the raw IP out of the marshalling stream.
-    hr = pStm->Read (ppvObj, sizeof (void *), &bytesRead);
-    if (FAILED (hr) || (bytesRead != sizeof (void *)))
-        IfFailGo(RPC_E_INVALID_DATA);
-
-    // And then the marshal flags.
-    hr = pStm->Read (&mshlflags, sizeof (ULONG), &bytesRead);
-    if (FAILED (hr) || (bytesRead != sizeof (ULONG)))
-        IfFailGo(RPC_E_INVALID_DATA);
-
-    // And then verify our secret, to be sure that cross-runtime clients aren't
-    // trying to trick us into mis-interpreting their data as a ppvObj.  Note that
-    // it is guaranteed that the secret data is initialized, or else we certainly
-    // haven't written it into this buffer!
-    if (!g_fInitedUnmarshalSecret)
-        IfFailGo(E_UNEXPECTED);
-
-    BYTE secret[sizeof(GUID)];
-
-    hr = pStm->Read(secret, sizeof(secret), &bytesRead);
-    if (FAILED(hr) || (bytesRead != sizeof(secret)))
-        IfFailGo(RPC_E_INVALID_DATA);
-
-    if (memcmp(g_UnmarshalSecret, secret, sizeof(secret)) != 0)
-        IfFailGo(E_UNEXPECTED);
-
-    if (ppvObj && ((mshlflags == MSHLFLAGS_TABLESTRONG) || (mshlflags == MSHLFLAGS_TABLEWEAK)))
-    {
-        // For table access we can just QI for the correct interface (this
-        // will addref the IP, but that's OK since we need to keep an extra
-        // ref on the IP until ReleaseMarshalData is called).
-        hr = ((IUnknown *)*ppvObj)->QueryInterface(riid, ppvObj);
-    }
-    else
-    {
-        // For normal access we QI for the correct interface then release
-        // the old IP.
-        NonVMComHolder<IUnknown> pOldUnk = (IUnknown *)*ppvObj;
-        hr = pOldUnk->QueryInterface(riid, ppvObj);
-    }
-ErrExit:
-    return hr;
-}
-
-STDMETHODIMP ComCallUnmarshal::ReleaseMarshalData (LPSTREAM pStm)
-{
-    CONTRACTL {
-        NOTHROW;
-        GC_NOTRIGGER;
-        STATIC_CONTRACT_MODE_PREEMPTIVE;
-        PRECONDITION(CheckPointer(pStm));
-    } CONTRACTL_END;
-
-    IUnknown *pUnk;
-    ULONG bytesRead;
-    ULONG mshlflags;
-    HRESULT hr = S_OK;
-
-    if (!pStm)
-        return E_POINTER;
-
-    // Read the raw IP out of the marshalling stream. Do this first since we
-    // need to update the stream pointer even in case of failures.
-    hr = pStm->Read (&pUnk, sizeof (pUnk), &bytesRead);
-    if (FAILED (hr) || (bytesRead != sizeof (pUnk)))
-        IfFailGo(RPC_E_INVALID_DATA);
-
-    // Now read the marshal flags.
-    hr = pStm->Read (&mshlflags, sizeof (mshlflags), &bytesRead);
-    if (FAILED (hr) || (bytesRead != sizeof (mshlflags)))
-        IfFailGo(RPC_E_INVALID_DATA);
-
-    if (!g_fInitedUnmarshalSecret)
-    {
-        IfFailGo(E_UNEXPECTED);
-    }
-
-    BYTE secret[sizeof(GUID)];
-
-    hr = pStm->Read(secret, sizeof(secret), &bytesRead);
-    if (FAILED(hr) || (bytesRead != sizeof(secret)))
-        IfFailGo(RPC_E_INVALID_DATA);
-
-    if (memcmp(g_UnmarshalSecret, secret, sizeof(secret)) != 0)
-        IfFailGo(E_UNEXPECTED);
-
-    pUnk->Release ();
-
-ErrExit:
-    return hr;
-}
-
-STDMETHODIMP ComCallUnmarshal::DisconnectObject (ULONG dwReserved)
-{
-    LIMITED_METHOD_CONTRACT;
-
-    // Nothing we can (or need to) do here. The client is using a raw IP to
-    // access this server, so the server shouldn't go away until the client
-    // Release()'s it.
-
-    return S_OK;
-}
-
-CComCallUnmarshalFactory::CComCallUnmarshalFactory()
-{
-    WRAPPER_NO_CONTRACT;
-}
-
-STDMETHODIMP CComCallUnmarshalFactory::QueryInterface(REFIID iid, void **ppv)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_NOTRIGGER;
-        PRECONDITION(CheckPointer(ppv));
-    } CONTRACTL_END;
-
-    if (!ppv)
-        return E_POINTER;
-
-    *ppv = NULL;
-    if (iid == IID_IClassFactory || iid == IID_IUnknown) {
-        *ppv = (IClassFactory *)this;
-        AddRef();
-    }
-    return (*ppv != NULL) ? S_OK : E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) CComCallUnmarshalFactory::AddRef(void)
-{
-    LIMITED_METHOD_CONTRACT;
-    return 2;
-}
-
-STDMETHODIMP_(ULONG) CComCallUnmarshalFactory::Release(void)
-{
-    LIMITED_METHOD_CONTRACT;
-    return 1;
-}
-
-STDMETHODIMP CComCallUnmarshalFactory::CreateInstance(LPUNKNOWN punkOuter, REFIID iid, LPVOID FAR *ppv)
-{
-    CONTRACTL
-    {
-        NOTHROW;
-        GC_NOTRIGGER;
-        PRECONDITION(CheckPointer(ppv));
-    } CONTRACTL_END;
-
-    if (!ppv)
-        return E_POINTER;
-
-    *ppv = NULL;
-
-    if (punkOuter != NULL)
-        return CLASS_E_NOAGGREGATION;
-
-    return m_Unmarshaller.QueryInterface(iid, ppv);
-}
-
-STDMETHODIMP CComCallUnmarshalFactory::LockServer(BOOL fLock)
-{
-    LIMITED_METHOD_CONTRACT;
-    return S_OK;
-}
-
-#endif // FEATURE_COMINTEROP
diff --git a/src/coreclr/src/dlls/mscoree/comcallunmarshal.h b/src/coreclr/src/dlls/mscoree/comcallunmarshal.h
deleted file mode 100644 (file)
index 8ef6973..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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.
-//
-// File: ComCallUnmarshal.h
-//
-
-//
-// Classes used to unmarshal all COM call wrapper IPs.
-//
-
-
-#pragma once
-
-#ifndef FEATURE_COMINTEROP
-#error FEATURE_COMINTEROP is required for this file
-#endif // FEATURE_COMINTEROP
-
-// Class used to unmarshal all COM call wrapper IPs. In order for this to work in side-by-side
-// scenarios, the CLSID of this class has to be changed with every side-by-side release.
-//
-// The class is identified by the following CLSID:
-// CLR v1.0, v1.1, v2.0: 3F281000-E95A-11d2-886B-00C04F869F04
-// CLR v4.0:             45FB4600-E6E8-4928-B25E-50476FF79425
-//
-class ComCallUnmarshal : public IMarshal
-{
-public:
-
-    // *** IUnknown methods ***
-    STDMETHODIMP QueryInterface(REFIID iid, void **ppv);
-    STDMETHODIMP_(ULONG) AddRef(void);
-    STDMETHODIMP_(ULONG) Release(void);
-
-    // *** IMarshal methods ***
-    STDMETHODIMP GetUnmarshalClass (REFIID riid, void * pv, ULONG dwDestContext,
-                                    void * pvDestContext, ULONG mshlflags,
-                                    LPCLSID pclsid);
-
-    STDMETHODIMP GetMarshalSizeMax (REFIID riid, void * pv, ULONG dwDestContext,
-                                    void * pvDestContext, ULONG mshlflags,
-                                    ULONG * pSize);
-
-    STDMETHODIMP MarshalInterface (LPSTREAM pStm, REFIID riid, void * pv,
-                                   ULONG dwDestContext, LPVOID pvDestContext,
-                                   ULONG mshlflags);
-
-    STDMETHODIMP UnmarshalInterface (LPSTREAM pStm, REFIID riid, void ** ppvObj);
-    STDMETHODIMP ReleaseMarshalData (LPSTREAM pStm);
-    STDMETHODIMP DisconnectObject (ULONG dwReserved);
-};
-
-// Class factory for the COM call wrapper unmarshaller.
-class CComCallUnmarshalFactory : public IClassFactory
-{
-    ComCallUnmarshal    m_Unmarshaller;
-
-  public:
-
-    CComCallUnmarshalFactory();
-
-    // *** IUnknown methods ***
-       STDMETHODIMP QueryInterface(REFIID iid, void **ppv);
-       STDMETHODIMP_(ULONG) AddRef(void);
-       STDMETHODIMP_(ULONG) Release(void);
-
-    // *** IClassFactory methods ***
-    STDMETHODIMP CreateInstance(LPUNKNOWN punkOuter, REFIID iid, LPVOID FAR *ppv);
-    STDMETHODIMP LockServer(BOOL fLock);
-};
index 7a064a83d02f81099408352273922e6a49810062..34e09beb63010328d6a6b31a8a40b071c1946012 100644 (file)
@@ -23,8 +23,6 @@ if (WIN32)
     set(END_LIBRARY_GROUP)
 
 else()
-    add_definitions(-DNO_CRT_INIT)
-
     set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/coreclr.exports)
     generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
 
index 47323f93b4e699f7be17a05b7e17e1b8d2812bb3..95c15cd5ee9ccf57cdf4012cdbbbf12eebf98732 100644 (file)
 
 #include "product_version.h"
 
-#ifdef FEATURE_COMINTEROP
-#include "ComCallUnmarshal.h"
-#endif // FEATURE_COMINTEROP
-
 #include <dbgenginemetrics.h>
 
 // Locals.
@@ -40,27 +36,20 @@ HINSTANCE g_hThisInst;  // This library.
 
 #include <shlwapi.h>
 
-#include <process.h> // for __security_init_cookie()
-
 extern "C" IExecutionEngine* IEE();
 
-#ifdef NO_CRT_INIT
-#define _CRT_INIT(hInstance, dwReason, lpReserved) (TRUE)
-#else
-extern "C" BOOL WINAPI _CRT_INIT(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved);
-#endif
+#ifdef PLATFORM_WINDOWS
+
+#include <process.h> // for __security_init_cookie()
 
+extern "C" BOOL WINAPI _CRT_INIT(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved);
 extern "C" BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved);
 
 // For the CoreClr, this is the real DLL entrypoint. We make ourselves the first entrypoint as
 // we need to capture coreclr's hInstance before the C runtime initializes. This function
 // will capture hInstance, let the C runtime initialize and then invoke the "classic"
 // DllMain that initializes everything else.
-extern "C"
-#ifdef FEATURE_PAL
-DLLEXPORT // For Win32 PAL LoadLibrary emulation
-#endif
-BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
+extern "C" BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
 {
     STATIC_CONTRACT_NOTHROW;
 
@@ -68,12 +57,10 @@ BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
     switch (dwReason)
     {
         case DLL_PROCESS_ATTACH:
-#ifndef FEATURE_PAL
             // Make sure the /GS security cookie is initialized before we call anything else.
             // BinScope detects the call to __security_init_cookie in its "Has Non-GS-friendly
             // Initialization" check and makes it pass.
             __security_init_cookie();
-#endif // FEATURE_PAL
 
             // It's critical that we invoke InitUtilCode() before the CRT initializes.
             // We have a lot of global ctors that will break if we let the CRT initialize without
@@ -112,6 +99,9 @@ BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
     return result;
 }
 
+#endif // PLATFORM_WINDOWS
+
+
 extern "C"
 #ifdef FEATURE_PAL
 DLLEXPORT // For Win32 PAL LoadLibrary emulation
@@ -124,6 +114,18 @@ BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
     {
     case DLL_PROCESS_ATTACH:
         {
+#ifndef PLATFORM_WINDOWS
+            // It's critical that we invoke InitUtilCode() before the CRT initializes.
+            // We have a lot of global ctors that will break if we let the CRT initialize without
+            // this step having been done.
+
+            CoreClrCallbacks cccallbacks;
+            cccallbacks.m_hmodCoreCLR = (HINSTANCE)hInstance;
+            cccallbacks.m_pfnIEE = IEE;
+            cccallbacks.m_pfnGetCORSystemDirectory = GetCORSystemDirectoryInternaL;
+            InitUtilcode(cccallbacks);
+#endif
+
             // Save the module handle.
             g_hThisInst = (HINSTANCE)hInstance;
 
@@ -154,61 +156,6 @@ BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
     return TRUE;
 }
 
-#ifdef FEATURE_COMINTEROP
-// ---------------------------------------------------------------------------
-// %%Function: DllCanUnloadNowInternal
-//
-// Returns:
-//  S_FALSE                 - Indicating that COR, once loaded, may not be
-//                            unloaded.
-// ---------------------------------------------------------------------------
-STDAPI DllCanUnloadNowInternal(void)
-{
-    STATIC_CONTRACT_NOTHROW;
-    STATIC_CONTRACT_ENTRY_POINT;
-
-    //we should never unload unless the process is dying
-    return S_FALSE;
-}  // DllCanUnloadNowInternal
-
-// ---------------------------------------------------------------------------
-// %%Function: DllRegisterServerInternal
-//
-// Description:
-//  Registers
-// ---------------------------------------------------------------------------
-STDAPI DllRegisterServerInternal(HINSTANCE hMod, LPCWSTR version)
-{
-
-    CONTRACTL{
-        NOTHROW;
-        GC_NOTRIGGER;
-        ENTRY_POINT;
-        PRECONDITION(CheckPointer(version));
-    } CONTRACTL_END;
-
-    return S_OK;
-}  // DllRegisterServerInternal
-
-// ---------------------------------------------------------------------------
-// %%Function: DllUnregisterServerInternal
-// ---------------------------------------------------------------------------
-STDAPI DllUnregisterServerInternal(void)
-{
-
-    CONTRACTL
-    {
-        GC_NOTRIGGER;
-        NOTHROW;
-        ENTRY_POINT;
-    }
-    CONTRACTL_END;
-
-    return S_OK;
-
-}  // DllUnregisterServerInternal
-#endif // FEATURE_COMINTEROP
-
 #endif // CROSSGEN_COMPILE
 
 HINSTANCE GetModuleInst()
index 1266ec9bc12476cbe4817f146e46df6dcc61988c..9c8ffa057789166b9f4f1cfb5d92ad05f98480f8 100644 (file)
@@ -25,9 +25,3 @@ EXPORTS
         coreclr_initialize
         coreclr_shutdown
         coreclr_shutdown_2
-
-        ; il{d}asm
-        MetaDataGetDispenser
-        GetMetaDataInternalInterface
-        GetMetaDataInternalInterfaceFromPublic
-        GetMetaDataPublicInterfaceFromInternal
index 98db67bd1a73c0d308a4015ac955fc86dbee82f4..1085876f981dc1380ab19d898dfdf9cf8fa09b14 100644 (file)
@@ -5,17 +5,6 @@ coreclr_initialize
 coreclr_shutdown
 coreclr_shutdown_2
 
-; il{d}asm
-MetaDataGetDispenser
-GetMetaDataInternalInterface
-GetMetaDataInternalInterfaceFromPublic
-GetMetaDataPublicInterfaceFromInternal
-
-; PAL module registration
-PAL_RegisterModule
-PAL_UnregisterModule
-
 ; Functions exported by the coreclr
-CoreDllMain
 DllMain
 GetCLRRuntimeHost
index 6cdd2e0c1f3979ed9679d3beb97c168a20d4b938..99a4321d38df420b2a2137b7a9f38c0575632677 100644 (file)
@@ -15,7 +15,6 @@
 #define DECLARE_DATA
 
 #include "assembler.h"
-MetaDataGetDispenserFunc metaDataGetDispenser;
 
 void indexKeywords(Indx* indx); // defined in asmparse.y
 
@@ -231,7 +230,6 @@ Assembler::~Assembler()
 
 BOOL Assembler::Init()
 {
-    metaDataGetDispenser = (MetaDataGetDispenserFunc)MetaDataGetDispenser;
     if (m_pCeeFileGen != NULL) {
         if (m_pCeeFile)
             m_pCeeFileGen->DestroyCeeFile(&m_pCeeFile);
index b02f78faeaba3b3f744151c4df136db30d5d7877..e08f5263133ad6be8b1f9d20d63b4492adddabc2 100644 (file)
 #ifdef FEATURE_PAL
 extern char *g_pszExeFile;
 #endif
-typedef int(STDAPICALLTYPE *MetaDataGetDispenserFunc) (
-    REFCLSID    rclsid,                 // The class to desired.
-    REFIID      riid,                   // Interface wanted on class factory.
-    LPVOID FAR  *ppv);                  // Return interface pointer here.
-
-extern MetaDataGetDispenserFunc metaDataGetDispenser;
 
 extern WCHAR   wzUniBuf[]; // Unicode conversion global buffer (assem.cpp)
 
index 0cbd375ec95bb2df524646cb23557d4de5c5777b..cc28f6ee2fa5e261aa450b508fbaac738045e99d 100644 (file)
@@ -30,7 +30,7 @@ HRESULT Assembler::InitMetaData()
 
     if(bClock) bClock->cMDInitBegin = GetTickCount();
 
-    hr = metaDataGetDispenser(CLSID_CorMetaDataDispenser,
+    hr = MetaDataGetDispenser(CLSID_CorMetaDataDispenser,
         IID_IMetaDataDispenserEx, (void **)&m_pDisp);
     if (FAILED(hr))
         goto exit;
index b27c61f6b1db0f11c1e085a66b242bf98d5d558c..11e42d3bb11aea66d5eb511a5ac99d50434f2fc1 100644 (file)
@@ -1,5 +1,2 @@
 getJit
 jitStartup
-DllMain
-PAL_RegisterModule
-PAL_UnregisterModule
index e0e30e8e72df2a0ca4aa9c420f31caf8999d0099..34a24e5ca9c005963c06034ca251157a2c13aa9e 100644 (file)
@@ -64,6 +64,14 @@ extern "C" DLLEXPORT void __stdcall jitStartup(ICorJitHost* jitHost)
         return;
     }
 
+#ifdef FEATURE_PAL
+    int err = PAL_InitializeDLL();
+    if (err != 0)
+    {
+        return;
+    }
+#endif
+
     g_jitHost = jitHost;
 
     assert(!JitConfig.isInitialized());
@@ -148,12 +156,7 @@ void jitShutdown(bool processIsTerminating)
 
 #ifndef FEATURE_MERGE_JIT_AND_ENGINE
 
-extern "C"
-#ifdef FEATURE_PAL
-    DLLEXPORT // For Win32 PAL LoadLibrary emulation
-#endif
-    BOOL WINAPI
-    DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved)
+extern "C" DLLEXPORT BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved)
 {
     if (dwReason == DLL_PROCESS_ATTACH)
     {
@@ -205,6 +208,11 @@ ICorJitCompiler* g_realJitCompiler = nullptr;
 
 DLLEXPORT ICorJitCompiler* __stdcall getJit()
 {
+    if (!g_jitInitialized)
+    {
+        return nullptr;
+    }
+
     if (ILJitter == nullptr)
     {
         ILJitter = new (CILJitSingleton) CILJit();
index c87f017d1474ebe46b7a07f384dd3750bbe34332..9695226ce8ee969b79a3784565b5f59341a631f5 100644 (file)
@@ -1709,13 +1709,7 @@ BOOL LOADInitializeCoreCLRModule()
         ERROR("Can not load the PAL module\n");
         return FALSE;
     }
-    PDLLMAIN pRuntimeDllMain = (PDLLMAIN)dlsym(module->dl_handle, "CoreDllMain");
-    if (!pRuntimeDllMain)
-    {
-        ERROR("Can not find the CoreDllMain entry point\n");
-        return FALSE;
-    }
-    return pRuntimeDllMain(module->hinstance, DLL_PROCESS_ATTACH, nullptr);
+    return TRUE;
 }
 
 /*++
index f9fe7172fa8b2d56957cd589cec963579f275c32..b23e1d355d7db5ad89cb29c6e1189f491912a756 100644 (file)
@@ -58,9 +58,6 @@ namespace Internal.JitInterface
 
         private ExceptionDispatchInfo _lastException;
 
-        [DllImport(JitLibrary)]
-        private extern static IntPtr PAL_RegisterModule([MarshalAs(UnmanagedType.LPUTF8Str)] string moduleName);
-
         [DllImport(JitLibrary, CallingConvention=CallingConvention.StdCall)] // stdcall in CoreCLR!
         private extern static IntPtr jitStartup(IntPtr host);
 
@@ -123,14 +120,6 @@ namespace Internal.JitInterface
                 NativeLibrary.SetDllImportResolver(typeof(CorInfoImpl).Assembly, JitLibraryResolver);
             }
 
-            if (Environment.OSVersion.Platform == PlatformID.Unix)
-            {
-                // TODO: The PAL_RegisterModule export should be removed from the JIT
-                // and the call to PAL_InitializeDLL should be moved to jitStartup.
-                // https://github.com/dotnet/coreclr/issues/27941
-                PAL_RegisterModule("libclrjitilc.so");
-            }
-
             jitStartup(GetJitHost(jitConfig.UnmanagedInstance));
         }