x86: Add VERIFY_COPY_RELOC
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 6 Oct 2017 07:50:12 +0000 (00:50 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 6 Oct 2017 07:51:40 +0000 (00:51 -0700)
Add VERIFY_COPY_RELOC to verify that symbol supports copy relocation.

* elfxx-x86.h (VERIFY_COPY_RELOC): New.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c
bfd/elfxx-x86.h

index 2ad9e423f0cae190db843ac7522dc25a54b07578..982d29daabf2a4deb8ee5b23884f2d6e8ef5c583 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elfxx-x86.h (VERIFY_COPY_RELOC): New.
+       * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
+       * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
+
 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elfxx-x86.h (VERIFY_PLT_ENTRY): New.
index 822fe4f9dc409d1faa2a96a5d38f7feab5cd7154..5fbcd6040e5c683b341dc21445afb8106c9de0ef 100644 (file)
@@ -3908,13 +3908,7 @@ do_glob_dat:
       asection *s;
 
       /* This symbol needs a copy reloc.  Set it up.  */
-
-      if (h->dynindx == -1
-         || (h->root.type != bfd_link_hash_defined
-             && h->root.type != bfd_link_hash_defweak)
-         || htab->elf.srelbss == NULL
-         || htab->elf.sreldynrelro == NULL)
-       abort ();
+      VERIFY_COPY_RELOC (h, htab)
 
       rel.r_offset = (h->root.u.def.value
                      + h->root.u.def.section->output_section->vma
index 1fb0a2deaf1bde66ea24550a7561b434926f071c..c4cf7ae5e4a3ef36ac4b60204a4bbeb31ca46bce 100644 (file)
@@ -4253,13 +4253,7 @@ do_glob_dat:
       asection *s;
 
       /* This symbol needs a copy reloc.  Set it up.  */
-
-      if (h->dynindx == -1
-         || (h->root.type != bfd_link_hash_defined
-             && h->root.type != bfd_link_hash_defweak)
-         || htab->elf.srelbss == NULL
-         || htab->elf.sreldynrelro == NULL)
-       abort ();
+      VERIFY_COPY_RELOC (h, htab)
 
       rela.r_offset = (h->root.u.def.value
                       + h->root.u.def.section->output_section->vma
index b81e1455398357809363f8b32d7f7259819cbc27..ca270ded0a582471449f301fb5dcf78899f72125 100644 (file)
       || (RELPLT) == NULL) \
     abort ();
 
+/* Verify that the symbol supports copy relocation.  */
+#define VERIFY_COPY_RELOC(H, HTAB) \
+  if ((H)->dynindx == -1 \
+      || ((H)->root.type != bfd_link_hash_defined \
+         && (H)->root.type != bfd_link_hash_defweak) \
+      || (HTAB)->elf.srelbss == NULL \
+      || (HTAB)->elf.sreldynrelro == NULL) \
+    abort ();
+
 /* x86 ELF linker hash entry.  */
 
 struct elf_x86_link_hash_entry
This page took 0.031536 seconds and 4 git commands to generate.