This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix commit 980aa3e6


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8a9e8e72fe88095043d16f8a56b5a1e150ee288b

commit 8a9e8e72fe88095043d16f8a56b5a1e150ee288b
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Aug 27 08:59:29 2016 +0930

    Fix commit 980aa3e6
    
    Commit 980aa3e6 was supposed to cure dyn_reloc counting problems, but
    did the opposite.  For PIC we count two types of dyn_reloc, those on
    pc-relative relocs, and the total.  If a sym needs pc-relative dyn
    relocs then all the relocs are dynamic.  If not, then only those that
    are must_be_dyn_reloc are dynamic.
    
    	PR 20519
    	* elf64-ppc.c (pc_dynrelocs): New function.
    	(ppc64_elf_relocate_section): Use it and must_be_dyn_reloc to
    	handle pic dynamic relocs.

Diff:
---
 bfd/ChangeLog   |  7 +++++++
 bfd/elf64-ppc.c | 22 ++++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4790c28..0ac0206 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2016-08-27  Alan Modra  <amodra@gmail.com>
+
+	PR 20519
+	* elf64-ppc.c (pc_dynrelocs): New function.
+	(ppc64_elf_relocate_section): Use it and must_be_dyn_reloc to
+	handle pic dynamic relocs.
+
 2016-08-26  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
 	* bfd-in.h (struct elf32_arm_params): Define.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 286130c..a9cedb5 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7173,6 +7173,19 @@ alias_readonly_dynrelocs (struct elf_link_hash_entry *h)
   return FALSE;
 }
 
+/* Return whether EH has pc-relative dynamic relocs.  */
+
+static bfd_boolean
+pc_dynrelocs (struct ppc_link_hash_entry *eh)
+{
+  struct elf_dyn_relocs *p;
+
+  for (p = eh->dyn_relocs; p != NULL; p = p->next)
+    if (p->pc_count != 0)
+      return TRUE;
+  return FALSE;
+}
+
 /* Return true if a global entry stub will be created for H.  Valid
    for ELFv2 before plt entries have been allocated.  */
 
@@ -14745,10 +14758,11 @@ ppc64_elf_relocate_section (bfd *output_bfd,
 	  if (NO_OPD_RELOCS && is_opd)
 	    break;
 
-	  if (h != NULL
-	      ? h->dyn_relocs != NULL
-	      : (bfd_link_pic (info)
-		 ? must_be_dyn_reloc (info, r_type)
+	  if (bfd_link_pic (info)
+	      ? ((h != NULL && pc_dynrelocs (h))
+		 || must_be_dyn_reloc (info, r_type))
+	      : (h != NULL
+		 ? h->dyn_relocs != NULL
 		 : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC))
 	    {
 	      bfd_boolean skip, relocate;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]