[FFmpeg-devel] Why 'You can only build one library type at once on MinGW'?

Trent Piepho xyzzy
Fri May 11 07:09:04 CEST 2007


On Thu, 10 May 2007, Rich Felker wrote:
> > On Wed, May 09, 2007 at 03:32:11PM -0700, Trent Piepho wrote:
> > On Wed, 9 May 2007, Rich Felker wrote:
> > > > On Wed, May 09, 2007 at 03:57:01PM +0100, M??ns Rullg??rd wrote:
> > > > Rich Felker wrote:
> > > > > Nope, this is not true. Rather, without PIC, relocations remain inline
> > > > > in the code rather than isolated to GOT/PLT tables. This means that
> > > > > the dynamic linker must modify large amounts of code at startup
> > > > > (runtime), resulting in unsharable pages and bad initial performance.
> > > > > However it in no way precludes relocation.
> > > >
> > > > On x86_64 it does, at least in the general case.  A 32-bit immediate operand
> > > > might need 64 bits after relocation.  Theoretically, the compiler could have
> > > > a flag telling it to make all relocatable values 64-bit, but gcc doesn't to
> > > > my knowledge have such an option.
> > >
> > > This is a bug in the assembler..
> >
> > How do you solve this?  The x86-64 ISA only allows for 32-bit displacements
> > in addresses and (in general) 32-bit immediate operands.
> >
> > I do not understand how you can do a 64-bit relocation on a 32-bit field.
>
> There's no opcode variant with a 64bit value? Sorry I don't know
> x86-64 asm so I don't know how to fix it.

There's no opcode variant for 64-bit displacements.  The mod field in the
ia32/x86-64 operand format is 2-bits.  0 = no displacement, 1 = one byte
displacement, 2 = 32-bit displacement, 3 = operand is register, not memory
address.

In x86-64, this isn't changed.  There is no option for a 64 bit displacement.
I imagine that AMD figured out that making displacements 64 bits instead of 32
bits was a net loosing proposition.  Using position independent code when
necessary is probably faster than bloating all code with 64-bit displacements
so text relocations are possible.  Even on ia32, were no instruction bloating
is necessary, PIC is almost always better than text relocations.

There is a "mov imm64, reg64" instruction.  I think there might be a "mov
disp64, reg64" instruction too, but I'm not sure.

It's not a problem with text relocations not being supported by the assembler
or dynamic linker.  The amd-64 architecture just doesn't allow it.




More information about the ffmpeg-devel mailing list