[PATCH] D135651: [LLD] [MinGW] Look for libs named "<libname>.lib" even with -static

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 12 01:08:02 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe75c87f22cf2: [LLD] [MinGW] Look for libs named "<libname>.lib" even with -static (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135651

Files:
  lld/MinGW/Driver.cpp
  lld/test/MinGW/lib.test


Index: lld/test/MinGW/lib.test
===================================================================
--- lld/test/MinGW/lib.test
+++ lld/test/MinGW/lib.test
@@ -38,9 +38,20 @@
 OTHERSTYLES: noprefix.dll.a
 OTHERSTYLES-SAME: msvcstyle.lib
 
+RUN: not ld.lld -### -m i386pep -L%t/lib -static -lnoprefix 2>&1 | FileCheck -check-prefix=ERROR-NOPREFIX %s
+ERROR-NOPREFIX: unable to find library -lnoprefix
+
+RUN: ld.lld -### -m i386pep -L%t/lib -static -lmsvcstyle 2>&1 | FileCheck -check-prefix=MSVCSTYLE %s
+MSVCSTYLE: msvcstyle.lib
+
 RUN: echo > %t/lib/libnoimplib.dll
 RUN: echo > %t/lib/noprefix_noimplib.dll
 RUN: ld.lld -### -m i386pep -L%t/lib -lnoimplib 2>&1 | FileCheck -check-prefix=DLL1 %s
 RUN: ld.lld -### -m i386pep -L%t/lib -lnoprefix_noimplib 2>&1 | FileCheck -check-prefix=DLL2 %s
 DLL1: libnoimplib.dll
 DLL2: noprefix_noimplib.dll
+
+RUN: not ld.lld -### -m i386pep -L%t/lib -static -lnoimplib 2>&1 | FileCheck -check-prefix=ERROR-NOIMPLIB %s
+RUN: not ld.lld -### -m i386pep -L%t/lib -static -lnoprefix_noimplib 2>&1 | FileCheck -check-prefix=ERROR-NOPREFIX-NOIMPLIB %s
+ERROR-NOIMPLIB: unable to find library -lnoimplib
+ERROR-NOPREFIX-NOIMPLIB: unable to find library -lnoprefix_noimplib
Index: lld/MinGW/Driver.cpp
===================================================================
--- lld/MinGW/Driver.cpp
+++ lld/MinGW/Driver.cpp
@@ -139,9 +139,9 @@
     }
     if (Optional<std::string> s = findFile(dir, "lib" + name + ".a"))
       return *s;
+    if (Optional<std::string> s = findFile(dir, name + ".lib"))
+       return *s;
     if (!bStatic) {
-      if (Optional<std::string> s = findFile(dir, name + ".lib"))
-        return *s;
       if (Optional<std::string> s = findFile(dir, "lib" + name + ".dll"))
         return *s;
       if (Optional<std::string> s = findFile(dir, name + ".dll"))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135651.467044.patch
Type: text/x-patch
Size: 1822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221012/51426ed4/attachment.bin>


More information about the llvm-commits mailing list