Skip to content

bench: ld64.lld always n/a on macOS — clang maps -fuse-ld=ld64.lld to nonexistent ld.ld64.lld #60

Closed

Description

@zackees

Summary

On macOS, reld-bench reports ld64.lld as n/a for every scenario — it never actually links — so the aarch64-apple-darwin benchmark has no lld column. The default system ld links fine; only the ld64.lld series is broken.

Evidence (from benchmark-stats branch, aarch64-apple-darwin/latest.json):

ld       small/medium/large  -> 0.052 / 0.054 / 0.0787
ld64.lld small/medium/large  -> None / None / None   # never links
reld     ...                  -> None                 # separate: no shim in that job

Root cause

reld-bench builds the macOS linker list as ["", "ld64.lld"] and passes each token verbatim to the compiler driver as -fuse-ld=<token> (see default_linkers() and link_once/probe_linker in crates/reld-testkit/src/bin/reld-bench.rs).

But clang maps -fuse-ld=NAME to a linker executable named ld.NAME (the GNU convention — -fuse-ld=gold → ld.gold, -fuse-ld=bfd → ld.bfd), with lld the one special-cased name. So -fuse-ld=ld64.lld makes clang look for a nonexistent ld.ld64.lld; the probe link fails and the series is marked n/a. The ld64.lld binary is present on PATH (the benchmark-stats macOS job asserts command -v ld64.lld), so this is purely the invocation, not a missing linker.

The repo already has the correct, proven form: ci.yml's macOS smoke links with -fuse-ld="$(brew --prefix llvm@18)/bin/ld64.lld" — i.e. an absolute path. (-fuse-ld=lld also works: clang selects ld64.lld for Mach-O targets.)

Fix

In reld-bench, when the macOS linker token is ld64.lld, pass a value clang accepts instead of the bare name:

  • Resolve the absolute path to ld64.lld (search PATH) and pass -fuse-ld=<abs-path>, matching ci.yml's proven invocation and pinning the exact binary being benchmarked.
  • Fall back to -fuse-ld=lld (clang picks ld64.lld on Darwin) if the binary can't be located on PATH.
  • Keep the table's display name as ld64.lld (decouple the display label from the -fuse-ld value, exactly as the harness already does for reld's shim).

This is a single translation point applied to the synthetic path, the replay path (--replay-corpus), and the availability probe.

Acceptance criteria

  • On macOS, reld-bench links via ld64.lld and reports real timings (not n/a) for the ld64.lld series, with the column still labeled ld64.lld.
  • The -fuse-ld value is the resolved absolute path to ld64.lld when found, else lld; other linkers (bfd/lld/mold/wild) and reld's shim are unchanged.
  • Non-macOS behavior is unchanged.
  • RED -> GREEN: a unit test showing the macOS ld64.lld token maps to an accepted -fuse-ld value (abs path when on PATH; lld fallback otherwise), where the current bare-name behavior would resolve to the failing ld.ld64.lld.

Decisions

  • Priority: P2. A published-benchmark correctness bug: macOS silently shows no lld numbers, understating coverage.
  • Absolute path over -fuse-ld=lld as the primary value, to match the repo's already-proven macOS invocation and to benchmark a specific, pinned ld64.lld; lld is the fallback.
  • Display stays ld64.lld — the value/label decoupling already exists for reld's shim; reuse it.

Activity

  1. zackees commented on Aug 7, 2026

    @zackees
    CollaboratorAuthor

    Generalized into meta #63 (benchmark linker-coverage integrity — no silent n/a). This fix's macOS CI assertion is the template for the per-platform expected-linker gates tracked there.

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