Skip to content

tests: extend remap-path-prefix-std to all stdlib rlibs#156570

Open
paradoxicalguy wants to merge 3 commits into
rust-lang:mainfrom
paradoxicalguy:test-extend-rmake-clean
Open

tests: extend remap-path-prefix-std to all stdlib rlibs#156570
paradoxicalguy wants to merge 3 commits into
rust-lang:mainfrom
paradoxicalguy:test-extend-rmake-clean

Conversation

@paradoxicalguy

@paradoxicalguy paradoxicalguy commented May 14, 2026

Copy link
Copy Markdown
Contributor

View all comments

problem:

the current remap-path-prefix-std run-make test validates path remapping for libstd.rlib, which leaves the rest of the distributed stdlib artifacts unchecked.

fix:

generalizing the test to go over over all distributed .rlib files found in the target sysroot libdir instead of checking only the libstd.

result:

improves reproducibility coverage for distributed stdlib artifacts.

r? @Urgau

@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 May 14, 2026
Comment thread tests/run-make/remap-path-prefix-std/rmake.rs
@rust-log-analyzer

This comment has been minimized.

@paradoxicalguy
paradoxicalguy force-pushed the test-extend-rmake-clean branch from 4c83da0 to 6a3fc8b Compare May 14, 2026 13:28
@Urgau

Urgau commented May 14, 2026

Copy link
Copy Markdown
Member

@bors try jobs=dist-x86_64-linux

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 14, 2026
tests: extend remap-path-prefix-std to all stdlib rlibs


try-job: dist-x86_64-linux
@rust-bors

rust-bors Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 8d33ecc (8d33ecc7330a13730e8a40214401163109712e5d, parent: 1a70f8d36e818b45829a5c065fd6004c9047e8d1)

@Urgau

Urgau commented May 14, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 6a3fc8b 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 14, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 14, 2026
…lean, r=Urgau

tests: extend remap-path-prefix-std to all stdlib rlibs

### problem:
the current `remap-path-prefix-std` run-make test validates path remapping for `libstd.rlib`, which leaves the rest of the distributed `stdlib` artifacts unchecked.

### fix:
generalizing the test to go over over all distributed `.rlib` files found in the target `sysroot libdir` instead of checking only the `libstd`.

### result:
improves reproducibility coverage for distributed `stdlib` artifacts.

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request May 14, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #156452 (Implement pinned drop sugar)
 - #156571 (Disable `main_needs_argc_argv` for Wasm)
 - #156565 (delegation: emit error when self type is not specified and accessed)
 - #156570 (tests: extend remap-path-prefix-std to all stdlib rlibs)
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors r-
#156584 (comment)

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 15, 2026
@rust-bors

rust-bors Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#156584), which was unapproved.

View changes since this unapproval

Comment thread tests/run-make/remap-path-prefix-std/rmake.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@paradoxicalguy
paradoxicalguy force-pushed the test-extend-rmake-clean branch from 94d97b7 to afa7f77 Compare May 15, 2026 09:29
@Urgau

Urgau commented May 15, 2026

Copy link
Copy Markdown
Member

Let's do a quick try run to be sure.

@bors try jobs=dist-i586-gnu-i586-i686-musl

rust-bors Bot pushed a commit that referenced this pull request May 15, 2026
tests: extend remap-path-prefix-std to all stdlib rlibs


try-job: dist-i586-gnu-i586-i686-musl
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

💔 Test for e47907c failed: CI. Failed job:

rust-bors Bot pushed a commit that referenced this pull request Jul 15, 2026
tests: extend remap-path-prefix-std to all stdlib rlibs
@rust-bors

rust-bors Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

✌️ @paradoxicalguy, you can now perform try builds on this pull request!

Warning

You used the legacy format of the delegate command.
The new format is @bors delegate[=<username>] [<try|review>].

You can now post @bors try to start a try build.

@paradoxicalguy

Copy link
Copy Markdown
Contributor Author

yay thank you!

@rust-bors

rust-bors Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c4ab863 (c4ab863e358eb59a031d1e2fcc6ef12157ca0eae)
Base parent: 2118366 (2118366bbfe2e57ec0e8417ea270833e9f013640)

@paradoxicalguy

Copy link
Copy Markdown
Contributor Author

@bors try jobs=dist-i586-gnu-i586-i686-musl

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 15, 2026
tests: extend remap-path-prefix-std to all stdlib rlibs


try-job: dist-i586-gnu-i586-i686-musl
@rust-bors

rust-bors Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 6b1fa23 failed: CI. Failed job:

@rustbot

rustbot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

@paradoxicalguy

Copy link
Copy Markdown
Contributor Author

@bors try jobs=dist-i586-gnu-i586-i686-musl

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 16, 2026
tests: extend remap-path-prefix-std to all stdlib rlibs


try-job: dist-i586-gnu-i586-i686-musl
@rust-bors

rust-bors Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

💔 Test for b3b0fe2 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

compiler-builtins is developed in its own repository. If possible, consider making this change to rust-lang/compiler-builtins instead.

cc @tgross35

@rustbot rustbot added the A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) label Jul 17, 2026
@paradoxicalguy

