Repository navigation
feat(bridge): delegate Windows COFF links to lld-link (BR-1) - #20
Merged
Merged
Conversation
On a Windows/MSVC host `reld`/`reld-link` previously bailed for COFF. Add a bridge module that discovers a COFF-capable linker (RELD_BRIDGE_LINKER override, then rust-lld / gcc-ld lld-link from the active toolchain, then lld-link on PATH) and forwards the raw argv to it, bypassing the ELF parser that cannot read MSVC-style link arguments. Intercept in main.rs before parse. Raw-argv pass-through strips a leading `-flavor <name>` selector (already consumed by reld's own dispatch) so it is never doubled against the `-flavor link` prepended for rust-lld. Child exit code is propagated verbatim, so a failing link can never be reported as success. This lights up the Windows target for CI and the benchmark ahead of the native COFF backend (#7), per the bridge strategy in #17. Closes #18 Co-Authored-By: Claude Fable 5 <[email protected]>
The `needs_flavor_prefix`/`child_command_line` tests used Windows-style backslash path literals (`C:\...\rust-lld.exe`). Off Windows, `\` is not a path separator, so `file_stem()` returned the whole string and the rust-lld detection asserted false — failing on the Linux and macOS CI runners while passing locally on Windows. Switch to forward-slash paths (identical `file_stem()` on every host) and keep the backslash cases under cfg(windows). Production code is Windows-only and unaffected. Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements BR-1 of the bridge strategy (#17). Closes #18.
What
On a Windows/MSVC host,
reld/reld-linkpreviously bailed for COFF. This adds areld_core::bridgemodule that makesreldlink on Windows by delegating COFF links tolld-link(therust-lldshipped with every Rust toolchain), via raw-argv pass-through.RELD_BRIDGE_LINKERoverride →rust-lldin the active toolchain →gcc-ld/lld-linkthere / on PATH → clear error). Never falls back to closed-source MSVClink.exe.main.rsbeforeargs.parse()— theArgs::Coffvariant reuses the ELF parser, which cannot read MSVC/OUT:-style args, so the bridge bypasses parsing and forwards the original argv.-flavorcorrectness:forwarded_argsstrips a leading-flavor <name>pair (already consumed by reld's dispatch) so it's never doubled against the-flavor linkprepended forrust-lld.ELF and Mach-O paths are unchanged; the
lib.rsCOFFbail!remains as a defensive backstop.Testing
bridge.rs(discovery, env override,-flavorstripping for name/flavor routes × rust-lld/lld-link, not-found message). Hermetic — no global env mutation, no real linker spawned.soldr cargo fmt/clippy --all-targetsclean;test -p reld-coregreen (pre-existing taplo-missing tidy test excluded).rusqlite(bundled→ compiles+links the SQLite C amalgamation), built with-Clinker=reld-link, produces a binary that runs and printslinked SQLite 3.46.0 / OK, exit 0.Review
Independent review found and I fixed a
-flavordouble-prefix bug on the-flavor linkinvocation route; re-review verdict: APPROVE.🤖 Generated with Claude Code