1) In some situations, Crossgen emits a section with EntrySize = 0.
Apparently the engine defaults to size_t in such case.
2) Similarly, Crossgen sometimes emits a section with the UNKNOWN
kind. I have relaxed the section kind check to just treat all
non-eager section kinds the same.
Thanks
Tomas
R2RImportSection.CorCompileImportFlags flags = (R2RImportSection.CorCompileImportFlags)NativeReader.ReadUInt16(Image, ref offset);
byte type = NativeReader.ReadByte(Image, ref offset);
byte entrySize = NativeReader.ReadByte(Image, ref offset);
+ if (entrySize == 0)
+ {
+ switch (Machine)
+ {
+ case Machine.I386:
+ case Machine.ArmThumb2:
+ entrySize = 4;
+ break;
+
+ case Machine.Amd64:
+ case Machine.IA64:
+ case Machine.Arm64:
+ entrySize = 8;
+ break;
+
+ default:
+ throw new NotImplementedException(Machine.ToString());
+ }
+ }
int entryCount = 0;
if (entrySize != 0)
{
}
}
break;
- case R2RImportSection.CorCompileImportFlags.CORCOMPILE_IMPORT_FLAGS_CODE:
- case R2RImportSection.CorCompileImportFlags.CORCOMPILE_IMPORT_FLAGS_PCODE:
+ default:
for (int i = 0; i < entryCount; i++)
{
int entryOffset = sectionOffset - startOffset;