This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] x86: Check the versioned __tls_get_addr symbol
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Sat, 20 Jan 2018 10:50:33 +1030
- Subject: Re: [PATCH] x86: Check the versioned __tls_get_addr symbol
- Authentication-results: sourceware.org; auth=none
- References: <20180119185737.GA22094@gmail.com>
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
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.
--
Alan Modra
Australia Development Lab, IBM