Skip to content

B8a: polylinker router foundation — engine registry + RELD_ENGINE/--engine override + routing log #34

Closed

Description

@zackees

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 Engine notion — a name plus the object format(s) it can link. The two bridge engines today: lld-link (COFF) and ld64.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_ENGINE env, or a reld-specific --engine=<name> argv token (consumed/stripped before pass-through, exactly like the existing -flavor stripping).
    • 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.lld on a COFF link) → clear error.
    • no override → the target's default engine (today's behavior, unchanged).
  • Observable routing. Extend the existing reld: engine=<name> (bridge) -> <path> note to include the reason: reason: default vs reason: override(RELD_ENGINE) / override(--engine). (This is the design's "routing decisions are observable" requirement, per agents/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-bridge links with the default engine (unchanged) AND with RELD_ENGINE=lld-link (explicit) — both produce a running binary. RELD_ENGINE=bogus / a format-mismatched override → clear error.
  • Unit tests: select_engine default / valid-override / unknown-name / format-mismatch; the --engine= argv stripping (like the -flavor tests).
  • 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

  1. added
    enhancement
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions