gimli-rs / object

A unified interface for reading and writing object file formats
https://docs.rs/object/
Apache License 2.0
673 stars 156 forks source link

Support reading thin archives #648

Closed bjorn3 closed 8 months ago

bjorn3 commented 8 months ago

This is necessary to fix https://github.com/rust-lang/rust/issues/107407 and allow moving rustc from LLVM's archive writer to ar_archive_writer again. The api for this should probably not directly read the member contents from the disk, but only parse the thin archive to get the member names (and optionally read the symbol table) to allow the consumer of this api to read them from the disk as necessary.

philipc commented 8 months ago

651 has thin archive support. What do you need for symbol table support? The symbol table contains a list of member offsets and symbol names. I can provide an iterator that returns those, and an ArchiveFile method to return a member at a given offset. Is that sufficient?

bjorn3 commented 8 months ago

The symbol table of the original archives is not currently used by the archive writer in rustc. It unconditionally looks directly at the object files. So at least for now reading the symbol table is not necessary.

philipc commented 8 months ago

I'll leave symbol table support for #479