Skip to content

test(linux): self-host reld with reld, two generations (reld#6, P2-T2) - #163

Merged
zackees merged 1 commit into
mainfrom
feat/6-linux-selfhost
Sep 17, 2026
Merged

zackees merged 1 commit into
mainfrom
feat/6-linux-selfhost

Conversation

@zackees

@zackees zackees commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Advances #6 (Wave 2 of #153) by closing P2-T2. Does not close #6: P2-T1, P2-T3 (corpus pass rate) and P2-T5 remain.

The gap

ci.yml self-hosts on Windows MSVC and on macOS. Linux — the platform Phase 2 exists to prove — did not. The strongest single correctness signal was missing on the one target the phase is about.

What it does

Three generations:

  • gen0 built by the host toolchain's linker,
  • gen1 = same source, linked by gen0,
  • gen2 = same source, linked by gen1.

All three must run. Then gen1 and gen2 are compared byte for byte — not merely both executed. A linker that mis-resolves a symbol produces a binary that links cleanly and then behaves wrong; using its output as the linker is what catches that, and comparing the two generations is what catches output depending on anything but the input.

The single exemption is .comment, where the linker writes its own version string: a generation linked by a differently-built reld truthfully differs there. Per DESIGN.md §3.1 that is one named field with every other byte still compared, and a failure reports the offset of the first divergence rather than just "differs".

Finally the self-hosted reld links and runs a program, so "it exists" is not mistaken for "it works".

Measured on this host

gen1 vs gen2: 39 differing bytes, all inside .comment [6873672, 6873834)
differences outside .comment: []

The 39 bytes are the recorded linker identity (Linker: Reld 0.1.0 <sha>), which differs because gen0 here was built at an earlier commit than gen1. Everything else is identical.

Cost

Three release builds, so it is its own workflow (selfhost-linux.yml, PR + push to main + dispatch) rather than buried in a job doing something else. The comparison logic is unit tested in ci/tests/test_selfhost.py against hand-built ELF files — exempt-range hit, exempt-range miss with the offset reported, no exemption, size mismatch, missing section, non-ELF input — so an exemption that silently widens fails on a PR.

docs/plan/04-PHASE-2-LINUX.md P2-T2 now names the real command instead of a ci/selfhost.sh that never existed.

Verification

uv run --no-sync python -m pytest ci/tests -q — 281 passed (7 new). The bootstrap itself was run locally end to end: both generations build, run, and agree.

🤖 Generated with Claude Code

Windows and macOS already self-host in ci.yml. Linux, the platform Phase 2 is
about, did not — the strongest single correctness signal was missing on the one
target the phase exists to prove.

Generation 0 is built by the host toolchain's linker, generation 1 is the same
source linked by generation 0, generation 2 is the same source linked by
generation 1. A linker that mis-resolves a symbol produces a binary that links
cleanly and then behaves wrong; using its output as the linker is what catches
that.

The generations are compared byte for byte rather than merely both being run.
The single exemption is `.comment`, where the linker writes its own version
string, so a generation linked by a differently-built reld truthfully differs
there and nowhere else. Measured locally: generations 1 and 2 differ in exactly
39 bytes, all inside `.comment`, and in nothing else.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees merged commit 69c1c0f into main Sep 17, 2026
19 checks passed
@zackees
zackees deleted the feat/6-linux-selfhost branch September 17, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P2: Prove Linux — self-host, corpus pass rate, populate the benchmark column

1 participant