aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-06-15 18:42:56 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-06-15 18:42:56 -0700
commit4c23f2ffa8fbd467bca51956130a1f30cfe34371 (patch)
tree1eaaf047843ab31401b50124d66d4c24f6583e60 /bfd/elf64-x86-64.c
parent77b1142d4e709cb12a460bdfad6f109d67260457 (diff)
downloadgdb-4c23f2ffa8fbd467bca51956130a1f30cfe34371.zip
gdb-4c23f2ffa8fbd467bca51956130a1f30cfe34371.tar.gz
gdb-4c23f2ffa8fbd467bca51956130a1f30cfe34371.tar.bz2
Check SEC_ALLOC before allocating dynamic relocation
* elf32-i386.c (elf_i386_check_relocs): Check SEC_ALLOC before allocating dynamic relocation. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index b209604..8c8bcce 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2601,20 +2601,19 @@ do_size:
may need to keep relocations for symbols satisfied by a
dynamic library if we manage to avoid copy relocs for the
symbol. */
- if ((bfd_link_pic (info)
- && (sec->flags & SEC_ALLOC) != 0
- && (! IS_X86_64_PCREL_TYPE (r_type)
- || (h != NULL
- && (! (bfd_link_pie (info)
- || SYMBOLIC_BIND (info, h))
- || h->root.type == bfd_link_hash_defweak
- || !h->def_regular))))
- || (ELIMINATE_COPY_RELOCS
- && !bfd_link_pic (info)
- && (sec->flags & SEC_ALLOC) != 0
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || !h->def_regular)))
+ if ((sec->flags & SEC_ALLOC) != 0
+ && ((bfd_link_pic (info)
+ && (! IS_X86_64_PCREL_TYPE (r_type)
+ || (h != NULL
+ && (! (bfd_link_pie (info)
+ || SYMBOLIC_BIND (info, h))
+ || h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))))
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))))
{
struct elf_dyn_relocs *p;
struct elf_dyn_relocs **head;