[PATCH] D75131: [llvm-objdump][XCOFF][AIX] Implement -r option

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 08:06:17 PDT 2020


jasonliu marked an inline comment as done.
jasonliu added inline comments.


================
Comment at: llvm/test/tools/llvm-objdump/XCOFF/disassemble-all.test:45-46
+CHECK:        00000090 <d>:
+ONLY-D-NEXT:      90: 00 00 00 00                  	<unknown>
+WITH-R-NEXT:      ...
+CHECK:        00000094 <func>:
----------------
jasonliu wrote:
> jhenderson wrote:
> > I find this behaviour difference confusing. What is causing it?
> This block of code kicks in:
> 
> ```
>         if (!DisassembleZeroes) {
>           uint64_t MaxOffset = End - Index;
>           // For -reloc: print zero blocks patched by relocations, so that
>           // relocations can be shown in the dump.
>           if (RelCur != RelEnd)
>             MaxOffset = RelCur->getOffset() - Index;
> 
>           if (size_t N =
>                   countSkippableZeroBytes(Bytes.slice(Index, MaxOffset))) {
>             outs() << "\t\t..." << '\n';
>             Index += N;
>             continue;
>           }
>         }
> ```
> The MaxOffset is larger when we have relocation. So we start to print '...' for that. 
> 
> In this file, you might think there is no relocation showing up after line 25. But it's actually there if we check the new print-reloc.test. The reason llvm-objdump is not printing them is because of this patch: https://reviews.llvm.org/D73531. Since we could not disassemble those instructions in the data section, we decide not to analysis them and skipped the relocation printing. This skip printing relocation is not ideal for XCOFF as you could see, but I would like to address it in a different patch.
To elaborate why MaxOffset is larger when we have relocation:
RelCur is pointing at the relocation of <func> when we are at <d>, and offset of func is 0, with RelCur->getOffset() - Index, it wraps around becomes a very large number, which is not right.


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

https://reviews.llvm.org/D75131





More information about the llvm-commits mailing list