summaryrefslogtreecommitdiff
path: root/lld/MinGW
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-06-17 15:57:20 +0300
committerMartin Storsjö <martin@martin.st>2021-07-02 09:49:13 +0300
commitc09e5e50b13aa1f5a2eafc81097ffe8a5799e5b3 (patch)
tree679611af19109cb7d78d646f88e50c7fedf6bcf6 /lld/MinGW
parenta9ff1ce1b9a52add7557cf0579d424c9d0678860 (diff)
downloadllvm-c09e5e50b13aa1f5a2eafc81097ffe8a5799e5b3.tar.gz
[LLD] [MinGW] Allow linking to DLLs directly
As the COFF linker is capable of linking directly against a DLL now (after D104530, as long as it is running in mingw mode), don't error out here but successfully load libraries specified with "-l" from DLLs if that's what ld.bfd would have matched. Differential Revision: https://reviews.llvm.org/D104531
Diffstat (limited to 'lld/MinGW')
-rw-r--r--lld/MinGW/Driver.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 734f4092a666..27cb508403f6 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -142,16 +142,10 @@ searchLibrary(StringRef name, ArrayRef<StringRef> searchPaths, bool bStatic) {
if (!bStatic) {
if (Optional<std::string> s = findFile(dir, name + ".lib"))
return *s;
- if (Optional<std::string> s = findFile(dir, "lib" + name + ".dll")) {
- error("lld doesn't support linking directly against " + *s +
- ", use an import library");
- return "";
- }
- if (Optional<std::string> s = findFile(dir, name + ".dll")) {
- error("lld doesn't support linking directly against " + *s +
- ", use an import library");
- return "";
- }
+ if (Optional<std::string> s = findFile(dir, "lib" + name + ".dll"))
+ return *s;
+ if (Optional<std::string> s = findFile(dir, name + ".dll"))
+ return *s;
}
}
error("unable to find library -l" + name);