Skip to content

make rlib object names deterministic - #165202

Open
paradoxicalguy wants to merge 3 commits into
rust-lang:mainfrom
paradoxicalguy:fix/deterministic-rlib-members
Open

paradoxicalguy wants to merge 3 commits into
rust-lang:mainfrom
paradoxicalguy:fix/deterministic-rlib-members

Conversation

@paradoxicalguy

@paradoxicalguy paradoxicalguy commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

fixes #165736

previously, rustc's random temporary object filenames leaked into .rlib archive member names and lib.rmeta-link.
with debuginfo enabled, absolute temporary paths also leaked into CodeView S_OBJNAME, making builds non-reproducible.

this change uses stable object names in archives, metadata, and CodeView while keeping temporary files unchanged.

result: byte-identical .rlibs across different build directories, tested with 16 CGUs and -Cdebuginfo=2.
regression test: extended tests/run-make/reproducible-rlib-object-names with a test that compiles duplicate-named dependencies with distinct metadata and swapped -C extra-filename values, verifying that the resulting binaries are bit-for-bit identical under both ThinLTO and FatLTO.

r? @bjorn3

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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 Oct 30, 2026
@rust-log-analyzer

This comment has been minimized.

@paradoxicalguy
paradoxicalguy force-pushed the fix/deterministic-rlib-members branch from 153421a to f2cf989 Compare October 30, 2026 19:13
@rust-log-analyzer

This comment has been minimized.

@paradoxicalguy

Copy link
Copy Markdown
Member Author

:/ okay

@paradoxicalguy
paradoxicalguy force-pushed the fix/deterministic-rlib-members branch from f2cf989 to a634851 Compare October 30, 2026 21:39
@paradoxicalguy

Copy link
Copy Markdown
Member Author

updated the tests affected by the new deterministic object naming; adjusted the expected diagnostics in lto-duplicate-symbols, archive member matching in cross-lang-lto, and llvm ir filename matching in pgo-embed-bc-lto.

validated locally on with the full run-make, ui, incremental, llvm codegen, and codegen-units suites

@rust-bors

This comment has been minimized.

@paradoxicalguy
paradoxicalguy force-pushed the fix/deterministic-rlib-members branch from a634851 to 24b5f82 Compare November 1, 2026 11:42
@rustbot

rustbot commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@paradoxicalguy

Copy link
Copy Markdown
Member Author

@bjorn3
image

@rust-log-analyzer

This comment has been minimized.

@paradoxicalguy

Copy link
Copy Markdown
Member Author

bors r+ --skip-ci --direct-prod

@paradoxicalguy

Copy link
Copy Markdown
Member Author

@rustbot reroll

@rustbot rustbot assigned JonathanBrouwer and unassigned bjorn3 Nov 28, 2026

This branch has not been deployed

No deployments
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. 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.

rustc: LTO link order depends on -C extra-filename w/ dupe crate deps

5 participants