[PATCH] D91152: [obj2yaml] - Dump section offsets in some cases.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 05:05:45 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: atanasyan, kbarton, nemanjai, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar requested review of this revision.

Currently we never dump the `sh_offset` key.
Though it sometimes an important information.

To reduce the noise this patch implements the following logic:

1. The "Offset" key for the first section is always emitted.
2. If we can derive the offset for a next section naturally, then the "Offset" key is omitted.

By "naturally" I mean that section[X] offset is expected to be:

  offsetOf(section[X]) == alignTo(section[X - 1].sh_offset + section[X - 1].sh_size, section[X].sh_addralign)

So, when it has the expected value, we omit it from the output.


https://reviews.llvm.org/D91152

Files:
  llvm/test/Object/obj2yaml.test
  llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml
  llvm/test/tools/obj2yaml/ELF/DWARF/debug-aranges.yaml
  llvm/test/tools/obj2yaml/ELF/DWARF/debug-ranges.yaml
  llvm/test/tools/obj2yaml/ELF/DWARF/debug-str.yaml
  llvm/test/tools/obj2yaml/ELF/DWARF/unrecognized-debug-section.yaml
  llvm/test/tools/obj2yaml/ELF/arm-exidx-section.yaml
  llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
  llvm/test/tools/obj2yaml/ELF/call-graph-profile-section.yaml
  llvm/test/tools/obj2yaml/ELF/duplicate-symbol-and-section-names.yaml
  llvm/test/tools/obj2yaml/ELF/dynamic-section.yaml
  llvm/test/tools/obj2yaml/ELF/gnu-hash-section.yaml
  llvm/test/tools/obj2yaml/ELF/hash-section.yaml
  llvm/test/tools/obj2yaml/ELF/implicit-sections-order.yaml
  llvm/test/tools/obj2yaml/ELF/invalid-section-name.yaml
  llvm/test/tools/obj2yaml/ELF/linker-options.yaml
  llvm/test/tools/obj2yaml/ELF/llvm-addrsig-section.yaml
  llvm/test/tools/obj2yaml/ELF/llvm-deplibs-section.yaml
  llvm/test/tools/obj2yaml/ELF/mips-abi-flags.yaml
  llvm/test/tools/obj2yaml/ELF/no-symbol-reloc.yaml
  llvm/test/tools/obj2yaml/ELF/note-section.yaml
  llvm/test/tools/obj2yaml/ELF/null-section.yaml
  llvm/test/tools/obj2yaml/ELF/offset.yaml
  llvm/test/tools/obj2yaml/ELF/ppc64-relocations.yaml
  llvm/test/tools/obj2yaml/ELF/rel-rela-section.yaml
  llvm/test/tools/obj2yaml/ELF/reladyn-section-shinfo.yaml
  llvm/test/tools/obj2yaml/ELF/relocation-type.yaml
  llvm/test/tools/obj2yaml/ELF/relr-section.yaml
  llvm/test/tools/obj2yaml/ELF/sections-info.yaml
  llvm/test/tools/obj2yaml/ELF/shinfo.yaml
  llvm/test/tools/obj2yaml/ELF/sht-symtab-shndx.yaml
  llvm/test/tools/obj2yaml/ELF/stack-sizes.yaml
  llvm/test/tools/obj2yaml/ELF/verdef-section.yaml
  llvm/test/tools/obj2yaml/ELF/verneed-section.yaml
  llvm/test/tools/obj2yaml/ELF/versym-section.yaml
  llvm/tools/obj2yaml/elf2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91152.304144.patch
Type: text/x-patch
Size: 38156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201110/7723fb95/attachment.bin>


More information about the llvm-commits mailing list