Spec M34 — examples/minimal: the smallest executable and what it costs (owner, 2026-09-03)
Program: i64 main() { return 0; }. The point is the number, measured reproducibly, per target.
Measured baseline (macOS 26.6 arm64, 2026-09-03) #
| metric | --exe | .o + ld |
|---|---|---|
| file size | 16 692 B | 16 840 B |
__text | 28 B | 28 B |
| layout | one 16 KiB __TEXT page (header + load commands + code) + 308 B __LINKEDIT (symtab, ad-hoc signature) | same shape |
max RSS (/usr/bin/time -l, 5 runs) | 1 327 104 B | — |
physical footprint at exit (vmmap) | ~1.0 MB | — |
| the process's own mappings | 32 KiB (2 pages) | — |
Everything above 32 KiB is dyld + libSystem from the shared cache; the floor on macOS is the page size plus the signature, and static executables are killed by the kernel (M0.5).
Deliverables #
examples/minimal/{main.mc, mc.toml, measure.sh, README.md}:measure.shbuilds every reachable variant and prints one table: macOS--exe, macOS.o+ld, Linux arm64 musl static (ld.lld, run in Docker), Linux arm64-nostdlibwith<sys_linux>_start(the true floor: expect ~1 KB and tens of KB RSS), later Windows and wasm; columns: file size, code bytes, segments/sections, max RSS, peak footprint, own mappings, startup time (hyperfinewhen installed, else a 100-run loop). Deterministic output (byte-identical across runs except timings, printed separately).docs/guide/80-footprint.md: the table with explanations of each floor (page size, signature, dyld, libc, WASI).make check-minimal: asserts the macOS--exesize and the Linux sizes stay under fixed ceilings (regression guard for the backends), skipping targets whose tools are absent.
- Compile time per variant (
mc1 --exe,.o+ link, Linux compile +ld.lld) with the compiler's own max RSS for that compilation, measured withhyperfinewhen installed (else a 100-run loop), reported as mean and min in the timings table (owner, 2026-09-03).
Acceptance #
sh examples/minimal/measure.sh prints the table; the ceilings hold in make check; the guide page
renders on the site.