Skip to content

Commit 589e38a

Browse files
committed
Enable relocations for BOLT
1 parent 240a7dd commit 589e38a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/bootstrap/bin/rustc.rs

+6
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ fn main() {
217217
eprintln!("{prefix} libdir: {libdir:?}");
218218
}
219219

220+
if env::var_os("RUSTC_BOLT_LINK_FLAGS").is_some() {
221+
if let Some("rustc_driver") = crate_name {
222+
cmd.arg("-Clink-args=-Wl,-q");
223+
}
224+
}
225+
220226
let start = Instant::now();
221227
let (child, status) = {
222228
let errmsg = format!("\nFailed to run:\n{cmd:?}\n-------------");

src/bootstrap/compile.rs

+5
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,11 @@ impl Step for Rustc {
906906
cargo.arg("-p").arg(krate);
907907
}
908908

909+
if compiler.stage == 1 {
910+
// Relocations are required for BOLT to work.k
911+
cargo.env("RUSTC_BOLT_LINK_FLAGS", "1");
912+
}
913+
909914
let _guard = builder.msg_sysroot_tool(
910915
Kind::Build,
911916
compiler.stage,

0 commit comments

Comments
 (0)