Skip to content

Add experimental aarch64-pc-msys support#348

Draft
Kreijstal wants to merge 7 commits into
msys2:msys2-3.6.9from
Kreijstal:aarch64-clang-experiment
Draft

Add experimental aarch64-pc-msys support#348
Kreijstal wants to merge 7 commits into
msys2:msys2-3.6.9from
Kreijstal:aarch64-clang-experiment

Conversation

@Kreijstal

@Kreijstal Kreijstal commented Jul 18, 2026

Copy link
Copy Markdown

This is an early port of msys2-runtime to native Windows ARM64
(aarch64-pc-msys). It builds on the AArch64 Cygwin work in
Windows-on-ARM-Experiments,
adapts it to the MSYS2 3.6.9 tree, and adds a Clang-based cross-build path.

I tested the resulting runtime and Bash on Windows 11 ARM64 in QEMU/HVF. I am
opening this as a draft because the basic process model works, but several
runtime issues and the source-attribution cleanup still need to be addressed.

Changes

  • recognize aarch64-pc-msys in the build system
  • add the AArch64 newlib and PE/COFF support needed by the runtime
  • adapt winsup startup, TLS, imports, exceptions, signals, pthreads, memory
    allocation, and fork handling for ARM64
  • allow the target to be cross-built with Clang and ARM64 PE binutils
  • document the toolchain and reproduction procedure

Testing

All existing GitHub Actions jobs pass, including the GCC, Clang, MSYS, and
CLANGARM64 configurations.

I also rebuilt commit 8e82becb50b8bf02fa0d0dd9cd6d53671d3a1347
from a clean checkout with the pinned LLVM, binutils, mingw-w64, and
LLVM-MinGW inputs. The prepared DLL was a native AArch64 PE32+ image with
SHA-256:

e69dd757dab8ca0148dbf0f0e95278afab70e56f527b1406bf9eb1d86ba653ed  msys-2.0.dll

On Windows 11 ARM64 under QEMU/HVF, that exact DLL passed:

  • native LoadLibrary and dll_crt0 resolution
  • runtime startup and external-process execution
  • native fork and pipe/fork probes, 10/10 runs each
  • Bash 5.3 startup and smoke tests, 5/5 runs
  • command substitution and subshell exit-status checks, 6/6 runs
  • a focused sigsetjmp/siglongjmp probe, 5/5 runs; saved signal masks were
    restored and the savemask=0 case left the current mask unchanged

One earlier Bash status invocation ended with 0xC0000005. During the ten-run
fork sweep, one child copy attempt reported Win32 error 299 and then succeeded
through the runtime retry path. These observations are consistent with the
transient QEMU child-start behavior described below, so this is functional
validation rather than a stability claim.

The reproduction gist
contains the pinned inputs, build scripts, hashes, probes, and captured output.

Known issues

  • long Bash argument lists can be corrupted
  • /tmp setup currently emits a warning
  • transient fork-child startup faults are retried up to four times
  • a rare process fault can occur in QEMU before the runtime is loaded
  • newly linked ARM64 executables still require the documented CRT post-link fix
  • the full native ARM64 runtime testsuite is not yet running as a required CI
    job

Prior work

The runtime implementation is derived from the Windows-on-ARM-Experiments
effort rather than being a separate ARM64 port. Before this is ready for
review, I need to compare the runtime commits against that history, retain
attribution for the code and designs carried over, and remove changes that
duplicate newer WOA work. The QEMU reproduction and Clang/MSYS2 adaptation are
the parts specifically validated here.

Teach the top-level, newlib, and winsup build logic to configure aarch64-pc-msys. Select the ARM64 runtime sources and direct linker path while retaining the existing x86_64 link rule.

Assisted-by: OpenAI Codex: GPT-5
@Kreijstal
Kreijstal force-pushed the aarch64-clang-experiment branch from 6011ee3 to 4be5b26 Compare July 18, 2026 03:36
@Kreijstal Kreijstal changed the title Experimental aarch64-pc-msys Clang cross-build and runtime bring-up QEMU validation of WOA-derived aarch64-pc-msys runtime with Clang Jul 18, 2026
@Kreijstal Kreijstal changed the title QEMU validation of WOA-derived aarch64-pc-msys runtime with Clang Add experimental aarch64-pc-msys support Jul 18, 2026
Kreijstal and others added 6 commits July 18, 2026 10:51
Resolve const-correctness, initializer, exception-specification, unused-code, and recursive-overload diagnostics exposed by the ARM64 Clang bootstrap. These changes are architecture-independent and intentionally isolated from the ARM64 implementation.

Assisted-by: OpenAI Codex: GPT-5
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adapt AArch64 assembly and setjmp for PE/COFF, provide ARM64-only weak aliases without STABS, and select the long-double library sources appropriate for the LP64 MSYS ABI.

Assisted-by: OpenAI Codex: GPT-5
Implement ARM64 startup, autoload thunks, TLS, signal contexts, exception handling, allocator bootstrap, import decoding, fork reconstruction, child-start retry, linker layout, and compatibility exports. Architecture-specific behavior is guarded from the x86_64 path.

Assisted-by: OpenAI Codex: GPT-5
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Record the generated configure, Makefile, and helper-script outputs used by the cross build. Keeping this mechanical update separate makes the source changes reviewable.

Assisted-by: OpenAI Codex: GPT-5
Document the cross-toolchain layout, configure arguments, support libraries, and known limitations for reproducing the Windows ARM64 runtime.

Assisted-by: OpenAI Codex: GPT-5
Credit the Windows-on-ARM-Experiments runtime foundation and state that the tested QEMU path is the primary result.

Assisted-by: OpenAI Codex: GPT-5
@Kreijstal
Kreijstal force-pushed the aarch64-clang-experiment branch from 4be5b26 to 8e82bec Compare July 18, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant