Making crossgen throw when compiling with the PartialNgen flag and no IBC data (...
authorFadi Hanna <fadim@microsoft.com>
Wed, 15 May 2019 19:18:19 +0000 (12:18 -0700)
committerGitHub <noreply@github.com>
Wed, 15 May 2019 19:18:19 +0000 (12:18 -0700)
* Making crossgen throw when compiling with the PartialNgen flag and no IBC data

* Adding missing m_fPartialNGen check

src/inc/corerror.xml
src/pal/prebuilt/corerror/mscorurt.rc
src/pal/prebuilt/inc/corerror.h
src/zap/zapimage.cpp

index d7121ef..4c6362f 100644 (file)
        <Comment>During a GC initialization, the GCHeapAffinitizeRanges config couldn't be parsed due to its invalid format.</Comment>
 </HRESULT>
 
+<HRESULT NumericValue="0x8013200C">
+       <SymbolicName>CLR_E_CROSSGEN_NO_IBC_DATA_FOUND</SymbolicName>
+       <Message>"Cannot compile using the PartialNgen flag because no IBC data was found."</Message>
+       <Comment>During crossgen compilation, the PartialNgen flag was set, but no IBC data was found in the resources section of the input image, and no IBC file was externally provided.</Comment>
+</HRESULT>
+
 <HRESULT NumericValue="E_ACCESSDENIED">
        <SymbolicName>COR_E_UNAUTHORIZEDACCESS</SymbolicName>
        <Comment> 0x80070005 // Access is denied.</Comment>
index 5b0a9e2..ee8ef67 100644 (file)
@@ -327,5 +327,6 @@ BEGIN
        MSG_FOR_URT_HR(CLR_E_GC_OOM) "Failfast due to an OOM during a GC"
        MSG_FOR_URT_HR(CLR_E_GC_BAD_AFFINITY_CONFIG) "GCHeapAffinitizeMask or GCHeapAffinitizeRanges didn't specify any CPUs the current process is affinitized to."
        MSG_FOR_URT_HR(CLR_E_GC_BAD_AFFINITY_CONFIG_FORMAT) "GCHeapAffinitizeRanges configuration string has invalid format."
+       MSG_FOR_URT_HR(CLR_E_CROSSGEN_NO_IBC_DATA_FOUND) "Cannot compile using the PartialNgen flag because no IBC data was found."
        MSG_FOR_URT_HR(COR_E_BADIMAGEFORMAT) "The format of a DLL or executable being loaded is invalid."
 END
index 6e72e49..f8578f1 100644 (file)
 #define CLR_E_GC_OOM EMAKEHR(0x2009)
 #define CLR_E_GC_BAD_AFFINITY_CONFIG EMAKEHR(0x200a)
 #define CLR_E_GC_BAD_AFFINITY_CONFIG_FORMAT EMAKEHR(0x200b)
+#define CLR_E_CROSSGEN_NO_IBC_DATA_FOUND EMAKEHR(0x200c)
 #define COR_E_UNAUTHORIZEDACCESS E_ACCESSDENIED
 #define COR_E_ARGUMENT E_INVALIDARG
 #define COR_E_INVALIDCAST E_NOINTERFACE
index 2dce179..a70b710 100644 (file)
@@ -3378,6 +3378,13 @@ void ZapImage::LoadProfileData()
             m_zapper->Warning(W("Warning: Invalid profile data was ignored for %s\n"), m_pModuleFileName);
         }
     }
+
+#ifdef CROSSGEN_COMPILE
+    if (m_zapper->m_pOpt->m_fPartialNGen && (m_pRawProfileData == NULL || m_cRawProfileData == 0))
+    {
+        ThrowHR(CLR_E_CROSSGEN_NO_IBC_DATA_FOUND);
+    }
+#endif
 }
 
 // Initializes our form of the profile data stored in the assembly.