Blame SOURCES/gdb-rhbz1420304-s390x-01of35.patch

e1d87d
commit d7ab4911f8aa3e1cd06ece40f74d0b4a532d6a10
e1d87d
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
e1d87d
Date:   Mon May 8 19:10:42 2017 +0200
e1d87d
e1d87d
    S/390: Fix ifunc missing runtime reloc
e1d87d
    
e1d87d
    This fixes a problem with a missing R_390_64 reloc against .data for a
e1d87d
    function pointer to an ifunc function.
e1d87d
    
e1d87d
    No regressions on s390x.
e1d87d
    
e1d87d
    Pushed to mainline.
e1d87d
    
e1d87d
    bfd/ChangeLog:
e1d87d
    
e1d87d
    2017-05-08  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
e1d87d
    
e1d87d
            * elf-s390-common.c: Don't check non_got_ref flag.
e1d87d
            * elf32-s390.c (elf_s390_relocate_section): Likewise.
e1d87d
            * elf64-s390.c (elf_s390_relocate_section): Likewise.
e1d87d
e1d87d
--- a/bfd/elf-s390-common.c
e1d87d
+++ b/bfd/elf-s390-common.c
e1d87d
@@ -161,9 +161,7 @@ keep:
e1d87d
       h->type = STT_FUNC;
e1d87d
     }
e1d87d
 
e1d87d
-  /* We need dynamic relocation for STT_GNU_IFUNC symbol only when
e1d87d
-     there is a non-GOT reference in a shared object.  */
e1d87d
-  if (!bfd_link_pic (info) || !h->non_got_ref)
e1d87d
+  if (!bfd_link_pic (info))
e1d87d
     *head = NULL;
e1d87d
 
e1d87d
   /* Finally, allocate space.  */
e1d87d
--- a/bfd/elf32-s390.c
e1d87d
+++ b/bfd/elf32-s390.c
e1d87d
@@ -2774,7 +2774,7 @@ elf_s390_relocate_section (bfd *output_bfd,
e1d87d
 	      && s390_is_ifunc_symbol_p (h)
e1d87d
 	      && h->def_regular)
e1d87d
 	    {
e1d87d
-	      if (!bfd_link_pic (info) || !h->non_got_ref)
e1d87d
+	      if (!bfd_link_pic (info))
e1d87d
 		{
e1d87d
 		  /* For a non-shared object STT_GNU_IFUNC symbol must
e1d87d
 		     go through PLT.  */
e1d87d
--- a/bfd/elf64-s390.c
e1d87d
+++ b/bfd/elf64-s390.c
e1d87d
@@ -2737,10 +2737,11 @@ elf_s390_relocate_section (bfd *output_bfd,
e1d87d
 	      && s390_is_ifunc_symbol_p (h)
e1d87d
 	      && h->def_regular)
e1d87d
 	    {
e1d87d
-	      if (!bfd_link_pic (info) || !h->non_got_ref)
e1d87d
+	      if (!bfd_link_pic (info))
e1d87d
 		{
e1d87d
-		  /* For a non-shared object STT_GNU_IFUNC symbol must
e1d87d
-		     go through PLT.  */
e1d87d
+		  /* For a non-shared object the symbol will not
e1d87d
+		     change.  Hence we can write the address of the
e1d87d
+		     target IPLT slot now.  */
e1d87d
 		  relocation = (htab->elf.iplt->output_section->vma
e1d87d
 				+ htab->elf.iplt->output_offset
e1d87d
 				+ h ->plt.offset);