[MPlayer-dev-eng] [RFC] rc2

Uoti Urpala uoti.urpala at pp1.inet.fi
Mon Apr 9 04:28:41 CEST 2007

On Mon, 2007-04-09 at 03:31 +0200, Michael Niedermayer wrote:
> gcc before 4.something simply assumed correct alignment on function entry
> which is not true under some circumstances on win32 (ive no faint clue
> when or if theres a relation to mingw/cygwin ...)

gcc still assumes that by default. Here are the relevant gcc changes I'm
aware of:

- gcc versions older than 4 ignored alignment attributes for stack
- gcc 4+ handles alignment up to 16 bytes correctly. However it relies
on the stack itself being 16-byte aligned. gcc will automatically align
the stack when entering main() and maintain alignment in functions it
generates itself, but if you mix code from some other compiler which
doesn't keep the stack aligned (mainly happens on Windows) then things
can break.
- gcc 4.2+ supports an option and a per-function attribute to generate
extra code to realign the stack on function entry. So if you intend to
mix the code with some that doesn't keep the stack aligned then you can
either set the option or if you have a limited set of interface
functions then set the attribute for those only.

> (and xine on linux with their overriden -mpreferred-stack-boundary too breaks
> stack alignment on entry to lavc functions and there are probably other cases
> ...)

Seems xine has fixed those nonsense options on 2007-02-18.

More information about the MPlayer-dev-eng mailing list