Skip to content

Commit

Permalink
Unrolled build for rust-lang#122138
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#122138 - lqd:llvm-mtime, r=clubby789

Record mtime in bootstrap's LLVM linker script

As discovered in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60ui.60.20tests.20re-running.3F the linker script added in rust-lang#121967 can trigger rebuilds or new test executions, as it's more recent than some of the existing files themselves.

This PR copies the mtime to the linker script to prevent a second invocation of `./x test tests/ui` from rerunning all of the tests.
  • Loading branch information
rust-timer committed Mar 8, 2024
2 parents 9c3ad80 + 1c3fe15 commit aa8f343
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,15 @@ fn install_llvm_file(
// projects like miri link against librustc_driver.so. We don't use a symlink, as
// these are not allowed inside rustup components.
let link = t!(fs::read_link(source));
t!(std::fs::write(full_dest, format!("INPUT({})\n", link.display())));
let mut linker_script = t!(fs::File::create(full_dest));
t!(write!(linker_script, "INPUT({})\n", link.display()));

// We also want the linker script to have the same mtime as the source, otherwise it
// can trigger rebuilds.
let meta = t!(fs::metadata(source));
if let Ok(mtime) = meta.modified() {
t!(linker_script.set_modified(mtime));
}
}
} else {
builder.install(&source, destination, 0o644);
Expand Down

0 comments on commit aa8f343

Please sign in to comment.