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

Michael Niedermayer michaelni
Sun Aug 12 11:09:52 CEST 2007


Hi

On Sat, Aug 11, 2007 at 08:14:45PM -0300, Ramiro Polla wrote:
[...]
> > why is the realignment not always done?
> >   
> 
> If ffmpeg.c is compiled with gcc, it will align main() to 16 bytes and 
> maintain alignment everywhere. If libavcodec is called from MSVC++, 
> these functions will be called with 4-byte alignment. The same happens 
> for threads (both in w32threads and pthreads-win32).

how do you know during compilation how libavcodec will be called?


> 
> > what effect does it have on object size?
> >
> >   
> 
> .text:    unpatched patched
> dsputil.o 0004e270 0004e280
> pthread.o 000003c0 000003d0
> utils.o   000029d0 00002a30

128 bytes difference

please add the realignment unconditionally! 128 bytes arent worth the
time users might end up spending due to some random crash (as well as the
number of bugreports we might get) and as someone else already said 
the ABI does not gurantee 16byte alignment so the realignment is needed

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

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070812/619c21fa/attachment.pgp>



More information about the ffmpeg-devel mailing list