This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Sparc GOTDATA support.
- From: Jakub Jelinek <jakub at redhat dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 17 Feb 2010 00:27:43 +0100
- Subject: Re: [PATCH]: Sparc GOTDATA support.
- References: <20100216.151130.207906638.davem@davemloft.net>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Feb 16, 2010 at 03:11:30PM -0800, David Miller wrote:
> Here is an example 32-bit GOTDATA code sequence:
>
> .data
> local_sym: .word 0
>
> .text
> local_addr:
> save %sp, -128, %sp
> sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
> pc: call 1f
> or %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
> add %l7, %o7, %l7
> /* GOTDATA_OP sequence */
> sethi %gdop_hix22(local_sym), %l1
> or %l1, %gdop_lox10(local_sym), %l1
Isn't this supposed to be xor instead?
> ld [%l7 + %l1], %i0, %gdop(local_sym)
> ret
> restore
>
> The linker will rewrite the three instructions under the "GOTDATA_OP
> sequence" comment into:
>
> sethi %hix22(local_sym-_GLOBAL_OFFSET_TABLE_), %l1
> or %l1, %lox10(local_sym-_GLOBAL_OFFSET_TABLE_), %l1
Here as well?
> add %l7, %l1,, %i0
>
> and eliminate the GOT slot.
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -2950,6 +2950,24 @@ case "$target" in
> [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
> [Define if your assembler supports -relax option.])])
>
> + gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs],
> + gcc_cv_as_sparc_gotdata_op,,
> + [-K PIC],
> +[.text
> +foo:
> + nop
> +bar:
> + sethi %gdop_hix22(foo), %g1
> + or %g1, %gdop_lox10(foo), %g1
and more importantly here as well?
For 32-bit code it doesn't matter so much, but for 64-bit it should.
Jakub