Windows loader can load a DLL without this bit but it wouldn't
call the initializer function in the DLL if the bit is absent.
llvm-svn: 213216
uint16_t characteristics = llvm::COFF::IMAGE_FILE_EXECUTABLE_IMAGE;
if (!ctx.is64Bit())
characteristics |= llvm::COFF::IMAGE_FILE_32BIT_MACHINE;
+ if (ctx.isDll())
+ characteristics |= llvm::COFF::IMAGE_FILE_DLL;
if (ctx.getLargeAddressAware() || ctx.is64Bit())
characteristics |= llvm::COFF::IMAGE_FILE_LARGE_ADDRESS_AWARE;
if (ctx.getSwapRunFromCD())
--- /dev/null
+# RUN: yaml2obj %p/Inputs/nop.obj.yaml > %t.obj
+#
+# RUN: lld -flavor link /out:%t.exe /subsystem:console \
+# RUN: /entry:start /dll -- %t.obj
+# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
+
+CHECK: IMAGE_FILE_DLL (0x2000)