GCC输出带C源代码的汇编文件

一、

g++ -S hello.cpp //输出hello.S
g++ -g -c hello.cpp //输出hello.o
objdump -S hello.o > hello_objdump.s

二、

g++ -c -g -Wa,-adlhn hello.cpp > gnu.s

-Wa,option :把选项option传递给汇编器.如果option含有逗号,就在逗号处分割成多个选项.也就是Gas,至于Gas的命令参数,可以查看相应的文档,其中-a[cdghlns]参数的作用是打开列表功能。

Gas的命令行参数概要信息摘录如下:

1: a: -a[cdghlns] enable listings
2: alternate: --alternate enable alternate macro syntax
3: D: -D for compatibility
4: f: -f to work faster
5: I: -I for .include search path
6: K: -K for difference tables
7: L: -L to retain local symbols
8: listing: --listing-XXX to configure listing output
9: M: -M or --mri to assemble in MRI compatibility mode
10: MD: --MD for dependency tracking
11: o: -o to name the object file
12: R: -R to join data and text sections
13: statistics: --statistics to see statistics about assembly
14: traditional-format: --traditional-format for compatible output
15: v: -v to announce version
16: W: -W, --no-warn, --warn, --fatal-warnings to control warnings
17: Z: -Z to make object file even after errors

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值