about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2023-10-09 21:57:19 +0200
committerJakub Beránek <berykubik@gmail.com>2023-10-09 22:00:17 +0200
commit9a0e90f7b47fa09aa49cbd9248b0218a6caf5728 (patch)
tree4ff0aa518eed43df42f73b3fa3f84c8d3b43d4f7 /src/bootstrap
parentdd7c5a00cb1cc5dbf5f661bb72c8e7d237031953 (diff)
downloadrust-9a0e90f7b47fa09aa49cbd9248b0218a6caf5728.tar.gz
rust-9a0e90f7b47fa09aa49cbd9248b0218a6caf5728.zip
Add `--enable-bolt-settings` bootstrap flag
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/compile.rs2
-rw-r--r--src/bootstrap/config.rs2
-rw-r--r--src/bootstrap/flags.rs3
3 files changed, 6 insertions, 1 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 42729797832..15fee486425 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -906,7 +906,7 @@ impl Step for Rustc {
             cargo.arg("-p").arg(krate);
         }
 
-        if compiler.stage == 1 {
+        if builder.build.config.enable_bolt_settings && compiler.stage == 1 {
             // Relocations are required for BOLT to work.k
             cargo.env("RUSTC_BOLT_LINK_FLAGS", "1");
         }
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 1755c3166de..759d874a089 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -234,6 +234,7 @@ pub struct Config {
     pub llvm_profile_use: Option<String>,
     pub llvm_profile_generate: bool,
     pub llvm_libunwind_default: Option<LlvmLibunwind>,
+    pub enable_bolt_settings: bool,
 
     pub reproducible_artifacts: Vec<String>,
 
@@ -1128,6 +1129,7 @@ impl Config {
         config.free_args = std::mem::take(&mut flags.free_args);
         config.llvm_profile_use = flags.llvm_profile_use;
         config.llvm_profile_generate = flags.llvm_profile_generate;
+        config.enable_bolt_settings = flags.enable_bolt_settings;
 
         // Infer the rest of the configuration.
 
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index e0291e407b3..5a6a5f37fc6 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -152,6 +152,9 @@ pub struct Flags {
     /// generate PGO profile with llvm built for rustc
     #[arg(global(true), long)]
     pub llvm_profile_generate: bool,
+    /// Enable BOLT link flags
+    #[arg(global(true), long)]
+    pub enable_bolt_settings: bool,
     /// Additional reproducible artifacts that should be added to the reproducible artifacts archive.
     #[arg(global(true), long)]
     pub reproducible_artifact: Vec<String>,