From: "H.J. Lu" <hongjiu.lu@intel.com>
To: binutils@sourceware.org
Subject: [committed, PATCH] x86: Check plt_got before using .plt.got
Date: Fri, 28 Apr 2017 14:29:00 -0000 [thread overview]
Message-ID: <20170428142947.GA7775@intel.com> (raw)
Since the GOT procedure linkage table is supported only if plt_got
isn't NULL, we need to check plt_got before using it.
* elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
before using .plt.got.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
---
bfd/ChangeLog | 6 ++++++
bfd/elf32-i386.c | 4 +++-
bfd/elf64-x86-64.c | 4 +++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3ae5c9f..75e1e38 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
+ before using .plt.got.
+ * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
+
2017-04-27 H.J. Lu <hongjiu.lu@intel.com>
* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index c995ef5..e07a81f 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2727,7 +2727,9 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
if PLT is used. */
eh->func_pointer_refcount = 0;
- if ((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed)
+ if (htab->plt_got != NULL
+ && (info->flags & DF_BIND_NOW)
+ && !h->pointer_equality_needed)
{
/* Don't use the regular PLT for DF_BIND_NOW. */
h->plt.offset = (bfd_vma) -1;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 6f9bc36..7c455f2 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3178,7 +3178,9 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
if PLT is used. */
eh->func_pointer_refcount = 0;
- if ((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed)
+ if (htab->plt_got != NULL
+ && (info->flags & DF_BIND_NOW)
+ && !h->pointer_equality_needed)
{
/* Don't use the regular PLT for DF_BIND_NOW. */
h->plt.offset = (bfd_vma) -1;
--
2.9.3
reply other threads:[~2017-04-28 14:29 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=20170428142947.GA7775@intel.com \
--to=hongjiu.lu@intel.com \
--cc=binutils@sourceware.org \
--cc=hjl.tools@gmail.com \
/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).