Fix dangling StubLinkerCPU::EmitDelegateInvoke in x86/Linux (dotnet/coreclr#8444)
authorJonghyun Park <parjong@gmail.com>
Mon, 5 Dec 2016 20:20:53 +0000 (05:20 +0900)
committerJan Vorlicek <janvorli@microsoft.com>
Mon, 5 Dec 2016 20:20:53 +0000 (21:20 +0100)
Several methods in StublicLinkerCPU (including EmitDelegateInvoke) are
available only when FEATURE_STUBS_AS_IL is defined.

This commit encloses their declaration with appropriate macro
(FEATURE_STUBS_AS_IL), and fix related build erros.

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

src/coreclr/src/vm/comdelegate.cpp
src/coreclr/src/vm/i386/cgencpu.h
src/coreclr/src/vm/i386/stublinkerx86.h

index 9ba1bdb..4e3523e 100644 (file)
@@ -2395,7 +2395,7 @@ PCODE COMDelegate::TheDelegateInvokeStub()
     }
     CONTRACT_END;
 
-#ifdef _TARGET_X86_
+#if defined(_TARGET_X86_) && !defined(FEATURE_STUBS_AS_IL)
     static PCODE s_pInvokeStub;
 
     if (s_pInvokeStub == NULL)
@@ -2415,7 +2415,7 @@ PCODE COMDelegate::TheDelegateInvokeStub()
     RETURN s_pInvokeStub;
 #else
     RETURN GetEEFuncEntryPoint(SinglecastDelegateInvokeStub);
-#endif // _TARGET_X86_
+#endif // _TARGET_X86_ && !FEATURE_STUBS_AS_IL
 }
 
 // Get the cpu stub for a delegate invoke.
index 269d64b..99f4eb4 100644 (file)
@@ -43,6 +43,10 @@ EXTERN_C void STDCALL PInvokeStackImbalanceHelper(void);
 EXTERN_C void STDCALL CopyCtorCallStub(void);
 #endif // !FEATURE_CORECLR
 
+#ifdef FEATURE_STUBS_AS_IL
+EXTERN_C void SinglecastDelegateInvokeStub();
+#endif // FEATURE_STUBS_AS_IL
+
 BOOL Runtime_Test_For_SSE2();
 
 #ifdef CROSSGEN_COMPILE
index ac37183..e50486b 100644 (file)
@@ -377,13 +377,16 @@ class StubLinkerCPU : public StubLinker
                                            BOOL bShouldProfile);
 #endif // FEATURE_COMINTEROP && _TARGET_X86_
 
+#ifndef FEATURE_STUBS_AS_IL
         //===========================================================================
         // Computes hash code for MulticastDelegate.Invoke()
         static UINT_PTR HashMulticastInvoke(MetaSig* pSig);
 
+#ifdef _TARGET_X86_
         //===========================================================================
         // Emits code for Delegate.Invoke() any delegate type
         VOID EmitDelegateInvoke();
+#endif // _TARGET_X86_
 
         //===========================================================================
         // Emits code for MulticastDelegate.Invoke() - sig specific
@@ -392,6 +395,7 @@ class StubLinkerCPU : public StubLinker
         //===========================================================================
         // Emits code for Delegate.Invoke() on delegates that recorded creator assembly
         VOID EmitSecureDelegateInvoke(UINT_PTR hash);
+#endif // !FEATURE_STUBS_AS_IL
 
         //===========================================================================
         // Emits code to adjust for a static delegate target.
@@ -405,9 +409,11 @@ class StubLinkerCPU : public StubLinker
         //Worker function to emit throw helpers for array ops.
         VOID EmitArrayOpStubThrow(unsigned exConst, unsigned cbRetArg);
 
+#ifndef FEATURE_STUBS_AS_IL
         //===========================================================================
         // Emits code to break into debugger
         VOID EmitDebugBreak();
+#endif // !FEATURE_STUBS_AS_IL
 
 #if defined(_DEBUG) && (defined(_TARGET_AMD64_) || defined(_TARGET_X86_)) && !defined(FEATURE_PAL)
         //===========================================================================