[PATCH] Improve and consolidate sparc PIC assembler.

David Miller davem at davemloft.net
Thu Apr 11 21:52:48 CEST 2013


I've done some more research into this.

I first made sure that we are using the same test that GCC uses to
enable the use of gotdata relocations.

Then I read over the new m4 LEA macros a few times, the only thing
I found was that I left around a local label that was only necessary
for an earlier revision of my changes, patch below to delete it.

Next, I tried to reproduce the asm --> s file made for gcd_1.asm to
try and double check the assembler output, I did this by configuring
for ultrasparc3-linux and forcing HAVE_SHARED_THUNKS to "no" in the
created config.m4

The line numbers match up with your report and the assembler line
looks fine as far as I can tell.  Also the lines surrounding look
ok too, just in case the line number reported by the assembler is
not correct for some reason.

The last remaining possible difference I can come up with is that
the build will pass "-K PIC" to the assembler (because of -fPIC
in the gcc command line) but for the relocation test in acinclude.m4
we don't pass that option.  Could you try, on swift.nada.kth.se,
a test file:

	.text
        sethi   %gdop_hix22(ctz_table), %i5
        xor     %i5, %gdop_lox10(ctz_table), %i5
        ldx     [%l7 + %i5], %i5, %gdop(ctz_table)

and then try to build it with:

	gcc -O2 -m64 -c -o test.o test.s

and then:

	gcc -O2 -m64 -fPIC -c -o test.o test.s

Finally, try to fetch the gcc command line used by the gotdata test in
config.log   Maybe we can include the config.log output in the build
farm links just like config.h currently is?  That would help diagnose
things like this.

Thanks!

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

	* mpn/sparc32/sparc-defs.m4 (LEA): Remove unused local label.
	(LEA_LEAF): Likewise.

diff -r ace68333a9dc mpn/sparc32/sparc-defs.m4
--- a/mpn/sparc32/sparc-defs.m4	Wed Apr 10 22:42:33 2013 +0200
+++ b/mpn/sparc32/sparc-defs.m4	Thu Apr 11 12:39:33 2013 -0700
@@ -50,7 +50,7 @@
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %`$3'
 	call	__sparc_get_pc_thunk.`$3'
 	 or	%`$3', %lo(_GLOBAL_OFFSET_TABLE_+4), %`$3'
-99:	sethi	%gdop_hix22(`$1'), %`$2'
+	sethi	%gdop_hix22(`$1'), %`$2'
 	xor	%`$2', %gdop_lox10(`$1'), %`$2'
 ifdef(`HAVE_ABI_64',`
 	ldx	[%`$3' + %`$2'], %`$2', %gdop(`$1')',`
@@ -58,7 +58,7 @@
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %`$3'
 	call	__sparc_get_pc_thunk.`$3'
 	 or	%`$3', %lo(_GLOBAL_OFFSET_TABLE_+4), %`$3'
-99:	sethi	%hi(`$1'), %`$2'
+	sethi	%hi(`$1'), %`$2'
 	or	%`$2', %lo(`$1'), %`$2'
 ifdef(`HAVE_ABI_64',`
 	ldx	[%`$3' + %`$2'], %`$2'',`
@@ -82,7 +82,7 @@
 	mov	%o7, %`$2'
 	call	__sparc_get_pc_thunk.`$3'
 	 or	%`$3', %lo(_GLOBAL_OFFSET_TABLE_+4), %`$3'
-99:	mov	%`$2', %o7
+	mov	%`$2', %o7
 	sethi	%gdop_hix22(`$1'), %`$2'
 	xor	%`$2', %gdop_lox10(`$1'), %`$2'
 ifdef(`HAVE_ABI_64',`
@@ -92,7 +92,7 @@
 	mov	%o7, %`$2'
 	call	__sparc_get_pc_thunk.`$3'
 	 or	%`$3', %lo(_GLOBAL_OFFSET_TABLE_+4), %`$3'
-99:	mov	%`$2', %o7
+	mov	%`$2', %o7
 	sethi	%hi(`$1'), %`$2'
 	or	%`$2', %lo(`$1'), %`$2'
 ifdef(`HAVE_ABI_64',`


More information about the gmp-devel mailing list