PR23123, PowerPC32 ifunc regression

Message ID 20180427092406.GP18288@bubble.grove.modra.org
State New
Headers show
Series
  • PR23123, PowerPC32 ifunc regression
Related show

Commit Message

Alan Modra April 27, 2018, 9:24 a.m.
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.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 0438af4..1200de8 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -5899,9 +5899,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 9009768..09377d1 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7304,8 +7304,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;
 		}
@@ -7321,8 +7321,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;