This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix IA-32 TLS handling with symbol versioning


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]