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

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 08:24:21 PST 2020


jasonliu added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:440
 
-    assert(CurrentAddressLocation == Section->Address &&
-           "Sections should be written consecutively.");
+    CurrentAddressLocation = Section->Address;
     for (const auto *Group : Section->Groups) {
----------------
Instead of removing the assert altogether, I would propose we check after alignment adjustment the CurrentAddressLocation would equal to Section address.
This would help us to detect if we have garbage Section->address value. 

And also add a comment similar to this:
There could be gap (but no zero paddings) between each sections.


================
Comment at: llvm/test/CodeGen/PowerPC/aix-return55.ll:5
+; RUN: llvm-readobj -sections %t.o | FileCheck --check-prefix=CHECKSECT %s
 
+ at strA = private unnamed_addr constant [14 x i8] c"hello world!\0A\00", align 1
----------------
daltenty wrote:
> nit: We might want to add a `RUN: not` case for the 64-bit so we don't forget to add it in the future
Please address this. I'm worried that you have forgotten this because it seems you updated the patch, but this is still not addressed. 


================
Comment at: llvm/test/CodeGen/PowerPC/aix-return55.ll:23
+;CHECKOBJ-NEXT:       8: 68 65 6c 6c                   xori 5, 3, 27756
+;CHECKOBJ-NEXT:       c: 6f 77 6f 72 xoris 23, 27, 28530 
+;CHECKOBJ-NEXT:       10: 0a 00 00 00 tdlti 0, 0{{[[:space:]] *}} 
----------------
This line and the next line is not aligned. 


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