Uh oh!
There was an error while loading. Please reload this page.
[WIP] Content hash support. (See also cargo changes) - #75594
Conversation
rust-highfive
commented
Aug 16, 2020
(rust_highfive has picked a reviewer for you, use r? to override) |
gilescope
commented
Aug 16, 2020
That looks a legit test failure. Let me look into that. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
gilescope
commented
Aug 18, 2020
Hmm, so that test failure wasn't legit and went away. Meanwhile spotted we already use a |
bjorn3
commented
Aug 18, 2020
Compiled dependencies and probably the output files also need to be hashed. |
Updated it so that we use the precomputed hashes - this makes this change effectively zero cost now as all the source was being hashed elsewhere. That's much better than I was exepcting (and given that maybe there's no need to put it behind a -Z rustc flag?). That's a really weird compiler error - I don't have a mental model how that could happen. Locally it's an Rc but the CI thinks it's an Arc. It's like the CI isn't actually compiling the branch of code I'm on, but is merging the patch onto master and building that? (Maybe the process has changed a bit? - I've taken a fair few months off from submissions) |
gilescope
commented
Aug 20, 2020
How should the hashes [u8] should be turned into utf8? Seems there's pleanty of options to turn bin to text - for now I've dodge that and just used the debug formatting of [u8] to turn it to a string but suggestions welcome! |
bjorn3
commented
Aug 20, 2020
There is a type in |
bors
commented
Aug 30, 2020
☔ The latest upstream changes (presumably #74862) made this pull request unmergeable. Please resolve the merge conflicts. |
gilescope
commented
Oct 25, 2020
@ehuss do my changes to base.rs look vaguely in the right direction? Once I can get one symbol appearing in the output that I can find I'll be unstuck. But I'm really clueless about this codegen side at the moment - I've not touched this part of the compiler at all before. Any hints are greatfully appreciated and may shave months of headbanging off this PR... |
Well this have been a voyage of discovery, I made a hi.rs that printed 'Hi'. I can see the section coming out in the llvm IR code and I can see it coming out in the generated assembly code if I do: I can see it in So I guess it's all working fine but some optimisation layer is removing it (linker maybe?). I will try and see if I can hint to the linker not to remove it... |
Uh oh!
There was an error while loading. Please reload this page.
bjorn3
commented
Oct 25, 2020
This for executables? You may need to do the same as for the gdb debug scripts section. (reference it from the main shim using a volatile load) rust/compiler/rustc_codegen_ssa/src/base.rs Line 429 in 17cc9b6 |
gilescope
commented
Oct 28, 2020
Seem to get the symbol coming out for rmeta and executables now. Just trying to add the symbol to the dylib (it's not coming out in the .ll so I've got a way to go there...). |
Uh oh!
There was an error while loading. Please reload this page.
bjorn3
commented
Oct 28, 2020
The cdylib doesn't contain the svh symbol, as the metadata module is omitted for cdylibs. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| if let Some(ref backend) = sess.opts.debugging_opts.codegen_backend { | ||
| files.push(backend.to_string()); | ||
| files.push((backend.to_string(), None)); // TO DO: is this something we need to hash? |
There was a problem hiding this comment.
Yes. It is a dylib, so it contains an SVH. You could add a parameter with the result of codegen_backend.metadata_loader() to this function to read it, but that looks like a bit of a hack.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
denser encoding format Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
bjorn3
commented
Nov 14, 2020
Did you also add the corresponding decode call? |
gilescope
commented
Nov 14, 2020
I see where I was being tripped up - the encode was converting an array to a slice before writing it so there's a length in there as well messing up my offsets. I should have guessed that might happen sooner... |
bors
commented
Nov 15, 2020
☔ The latest upstream changes (presumably #79070) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels: |
bors
commented
Dec 16, 2020
☔ The latest upstream changes (presumably #77117) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels: |
Dylan-DPC-zz
commented
Feb 28, 2021
@gilescope any updates on this? |
gilescope
commented
Mar 24, 2021
This PR is good, but blocked waiting on the cargo changes. The cargo PR needs another round of work to nail the build.rs interactions. |
JohnCSimon
commented
Nov 27, 2022
@gilescope @rustbot label: +S-inactive |
This PR adds a makefile comment (on the following line as can't be the same line in makefiles) with the file size and a hash of the file in the deps/*.d files.
The main PR is on cargo's repo: rust-lang/cargo#8623
This is to enable cargo to be able to use file sizes and content hashes as well as mtimes to both detect rapid changes that are currently missed and also to prevent compile cascades where mtimes have been altered but no actual change to the content occured (E.g. docker layers typically don't store precise times or copying a target dir from one place to another).
It seems that the hashes are already being calculated in the compiler so this is almost zero cost to rustc - the changes are:
.rlib,lib.rmetais renamed tolibcrate_name-svh.rmeta.rmetafiles we add the svh to a known location in the uncompressed header.(For outanding points please see the cargo PR. For binary file tracking we build on #63012 )