#253
fix(zero-c): fail closed for unsupported aarch64 ELF IR
Summary
Addresses #145.
This PR updates the AArch64 ELF backend so unsupported IR fails closed with a CGEN004 diagnostic instead of allowing successful emission of a misleading executable.
The change is intentionally limited to validation and diagnostic behavior. It does not add new AArch64 code generation support.
What changed
- Added AArch64 ELF validation for every IR function before successful object or executable emission.
- Preserved the existing emitted-function behavior: non-exported functions are validated but not newly emitted.
- Preserved the currently supported small literal-return subset.
- Aligned unsupported-lowering diagnostic wording with existing native backend terminology.
- Kept the existing CGEN004 diagnostic path.
- Avoided adding
world.out.writelowering, Linux write syscall lowering, general call lowering, or broader backend support.
Validation
- Rebuilt the native compiler with
make -C native/zero-c. - Confirmed
bash bin/zero --versionsucceeds. - Confirmed
zero new cli hellosucceeds. - Confirmed
zero check .succeeds. - Confirmed
zero test .succeeds. - Confirmed
zero build .fails with CGEN004 for unsupported AArch64 ELF lowering. - Confirmed
zero run .fails with the same diagnostic. - Confirmed the previous silent no-output executable behavior no longer reproduces.
- Confirmed the committed scope is limited to
native/zero-c/src/emit_elf_aarch64.c.
Scope
This PR does not change:
- IR generation
- checker behavior
- CLI behavior
- x64 ELF backend behavior
- Mach-O backend behavior
- COFF backend behavior
- WASM/WASI behavior
- documentation
- package files
- lockfiles
- build scripts
Notes
This is the fail-closed compiler behavior fix. It does not make unsupported AArch64 programs run successfully. Follow-up work can add actual AArch64 lowering for specific constructs in separate PRs.
@VelariumAI is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.