Skip to content

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

Description

@ashi009

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)A-linkersArea: linkers... you gotta love linkersA-name-manglingArea: Name mangling / decoration aka symbol manglingC-bugCategory: This is a bug.I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}O-macosOperating system: macOST-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions