about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-10-23 03:06:21 +0000
committerbors <bors@rust-lang.org>2021-10-23 03:06:21 +0000
commita3f7c4db0373aa077f86cdd1bf11122845d3b65a (patch)
tree83cc1cd209897f3d0c7ff4c8d6633ede02694a13 /src/bootstrap
parent514b3877956dc594823106b66c164f8cdbc8b3da (diff)
parent456283c95dfc21a94a3f48e26a0809bc8976afbe (diff)
downloadrust-a3f7c4db0373aa077f86cdd1bf11122845d3b65a.tar.gz
rust-a3f7c4db0373aa077f86cdd1bf11122845d3b65a.zip
Auto merge of #90054 - michaelwoerister:v0-mangling-in-compiler, r=Mark-Simulacrum
Make new symbol mangling scheme default for compiler itself.

As suggest in https://github.com/rust-lang/rust/pull/89917#issuecomment-945888574, 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`
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs20
-rw-r--r--src/bootstrap/config.rs4
2 files changed, 21 insertions, 3 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index ac1841b6913..d5656f0f37e 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 8d03aade341..68e20f90b7f 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -141,7 +141,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 rust_new_symbol_mangling: Option<bool>,
     pub rust_profile_use: Option<String>,
     pub rust_profile_generate: Option<String>,
     pub llvm_profile_use: Option<String>,
@@ -874,7 +874,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);