[PATCH] D66969: Output XCOFF object text section header and symbol entry for program code

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 16:22:08 PDT 2019


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:89
   uint32_t Size;
+  uint32_t PaddingSize;
   uint32_t FileOffsetToData;
----------------
Remove this field (see comments on later lines).


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:103
     Size = 0;
+    PaddingSize = 0;
     FileOffsetToData = 0;
----------------
Remove this field (see comments on later lines).


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:511
+      const MCSectionXCOFF *MCSec = Csect.MCCsect;
+      Csect.PaddingSize = alignTo(Address, MCSec->getAlignment()) - Address;
+      Address += Csect.PaddingSize;
----------------
The inter-csect padding is not really a property of the csect requiring alignment. We do not need to store this value here. The amount of padding to write can be determined by tracking the virtual address of the raw section data being written during the serialization into the object file. The next virtual address following the padding should be `Csect.Address`.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:525
+    }
+    Text.PaddingSize = alignTo(Address, DefaultSectionAlign) - Address;
+    Address += Text.PaddingSize;
----------------
The `Size` field accounts for the padding. We do not need to store this value here. The amount of padding to write can be determined by tracking the virtual address of the raw section data being written during the serialization into the object file. The next virtual address following the padding should be `Text.Address + Text.Size`.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66969





More information about the llvm-commits mailing list