Skip to content

Commit

Permalink
[x86/Linux] Fix inconsistent GetCLRFunction definitions (dotnet/corec…
Browse files Browse the repository at this point in the history
…lr#8472)

* [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 dotnet/coreclr@6665345
  • Loading branch information
parjong authored and janvorli committed Dec 8, 2016
1 parent b99cd17 commit 0afa877
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/coreclr/src/dlls/mscoree/mscoree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/src/inc/utilcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -5766,4 +5766,6 @@ extern SpinConstants g_SpinConstants;

// ======================================================================================

void* __stdcall GetCLRFunction(LPCSTR FunctionName);

#endif // __UtilCode_h__
1 change: 0 additions & 1 deletion src/coreclr/src/vm/ceemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/vm/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0afa877

Please sign in to comment.