Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fix GCC's preferred stack alignment to match psABI

On Mon, Sep 17, 2012 at 06:34:45PM +0100, David Laight wrote:
> If we set -mstackalign and align the stack in exec and for threads,
> then the stack stays aligned through gcc calls - giving aligned
> 8 byte items, but any frames that need 16bit alignment get the stack
> realigned (which involves using %ebp relative addressing for the args
> and %esp relative addressing for the local (unless alloca() is also used)).

As shown by the attached minimal test case, GCC does not correctly
maintain stack alignment if only -mstackalign is used. In short, it
doesn't work correctly. This is independent of the question whether
preserving a stack alignment of 128bit is preferable or not.

void a(int *);

void b(void)
        int __attribute__((aligned(8))) c;

Home | Main Index | Thread Index | Old Index