[FFmpeg-devel] Compiling with Sun cc
Roman V. Shaposhnik
Fri Oct 3 22:50:18 CEST 2008
On Fri, 2008-10-03 at 01:04 -0600, Loren Merritt wrote:
> > Huh? Meaning that it does so in crt*.o? And tough luck if you link
> > with a different crt* modules?
> main() is in ffmpeg.o not crt*.o
> I confirm that gcc compiles main() as if it had force_align_arg_pointer.
I see. Thanks for pointing that out. Is this documented somewhere?
What's the earliest version of gcc that has that behavior?
> >> 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...
> There isn't a single asm statement in ffmpeg that calls back to C. And if
> we ever need that, someone handwriting asm can preserve whatever they want,
> including alignment.
Sure. All I'm pointing out is that there's more ways to pass control
event to static functions than one usually realizes. Our codecs
register themselves via AVCodec, right? Well, I don't think that
our APIs prevent calling these registered functions directly
bypassing the usual libavcodec machinery. And if they don't these
static functions could very well be called from wherever. Right?
> >> 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.
> Forbidding SSE is expensive too.
> Even if the only way to guarantee alignment was to force_align_arg_pointer
> every nonstatic function (or every function that declares aligned data),
> that would still be a necessary cost.
Look, if gcc would guarantee that every function that declares aligned
data gets force_align_arg_pointer -- I'd be happy as a clam.
P.S. In fact, that's the implementation proposal for Sun Studio that
seems to be the top contender so far.
More information about the ffmpeg-devel