From 456283c95dfc21a94a3f48e26a0809bc8976afbe Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Tue, 19 Oct 2021 14:58:21 +0200 Subject: [PATCH] Make new symbol mangling scheme default for compiler itself. --- config.toml.example | 6 +++++- src/bootstrap/builder.rs | 20 +++++++++++++++++++- src/bootstrap/config.rs | 4 ++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/config.toml.example b/config.toml.example index 61e57eee782b8..97289befd3100 100644 --- a/config.toml.example +++ b/config.toml.example @@ -603,7 +603,11 @@ changelog-seen = 2 # Enable symbol-mangling-version v0. This can be helpful when profiling rustc, # as generics will be preserved in symbols (rather than erased into opaque T). -#new-symbol-mangling = false +# When no setting is given, the new scheme will be used when compiling the +# compiler and its tools and the legacy scheme will be used when compiling the +# standard library. +# If an explicit setting is given, it will be used for all parts of the codebase. +#new-symbol-mangling = true|false (see comment) # ============================================================================= # Options for specific targets diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index ac1841b691334..d5656f0f37e03 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -972,8 +972,26 @@ impl<'a> Builder<'a> { } } - if self.config.rust_new_symbol_mangling { + let use_new_symbol_mangling = match self.config.rust_new_symbol_mangling { + Some(setting) => { + // If an explicit setting is given, use that + setting + } + None => { + if mode == Mode::Std { + // The standard library defaults to the legacy scheme + false + } else { + // The compiler and tools default to the new scheme + true + } + } + }; + + if use_new_symbol_mangling { rustflags.arg("-Zsymbol-mangling-version=v0"); + } else { + rustflags.arg("-Zsymbol-mangling-version=legacy"); } // FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`, diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 9a48b768cb37d..6585152ab31a7 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -140,7 +140,7 @@ pub struct Config { pub rust_verify_llvm_ir: bool, pub rust_thin_lto_import_instr_limit: Option, pub rust_remap_debuginfo: bool, - pub rust_new_symbol_mangling: bool, + pub rust_new_symbol_mangling: Option, pub rust_profile_use: Option, pub rust_profile_generate: Option, pub llvm_profile_use: Option, @@ -870,7 +870,7 @@ impl Config { config.rust_run_dsymutil = rust.run_dsymutil.unwrap_or(false); optimize = rust.optimize; ignore_git = rust.ignore_git; - set(&mut config.rust_new_symbol_mangling, rust.new_symbol_mangling); + config.rust_new_symbol_mangling = rust.new_symbol_mangling; set(&mut config.rust_optimize_tests, rust.optimize_tests); set(&mut config.codegen_tests, rust.codegen_tests); set(&mut config.rust_rpath, rust.rpath);