[FFmpeg-devel] Compiling with Sun cc
Fri Oct 3 09:04:20 CEST 2008
On Thu, 2 Oct 2008, Roman V. Shaposhnik wrote:
> 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:
>>> 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.
>> 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?
main() is in ffmpeg.o not crt*.o
I confirm that gcc compiles main() as if it had force_align_arg_pointer.
>> The only way stack alignment can fail is if
>> GCC-generated code is called from a function compiled with another
> 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,
>> 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
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.
More information about the ffmpeg-devel