[PATCH] D70464: [COFF] Widen PE32Header fields to fit 64 bit versions

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 00:09:56 PST 2019


mstorsjo updated this revision to Diff 230199.
mstorsjo retitled this revision from "[COFFYAML] Use PE32PlusHeader for storing the optional header" to "[COFF] Widen PE32Header fields to fit 64 bit versions".
mstorsjo edited the summary of this revision.
mstorsjo added a comment.

Widen the necessary fields in the existing struct instead of adding a completely separate struct.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70464/new/

https://reviews.llvm.org/D70464

Files:
  llvm/include/llvm/BinaryFormat/COFF.h
  llvm/test/tools/yaml2obj/coff-arm64.yaml


Index: llvm/test/tools/yaml2obj/coff-arm64.yaml
===================================================================
--- llvm/test/tools/yaml2obj/coff-arm64.yaml
+++ llvm/test/tools/yaml2obj/coff-arm64.yaml
@@ -3,7 +3,9 @@
 # RUN: obj2yaml %t | FileCheck %s --check-prefix=ROUNDTRIP
 
 # CHECK: OptionalHeaderSize: 240
+# CHECK: ImageBase: 0x140000000
 
+# ROUNDTRIP: ImageBase: 5368709120
 # ROUNDTRIP: VirtualAddress:  4096
 # ROUNDTRIP: VirtualAddress:  8192
 # ROUNDTRIP: VirtualAddress:  12288
@@ -11,7 +13,7 @@
 --- !COFF
 OptionalHeader:  
   AddressOfEntryPoint: 4096
-  ImageBase:       1073741824
+  ImageBase:       5368709120
   SectionAlignment: 4096
   FileAlignment:   512
   MajorOperatingSystemVersion: 6
Index: llvm/include/llvm/BinaryFormat/COFF.h
===================================================================
--- llvm/include/llvm/BinaryFormat/COFF.h
+++ llvm/include/llvm/BinaryFormat/COFF.h
@@ -547,7 +547,7 @@
   uint32_t AddressOfEntryPoint; // RVA
   uint32_t BaseOfCode;          // RVA
   uint32_t BaseOfData;          // RVA
-  uint32_t ImageBase;
+  uint64_t ImageBase;
   uint32_t SectionAlignment;
   uint32_t FileAlignment;
   uint16_t MajorOperatingSystemVersion;
@@ -563,10 +563,10 @@
   uint16_t Subsystem;
   // FIXME: This should be DllCharacteristics to match the COFF spec.
   uint16_t DLLCharacteristics;
-  uint32_t SizeOfStackReserve;
-  uint32_t SizeOfStackCommit;
-  uint32_t SizeOfHeapReserve;
-  uint32_t SizeOfHeapCommit;
+  uint64_t SizeOfStackReserve;
+  uint64_t SizeOfStackCommit;
+  uint64_t SizeOfHeapReserve;
+  uint64_t SizeOfHeapCommit;
   uint32_t LoaderFlags;
   // FIXME: This should be NumberOfRvaAndSizes to match the COFF spec.
   uint32_t NumberOfRvaAndSize;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70464.230199.patch
Type: text/x-patch
Size: 1727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191120/c72c22d1/attachment.bin>


More information about the llvm-commits mailing list