s09 — Walking-Skeleton Fan-out: All Five Targets (MILESTONE GATE)
Goal
THE milestone gate: the trivial-program corpus compiles, links, and RUNS on all five targets — x86-64 (host), aarch64, riscv64, s390x (qemu-user in CI), and WASM (wasmtime). Stubs do not count; only linking, running binaries prove the ABI per target. This gate BLOCKS every downstream section.
Implementation Sketch
Each target replays the s08 pathfinder shape through its ArchConfig instance:
- aarch64: AAPCS64 (args x0-x7, ret x0; v0-v7 floats), fixed-width encoder (no REX games), adr/adrp+add literal addressing, bl relocations (R_AARCH64_CALL26); c_char is u8 — the declaration-table discipline from s07 is exercised for real here.
- riscv64: LP64D ABI (a0-a7, fa0-fa7), RV64GC encoding, auipc+jalr calls (R_RISCV_CALL_PLT), li expansion.
- s390x: ELF ABI (r2-r6 args, r2 ret, r15 stack, 160-byte register save area), BIG-ENDIAN — every literal/encoding path is byte-order audited; brasl calls (R_390_PLT32DBL).
- wasm: virtual-register arch per the locked design — MIR uses virtual regs; the final emitter assigns locals and collapses OnWasmStack values; emits a COMPLETE wasm module (type/function/memory/export/code sections; __ori_alloc/__ori_free linkage deferred to s14 — bootstrap runtime calls resolve via a wasm build of the runtime OR host-import shims, per the s03 object/link decision); runs under wasmtime.
- CI matrix: qemu-user (qemu-aarch64/-riscv64/-s390x with QEMU_LD_PREFIX sysroots + cross gcc for linking) + wasmtime; native x86-64. CI workflow file added to compiler_repo (public-repo hygiene: no wrapper references).
- MILESTONE GATE close: all five smoke matrices green in CI; gate recorded; the test-all.sh run_ori_native slot (s04) flips from auto-skip to active for the host target.
Test Strategy
- Per-target matrix: the s08 program-shape x type matrix replayed; stdout/exit-code interpreter-parity per cell, per target.
- Semantic pins: one disassembly/encoding pin per ISA (frame + call sequence); s390x adds a big-endian data pin (multi-byte literal round-trip).
- Negative pin per target: wrong-ABI fixture (e.g. misaligned stack at call) caught by the per-target ABI assertion tests, not by crash archaeology.
Work Items
- aarch64 ArchConfig + encoder + ABI: pathfinder matrix green under qemu-aarch64.
- riscv64 ArchConfig + encoder + ABI: matrix green under qemu-riscv64.
- s390x ArchConfig + encoder + ABI with big-endian audit + endian pin: matrix green under qemu-s390x.
- wasm emitter: complete-module writer + OnWasmStack collapse + runtime-call resolution per s03 decision: matrix green under wasmtime.
- CI matrix workflow (qemu-user x3 + wasmtime + host) green; MILESTONE GATE recorded; run_ori_native activated for host in test-all.sh.