Skip to content

Commit 1e251c2

Browse files
Rollup merge of #166090 - zlfn:rebuild-lld-on-llvm-change, r=Kobzol
bootstrap: rebuild LLD when LLVM changes When rebuilding Rust, bootstrap did not rebuild LLD even if LLVM had changed. In most cases this is unlikely to cause problems, but having different versions of LLD and LLVM could cause issues. Discovered in the downstream rust-z80: llvm-z80/llvm-z80#133 (comment)
2 parents d378cd5 + 3150bfb commit 1e251c2

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

  • src/bootstrap/src/core/build_steps

‎src/bootstrap/src/core/build_steps/llvm.rs‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,8 +1708,17 @@ impl CommandLineStep for Lld {
17081708

17091709
let out_dir = builder.out.join(target).join("lld");
17101710

1711-
let lld_stamp = BuildStamp::new(&out_dir).with_prefix("lld");
1712-
if lld_stamp.path().exists() {
1711+
static STAMP_HASH_MEMO: OnceLock<String> = OnceLock::new();
1712+
let smart_stamp_hash = STAMP_HASH_MEMO.get_or_init(|| {
1713+
generate_smart_stamp_hash(
1714+
builder,
1715+
&builder.config.src.join("src/llvm-project"),
1716+
builder.in_tree_llvm_info.sha().unwrap_or_default(),
1717+
)
1718+
});
1719+
1720+
let lld_stamp = BuildStamp::new(&out_dir).with_prefix("lld").add_stamp(smart_stamp_hash);
1721+
if lld_stamp.is_up_to_date() {
17131722
return out_dir;
17141723
}
17151724

0 commit comments

Comments
 (0)