From 93370e8e7b406cf0aeedcf57cf457c07d6a2c7e6 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 7 Oct 2019 23:14:31 +1030 Subject: [PATCH] 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. --- bfd/ChangeLog | 5 +++++ bfd/elf64-ppc.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 607f37cfb27..72737181b0d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2019-10-07 Alan Modra + + * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Do allocate + space for local got non-tls relocs when PIE. + 2019-10-07 Alan Modra * elflink.c (elf_fixup_link_order): Don't attempt to find diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 842fc40f144..32ed81d98e3 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -9814,7 +9814,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; -- 2.30.2