[PATCH] D71845: [AIX][XCOFF][AIX] Fix XCOFFObjectWriter assertion failure with alignment-related gap and improve text section output testing

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 11:30:55 PST 2020


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:442
 
+    // There could be gap (but no zero paddings) between each sections.
+    const MCSectionXCOFF *MCSec = (*Section->Groups[0])[0].MCCsect;
----------------
Suggestion:
There could be a gap (without corresponding zero padding) between sections. 


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:444
+    const MCSectionXCOFF *MCSec = (*Section->Groups[0])[0].MCCsect;
+    CurrentAddressLocation = alignTo(CurrentAddressLocation, MCSec->getAlignment());;
     assert(CurrentAddressLocation == Section->Address &&
----------------
I think the assert should check that this value is equal to `Section->Address` without updating `CurrentAddessLocation`. `CurrentAddressLocation` can then be updated to `Section->Address` after the assert.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71845





More information about the llvm-commits mailing list