readelf -sD 和 readelf --dyn-syms 有什么区别
从Readelf的manpage中,我可以看到,
--dyn-syms Display the dynamic symbol table
-s --syms Display the symbol table
-D --use-dynamic Use the dynamic section info when displaying symbols
所以我认为readelf -sd
等于readelf -dyn -syms
。但是,当我在CentOS 7中进行测试时,它给出以下结果。我想知道为什么?
$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)
ps a是从以下代码中编译的,g ++ a.cpp -o a
与GCC 7.3.0编译
#include <iostream>
int main() {
printf("aaa");
}
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");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论