Skip to content

SPMI: Fix relocs into new RO data section#124383

Merged
jakobbotsch merged 3 commits intodotnet:mainfrom
jakobbotsch:fix-124371
Feb 19, 2026
Merged

SPMI: Fix relocs into new RO data section#124383
jakobbotsch merged 3 commits intodotnet:mainfrom
jakobbotsch:fix-124371

Conversation

@jakobbotsch
Copy link
Member

  • Add arm64 handling similar to existing handling for relative relocs pointing into RO data section
  • Teach the relocation handling that on arm64 there are multiple RO data blocks (one at the end of code, one separate one for async functions). The new relative reloc handling for arm64 is interested in the latter one as the former one doesn't need relocs.

Fix #124371

This is quite hacky. I opened #124382 to clean this up in the future.

- Add arm64 handling similar to existing handling for relative relocs
  pointing into RO data section
- Teach the relocation handling that on arm64 there are multiple RO data
  blocks (one at the end of code, one separate one for async functions)
Copilot AI review requested due to automatic review settings February 13, 2026 14:04
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 13, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
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 SuperPMI’s near-diff relocation normalization to better handle ARM64 relocations that reference a second RO-data block (not the constant pool appended to hot code), addressing spurious diffs seen for async-related data on linux-arm64.

Changes:

  • Extend RelocContext to track two RO-data ranges (primary + secondary) and thread that through near-diff relocation application.
  • Add ARM64-specific relocation handling intended to remap targets that land in the secondary RO-data block.
  • Minor assignment reordering in Compiler::impResolveToken.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/coreclr/tools/superpmi/superpmi/neardiffer.cpp Tracks two RO-data regions on ARM64 and populates the expanded RelocContext accordingly.
src/coreclr/tools/superpmi/superpmi-shared/compileresult.h Expands RelocContext with roDataSize1/2 and originalRoDataAddress1/2.
src/coreclr/tools/superpmi/superpmi-shared/compileresult.cpp Adds ARM64 relocation remapping logic for targets that fall into the secondary RO-data range; updates uses to new context fields.
src/coreclr/jit/importer.cpp Reorders token field assignments in impResolveToken.
Comments suppressed due to low confidence (1)

src/coreclr/tools/superpmi/superpmi-shared/compileresult.cpp:890

  • In the ARM64_PAGEBASE_REL21 relocation handling, pageDelta is computed as targetPage - targetPage, which is always 0 and leaves fixupLocationPage unused. This should be computed relative to the fixup location page (e.g., targetPage - fixupLocationPage) so ADRP immediates are patched correctly and reflect the recorded relocation target.
                        INT64 targetPage        = (INT64)target & 0xFFFFFFFFFFFFF000LL;
                        INT64 fixupLocationPage = (INT64)fixupLocation & 0xFFFFFFFFFFFFF000LL;
                        INT64 pageDelta         = (INT64)(targetPage - targetPage);
                        INT32 imm21             = (INT32)(pageDelta >> 12) & 0x1FFFFF;
                        PutArm64Rel21((UINT32*)address, imm21);

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr superpmi-diffs

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI review requested due to automatic review settings February 17, 2026 11:42
Copy link
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib. Fixes some spurious diffs.
Copilot feedback is valid but issues are preexisting and I think it would be better to clean up all the reloc handling in the future. #124382 tracks that.

@jakobbotsch jakobbotsch requested a review from a team February 17, 2026 15:33
@jakobbotsch jakobbotsch merged commit d9747b7 into dotnet:main Feb 19, 2026
106 of 108 checks passed
@jakobbotsch jakobbotsch deleted the fix-124371 branch February 19, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SPMI: Spurious diffs for async resumption info on linux-arm64

3 participants