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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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-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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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