[lld] r367806 - Merge r367599 - [COFF] Fix wholearchive with thin archives (PR42388, D65565)
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 00:35:49 PDT 2019
Author: hans
Date: Mon Aug 5 00:35:49 2019
New Revision: 367806
URL: http://llvm.org/viewvc/llvm-project?rev=367806&view=rev
Log:
Merge r367599 - [COFF] Fix wholearchive with thin archives (PR42388, D65565)
Added:
lld/branches/release_90/test/COFF/Inputs/mangled-symbol.s
lld/branches/release_90/test/COFF/thin-archive.s
Modified:
lld/branches/release_90/COFF/Driver.cpp
Modified: lld/branches/release_90/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_90/COFF/Driver.cpp?rev=367806&r1=367805&r2=367806&view=diff
==============================================================================
--- lld/branches/release_90/COFF/Driver.cpp (original)
+++ lld/branches/release_90/COFF/Driver.cpp Mon Aug 5 00:35:49 2019
@@ -184,8 +184,10 @@ void LinkerDriver::addBuffer(std::unique
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;
}
Added: lld/branches/release_90/test/COFF/Inputs/mangled-symbol.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_90/test/COFF/Inputs/mangled-symbol.s?rev=367806&view=auto
==============================================================================
--- lld/branches/release_90/test/COFF/Inputs/mangled-symbol.s (added)
+++ lld/branches/release_90/test/COFF/Inputs/mangled-symbol.s Mon Aug 5 00:35:49 2019
@@ -0,0 +1,9 @@
+ .text
+
+ .def "?f@@YAHXZ"
+ .scl 2
+ .type 32
+ .endef
+ .global "?f@@YAHXZ"
+"?f@@YAHXZ":
+ retq $0
Added: lld/branches/release_90/test/COFF/thin-archive.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_90/test/COFF/thin-archive.s?rev=367806&view=auto
==============================================================================
--- lld/branches/release_90/test/COFF/thin-archive.s (added)
+++ lld/branches/release_90/test/COFF/thin-archive.s Mon Aug 5 00:35:49 2019
@@ -0,0 +1,32 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc -o %t.main.obj %s
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc -o %t.lib.obj \
+# RUN: %S/Inputs/mangled-symbol.s
+# RUN: lld-link /lib /out:%t.lib %t.lib.obj
+# RUN: lld-link /lib /llvmlibthin /out:%t_thin.lib %t.lib.obj
+
+# RUN: lld-link /entry:main %t.main.obj %t.lib /out:%t.exe 2>&1 | \
+# 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 | \
+# RUN: FileCheck --allow-empty %s
+
+# CHECK-NOT: error: could not get the buffer for the member defining
+
+ .text
+
+ .def main
+ .scl 2
+ .type 32
+ .endef
+ .global main
+main:
+ call "?f@@YAHXZ"
+ retq $0
More information about the llvm-commits
mailing list