Repository navigation
Description
Sub-task of #17 (phase BR-1). First executable slice of the bridge strategy.
Goal
Make reld link a real program on Windows / x86_64-pc-windows-msvc by delegating to lld-link (via the rust-lld that ships in every Rust toolchain). ELF/Linux path stays byte-for-byte unchanged.
Why raw-argv pass-through (not parsed args)
On a Windows-MSVC host, PlatformKind::host() → Coff, but Args::new reuses the ELF/GNU parser for Args::Coff (crates/reld-core/src/args.rs:142-145). rustc drives the msvc linker with link.exe syntax (/OUT:, /DEFAULTLIB:, /LIBPATH:…), which the ELF parser cannot parse. Therefore the bridge must forward the original argv verbatim to rust-lld -flavor link, bypassing reld's parser entirely. lld-link speaks MSVC syntax natively, so pass-through is correct (issue #17, decision B3).
Scope
- New
reld_core::bridgemodule:- Discovery (issue Bridge linkers: run + benchmark reld on Windows and macOS now by delegating to lld (rust-lld) per platform #17, B2 order):
RELD_BRIDGE_LINKERenv override →rust-lldnext to the active toolchain (rustc --print sysroot→lib/rustlib/<host>/bin/rust-lld) →gcc-ld/lld-linkin that same tree / onPATH→ hard error naming what to install. Never silently fall back to MSVClink.exe. - Exec: spawn the discovered linker with
-flavor link+ the pass-through argv tail; inherit stdio; propagate the child's exit code verbatim; emit one note-level linereld: engine=lld-link (bridge) <path>to stderr (B5).
- Discovery (issue Bridge linkers: run + benchmark reld on Windows and macOS now by delegating to lld (rust-lld) per platform #17, B2 order):
- Wiring: intercept in the run path when the platform is
Coff, operating on rawstd::env::args(), before the ELF parse runs.Args::Elf/Args::MachOpaths untouched. - Unit tests for discovery: env override wins; sysroot resolution; PATH fallback; missing-everything produces a clear error naming
RELD_BRIDGE_LINKERand rust-lld.
Out of scope (later BR phases)
macOS/ld64.lld bridge (BR-3), 3-platform benchmark + schema bump (BR-4), embedded payload/versioned cache (BR-5), flag-based LTO routing (BR-6), radlink alternative.
Done when
cargo buildof a 16-source-file, two-crate project (lib + bin) with 4 dependencies includingrusqlite(bundled→ compiles+links the SQLite C amalgamation) using-C linker=<reld-link>onx86_64-pc-windows-msvcproduces an.exethat runs and exits 0 (opens an in-memory SQLite DB, round-trips a row).- Existing Linux acceptance/CI stays green (ELF path unchanged).
- Bridge-discovery unit tests pass.
- PR merged, this issue closed, branch rebased on
origin/main.
Activity