【发布时间】:2012-04-27 22:44:29
【问题描述】:
当我编译下面的函数时:gcc -S teste.c
void readInput() {
int buf;
}
teste.S 变为:
readInput:
pushl %ebp
movl %esp, %ebp
subl $16, %esp
leave
ret
我的疑问是:为什么 %esp 是从 16 个字节中减去的,对于 int 来说不应该是 4 个字节吗?跟对齐有关系吗?
当我编译这个时会发生类似的事情:
void readInput() {
char buf;
}
输出和上面一样。
【问题讨论】:
标签: gcc assembly compiler-construction