diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-17 11:13:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-17 11:13:44 +0200 |
| commit | 5e597875b73e651c5dea200754489f426bc39596 (patch) | |
| tree | 44ae9984f188d9c75112b797362979f2f157dc78 | |
| parent | 477db0506658a7db06808e24c11a1f0514da7c1c (diff) | |
| parent | 692c0bf4ff8d1f551850962bd8d3af62033dee39 (diff) | |
| download | rust-5e597875b73e651c5dea200754489f426bc39596.tar.gz rust-5e597875b73e651c5dea200754489f426bc39596.zip | |
Rollup merge of #63505 - jgalenson:sysroot-hash, r=alexcrichton
Hash the remapped sysroot instead of the original. One of the reasons that rustc builds are not reproducible is because the --sysroot path is dependent on the current directory. We can fix this by hashing the remapped sysroot instead of the original when applicable. Note that with this patch, the hash will stay the same if both the sysroot and the remapped path change. However, given that if the contents of the sysroot change the hash will also stay the same, this might be acceptable. I would appreciate feedback on the best way to do this. This helps #34902, although it does not fix it by itself.
| -rw-r--r-- | src/librustc/session/config.rs | 2 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/reproducible-build-2/Makefile | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 3536b2aa8ff..8e3b910e0da 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -395,7 +395,7 @@ top_level_options!( output_types: OutputTypes [TRACKED], search_paths: Vec<SearchPath> [UNTRACKED], libs: Vec<(String, Option<String>, Option<cstore::NativeLibraryKind>)> [TRACKED], - maybe_sysroot: Option<PathBuf> [TRACKED], + maybe_sysroot: Option<PathBuf> [UNTRACKED], target_triple: TargetTriple [TRACKED], diff --git a/src/test/run-make-fulldeps/reproducible-build-2/Makefile b/src/test/run-make-fulldeps/reproducible-build-2/Makefile index b96954fea0d..45c9a742723 100644 --- a/src/test/run-make-fulldeps/reproducible-build-2/Makefile +++ b/src/test/run-make-fulldeps/reproducible-build-2/Makefile @@ -5,7 +5,8 @@ # Objects are reproducible but their path is not. all: \ - fat_lto + fat_lto \ + sysroot fat_lto: rm -rf $(TMPDIR) && mkdir $(TMPDIR) @@ -14,3 +15,12 @@ fat_lto: cp $(TMPDIR)/reproducible-build $(TMPDIR)/reproducible-build-a $(RUSTC) reproducible-build.rs -C lto=fat cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 1 + +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 $(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 |
