This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: help!


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]