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.
+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.
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
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
|| (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