Port-i386 archive

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

Re: gcc stack alignment

On Sun, Dec 30, 2012 at 08:46:36PM +0000, David Laight wrote:
> Currently gcc for i386 in NetBSD is configured to conform to the historic
> The following patch (and the equivalent one for the amd64 compiler)
> reverts the change made just before NetBSD 6.0 was branched, but
> defaults to setting the flag to realign the stack if anything
> requiring 16b-byte alignemnt is allocated on-stack.
> This will probably fix things for the programs that failed in
> NetBSD 5.0.

I am aware of exactly one source of code failing so far with the default
and that's the horrible unportable mess called ffmpeg. There is an easy
workaround using compiler options for that. Your change doesn't fix
non-GCC compilers either and is known to generate broken code for one
case (the aligned 64bit case). The MMX assertion is fixed, so it is no
longer relevant for the discussion and arguably is a separate bug in
GCC. As such, I don't believe your patch improves the situation. A
better compiler handling would (a) realign the stack if it requires more
than 32bit alignment (b) keep the stack manipulation to the right offset
modulo 128bit. Your patch doesn't do that and from reading the GCC
source, I'm not sure that is easy to do.


Home | Main Index | Thread Index | Old Index