← board

Cross self-host: AArch64 generated compiler runs under QEMU

Goal

Make the AArch64 compiler binary emitted by native pascal26 work as a compiler under QEMU. Keep this platform-specific until the failure is understood.

Current failure

Repro from repo root:

./compiler/pascal26 -dPXX_MANAGED_STRING --target=aarch64 \
  compiler/compiler.pas /tmp/compiler_aarch64
tools/run_target.sh aarch64 /tmp/compiler_aarch64 -dPXX_MANAGED_STRING \
  --target=x86_64 test/hello.pas /tmp/hello_aarch64_to_x64

Observed 2026-06-14: the native-built AArch64 compiler is produced, and the AArch64-hosted self compile no longer segfaults in FindProcOverload. It now fails deterministically while compiling the built-in heap unit:

ok: /tmp/ca64  [code=2542476B  data=43368B  bss=133171336B  procs=801]
pascal26:82: error: invalid IR node reference in arg value ()

The previous crash was PC 0x48bda8, fault address 0x48, instruction ldrb w0, [x0], mapped to FindProcOverload. That was caused by AArch64 IR_LEA loading a non-byref open-array/fixed-string/set parameter slot with the element width (array of Boolean loaded one byte, yielding pointer 0x48). The current wall is past that crash and is an IR validation failure from an IR_ARG with an empty value while compiling compiler/builtin/ builtinheap.pas around the HeapMmap raw-syscall block.

Acceptance

Log