diff options
| author | Jordan Rupprecht <rupprecht@google.com> | 2019-01-14 21:11:46 +0000 |
|---|---|---|
| committer | Jordan Rupprecht <rupprecht@google.com> | 2019-01-14 21:11:46 +0000 |
| commit | 93bfb99ffc7ea9c828c3679ecc61719de453a8d0 (patch) | |
| tree | 0f5690ea2ed97184230079809ef018744c3bed51 /llvm/test/tools/llvm-ar/flatten-thin-archive.test | |
| parent | add3080cb95d1ccd3ec41c1a1d1c5f21fe32060a (diff) | |
| download | bcm5719-llvm-93bfb99ffc7ea9c828c3679ecc61719de453a8d0.tar.gz bcm5719-llvm-93bfb99ffc7ea9c828c3679ecc61719de453a8d0.zip | |
[llvm-ar] Flatten thin archives.
Summary:
Normal behavior for GNU ar is to flatten thin archives when adding them to another thin archive, i.e. add the members directly instead of nesting the archive.
Some refactoring done as part of this patch to ease things:
- Consolidate `addMember`/`addLibMember` methods
- Rename `addMember` to `addChildMember` to make it more visibly different at the call site that an archive child is passed instead of a regular member
- Pass in a separate vector and splice it back into position instead of passing a vector + optional Pos (which makes expanding libs tricky)
This fixes PR37530 as raised by https://github.com/ClangBuiltLinux/linux/issues/279.
Reviewers: mstorsjo, pcc, ruiu
Reviewed By: mstorsjo
Subscribers: llvm-commits, tpimh, nickdesaulniers
Differential Revision: https://reviews.llvm.org/D56508
llvm-svn: 351120
Diffstat (limited to 'llvm/test/tools/llvm-ar/flatten-thin-archive.test')
| -rw-r--r-- | llvm/test/tools/llvm-ar/flatten-thin-archive.test | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-ar/flatten-thin-archive.test b/llvm/test/tools/llvm-ar/flatten-thin-archive.test new file mode 100644 index 00000000000..430f48fe7c4 --- /dev/null +++ b/llvm/test/tools/llvm-ar/flatten-thin-archive.test @@ -0,0 +1,18 @@ +# This test creates a thin archive that contains a thin archive, a regular +# archive, and a file. +# +# The inner thin archive should be flattened, but the regular archive should +# not. The order of members in the archive should match the input order, with +# flattened members appearing together. + +RUN: touch %t-a.txt %t-b.txt %t-c.txt %t-d.txt %t-e.txt +RUN: rm -f %t-a-plus-b.a %t.a +RUN: llvm-ar rcsT %t-a-plus-b.a %t-a.txt %t-b.txt +RUN: llvm-ar rcs %t-d-plus-e.a %t-d.txt %t-e.txt +RUN: llvm-ar rcsT %t.a %t-a-plus-b.a %t-c.txt %t-d-plus-e.a +RUN: llvm-ar t %t.a | FileCheck %s + +CHECK: a.txt +CHECK-NEXT: b.txt +CHECK-NEXT: c.txt +CHECK-NEXT: -d-plus-e.a |

