]> git.lizzy.rs Git - rust.git/commit
rustc: Handle duplicate names merging archives
authorAlex Crichton <alex@alexcrichton.com>
Tue, 14 Apr 2015 23:28:50 +0000 (16:28 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 21 Apr 2015 18:08:19 +0000 (11:08 -0700)
commit9ab0475d940342a670ad323c151db565e6318e08
tree90805d59b9a8cde5071c3591a8f4ace0103973dc
parent77acda1c8ee75f9eb923ddd811ee591951b2d43f
rustc: Handle duplicate names merging archives

When linking an archive statically to an rlib, the compiler will extract all
contents of the archive and add them all to the rlib being generated. The
current method of extraction is to run `ar x`, dumping all files into a
temporary directory. Object archives, however, are allowed to have multiple
entries with the same file name, so there is no method for them to extract their
contents into a directory in a lossless fashion.

This commit adds iterator support to the `ArchiveRO` structure which hooks into
LLVM's support for reading object archives. This iterator is then used to
inspect each object in turn and extract it to a unique location for later
assembly.
12 files changed:
src/librustc/metadata/loader.rs
src/librustc_back/archive.rs
src/librustc_back/lib.rs
src/librustc_llvm/archive_ro.rs
src/librustc_llvm/lib.rs
src/librustc_trans/back/lto.rs
src/rustllvm/RustWrapper.cpp
src/test/run-make/archive-duplicate-names/Makefile [new file with mode: 0644]
src/test/run-make/archive-duplicate-names/bar.c [new file with mode: 0644]
src/test/run-make/archive-duplicate-names/bar.rs [new file with mode: 0644]
src/test/run-make/archive-duplicate-names/foo.c [new file with mode: 0644]
src/test/run-make/archive-duplicate-names/foo.rs [new file with mode: 0644]