Skip to content

feat(linker): make reld the default linker - #3263

Closed
zackees wants to merge 2 commits into
mainfrom
reld-default-linker
Closed

zackees wants to merge 2 commits into
mainfrom
reld-default-linker

Conversation

@zackees

@zackees zackees commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes reld soldr's default linker, per the polylinker direction (#3262). reld behaves correctly everywhere via its native ELF backend (Linux) and lld bridge (Windows/COFF, macOS/Mach-O); any residual linking bug is a reld fix.

Changes

  • fast now resolves to reld: clang --ld-path=reld on Linux (reld's native ELF backend needs the driver to inject CRT/PT_INTERP), direct reld elsewhere (its lld-link/ld64.lld bridge handles CRT). Removed the dead mold_on_path probe and folded resolve_for_target_with_probe into resolve_for_target.
  • reld is the default: from_env_and_config(None, None) returns Fast instead of Default, so soldr cargo injects reld when nothing is explicitly configured. SOLDR_LINKER=default / ld remain explicit opt-outs.
  • MSVC proc-macro strip extended to reld (soldr#1992): reld bridges to lld-link on MSVC, so it has the same proc-macro-DLL failure mode as rust-lld.
  • PEP 517 fallback-cache identity probes reld (--ld-path= detection) so the cache invalidates on reld upgrades.
  • Docs (docs/API.md, config schema) and tests updated.

Tests

  • 28 linker unit tests pass, including fast_resolves_to_reld_on_every_target, proc_macro_on_msvc_loses_the_injected_reld, and the updated nothing_falls_back_to_fast_reld.
  • Integration test cargo_front_door_default_linker_injects_reld asserts the front door injects reld by default (clang --ld-path=reld on Linux, direct reld elsewhere).
  • cargo clippy -p soldr-cli --all-targets -- -D warnings and cargo fmt --check clean.

Closes #3262.

🤖 Generated with Claude Code

zackees and others added 2 commits September 16, 2026 08:33
reld is now soldr's default linker, per the polylinker direction. `fast`
resolves to reld on every platform — `clang --ld-path=reld` on Linux (native
ELF backend needs the driver for CRT/PT_INTERP) and direct `reld` elsewhere
(lld-link/ld64.lld bridge) — and `from_env_and_config` falls back to `fast`
when neither SOLDR_LINKER nor the config `linker` field is set.
`SOLDR_LINKER=default` / `ld` remain explicit no-injection opt-outs.

Also:
- Remove the now-dead `mold_on_path` probe and fold
  `resolve_for_target_with_probe` into `resolve_for_target`.
- Strip `reld` (not just `rust-lld`) for MSVC proc-macro dylibs (soldr#1992),
  since reld bridges to lld-link on MSVC.
- Probe `reld` in `linker_candidate_identity` so the PEP 517 fallback cache
  invalidates on reld upgrades.

Closes #3262.

Co-Authored-By: Claude Code <[email protected]>
clang's `--ld-path=` rejects a bare linker name the same way `-fuse-ld=`
does ("invalid linker name"), so `--ld-path=reld` failed on every real
Linux link. Resolve `reld` to its absolute path on `PATH` before injecting
it; fall back to the bare name (a clear clang error, never a mislink) when
it is absent.

Also pin test fixtures to `SOLDR_LINKER=default` so real-build tests don't
depend on `reld` being installed; linker tests set it explicitly.

Co-Authored-By: Claude Code <[email protected]>
@zackees

zackees commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

Reverting this migration as premature: reld-as-default is unsafe until reld routes silently-ignored flags to a capable linker instead of dropping them (tracked in reld#121). Re-opening after that prerequisite lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make reld the default linker for soldr

1 participant