Skip to content

Ensure the Thumb bit is set for resumption stub relocs#125421

Merged
jtschuster merged 9 commits intodotnet:mainfrom
jtschuster:async-r2r-arm32-thumb-bit
Mar 19, 2026
Merged

Ensure the Thumb bit is set for resumption stub relocs#125421
jtschuster merged 9 commits intodotnet:mainfrom
jtschuster:async-r2r-arm32-thumb-bit

Conversation

@jtschuster
Copy link
Member

ARM32 requires bit 0 to be set for Thumb-2 code. Without this bit set, we encountered illegal instruction failures in CI and disabled crossgenning async methods on ARM32.

@jtschuster
Copy link
Member Author

/azp run runtime-coreclr crossgen2 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

This PR addresses ARM32 Thumb-2 requirements for async resumption-related code pointers so ReadyToRun/crossgen2 can safely emit async methods again on ARM32 without illegal-instruction failures.

Changes:

  • Remove the ARM32-specific exclusion that prevented async methods from being emitted in ReadyToRun mode (still excluded for composite builds).
  • Update JIT emission of CORINFO_AsyncResumeInfo relocations to apply an additional delta on ARM32 so relocated code pointers have bit 0 (Thumb bit) set.

Reviewed changes

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

File Description
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs Stops filtering out async methods on ARM32; keeps composite-build exclusion.
src/coreclr/jit/emit.cpp Records async resume info relocations with an ARM32 addend delta to ensure Thumb-bit-correct code pointers.

@jtschuster jtschuster force-pushed the async-r2r-arm32-thumb-bit branch from 3e8fe1f to 62c80b7 Compare March 11, 2026 20:47
Copilot AI review requested due to automatic review settings March 12, 2026 00:12
@jtschuster
Copy link
Member Author

/azp run runtime-coreclr crossgen2 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.

On ARM32, the JIT sets bit 0 on code pointers to indicate Thumb mode.
When crossgen2's recordRelocation receives an external handle with the
Thumb bit set, HandleToObject's integer division (by handleMultiplier=8)
truncates the low bits, and the relocation delta is recorded as 0
instead of 1. At runtime, the resume stub pointer in the continuation
layout lacks the Thumb bit, causing blx to switch the CPU to ARM mode
where Thumb-encoded instructions are undefined — resulting in SIGILL.

Fix: before calling HandleToObject, capture the low bits of the handle
that would be lost to integer division and include them in relocDelta.
This is architecture-agnostic: on non-ARM targets the low bits are
always 0, so the mask is a no-op.

Co-authored-by: Copilot <[email protected]>
@MichalStrehovsky
Copy link
Member

/azp run runtime-nativeaot-outerloop

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.

@jtschuster
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MichalStrehovsky
Copy link
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MichalStrehovsky
Copy link
Member

(AzDo canceled the previous run. If /azp run is issued too quickly after a push AzDo does that...)

Copilot AI review requested due to automatic review settings March 17, 2026 21:43
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 3 out of 3 changed files in this pull request and generated 1 comment.

@jtschuster
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jtschuster
Copy link
Member Author

The failure on nativeaot linux-arm outerloop looks unrelated but odd. The console logs don't show all tests passed without any error messages.

@MichalStrehovsky
Copy link
Member

The failure on nativeaot linux-arm outerloop looks unrelated but odd. The console logs don't show all tests passed without any error messages.

There are actually two console logs:

https://helix.dot.net/api/jobs/f2f7ddd6-383d-419a-a15a-9ebf603eb5b4/workitems/System.Net.Sockets.Tests?api-version=2019-06-17

First one has the failure, the second is clean.

As to why there are two logs:

2026-03-18T19:47:49.140Z	INFO   	executor(214)	run	Test configuration for test set indicates 'RERUN', re-executing workitem...

Looks like AzDo shows this somewhat better: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1341505&view=ms.vss-test-web.build-test-results-tab&runId=37468284&resultId=171773&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab

But still shows the test as failed, but with multiple executions and multiple logs.

Not sure what triggers the RERUN.

But looks good, I got desensitized to networking test failures.

@jtschuster
Copy link
Member Author

/ba-g Failures are network flakes or #125757

@jtschuster jtschuster merged commit 64350da into dotnet:main Mar 19, 2026
144 of 155 checks passed
@github-project-automation github-project-automation bot moved this to Done in AppModel Mar 19, 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.

6 participants