Repository navigation
Fix managed ilasm ARM64 target with PE64 - #137454
Merged
jkoritzinsky merged 4 commits intoNov 18, 2026
Merged
Conversation
Honor the ARM64 target when PE64 is also specified, retaining AMD64 as the PE64-only default. Cover legacy and modern architecture switches and both option orders with emitted-header checks. Co-authored-by: Copilot App <[email protected]>
jkoritzinsky
requested review from
MichalStrehovsky,
akoeplinger and
jkotas
and
a balanced review from Copilot
November 12, 2026 20:47
|
Azure Pipelines: Successfully started running 4 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the ARM64/PE64 target-selection change.
No open issues 🎉
What changed in this PR
Fixes managed ILAsm target selection so an explicit ARM64 option takes precedence over the PE64 default to AMD64, restoring compatibility with existing MixedMode fixture invocations.
Changes:
- Prevents PE64 from overriding ARM64 while preserving explicit X64 and PE64-only behavior.
- Adds 15 command-line test cases checking COFF machine and optional-header magic across legacy and modern option spellings and both option orders.
| File | Description |
|---|---|
src/tools/ilasm/tests/ilasm.Tests/CommandLineTests.cs |
Adds architecture-selection regression coverage using emitted PE headers. |
src/tools/ilasm/src/ilasm/Program.cs |
Applies the PE64 AMD64 default only when ARM64 is not explicitly requested. |
Review effort: Balanced
jkotas
reviewed
Nov 12, 2026
Replace the modern --pe64, --x64, and --arm64 switches with a single --arch <x86|x64|arm64> option. Legacy /PE64, /X64, and /ARM64 switches now normalize to one --arch value that matches native ilasm: the last /X64 or /ARM64 wins, and /PE64 alone targets x64. Co-authored-by: Copilot App <[email protected]>
jkotas
reviewed
Nov 17, 2026
Emit the synthesized architecture option at the end of the normalized arguments instead of tracking its original position. Keep the end-of-options separator and trailing operands after the architecture option. Co-authored-by: Copilot App <[email protected]>
jkotas
reviewed
Nov 17, 2026
Replace the single-use local setter functions with direct assignments. Co-authored-by: Copilot App <[email protected]>
jkotas
approved these changes
Nov 17, 2026
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.

Treat PE64 as an AMD64 default only when ARM64 was not explicitly requested. Previously, PE64 selected AMD64 before the ARM64 option was considered, regardless of argument order.
This restores compatibility with the original
-DLL -PE64 -ARM64invocations without changing the MixedMode fixture projects. Explicit X64 and PE64-only behavior remain unchanged.Add a 15-case command-line theory checking both COFF Machine and optional-header magic for the default target, X64, ARM64, and PE64, including legacy/modern spellings and both option orders.
Validation
.\build.cmd clr+libs -rc release— passed (clean prerequisite build)..\dotnet.cmd test src\tools\ilasm\tests\ilasm.Tests\ilasm.Tests.csproj --filter FullyQualifiedName~TargetOptions_EmitRequestedArchitecturebefore the fix — reproduced exactly four failures (ARM64 + PE64 with legacy/modern spellings in both orders); 11 controls passed..\dotnet.cmd test src\tools\ilasm\tests\ilasm.Tests\ilasm.Tests.csprojafter the fix — passed: 578 passed, 3 existing skips, 0 failures..\build.cmd tools+tools.ilasm— passed. Two unrelated NU1903 warnings report the existing Microsoft.DotNet.ILCompiler 10.0.12 dependency in mscordaccore_universal.DataPointers.ilandExecutableData.ilfixtures with the built production ILAsm and inspected their PE headers: all 20 fixture/option combinations passed. Both legacy-PE64 -ARM64and modern--pe64 --arm64, in either order, emit Machine0xAA64and PE32+ (0x20B). ARM64 alone, PE64 alone, X64, X64 + PE64, and default I386/PE32 controls also passed. The ARM64 executable-data input includes the existingArm64.ildefinition, as its project does.Windows ARM64 execution was not performed: the available host is Windows x64. No test cases were disabled or fixture flags changed.
Resolves #137449
Note
This pull request was generated by GitHub Copilot.