-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes #14830
base: master
Are you sure you want to change the base?
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
…e hashes For now, they should result in the same data.
|
f709c73
to
2af218d
Compare
FWIW, I think this should resolve an issue in the Hubris build system. Currently we bypass Cargo's dirtiness checks for building deps in certain circumstances (to get maximum reuse of objects despite small controlled changes to Haven't tested it yet though. |
26ced7e
to
536ae6e
Compare
@@ -83,7 +83,7 @@ | |||
//! Target flags (test/bench/for_host/edition) | ✓ | | | | |||
//! -C incremental=… flag | ✓ | | | | |||
//! mtime of sources | ✓[^3] | | | | |||
//! RUSTFLAGS/RUSTDOCFLAGS | ✓ | | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like unit_id
is generally the same as c_extra_filename
at this moment. Do we anticipate in anything in the future of separating them? I think it worth some docs for future us and contributors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a slight docs update to describe how they are related. I'm a bit mixed about overly specifying it, especially since this is new to be tracked separately and I don't fully understand the the ramifications for when things are put in here or not.
dep_c_extra_filename_hashes.hash(&mut c_extra_filename_hasher); | ||
// Avoid trashing the caches on RUSTFLAGS changing via `c_extra_filename` | ||
// | ||
// Limited to `c_extra_filename` to help with reproducible build / PGO issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should (probably) avoid the PGO problems, since the symbols won't change. However, this could still cause problems with reproducible builds if the rlib filename somehow leaks into the resulting binary (I don't have a reason to think it does, but it seems risky).
I believe this does because the filenames of object files show up as the codegen unit names in dwarf debug info (and probably PDB?). I suspect that everything else in the binary will be the same, but builds differing only in extra-filename are likely to still produce different binaries.
Have we checked if it doesn't affect PGO?
We would like to check if anything is leaking rlib filename in debug info files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea how to go about that? I have no experience with PGO and we have no tests focusing on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do some experiments this week and see if we can have tests written down!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posted #14859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test passes with this PR for me
16ce931
to
c762927
Compare
### What does this PR try to resolve? This is a regression test to prevent issues like #7416. The test only run on Linux, as other platforms have different requirements for PGO, or emit different PGO function missing warnings. ### How should we test and review this PR? Not sure how brittle it is. We can optionally run it only on Cargo's CI? cc #14830
What does this PR try to resolve?
Fixes #8716
This splits
-C metdata
and-C extra-filename
and addsRUSTFLAGS
to-C extra-filename
in the hope that we can still make PGO and reproducible builds work while caching artifacts per RUSTFLAGS used.How should we test and review this PR?
Additional information