[lld] r313832 - Include thin --whole-archive members in --reproduce.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 15:59:51 PDT 2017
Author: rafael
Date: Wed Sep 20 15:59:50 2017
New Revision: 313832
URL: http://llvm.org/viewvc/llvm-project?rev=313832&view=rev
Log:
Include thin --whole-archive members in --reproduce.
We were only including the thin archive members used via a lazy symbol
before.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/test/ELF/reproduce-thin-archive.s
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=313832&r1=313831&r2=313832&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Sep 20 15:59:50 2017
@@ -128,6 +128,7 @@ std::vector<std::pair<MemoryBufferRef, u
std::vector<std::pair<MemoryBufferRef, uint64_t>> V;
Error Err = Error::success();
+ bool AddToTar = File->isThin() && Tar;
for (const ErrorOr<Archive::Child> &COrErr : File->children(Err)) {
Archive::Child C =
check(COrErr, MB.getBufferIdentifier() +
@@ -136,6 +137,8 @@ std::vector<std::pair<MemoryBufferRef, u
check(C.getMemoryBufferRef(),
MB.getBufferIdentifier() +
": could not get the buffer for a child of the archive");
+ if (AddToTar)
+ Tar->append(relativeToRoot(check(C.getFullName())), MBRef.getBuffer());
V.push_back(std::make_pair(MBRef, C.getChildOffset()));
}
if (Err)
Modified: lld/trunk/test/ELF/reproduce-thin-archive.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/reproduce-thin-archive.s?rev=313832&r1=313831&r2=313832&view=diff
==============================================================================
--- lld/trunk/test/ELF/reproduce-thin-archive.s (original)
+++ lld/trunk/test/ELF/reproduce-thin-archive.s Wed Sep 20 15:59:50 2017
@@ -5,11 +5,17 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.dir/foo.o
# RUN: cd %t.dir
# RUN: llvm-ar --format=gnu rcT foo.a foo.o
+
# RUN: ld.lld -m elf_x86_64 foo.a -o bar --reproduce repro.tar
# RUN: tar xf repro.tar
# RUN: diff foo.a repro/%:t.dir/foo.a
# RUN: diff foo.o repro/%:t.dir/foo.o
+# RUN: ld.lld -m elf_x86_64 --whole-archive foo.a -o bar --reproduce repro2.tar
+# RUN: tar xf repro2.tar
+# RUN: diff foo.a repro2/%:t.dir/foo.a
+# RUN: diff foo.o repro2/%:t.dir/foo.o
+
.globl _start
_start:
nop
More information about the llvm-commits
mailing list