From 8a1b824af786989f879ab1421a4279f60bba141a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 20 Jan 2018 14:25:24 -0800 Subject: x86: Check the versioned __tls_get_addr symbol We need to check the versioned __tls_get_addr symbol when looking up "__tls_get_addr". bfd/ PR ld/22721 * elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Check the versioned __tls_get_addr symbol. ld/ PR ld/22721 * testsuite/ld-plugin/lto.exp: Run PR ld/22721 tests. * testsuite/ld-plugin/pr22721.t: New file. * testsuite/ld-plugin/pr22721a.s: Likewise. * testsuite/ld-plugin/pr22721b.c: Likewise. --- bfd/elfxx-x86.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'bfd/elfxx-x86.c') diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index a9ee4ba..a7db5d9 100644 --- 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; + } + } /* "__ehdr_start" will be defined by linker as a hidden symbol later if it is referenced and not defined. */ -- cgit v1.1