public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
To: binutils@sourceware.org
Subject: [Committed] S/390: Fix ifunc missing runtime reloc
Date: Mon, 08 May 2017 17:45:00 -0000	[thread overview]
Message-ID: <20170508174521.21726-1-krebbel@linux.vnet.ibm.com> (raw)

This fixes a problem with a missing R_390_64 reloc against .data for a
function pointer to an ifunc function.

No regressions on s390x.

Pushed to mainline.

bfd/ChangeLog:

2017-05-08  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* elf-s390-common.c: Don't check non_got_ref flag.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elf64-s390.c (elf_s390_relocate_section): Likewise.
---
 bfd/elf-s390-common.c | 4 +---
 bfd/elf32-s390.c      | 2 +-
 bfd/elf64-s390.c      | 7 ++++---
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/bfd/elf-s390-common.c b/bfd/elf-s390-common.c
index 1570365..8795fb9 100644
--- a/bfd/elf-s390-common.c
+++ b/bfd/elf-s390-common.c
@@ -161,9 +161,7 @@ keep:
       h->type = STT_FUNC;
     }
 
-  /* We need dynamic relocation for STT_GNU_IFUNC symbol only when
-     there is a non-GOT reference in a shared object.  */
-  if (!bfd_link_pic (info) || !h->non_got_ref)
+  if (!bfd_link_pic (info))
     *head = NULL;
 
   /* Finally, allocate space.  */
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index ddb6f5b..8a09a31 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -2774,7 +2774,7 @@ elf_s390_relocate_section (bfd *output_bfd,
 	      && s390_is_ifunc_symbol_p (h)
 	      && h->def_regular)
 	    {
-	      if (!bfd_link_pic (info) || !h->non_got_ref)
+	      if (!bfd_link_pic (info))
 		{
 		  /* For a non-shared object STT_GNU_IFUNC symbol must
 		     go through PLT.  */
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index fbbf8d6..ca3541f 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2737,10 +2737,11 @@ elf_s390_relocate_section (bfd *output_bfd,
 	      && s390_is_ifunc_symbol_p (h)
 	      && h->def_regular)
 	    {
-	      if (!bfd_link_pic (info) || !h->non_got_ref)
+	      if (!bfd_link_pic (info))
 		{
-		  /* For a non-shared object STT_GNU_IFUNC symbol must
-		     go through PLT.  */
+		  /* For a non-shared object the symbol will not
+		     change.  Hence we can write the address of the
+		     target IPLT slot now.  */
 		  relocation = (htab->elf.iplt->output_section->vma
 				+ htab->elf.iplt->output_offset
 				+ h ->plt.offset);
-- 
2.9.1

                 reply	other threads:[~2017-05-08 17:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170508174521.21726-1-krebbel@linux.vnet.ibm.com \
    --to=krebbel@linux.vnet.ibm.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).