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

Trent Piepho xyzzy
Fri Feb 8 22:03:56 CET 2008

On Fri, 8 Feb 2008, Thorsten Jordan wrote:
> > Why does it fail with pic for you?
> the same problem that was discussed several times on this list, gcc
> fails to generate the code because it runs out of registers (ebx is used
> with -fPIC):

Since version 3 something, gcc can use other registers besides ebx, and
might not use ebx at all if the function doesn't do anything that requires
access to the pic pointer.  If a function accesses no globals, does not
take the address of a fuction, or call a function in another shared
library, it shouldn't need to load the pic register.

The real problem isn't ebx, it's accessing globals.  In non-PIC code, a
memory reference to a global takes zero registers.  In PIC code, it takes
one register.  In some cases multiple global references can share the same
register(s), so gcc doesn't always need one per global.  But this could
still easily add a half dozen extra registers to an asm block.

More information about the ffmpeg-devel mailing list