diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-03-07 18:32:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-07 18:32:49 +0100 |
| commit | 9e92e2adb070fbf966237de68f471259505c8d81 (patch) | |
| tree | e4ebfec2ad334214861825b2c0add2108be98c3d | |
| parent | 57aea3811eb6a30141ad0b8de1ece04421db56e9 (diff) | |
| parent | 1c3fe15f6cb666f59f6ca16d741b4d43442f5b07 (diff) | |
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.
| -rw-r--r-- | src/bootstrap/src/core/build_steps/dist.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index c8c32fb8699..1090edc9c92 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -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); |
