Description
I was trying to determine if sccache could cache crates built as dependencies of different root crates. When I looked into it I found that the rlibs were not bit-identical despite being built from the same source. Most of the differences were in the debug info because the current directory winds up encoded there. I tried using -Zremap-path-prefix-from=... -Zremap-path-prefix-to=...
which removed most of the differences but not all. A small difference in the metadata remains, which from looking at the diff of the serialized metadata @eddyb said was the SVH. @michaelwoerister: do you know why this would be?
I built this test crate twice in different directories using the test-build.sh script. The diff of the itoa
rlib from each build looks like this (I generated that using diffoscope.)
Activity
michaelwoerister commentedon Feb 12, 2018
Lots of stuff goes into the SVH. It might well be that something directory related accidentally goes into it. The SVH is computed here:
rust/src/librustc/hir/map/collector.rs
Lines 123 to 163 in 16362c7
infinity0 commentedon Feb 12, 2018
cc #34902
This is similar to the GCC build-path issue where other programs (and in the past, GCC's DW_AT_producer) likes to embed CFLAGS into the output. Suggested options:
michaelwoerister commentedon Feb 12, 2018
#48162 addresses (1), which is kind of orthogonal to (2) and (3) because the SVH will always be part of the output binary and it must change if the result of the mapping changes.
luser commentedon Feb 20, 2018
With the latest Rust nightly:
which includes the fix from #48162, the outputs from my test script are still not the same:
alexcrichton commentedon Feb 20, 2018
I think we may still be hashing
-L
arguments?michaelwoerister commentedon Feb 21, 2018
Yes, it seems we do:
rust/src/librustc/session/config.rs
Line 396 in 27a046e
Good catch! Not sure if we have to hash those at this point. The tracking system should catch resulting changes later on, if we don't have any holes in the tracking. This needs some review.
jsgf commentedon Feb 22, 2018
Edit: never mind - seems fixed now that I've rebased to master.
I found that (after implementing it)
--remap-path-prefix
still affects the SVH, even if the mapping does nothing:will generate different metadata hashes if I change the mapping, even though it doesn't affect anything and nothing else changes.
3 remaining items