diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -139,9 +139,9 @@ } if (Optional s = findFile(dir, "lib" + name + ".a")) return *s; + if (Optional s = findFile(dir, name + ".lib")) + return *s; if (!bStatic) { - if (Optional s = findFile(dir, name + ".lib")) - return *s; if (Optional s = findFile(dir, "lib" + name + ".dll")) return *s; if (Optional s = findFile(dir, name + ".dll")) diff --git a/lld/test/MinGW/lib.test b/lld/test/MinGW/lib.test --- a/lld/test/MinGW/lib.test +++ b/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