Blame SOURCES/binutils-2.27-s390-plt.patch

be6651
diff -rup binutils.orig/bfd/elf32-s390.c binutils-2.27/bfd/elf32-s390.c
be6651
--- binutils.orig/bfd/elf32-s390.c	2017-05-12 13:00:01.697650210 +0100
be6651
+++ binutils-2.27/bfd/elf32-s390.c	2017-05-12 13:01:05.223988744 +0100
be6651
@@ -2809,7 +2809,7 @@ elf_s390_relocate_section (bfd *output_b
be6651
 	      && s390_is_ifunc_symbol_p (h)
be6651
 	      && h->def_regular)
be6651
 	    {
be6651
-	      if (!bfd_link_pic (info) || !h->non_got_ref)
be6651
+	      if (!bfd_link_pic (info))
be6651
 		{
be6651
 		  /* For a non-shared object STT_GNU_IFUNC symbol must
be6651
 		     go through PLT.  */
be6651
diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.27/bfd/elf64-s390.c
be6651
--- binutils.orig/bfd/elf64-s390.c	2017-05-12 13:00:01.699650190 +0100
be6651
+++ binutils-2.27/bfd/elf64-s390.c	2017-05-12 13:01:31.017720167 +0100
be6651
@@ -2768,10 +2768,11 @@ elf_s390_relocate_section (bfd *output_b
be6651
 	      && s390_is_ifunc_symbol_p (h)
be6651
 	      && h->def_regular)
be6651
 	    {
be6651
-	      if (!bfd_link_pic (info) || !h->non_got_ref)
be6651
+	      if (!bfd_link_pic (info))
be6651
 		{
be6651
-		  /* For a non-shared object STT_GNU_IFUNC symbol must
be6651
-		     go through PLT.  */
be6651
+		  /* For a non-shared object the symbol will not
be6651
+		     change.  Hence we can write the address of the
be6651
+		     target IPLT slot now.  */
be6651
 		  relocation = (htab->elf.iplt->output_section->vma
be6651
 				+ htab->elf.iplt->output_offset
be6651
 				+ h ->plt.offset);
be6651
diff -rup binutils.orig/bfd/elf-s390-common.c binutils-2.27/bfd/elf-s390-common.c
be6651
--- binutils.orig/bfd/elf-s390-common.c	2017-05-12 13:00:01.695650231 +0100
be6651
+++ binutils-2.27/bfd/elf-s390-common.c	2017-05-12 13:01:54.347477247 +0100
be6651
@@ -161,9 +161,7 @@ keep:
be6651
       h->type = STT_FUNC;
be6651
     }
be6651
 
be6651
-  /* We need dynamic relocation for STT_GNU_IFUNC symbol only when
be6651
-     there is a non-GOT reference in a shared object.  */
be6651
-  if (!bfd_link_pic (info) || !h->non_got_ref)
be6651
+  if (!bfd_link_pic (info))
be6651
     *head = NULL;
be6651
 
be6651
   /* Finally, allocate space.  */