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

David Miller davem at davemloft.net
Mon Apr 15 23:09:54 CEST 2013


From: Torbjorn Granlund <tg at gmplib.org>
Date: Mon, 15 Apr 2013 22:34:24 +0200

> David Miller <davem at davemloft.net> writes:
> 
>   Some of this stuff doesn't work, for example, from invert_limb.asm:
>   
>   +       rd      %pc, %g3
>   +       sethi   %hi(_GLOBAL_OFFSET_TABLE_+4), %g4
>   +       add     %g4, %lo(_GLOBAL_OFFSET_TABLE_+8), %g4
>   +       add     %g3, %g4, %g4
>           sethi   %hi(approx_tab-512), %g2
>           or      %g2, %lo(approx_tab-512), %g2
>   +       ldx     [%g4+%g2], %g2
>   
>   You can't use "approx_tab-512", you're addressing the GOT slot
>   of the resolved address, not the address itself.
>   
>   That's why my fix used:
>   
>   	sethi   %hi(approx_tab), %g2
>   	or      %g2, %lo(approx_tab), %g2
>   	ldx     [%g4+%g2], %g2
>   	sub	%g2, 512, %g2
>   
> What you say makes a lot of sense.  But I did run complete tests on two
> systems...

Please double check because that PIC sequence you're using should
load garbage.

And if anything it broke binutils+gcc builds on Sparc.


More information about the gmp-devel mailing list