Fix FieldRVA handling of Field tokens (#35557)
authorSimon Nattress <nattress@gmail.com>
Wed, 29 Apr 2020 03:41:42 +0000 (20:41 -0700)
committerGitHub <noreply@github.com>
Wed, 29 Apr 2020 03:41:42 +0000 (20:41 -0700)
commita561ecb533f591c957b04880ef16e7f7e60244cd
tree3d6839836530eaffaf9bc1325e0d5bc29716b6d2
parentd10a78217f61a1113624eff3747a17cf2907297a
Fix FieldRVA handling of Field tokens (#35557)

FieldRefs in the metadata tables are variable sized. We assumed the common 2 byte encoding, but if there are at least 0x10000 fields in the assembly 4 bytes are used in all tables with FieldRefs, including the FieldRva table we walk and patch.

Use row size to make sure we adjust based on the encoding, and preserve it when rewriting the metadata.
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMetadataBlobNode.cs