[PATCH] D152198: [lld][COFF] Don't handle an input file multiple times when retrying

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 14:34:48 PDT 2023


aeubanks created this revision.
aeubanks added reviewers: rnk, hans.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Follow up to D151815 <https://reviews.llvm.org/D151815>.

Or else we properly handle the first instance of a file, then error out on the second instance of the same file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152198

Files:
  lld/COFF/Driver.cpp
  lld/test/COFF/winsysroot.test


Index: lld/test/COFF/winsysroot.test
===================================================================
--- lld/test/COFF/winsysroot.test
+++ lld/test/COFF/winsysroot.test
@@ -26,6 +26,10 @@
 # RUN: lld-link %t.obj /winsysroot:%t.dir/sysroot \
 # RUN:          std32.lib /entry:main
 
+Check that passing a lib from /winsysroot twice is ok
+# RUN: lld-link %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot \
+# RUN:          std64.lib std64.lib /entry:main
+
 If winsysroot lib appears before we can detect arch we don't find it
 # RUN: not lld-link std64.lib %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot \
 # RUN:          /entry:main
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -262,6 +262,9 @@
         ec = retryMb.getError();
         if (!ec)
           mb = std::move(*retryMb);
+      } else {
+        // We've already handled this file.
+        return;
       }
     }
     if (ec) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152198.528578.patch
Type: text/x-patch
Size: 1002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230605/9a0440d9/attachment.bin>


More information about the llvm-commits mailing list