[NFC][llvm-readobj] Split getSectionIndexName function into two
authorJames Henderson <jh7370@my.bristol.ac.uk>
Fri, 1 Nov 2019 10:27:00 +0000 (10:27 +0000)
committerJames Henderson <jh7370@my.bristol.ac.uk>
Fri, 1 Nov 2019 11:48:31 +0000 (11:48 +0000)
commitd835bc004af25d3431977047e13d1bbc5cef5b91
treebb36732afcb00de7228d314a294ea25e07740133
parent490f6f3211cb54d109a14be78520441b711af669
[NFC][llvm-readobj] Split getSectionIndexName function into two

getSectionIndexName was trying to fetch two things at once, which led to
a somewhat tricky to understand interface involving passing output
parameters in, and also made it hard to return Errors further up the
stack.

This change is in preparation for changing the error handling.

Additionally, update a related test now that yaml2obj supports
SHT_SYMTAB_SHNDX properly (see d3963051c490), and add missing LLVM-style
coverage for symbols with shndx SHN_XINDEX. This test (after fixing)
caught a mistake in my first attempt at this patch, hence I'm including
it as part of this patch.

Reviewed by: grimar, MaskRay

Differential Revision: https://reviews.llvm.org/D69670
llvm/test/tools/llvm-readobj/elf-symbol-shndx.test
llvm/tools/llvm-readobj/ELFDumper.cpp