Enable same-OS cross-arch NativeAOT builds; cross-build arm64 AoT legs on x64 - #55205
Merged
Merged
Conversation
…s on x64 Generalize the dotnet-aot NativeAOT publish gate so same-OS cross-architecture AoT publishes work on Windows and macOS too, not just Linux, per post-merge review feedback on #55143 (issue #55077). - src/Layout/Directory.Build.props: replace the Linux-only native/cross gate properties with OS-agnostic _DotnetAotIsSameOSBuild / _DotnetAotIsNativeBuild / _DotnetAotIsCrossBuild. _ShouldPublishDotnetAot now publishes for a supported RID whenever the target OS equals the host OS and the target arch either matches (native) or differs (cross) from the build host. Removes the strict TargetRid == HostRid clause while preserving native same-arch behavior. - src/Layout/redist/targets/GenerateLayout.targets: forward CrossBuild/TargetArchitecture/TargetRid to the child dotnet-aot Publish for all cross-arch builds (win/osx/linux), not just Linux. Comments updated. - eng/pipelines/templates/jobs/sdk-build.yml: forward osProperties to the Windows build step so cross legs can pass /p:CrossBuild=true (no-op for existing legs). - .vsts-ci.yml / .vsts-pr.yml: macOS AoT leg now cross-builds osx-arm64 on the x64 macOS pool and still dispatches *.AoT.Tests to the osx.15.arm64 Helix queue (no coverage loss). New build-only win-arm64 AoT cross leg on the win-x64 pool that publishes the mstat/dgml size-analysis artifacts; Helix arm64 testing deferred pending a windows.11.arm64 queue. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR generalizes the dotnet-aot publish gate and CI configuration to enable same-OS cross-architecture NativeAOT builds (win-x64→win-arm64, osx-x64→osx-arm64, and existing linux-x64→linux-arm64 via cross containers). It updates the Layout gating properties and ensures cross-build inputs are forwarded to the dotnet-aot publish step, then wires new/updated pipeline legs to cross-build arm64 AoT outputs on x64 hardware.
Changes:
- Generalize
_ShouldPublishDotnetAotgating insrc/Layout/Directory.Build.propsfrom Linux-only to same-OS native vs cross-arch builds. - Forward
CrossBuild/TargetArchitecture/TargetRidto thedotnet-aotchild publish for all same-OS cross-arch builds. - Update CI/PR pipelines to add a Windows win-arm64 AoT cross-build leg and switch macOS AoT to cross-build on x64 while still running tests on arm64 Helix.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Layout/redist/targets/GenerateLayout.targets | Forward cross-build properties to dotnet-aot publish for same-OS cross-arch builds. |
| src/Layout/Directory.Build.props | Replace Linux-specific AoT publish gating with OS-agnostic same-OS native/cross-arch gating. |
| eng/pipelines/templates/jobs/sdk-build.yml | Allow OS-specific MSBuild property passthrough (osProperties) on Windows build steps. |
| .vsts-pr.yml | Add win-arm64 AoT cross-build leg; switch macOS AoT leg to cross-build on x64 and keep Helix arm64 tests. |
| .vsts-ci.yml | Mirror PR pipeline changes for internal CI (win-arm64 AoT cross-build; macOS AoT cross-build on x64). |
The generalized _DotnetAotIsCrossBuild matched the regular linux-arm64 TestBuild leg (x64 host, arm64 target, same OS) even though that leg builds on the plain x64 pool with no arm64 sysroot, causing the dotnet-aot NativeAOT cross-link to fail. On Linux the cross toolchain + target sysroot only exist inside the azurelinux cross-prereq container, which signals its availability via CrossBuild=true. Re-add that guard for Linux targets only; Windows/macOS still infer cross from the architecture mismatch since their toolchains are multi-target. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Member
Author
|
This appears to have worked - I checked the legs and each generated NAOT binaries and uploaded the size analysis artifacts. |
marcpopMSFT
reviewed
Jul 13, 2026
akoeplinger
approved these changes
Jul 14, 2026
baronfel
added a commit
that referenced
this pull request
Jul 15, 2026
The win-x64 -> win-arm64 NativeAOT cross-build AoT leg (added in #55205) has been persistently failing in CI. Disable it via disableJob: true in both .vsts-pr.yml and .vsts-ci.yml, with a comment linking the tracking issue #55298 for dotnet/illink (ILCompiler) team follow-up. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b7c0dc09-64f3-40b8-9c5f-45b0fce2e461
dsplaisted
added a commit
to dsplaisted/sdk
that referenced
this pull request
Jul 15, 2026
…um 843419) The 'AoT: windows (arm64)' cross-build leg added in dotnet#55205 has never passed: the win-arm64 NativeAOT cross-link fails with 'LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419)' because the ILCompiler-produced object is not split into per-function sections, so the MSVC arm64 linker cannot apply the erratum fixup. Only win-arm64 is affected (win-x64, osx-arm64, linux-x64/arm64 AoT legs all pass). Set disableJob: true on the win-arm64 AoT job parameter set in .vsts-pr.yml and .vsts-ci.yml to stop it red-walling every build until the underlying ILCompiler fix lands. Re-enable by removing disableJob. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 59570d89-a7e3-4993-baa9-3fb1f442a617
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to merged #55143 (issue #55077). Builds directly on that PR.
Motivation
Post-merge review feedback from @akoeplinger on
src/Layout/Directory.Build.props:The original gate only allowed NativeAOT cross-compilation for Linux (via the azurelinux cross containers). This PR generalizes the gate so same-OS cross-architecture AoT publishes work on Windows and macOS as well, then uses x64 hardware to cross-build the arm64 AoT legs.
Gate generalization (
src/Layout/Directory.Build.props)Replaces the Linux-only
_DotnetAotIsLinuxNativeBuild/_DotnetAotIsLinuxCrossBuildwith OS-agnostic properties:_DotnetAotIsSameOSBuild— target OS (from theTargetRidprefix) equals the build host OS. NativeAOT can only target the host OS, so this is the prerequisite for both native and cross publishing._DotnetAotIsNativeBuild— same OS andTargetArchitecture == BuildArchitecture(the canonical native signal on all platforms; avoids theTargetRid == HostRidmismatch on Linux whereHostRidis distro-specific). Keeps thelinux-musland source-build exclusions._DotnetAotIsCrossBuild— same OS butTargetArchitecture != BuildArchitecture. Covers win-x64→win-arm64, osx-x64→osx-arm64, and Linux (which keeps itsCrossBuild+ROOTFS_DIRcontainer semantics)._ShouldPublishDotnetAot = _DotnetAotTargetRidSupported AND (_DotnetAotIsNativeBuild OR _DotnetAotIsCrossBuild). The strictTargetRid == HostRidclause is removed but the native same-arch/same-OS case remains equivalent. Cross-OS builds,linux-musl, source-build and unsupported RIDs are still excluded (verified by evaluating the gate across 10 scenarios).GenerateLayout.targetsnow forwardsCrossBuild=true;TargetArchitecture;TargetRidto the childdotnet-aotPublish for all cross-arch builds, not just Linux.sdk-build.ymlforwardsosPropertiesto the Windows build step (default empty, no-op for existing legs) so cross legs can pass/p:CrossBuild=true.macOS: x64 cross-build + arm64 Helix tests (no coverage loss)
Because
runTestsdispatches tests to Helix (-test /p:CustomHelixTargetQueue=...), AoT test execution is bound to the Helix queue, not the build agent. The macOS AoT leg now builds osx-arm64 on the x64 macOS pool (the Official osx-arm64 leg already cross-builds there) with/p:CrossBuild=true, and still runs the*.AoT.Testson theosx.15.arm64Helix queue — so there is zero macOS AoT test-coverage loss.Windows: new build-only win-arm64 AoT leg
Adds a win-arm64 AoT cross leg that builds on the existing win-x64 pool with
/p:CrossBuild=trueand publishes the mstat/dgml size-analysis artifacts (gated onrunAoTTests). It is build-only (runTests: false) because there is no wired windows arm64 Helix queue yet; running the AoT tests on arm64 hardware is a follow-up pending awindows.11.arm64queue. Expressed directly in.vsts-ci.yml/.vsts-pr.yml(with the.openqueue suffix for PR), mirroring the linux-arm64 cross leg precedent. Existing linux x64/arm64 AoT legs are unchanged.Validation
This is a Windows dev host, so the actual cross-links can't be exercised locally. All edited YAML/props/targets parse, and the gate's boolean logic was evaluated with MSBuild across native/cross/cross-OS/musl/source-build/unsupported-RID scenarios — all correct. Per @akoeplinger's caveat, a full VMR build is advisable to validate the win-x64→win-arm64 and osx-x64→osx-arm64 cross-links end to end.