[Ffmpeg-devel] Re: [PATCH] Fix compilation when using --disable-opts

Alexis Ballier alexis.ballier
Sun Apr 1 00:28:18 CEST 2007

> Yes 7 registers are assumed on AMD64. And there will be 7 registers
> available because there are more registers than on 32-bit so it doesn't
> matter even if one is reserved.
> This error has nothing whatsoever to do with the number of available
> registers, and is not the one mentioned in the first link you gave in
> your original post.
> So there are 2 separate problems:
> error: PIC register '%ebx' clobbered in 'asm'
> This is the one first linked to in your original mail, and is related to
> Error: junk `(%rip)' after expression
> This has nothing to do with CONFIG_7REGS. Reimar's earlier post talked
> about this problem.

but :

$ LC_ALL=C svn diff
Index: libavutil/x86_cpu.h
--- libavutil/x86_cpu.h (revision 8578)
+++ libavutil/x86_cpu.h (working copy)
@@ -57,7 +57,7 @@
 #  define REGSP   esp

-#if defined(ARCH_X86_64) || (defined(ARCH_X86_32) &&
+#if (defined(ARCH_X86_64) || (defined(ARCH_X86_32) &&
 #  define CONFIG_7REGS 1

compiles fine on x86_64 and also in my 32 bits chroot.

Of course this patch is dumb, but as michael has said we cannot use
ebx with pic and gcc.
A possible fix would be to readd the hack that wouldnt use ebx with
pic and __GNUC__ defined, but I dunno if this is wanted.
A probably better one would be to add a check for ebx with pic in
configure with something like  :

#ifdef PIC
test ebx

compiled with -fPIC (or with a more portable way) and with
-D$LIBOBJFLAGS (the syntax is wrong but you get the idea) so that it
would be a "generic" check for ebx with pic without requiring special
ifdef's for gcc (and then update the if defined logic to reflect that)

anyway I'm just suggesting here as you probably have a better
knowledge than me on those issues.

As I see I haven't answered to your first question about how we build
pic libs on x86_32 :
    # Make it use pic always since we don't need textrels
    sed -i -e "s:LIBOBJFLAGS=\"\":LIBOBJFLAGS=\'\$\(PIC\)\':" configure

Alexis Ballier.

More information about the ffmpeg-devel mailing list