[x86/Linux] Fix inconsistent GetCLRFunction definitions (dotnet/coreclr#8472)
authorJonghyun Park <parjong@gmail.com>
Thu, 8 Dec 2016 01:25:38 +0000 (10:25 +0900)
committerJan Vorlicek <janvorli@microsoft.com>
Thu, 8 Dec 2016 01:25:38 +0000 (02:25 +0100)
* [x86/Linux] Fix inconsistency in GetCLRFunction definitions

GetCLRFunction is treated as pfnGetCLRFunction_t which has __stdcall
convention, but is  implemented without __stdcall.

This inconsistency causes segmentaion fault while initializing CoreCLR
for x86/Linux.

This commit fixes such inconsistency via adding __stdcall to
GetCLRFunction implementation.

In addition, this commit declares GetCLRFuntion in 'utilcode.h' and
and revises .cpp files to include 'utilcode.h' instead of declaring
'GetCLRFunction'.

* Remove unnecessary includes

* Remove another unnecessay include

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

src/coreclr/src/dlls/mscoree/mscoree.cpp
src/coreclr/src/inc/utilcode.h
src/coreclr/src/vm/ceemain.cpp
src/coreclr/src/vm/util.cpp

index 3d33337..4c613ff 100644 (file)
@@ -75,8 +75,6 @@ HINSTANCE g_hThisInst;  // This library.
 
 #include <process.h> // for __security_init_cookie()
 
-void* __stdcall GetCLRFunction(LPCSTR FunctionName);
-
 extern "C" IExecutionEngine* __stdcall IEE();
 
 #ifdef NO_CRT_INIT
index 6c5498f..a1a0836 100644 (file)
@@ -5766,4 +5766,6 @@ extern SpinConstants g_SpinConstants;
 
 // ======================================================================================
 
+void* __stdcall GetCLRFunction(LPCSTR FunctionName);
+
 #endif // __UtilCode_h__
index b16d797..5521d8a 100644 (file)
@@ -306,7 +306,6 @@ extern "C" HRESULT __cdecl CorDBGetInterface(DebugInterface** rcInterface);
 
 
 #if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-void* __stdcall GetCLRFunction(LPCSTR FunctionName);
 
 // Pointer to the activated CLR interface provided by the shim.
 ICLRRuntimeInfo *g_pCLRRuntime = NULL;
index a96a56c..2cf6f7f 100644 (file)
@@ -2551,7 +2551,7 @@ extern BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem);
 extern void ShutdownRuntimeWithoutExiting(int exitCode);
 extern BOOL IsRuntimeStarted(DWORD *pdwStartupFlags);
 
-void * GetCLRFunction(LPCSTR FunctionName)
+void * __stdcall GetCLRFunction(LPCSTR FunctionName)
 {
 
     void* func = NULL;