Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d65abd8

Browse files
committed
Merge pull request #3070 from jkotas/crossgen-fix
Fix loading of native images on Unix
2 parents 3593fba + fbeed7c commit d65abd8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/inc/pedecoder.inl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,11 +1340,20 @@ inline void PEDecoder::GetPEKindAndMachine(DWORD * pdwPEKind, DWORD *pdwMachine)
13401340
dwKind |= (DWORD)pe32Unmanaged;
13411341
}
13421342

1343-
if (HasReadyToRunHeader() && (GetReadyToRunHeader()->Flags & READYTORUN_FLAG_PLATFORM_NEUTRAL_SOURCE) != 0)
1343+
if (HasReadyToRunHeader())
13441344
{
1345-
// Supply the original PEKind/Machine to the assembly binder to make the full assembly name look like the original
1346-
dwKind = peILonly;
1347-
dwMachine = IMAGE_FILE_MACHINE_I386;
1345+
if (dwMachine == IMAGE_FILE_MACHINE_NATIVE_NI)
1346+
{
1347+
// Supply the original machine type to the assembly binder
1348+
dwMachine = IMAGE_FILE_MACHINE_NATIVE;
1349+
}
1350+
1351+
if ((GetReadyToRunHeader()->Flags & READYTORUN_FLAG_PLATFORM_NEUTRAL_SOURCE) != 0)
1352+
{
1353+
// Supply the original PEKind/Machine to the assembly binder to make the full assembly name look like the original
1354+
dwKind = peILonly;
1355+
dwMachine = IMAGE_FILE_MACHINE_I386;
1356+
}
13481357
}
13491358
}
13501359
else

0 commit comments

Comments
 (0)