+2017-09-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (R_X86_64_converted_reloc_bit): New.
+ (elf_x86_64_info_to_howto): Get the real relocation type by
+ masking out R_X86_64_converted_reloc_bit.
+ (elf_x86_64_check_tls_transition): Get the real relocation type
+ by masking out R_X86_64_converted_reloc_bit.
+ (elf_x86_64_convert_load_reloc): Set R_X86_64_converted_reloc_bit
+ instead of setting converted_reloc.
+ (elf_x86_64_relocate_section): Check R_X86_64_converted_reloc_bit
+ instead of converted_reloc. Get the real relocation type by
+ masking out R_X86_64_converted_reloc_bit.
+ (elf_x86_64_link_setup_gnu_properties): Verify that the value of
+ R_X86_64_converted_reloc_bit is valid.
+ * elfxx-x86.h (converted_reloc): Removed.
+
2017-09-06 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (elf_i386_relocate_section): Don't change r_type
FALSE)
};
+/* Set if a relocation is converted from a GOTPCREL relocation. */
+#define R_X86_64_converted_reloc_bit (1 << 7)
+
#define IS_X86_64_PCREL_TYPE(TYPE) \
( ((TYPE) == R_X86_64_PC8) \
|| ((TYPE) == R_X86_64_PC16) \
unsigned r_type;
r_type = ELF32_R_TYPE (dst->r_info);
+ if (r_type != (unsigned int) R_X86_64_GNU_VTINHERIT
+ && r_type != (unsigned int) R_X86_64_GNU_VTENTRY)
+ r_type &= ~R_X86_64_converted_reloc_bit;
cache_ptr->howto = elf_x86_64_rtype_to_howto (abfd, r_type);
BFD_ASSERT (r_type == cache_ptr->howto->type);
}
if (h == NULL
|| !((struct elf_x86_link_hash_entry *) h)->tls_get_addr)
return FALSE;
- else if (largepic)
- return ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PLTOFF64;
- else if (indirect_call)
- return ELF32_R_TYPE (rel[1].r_info) == R_X86_64_GOTPCRELX;
else
- return (ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PC32
- || ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
+ {
+ r_type = (ELF32_R_TYPE (rel[1].r_info)
+ & ~R_X86_64_converted_reloc_bit);
+ if (largepic)
+ return r_type == R_X86_64_PLTOFF64;
+ else if (indirect_call)
+ return r_type == R_X86_64_GOTPCRELX;
+ else
+ return (r_type == R_X86_64_PC32 || r_type == R_X86_64_PLT32);
+ }
case R_X86_64_GOTTPOFF:
/* Check transition from IE access model:
return TRUE;
convert:
- if (h != NULL)
- ((struct elf_x86_link_hash_entry *) h)->converted_reloc = 1;
-
if (opcode == 0xff)
{
/* We have "call/jmp *foo@GOTPCREL(%rip)". */
bfd_put_8 (abfd, opcode, contents + roff - 2);
}
- irel->r_info = htab->r_info (r_symndx, r_type);
+ irel->r_info = htab->r_info (r_symndx,
+ r_type | R_X86_64_converted_reloc_bit);
*converted = TRUE;
bfd_vma st_size;
bfd_boolean resolved_to_zero;
bfd_boolean relative_reloc;
+ bfd_boolean converted_reloc;
r_type = ELF32_R_TYPE (rel->r_info);
if (r_type == (int) R_X86_64_GNU_VTINHERIT
continue;
}
+ converted_reloc = (r_type & R_X86_64_converted_reloc_bit) != 0;
+ r_type &= ~R_X86_64_converted_reloc_bit;
+
if (r_type >= (int) R_X86_64_standard)
return _bfd_unrecognized_reloc (input_bfd, input_section, r_type);
if (r == bfd_reloc_overflow)
{
- if (eh != NULL && eh->converted_reloc)
+ if (converted_reloc)
{
info->callbacks->einfo
(_("%F%P: failed to convert GOTPCREL relocation; relink with --no-relax\n"));
{
struct elf_x86_plt_layout_table plt_layout;
+ if ((int) R_X86_64_standard >= (int) R_X86_64_converted_reloc_bit
+ || (int) R_X86_64_max <= (int) R_X86_64_converted_reloc_bit
+ || ((int) (R_X86_64_GNU_VTINHERIT | R_X86_64_converted_reloc_bit)
+ != (int) R_X86_64_GNU_VTINHERIT)
+ || ((int) (R_X86_64_GNU_VTENTRY | R_X86_64_converted_reloc_bit)
+ != (int) R_X86_64_GNU_VTENTRY))
+ abort ();
+
plt_layout.is_vxworks = FALSE;
if (get_elf_x86_64_backend_data (info->output_bfd)->os == is_normal)
{