summaryrefslogtreecommitdiff
path: root/src/vm/pefile.cpp
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-06-11 07:49:03 -0700
committerGitHub <noreply@github.com>2016-06-11 07:49:03 -0700
commite266aff51403794bb2bd925a7ebb1ea53b119575 (patch)
treeb6781e6d7d8d5ef34e82aec078733925339d62f2 /src/vm/pefile.cpp
parentc265ae38157f8543f9100c5f076d4dfa953766c7 (diff)
downloadcoreclr-e266aff51403794bb2bd925a7ebb1ea53b119575.tar.gz
coreclr-e266aff51403794bb2bd925a7ebb1ea53b119575.tar.bz2
coreclr-e266aff51403794bb2bd925a7ebb1ea53b119575.zip
Do not use fragile native image content when generating R2R images (#5715)
Diffstat (limited to 'src/vm/pefile.cpp')
-rw-r--r--src/vm/pefile.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp
index deddc67408..440281e953 100644
--- a/src/vm/pefile.cpp
+++ b/src/vm/pefile.cpp
@@ -499,7 +499,7 @@ static void ValidatePEFileMachineType(PEFile *peFile)
if (actualMachineType == IMAGE_FILE_MACHINE_I386 && ((peKind & (peILonly | pe32BitRequired)) == peILonly))
return; // Image is marked CPU-agnostic.
- if (actualMachineType != IMAGE_FILE_MACHINE_NATIVE)
+ if (actualMachineType != IMAGE_FILE_MACHINE_NATIVE && actualMachineType != IMAGE_FILE_MACHINE_NATIVE_NI)
{
#ifdef _TARGET_AMD64_
// v4.0 64-bit compatibility workaround. The 64-bit v4.0 CLR's Reflection.Load(byte[]) api does not detect cpu-matches. We should consider fixing that in
@@ -2334,6 +2334,12 @@ BOOL PEFile::ShouldTreatNIAsMSIL()
{
LIMITED_METHOD_CONTRACT;
+ // Never use fragile native image content during ReadyToRun compilation. It would
+ // produces non-version resilient images because of wrong cached values for
+ // MethodTable::IsLayoutFixedInCurrentVersionBubble, etc.
+ if (IsReadyToRunCompilation())
+ return TRUE;
+
// Ask profiling API & config vars whether NGENd images should be avoided
// completely.
if (!NGENImagesAllowed())