Skip to content

Conversation

@jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Feb 6, 2026

These cannot have any addend embedded in the instruction and must instead be handled via a additional reloc entry. The object writer already knows how to create these reloc entries, but it was leaving the embedded addend in the instruction in some cases.

Fix #124015

These cannot have any addend embedded in the instruction and must
instead be handled via a additional reloc entry. The object writer
already knows how to create these reloc entries, but it was leaving the
embedded addend in the intstruction in some cases.
Copilot AI review requested due to automatic review settings February 6, 2026 12:31
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 6, 2026
@jakobbotsch jakobbotsch changed the title Fix MachO relocations adrp/add and branch relocations Fix MachO adrp/add and branch relocations Feb 6, 2026
@jakobbotsch jakobbotsch changed the title Fix MachO adrp/add and branch relocations Fix MachO adrp/add and branch relocations with embedded addend Feb 6, 2026
@jakobbotsch
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch jakobbotsch added area-NativeAOT-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Feb 6, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
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 fixes a bug in the MachO object writer where ARM64 relocations (ADRP/ADD and BRANCH26) were incorrectly leaving embedded addends in the instruction encoding. According to the MachO format specification for ARM64, these relocation types cannot have addends embedded in the instruction - instead, addends must be communicated through separate ARM64_RELOC_ADDEND relocation entries.

Changes:

  • Added IMAGE_REL_BASED_ARM64_BRANCH26 to the case statement handling ARM64 relocations that require addend extraction and clearing
  • Ensured that any existing addend value embedded in the BRANCH26 instruction is read out, accumulated into the addend variable, and then the instruction is cleared to zero

@jkotas
Copy link
Member

jkotas commented Feb 6, 2026

Can we re-enable the test disabled against the fixed issue?

[ActiveIssue("https://github.com/dotnet/runtime/issues/124015", typeof(PlatformDetection), nameof(PlatformDetection.IsArm64Process))]

Copilot AI review requested due to automatic review settings February 6, 2026 12:46
@jakobbotsch
Copy link
Member Author

Can we re-enable the test disabled against the fixed issue?

[ActiveIssue("https://github.com/dotnet/runtime/issues/124015", typeof(PlatformDetection), nameof(PlatformDetection.IsArm64Process))]

Thanks, reenabled that.

@jakobbotsch
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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 2 out of 2 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings February 6, 2026 13:18
@jakobbotsch
Copy link
Member Author

jakobbotsch commented Feb 6, 2026

The LLVM code at https://github.com/llvm/llvm-project/blob/3a084241248efd7d5259183cffae1d5b7057a54c/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp#L355-L382 does it for Branch26 as well, but in my tests the embedded addends for those appear to be fine, so I have left that out.

Edit: The documentation is quite clear to use ARM64_RELOC_ADDEND though, so I reapplied this.

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 2 out of 2 changed files in this pull request and generated no new comments.

@jakobbotsch
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch
Copy link
Member Author

The runtime-nativeaot-outerloop osx-arm64 failure looks related, but I cannot reproduce it locally after running in a loop for a while.

@jakobbotsch
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

Copilot AI review requested due to automatic review settings February 9, 2026 10:58
@jakobbotsch
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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 2 out of 2 changed files in this pull request and generated no new comments.

kotlarmilos added a commit that referenced this pull request Feb 9, 2026
## Description

This PR fixes several failures encountered in extra-platforms pipeline:
- Updates `ZipMergedPayloadDirectory` target to use
`PreparePayloadDirectories` instead of
`PrepareMergedTestPayloadDirectories`, which was inlined in
#123110. This should fix Apple
mobile runtime tests
- Includes StandaloneTestRunner markers used for Native AOT mobile tests
 - Excludes test markers for shared libraries on Android
 - Disables unreliable socket tests on Apple mobile

Native AOT builds will be fixed in
#124083

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jakobbotsch
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Thank you!

@jakobbotsch
Copy link
Member Author

/ba-g Timeout and unmatched dotnet/dnceng#6457

1 similar comment
@jakobbotsch
Copy link
Member Author

/ba-g Timeout and unmatched dotnet/dnceng#6457

@jakobbotsch jakobbotsch merged commit c4a5583 into dotnet:main Feb 10, 2026
154 of 164 checks passed
@jakobbotsch jakobbotsch deleted the fix-124015 branch February 10, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MacOS arm64 NAOT runtime-async - bad ResumeInfo written (causing failure on StackTraceTests)

4 participants