From: H.J. Lu Date: Fri, 28 Apr 2017 14:26:45 +0000 (-0700) Subject: x86: Check plt_got before using .plt.got X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=750eaa47f10f48d19aacbec74ab6867da0164677;p=binutils-gdb.git 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3ae5c9f0b78..75e1e38dfbb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-04-28 H.J. Lu + + * 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 * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "=" diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index c995ef563f3..e07a81fb592 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 6f9bc36894a..7c455f2d843 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;