Skip to content

Move NativeLib::filename to the rmeta-link archive member#156735

Open
mehdiakiki wants to merge 1 commit into
rust-lang:mainfrom
mehdiakiki:fix/rlib-digest
Open

Move NativeLib::filename to the rmeta-link archive member#156735
mehdiakiki wants to merge 1 commit into
rust-lang:mainfrom
mehdiakiki:fix/rlib-digest

Conversation

@mehdiakiki

@mehdiakiki mehdiakiki commented May 19, 2026

Copy link
Copy Markdown
Contributor

View all comments

Second PR in #138243
Moves NativeLib::filename out of rmeta into lib.rmeta-link archive member that was introduced in the first PR. Filename is a link time only data so requiring a full metadata decode should be avoided. It is stored as (name, filename) pairs keyed by name, the new MetadataLoader::get_rlib_native_lib_filenames patches it back on decode. Also bumped METADATA_VERSION from version 10 to 11. Added also new round trip test and existing bundled-libs tests still pass.

@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 19, 2026
@rustbot

rustbot commented May 19, 2026

Copy link
Copy Markdown
Collaborator

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 19 candidates

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@mehdiakiki

Copy link
Copy Markdown
Contributor Author

r? @petrochenkov
cc @bjorn3

Comment thread tests/run-make/rlib-rmeta-link-native-lib-filenames/rmake.rs Outdated
Comment thread compiler/rustc_metadata/src/rmeta/mod.rs Outdated
Comment thread compiler/rustc_session/src/cstore.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/rmeta_link.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/link.rs Outdated
@petrochenkov petrochenkov 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 19, 2026
@mehdiakiki

Copy link
Copy Markdown
Contributor Author

Started working on it today. Should have it ready soon.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. labels Jul 2, 2026
@petrochenkov petrochenkov added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 3, 2026
Comment thread compiler/rustc_codegen_ssa/src/back/rmeta_link.rs
Comment thread compiler/rustc_codegen_ssa/src/back/link.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/link.rs Outdated
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 3, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 3, 2026
Move NativeLib::filename to the rmeta-link archive member
@petrochenkov petrochenkov 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 Jul 3, 2026
@rust-bors

rust-bors Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 2f75410 (2f7541075058da7aa2a74d202935f2d3b0e07464)
Base parent: c397dae (c397dae808f70caebab1fc4e11b3edf7e59f58c7)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2f75410): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (secondary -2.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-6.4%, -2.6%] 4
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 485.944s -> 486.779s (0.17%)
Artifact size: 393.37 MiB -> 393.32 MiB (-0.01%)

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Jul 3, 2026
@mehdiakiki

Copy link
Copy Markdown
Contributor Author

Resolved the conflicts
@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 Jul 3, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

Could you address the review comments (#156735 (comment) and below)?
@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 Jul 6, 2026
@mehdiakiki

Copy link
Copy Markdown
Contributor Author

@petrochenkov Yes sure!

&& let Some(rlib_path) = crate_info.used_crate_source[&cnum].rlib.as_ref()
{
bundled_libs = rmeta_link_cache
.get_or_insert_with(rlib_path, || {

@petrochenkov petrochenkov Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • fn native_lib_filenames can be used here too
  • fn read_from_path can be made private
  • fn crate_may_have_bundled_libs can be merged into fn native_lib_filenames

View changes since the review

@mehdiakiki

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 9, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

#156735 (comment)
@rustbot author

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

7 participants