Fix R2Rdump for 32bit platforms, and print disassembly for wasm even when we can't load CoreDisTools#128237
Open
davidwrighton wants to merge 2 commits into
Open
Fix R2Rdump for 32bit platforms, and print disassembly for wasm even when we can't load CoreDisTools#128237davidwrighton wants to merge 2 commits into
davidwrighton wants to merge 2 commits into
Conversation
…when we can't load CoreDisTools
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates R2RDump handling for WebAssembly/Webcil inputs and corrects import section parsing for 32-bit import entries so fixup offsets map more accurately.
Changes:
- Avoids creating the CoreDisTools-backed disassembler for Webcil inputs.
- Reads 4-byte import section entries as 32-bit values instead of always consuming 8 bytes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/coreclr/tools/r2rdump/Program.cs |
Skips CoreDisTools disassembler initialization for Webcil images. |
src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunReader.cs |
Adjusts import section entry reading based on 4-byte vs larger entry sizes. |
When disassembling WebAssembly code, detect the pattern where global.get 1 (imageBase) is followed by i32.const <RVA> or i32.load offset=<RVA>, and resolve the RVA to a symbolic name via ImportSignatures. This mirrors what CoreDisTools does for x64 RIP-relative and ARM64 ADRP+ADD patterns. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 32bit issue affected the ability to identify which fixups were associated with a given offset. This has been broken for a long time, but mostly wasn't relevant as the disassembly view of fixups made it unimportant.
CoreDisTools isn't used for webassembly, but we were trying to load it when we did disassembly. This fixes that problem, and allows the r2rdump built in wasm build to work properly.
Also, finally, add support for symbolic lookup when disassembly a wasm file for R2R symbols