[PATCH] D70859: [BUG-FIX][XCOFF] fixed a bug of XCOFFObjectFile.cpp when there is padding at the last csect of a sections

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 13:03:09 PST 2019


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:359
 
-    assert(CurrentAddressLocation == Section->Address &&
-           "We should have no padding between sections.");
+    CurrentAddressLocation = Section->Address;
     for (const auto *Group : Section->Groups) {
----------------
daltenty wrote:
> Combine this with the declaration
The assert has the effect to detecting if we assigned the section addresses in a different order than we are writing the sections. We should update the assert to indicate that `"We should be writing sections consecutively."`


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:374
             Section->Address + Section->Size - CurrentAddressLocation)
       W.OS.write_zeros(PaddingSize);
   }
----------------
We can update `CurrentAddressLocation` here instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70859





More information about the llvm-commits mailing list