about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2018-10-22 16:39:36 +0200
committerMichael Woerister <michaelwoerister@posteo>2018-10-26 15:07:03 +0200
commitb8f977a8a7ab9d87fa8b5b72288a69f2fedc7455 (patch)
treedeae1837eec559acb7ebafa1b3081f7891734f50 /src/bootstrap
parent82239b04dc9cea1d54422c2fb223ff5321ccafdd (diff)
downloadrust-b8f977a8a7ab9d87fa8b5b72288a69f2fedc7455.tar.gz
rust-b8f977a8a7ab9d87fa8b5b72288a69f2fedc7455.zip
bootstrap: Allow for build libstd to have its own codegen-unit setting.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs13
-rw-r--r--src/bootstrap/config.rs4
2 files changed, 13 insertions, 4 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 71a89cd6d76..5abc0455b58 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1119,10 +1119,15 @@ impl<'a> Builder<'a> {
             cargo.arg("-v");
         }
 
-        // This must be kept before the thinlto check, as we set codegen units
-        // to 1 forcibly there.
-        if let Some(n) = self.config.rust_codegen_units {
-            cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
+        match (mode, self.config.rust_codegen_units_std, self.config.rust_codegen_units) {
+            (Mode::Std, Some(n), _) |
+            (Mode::Test, Some(n), _) |
+            (_, _, Some(n)) => {
+                cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
+            }
+            _ => {
+                // Don't set anything
+            }
         }
 
         if self.config.rust_optimize {
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index a9d330e06a1..3eb6e8d84e8 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -95,6 +95,7 @@ pub struct Config {
     // rust codegen options
     pub rust_optimize: bool,
     pub rust_codegen_units: Option<u32>,
+    pub rust_codegen_units_std: Option<u32>,
     pub rust_debug_assertions: bool,
     pub rust_debuginfo: bool,
     pub rust_debuginfo_lines: bool,
@@ -294,6 +295,7 @@ impl Default for StringOrBool {
 struct Rust {
     optimize: Option<bool>,
     codegen_units: Option<u32>,
+    codegen_units_std: Option<u32>,
     debug_assertions: Option<bool>,
     debuginfo: Option<bool>,
     debuginfo_lines: Option<bool>,
@@ -580,6 +582,8 @@ impl Config {
                 Some(n) => config.rust_codegen_units = Some(n),
                 None => {}
             }
+
+            config.rust_codegen_units_std = rust.codegen_units_std;
         }
 
         if let Some(ref t) = toml.target {