llvm-ar doesn't flatten thin archives
| Bugzilla Link | 37530 |
| Resolution | FIXED |
| Resolved on | Jan 14, 2019 13:13 |
| Version | trunk |
| OS | Linux |
| Attachments | resulting test2.a archive using llvm-ar, resulting test2.a archive using GNU ar |
| Reporter | LLVM Bugzilla Contributor |
| CC | @lalozano,@nickdesaulniers,@rupprecht,@stephenhines |
| Fixed by commit(s) | https://reviews.llvm.org/rL351120 |
Extended Description
The behavior of llvm-ar is not the same with GNU ar (from GNU binutils).
To reproduce this:
-
create two empty objects:
clang -c -x c /dev/null -o test1.o clang -c -x c /dev/null -o test2.o
-
archive the first object:
llvm-ar rcSTD test1.a test1.o
-
archive the second object together with the first archive:
llvm-ar rcsTD test2.a test2.o test1.a
-
check archive's contents:
llvm-ar t test2.a
Expected result:
test2.o and test1.o are in the archive
Actual result:
test2.o and test1.a are in the archive
If you use GNU ar instead of llvm-ar, you will get the expected result.
The relevant bit in GNU ar is here: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=binutils/binemul.c;h=894a915716ce39eaec167e93f2c7ad8346c15f99;hb=HEAD#l63
llvm-ar/libObject doesn't seem to flatten archive members.
assigned to @rupprecht