[PATCH] D37761: [LLD] [MinGW] Support creating DLLs with a def file

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 13:22:22 PDT 2017


mstorsjo created this revision.

https://reviews.llvm.org/D37761

Files:
  MinGW/Driver.cpp
  test/MinGW/driver.test


Index: test/MinGW/driver.test
===================================================================
--- test/MinGW/driver.test
+++ test/MinGW/driver.test
@@ -26,6 +26,9 @@
 SHARED:      -out:a.dll
 SHARED-SAME: -dll
 
+RUN: ld.lld -### foo.o -m i386pep -shared foo.def | FileCheck -check-prefix=DEF %s
+DEF: -def:foo.def
+
 RUN: ld.lld -### foo.o -m i386pep -o bar.exe | FileCheck -check-prefix=OUT %s
 OUT: -out:bar.exe
 
Index: MinGW/Driver.cpp
===================================================================
--- MinGW/Driver.cpp
+++ MinGW/Driver.cpp
@@ -177,7 +177,10 @@
                                OPT_no_whole_archive)) {
     switch (A->getOption().getID()) {
     case OPT_INPUT:
-      Add(WholeArchivePrefix + StringRef(A->getValue()));
+      if (StringRef(A->getValue()).endswith(".def"))
+        Add("-def:" + StringRef(A->getValue()));
+      else
+        Add(WholeArchivePrefix + StringRef(A->getValue()));
       break;
     case OPT_l:
       Add(WholeArchivePrefix + searchLibrary(A->getValue(), SearchPaths, Args.hasArg(OPT_Bstatic)));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37761.114891.patch
Type: text/x-patch
Size: 1062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170912/bdaf1194/attachment.bin>


More information about the llvm-commits mailing list