[obj2yaml] - Dump allocatable SHT_STRTAB, SHT_SYMTAB and SHT_DYNSYM sections.
authorGeorgii Rymar <grimar@accesssoftek.com>
Fri, 21 Feb 2020 11:10:23 +0000 (14:10 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Tue, 3 Mar 2020 08:32:49 +0000 (11:32 +0300)
commitd58e383f23d3a64b4ed71926217a6d36543e77c5
tree7a56843e71d3ca118769992f8180a16729b50959
parent9e1443e6f6d0aa55a2caaf6fd540f4a3e5ce81d4
[obj2yaml] - Dump allocatable SHT_STRTAB, SHT_SYMTAB and SHT_DYNSYM sections.

Sometimes we need to dump an object and build it again from a YAML
description produced. The problem is that obj2yaml does not dump some
of sections, like string tables and symbol tables.

Because of that yaml2obj implicitly creates them and sections created
are not placed at their original locations. They are added to the end of a section list.
That makes a preparing test cases task harder than it can be.

This patch teaches obj2yaml to dump parts of allocatable SHT_STRTAB, SHT_SYMTAB
and SHT_DYNSYM sections to print placeholders for them.
This also allows to preserve usefull parameters, like virtual address.

Differential revision: https://reviews.llvm.org/D74955
llvm/test/tools/obj2yaml/duplicate-symbol-and-section-names.test
llvm/test/tools/obj2yaml/implicit-sections-order.yaml [new file with mode: 0644]
llvm/test/tools/obj2yaml/versym-section.yaml
llvm/tools/obj2yaml/elf2yaml.cpp