From 8c9a5220a34ae85b5a8fc58def8f69b0f30cbb2f Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Tue, 6 Dec 2016 18:54:04 +0900 Subject: [PATCH 1/3] [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'. --- src/dlls/mscoree/mscoree.cpp | 2 +- src/inc/utilcode.h | 2 ++ src/vm/ceemain.cpp | 2 +- src/vm/util.cpp | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp index 3d33337c62a0..73350e27bc4e 100644 --- a/src/dlls/mscoree/mscoree.cpp +++ b/src/dlls/mscoree/mscoree.cpp @@ -75,7 +75,7 @@ HINSTANCE g_hThisInst; // This library. #include // for __security_init_cookie() -void* __stdcall GetCLRFunction(LPCSTR FunctionName); +#include extern "C" IExecutionEngine* __stdcall IEE(); diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h index 6c5498f761ec..a1a083638b0d 100644 --- a/src/inc/utilcode.h +++ b/src/inc/utilcode.h @@ -5766,4 +5766,6 @@ extern SpinConstants g_SpinConstants; // ====================================================================================== +void* __stdcall GetCLRFunction(LPCSTR FunctionName); + #endif // __UtilCode_h__ diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index b16d7972bec8..ba81c7260252 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -306,7 +306,7 @@ extern "C" HRESULT __cdecl CorDBGetInterface(DebugInterface** rcInterface); #if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) -void* __stdcall GetCLRFunction(LPCSTR FunctionName); +#include // Pointer to the activated CLR interface provided by the shim. ICLRRuntimeInfo *g_pCLRRuntime = NULL; diff --git a/src/vm/util.cpp b/src/vm/util.cpp index a96a56cd5828..826d0dd8d446 100644 --- a/src/vm/util.cpp +++ b/src/vm/util.cpp @@ -15,6 +15,7 @@ #include "posterror.h" #include "eemessagebox.h" #include "newapis.h" +#include "utilcode.h" #include @@ -2551,7 +2552,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; From 2174591e44f5ea1f76663549fb3896d11c344f2a Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Thu, 8 Dec 2016 08:48:42 +0900 Subject: [PATCH 2/3] Remove unnecessary includes --- src/dlls/mscoree/mscoree.cpp | 2 -- src/vm/ceemain.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp index 73350e27bc4e..4c613fff6a0c 100644 --- a/src/dlls/mscoree/mscoree.cpp +++ b/src/dlls/mscoree/mscoree.cpp @@ -75,8 +75,6 @@ HINSTANCE g_hThisInst; // This library. #include // for __security_init_cookie() -#include - extern "C" IExecutionEngine* __stdcall IEE(); #ifdef NO_CRT_INIT diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index ba81c7260252..5521d8a4d92a 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -306,7 +306,6 @@ extern "C" HRESULT __cdecl CorDBGetInterface(DebugInterface** rcInterface); #if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) -#include // Pointer to the activated CLR interface provided by the shim. ICLRRuntimeInfo *g_pCLRRuntime = NULL; From 00a8f65562adc679ee02ac1b80435aa0da3a8a3b Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Thu, 8 Dec 2016 08:56:42 +0900 Subject: [PATCH 3/3] Remove another unnecessay include --- src/vm/util.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vm/util.cpp b/src/vm/util.cpp index 826d0dd8d446..2cf6f7f31cad 100644 --- a/src/vm/util.cpp +++ b/src/vm/util.cpp @@ -15,7 +15,6 @@ #include "posterror.h" #include "eemessagebox.h" #include "newapis.h" -#include "utilcode.h" #include