]> granicus.if.org Git - llvm/commit
[llvm-ar] Flatten thin archives.
authorJordan Rupprecht <rupprecht@google.com>
Mon, 14 Jan 2019 21:11:46 +0000 (21:11 +0000)
committerJordan Rupprecht <rupprecht@google.com>
Mon, 14 Jan 2019 21:11:46 +0000 (21:11 +0000)
commit19263d1daaa2bf8e37d530152ff52aeeabeb5278
treee7e5936958faab4a56cc870eb785e5a025695512
parent8c1bb502a7ec0fb6037ba2dc85b00e0970ec9dc4
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351120 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-ar/Inputs/a-plus-b.a [new file with mode: 0644]
test/tools/llvm-ar/Inputs/a.txt [new file with mode: 0644]
test/tools/llvm-ar/Inputs/b.txt [new file with mode: 0644]
test/tools/llvm-ar/Inputs/c.txt [new file with mode: 0644]
test/tools/llvm-ar/Inputs/d.txt [new file with mode: 0644]
test/tools/llvm-ar/Inputs/nested-thin-archive.a [new file with mode: 0644]
test/tools/llvm-ar/flatten-thin-archive-recursive.test [new file with mode: 0644]
test/tools/llvm-ar/flatten-thin-archive.test [new file with mode: 0644]
tools/llvm-ar/llvm-ar.cpp