[llvm-readelf/obj] - Print section symbol names properly when dumping relocations.
authorGeorgii Rymar <grimar@accesssoftek.com>
Fri, 11 Sep 2020 13:26:59 +0000 (16:26 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Wed, 23 Sep 2020 10:25:39 +0000 (13:25 +0300)
commitd4035af2537432da41b2728829f8cd2fca9a9de8
treeda5ecdc16c702c69806e60cb8490e0c16e428cd3
parentca907bfb57d8ad3ec3bcc2cff2abab7b1b933af6
[llvm-readelf/obj] - Print section symbol names properly when dumping relocations.

Currently `--relocations` ignores section symbol names and always prints
section names for them. This is inconsistent with GNU readelf and with `--symbols`.

We have a code in `getFullSymbolName` (which is used for `--symbols`) which can be
reused for `getRelocationTarget` (used for `--relocations`).
With that the issue described is fixed and code becomes a bit shorter.
Also with this change we start to print more relocations (in situations when we just
showed warnings instead before) and also start to report more diagnostic warnings
(see reloc-zero-name-or-value.test).

Differential revision: https://reviews.llvm.org/D87613
llvm/test/tools/llvm-objcopy/ELF/Inputs/compress-debug-sections.yaml
llvm/test/tools/llvm-readobj/ELF/reloc-zero-name-or-value.test
llvm/test/tools/llvm-readobj/ELF/relocation-errors.test
llvm/test/tools/llvm-readobj/ELF/section-symbols.test
llvm/tools/llvm-readobj/ELFDumper.cpp