[lld] r200518 - [PECOFF] Set the correct PE header field value.
Rui Ueyama
ruiu at google.com
Thu Jan 30 21:43:12 PST 2014
Author: ruiu
Date: Thu Jan 30 23:43:12 2014
New Revision: 200518
URL: http://llvm.org/viewvc/llvm-project?rev=200518&view=rev
Log:
[PECOFF] Set the correct PE header field value.
The charcateristics field should not have IMAGE_FILE_32BIT_MACHINE bit but have
IMAGE_FILE_LARGE_ADDRESS_AWARE bit for PE32+.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
lld/trunk/test/pecoff/pe32plus.test
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=200518&r1=200517&r2=200518&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Thu Jan 30 23:43:12 2014
@@ -331,9 +331,10 @@ PEHeaderChunk<PEHeader>::PEHeaderChunk(c
_coffHeader.TimeDateStamp = time(nullptr);
// Attributes of the executable.
- uint16_t characteristics = llvm::COFF::IMAGE_FILE_32BIT_MACHINE |
- llvm::COFF::IMAGE_FILE_EXECUTABLE_IMAGE;
- if (ctx.getLargeAddressAware())
+ uint16_t characteristics = llvm::COFF::IMAGE_FILE_EXECUTABLE_IMAGE;
+ if (!ctx.is64Bit())
+ characteristics |= llvm::COFF::IMAGE_FILE_32BIT_MACHINE;
+ if (ctx.getLargeAddressAware() || ctx.is64Bit())
characteristics |= llvm::COFF::IMAGE_FILE_LARGE_ADDRESS_AWARE;
if (ctx.getSwapRunFromCD())
characteristics |= llvm::COFF::IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP;
Modified: lld/trunk/test/pecoff/pe32plus.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/pe32plus.test?rev=200518&r1=200517&r2=200518&view=diff
==============================================================================
--- lld/trunk/test/pecoff/pe32plus.test (original)
+++ lld/trunk/test/pecoff/pe32plus.test Thu Jan 30 23:43:12 2014
@@ -14,9 +14,9 @@ CHECK-NEXT: TimeDateStamp:
CHECK-NEXT: PointerToSymbolTable: 0x0
CHECK-NEXT: SymbolCount: 0
CHECK-NEXT: OptionalHeaderSize: 240
-CHECK-NEXT: Characteristics [ (0x102)
-CHECK-NEXT: IMAGE_FILE_32BIT_MACHINE (0x100)
+CHECK-NEXT: Characteristics [ (0x22)
CHECK-NEXT: IMAGE_FILE_EXECUTABLE_IMAGE (0x2)
+CHECK-NEXT: IMAGE_FILE_LARGE_ADDRESS_AWARE (0x20)
CHECK-NEXT: ]
CHECK-NEXT: }
CHECK-NEXT: ImageOptionalHeader {
More information about the llvm-commits
mailing list