Files
rust/compiler/rustc_interface
Jonathan Brouwer 3aa45f9798 Rollup merge of #156950 - cezarbbb:staticlib-rename-internal-symbols, r=petrochenkov
Staticlib rename internal symbols

Follow-up to rust-lang/rust#155338.

`-Zstaticlib-rename-internal-symbols` appends a crate-specific suffix (`_rs{StableCrateId}`) to non-exported symbols, resolving duplicate symbol conflicts when linking multiple Rust staticlibs into the same binary.

The implementation collects all defined `GLOBAL/WEAK` symbol names not in the exported set across all .o files, then renames them by extending the strtab and patching symbol name offsets. When combined with `-Zstaticlib-hide-internal-symbols`, the renamed symbols also receive `STV_HIDDEN` visibility.

Supported on ELF targets (Linux, BSD, etc.) and Apple targets (macOS, iOS, etc.). On unsupported targets (Windows), a warning is emitted and the flag has no effect.

r?@bjorn3 @petrochenkov
2026-06-16 22:11:02 +02:00
..