about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRémy Rakic <remy.rakic+github@gmail.com>2024-03-07 12:39:51 +0000
committerRémy Rakic <remy.rakic+github@gmail.com>2024-03-07 12:56:17 +0000
commit1c3fe15f6cb666f59f6ca16d741b4d43442f5b07 (patch)
treec267a93f8bff9d0cdfc0e16998c387bf65e9a674
parentb91ceb88de6a9b3465fb1825ead43235909563ef (diff)
downloadrust-1c3fe15f6cb666f59f6ca16d741b4d43442f5b07.tar.gz
rust-1c3fe15f6cb666f59f6ca16d741b4d43442f5b07.zip
record mtime in llvm linker script
This will avoid rebuilds due to the script being more recent than the
rest of the original files.
-rw-r--r--src/bootstrap/src/core/build_steps/dist.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index 8c9f320e1c9..2d5e861aa1d 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -2048,6 +2048,13 @@ fn install_llvm_file(
             let link = t!(fs::read_link(source));
             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);