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

Torbjorn Granlund tg at gmplib.org
Mon Apr 15 23:04:33 CEST 2013


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

The code I used works on Solaris, not on GNU...
I checked in a fix (but adjust g1 instead, for efficiency).

I will automated setup testing of the T3 stuff for Solaris as well as
GNU.  The test harness handles such things.  I'll also make sure all old
sparc32 code is tested automtically under Solaris and GNU.

-- 
Torbjörn


More information about the gmp-devel mailing list