about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2023-10-02 21:14:16 +0200
committerJakub Beránek <berykubik@gmail.com>2023-10-09 21:55:00 +0200
commit589e38a413f13ed66019d9d9907ad48895b037dc (patch)
treee9aa570ff2f9c6700c2e59a633a5688abc9c716d
parent240a7dd02eb67c3a48f8cd3fa3b0de3c310aab93 (diff)
downloadrust-589e38a413f13ed66019d9d9907ad48895b037dc.tar.gz
rust-589e38a413f13ed66019d9d9907ad48895b037dc.zip
Enable relocations for BOLT
-rw-r--r--src/bootstrap/bin/rustc.rs6
-rw-r--r--src/bootstrap/compile.rs5
2 files changed, 11 insertions, 0 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 20cd63b966b..495eda2100a 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -217,6 +217,12 @@ fn main() {
         eprintln!("{prefix} libdir: {libdir:?}");
     }
 
+    if env::var_os("RUSTC_BOLT_LINK_FLAGS").is_some() {
+        if let Some("rustc_driver") = crate_name {
+            cmd.arg("-Clink-args=-Wl,-q");
+        }
+    }
+
     let start = Instant::now();
     let (child, status) = {
         let errmsg = format!("\nFailed to run:\n{cmd:?}\n-------------");
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 6821ded1458..42729797832 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -906,6 +906,11 @@ impl Step for Rustc {
             cargo.arg("-p").arg(krate);
         }
 
+        if compiler.stage == 1 {
+            // Relocations are required for BOLT to work.k
+            cargo.env("RUSTC_BOLT_LINK_FLAGS", "1");
+        }
+
         let _guard = builder.msg_sysroot_tool(
             Kind::Build,
             compiler.stage,