aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-04-28 07:26:45 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-04-28 07:26:45 -0700
commit750eaa47f10f48d19aacbec74ab6867da0164677 (patch)
tree791959bf4f4aea484db4e169a1f57ba9f590a310 /bfd/elf64-x86-64.c
parent4621115fe529869e938dca605bb90190ea52316a (diff)
downloadgdb-750eaa47f10f48d19aacbec74ab6867da0164677.zip
gdb-750eaa47f10f48d19aacbec74ab6867da0164677.tar.gz
gdb-750eaa47f10f48d19aacbec74ab6867da0164677.tar.bz2
x86: Check plt_got before using .plt.got
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.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c4
1 files changed, 3 insertions, 1 deletions
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;