This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: IA32 TLS GD optimization issue
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 6 Nov 2003 18:15:31 +0100
- Subject: Re: IA32 TLS GD optimization issue
- References: <20031106174951.GA14003@lucon.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Nov 06, 2003 at 09:49:51AM -0800, H. J. Lu wrote:
> The ia32 linker can optimize TLS GD to LE or IE. But they are not
> consistent. For GD -> LE, we can turn
>
> leal foo(%reg), %eax; call ___tls_get_addr; nop
>
> into
>
> movl %gs:0, %eax; subl $foo@tpoff, %eax # 6 byte form of subl
>
> and
>
> leal foo(%reg), %eax; call ___tls_get_addr
>
> into
>
> movl %gs:0, %eax; subl $foo@tpoff, %eax # 5 byte form of subl
>
> But for GD -> IE, we only support
>
> leal foo(%reg), %eax; call ___tls_get_addr; nop
>
> to
> movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax # 6 byte form of subl
>
> since there is no 5 byte form for "subl $foo@gottpoff(%reg), %eax".
And the problem is?
Have you read http://people.redhat.com/drepper/tls.pdf ?
> Also I think this patch is needed for
>
> leal foo(%reg), %eax; call ___tls_get_addr
No. Look what line 2438 does.
> Should we support
>
> leal foo(%reg), %eax; call ___tls_get_addr
>
> at all? If yes, how should we fix it?
Can you explain what needs fixing?
> --- elf32-i386.c.tls 2003-11-04 09:43:23.000000000 -0800
> +++ elf32-i386.c 2003-11-06 09:45:57.000000000 -0800
> @@ -2473,6 +2473,7 @@ elf_i386_relocate_section (bfd *output_b
> (5 byte form of subl). */
> memcpy (contents + rel->r_offset - 2,
> "\x65\xa1\0\0\0\0\x2d\0\0\0", 11);
> + roff = rel->r_offset + 5;
> }
> }
> bfd_put_32 (output_bfd, tpoff (info, relocation),
Jakub