[PECOFF] Set DLL bit in PE header if DLL.
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
This commit is contained in:
parent
033890cd0a
commit
286691ad5e
|
@ -332,6 +332,8 @@ PEHeaderChunk<PEHeader>::PEHeaderChunk(const PECOFFLinkingContext &ctx)
|
|||
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())
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# 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)
|
Loading…
Reference in New Issue