help!
Eric Botcazou
ebotcazou@libertysurf.fr
Fri Jun 28 06:17:00 GMT 2002
> WHY?
In order to enforce 16-byte stack alignment.
> According to our knowledge, the number should be 12 rather than 24.
egcs 1.1.2 gives 4, 8, 12 respectively because it enforced only 4-byte
alignment.
> CAN YOU EXPLAIN THE REASON AND THE RULES OF STACK SPACE ALLOCATION?
I use gcc 3.1 as the support, which gives 8, 8, 24 respectively:
- the stack is 16-byte aligned at startup,
- calling main() pushes 4 bytes onto the stack,
- likewise for pushl %ebp,
Therefore, to enforce 16-byte alignment after allocating local variables,
you need to substract 8 from the stack pointer if there are less than 2
dword variables, otherwise 24 if there are less than 6 dword variables and
so on.
--
Eric Botcazou
ebotcazou@multimania.com
More information about the Gcc
mailing list