diff options
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 12 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 7 |
3 files changed, 19 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9f34899..b691d58 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,12 @@ 2019-10-07 Alan Modra <amodra@gmail.com> + * elf32-ppc.c (ppc_elf_tls_optimize): Don't process R_PPC_TLSLD + with non-local symbol. Don't double count __tls_get_addr calls + with marker relocs. + * elf64-ppc.c (ppc64_elf_tls_optimize): Likewise. + +2019-10-07 Alan Modra <amodra@gmail.com> + * elf32-ppc.c (nomark_tls_get_addr): Rename from has_tls_get_addr_call throughout. * elf64-ppc.c (nomark_tls_get_addr): Likewise. diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index d5c3ae9..cb6cd11 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4530,8 +4530,11 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, else continue; - case R_PPC_TLSGD: case R_PPC_TLSLD: + if (!is_local) + continue; + /* Fall through. */ + case R_PPC_TLSGD: if (rel + 1 < relend && is_plt_seq_reloc (ELF32_R_TYPE (rel[1].r_info))) { @@ -4633,7 +4636,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, != (TLS_TLS | TLS_MARK))) continue; - if (expecting_tls_get_addr) + if (expecting_tls_get_addr == 1 + !sec->nomark_tls_get_addr) { struct plt_entry *ent; bfd_vma addend = 0; @@ -4646,10 +4649,9 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, got2, addend); if (ent != NULL && ent->plt.refcount > 0) ent->plt.refcount -= 1; - - if (expecting_tls_get_addr == 2) - continue; } + if (tls_clear == 0) + continue; if (tls_set == 0) { diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 31c86b4..842fc40 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -7906,8 +7906,11 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info) } continue; - case R_PPC64_TLSGD: case R_PPC64_TLSLD: + if (!is_local) + continue; + /* Fall through. */ + case R_PPC64_TLSGD: if (rel + 1 < relend && is_plt_seq_reloc (ELF64_R_TYPE (rel[1].r_info))) { @@ -8092,7 +8095,7 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info) != (TLS_TLS | TLS_MARK))) continue; - if (expecting_tls_get_addr) + if (expecting_tls_get_addr == 1 + !sec->nomark_tls_get_addr) { struct plt_entry *ent = NULL; |