diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -142,16 +142,10 @@ if (!bStatic) { if (Optional s = findFile(dir, name + ".lib")) return *s; - if (Optional s = findFile(dir, "lib" + name + ".dll")) { - error("lld doesn't support linking directly against " + *s + - ", use an import library"); - return ""; - } - if (Optional s = findFile(dir, name + ".dll")) { - error("lld doesn't support linking directly against " + *s + - ", use an import library"); - return ""; - } + if (Optional s = findFile(dir, "lib" + name + ".dll")) + return *s; + if (Optional s = findFile(dir, name + ".dll")) + return *s; } } error("unable to find library -l" + name); 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 @@ -40,7 +40,7 @@ RUN: echo > %t/lib/libnoimplib.dll RUN: echo > %t/lib/noprefix_noimplib.dll -RUN: not ld.lld -### -m i386pep -L%t/lib -lnoimplib 2>&1 | FileCheck -check-prefix=UNSUPPORTED-DLL1 %s -RUN: not ld.lld -### -m i386pep -L%t/lib -lnoprefix_noimplib 2>&1 | FileCheck -check-prefix=UNSUPPORTED-DLL2 %s -UNSUPPORTED-DLL1: lld doesn't support linking directly against {{.*}}libnoimplib.dll, use an import library -UNSUPPORTED-DLL2: lld doesn't support linking directly against {{.*}}noprefix_noimplib.dll, use an import library +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