Copy link
Copy Markdown
Contributor Author

@bors try jobs=dist-i586-gnu-i586-i686-musl

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 17, 2026
tests: extend remap-path-prefix-std to all stdlib rlibs


try-job: dist-i586-gnu-i586-i686-musl
@rust-bors

rust-bors Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 32d8583 (32d8583df382b763630da17b83d38ed4532a3f94)
Base parent: 4a9d536 (4a9d5368df6450bbd2fc8dde4508c3e5d83bb19d)

@paradoxicalguy

Copy link
Copy Markdown
Contributor Author

FINALLY 🎉
tho can we get a final code review for both files? if they are good to go, i'll open the compiler-builtins PR first.

@Urgau @tgross35

Comment thread library/compiler-builtins/compiler-builtins/build.rs
Comment thread library/compiler-builtins/compiler-builtins/build.rs
Comment thread library/compiler-builtins/compiler-builtins/build.rs
Comment on lines +544 to +549
let commit_hash = debuginfo_map
.split('\t')
.next()
.and_then(|first| first.split("/rustc/").nth(1))
.and_then(|s| s.split('/').next())
.map(String::from);

@Urgau Urgau Jul 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we do this extraction? Looking at #t-compiler > Checking reproducibility of rustc @ 💬 I feel like we could just apply all remapping like we do for llvm, no?

// Remap ci-llvm include paths in debug info for reproducible builds.
if let Some(maps) = tracked_env_var_os("RUSTC_DEBUGINFO_MAP")
&& let Some(maps_str) = maps.to_str()
{
for map in maps_str.split('\t') {
cfg.flag_if_supported(&format!("-ffile-prefix-map={map}"));
}
}

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wait i'll test this one rn, thanks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

tested this: switched to -ffile-prefix-map, looping over all RUSTC_DEBUGINFO_MAP entries like rustc_llvm's build.rs does.
added one extra mapping for the crate's own manifest dir since it's not covered by the existing entries.
removed the old line-538 mapping since it was conflicting with this.
verified via llvm-dwarfdump: all comp_dir entries now show /rustc/<hash>, no leaked paths.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm surprised the crate own manifest dir is still necessary, but oh well, if it works.

Ping me when you push.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mb it doesnt need a strict manifest dir
removing it gives: DW_AT_comp_dir ("/rustc/08f62523b1c3262cc2f0288a3369b760ab4bda45/library/compiler-builtins/compiler-builtins").
instead of the shorter DW_AT_comp_dir ("/rustc/08f62523b1c3262cc2f0288a3369b760ab4bda45").
no path leak tho. happy to keep code or drop it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well, the first DW_AT_comp_dir is more inline with what I would expect, to be honest. I would say, let's drop it, that makes the code simpler and clearer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure, i'll open a separate pr first

@paradoxicalguy

Copy link
Copy Markdown
Contributor Author

why bootstrap doesn't just thread this through CFLAGS/CXXFLAGS instead of the custom RUSTC_DEBUGINFO_MAP env var. does the same cargo#4423 forwarding issue apply to CFLAGS/CXXFLAGS too, or is there another reason bootstrap doesn't use them here?

@Urgau

Urgau commented Jul 19, 2026

Copy link
Copy Markdown
Member

That's a very good point, I didn't think of that. Turns out we already even have such remapping flags set in

rust/src/bootstrap/src/lib.rs

Lines 1323 to 1332 in 9f36de7

if let Some(map_to) = self.debuginfo_map_to(which, RemapScheme::NonCompiler) {
let map = format!("{}={}", self.src.display(), map_to);
let cc = self.cc(target);
if cc.ends_with("clang") || cc.ends_with("gcc") {
base.push(format!("-fdebug-prefix-map={map}"));
} else if cc.ends_with("clang-cl.exe") {
base.push("-Xclang".into());
base.push(format!("-fdebug-prefix-map={map}"));
}
}

let env = format!("CFLAGS_{triple_underscored}");

I wonder why it's not working then, could it be because we only set it for the target?

@paradoxicalguy

paradoxicalguy commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

mark was asking here
rust-lang/compiler-builtins#1236 (comment) .

and found it, cc_unhandled_cflags only pushes -fdebug-prefix-map if cc.ends_with("clang") || cc.ends_with("gcc"). my CC resolves to plain "cc" (common symlink), which doesn't match either suffix, so the flag never gets added.
not a target-scoping issue looks like a gap in that string check.

@paradoxicalguy

paradoxicalguy commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

i tried it with

if cc.ends_with("clang")
                || cc.ends_with("gcc")
                || cc.file_name().is_some_and(|f| f == "cc")
            {
                base.push(format!("-fdebug-prefix-map={map}"));
           }

while reverting the compiler-builtins as it was (only build.flag_if_supported(&format!("-ffile-prefix-map={}=.", root.display()));)

final result gives:
/rustc/08f62523b1c3262cc2f0288a3369b760ab4bda45/library/compiler-builtins/compiler-builtins

the remap-path-prefix-std run-make test also passes with just the bootstrap change locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

6 participants