Repository navigation
feat(bridge): macOS Mach-O bridge via ld64.lld (BR-3) - #31
Merged
Merged
Conversation
…ld (BR-3) Extend the COFF-only bridge (BR-1) to be format-aware: a BridgeTarget selects the concrete driver (lld-link for COFF, ld64.lld for Mach-O) and the rust-lld flavor (link vs darwin). reld now routes Mach-O links (macOS host, ld64.reld, or -flavor darwin) through the same discovery + raw-argv pass-through as COFF, delegating to ld64.lld. Exit-code propagation and the -flavor de-duplication are unchanged; the COFF path is behaviorally identical. Add a macos-arm64 CI e2e that builds ci/e2e/sqlite-bridge with reld as the linker (via -Clinker-flavor=ld64.lld so rustc emits ld64-native argv) and runs it, asserting OK + linked SQLite — the real Mach-O proof on the runner's ld64.lld. Native Mach-O codegen (#8) remains separate; this makes macOS work now. Closes #29 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-3 (#17), adapted to the bridge strategy. Closes #29. Follows BR-1 (#20, the Windows COFF bridge this generalizes).
What
Makes
reldlink Mach-O on macOS by delegating told64.lld— generalizing the COFF-only bridge to be format-aware. This completes the "runs everywhere" promise: Linux native + Windows bridge + macOS bridge.BridgeTarget { Coff, MachO }parameterizes the bridge: concrete driver (lld-link/ld64.lld) and rust-lld flavor (link/darwin).discover_linker,find_concrete_linker,not_found_message, and the-flavorprepend all key off the target.RELD_BRIDGE_LINKERoverride + raw-argv pass-through + exit-code propagation are unchanged.is_macho()/bridge_target()onArgs;main.rsroutesSome(target)torun_bridge(argv, target)before parsing. So a macOS host,ld64.reld, or-flavor darwinall reach the Mach-O bridge; ELF is untouched. The COFF path is behaviorally identical (verified).macos-arm64leg: buildsci/e2e/sqlite-bridgewith reld as the linker via-Clinker-flavor=ld64.lld(so rustc emits ld64-native argv that reld forwards told64.lld), runs it, assertsOK+linked SQLite.ld64.lldhandles ad-hoc signing itself, so D6 is deferred, not solved.Testing
linkand Mach-Odarwinflavor paths (prefix only forrust-lld, exactly one-flavorpair, concrete drivers get no prefix); YAML valid; the Windows COFF rusqlite e2e still returnsOK(COFF non-regression).-Clinker-flavor=ld64.lldconfirmed a valid rustc 1.94 flavor against the compiler's own accepted list.ld64.lld(rust-lld / brew llvm@18).Review
Independent review: APPROVE-WITH-NITS — confirmed the COFF path is behaviorally unchanged, no COFF assumptions leak into the Mach-O path, and the macOS e2e can't false-green (
set -euo pipefail, failing command-substitution under-e, twogrepgates, fixture returns nonzero on error). Its one actionable nit (leftover hedging in the flavor comment) is resolved here now that the spelling is confirmed valid.The one thing static analysis can't settle — that
-Clinker-flavor=ld64.lldon rustc 1.94 emits exactly the ld64 argvld64.lldexpects — is what the macos-arm64 CI leg exists to confirm.🤖 Generated with Claude Code