我使用的是CompCert,它编译
int main() { return 0; }至
# File generated by CompCert 2.3pl2
# Command line: -S test2.c
.text
.align 16
.globl main
main:
.cfi_startproc
subl $12, %esp
.cfi_adjust_cfa_offset 12
leal 16(%esp), %edx
movl %edx, 0(%esp)
xorl %eax, %eax
addl $12, %esp
ret
.cfi_endproc
.type main, @function
.size main, . - main注意,这是AT&T语法。
这是在干什么?
我不熟悉subl,leal,movl的模式。
我只见过
push %ebp
movl %esp, %ebp
...
leave模式。
发布于 2015-04-03 21:59:25
[ESP + 4]指向proc条目上的返回地址。
[ESP + xx]指的是proc输入参数。
局部变量的[ESP - xx]储备位置

https://stackoverflow.com/questions/29421280
复制相似问题