fix: remap assembler debug paths in Cargo build scripts - #54
Merged
dzbarsky merged 1 commit intoSep 8, 2026
Merged
Conversation
This was referenced Sep 5, 2026
Member
|
Ah, fun, thanks for the fix! BTW I thought Simon was trying to get Selenium working with @llvm (hermetic-llvm), do yall need help getting that over the finish line? |
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.
Problem
Selenium's CI broke due to a rules_rs bug (hermeticbuild/rules_rs#238). That bug was fixed in 0.0.108, but we can't upgrade to that version because our remote executor uses gcc 9 and hits a hermeticity bug.
ringandzstd-syscompile hand-written assembly in their build scripts. rules_rust passes-ffile-prefix-map=${pwd}=.so the build directory never appears in compiled output, but gcc 12 and older don't forward that flag to the assembler. The assembler records the absolute build directory in the object's debug info,cc-rsarchives the object, rustc bundles the archive into therlib, and--check-output-for-working-dirfails the build:The message points at Rust source, but the path comes from the assembly.
This only affects gcc 12 and older (upstream GCC added the forwarding in 13; Ubuntu's gcc-12 backports it) and only in
fastbuildanddbg, wherecc-rspasses-g. clang assembles.Sitself, so it's unaffected.Solution
Add
-fdebug-prefix-map=${pwd}=.which gcc forwards to the assembler. The assembly gets rewritten along with everything else, and therlibstops depending on where it was built. The flag is redundant and harmless for gcc 13+.Additional considerations
-ffile-prefix-mapsince it also implies-fmacro-prefix-map, which covers__FILE__, so dropping it would trade one leaked path for another.-Wa,--debug-prefix-mapdirectly, so that's not an option.rustcactions happen to run in the same directory. It compares against the working directory of therustcaction, but the path is written by the build script action, so under sandboxing or remote execution the two can differ and the check passes. Scanning build script output where it is produced would close that. I have it working and left it out of this PR, since it's a new check that could fail builds passing today.