[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
This commit is contained in:
Rui Ueyama 2013-12-25 13:34:31 +00:00
parent 782ad0eb71
commit cc66ff6776
2 changed files with 5 additions and 1 deletions

View File

@ -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.");
}

View File

@ -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