[PATCH] D65565: [LLD] [COFF] Fix wholearchive with thin archives

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 11:46:45 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL367599: [COFF] Fix wholearchive with thin archives (authored by mstorsjo, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D65565?vs=212761&id=212870#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65565/new/

https://reviews.llvm.org/D65565

Files:
  lld/trunk/COFF/Driver.cpp
  lld/trunk/test/COFF/thin-archive.s


Index: lld/trunk/test/COFF/thin-archive.s
===================================================================
--- lld/trunk/test/COFF/thin-archive.s
+++ lld/trunk/test/COFF/thin-archive.s
@@ -11,6 +11,8 @@
 # RUN:     FileCheck --allow-empty %s
 # RUN: lld-link /entry:main %t.main.obj %t_thin.lib /out:%t.exe 2>&1 | \
 # RUN:     FileCheck --allow-empty %s
+# RUN: lld-link /entry:main %t.main.obj /wholearchive:%t_thin.lib /out:%t.exe 2>&1 | \
+# RUN:     FileCheck --allow-empty %s
 
 # RUN: rm %t.lib.obj
 # RUN: lld-link /entry:main %t.main.obj %t.lib /out:%t.exe 2>&1 | \
Index: lld/trunk/COFF/Driver.cpp
===================================================================
--- lld/trunk/COFF/Driver.cpp
+++ lld/trunk/COFF/Driver.cpp
@@ -184,8 +184,10 @@
     if (wholeArchive) {
       std::unique_ptr<Archive> file =
           CHECK(Archive::create(mbref), filename + ": failed to parse archive");
+      Archive *archive = file.get();
+      make<std::unique_ptr<Archive>>(std::move(file)); // take ownership
 
-      for (MemoryBufferRef m : getArchiveMembers(file.get()))
+      for (MemoryBufferRef m : getArchiveMembers(archive))
         addArchiveBuffer(m, "<whole-archive>", filename, 0);
       return;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65565.212870.patch
Type: text/x-patch
Size: 1227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190801/ec9db8bb/attachment.bin>


More information about the llvm-commits mailing list