summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-10-07 23:14:31 +1030
committerAlan Modra <amodra@gmail.com>2019-10-09 00:34:47 +1030
commit8aaf083b7fd848934b5f42e594d3bbbb73267950 (patch)
treeede5d739a49831f0ef81ea7cddfc244923c66563
parent1b1bf9a89a20ab627dbe8d421d55fe32b27e7106 (diff)
downloadbinutils-8aaf083b7fd848934b5f42e594d3bbbb73267950.tar.gz
binutils-8aaf083b7fd848934b5f42e594d3bbbb73267950.tar.bz2
binutils-8aaf083b7fd848934b5f42e594d3bbbb73267950.zip
Re: PowerPC PIC vs. DLL TLS issues
A bug crept into commit f749f26eea, which could cause linker segfaults when creating PIEs. This patch fixes it. * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Do allocate space for local got non-tls relocs when PIE. (cherry picked from commit 93370e8e7b406cf0aeedcf57cf457c07d6a2c7e6)
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elf64-ppc.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 562aa63c814..3c0c42bdbe8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,6 +1,10 @@
2019-10-09 Alan Modra <amodra@gmail.com>
Apply from master
+ 2019-10-07 Alan Modra <amodra@gmail.com>
+ * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Do allocate
+ space for local got non-tls relocs when PIE.
+
2019-10-04 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_check_relocs): Move initialisation of vars.
(ppc64_elf_tls_optimize): Correct is_local condition.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 144c731cbd1..5d6443eaeaf 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -9781,7 +9781,9 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
htab->elf.irelplt->size += rel_size;
htab->got_reli_size += rel_size;
}
- else if (bfd_link_dll (info))
+ else if (bfd_link_pic (info)
+ && !(ent->tls_type != 0
+ && bfd_link_executable (info)))
{
asection *srel = ppc64_elf_tdata (ibfd)->relgot;
srel->size += rel_size;