diff options
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 3 | ||||
| -rw-r--r-- | lld/test/ELF/reproduce-thin-archive.s | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index d23aa118f61..66a9c2e89d2 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -372,6 +372,9 @@ MemoryBufferRef ArchiveFile::getMember(const Archive::Symbol *Sym) { if (!Seen.insert(C.getChildOffset()).second) return MemoryBufferRef(); + if (!Config->Reproduce.empty() && C.getParent()->isThin()) + copyInputFile(check(C.getFullName())); + return check(C.getMemoryBufferRef(), "could not get the buffer for the member defining symbol " + Sym->getName()); diff --git a/lld/test/ELF/reproduce-thin-archive.s b/lld/test/ELF/reproduce-thin-archive.s new file mode 100644 index 00000000000..cf340cb49a3 --- /dev/null +++ b/lld/test/ELF/reproduce-thin-archive.s @@ -0,0 +1,14 @@ +# REQUIRES: x86, shell + +# RUN: rm -rf %t.dir +# RUN: mkdir -p %t.dir +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.dir/foo.o +# RUN: cd %t.dir +# RUN: llvm-ar rcT foo.a foo.o +# RUN: ld.lld -m elf_x86_64 foo.a -o bar --reproduce repro +# RUN: diff foo.a repro/%:t.dir/foo.a +# RUN: diff foo.o repro/%:t.dir/foo.o + +.globl _start +_start: + nop |

