Skip to content

Fix -Zremap-path-scope rmeta handling #139550

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

Merged
merged 1 commit into from
May 6, 2025

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Apr 8, 2025

This PR fixes the conditional remapping (-Zremap-path-scope) of rmeta file paths by using the debuginfo scope by conditionally embedding the local path in addition to the remapped path.

Fixes #139217

@rustbot
Copy link
Collaborator

rustbot commented Apr 8, 2025

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented Apr 8, 2025

This PR modifies run-make tests.

cc @jieyouxu

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs 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 Apr 8, 2025
Copy link
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

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

Looks fine to me but I'm not an expert here and I'm wondering if it needs to be DEBUGINFO | DIAGNOSTICS over just DEBUGINFO.

@Urgau Urgau added S-blocked Status: Blocked on something else such as an RFC or other implementation work. 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. S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Apr 11, 2025
@Urgau Urgau force-pushed the rmeta-remap-path-scope branch from 4dcb816 to 4361d4f Compare April 19, 2025 11:31
@Urgau
Copy link
Member Author

Urgau commented Apr 19, 2025

After more investigation I was finally able to figure out the real issue, when we embed the paths in the rmeta files we call PathMapping::to_embeddable_absolute_path, that function does the necessary to create a remapped path when possible BUT when doing so that function does not keep the original un-remapped path.

This was done before -Zremap-path-scope introduction and means that when we are in a subsequent crate we only have access to the remapped path even through we might want the un-remapped path (depending on the remap path scope), which lead to the issue described in #139217 where the path of the dependency was un-conditionaly the remapped one, because that's all we got.

I've added to PathMapping and PathMapping::to_embeddable_absolute_path some logic to keep the local path when not all remap path scope are requested, as to keep rlib and rmeta free of local path when only --remap-path-prefix is passed (privacy and build reproducibility reasons).

@rustbot labels -S-blocked -S-waiting-on-author +S-waiting-on-review

@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 Apr 19, 2025
@fmease
Copy link
Member

fmease commented May 1, 2025

I don't have the capacity to properly review this right now and verify everything is correct.
r? compiler

@rustbot rustbot assigned estebank and unassigned fmease May 1, 2025
@fmease
Copy link
Member

fmease commented May 1, 2025

Esteban isn't that active rn afaik.
r? compiler

@rustbot rustbot assigned nnethercote and unassigned estebank May 1, 2025
@Urgau Urgau force-pushed the rmeta-remap-path-scope branch from 4361d4f to 7b89535 Compare May 1, 2025 22:59
@nnethercote
Copy link
Contributor

I'm no expert on this stuff, but the code seems fine and you've added plenty of tests, which is great. r=me with the typos fixed.

@bors delegate=Urgau

@bors
Copy link
Collaborator

bors commented May 5, 2025

✌️ @Urgau, you can now approve this pull request!

If @nnethercote told you to "r=me" after making some further change, please make that change, then do @bors r=@nnethercote

@nnethercote
Copy link
Contributor

@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, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 5, 2025

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

@Urgau Urgau force-pushed the rmeta-remap-path-scope branch from 7b89535 to 6a7996e Compare May 5, 2025 17:46
@Urgau
Copy link
Member Author

Urgau commented May 5, 2025

@bors r=@nnethercote

@bors
Copy link
Collaborator

bors commented May 5, 2025

📌 Commit 6a7996e has been approved by nnethercote

It is now in the queue for this repository.

@bors bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 5, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request May 6, 2025
…ethercote

Fix `-Zremap-path-scope` rmeta handling

This PR fixes the conditional remapping (`-Zremap-path-scope`) of rmeta file paths ~~by using the `debuginfo` scope~~ by conditionally embedding the local path in addition to the remapped path.

Fixes rust-lang#139217
bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
Rollup of 12 pull requests

Successful merges:

 - rust-lang#139550 (Fix `-Zremap-path-scope` rmeta handling)
 - rust-lang#139773 (Implement `Iterator::last` for `vec::IntoIter`)
 - rust-lang#140035 (Implement RFC 3503: frontmatters)
 - rust-lang#140176 (Fix linking statics on Arm64EC)
 - rust-lang#140251 (coverage-dump: Resolve global file IDs to filenames)
 - rust-lang#140393 (std: get rid of `sys_common::process`)
 - rust-lang#140532 (Fix RustAnalyzer discovery of rustc's `stable_mir` crate)
 - rust-lang#140598 (Steer docs to `utf8_chunks` and `Iterator::take`)
 - rust-lang#140634 (Use more accurate ELF flags on MIPS)
 - rust-lang#140673 (Clean rustdoc tests folder)
 - rust-lang#140678 (Be a bit more relaxed about not yet constrained infer vars in closure upvar analysis)
 - rust-lang#140687 (Update mdbook to 0.4.49)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
Rollup of 12 pull requests

Successful merges:

 - rust-lang#139550 (Fix `-Zremap-path-scope` rmeta handling)
 - rust-lang#139764 (Consistent trait bounds for ExtractIf Debug impls)
 - rust-lang#139773 (Implement `Iterator::last` for `vec::IntoIter`)
 - rust-lang#140035 (Implement RFC 3503: frontmatters)
 - rust-lang#140251 (coverage-dump: Resolve global file IDs to filenames)
 - rust-lang#140393 (std: get rid of `sys_common::process`)
 - rust-lang#140532 (Fix RustAnalyzer discovery of rustc's `stable_mir` crate)
 - rust-lang#140598 (Steer docs to `utf8_chunks` and `Iterator::take`)
 - rust-lang#140634 (Use more accurate ELF flags on MIPS)
 - rust-lang#140673 (Clean rustdoc tests folder)
 - rust-lang#140678 (Be a bit more relaxed about not yet constrained infer vars in closure upvar analysis)
 - rust-lang#140687 (Update mdbook to 0.4.49)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 01cbc86 into rust-lang:master May 6, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone May 6, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
Rollup merge of rust-lang#139550 - Urgau:rmeta-remap-path-scope, r=nnethercote

Fix `-Zremap-path-scope` rmeta handling

This PR fixes the conditional remapping (`-Zremap-path-scope`) of rmeta file paths ~~by using the `debuginfo` scope~~ by conditionally embedding the local path in addition to the remapped path.

Fixes rust-lang#139217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs 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.

-Zremap-path-scope=macro still remaps inlined ELF symbols
7 participants