Skip to content

Adopt mimalloc-pprof in the Wild fork; stage a minimal LLVM COFF library #92

Closed

Description

@zackees

Goal

Replace the Linux Wild-fork executable's default system allocator with the requested zackees/mimalloc-pprof allocator, then use the resulting profiling evidence to stage the Windows PE/COFF LLD work selected in #91.

The allocator is an implementation-only performance change: it must not change link artifacts or observable linker behavior.

Phase 1 — reld / Wild allocator

  1. Vendor a pinned zackees/mimalloc-pprof revision under _vendor/, bypassing crates.io. Do not add a crates.io dependency.
  2. Make the default reld/Wild executable allocator use its Rust MiMalloc integration on Linux. Retain a build switch for the unprofiled allocator engine (MI_PPROF=OFF) and a separately named profiling build/configuration; do not make the known profiler-enabled fast-path overhead the release default without a benchmark win.
  3. Start by validating that the allocator works unchanged: soldr cargo build/test, native Linux acceptance, and the existing benchmark corpus.
  4. Establish the measurement matrix: current system allocator vs vendored mimalloc-pprof with MI_PPROF=OFF vs profiling-enabled sampling. Capture wall time, CPU time, peak RSS, allocation profile, and enough repetitions to report variation.
  5. Per DESIGN.md §3.1, run each deterministic fixture twice, then require byte identity against the pinned pre-change reld/Wild baseline for every performance-only configuration. Also require native execution with exact observable output.

Phase 2 — isolated Windows LLD fork

Create zackees/llvm-ld as a minimal C/C++ library-only extraction/fork of LLVM LLD's COFF driver for both MSVC and MinGW personas. This repository owns the pinned LLVM revision, the C/C++ build, allocator replacement, and manual import of selected upstream LLVM/LLD changes. It should not own the Rust API.

Its first milestone is deliberately small:

  1. Expose the COFF linker through a narrow C ABI around LLD's library entry point; do not shell out to an executable.
  2. Build it with the same pinned vendored mimalloc-pprof implementation, first with MI_PPROF=OFF, then verify sampled profiling works as-is.
  3. Prove link correctness against the pinned unmodified LLD baseline: same effective args, input files, executable path/cwd, deterministic switches, byte-identical EXE and PDB; then native Windows execution with exact stdout/stderr/exit status.
  4. Benchmark MSVC and GNU/MinGW separately, debug/PDB and non-debug, non-LTO and LTO. Report allocator effects before changing linker algorithms.

Phase 3 — Rust ownership in reld

Keep zackees/llvm-ld C/C++-only. Add the Rust wrapper inside reld, vendoring the pinned llvm-ld source below _vendor/ as a git-backed source import/submodule (not crates.io). The Rust wrapper owns the safe API and reld routing; the C/C++ repository stays a minimal upstream-syncable LLD isolation.

The integration must preserve the Windows guide's current bridge oracle until a new engine is accepted: direct pinned lld-link and reld must be run with the same inputs/environment/determinism switches, with byte comparison of EXE and PDB plus native MSVC and MinGW acceptance.

Existing prior art and decision

mun-lang/lld-rs (lld_rs) is relevant prior art, but it targets LLVM 14, links all LLD drivers, and its docs.rs build currently fails. It is not an appropriate fork base for a current minimal COFF-only library. Use the current LLVM LLD COFF library API as the base and maintain a small C ABI shim instead. LLD itself has COFF-as-a-library coverage.

Guardrails

  • The dependency approval in this issue is specifically for vendoring zackees/mimalloc-pprof; record the exact revision, license, and update procedure. No other dependency is approved by implication.
  • No performance claim without the artifact-equivalence evidence above.
  • Pin the LLVM revision, Rust toolchain, MSVC/MinGW toolchains, workload inputs, and all allocator configuration.
  • Update agents/platforms/linux.md and agents/platforms/windows.md when their validation/build workflow changes.
  • Do not start linker optimizations before the allocator baseline and profiles are attached here and summarized on Research: Windows PE/COFF fast-linking strategy - optimize LLD-COFF fork vs retrofit COFF into Wild #91.

Completion criteria

  • Linux reld/Wild has a reproducible, vendored mimalloc-pprof integration and an evidence-backed keep/revert decision.
  • zackees/llvm-ld builds a COFF library with the allocator replacement and passes its baseline comparison suite for both Windows personas.
  • reld's in-tree Rust wrapper loads the vendored library and demonstrates an artifact-identical, native-executed Windows link.

Activity

  1. zackees commented on Sep 17, 2026

    @zackees
    CollaboratorAuthor

    Closing as superseded by #97, which states this in its own text: the _vendor/mimalloc-pprof direction here conflicts with the approved registry direction, and #97 replaces both this issue and #94's vendoring approach. The Windows COFF strategy selected in #91 is sequenced there and in the zackees/llvm-ld repository. Long-horizon tracking now lives in #154; near-term burn-down in #153 (Wave 0).

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