[yaml2obj/obj2yaml] - Refine handling of SHT_GNU_verdef sections.
authorGeorgii Rymar <grimar@accesssoftek.com>
Wed, 13 Jan 2021 14:16:55 +0000 (17:16 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Fri, 15 Jan 2021 09:40:42 +0000 (12:40 +0300)
commitd9afe8588e49f1a2779ab1fe7ff2ec39e8d080fd
tree3289a14b969646702866a7331d9fa2e07a3ee20f
parent3676ef105389f0a8fd7d0efa1477adc209f0b486
[yaml2obj/obj2yaml] - Refine handling of SHT_GNU_verdef sections.

This patch:
1) Makes `Version`, `Flags`, `VersionNdx` and `Hash` fields to be `Optional<>`.
2) Disallows dumping version definitions that have `vd_version != 1`.
   `vd_version` identifies the version of the structure itself.
   (https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html,
    https://docs.oracle.com/cd/E19683-01/816-7777/chapter6-80869/index.html)
3) Stops dumping default values for `Version`, `Flags`, `VersionNdx` and `Hash` fields.
4) Refines testing.

Differential revision: https://reviews.llvm.org/D94659
llvm/include/llvm/ObjectYAML/ELFYAML.h
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/tools/obj2yaml/ELF/verdef-section.yaml
llvm/test/tools/yaml2obj/ELF/verdef-section.yaml
llvm/tools/obj2yaml/elf2yaml.cpp