This is the mail archive of the binutils@sourceware.org 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] x86: Check the versioned __tls_get_addr symbol


On Fri, Jan 19, 2018 at 4:20 PM, Alan Modra <amodra@gmail.com> wrote:
> On Fri, Jan 19, 2018 at 10:57:37AM -0800, H.J. Lu wrote:
>> --- a/bfd/elfxx-x86.c
>> +++ b/bfd/elfxx-x86.c
>> @@ -856,7 +856,16 @@ _bfd_x86_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info)
>>                                   htab->tls_get_addr,
>>                                   FALSE, FALSE, FALSE);
>>         if (h != NULL)
>> -         elf_x86_hash_entry (h)->tls_get_addr = 1;
>> +         {
>> +           elf_x86_hash_entry (h)->tls_get_addr = 1;
>> +
>> +           /* Check the versioned __tls_get_addr symbol.  */
>> +           while (h->root.type == bfd_link_hash_indirect)
>> +             {
>> +               h = (struct elf_link_hash_entry *) h->root.u.i.link;
>> +               elf_x86_hash_entry (h)->tls_get_addr = 1;
>> +             }
>> +         }
>
> I think it would be a little more bomb proof to pass follow=TRUE on
> the elf_link_hash_lookup call, and then always test the flag on the
> real symbol (which would mean a patch to elf_i386_check_tls_transition
> and elf_x86_64_check_tls_transition).  We have some really odd cases

I'd like to keep the change as small as possible for backporting to
2.30.

> in _bfd_elf_merge_symbol where a versioned symbol can end up pointing
> at the undecorated symbol.  So it might be possible to have
>   __tls_get_addr@VER -> __tls_get_addr -> __tls_get_addr@@VER
> in which case you wouldn't set the flag on __tls_get_addr@VER.
>

But I do want to cover all bases.  Do you have a testcase to show
such a scenario so that I can verify that it is covered?

Thanks.


-- 
H.J.


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