[FFmpeg-devel] [PATCH] Hack around gcc 4.6 breaking asm using call.
Reimar.Doeffinger at gmx.de
Mon Aug 29 18:31:35 CEST 2011
On Mon, Aug 29, 2011 at 12:47:59AM +0200, Michael Niedermayer wrote:
> On Sun, Aug 28, 2011 at 09:16:49PM +0200, Reimar Döffinger wrote:
> > gcc 4.6 no longer decrements esp to account for local variables.
> > Thus using call will end up overwriting some local variable.
> > So add an extra one it can safely clobber.
> > This is a huge hack because it's basically pure chance it works,
> > no idea how this is supposed to be done.
> > Fixes trac ticket #397.
> > Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> if its the best we have, i wont be angry if you commit it but it really
> is the most hackish thing ive seen in a long time
Well, I am mostly wondering on whether this is/should be considered a
gcc bug, or if maybe someone knows a better solution.
There is for example an attribute to mark the function as a leaf
function, but none for the opposite it seems.
Decrementing the stack right before and reincrementing after each call
should work, too, but it costs speed and it is a bit of a hack too
since there's not really any way to know for sure where gcc puts things.
Writing the whole function in yasm instead might be possible, too, but
I don't know how well.
Other options might be to change the type of mmx2FilterCode to be an
actual function pointer type, but I'd consider it highly unlikely
that gcc is that bright that it makes a difference...
More information about the ffmpeg-devel