aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-14 11:32:29 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-14 11:32:52 -0700
commit851b6fa13707d187e068c8773f21d376391387a9 (patch)
treedd1c0760f2b6f885909eb2a22e5213e9fc7ab645 /bfd/elf64-x86-64.c
parent9577f60b5a19ce93536f49cba3af4be39e39c327 (diff)
downloadgdb-851b6fa13707d187e068c8773f21d376391387a9.zip
gdb-851b6fa13707d187e068c8773f21d376391387a9.tar.gz
gdb-851b6fa13707d187e068c8773f21d376391387a9.tar.bz2
x86: Add elf_x86_backend_data
Add plt0_pad_byte and target_os fields to elf_x86_link_hash_table. Replace elf_i386_backend_data and elf_x86_64_backend_data with elf_x86_backend_data. * elf32-i386.c (elf_i386_backend_data): Removed. (get_elf_i386_backend_data): Likewise. (elf_i386_arch_bed): Replace elf_i386_backend_data with elf_x86_backend_data. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_nacl_arch_bed): Likewise. (elf_i386_vxworks_arch_bed): Likewise. (elf_i386_relocate_section): Check target_os instead of is_vxworks. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Use htab->plt0_pad_byte. Check target_os instead of is_vxworks. (elf_i386_link_setup_gnu_properties): Remove normal_target and is_vxworks. Initialize plt0_pad_byte. * elf64-x86-64.c (elf_x86_64_backend_data); Removed. (get_elf_x86_64_arch_data): Likewise. (get_elf_x86_64_backend_data): Likewise. (elf_x86_64_arch_bed): Replace elf_x86_64_backend_data with elf_x86_backend_data. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_nacl_arch_bed): Likewise. (elf_x86_64_link_setup_gnu_properties): Remove is_vxworks and normal_target. Initialize plt0_pad_byte. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Check target_os instead of is_vxworks. (_bfd_x86_elf_size_dynamic_sections): Likewise. (_bfd_x86_elf_finish_dynamic_sections): Likewise. (_bfd_x86_elf_adjust_dynamic_symbol): Likewise. (_bfd_x86_elf_link_hash_table_create): Initialize target_os. (_bfd_x86_elf_link_setup_gnu_properties): Remove is_vxworks. Update normal_target. Set up plt0_pad_byte. Check target_os instead of is_vxworks. * elfxx-x86.h (elf_x86_target_os): New. (elf_x86_backend_data): Likewise. (get_elf_x86_backend_data): Likewise. (elf_x86_link_hash_table): Remove is_vxworks. Add plt0_pad_byte and target_os. (elf_x86_init_table): Remove normal_target and is_vxworks. Add plt0_pad_byte.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 047e78a..6a5159d4 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -820,24 +820,6 @@ static const bfd_byte elf_x86_64_eh_frame_non_lazy_plt[] =
DW_CFA_nop, DW_CFA_nop, DW_CFA_nop
};
-/* Architecture-specific backend data for x86-64. */
-
-struct elf_x86_64_backend_data
-{
- /* Target system. */
- enum
- {
- is_normal,
- is_nacl
- } os;
-};
-
-#define get_elf_x86_64_arch_data(bed) \
- ((const struct elf_x86_64_backend_data *) (bed)->arch_data)
-
-#define get_elf_x86_64_backend_data(abfd) \
- get_elf_x86_64_arch_data (get_elf_backend_data (abfd))
-
/* These are the standard parameters. */
static const struct elf_x86_lazy_plt_layout elf_x86_64_lazy_plt =
{
@@ -967,7 +949,7 @@ static const struct elf_x86_non_lazy_plt_layout elf_x32_non_lazy_ibt_plt =
sizeof (elf_x86_64_eh_frame_non_lazy_plt) /* eh_frame_plt_size */
};
-static const struct elf_x86_64_backend_data elf_x86_64_arch_bed =
+static const struct elf_x86_backend_data elf_x86_64_arch_bed =
{
is_normal /* os */
};
@@ -4529,7 +4511,7 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd,
if (relsize <= 0)
return -1;
- if (get_elf_x86_64_backend_data (abfd)->os == is_normal)
+ if (get_elf_x86_backend_data (abfd)->target_os == is_normal)
{
lazy_plt = &elf_x86_64_lazy_plt;
non_lazy_plt = &elf_x86_64_non_lazy_plt;
@@ -4877,8 +4859,11 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
!= (int) R_X86_64_GNU_VTENTRY))
abort ();
- init_table.is_vxworks = FALSE;
- if (get_elf_x86_64_backend_data (info->output_bfd)->os == is_normal)
+ /* This is unused for x86-64. */
+ init_table.plt0_pad_byte = 0x90;
+
+ if (get_elf_x86_backend_data (info->output_bfd)->target_os
+ == is_normal)
{
if (info->bndplt)
{
@@ -4901,7 +4886,6 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
init_table.lazy_ibt_plt = &elf_x32_lazy_ibt_plt;
init_table.non_lazy_ibt_plt = &elf_x32_non_lazy_ibt_plt;
}
- init_table.normal_target = TRUE;
}
else
{
@@ -4909,7 +4893,6 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
init_table.non_lazy_plt = NULL;
init_table.lazy_ibt_plt = NULL;
init_table.non_lazy_ibt_plt = NULL;
- init_table.normal_target = FALSE;
}
if (ABI_64_P (info->output_bfd))
@@ -5176,7 +5159,7 @@ static const bfd_byte elf_x86_64_nacl_eh_frame_plt[] =
|| PLT_FDE_LENGTH != 36 \
|| PLT_FDE_START_OFFSET != 4 + PLT_CIE_LENGTH + 8 \
|| PLT_FDE_LEN_OFFSET != 4 + PLT_CIE_LENGTH + 12)
-# error "Need elf_x86_64_backend_data parameters for eh_frame_plt offsets!"
+# error "Need elf_x86_backend_data parameters for eh_frame_plt offsets!"
#endif
PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */
0, 0, 0, 0, /* CIE ID */
@@ -5230,7 +5213,7 @@ static const struct elf_x86_lazy_plt_layout elf_x86_64_nacl_plt =
sizeof (elf_x86_64_nacl_eh_frame_plt) /* eh_frame_plt_size */
};
-static const struct elf_x86_64_backend_data elf_x86_64_nacl_arch_bed =
+static const struct elf_x86_backend_data elf_x86_64_nacl_arch_bed =
{
is_nacl /* os */
};