1 year ago
#388453
calvin
What is the difference between readelf -sD and readelf --dyn-syms
From readelf's manpage, I see that
--dyn-syms Display the dynamic symbol table
-s --syms Display the symbol table
-D --use-dynamic Use the dynamic section info when displaying symbols
So I think readelf -sD
equals readelf --dyn-syms
. However, when I test in CentOS 7, it gives the following result. I wonder why?
$readelf -sD a
Symbol table for image:
Num Buc: Value Size Type Bind Vis Ndx Name
6 0: 0000000000400580 0 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitD1Ev
2 0: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
5 1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit
4 1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main
3 1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitC1Ev
1 2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf
readelf --dyn-syms a
Symbol table '.dynsym' contains 7 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf@GLIBC_2.2.5 (2)
2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
3: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitC1Ev@GLIBCXX_3.4 (3)
4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.2.5 (2)
6: 0000000000400580 0 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitD1Ev@GLIBCXX_3.4 (3)
P.S. a is compiled from the following code, with GCC 7.3.0 by g++ a.cpp -o a
#include <iostream>
int main() {
printf("aaa");
}
elf
readelf
0 Answers
Your Answer