Skip to content

Commit 009551f

Browse files
committed
Auto merge of #75472 - Mark-Simulacrum:mangling-config, r=eddyb
Add option to use the new symbol mangling in rustc/std I don't know if this causes problems in some cases -- maybe it should be on by default for at least rustc. I've never encountered problems with it other than tools not supporting it, though. cc @nnethercote r? @eddyb
2 parents 7a4fb35 + e09cca0 commit 009551f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

config.toml.example

+4
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,10 @@
475475
# This only applies from stage 1 onwards, and only for Windows targets.
476476
#control-flow-guard = false
477477

478+
# Enable symbol-mangling-version v0. This can be helpful when profiling rustc,
479+
# as generics will be preserved in symbols (rather than erased into opaque T).
480+
#new-symbol-mangling = false
481+
478482
# =============================================================================
479483
# Options for specific targets
480484
#

src/bootstrap/builder.rs

+4
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,10 @@ impl<'a> Builder<'a> {
859859
rustflags.arg("--cfg=bootstrap");
860860
}
861861

862+
if self.config.rust_new_symbol_mangling {
863+
rustflags.arg("-Zsymbol-mangling-version=v0");
864+
}
865+
862866
// FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
863867
// but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See
864868
// #71458.

src/bootstrap/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ pub struct Config {
112112
pub rust_verify_llvm_ir: bool,
113113
pub rust_thin_lto_import_instr_limit: Option<u32>,
114114
pub rust_remap_debuginfo: bool,
115+
pub rust_new_symbol_mangling: bool,
115116

116117
pub build: TargetSelection,
117118
pub hosts: Vec<TargetSelection>,
@@ -410,6 +411,7 @@ struct Rust {
410411
test_compare_mode: Option<bool>,
411412
llvm_libunwind: Option<bool>,
412413
control_flow_guard: Option<bool>,
414+
new_symbol_mangling: Option<bool>,
413415
}
414416

415417
/// TOML representation of how each build target is configured.
@@ -637,6 +639,7 @@ impl Config {
637639
debuginfo_level_tests = rust.debuginfo_level_tests;
638640
optimize = rust.optimize;
639641
ignore_git = rust.ignore_git;
642+
set(&mut config.rust_new_symbol_mangling, rust.new_symbol_mangling);
640643
set(&mut config.rust_optimize_tests, rust.optimize_tests);
641644
set(&mut config.codegen_tests, rust.codegen_tests);
642645
set(&mut config.rust_rpath, rust.rpath);

0 commit comments

Comments
 (0)