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

David Miller davem at davemloft.net
Mon Apr 15 21:28:50 CEST 2013

I use rd %pc here, since moving forward that's what we're going to

I tried to look into doing something like:

L(pc):	rd	%pc, %g2
	sethi	%hi(approx_tab-L(pc)-512), %g3
	or	%g3, %lo(approx_tab-L(pc)-512), %g3
	add	%g2, %g3, %g3

but we can't do that on 64-bit, we have to handle this properly regardless
of how the linker orders the .text section relative to the .rodata section,
which means we need to be able to potentially have a negative offset here.

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.

Meanwhile, I'm going to install Solaris10 on my Ultra-III box here
over the next day or two and work on looking into what's going wrong
with the gotdata stuff since I've gotten nothing but silence on the
test tarball.

Torbjon, is the gcc on that Solaris box of your's the one that came as
part of the Solaris install?


2013-04-15  David S. Miller  <davem at davemloft.net>

	* mpn/sparc64/ultrasparct3/invert_limb.asm: Fix address formation.

diff -r 072b7964204b mpn/sparc64/ultrasparct3/invert_limb.asm
--- a/mpn/sparc64/ultrasparct3/invert_limb.asm	Mon Apr 15 16:30:00 2013 +0200
+++ b/mpn/sparc64/ultrasparct3/invert_limb.asm	Mon Apr 15 12:21:45 2013 -0700
@@ -34,8 +34,18 @@
 	srlx	d, 55, %g1
 	add	%g1, %g1, %g1
-	sethi	%hi(approx_tab-512), %g2
-	or	%g2, %lo(approx_tab-512), %g2
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %g3
+	rd	%pc, %g2
+	add	%g3, %lo(_GLOBAL_OFFSET_TABLE_+4), %g3
+	add	%g2, %g3, %g3
+	sethi	%hi(approx_tab), %g2
+	or	%g2, %lo(approx_tab), %g2
+	ldx	[%g3+%g2], %g2
+	sub	%g2, 512, %g2
+	setx	approx_tab-512, %g3, %g2
 	lduh	[%g2+%g1], %g3
 	srlx	d, 24, %g4
 	add	%g4, 1, %g4

More information about the gmp-devel mailing list