Skip to content

Replace vendored ar module with ar_archive_writer#26

Merged
messense merged 2 commits intomainfrom
replace-vendored-ar-with-ar-archive-writer
Apr 23, 2026
Merged

Replace vendored ar module with ar_archive_writer#26
messense merged 2 commits intomainfrom
replace-vendored-ar-with-ar-archive-writer

Conversation

@messense
Copy link
Copy Markdown
Owner

  • MSVC path: delegate entirely to ar_archive_writer::write_import_library, reducing msvc.rs from ~1250 lines to ~80 lines. ARM64EC mangling, import descriptors, null thunks, short imports, and weak externals are all handled by the upstream crate.

  • GNU path: replace vendored ar::GnuBuilder with ar_archive_writer::write_archive_to_stream. The ObjectFactory that builds COFF .o members is kept; only the archive assembly changes.

  • Delete src/ar/ (vendored fork of the ar crate) entirely.

  • Remove the now-unused ArchiveMember.symbols field and related tracking code.

Output is bit-identical to the previous implementation and to llvm-dlltool. Verified linking with both lld-link (rust-lld) and mingw-w64 ld.

Closes #15

- MSVC path: delegate entirely to ar_archive_writer::write_import_library,
  reducing msvc.rs from ~1250 lines to ~80 lines. ARM64EC mangling,
  import descriptors, null thunks, short imports, and weak externals
  are all handled by the upstream crate.

- GNU path: replace vendored ar::GnuBuilder with
  ar_archive_writer::write_archive_to_stream. The ObjectFactory that
  builds COFF .o members is kept; only the archive assembly changes.

- Delete src/ar/ (vendored fork of the ar crate) entirely.

- Remove the now-unused ArchiveMember.symbols field and related
  tracking code.

Output is bit-identical to the previous implementation and to
llvm-dlltool. Verified linking with both lld-link (rust-lld) and
mingw-w64 ld.
@messense messense force-pushed the replace-vendored-ar-with-ar-archive-writer branch from 57c73f5 to b1b0318 Compare April 23, 2026 10:55
ar_archive_writer 0.5.1 is synced with LLVM 20.1.8, so the
bit-identical comparison needs a matching llvm-dlltool version.
The default ubuntu llvm package (v18) produces different output.
@messense messense merged commit 2465d47 into main Apr 23, 2026
6 checks passed
@messense messense deleted the replace-vendored-ar-with-ar-archive-writer branch April 23, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

possibility of un-bundling "ar" and upstreaming downstream changes

1 participant