This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: help!
- From: "Eric Botcazou" <ebotcazou at libertysurf dot fr>
- To: "tony_hcb" <tony_hcb at sina dot com>
- Cc: <gcc at gnu dot org>,<gcc-owner at gcc dot gnu dot org>
- Date: Fri, 28 Jun 2002 13:02:56 +0200
- Subject: Re: help!
- References: <20020628042854.20944.qmail@sina.com>
> 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