[FFmpeg-devel] Compiling with Sun cc

Roman V. Shaposhnik rvs
Fri Oct 3 07:35:28 CEST 2008


On Fri, 2008-10-03 at 06:46 +0300, Uoti Urpala wrote:
> On Thu, 2008-10-02 at 20:10 -0700, Roman V. Shaposhnik wrote:
> > On Thu, 2008-10-02 at 11:09 +0200, Diego 'Flameeyes' Petten? wrote:
> > > > "libavcodec/mpegvideo_enc.c", line 3288: warning: can not set non-default
> > > > alignment for automatic variable
> > > 
> > > This basically means it does not support alignment for stack variable,
> > > which is probably a very bad thing, this is actually where I stopped and
> > > waited before continuing...
> > 
> > Well, it is very controversial thing, for one. The trouble is, that even
> > gcc can not really guarantee it, since initial stack assumptions are not
> > controlled by the compiler, but rather by the combination of an OS
> > and how linking was done.
> 
> The initial stack state is irrelevant.

We've been there, haven't we?

>  GCC will always align the stack at the start of main(). 

Huh? Meaning that it does so in crt*.o? And tough luck if you link
with a different crt* modules?

> The only way stack alignment can fail is if
> GCC-generated code is called from a function compiled with another
> compiler

Or written by hand, or generate by JIT compiler, or...

>  that does not keep the stack aligned. Even that case can be
> handled by setting the force_align_arg_pointer function attribute

Which fails on at least one version of gcc I know.

> FFmpeg uses that attribute for functions that can be called from outside the
> library and require the stack to be aligned.

Tracing all the entry points in a library such as libavcodec could
be quite tricky. And arbitrary force_align_arg_pointer is
expensive.

Thanks,
Roman.





More information about the ffmpeg-devel mailing list