Skip to content

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
dotnet:mainfrom
davidwrighton:fix_r2rdump_wasm
Open

Fix R2Rdump for 32bit platforms, and print disassembly for wasm even when we can't load CoreDisTools#128237
davidwrighton wants to merge 2 commits into
dotnet:mainfrom
davidwrighton:fix_r2rdump_wasm

Conversation

@davidwrighton
Copy link
Copy Markdown
Member

@davidwrighton davidwrighton commented May 14, 2026

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/coreclr/tools/r2rdump/Program.cs
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-R2RDump-coreclr Ready-to-run image dump tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants