Repository navigation
Description
First implementation slice of the polylinker router (B8 in #17; design in #30, now merged as agents/docs/polylinker.md / DESIGN §4.5 / D13). Follows the docs landing in #33.
Scope — the Windows-verifiable router foundation
Turn the bridge's fixed platform→engine mapping into an explicit, overridable engine selection with a capability seed and observable routing. This is the scaffold B8's flag-aware routing (LTO etc.) will extend; that flag/LTO routing (Linux native→lld) is intentionally a later slice, not this issue.
Concretely, in crates/reld-core/src/bridge.rs:
- Engine registry (capability seed). A small
Enginenotion — a name plus the object format(s) it can link. The two bridge engines today:lld-link(COFF) andld64.lld(Mach-O). Keep native ELF out of scope (it's not a bridge engine). - Explicit override.
select_engine(target, override: Option<&str>) -> Result<Engine>:- override name comes from
RELD_ENGINEenv, or a reld-specific--engine=<name>argv token (consumed/stripped before pass-through, exactly like the existing-flavorstripping). - a known engine that supports the target's format → use it; unknown name → clear error listing valid engines; known but wrong format (e.g.
--engine=ld64.lldon a COFF link) → clear error. - no override → the target's default engine (today's behavior, unchanged).
- override name comes from
- Observable routing. Extend the existing
reld: engine=<name> (bridge) -> <path>note to include the reason:reason: defaultvsreason: override(RELD_ENGINE)/override(--engine). (This is the design's "routing decisions are observable" requirement, peragents/docs/polylinker.md.)
The selected engine (not the raw BridgeTarget) drives linker_basename + the rust-lld flavor. For the default path this is identical to today.
Out of scope (later slices)
Flag/LTO-based routing (-flto//GL/-Clto → lld, esp. on Linux where the native engine exists); the full capability table (GC-sections/ICF/PDB/etc.); routing on the ELF/native path; the daemon router (#19). This issue is override + registry + observability only, on the bridge path.
Verification
- Windows (local): rusqlite
ci/e2e/sqlite-bridgelinks with the default engine (unchanged) AND withRELD_ENGINE=lld-link(explicit) — both produce a running binary.RELD_ENGINE=bogus/ a format-mismatched override → clear error. - Unit tests:
select_enginedefault / valid-override / unknown-name / format-mismatch; the--engine=argv stripping (like the-flavortests). - COFF and Mach-O bridge behavior otherwise unchanged; ELF untouched.
Done when
RELD_ENGINE/--engine= selects the bridge engine (validated against a capability seed) with the routing reason logged; default behavior unchanged; unit tests + the Windows rusqlite e2e pass; PR merged, issue closed, branch rebased on origin/main.
Activity