about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-16 16:58:13 +0000
committerbors <bors@rust-lang.org>2020-08-16 16:58:13 +0000
commit009551f758d1d007ad0f7b652bfa8ddba0738117 (patch)
treeaa5f84888857172542e9fd4df1e4854e48c960ac
parent7a4fb355c6ce4e534e0998d83b68591bbe234ddb (diff)
parente09cca09acf7f146e7df754e74a5fc934af10de4 (diff)
downloadrust-009551f758d1d007ad0f7b652bfa8ddba0738117.tar.gz
rust-009551f758d1d007ad0f7b652bfa8ddba0738117.zip
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
-rw-r--r--config.toml.example4
-rw-r--r--src/bootstrap/builder.rs4
-rw-r--r--src/bootstrap/config.rs3
3 files changed, 11 insertions, 0 deletions
diff --git a/config.toml.example b/config.toml.example
index a9835ad12ad..36587cc0784 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -475,6 +475,10 @@
 # This only applies from stage 1 onwards, and only for Windows targets.
 #control-flow-guard = false
 
+# 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
+
 # =============================================================================
 # Options for specific targets
 #
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 709b202052e..6446fa7550d 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -859,6 +859,10 @@ impl<'a> Builder<'a> {
             rustflags.arg("--cfg=bootstrap");
         }
 
+        if self.config.rust_new_symbol_mangling {
+            rustflags.arg("-Zsymbol-mangling-version=v0");
+        }
+
         // FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
         // but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See
         // #71458.
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index d64ca95d243..70b1c471ac3 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -112,6 +112,7 @@ pub struct Config {
     pub rust_verify_llvm_ir: bool,
     pub rust_thin_lto_import_instr_limit: Option<u32>,
     pub rust_remap_debuginfo: bool,
+    pub rust_new_symbol_mangling: bool,
 
     pub build: TargetSelection,
     pub hosts: Vec<TargetSelection>,
@@ -410,6 +411,7 @@ struct Rust {
     test_compare_mode: Option<bool>,
     llvm_libunwind: Option<bool>,
     control_flow_guard: Option<bool>,
+    new_symbol_mangling: Option<bool>,
 }
 
 /// TOML representation of how each build target is configured.
@@ -637,6 +639,7 @@ impl Config {
             debuginfo_level_tests = rust.debuginfo_level_tests;
             optimize = rust.optimize;
             ignore_git = rust.ignore_git;
+            set(&mut 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);