Skip to content
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

Remove dependency formats from crate metadata #96708

Open
bjorn3 opened this issue May 4, 2022 · 4 comments
Open

Remove dependency formats from crate metadata #96708

bjorn3 opened this issue May 4, 2022 · 4 comments
Labels
A-metadata Area: Crate metadata C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@bjorn3
Copy link
Member

bjorn3 commented May 4, 2022

It only really needs to be stored for dylibs and only the dependency format for said dylib and not for any other crate types also used. It can be stored in a separate section for dylibs. For example .rsdpfmt (needs to stay within the 8 char limit for COFF section names). Furthermore omitting it from the crate metadata is necessary for implementing bazelbuild/rules_rust#228 (comment) as otherwise the dependency formats included in the crate metadata of the first compilation wouldn't match the second compilation due to dylibs not being available yet. Not encoding it in the crate metadata may also improve performance a tiny bit although rlib only crates already encode an empty list anyway.

@bjorn3 bjorn3 added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-metadata Area: Crate metadata labels May 4, 2022
@davidbarsky
Copy link
Contributor

I was talking to @jsgf about this issue, but I had two questions:

To summarize/get everyone on the same page, the reason that @jsgf took the "hollow .rlib" approach (as described in bazelbuild/rules_rust#228 (comment)) was that BuckV2's rules allows for reusing the generated .rlib across the equivalent of Buck's cargo check and cargo build flavors (Jeremy allude to that in the comment, but I didn't pick up on that until he made it explicit to me).

(On an aside, I've noticed that the approach that Jeremy took incurs about 20-30% more overhead compared to emitting plain metadata, so maybe resolving this issue can hopefully reduce that discrepancy.)

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 21, 2022

Currently the crate metadata is shared between all crate types. For dylibs we still need to store the dylib dependency formats. I think the best way is to store it in an additional section of the dylib and then remove it from the main crate metadata. I don't think this interacts with MIR-only rlibs at all.

@jsgf
Copy link
Contributor

jsgf commented Sep 21, 2022

Just to make sure we're all talking about the same thing, "dependency format" just means this right?

That's only linkages and crate types, so there's no hashes or any other identifiers of specific crates. So @davidbarsky I don't think this is relevant to any of the things we're talking about.

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 21, 2022

Just to make sure we're all talking about the same thing, "dependency format" just means this right?

Correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metadata Area: Crate metadata C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants