llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

llvm-ar doesn't flatten thin archives

Open llvmbot opened this issue 8 years ago • 2 comments

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:

  1. create two empty objects:

    clang -c -x c /dev/null -o test1.o clang -c -x c /dev/null -o test2.o

  2. archive the first object:

    llvm-ar rcSTD test1.a test1.o

  3. archive the second object together with the first archive:

    llvm-ar rcsTD test2.a test2.o test1.a

  4. 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.

llvmbot avatar May 19 '18 11:05 llvmbot

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.

rupprecht avatar Jan 07 '19 22:01 rupprecht

assigned to @rupprecht

llvmbot avatar May 19 '18 11:05 llvmbot