Skip to content

fix: remap ci-llvm debug paths via -ffile-prefix-map#156186

Open
paradoxicalguy wants to merge 2 commits intorust-lang:mainfrom
paradoxicalguy:fix-llvm-debuginfo-remap2
Open

fix: remap ci-llvm debug paths via -ffile-prefix-map#156186
paradoxicalguy wants to merge 2 commits intorust-lang:mainfrom
paradoxicalguy:fix-llvm-debuginfo-remap2

Conversation

@paradoxicalguy
Copy link
Copy Markdown
Contributor

problem:

ci-llvm include paths leak into debuginfo of librustc_driver via C/C++ compilation in rustc_llvm , causing non-determinism across two stage2 hermetic builds.

this exhibits as suffixes differing in anon.*.llvm.<hash> and mismatched GNU Build IDs, this persists even after stripping the debuginfo.
remap-debuginfo does not cover this, it only applies to rustc and not to C/C++ compiler.

fix:

extend debug path remapping to the C/C++ build in rustc_llvm by converting RUSTC_DEBUGINFO_MAP into corresponding -fdebug-prefix-map flags and passing them through cc::Build.

this is a targeted fix in rustc_llvm; a more general solution would involve propagating remap flags across rustc <-> cargo <-> build scripts.

r? @Urgau

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 5, 2026
Comment thread compiler/rustc_llvm/build.rs Outdated
Comment thread compiler/rustc_llvm/build.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment was marked as resolved.

ci-llvm include paths were leaking into debuginfo of `librustc_driver` via C/C++ compilation in rustc_llvm, causing non-determinism across
stage2 builds.

extend debug path remapping to the C/C++ build in rustc_llvm by converting RUSTC_DEBUGINFO_MAP into corresponding -fdebug-prefix-map flags and passing them through cc::Build.
@paradoxicalguy paradoxicalguy force-pushed the fix-llvm-debuginfo-remap2 branch from d1eccd5 to 6a19534 Compare May 5, 2026 13:54
@paradoxicalguy
Copy link
Copy Markdown
Contributor Author

knew i had it in me to pass tidy 🥹

Comment thread compiler/rustc_llvm/build.rs Outdated
@Urgau
Copy link
Copy Markdown
Member

Urgau commented May 5, 2026

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 5, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com>
@paradoxicalguy
Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 5, 2026
@Urgau Urgau changed the title fix: remap ci-llvm debug paths via -fdebug-prefix-map fix: remap ci-llvm debug paths via -ffile-prefix-map May 5, 2026
Copy link
Copy Markdown
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Urgau
Copy link
Copy Markdown
Member

Urgau commented May 5, 2026

I've update the title of the PR to better reflect the flag used.

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 5, 2026

📌 Commit fc6b9c8 has been approved by Urgau

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request May 5, 2026
…remap2, r=Urgau

fix: remap ci-llvm debug paths via `-ffile-prefix-map`

### problem:
ci-llvm include paths leak into debuginfo of `librustc_driver` via C/C++ compilation in `rustc_llvm` , causing non-determinism across two stage2 hermetic builds.

this exhibits as suffixes differing in `anon.*.llvm.<hash>` and mismatched GNU Build IDs, this persists even after stripping the debuginfo.
`remap-debuginfo` does not cover this, it only applies to rustc and not to C/C++ compiler.

### fix:
extend debug path remapping to the C/C++ build in `rustc_llvm` by converting `RUSTC_DEBUGINFO_MAP` into corresponding `-fdebug-prefix-map` flags and passing them through `cc::Build`.

**this is a targeted fix in rustc_llvm; a more general solution would involve propagating remap flags across rustc <-> cargo <-> build scripts.**

r? @Urgau
jhpratt added a commit to jhpratt/rust that referenced this pull request May 5, 2026
…remap2, r=Urgau

fix: remap ci-llvm debug paths via `-ffile-prefix-map`

### problem:
ci-llvm include paths leak into debuginfo of `librustc_driver` via C/C++ compilation in `rustc_llvm` , causing non-determinism across two stage2 hermetic builds.

this exhibits as suffixes differing in `anon.*.llvm.<hash>` and mismatched GNU Build IDs, this persists even after stripping the debuginfo.
`remap-debuginfo` does not cover this, it only applies to rustc and not to C/C++ compiler.

### fix:
extend debug path remapping to the C/C++ build in `rustc_llvm` by converting `RUSTC_DEBUGINFO_MAP` into corresponding `-fdebug-prefix-map` flags and passing them through `cc::Build`.

