Skip to content

Commit 9e92e2a

Browse files
Rollup merge of #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 #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.
2 parents 57aea38 + 1c3fe15 commit 9e92e2a

File tree

1 file changed

+9
-1
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+9
-1
lines changed

src/bootstrap/src/core/build_steps/dist.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,15 @@ fn install_llvm_file(
20472047
// projects like miri link against librustc_driver.so. We don't use a symlink, as
20482048
// these are not allowed inside rustup components.
20492049
let link = t!(fs::read_link(source));
2050-
t!(std::fs::write(full_dest, format!("INPUT({})\n", link.display())));
2050+
let mut linker_script = t!(fs::File::create(full_dest));
2051+
t!(write!(linker_script, "INPUT({})\n", link.display()));
2052+
2053+
// We also want the linker script to have the same mtime as the source, otherwise it
2054+
// can trigger rebuilds.
2055+
let meta = t!(fs::metadata(source));
2056+
if let Ok(mtime) = meta.modified() {
2057+
t!(linker_script.set_modified(mtime));
2058+
}
20512059
}
20522060
} else {
20532061
builder.install(&source, destination, 0o644);

0 commit comments

Comments
 (0)