rust-lang / rust-lang/rust

Large arm64 macOS debug binaries fail to exec since the v0 mangling default

Open
#159,426 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-debuginfo A-linkers A-name-mangling C-bug I-prioritize O-macos regression-from-stable-to-stable T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Since the switch to v0 mangling by default (#151994), the dev build of our
workspace (~1100 crates, debug = "line-tables-only") is killed at exec on
arm64 macOS:

dyld[90104]: dyld cache '(null)' not loaded: syscall to map cache into shared region failed

With the default -Csplit-debuginfo=unpacked, ld64's debug map puts an
N_FUN stab with the full mangled name of every function into the
executable. Legacy names stay near-constant length under generic nesting (the
hash absorbs the type), while v0 names grow with it — the map is now
3,173,815 functions averaging 475 bytes per name (max 1558), a 1.51 GB
LC_SYMTAB strtab in a 2.45 GB binary, and once the image passes ~2 GB the
process no longer fits between its load address and the dyld shared region.

The scaling is visible on a 25-line file — a closure inside a generic
function, instantiated at type-nesting depth 4 vs 16:

$ git clone https://github.com/ashi009/v0-debug-map-repro && cd v0-debug-map-repro
$ for tc in 1.96.0 1.97.0; do rustc +$tc -V; for d in d4 d16; do rustc +$tc -Cdebuginfo=line-tables-only repro_$d.rs -o repro_$d; printf "repro_%s: " $d; nm -ap repro_$d | awk '$5=="FUN" && /4work/ {s+=length($NF)} END {print s+0}'; done; done
rustc 1.96.0 (ac68faa20 2026-05-25)
repro_d4: 332
repro_d16: 336
rustc 1.97.0 (2d8144b78 2026-07-07)
repro_d4: 334
repro_d16: 846

-Csymbol-mangling-version=legacy would be the escape hatch, but it is gated
on -Zunstable-options, so there is no stable way back to a bootable debug
build. Could that gate be lifted, or over-long names be hashed in the
debug-map path the way MCP 934 (#148429) does for PDB?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the 25-line v0-debug-map-repro case and reproduce the arm64 macOS size and exec failure using the listed rustc versions, debug settings, and nm command. Read the compiler paths handling -Csymbol-mangling-version and -Csplit-debuginfo; done means a stable, bootable debug build without the excessive debug-map strings, or a documented stable escape hatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.