aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-28 09:30:19 +0930
committerAndreas K. Hüttel <dilfridge@gentoo.org>2020-10-21 00:56:00 +0300
commit1fe59adeca534eae79ccde8e8c63f533cc898bea (patch)
tree8ffbc3f8ceda74a143586db866cb6ff96d86c723
parent[GOLD] PPC64_OPT_LOCALENTRY is incompatible with tail calls (diff)
downloadbinutils-gdb-1fe59adeca534eae79ccde8e8c63f533cc898bea.tar.gz
binutils-gdb-1fe59adeca534eae79ccde8e8c63f533cc898bea.tar.bz2
binutils-gdb-1fe59adeca534eae79ccde8e8c63f533cc898bea.zip
Re: PR26656, power10 libstdc++.so segfault in __cxxabiv1::__cxa_throw
Some missing NULL checks meant a stub for a local symbol used a stub looking like the __tls_get_addr_opt stub. PR 26656 * elf64-ppc.c (ppc_build_one_stub, ppc_size_one_stub): Check for NULL stub_entry->h before calling is_tls_get_addr. (cherry picked from commit 12cf8b93da0ae155643d262235486fde5af72a80) (cherry picked from commit 39f2c1f7b80a30297e93f04c885b444e5a874372)
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf64-ppc.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 01ccac443e..dd6d8fdd03 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-09-28 Alan Modra <amodra@gmail.com>
+
+ PR 26656
+ * elf64-ppc.c (ppc_build_one_stub, ppc_size_one_stub): Check for
+ NULL stub_entry->h before calling is_tls_get_addr.
+
2020-09-26 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Depend on has_plt_localentry0.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index f4d0c88c7a..0aeda47e57 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -11674,6 +11674,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
obfd = htab->params->stub_bfd;
is_tga = ((stub_entry->stub_type == ppc_stub_plt_call_notoc
|| stub_entry->stub_type == ppc_stub_plt_call_both)
+ && stub_entry->h != NULL
&& is_tls_get_addr (&stub_entry->h->elf, htab)
&& htab->params->tls_get_addr_opt);
if (is_tga)
@@ -12184,7 +12185,8 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
case ppc_stub_plt_call_notoc:
case ppc_stub_plt_call_both:
lr_used = 0;
- if (is_tls_get_addr (&stub_entry->h->elf, htab)
+ if (stub_entry->h != NULL
+ && is_tls_get_addr (&stub_entry->h->elf, htab)
&& htab->params->tls_get_addr_opt)
{
lr_used += 7 * 4;
@@ -12254,6 +12256,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
}
if ((stub_entry->stub_type == ppc_stub_plt_call_notoc
|| stub_entry->stub_type == ppc_stub_plt_call_both)
+ && stub_entry->h != NULL
&& is_tls_get_addr (&stub_entry->h->elf, htab)
&& htab->params->tls_get_addr_opt)
{