[yaml2obj/obj2yaml] - Improve dumping/creating of ELF versioning sections.
authorGeorgii Rymar <grimar@accesssoftek.com>
Mon, 18 Jan 2021 14:42:49 +0000 (17:42 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Thu, 21 Jan 2021 07:36:48 +0000 (10:36 +0300)
commit51f4958057d6c246e85c3fbc65353bc0d7c1049b
tree622cc41884ad6d4d3130a8491486dd4170db641c
parentdd8ae42674b494e46ec40a22f40068db2b4a8b60
[yaml2obj/obj2yaml] - Improve dumping/creating of ELF versioning sections.

This makes the following improvements.

For `SHT_GNU_versym`:
 * yaml2obj: set `sh_link` to index of `.dynsym` section automatically.
For `SHT_GNU_verdef`:
 * yaml2obj: set `sh_link` to index of `.dynstr` section automatically.
 * yaml2obj: set `sh_info` field automatically.
 * obj2yaml: don't dump the `Info` field when its value matches the number of version definitions.
For `SHT_GNU_verneed`:
 * yaml2obj: set `sh_link` to index of `.dynstr` section automatically.
 * yaml2obj: set `sh_info` field automatically.
 * obj2yaml: don't dump the `Info` field when its value matches the number of version dependencies.

Also, simplifies few test cases.

Differential revision: https://reviews.llvm.org/D94956
28 files changed:
lld/test/ELF/invalid/verneed-shared.test
llvm/include/llvm/ObjectYAML/ELFYAML.h
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/Object/invalid.test
llvm/test/tools/llvm-objdump/ELF/verdef.test
llvm/test/tools/llvm-objdump/ELF/verneed.test
llvm/test/tools/llvm-readobj/ELF/all.test
llvm/test/tools/llvm-readobj/ELF/dyn-symbols.test
llvm/test/tools/llvm-readobj/ELF/hidden-versym.test
llvm/test/tools/llvm-readobj/ELF/merged.test
llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test
llvm/test/tools/llvm-readobj/ELF/section-types.test
llvm/test/tools/llvm-readobj/ELF/verdef-invalid.test
llvm/test/tools/llvm-readobj/ELF/verneed-flags.yaml
llvm/test/tools/llvm-readobj/ELF/verneed-invalid.test
llvm/test/tools/llvm-readobj/ELF/versioninfo.test
llvm/test/tools/llvm-readobj/ELF/versym-invalid.test
llvm/test/tools/obj2yaml/ELF/verdef-section.yaml
llvm/test/tools/obj2yaml/ELF/verneed-section.yaml
llvm/test/tools/yaml2obj/ELF/override-shname.yaml
llvm/test/tools/yaml2obj/ELF/override-shoffset.yaml
llvm/test/tools/yaml2obj/ELF/override-shsize.yaml
llvm/test/tools/yaml2obj/ELF/override-shtype.yaml
llvm/test/tools/yaml2obj/ELF/verdef-section.yaml
llvm/test/tools/yaml2obj/ELF/verneed-section.yaml
llvm/test/tools/yaml2obj/ELF/versym-section.yaml
llvm/tools/obj2yaml/elf2yaml.cpp