]> granicus.if.org Git - llvm/commit
[llvm-ar][libObject] Fix relative paths when nesting thin archives.
authorJordan Rupprecht <rupprecht@google.com>
Thu, 7 Feb 2019 16:41:06 +0000 (16:41 +0000)
committerJordan Rupprecht <rupprecht@google.com>
Thu, 7 Feb 2019 16:41:06 +0000 (16:41 +0000)
commit8f777ee63641701a1b410e705600cad0be694ed3
treeaf82562f0582d774b71da25df00e3457a55ed8dc
parent0bfb8d30864120a5a218f6e574391f5c6333b475
[llvm-ar][libObject] Fix relative paths when nesting thin archives.

Summary:
When adding one thin archive to another, we currently chop off the relative path to the flattened members. For instance, when adding `foo/child.a` (which contains `x.txt`) to `parent.a`, when flattening it we should add it as `foo/x.txt` (which exists) instead of `x.txt` (which does not exist).

As a note, this also undoes the `IsNew` parameter of handling relative paths in r288280. The unit test there still passes.

This was reported as part of testing the kernel build with llvm-ar: https://patchwork.kernel.org/patch/10767545/ (see the second point).

Reviewers: mstorsjo, pcc, ruiu, davide, david2050

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57842

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353424 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Object/ArchiveWriter.h
lib/Object/ArchiveWriter.cpp
test/tools/llvm-ar/flatten-thin-archive-directories.test [new file with mode: 0644]
test/tools/llvm-ar/flatten-thin-archive.test
tools/llvm-ar/llvm-ar.cpp