**this is a targeted fix in rustc_llvm; a more general solution would involve propagating remap flags across rustc <-> cargo <-> build scripts.**

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request May 5, 2026
Rollup of 12 pull requests

Successful merges:

 - #155341 (generic_const_args: allow paths to non type consts)
 - #156062 (Added command-line argument support for `wasm32-wali-linux-musl`)
 - #156159 ([AIX] add -bdbg:namedsects:ss link arg)
 - #156174 (Wasm: remove implicit `__heap_base`/`__data_end` exports)
 - #156186 (fix: remap ci-llvm debug paths via `-ffile-prefix-map`)
 - #156193 (port `rustc_ast*` crates from `box_` to `deref_patterns`)
 - #156201 (Don't run ui-fulldeps tests twice in stage 1)
 - #155808 (Always use `ConstFn` context for `const` closures)
 - #156105 (interpret: correctly deal with repr(transparent) enums)
 - #156148 (Use `all_impls` instead of handrolling it)
 - #156156 (Adjust getMCSubtargetInfo signature for LLVM 23+)
 - #156205 (move generalization test)
jhpratt added a commit to jhpratt/rust that referenced this pull request May 6, 2026
…remap2, r=Urgau

fix: remap ci-llvm debug paths via `-ffile-prefix-map`

### problem:
ci-llvm include paths leak into debuginfo of `librustc_driver` via C/C++ compilation in `rustc_llvm` , causing non-determinism across two stage2 hermetic builds.

this exhibits as suffixes differing in `anon.*.llvm.<hash>` and mismatched GNU Build IDs, this persists even after stripping the debuginfo.
`remap-debuginfo` does not cover this, it only applies to rustc and not to C/C++ compiler.

### fix:
extend debug path remapping to the C/C++ build in `rustc_llvm` by converting `RUSTC_DEBUGINFO_MAP` into corresponding `-fdebug-prefix-map` flags and passing them through `cc::Build`.

**this is a targeted fix in rustc_llvm; a more general solution would involve propagating remap flags across rustc <-> cargo <-> build scripts.**

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request May 6, 2026
Rollup of 15 pull requests

Successful merges:

 - #151122 (fix: more descriptive error message for enum to integer)
 - #155341 (generic_const_args: allow paths to non type consts)
 - #156062 (Added command-line argument support for `wasm32-wali-linux-musl`)
 - #156159 ([AIX] add -bdbg:namedsects:ss link arg)
 - #156174 (Wasm: remove implicit `__heap_base`/`__data_end` exports)
 - #156186 (fix: remap ci-llvm debug paths via `-ffile-prefix-map`)
 - #156193 (port `rustc_ast*` crates from `box_` to `deref_patterns`)
 - #156201 (Don't run ui-fulldeps tests twice in stage 1)
 - #155808 (Always use `ConstFn` context for `const` closures)
 - #156105 (interpret: correctly deal with repr(transparent) enums)
 - #156148 (Use `all_impls` instead of handrolling it)
 - #156156 (Adjust getMCSubtargetInfo signature for LLVM 23+)
 - #156170 (add known-bug test for coroutine 'static-yields-non-'static unsoundness (#144442))
 - #156195 (Move tests codegen)
 - #156205 (move generalization test)
rust-bors Bot pushed a commit that referenced this pull request May 6, 2026
Rollup of 15 pull requests

Successful merges:

 - #151122 (fix: more descriptive error message for enum to integer)
 - #155341 (generic_const_args: allow paths to non type consts)
 - #156062 (Added command-line argument support for `wasm32-wali-linux-musl`)
 - #156159 ([AIX] add -bdbg:namedsects:ss link arg)
 - #156174 (Wasm: remove implicit `__heap_base`/`__data_end` exports)
 - #156186 (fix: remap ci-llvm debug paths via `-ffile-prefix-map`)
 - #156193 (port `rustc_ast*` crates from `box_` to `deref_patterns`)
 - #156201 (Don't run ui-fulldeps tests twice in stage 1)
 - #155808 (Always use `ConstFn` context for `const` closures)
 - #156105 (interpret: correctly deal with repr(transparent) enums)
 - #156148 (Use `all_impls` instead of handrolling it)
 - #156156 (Adjust getMCSubtargetInfo signature for LLVM 23+)
 - #156170 (add known-bug test for coroutine 'static-yields-non-'static unsoundness (#144442))
 - #156195 (Move tests codegen)
 - #156205 (move generalization test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants