diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-30 21:53:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-30 21:53:33 +0200 |
| commit | 0d78b1e65798f3ea684e3b056af35e5c6ffb0643 (patch) | |
| tree | 2be28a4015dcd7d09ad5c5a6ab5246165b891de7 /compiler | |
| parent | 3e621b3dbf4e5e49378c33686bdbd48d30320a1f (diff) | |
| parent | 996962243670f15a88910f5c52b30fbc7b409138 (diff) | |
| download | rust-0d78b1e65798f3ea684e3b056af35e5c6ffb0643.tar.gz rust-0d78b1e65798f3ea684e3b056af35e5c6ffb0643.zip | |
Rollup merge of #146518 - madsmtm:ld-reproducible-doc, r=SparrowLii
Improve the documentation around `ZERO_AR_DATE` In particular, document why we don't use the new `-reproducible` flag. I went through [the source for Apple's old linker](https://github.com/apple-oss-distributions/ld64), and compared the versions with [the mapping to Xcode versions on Wikipedia](https://en.wikipedia.org/wiki/Xcode) to find the relevant Xcode versions for these features. r? compiler
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_target/src/spec/base/apple/mod.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs index ecc74264160..39e604bcce7 100644 --- a/compiler/rustc_target/src/spec/base/apple/mod.rs +++ b/compiler/rustc_target/src/spec/base/apple/mod.rs @@ -158,12 +158,22 @@ pub(crate) fn base( SplitDebuginfo::Off, ]), + // Tell the linker that we would like it to avoid irreproducible binaries. + // // This environment variable is pretty magical but is intended for // producing deterministic builds. This was first discovered to be used // by the `ar` tool as a way to control whether or not mtime entries in - // the archive headers were set to zero or not. It appears that - // eventually the linker got updated to do the same thing and now reads - // this environment variable too in recent versions. + // the archive headers were set to zero or not. + // + // In `ld64-351.8`, shipped with Xcode 9.3, the linker was updated to + // read this flag too. Linker versions that don't support this flag + // may embed modification timestamps in binaries (especially in debug + // information). + // + // A cleaner alternative would be to pass the `-reproducible` flag, + // though that is only supported since `ld64-819.6` shipped with Xcode + // 14, which is too new for our minimum supported version: + // https://doc.rust-lang.org/rustc/platform-support/apple-darwin.html#host-tooling // // For some more info see the commentary on #47086 link_env: Cow::Borrowed(&[(Cow::Borrowed("ZERO_AR_DATE"), Cow::Borrowed("1"))]), |
