aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-12-25 13:34:31 +0000
committerRui Ueyama <ruiu@google.com>2013-12-25 13:34:31 +0000
commitcc66ff677632be92b84b885c6ba6fafa616c215c (patch)
tree22bee8cb3f40dee999541072b6d6ace3ad006af8
parent782ad0eb718072b657fc49af0ff914c3a91971e3 (diff)
downloadllvm-cc66ff677632be92b84b885c6ba6fafa616c215c.zip
llvm-cc66ff677632be92b84b885c6ba6fafa616c215c.tar.gz
llvm-cc66ff677632be92b84b885c6ba6fafa616c215c.tar.bz2
[PECOFF] Set default subsystem to the DLL header.
Subsystem field in the PE/COFF file header has no meanining for the DLL. It looks like MSVC link.exe sets the default subsystem (Windows GUI) to the field if no /subsystem option is specified. llvm-svn: 198015
-rw-r--r--lld/lib/ReaderWriter/PECOFF/SetSubsystemPass.h4
-rw-r--r--lld/test/pecoff/export.test2
2 files changed, 5 insertions, 1 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/SetSubsystemPass.h b/lld/lib/ReaderWriter/PECOFF/SetSubsystemPass.h
index ddc6fc1..8b99d2b 100644
--- a/lld/lib/ReaderWriter/PECOFF/SetSubsystemPass.h
+++ b/lld/lib/ReaderWriter/PECOFF/SetSubsystemPass.h
@@ -41,6 +41,10 @@ public:
return;
}
}
+ if (_ctx.getImageType() == PECOFFLinkingContext::IMAGE_DLL) {
+ _ctx.setSubsystem(WindowsSubsystem::IMAGE_SUBSYSTEM_WINDOWS_GUI);
+ return;
+ }
llvm_unreachable("Failed to infer the subsystem.");
}
diff --git a/lld/test/pecoff/export.test b/lld/test/pecoff/export.test
index 90d56d1..c86d516 100644
--- a/lld/test/pecoff/export.test
+++ b/lld/test/pecoff/export.test
@@ -1,6 +1,6 @@
# RUN: yaml2obj %p/Inputs/export.obj.yaml > %t.obj
#
-# RUN: lld -flavor link /out:%t1.dll /dll /subsystem:console /entry:_init \
+# RUN: lld -flavor link /out:%t1.dll /dll /entry:_init \
# RUN: /export:exportfn1 /export:exportfn2 -- %t.obj
# RUN: llvm-objdump -s %t1.dll | FileCheck -check-prefix=CHECK1 %s