Skip to content

Move the wild engine into a zackees/wild fork and consume it as a git submodule #203

Open

Description

@zackees

Why

reld is a polylinker. It routes each link to an engine: native wild for ELF (and Mach-O where it applies), or bridged lld engines (lld-link, ld64.lld, lld-mingw), with lld-link now running in-process through llvm-ld-coff (#202). Today the wild engine is vendored and renamed into crates/reld-core (plus reld-diff, reld-layout-schema, reld-reloc, reld-trace) from upstream 5793935f (wild v0.9.0, 2026-08-01). Our polylinker code is mixed into those same files.

Upstream wild is now under very active development. wild-linker/wild main is 189 commits ahead of our fork point, and v0.10.0 shipped 3 days after we vendored. It includes ELF correctness fixes (canonical PLT function identity, dynsym relaxed size, --wrap under plugin LTO, -ffat-lto-objects, library search order, …), linker-script features (PHDRS/FILEHDR, ASSERT, ALIGN(expr), compound assignment), LDEMULATION, -z force-ibt/-z cet-report, AArch64 ADRP+ADD relaxation, 12 perf changes, 24 Mach-O ports, __start_/__stop_ refs resolved before GC (#2479, groundwork for our -z start-stop-gc gap), MSVC-style COFF arg parsing (#2374), and an LLD ELF test suite wired in for x86_64 and aarch64.

With the renamed, vendored copy, taking any of that in means a hand-merged diff: about 20k changed lines on our side against 53 changed files upstream, mostly the same hot files (elf_writer.rs, elf.rs, layout.rs, args/elf.rs, fs.rs). The fix is structural:

  1. zackees/wild: a GitHub fork of wild-linker/wild carrying reld's engine changes as a rebaseable patch series under upstream names.
  2. reld consumes the fork as a git submodule compiled in through Cargo path dependencies, and keeps only the polylinker layer in its own crates.

Where each change goes

Measured against 5793935f:

reld today Destination
Changes to upstream libwild files: elf_writer.rs (~1190 changed lines), args/elf.rs (650), layout.rs (541), fs.rs (469), args.rs (459, but see seam), input_data.rs (407), output_section_part_map.rs (270), symbol_db.rs (264), elf.rs (225), linker_plugins.rs, subprocess.rs, file_writer.rs, arch files, … fork, patch series
diagnostic.rs (lld-format undefined-symbol errors, color), args/response_file.rs fork (called from layout.rs, error.rs, args/elf.rs, so this is engine behaviour)
platforms/ host boundary plus the ban_platform_cfg_outside_boundary Dylint decision D3
bridge.rs (3.5k), target_probe.rs (1.8k), flag_table.rs, llvm_ld.rs reld, new polylinker crate (working name reld-poly)
linker-diff/-layout/-utils/-trace changes (small: +583/−423, +60, +6, +8) fork
crates/reld binary, acceptance/bridge-route/color/nix-rpath tests, mold external runner, 18 reld-added test sources reld (test sources that exercise engine fixes move to the fork's wild/tests)
reld-testkit, benchmarks, CI, docs, roadmap reld
Removal of the Wasm backend don't carry it (D2)

Decisions (recommended defaults)

  • D1 · Upstream names inside the fork. Keep libwild, linker-*, wild and the WILD_* env vars in the fork. The reld-* crate names, ld.reld/reld-link/ld64.reld, and RELD_* env vars belong to reld's front end, which maps RELD_* onto the engine configuration. Renaming inside the fork would make every upstream commit conflict.
  • D2 · Keep upstream Wasm in the fork. Wasm alone is 39 of the 189 commits; deleting it would make each of those a conflict. reld simply never routes to it. Cost: wasm-encoder/wasmparser get compiled in, and the license job's allow-list must cover them.
  • D3 · The platforms/Dylint boundary. It rewrote cfgs across fs.rs, subprocess.rs, save_dir.rs, timing.rs, linker_plugins.rs and args*.rs, which is standing patch surface against upstream. Either carry it as one isolated fork commit, with the Dylint run over the submodule in reld CI, or confine the lint to reld's own crates. Recommend carrying it as a single commit, and offering it upstream.
  • D4 · The seam. Today Args::parse calls bridge::resolve_link_target, so the engine depends on the polylinker. Invert that: the fork exposes a small public entry point that takes an already-resolved target/emulation, lining up with upstream's new explicit ELF emulations (#2492/#2497) and args/coff.rs (#2374). reld-poly resolves the route first, then either calls libwild or runs the bridge. The seam is the one fork patch that upstream will never want, so keep it minimal.
  • D5 · Pins stay reachable. Rebasing the fork rewrites history, but reld's submodule pins must never dangle. Every rebase lands on a new branch, reld/<upstream-version-or-date>, and every SHA reld pins gets a tag (reld-pin-<n>). Nothing pinned is ever force-pushed away.
  • D6 · Upstream first. Generic fixes (engine bugs, flags, perf) are also submitted as PRs to wild-linker/wild, and each is dropped from the patch series once merged. The goal is a patch series limited to reld-only behaviour.

Phases

P0 · Create the fork

  • Fork wild-linker/wild → zackees/wild. Add branch reld/base = 5793935f.
  • Fork CI: keep upstream's workflows on reld branches, trimmed to the jobs that matter (ELF tests x86_64/aarch64, Mach-O, clippy/fmt).

P1 · Extract reld's changes as a patch series at the old base (behaviour-neutral)

P2 · Ingest into reld as a submodule, still at the old base

  • Add submodule vendor/wild → zackees/wild, pinned to a reld-pin-* tag on reld/v0.9.
  • New crate crates/reld-poly with bridge, target_probe, flag_table, llvm_ld (and the llvm-ld feature). crates/reld depends on libwild via path = "../../vendor/wild/libwild". Path deps into another workspace are supported; the fork's workspace = true keys resolve against its own root, and reld's Cargo.lock governs.
  • Delete crates/reld-core, reld-diff, reld-layout-schema, reld-reloc and reld-trace, or leave thin re-export shims for one release if anything external names them.
  • Fix up every consumer of those paths: tidy/clang-format tests, ci/*.py and its tests, cache keys (include the submodule SHA), .github/workflows/* checkouts (submodules: recursive, mind the existing mold and tests/bins submodules), Dylint target set (D3), cargo-deny/license allow-list (D2), release packaging, UPSTREAM.md/README.md/DESIGN.md/agents/.
  • Exit criterion: no behaviour change. Every reld check green exactly as on main today: Phase 1 (linux-gnu x86_64/aarch64, windows-msvc/gnu, macOS), self-host two generations, cross-ship, release dry run with the llvm-ld-coff smoke, mold/wild suites with unchanged skip lists, bench within noise. Byte-identical outputs on the self-host link against a pre-migration build.

P3 · Rebase onto upstream main (v0.10.0+)

  • Rebase reld/v0.9 → reld/<date> onto upstream main. Drop patches upstream superseded (compare --image-base vs #2513, fallocate/huge pages vs #2468/#2508, start/stop vs #2479, COFF args vs #2374) and record each drop in the tracking notes.
  • Toolchain: upstream MSRV is 1.97.1 (#2341), so reld's rust-toolchain.toml (1.95.0) and rust-version bump with this phase.
  • Bump the submodule. Re-run the P2 gate, plus enable upstream's LLD ELF test suite (#2399/#2459/#2439) in reld CI. Re-check mold skip lists: entries that now pass get removed, and new failures need a reason.
  • Re-evaluate -z start-stop-gc (Polylinker no-gaps gate: classify every flag, route by target not host, prove coverage before reld becomes soldr's default #123) on top of #2479.

P4 · Steady state

  • Documented sync procedure (UPSTREAM.md): cadence (e.g. per upstream release or monthly), rebase → tag → bump the submodule via a PR that must pass the full gate.
  • Scheduled CI job in reld that builds reld against the fork's latest reld/* branch rebased on upstream main, and files an issue on conflict or failure. This is an early warning, not a merge.
  • Replace ci/upstream-diff.sh with git -C vendor/wild log --oneline upstream/main..HEAD (the patch series is the delta).
  • Open upstream PRs for the generic patches (D6); track the patch count trending down.

Risks

  • Seam churn (D4): upstream is actively reshaping Args (emulations, COFF parsing), so the seam may need rework at each rebase. Keep it one small commit.
  • Submodule ergonomics: contributors need git submodule update --init --recursive. Release source tarballs from git archive exclude submodules, so the release workflow must package from a recursive checkout.
  • Double CI cost: the fork runs wild's suite and reld runs its gate. Acceptable, and it catches engine regressions before the pin moves.
  • Upstream test harness assumptions (paths such as wild/tests/sources, a test-config.toml): run them in the fork, not re-hosted inside reld.

Done when

reld builds the ELF/Mach-O engine from the vendor/wild submodule at a reld-pin-* tag of zackees/wild, and the vendored engine crates are gone from reld. The fork's reld branch is rebased on current upstream main. All reld CI is green. UPSTREAM.md documents the sync procedure.

Activity

  1. zackees commented on Sep 19, 2026

    @zackees
    CollaboratorAuthor

    P0 progress: zackees/wild now exists as a GitHub fork of wild-linker/wild. Its scheduled, release and image workflows are disabled; only CI stays enabled. Decision D3 (the platforms boundary) is being offered upstream first. The implementation is on zackees/wild:platforms-facade, and #204 tracks the 2026-10-03 check that decides whether we align or carry it as a patch.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions