Skip to content

Add missing THUMB_BRANCH24 and ARM64_BRANCH26 to Relocation.GetSize#128170

Merged
jtschuster merged 6 commits into
dotnet:mainfrom
jtschuster:fix/relocation-getsize-arm
May 19, 2026
Merged

Add missing THUMB_BRANCH24 and ARM64_BRANCH26 to Relocation.GetSize#128170
jtschuster merged 6 commits into
dotnet:mainfrom
jtschuster:fix/relocation-getsize-arm

Conversation

@jtschuster
Copy link
Copy Markdown
Member

@jtschuster jtschuster commented May 13, 2026

These relocation types were handled in ReadValue/WriteValue but missing from GetSize, causing a NotSupportedException when PEObjectWriter resolves relocations during ARM/ARM64 composite R2R image emission.

This doesn't fully fix the coreroot build because there are relocs from async variants to their resumption stubs which don't fit into these reloc sizes. A follow-up PR to place resumption stubs next to their async methods will fix that.

These relocation types were handled in ReadValue/WriteValue but missing
from GetSize, causing a NotSupportedException when PEObjectWriter
resolves relocations during ARM/ARM64 composite R2R image emission.

Fixes crossgen2 crash in runtime-coreclr crossgen2-composite pipeline
on linux arm (Generate CORE_ROOT step).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 13, 2026 21:50
@github-actions github-actions Bot added the area-crossgen2-coreclr only use for closed issues label May 13, 2026
@jtschuster
Copy link
Copy Markdown
Member Author

/azp run runtime-coreclr crossgen2-composite

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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 Crossgen2/CoreCLR tooling relocation metadata so Relocation.GetSize reports the correct span size for two instruction-immediate relocation kinds used on ARM/ARM64.

Changes:

  • Add RelocType.IMAGE_REL_BASED_THUMB_BRANCH24 => 4 to Relocation.GetSize.
  • Add RelocType.IMAGE_REL_BASED_ARM64_BRANCH26 => 4 to Relocation.GetSize.

Comment thread src/coreclr/tools/Common/Compiler/DependencyAnalysis/Relocation.cs
@jtschuster
Copy link
Copy Markdown
Member Author

/azp run runtime-coreclr crossgen2-composite

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

jtschuster and others added 2 commits May 18, 2026 15:17
Resolve ARM branch relocations in PE images and avoid out-of-range Thumb branches for composite ARM exact method body calls.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the speculative ARM composite-mode branch heuristic and keep PE relocation handling consistent with existing unchecked relocation resolution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 18, 2026 22:17
@jtschuster
Copy link
Copy Markdown
Member Author

/azp run runtime-coreclr crossgen2-composite

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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

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

jtschuster and others added 2 commits May 18, 2026 15:59
Use a non-branch relocation hint for exact composite method bodies on ARM so crossgen2 emits an address-load sequence instead of a Thumb BL that may exceed its immediate range.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 19, 2026 00:46
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

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

Comment thread src/coreclr/tools/Common/Compiler/ObjectWriter/PEObjectWriter.cs
@jtschuster jtschuster enabled auto-merge (squash) May 19, 2026 18:53
@jtschuster jtschuster merged commit 95b6668 into dotnet:main May 19, 2026
113 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel May 19, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants