Index: COFF/Driver.cpp =================================================================== --- COFF/Driver.cpp +++ COFF/Driver.cpp @@ -187,6 +187,7 @@ for (MemoryBufferRef m : getArchiveMembers(file.get())) addArchiveBuffer(m, "", filename, 0); + make>(std::move(file)); // take ownership return; } symtab->addFile(make(mbref)); Index: test/COFF/thin-archive.s =================================================================== --- test/COFF/thin-archive.s +++ 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 | \