Skip to content

docs: phased implementation plan for GPT-5.6 handoff - #3

Merged
zackees merged 7 commits into
mainfrom
docs/implementation-plan
Aug 2, 2026
Merged

zackees merged 7 commits into
mainfrom
docs/implementation-plan

Conversation

@zackees

@zackees zackees commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Adds docs/plan/ — a 10-document execution-ready plan covering the batch linker (P0–P5) and incremental linking (I0–I7), written for an implementing agent that follows instructions precisely but does not plan.

Grounded in file-level analysis of wild, mold and radlink, plus a survey of incremental-linking prior art (Zig, MSVC /INCREMENTAL, gold, HP-UX +ild, Sun ild, Live++).

Locked decisions

  • Fork wild, don't reimplement — Linux/ELF arrives working; all new effort goes to PE/COFF and Mach-O.
  • windows-gnu before windows-msvc — DWARF defers the PDB problem, which is ~20k lines in radlink.
  • Generalize wild's ELF relocation vocabulary, don't fork it — forking it is the mistake that cost LLD 36,441 lines in 2021.
  • Adopt radlink's synthetic-object architecture for imports/exports.
  • Semantic differential testing, not byte comparison — reproducible output is an explicit non-goal.

Two contradictions in DESIGN.md surfaced for resolution

  1. Peak RSS vs. the daemon. §2.3 lists peak RSS as a win category, but millisecond warm relinks require a resident process holding the symbol graph and relocation reverse-index in memory. These may not be simultaneously satisfiable.
  2. Archive semantics. wild's incremental design explicitly excludes them on the grounds that Rust doesn't use them. A C/C++ linker on three platforms cannot make that move — and archive semantics are precisely mold's core objection to incremental linking.

Notable findings

  • wild's Mach-O backend is a skeleton with 40 todo!()s, arm64-only, feature-gated off. We do not inherit a working Mach-O.
  • The daemon is a precondition, not an optimization. HP-UX data shows a file-persisted incremental linker has a fixed cost proportional to binary size, not change size — changing 15× more objects cost only 48% more time. gold's null relink on Chrome was ~30s.
  • The sorted-table problem (.eh_frame_hdr / .pdata / __unwind_info) is what killed gold's C++ support, and it is identical on all three target formats.
  • wild was named for incremental linking, published a design in Nov 2024, and still has not implemented it as of 0.9.0 — because the base linker consumed the time. That is the failure mode most likely to happen to us.

🤖 Generated with Claude Code

Adds docs/plan/ — a 10-document, execution-ready plan covering the batch
linker (phases P0-P5) and incremental linking (I0-I7), written for an
implementing agent that follows instructions precisely rather than planning.

Grounded in analysis of wild, mold, and radlink (shallow-cloned to
.extern-repos/, now gitignored) plus a survey of incremental-linking prior
art (Zig, MSVC /INCREMENTAL, gold, HP-UX, Sun ild, Live++).

Key locked decisions: fork wild rather than reimplement; windows-gnu before
windows-msvc to defer PDB; generalize wild's ELF relocation vocabulary rather
than fork it; adopt radlink's synthetic-object architecture for imports;
semantic differential testing rather than byte comparison.

Two contradictions in DESIGN.md are surfaced for resolution: peak-RSS as a
win category conflicts with the resident daemon that millisecond warm relinks
require, and archive semantics — which wild's incremental design excludes by
targeting Rust — are unavoidable for a C/C++ linker.

Co-Authored-By: Claude <[email protected]>
zackees and others added 6 commits August 1, 2026 16:23
LTO was listed as a project non-goal in DESIGN.md and README.md. It is
actually a stretch goal, deliberately sequenced after the fast linker on all
three platforms — the inner loop is the priority and LTO touches nearly every
subsystem.

Adds DESIGN.md §3.1 and a README stretch-goals section, and records the
sequencing as D13 with its consequences: do not delete wild's inherited
linker-plugin LTO; reject LTO flags with a specific diagnostic rather than a
silent mislink until implemented; /GL objects must hard-error since they
contain IL rather than machine code.

Co-Authored-By: Claude <[email protected]>
Six reviewers attacked the plan: internal consistency, wild-fork feasibility
(source-verified), PE/COFF + MinGW (measured on the local MSYS2 toolchain),
Mach-O, incremental soundness, and the test oracle.

The plan does not survive unamended. D10 (reject auto-import) is refuted by
measurement — plain g++ hello-world requires runtime pseudo-relocs. The
"-m i386pep selects COFF" acceptance criterion is architecturally impossible
in wild's arg design. And the plan is unaware of wild's fourth backend, Wasm,
which it would inherit at ~6,650 LOC.

Co-Authored-By: Claude <[email protected]>
The most consequential finding of the whole review: I2, scheduled as "the
first shippable win," targets ~5% of link time. Published phase data for lld
on clang RelWithDebInfo puts input parsing at 5.04% and string merging at
66.54%, corroborated independently by wild's own benchmark page. A daemon
caching parsed inputs skips the 5% and repeats the 66%.

String merging is also a soundness hole: the I1 resolution fingerprint is
structurally blind to SHF_MERGE offset shifts.

Test oracle: linker-diff's non-ELF failure mode is silently green, its
coverage is ~50-70% of relocations even on ELF, and the 18-directive freeze
is mutually exclusive with adopting wild's 213 fixtures.

Mach-O: __unwind_info must be linker-constructed and appears nowhere in
Phase 4; MH_PIE/hard __PAGEZERO/MH_DYLDLINK/LC_MAIN are kernel- or
dyld-enforced and unlisted.

Co-Authored-By: Claude <[email protected]>
…arlier

D3 revised: windows-msvc before windows-gnu. The original ordering priced
only the debug-info axis and priced MinGW compatibility at zero. radlink is an
in-tree MSVC-target reference; MinGW's auto-import, default-script emulation,
.rsrc and .CRT$X* requirements are all where it gives zero help.

D10 revised: auto-import and runtime pseudo-relocs are REQUIRED, not
rejectable. Refuted by measurement on the local MSYS2 toolchain.

D14 added: delete wild's Wasm backend (~6,650 LOC, 2 CI jobs) in P0.

D15 added: the first incremental phase moves ahead of P4/P5, on ELF alone.
Its content is flagged as an open item pending measurement — see R25.

Co-Authored-By: Claude <[email protected]>
Applies the decisions taken after adversarial review:

- D3 revised: windows-msvc leads and carries the COFF core; MinGW becomes an
  additive phase. Docs 05 and 07 swapped and re-split accordingly.
- D14: delete wild's Wasm backend in P0 (~6,650 LOC, 2 CI jobs) — the plan was
  unaware it existed, so every "add an arm" count was off by one.
- D15: the incremental workstream moves ahead of P4/P5, on ELF alone.
- D16: IX-T0 gates it — measure the per-phase split before designing a daemon.
  Caching parsed inputs targets ~5% of link time; string merging is ~66%.
- D17: oracle coverage floor plus one malfunction site per format, because
  linker-diff's non-ELF failure mode is silently green.

Also adds the tasks review found missing: P0-T0 Linux dev container (all
P0-P2 acceptance is unrunnable on the Windows dev host), P0-T7 multi-call
driver binaries, P0-T8 workflow reconciliation, P4-T2b kernel/dyld invariants,
P4-T5b __unwind_info construction, P4-T5c static initializers, P4-T8b rustc
flags, coff_writer.rs, and the COFF linker-diff instantiation.

Co-Authored-By: Claude <[email protected]>
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.

1 participant