[all-commits] [llvm/llvm-project] 5edb90: [obj2yaml] - Dump section offsets in some cases.

Georgii Rymar via All-commits all-commits at lists.llvm.org
Wed Nov 25 01:49:34 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5edb90c927131b9153da98634241ef74419a3b4d
      https://github.com/llvm/llvm-project/commit/5edb90c927131b9153da98634241ef74419a3b4d
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M llvm/include/llvm/ObjectYAML/ELFYAML.h
    M llvm/lib/ObjectYAML/ELFEmitter.cpp
    M llvm/test/Object/obj2yaml.test
    A llvm/test/tools/obj2yaml/ELF/offset.yaml
    M llvm/tools/obj2yaml/elf2yaml.cpp

  Log Message:
  -----------
  [obj2yaml] - Dump section offsets in some cases.

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.

Differential revision: https://reviews.llvm.org/D91152




More information about the All-commits mailing list