[llvm] r200038 - Support/COFF: Fix PEHeader struct, and define PE32Header as its alias.
Rui Ueyama
ruiu at google.com
Sat Jan 25 14:42:29 PST 2014
On Fri, Jan 24, 2014 at 6:13 PM, Saleem Abdulrasool
<compnerd at compnerd.org>wrote:
> On Fri, Jan 24, 2014 at 12:54 PM, Rui Ueyama <ruiu at google.com> wrote:
>
>> Author: ruiu
>> Date: Fri Jan 24 14:54:10 2014
>> New Revision: 200038
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=200038&view=rev
>> Log:
>> Support/COFF: Fix PEHeader struct, and define PE32Header as its alias.
>>
>> This change does not affect anything because everybody seems to be using
>> Object/COFF.h instead. But the definition is not for PE32 but for PE32+,
>> so fix it anyway.
>>
>> Modified:
>> llvm/trunk/include/llvm/Support/COFF.h
>>
>
> While it is unclear if we will have support for PEP, it doesn't feel like
> a great idea to simply alias PE32Header as PEHeader. The PE Header for
> PE32 and PE32+ are ever so slightly different (they account for the
> difference by canabalising some of the PE32 header fields and changing the
> size of other fields). I think for the sake of clarity, it might be nicer
> to just define both structs and name them appropriately.
>
Yes, that is my plan. The reason why I defined PEHeader as an alias for
PE32Header is to not break LLD build which uses PEHeader::PE32. I will make
a change to LLD and then remove the PEHeader definition.
>
>> Modified: llvm/trunk/include/llvm/Support/COFF.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/COFF.h?rev=200038&r1=200037&r2=200038&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/COFF.h (original)
>> +++ llvm/trunk/include/llvm/Support/COFF.h Fri Jan 24 14:54:10 2014
>> @@ -450,7 +450,7 @@ namespace COFF {
>> uint32_t AddressOfNewExeHeader;
>> };
>>
>> - struct PEHeader {
>> + struct PE32Header {
>> enum {
>> PE32 = 0x10b,
>> PE32_PLUS = 0x20b
>> @@ -465,7 +465,7 @@ namespace COFF {
>> uint32_t AddressOfEntryPoint; // RVA
>> uint32_t BaseOfCode; // RVA
>> uint32_t BaseOfData; // RVA
>> - uint64_t ImageBase;
>> + uint32_t ImageBase;
>> uint32_t SectionAlignment;
>> uint32_t FileAlignment;
>> uint16_t MajorOperatingSystemVersion;
>> @@ -480,14 +480,16 @@ namespace COFF {
>> uint32_t CheckSum;
>> uint16_t Subsystem;
>> uint16_t DLLCharacteristics;
>> - uint64_t SizeOfStackReserve;
>> - uint64_t SizeOfStackCommit;
>> - uint64_t SizeOfHeapReserve;
>> - uint64_t SizeOfHeapCommit;
>> + uint32_t SizeOfStackReserve;
>> + uint32_t SizeOfStackCommit;
>> + uint32_t SizeOfHeapReserve;
>> + uint32_t SizeOfHeapCommit;
>> uint32_t LoaderFlags;
>> uint32_t NumberOfRvaAndSize;
>> };
>>
>> + typedef PE32Header PEHeader;
>> +
>> struct DataDirectory {
>> uint32_t RelativeVirtualAddress;
>> uint32_t Size;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
>
> --
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140125/53699dad/attachment.html>
More information about the llvm-commits
mailing list