[lld] r200184 - [PECOFF] Fix PE/COFF optional header size for PE32+.
Shankar Easwaran
shankare at codeaurora.org
Sun Jan 26 20:07:41 PST 2014
On 1/26/2014 9:53 PM, Rui Ueyama wrote:
> Author: ruiu
> Date: Sun Jan 26 21:53:26 2014
> New Revision: 200184
>
> URL: http://llvm.org/viewvc/llvm-project?rev=200184&view=rev
> Log:
> [PECOFF] Fix PE/COFF optional header size for PE32+.
>
> The optional header for PE32+ is a bit larger than PE32 because some of
> its fields are extended to 8 bytes.
>
> Modified:
> lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
> lld/trunk/test/pecoff/peplus.test
>
> Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=200184&r1=200183&r2=200184&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Sun Jan 26 21:53:26 2014
> @@ -322,8 +322,8 @@ PEHeaderChunk<PEHeader>::PEHeaderChunk(c
> _coffHeader.Machine = ctx.getMachineType();
> _coffHeader.TimeDateStamp = time(nullptr);
>
> - // The size of PE header including optional data directory is always 224.
> - _coffHeader.SizeOfOptionalHeader = 224;
> + // The size of PE header including optional data directory.
> + _coffHeader.SizeOfOptionalHeader = ctx.is64Bit() ? 240 : 224;
I think this should be defined in the PECOFFLinkingContext that return
240 vs 224 (or) in a header file.
>
> // Attributes of the executable.
> uint16_t characteristics = llvm::COFF::IMAGE_FILE_32BIT_MACHINE |
>
> Modified: lld/trunk/test/pecoff/peplus.test
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/peplus.test?rev=200184&r1=200183&r2=200184&view=diff
> ==============================================================================
> --- lld/trunk/test/pecoff/peplus.test (original)
> +++ lld/trunk/test/pecoff/peplus.test Sun Jan 26 21:53:26 2014
> @@ -11,7 +11,7 @@ CHECK-NEXT: SectionCount: 3
> CHECK-NEXT: TimeDateStamp:
> CHECK-NEXT: PointerToSymbolTable: 0x0
> CHECK-NEXT: SymbolCount: 0
> -CHECK-NEXT: OptionalHeaderSize: 224
> +CHECK-NEXT: OptionalHeaderSize: 240
> CHECK-NEXT: Characteristics [ (0x102)
> CHECK-NEXT: IMAGE_FILE_32BIT_MACHINE (0x100)
> CHECK-NEXT: IMAGE_FILE_EXECUTABLE_IMAGE (0x2)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
More information about the llvm-commits
mailing list