about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2023-10-11 22:40:04 +0200
committerJakub Beránek <berykubik@gmail.com>2023-10-11 22:40:04 +0200
commit482a8204bc3d586c664bd3c494372fa7340be99f (patch)
treef59b444e57a210d223fccc6a2d286ce1a69f850f /src
parent9a0e90f7b47fa09aa49cbd9248b0218a6caf5728 (diff)
downloadrust-482a8204bc3d586c664bd3c494372fa7340be99f.tar.gz
rust-482a8204bc3d586c664bd3c494372fa7340be99f.zip
Pass BOLT settings at the correct step
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/compile.rs2
-rw-r--r--src/tools/opt-dist/src/main.rs10
2 files changed, 8 insertions, 4 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 15fee486425..623fa5fa111 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -907,7 +907,7 @@ impl Step for Rustc {
         }
 
         if builder.build.config.enable_bolt_settings && compiler.stage == 1 {
-            // Relocations are required for BOLT to work.k
+            // Relocations are required for BOLT to work.
             cargo.env("RUSTC_BOLT_LINK_FLAGS", "1");
         }
 
diff --git a/src/tools/opt-dist/src/main.rs b/src/tools/opt-dist/src/main.rs
index 60a53cb15de..9cdff84676e 100644
--- a/src/tools/opt-dist/src/main.rs
+++ b/src/tools/opt-dist/src/main.rs
@@ -215,7 +215,12 @@ fn execute_pipeline(
         print_free_disk_space()?;
 
         stage.section("Build PGO optimized rustc", |section| {
-            Bootstrap::build(env).rustc_pgo_optimize(&profile).run(section)
+            let mut cmd = Bootstrap::build(env).rustc_pgo_optimize(&profile);
+            if env.use_bolt() {
+                cmd = cmd.with_rustc_bolt_ldflags();
+            }
+
+            cmd.run(section)
         })?;
 
         Ok(profile)
@@ -259,7 +264,6 @@ fn execute_pipeline(
             stage.section("Build PGO optimized LLVM", |stage| {
                 Bootstrap::build(env)
                     .with_llvm_bolt_ldflags()
-                    .with_rustc_bolt_ldflags()
                     .llvm_pgo_optimize(&llvm_pgo_profile)
                     .avoid_rustc_rebuild()
                     .run(stage)
@@ -270,7 +274,7 @@ fn execute_pipeline(
 
             log::info!("Optimizing {llvm_lib} with BOLT");
 
-            // FIXME(kobzol: try gather profiles together, at once for LLVM and rustc
+            // FIXME(kobzol): try gather profiles together, at once for LLVM and rustc
             // Instrument the libraries and gather profiles
             let llvm_profile = with_bolt_instrumented(&llvm_lib, |llvm_profile_dir| {
                 stage.section("Gather profiles", |_| {