[PATCH] D56083: [llvm-objdump] - Implement -z/--disassemble-zeroes

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 26 04:47:06 PST 2018


grimar created this revision.
grimar added reviewers: echristo, dblaikie, davide, jhenderson, atanasyan.
Herald added subscribers: kbarton, arichardson, nemanjai, sdardis, emaste.
Herald added a reviewer: espindola.

This is https://bugs.llvm.org/show_bug.cgi?id=37151,

GNU objdump spec says that "Normally the disassembly output will skip blocks of zeroes.",
but currently, llvm-objdump prints them.

The patch implements the -z/--disassemble-zeroes option and switches the default to always
skip blocks of zeroes.

GNU objdump has a bit more complex heuristic for this option. For example, it tries to
skip the last zero bytes in a section if the amount of them > 3:
https://github.com/CyberGrandChallenge/binutils/blob/master/binutils/objdump.c#L1489
so it tries to avoid disassembling zeroes inserted by section alignment.
I think it is too brittle and probably not very useful. Modern linkers like LLD insert/align sections with
trap instructions and not zeroes. Hence I tried to implement simple and clear rules in this patch
(see my comments in the code).


https://reviews.llvm.org/D56083

Files:
  test/ELF/mips-26.s
  test/ELF/mips-micro-jal.s
  test/ELF/mips-npic-call-pic-os.s
  test/ELF/mips-npic-call-pic-script.s
  test/ELF/mips-npic-call-pic.s
  test/ELF/ppc64-dtprel.s
  test/ELF/relocation-size-shared.s
  test/ELF/relocation-size.s
  test/MC/Mips/cpsetup.s
  test/MC/Mips/nacl-mask.s
  test/MC/X86/disassemble-zeroes.s
  tools/llvm-objdump/llvm-objdump.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56083.179507.patch
Type: text/x-patch
Size: 15587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181226/9d929820/attachment.bin>


More information about the llvm-commits mailing list