[FFmpeg-devel] Stack variables alignment check in libavcodec/dsputil.c

Michael Niedermayer michaelni
Mon Jul 30 23:26:51 CEST 2007


Hi

On Mon, Jul 30, 2007 at 01:49:01PM -0700, Roman Shaposhnick wrote:
> Hi,
> 
> On Mon, 2007-07-30 at 22:05 +0200, Alex Beregszaszi wrote:
> > Hi,
> > 
> > > does the following code really belong to libavcodec/dsputil.c? Shouldn't
> > > it be moved to configure? Or at least duplicated there as well.
> > 
> > I think it is ok to reside there, and anyway, it must be a message
> > printed on runtime imho, to inform the user.
> 
>   Well, I might've agreed with the above statement if we have anything
> in our public header that would depend on that functionality, but it
> seems that once you're done compiling libav* and ffmpeg -- that's it.
> You might never ever use that compiler again.
> 
>   I do agree that printing it in runtime identifies the executable
> as the one with potential problems, but frankly a big WARNING message
> during the configure step would achieve the same result. Warn the one
> who is doing a build and not confuse somebody for whom it too late to
> fix the problem anyway.

the problem is that things depend on how functions from libav* are called
if they are called with a missaligned stack then things will fail, its
very possible that ffmpeg.c / configure do not call them with a misaligned
stack, so theres no way this test can be done during configure
also dont forget things called by "thread start functions" they too can
have alignment issues

so the alignment check failure mean one or more of the following is true
* stack was not aligned on entry AND gcc did not realign it 
* gcc did not maintain alignment

the gcc behavior depends at least on its version, and various options
given to it
the initial alignment depends on your OS and how it loads the executable
as well as how the application which calls lavc as been compiled and
how the thread lib has been compiled ...



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070730/3e364f47/attachment.pgp>



More information about the ffmpeg-devel mailing list