I created a quick x86_64 Assembly file with NASM to generate the four different visibility classes for ELF 64. With readelf --symbols
I get the Symbol Visibility in the Vis
column: DEFAULT
, INTERNAL
, HIDDEN
, PROTECTED
.
Symbol table '.symtab' contains 16 entries:
Num: Value Size Type Bind Vis Ndx Name
4: 000000000040007e 0 OBJECT GLOBAL PROTECTED 1 gdp
5: 0000000000400082 0 FUNC GLOBAL HIDDEN 2 gfh
6: 000000000040007a 0 OBJECT GLOBAL INTERNAL 1 gdi
8: 000000000040007c 0 OBJECT GLOBAL HIDDEN 1 gdh
9: 0000000000400083 0 FUNC GLOBAL PROTECTED 2 gfp
11: 0000000000400078 0 OBJECT GLOBAL DEFAULT 1 gdd
14: 0000000000400081 0 FUNC GLOBAL INTERNAL 2 gfi
15: 0000000000400080 0 FUNC GLOBAL DEFAULT 2 gfd
These symbols are encoded such that
- First character:
g
means they'reGLOBAL
(NASM) -- they all are. - Middle character:
f
means they're "Function",d
means they're Data - Last character:
d
efault,i
nternal,h
idden,p
rotected.
However with radare I can't figure out how to see the visibility that readelf --symbols
shows is available. Using fs symbols; f
0x0040007e 0 obj.gdp
0x00400082 0 sym.gfh
0x0040007a 0 obj.gdi
0x0040007c 0 obj.gdh
0x00400083 0 sym.gfp
0x00400078 0 obj.gdd
0x00400081 0 sym.gfi
0x00400080 0 sym.gfd
Clearly, sym
is a function and obj
is data. But how can I get radare to show me the visibility?