[llvm-readelf]Don't lose negative-ness of negative addends for no symbol relocations
authorJames Henderson <jh7370@my.bristol.ac.uk>
Fri, 8 Mar 2019 13:22:05 +0000 (13:22 +0000)
committerJames Henderson <jh7370@my.bristol.ac.uk>
Fri, 8 Mar 2019 13:22:05 +0000 (13:22 +0000)
commitb41130bedcd3605b821f51ea70cbf0672066f96a
treeef7a0ad839a80217cf4f0eda410063fd8d7cc720
parent6bce2f8ee5db2a038f25a34f40b7d65e304344c3
[llvm-readelf]Don't lose negative-ness of negative addends for no symbol relocations

llvm-readelf prints relocation addends as:

  <symbol value>[+-]<absolute addend>

where [+-] is determined from whether addend is less than zero or not.
However, it does not print the +/- if there is no symbol, which meant
that negative addends became their positive value with no indication
that this had happened. This patch stops the absolute conversion when
addends are negative and there is no associated symbol.

Reviewed by: Higuoxing, mattd, MaskRay

Differential Revision: https://reviews.llvm.org/D59095

llvm-svn: 355696
llvm/test/tools/llvm-readobj/elf-reloc-negative-addend-no-sym.test [new file with mode: 0644]
llvm/tools/llvm-readobj/ELFDumper.cpp