[FFmpeg-devel] Question about -fPIC usage for some files

Rich Felker dalias
Sun Feb 10 05:31:28 CET 2008

On Sun, Feb 10, 2008 at 05:09:21AM +0100, Michael Niedermayer wrote:
> > It's also somewhat problematic to save
> > and restore esp in a thread safe manner
> true

Store it in a floating point/mmx/whatever register. =)

> > or receive signals with an invalid
> > stack.
> An OS not switching stacks for signals, interrupts, ... is broken
> even windows did this >10 years ago

POSIX (or maybe only Unix(tm)? i.e. XSI extension) supports alternate
signal stacks, but library code would be insane to assume it has the
right to play with the caller's environment by setting one up... There
are also major disadvanatages to using alternate stacks such as
address space fragmentation and inability for them to grow like the
real stack does without running into other memory.. Overall I think
the approach of having a single stack is smarter except for very
special-purpose code...

BTW, IIRC the original Windows threads implementation had the stack
address space mapped differently for each thread, so that a pointer to
an object on one thread's stack could not be used from another thread.
This is far more broken than anything unix OS's have ever done...


More information about the ffmpeg-devel mailing list