R2RDump improvements (#46833)
authorSimon Nattress <nattress@gmail.com>
Tue, 12 Jan 2021 02:20:04 +0000 (18:20 -0800)
committerGitHub <noreply@github.com>
Tue, 12 Jan 2021 02:20:04 +0000 (18:20 -0800)
commit0fd7a3ff00d0421bf3cbb31edbac005b95e49ffc
tree30cd98215200ee228a16991737d41a462728a90c
parentfde73e0cc755defff75c4dd32933374b04af1cde
R2RDump improvements (#46833)

* Fix handling of module override token in signature parser. When the override is present, a new SignatureDecoder is created and used as the decoder for the final signature with the fixup kind (and module override flag which is stored in the upper bit of the fixup kind byte) already parsed. This causes the remainder of the signature to be parsed as a full R2R signature which is now missing the fixup type.
* Instead of creating a new decoder when a module override is present, set up the initial decoder's metadata reader in the constructor by detecting the module override up front.
* Fix `TryLocateNativeReadyToRunHeader` to swallow `BadImageFormatException` and return true / false whether the image has a native R2R header (for composite images).
* Running R2RDump on IL assemblies with no R2R now emits an error message that the assembly is not R2R instead of an unhelpful error about some RVA offset conversion failing.
src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunReader.cs
src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs