nm命令输出解释

nm 将找到的符号值使用十六进制缺省表示,并在函数前添加其类型,类型主要有:

ValueDescripitionNote
AThe symbol's value is absolute, and will not be changed by further linking.符号绝对,链接过程不会改变
B/bThe symbol is in the uninitialized data section (known as BSS).非初始化符号
CThe symbol is common.公有符号,链接时会被同名符号覆盖
D/dThe symbol is in the initialized data section.初始化符号
G/gThe symbol is in an initialized data section for small objects.初始化符号,面向小数据访问优化
IThe symbol is an indirect reference to another symbol.其它符号的间接引用
NThe symbol is a debugging symbol.调试符号
PThe symbols is in a stack unwind section.栈区符号(清空)
R/rThe symbol is in a read only data section.符号只读
S/sThe symbol is in an uninitialized data section for small objects.非初始化符号,面向小数据访问优化
T/tThe symbol is in the text (code) section.代码区符号
UThe symbol is undefined.未定义或在外部定义的符号
uThe symbol is a unique global symbol.全局唯一,GNU保留符
V/vThe symbol is a weak object.弱定义符(详见C++强弱符号定义)
W/wThe symbol is a weak symbol that has not been specifically tagged as a weak object symbol.emm...绕口令符号
-The symbol is a stabs symbol in an a.out object file.stabs格式符号
?The symbol type is unknown, or object file format specific.NM也不认识的符号

注意几点:

  • -C 总是适用于c++编译出来的对象文件。还记得c++中有重载么?为了区分重载函数,c++编译器会将函数返回值/参数等信息附加到函数名称中去形成一个mangle过的符号,那用这个选项列出符号的时候,做一个逆操作,输出那些原始的、我们可理解的符号名称。
  • 使用 -l 时,必须保证你的对象文件中带有符号调式信息,这一般要求你在编译的时候指定一个 -g 选项,见 Linux:Gcc
  • 使用nm前,最好先用Linux:File查看对象文件所属处理器架构,然后再用相应交叉版本的nm工具。
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值