[llvm-readelf] - Print unknown st_other value if present in GNU output.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 6 Sep 2019 13:05:34 +0000 (13:05 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 6 Sep 2019 13:05:34 +0000 (13:05 +0000)
commitedfd276cbc609051143d113f5e0d6b9248aebe47
tree7435f06ccfe1630c24d69d658265318bc6955b2f
parent4fc3ad9e1359ea1b9e5b923a08af400a5d680cef
[llvm-readelf] - Print unknown st_other value if present in GNU output.

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40785.

llvm-readelf does not print the st_value of the symbol when
st_value has any non-visibility bits set.

This patch:

* Aligns "Ndx" row for the default and a new cases.
(it was 1 space character off for the case when "PROTECTED" visibility was printed)

* Prints "[<other>: 0x??]" for symbols which has an additional st_other bits set.
In compare with GNU, this logic is a bit simpler and seems to be more consistent.

For MIPS GNU can print named flags, though can't print a mix of them:
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE GLOBAL DEFAULT [OPTIONAL] UND a1
2: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PLT] UND a2
3: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PIC] UND a3
4: 00000000 0 NOTYPE GLOBAL DEFAULT [MICROMIPS] UND a4
5: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS16] UND a5
6: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: c] UND b1
7: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: 28] UND b2

On PPC64 it can print a localentry value that is encoded in the high bits of st_other
63: 0000000000000850 208 FUNC GLOBAL DEFAULT [<localentry>: 8] 12

We chose to print the raw st_other field, prefixed with '0x'.

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

llvm-svn: 371201
llvm/test/tools/llvm-readobj/elf-symbol-visibility.test
llvm/tools/llvm-readobj/ELFDumper.cpp