gcc-4.9.2: Assembly for i386 Target
Stefan Ring
stefanrin@gmail.com
Mon Oct 12 09:40:00 GMT 2015
On Mon, Oct 12, 2015 at 11:11 AM, Abhishek Aggarwal
<abhiinnitald@gmail.com> wrote:
> I was befuddled by the following 3 assembly instructions (generated
> right in the beginning of 'main' function):
> lea 0x4(%esp), %ecx
> and 0xfffffff0, %esp
> pushl -0x4(%ecx)
>
> I am not able to understand the purpose of these 3 instructions. Can
> anyone explain me about them? I didn't observe these 3 instructions
> when I compiled the same code with '-m64' switch instead of '-m32'.
This is for aligning the stack to 16 bytes. IIRC, the x86 ABI on Linux
does not mandate a stack alignment greater than 4 bytes (or 8 -- not
sure about the exact number), whereas the one for x86_64 does.
More information about the Gcc
mailing list