Skip to content

Commit

Permalink
[MinGW] Support creating DLLs with a def file
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D37761

llvm-svn: 313125
  • Loading branch information
mstorsjo committed Sep 13, 2017
1 parent 32e1626 commit 064b0fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lld/MinGW/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
OPT_no_whole_archive)) {
switch (A->getOption().getID()) {
case OPT_INPUT:
Add(Prefix + StringRef(A->getValue()));
if (StringRef(A->getValue()).endswith(".def"))
Add("-def:" + StringRef(A->getValue()));
else
Add(Prefix + StringRef(A->getValue()));
break;
case OPT_l:
Add(Prefix +
Expand Down
3 changes: 3 additions & 0 deletions lld/test/MinGW/driver.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ RUN: ld.lld -### foo.o -m i386pep -shared | FileCheck -check-prefix=SHARED %s
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

Expand Down

0 comments on commit 064b0fa

Please sign in to comment.