fix: strip OUT_DIR from the object file name hash too - #1902
Merged
NobodyXu merged 2 commits intoSep 15, 2026
Merged
Conversation
rust-lang#1270 made the hash relative to CARGO_MANIFEST_DIR, but sources a build script writes into OUT_DIR are not under the manifest dir when the target dir is somewhere else, so the absolute OUT_DIR still ends up in the hash and the object name changes with the build location. compiler-builtins hits this with its generated lse_*.S on distro builds and libcompiler_builtins comes out different per build path. Try OUT_DIR first, then CARGO_MANIFEST_DIR. Adds a test that builds the same source under two OUT_DIRs and checks the object name matches. Fixes rust-lang#1901 Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
NobodyXu
requested changes
Sep 14, 2026
NobodyXu
left a comment
Contributor
There was a problem hiding this comment.
Thank you just one minor nit
Review suggestion from NobodyXu: have the closure produce the Cow directly instead of wrapping at every call site. Kept the Option on the outside so it type-checks, and the call site becomes an or_else/unwrap_or chain.
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1901
objects_from_fileshashes the source dir into the object name and stripsCARGO_MANIFEST_DIRfirst (#1270). A source a build script writes intoOUT_DIRis not under the manifest dir when the target dir is elsewhere, so the absolute path still goes into the hash. This stripsOUT_DIRfirst and falls back toCARGO_MANIFEST_DIR; in-tree sources are unaffected.Repro from the issue, before/after:
The new test fails on 1.4.6 and passes with this change. #1277 was an earlier attempt at the same thing, closed as covered by #1270.