Skip to content

Commit a3f7c4d

Browse files
committed
Auto merge of rust-lang#90054 - michaelwoerister:v0-mangling-in-compiler, r=Mark-Simulacrum
Make new symbol mangling scheme default for compiler itself. As suggest in rust-lang#89917 (comment), this PR enables the new symbol mangling scheme for the compiler itself. The standard library is still compiled using the legacy mangling scheme so that the new symbol format does not show up in user code (yet). r? `@Mark-Simulacrum`
2 parents 514b387 + 456283c commit a3f7c4d

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
@@ -609,7 +609,11 @@ changelog-seen = 2
609609

610610
# Enable symbol-mangling-version v0. This can be helpful when profiling rustc,
611611
# as generics will be preserved in symbols (rather than erased into opaque T).
612-
#new-symbol-mangling = false
612+
# When no setting is given, the new scheme will be used when compiling the
613+
# compiler and its tools and the legacy scheme will be used when compiling the
614+
# standard library.
615+
# If an explicit setting is given, it will be used for all parts of the codebase.
616+
#new-symbol-mangling = true|false (see comment)
613617

614618
# =============================================================================
615619
# 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
@@ -141,7 +141,7 @@ pub struct Config {
141141
pub rust_verify_llvm_ir: bool,
142142
pub rust_thin_lto_import_instr_limit: Option<u32>,
143143
pub rust_remap_debuginfo: bool,
144-
pub rust_new_symbol_mangling: bool,
144+
pub rust_new_symbol_mangling: Option<bool>,
145145
pub rust_profile_use: Option<String>,
146146
pub rust_profile_generate: Option<String>,
147147
pub llvm_profile_use: Option<String>,
@@ -874,7 +874,7 @@ impl Config {
874874
config.rust_run_dsymutil = rust.run_dsymutil.unwrap_or(false);
875875
optimize = rust.optimize;
876876
ignore_git = rust.ignore_git;
877-
set(&mut config.rust_new_symbol_mangling, rust.new_symbol_mangling);
877+
config.rust_new_symbol_mangling = rust.new_symbol_mangling;
878878
set(&mut config.rust_optimize_tests, rust.optimize_tests);
879879
set(&mut config.codegen_tests, rust.codegen_tests);
880880
set(&mut config.rust_rpath, rust.rpath);

0 commit comments

Comments
 (0)