[llvm-readobj] - Teach tool to dump objects with >= SHN_LORESERVE of sections.
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 18 Jul 2018 08:19:58 +0000 (08:19 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 18 Jul 2018 08:19:58 +0000 (08:19 +0000)
commit6fdac3b23ad9229c953a0cede9c01af6c5605792
tree41b1c8d67ca734736de9796e46849d5eba2157c4
parentad50ae82ad4dafefdaf0779258bf164d5687e984
[llvm-readobj] - Teach tool to dump objects with >= SHN_LORESERVE of sections.

http://www.sco.com/developers/gabi/2003-12-17/ch4.eheader.html

says that e_shnum and/or e_shstrndx may have special values if
"the number of sections is greater than or equal to SHN_LORESERVE" or
"the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00)"

Previously llvm-readobj was unable to dump such files, patch changes that.

I had to add a precompiled test case because it does not seem possible to
prepare a test using yaml2obj or llvm-mc (not clear how to make .shstrtab
to have index >= SHN_LORESERVE).

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

llvm-svn: 337360
llvm/test/tools/llvm-readobj/Inputs/many-sections-stripped.elf-x86_64 [new file with mode: 0644]
llvm/test/tools/llvm-readobj/Inputs/many-sections.elf-x86_64 [new file with mode: 0644]
llvm/test/tools/llvm-readobj/many-sections.s [new file with mode: 0644]
llvm/tools/llvm-readobj/ELFDumper.cpp