Skip to content

fix(msvc): validate native Windows runtime and C ABI - #668

Merged
LunaStev merged 4 commits into
wavefnd:masterfrom
LunaStev:feat/msvc-native-runtime-abi
Sep 16, 2026
Merged

LunaStev merged 4 commits into
wavefnd:masterfrom
LunaStev:feat/msvc-native-runtime-abi

Conversation

@LunaStev

Copy link
Copy Markdown
Member

Summary

Add required native Windows x64 and ARM64 execution gates for MSVC hosted programs and bidirectional C/Wave ABI calls. Fix the ARM64 aggregate classification and runtime/archive handling needed to run those gates against the real Microsoft SDK and CRT.

The change is split into four commits:

  1. Fix native regression target selection and SDK archive validation in CI.
  2. Resolve target-matched LLVM arithmetic builtins and cover hosted runtime behavior (Validate hosted MSVC startup and generated runtime-helper dependencies #617).
  3. Add the shared native C ABI execution driver and fixtures (Establish executable MSVC x64 C ABI interoperability in both call directions #615 and Establish executable Windows ARM64 MSVC C ABI interoperability #616).
  4. Fix ARM64 HFA and variadic argument classification (Establish executable Windows ARM64 MSVC C ABI interoperability #616).

Fixes #615
Fixes #616
Fixes #617

Related migration tracker: #611.

Motivation

MSVC hosts were running executable regressions through the public GNU default, while valid SDK archives could be rejected before linking. Hosted wide arithmetic also needs the matching LLVM compiler-rt builtins. On ARM64, four-double homogeneous aggregates were classified as indirect before HFA classification, and named HFA arguments in Windows variadic functions used the wrong transport.

The new native gate checks independent results in both C-to-Wave and Wave-to-C calls. Missing tools, wrong machine types, emulation, link failures, and execution failures fail the gate instead of reporting a skipped success.

Target and compatibility impact

  • Native regression helpers explicitly select MSVC on MSVC hosts. The public Windows GNU default and final GNU retirement are unchanged.
  • SDK archive inspection accepts validated hybrid native/EC archives, legitimate unselected companion members, Microsoft padding, and neutral debug/alias objects. Direct foreign objects, invalid native indexes, ordinary mixed-machine archives, and foreign members selected by /WHOLEARCHIVE remain rejected.
  • Hosted MSVC linking discovers the matching LLVM 21 arithmetic runtime. Explicit /NODEFAULTLIB behavior is preserved, and missing-helper diagnostics explain the required LLVM location.
  • ARM64 HFA classification precedes the indirect-size rule. Windows named variadic aggregates use composite transport; Linux and Darwin named-HFA behavior is preserved.
  • No std/ libc bindings or license-boundary changes. Release packaging work in Stage native MSVC release packages for amd64 and ARM64 without MinGW runtimes #621 and final cutover in Remove Windows GNU and MinGW support after the MSVC release gates pass #626 remain separate.

Validation

Passed locally:

  • cargo test --locked --workspace --all-targets --no-default-features --features llvm-target-core64 --jobs 2: 203 tests across 29 suites, no failed or ignored tests.
  • cargo clippy --locked --workspace --all-targets --no-default-features --features llvm-target-core64 --jobs 2 -- -D warnings.
  • cargo fmt --all --check and rustfmt --check tools/check_msvc_inputs.rs.
  • cargo test --locked --no-default-features --features llvm-target-aarch64 --jobs 2 --test codegen_regressions msvc_native_fixtures_compile_and_arm64_hfas_match_clang.
  • Six Python native-gate/package tests, PowerShell real COFF/import-archive checks, workflow parsing, and git diff --check.
  • Inspection of actual Windows SDK 10.0.26100, VC CRT, and LLVM 21.1.8 compiler-rt archives for both target machines.
  • x64 MSVC cross builds executed under Wine at O0/O2 with dynamic/static CRT, including negative-link scenarios.
  • ARM64 MSVC cross-link scenarios and separate AAPCS64 ABI execution under QEMU at O0/O2.

Native Windows x64 and ARM64 execution is still required in this PR's CI before merging. Wine execution, QEMU AAPCS64 execution, and ARM64 PE cross-linking are supporting checks, not native Windows evidence. The required CI gate runs 25 scenarios per architecture covering startup, arithmetic helpers, bidirectional ABI calls, custom entry, and negative linking. It retains source snapshots, IR, objects, executables, tool versions, commands, output, and exit status.

Checklist

  • Commits include a DCO Signed-off-by line.
  • Tests cover new behavior or the PR explains why no test is needed.
  • User-facing changes include documentation or diagnostics updates.
  • The change preserves the license boundary between the compiler and std/.

Resolve target-matched LLVM 21 builtins alongside the selected MSVC CRT and add hosted startup, wide arithmetic, and negative-link fixtures. Preserve explicit no-default-library linking.

Refs wavefnd#617.

Signed-off-by: LunaStev <[email protected]>
Add independent C and Wave checks with native machine validation, both optimization and CRT modes, and retained execution evidence. Share the driver and fixtures between x64 and ARM64 Windows.

Refs wavefnd#615, wavefnd#616, wavefnd#617.

Signed-off-by: LunaStev <[email protected]>
Classify homogeneous floating aggregates before the indirect-size rule and use ordinary composite transport for named aggregates in Windows variadic functions. Verify both MSVC targets against Clang IR and feature-isolated compilation.

Refs wavefnd#616.

Signed-off-by: LunaStev <[email protected]>
@LunaStev LunaStev added bug A problem that causes incorrect behavior or crashes. needs testing Issues that require additional testing or verification. migration Issues related to migrating from older systems or versions. ci GitHub CI or CI labels Sep 16, 2026
@LunaStev
LunaStev merged commit 6a66f0b into wavefnd:master Sep 16, 2026
22 of 27 checks passed
@LunaStev LunaStev mentioned this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A problem that causes incorrect behavior or crashes. ci GitHub CI or CI migration Issues related to migrating from older systems or versions. needs testing Issues that require additional testing or verification.

Projects

None yet

1 participant