[PATCH] Fix 64-bit T3 invert_limb.asm on PIC again.

David Miller davem at davemloft.net
Mon Apr 15 23:12:05 CEST 2013

From: nisse at lysator.liu.se (Niels Möller)
Date: Mon, 15 Apr 2013 22:28:54 +0200

> David Miller <davem at davemloft.net> writes:
>> Accomodating a negative offset means using sethi+xor with the
>> "%hix22()" and "%lox10()" relocs, which gets us potentially right back
>> into the area where we could hit Solaris assembler/linker quirks.
> Maybe I'm missing something, but is there no easier way to sign extend
> from 32 to 64 bits? Under the (reasonable) assumption that the offset
> fits in the range of a signed 32-bit value, do we really need any fancy
> 64-bit relocation magic?

The problem is that sethi zero extends.

That's why you need to use a sethi+xor sequence to build a 32-bit
value sign extended to 64-bits.  It's the only way to do this in
2 instructions.

And if you do form a symbol relative address this way, you need to use
%hix22() and %lox10() relocations so that the linker knows that you
are using sethi+xor rather than sethi+or.

More information about the gmp-devel mailing list