macOS汇编语言摘要
来源:互联网 发布:视频马赛克复原软件 编辑:程序博客网 时间:2024/06/11 03:15
C++
int global_value = 1;static int static_value = 2;void foo(){ static_value = 3;}int global_value_uninitialized;static int static_value_uninitialized;int main(){ static_value_uninitialized = 4;}
在Terminal中执行
cc -arch i386 -S hello.cpp
得到汇编语言
.section __TEXT,__text,regular,pure_instructions .globl __Z3foov .p2align 4, 0x90__Z3foov: pushl %ebp movl %esp, %ebp calll L0$pbL0$pb: popl %eax movl $3, __ZL12static_value-L0$pb(%eax) popl %ebp retl .globl _main .p2align 4, 0x90_main: pushl %ebp movl %esp, %ebp calll L1$pbL1$pb: popl %eax xorl %ecx, %ecx movl $4, __ZL26static_value_uninitialized-L1$pb(%eax) movl %ecx, %eax popl %ebp retl .section __DATA,__data .globl _global_value .p2align 2_global_value: .long 1 .p2align 2__ZL12static_value: .long 2 .globl _global_value_uninitialized.zerofill __DATA,__common,_global_value_uninitialized,4,2.zerofill __DATA,__bss,__ZL26static_value_uninitialized,4,2
可以看到代码放在(__TEXT,__text)
中
global_value和static_value放在(__DATA,__data)
中
global_value_uninitialized放在(__DATA,__common)
中
static_value_uninitialized放在(__DATA,__bss)
中
代码
.section __TEXT,__text,regular,pure_instructions
有个简写的等价directive
.text
代码
.section __DATA,__data
有个简写的等价directive
.data
代码
.zerofill __DATA,__common,_global_value_uninitialized,4,2
有个简写的等价directive
.comm _global_value_uninitialized,4
代码
.zerofill __DATA,__bss,__ZL26static_value_uninitialized,4,2
有个简写的等价directive
.lcomm __ZL26static_value_uninitialized,4,2
阅读全文
0 0
- macOS汇编语言摘要
- 汇编语言学习摘要
- 《汇编语言》王爽版重点摘要-----第一章
- 《汇编语言》王爽版重点摘要-----第二章
- 《汇编语言》王爽版重点摘要-----第三章
- 《汇编语言》王爽版重点摘要-----第四章
- 《汇编语言》王爽版重点摘要-----第五章
- macOS
- macOS
- macOS
- macOS
- MacOS
- macOS
- 摘要
- 摘要
- 摘要
- 摘要
- 摘要
- 缓存
- 使用SourceTree 提交本地代码到github小记
- 未能加载文件或程序集“Newtonsoft.Json”或它的某一个依赖项。
- POJ 1741 Tree
- (转载) linux打开eclipse 崩溃
- macOS汇编语言摘要
- Codeforces Round #425 (Div. 2)A. Sasha and Sticks
- System.Timers.Timer是多线程定时器
- LeetCode 28. Implement strStr()
- Cocos2dx中字符的转换
- 归纳总结C#中的各种定时器
- 编程题(买帽子求第三便宜价格)
- Mac上尝试安装最新的WireShark-2.4后在Launchpad里看不到App图标的问题
- Web中的Grunt:任务自动管理工具的基本介绍