Skip to content

Commit 456283c

Browse files
Make new symbol mangling scheme default for compiler itself.
1 parent d45ed75 commit 456283c

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

config.toml.example

+5-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,11 @@ changelog-seen = 2
603603

604604
# Enable symbol-mangling-version v0. This can be helpful when profiling rustc,
605605
# as generics will be preserved in symbols (rather than erased into opaque T).
606-
#new-symbol-mangling = false
606+
# When no setting is given, the new scheme will be used when compiling the
607+
# compiler and its tools and the legacy scheme will be used when compiling the
608+
# standard library.
609+
# If an explicit setting is given, it will be used for all parts of the codebase.
610+
#new-symbol-mangling = true|false (see comment)
607611

608612
# =============================================================================
609613
# Options for specific targets

src/bootstrap/builder.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -972,8 +972,26 @@ impl<'a> Builder<'a> {
972972
}
973973
}
974974

975-
if self.config.rust_new_symbol_mangling {
975+
let use_new_symbol_mangling = match self.config.rust_new_symbol_mangling {
976+
Some(setting) => {
977+
// If an explicit setting is given, use that
978+
setting
979+
}
980+
None => {
981+
if mode == Mode::Std {
982+
// The standard library defaults to the legacy scheme
983+
false
984+
} else {
985+
// The compiler and tools default to the new scheme
986+
true
987+
}
988+
}
989+
};
990+
991+
if use_new_symbol_mangling {
976992
rustflags.arg("-Zsymbol-mangling-version=v0");
993+
} else {
994+
rustflags.arg("-Zsymbol-mangling-version=legacy");
977995
}
978996

979997
// FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,

src/bootstrap/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub struct Config {
140140
pub rust_verify_llvm_ir: bool,
141141
pub rust_thin_lto_import_instr_limit: Option<u32>,
142142
pub rust_remap_debuginfo: bool,
143-
pub rust_new_symbol_mangling: bool,
143+
pub rust_new_symbol_mangling: Option<bool>,
144144
pub rust_profile_use: Option<String>,
145145
pub rust_profile_generate: Option<String>,
146146
pub llvm_profile_use: Option<String>,
@@ -870,7 +870,7 @@ impl Config {
870870
config.rust_run_dsymutil = rust.run_dsymutil.unwrap_or(false);
871871
optimize = rust.optimize;
872872
ignore_git = rust.ignore_git;
873-
set(&mut config.rust_new_symbol_mangling, rust.new_symbol_mangling);
873+
config.rust_new_symbol_mangling = rust.new_symbol_mangling;
874874
set(&mut config.rust_optimize_tests, rust.optimize_tests);
875875
set(&mut config.codegen_tests, rust.codegen_tests);
876876
set(&mut config.rust_rpath, rust.rpath);

0 commit comments

Comments
 (0)