Skip to content

Managed ilasm emits AMD64 instead of ARM64 when -PE64 and -ARM64 are combined #137449

Closed

Description

@akoeplinger

Description

The updated managed ilasm emits an AMD64 PE image when the existing -PE64 -ARM64 option combination is used. The native assembler emits ARM64 for the same inputs and options. This breaks both ARM64 data fixtures in the MixedMode tests. @jkoritzinsky

We should retain compatibility with the existing invocation rather than changing the test flags to hide the regression.

Reproduction Steps

Use runtime.osx-arm64.Microsoft.NETCore.ILAsm version 12.0.0-alpha.1.26561.116 with the existing DataPointers.il fixture:

ilasm DataPointers.il -DLL -PE64 -ARM64 -OUTPUT=DataPointersArm64.dll

Inspect the PE COFF Machine field. The checked-in DataPointersArm64.ilproj uses these architecture options. Repeat with ExecutableData.il; its ARM64 project uses the same combination.

The problem also reproduces with --pe64 --arm64 and with the order reversed (--arm64 --pe64).

Expected behavior

PE32+ image with Machine 0xAA64 (ARM64), matching native ilasm and the explicitly requested target. Re-enable the ARM64 cases of MixedModeTests.Data once both fixtures assemble correctly with the original flags and execute on Windows ARM64.

Actual behavior

The assembler succeeds but emits Machine 0x8664 (AMD64). Both DataPointersArm64.dll and ExecutableDataArm64.dll have the wrong architecture.

Windows ARM64 CI encounters the first fixture and fails with:

System.IO.FileLoadException: Could not load file or assembly '...DataPointersArm64.dll'. The assembly architecture is not compatible with the current process architecture.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at MixedModeTests.LoadAssembly(String name)
   at MixedModeTests.Data(String name)

Regression?

Yes, relative to native ilasm. Local comparison using the original -PE64 -ARM64 invocation:

Assembler/options Machine Optional header
Native ilasm, -PE64 -ARM64 0xAA64 (ARM64) PE32+
Managed ilasm, -PE64 -ARM64 0x8664 (AMD64) PE32+
Managed ilasm, --pe64 --arm64 0x8664 (AMD64) PE32+
Managed ilasm, --arm64 --pe64 0x8664 (AMD64) PE32+
Managed ilasm, --arm64 alone 0xAA64 (ARM64) PE32+

Known Workarounds

Omitting -PE64 produces the correct ARM64 header for both fixtures in local assembly/PE checks. Windows execution of that workaround was not verified. Alternatively, use native ilasm.

The temporary test quarantine should cover only the ARM64 cases and preserve x86/x64 data coverage, leaving the original project flags unchanged.

Configuration

Managed ilasm package: 12.0.0-alpha.1.26561.116. Package repository commit: dotnet/dotnet@60864f1c9f7bc774d1c191ef6f1630e81607cd62.

Reproduced assembly/header selection on macOS ARM64; runtime failure observed on Windows 11 ARM64 CoreCLR Checked. Windows execution was not performed locally.

Other information

Failing runtime build 1677882, test run 46773528.

Related dependency update: #137416. This is separate from the preprocessor regression in #137424 and the missing AutoExports output.

Note

This issue was generated by GitHub Copilot.

Activity

  1. added
    untriaged
    on Nov 12, 2026
  2. dotnet-policy-service commented on Nov 12, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib
    See info in area-owners.md if you want to be subscribed.

  3. removed
    untriaged
    on Nov 18, 2026
  4. added a commit that references this issue on Nov 18, 2026
    8efd167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions