Skip to content

rustc_codegen_ssa: Refactor ArchiveEntry to include entry kind#157263

Open
petrochenkov wants to merge 1 commit into
rust-lang:mainfrom
petrochenkov:arentry
Open

rustc_codegen_ssa: Refactor ArchiveEntry to include entry kind#157263
petrochenkov wants to merge 1 commit into
rust-lang:mainfrom
petrochenkov:arentry

Conversation

@petrochenkov
Copy link
Copy Markdown
Contributor

Needed for #155338 in particular.

r? @bjorn3

@rustbot rustbot added 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 Jun 1, 2026
.map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;
let metadata_link =
skip.as_ref().and_then(|_| rmeta_link::read(&archive, &archive_map, &archive_path));
let metadata_link = rmeta_link::read(&archive, &archive_map, &archive_path);
Copy link
Copy Markdown
Contributor Author

@petrochenkov petrochenkov Jun 1, 2026

Choose a reason for hiding this comment

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

We always try to read the link-metadata now.

Right now skip happens to be always Some for Rust rlibs and always None for native libs, so the previous optimization happened to be correct.
We could potentially reinstate the optimization and add a comment saying that skip must always be Some for Rust rlibs, but it's probably not that useful for performance in practice.

View changes since the review

}

// Skip objects for bundled libs.
if bundled_libs.contains(&Symbol::intern(fname)) {
Copy link
Copy Markdown
Contributor Author

@petrochenkov petrochenkov Jun 1, 2026

Choose a reason for hiding this comment

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

From this function we can see that it would be also useful to track at least ArchiveEntryKind::Rmeta and ArchiveEntryKind::BundledNativeLib.

But in general, it would probably make sense to get rid of ArchiveEntryKind::Other and keep the full "entry name -> entry kind" table in the link-metadata.

View changes since the review

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

Labels

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.

3 participants