[binutils-gdb/binutils-2_30-branch] PR23123, PowerPC32 ifunc regression

Alan Modra amodra@sourceware.org
Fri Apr 27 09:31:00 GMT 2018


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

commit 69bc498952e7e477d6f96f3b6f900a6112e82350
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Apr 27 15:46:40 2018 +0930

    PR23123, PowerPC32 ifunc regression
    
    Two of the gcc ifunc tests fail for ppc32, due to my pr22374 fix being
    a little too enthusiastic in trimming PLT entries.  ppc64 doesn't have
    the same failures because ppc64_elf_check_relocs happens to set
    needs_plt for any ifunc reloc.
    
    	PR 23123
    	PR 22374
    	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't drop plt
    	relocs for ifuncs.
    	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Comment fixes.
    
    (cherry picked from commit 04383fd15b3b82d824df9c72e3ade88c43bfb5ac)

Diff:
---
 bfd/ChangeLog   | 8 ++++++++
 bfd/elf32-ppc.c | 6 +++---
 bfd/elf64-ppc.c | 8 ++++----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ad41bbf..c54a5c0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2018-04-27  Alan Modra  <amodra@gmail.com>
+
+	PR 23123
+	PR 22374
+	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't drop plt
+	relocs for ifuncs.
+	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Comment fixes.
+
 2018-02-09  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* elf32-i386.c (elf_i386_get_synthetic_symtab): Also handle
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 092b1ce..16ee60f 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -5551,9 +5551,9 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
 	      && !readonly_dynrelocs (h))
 	    {
 	      h->pointer_equality_needed = 0;
-	      /* If we haven't seen a branch reloc then we don't need
-		 a plt entry.  */
-	      if (!h->needs_plt)
+	      /* If we haven't seen a branch reloc and the symbol
+		 isn't an ifunc then we don't need a plt entry.  */
+	      if (!h->needs_plt && h->type != STT_GNU_IFUNC)
 		h->plt.plist = NULL;
 	    }
 	  else if (!bfd_link_pic (info))
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 039294f..8940d0a 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7183,8 +7183,8 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
 	      if (!readonly_dynrelocs (h))
 		{
 		  h->pointer_equality_needed = 0;
-		  /* If we haven't seen a branch reloc then we don't need
-		     a plt entry.  */
+		  /* If we haven't seen a branch reloc and the symbol
+		     isn't an ifunc then we don't need a plt entry.  */
 		  if (!h->needs_plt)
 		    h->plt.plist = NULL;
 		}
@@ -7200,8 +7200,8 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
       else if (!h->needs_plt
 	       && !readonly_dynrelocs (h))
 	{
-	  /* If we haven't seen a branch reloc then we don't need a
-	     plt entry.  */
+	  /* If we haven't seen a branch reloc and the symbol isn't an
+	     ifunc then we don't need a plt entry.  */
 	  h->plt.plist = NULL;
 	  h->pointer_equality_needed = 0;
 	  return TRUE;



More information about the Binutils-cvs mailing list