This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Fix IA-32 TLS handling with symbol versioning
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com, drow at mvista dot com
- Date: Wed, 31 Jul 2002 09:27:18 +0930
- Subject: Re: [PATCH] Fix IA-32 TLS handling with symbol versioning
- References: <20020730203028.J20867@sunsite.ms.mff.cuni.cz>
On Tue, Jul 30, 2002 at 08:30:28PM +0200, Jakub Jelinek wrote:
> Hi!
>
> If _bfd_elf_link_hash_copy_indirect is swapping h->got.offset values,
> tls_type needs to match that, otherwise the backend gets confused with
> GOT_UNKNOWN values where it is not expecting them.
>
> 2002-07-30 Jakub Jelinek <jakub@redhat.com>
>
> * elf32-i386.c (elf_i386_copy_indirect_symbol): Swap tls_type
> if _bfd_elf_link_hash_copy_indirect will swap got.refcount.
>
> --- bfd/elf32-i386.c.jj 2002-07-30 16:14:55.000000000 +0200
> +++ bfd/elf32-i386.c 2002-07-30 18:06:40.000000000 +0200
> @@ -809,6 +809,14 @@ elf_i386_copy_indirect_symbol (dir, ind)
> eind->dyn_relocs = NULL;
> }
>
> + if (ind->root.type == bfd_link_hash_indirect
> + && dir->got.refcount <= 0)
> + {
> + int type = edir->tls_type;
> +
> + edir->tls_type = eind->tls_type;
> + eind->tls_type = type;
> + }
> _bfd_elf_link_hash_copy_indirect (dir, ind);
> }
Won't a simpler patch like the following work?
@@ -809,6 +809,8 @@ elf_i386_copy_indirect_symbol (dir, ind)
eind->dyn_relocs = NULL;
}
+ edir->tls_type = eind->tls_type;
+ eind->tls_type = GOT_UNKNOWN;
_bfd_elf_link_hash_copy_indirect (dir, ind);
}
I'm particularly concerned that you seem to think it necessary to
_swap_ tls_type. Is there a code somewhere that needs to follow
the link for an indirect symbol?
Also the ind->root.type == bfd_link_hash_indirect test means weak
syms won't get the tls info when you later find a tls definition.
Maybe that's what you want.
--
Alan Modra
IBM OzLabs - Linux Technology Centre