Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export ZERO_AR_DATE for macos linker invocations #71931

Merged
merged 1 commit into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/librustc_target/spec/apple_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ pub fn opts() -> TargetOptions {
has_elf_tls: version >= (10, 7),
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,

// 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.
//
// For some more info see the commentary on #47086
link_env: vec![("ZERO_AR_DATE".to_string(), "1".to_string())],

..Default::default()
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/run-make-fulldeps/reproducible-build-2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# ignore-musl
# ignore-windows
# ignore-macos (rust-lang/rust#66568)
# Objects are reproducible but their path is not.

all: \
Expand All @@ -21,7 +20,7 @@ sysroot:
rm -rf $(TMPDIR) && mkdir $(TMPDIR)
$(RUSTC) reproducible-build-aux.rs
$(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(shell $(RUSTC) --print sysroot) --remap-path-prefix=$(shell $(RUSTC) --print sysroot)=/sysroot
cp -r $(shell $(RUSTC) --print sysroot) $(TMPDIR)/sysroot
cp -R $(shell $(RUSTC) --print sysroot) $(TMPDIR)/sysroot
cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib
$(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(TMPDIR)/sysroot --remap-path-prefix=$(TMPDIR)/sysroot=/sysroot
cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1