Add one more "late metadata"/"digest" file to rlib archives
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
The file should contain data about:
- Native libraries bundled into the rlib, to avoid looking up native libraries during the regular "early" metadata construction, when it's unnecessary and cannot be done fully correctly (#138170)
- Object files bundled into the rlib, to support link time
cfgon native libraries bundled as object files - Rust object files in the rlib to avoid hacks like
looks_like_rust_object_fileduring LTO
Unlike regular metadata which is constructed early, this additional digest will be constructed and added to the archive in the very end, when all other members of the rlib archive are already added.
It is also going to be read only when rustc is going to link the rlib into something, not earlier.
The data could potentially use some text format like json, but it would probably be simpler to just use the same format as the regular metadata uses.
The implementation can also mirror what is done for regular metadata, in a simplified form.
Me and @belovdv wanted to do this when implementing +bundle,+whole-archive (https://github.com/rust-lang/rust/pull/113301) and packed_bundled_libs (https://github.com/rust-lang/rust/issues/108081), as a more principle solution, but ended up with just some workarounds instead, and never returned to this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how regular metadata is constructed and how members are added to an rlib archive, then review the context from PR #113301 and issue #108081. The finished work should add a late digest containing native libraries, bundled object files, and Rust object files, append it after other archive members, and read it only during linking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100