Geo*_* R. 2 assembly gcc intel
我想知道为什么gcc为函数引入了一个新的序言(以及结语) - 尤其是main(),因为我只分析它.例如,之前,它是:
push ebp
mov ebp, esp
sub esp, 0x... ; Allocate memory space into the stack
; ... Some code
; Epilogue
leave
ret
Run Code Online (Sandbox Code Playgroud)
现在这有点复杂(至少要理解):
lea ecx,[esp+0x4]
and esp,0xfffffff0
push DWORD PTR [ecx-0x4]
push ebp
mov ebp,esp
push ecx
sub esp,0x64
; Some code
; Epilogue
add esp,0x64
pop ecx
pop ebp
lea esp,[ecx-0x4]
ret
Run Code Online (Sandbox Code Playgroud)
我明白具体是什么,但我无法弄清楚它的目的 .是否使得利用(堆栈溢出)尝试更棘手?另一个召集会议?只是为了让堆栈更安全?(因为我在战争游戏中遇到了这个东西)
最后,我的gcc版本是:gcc版本4.3.2(Debian 4.3.2-1.1)
提前致谢!
目的是将堆栈对齐在16字节边界上.