diff options
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 53 |
1 files changed, 13 insertions, 40 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 166ca9d00fa..4b57b652ed5 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -824,30 +824,9 @@ static const struct elf_x86_non_lazy_plt_layout elf_i386_non_lazy_ibt_plt = #define PLTRESOLVE_RELOCS 2 #define PLT_NON_JUMP_SLOT_RELOCS 2 -/* Architecture-specific backend data for i386. */ - -struct elf_i386_backend_data -{ - /* Value used to fill the unused bytes of the first PLT entry. */ - bfd_byte plt0_pad_byte; - - /* Target system. */ - enum - { - is_normal, - is_vxworks, - is_nacl - } os; -}; - -#define get_elf_i386_backend_data(abfd) \ - ((const struct elf_i386_backend_data *) \ - get_elf_backend_data (abfd)->arch_data) - /* These are the standard parameters. */ -static const struct elf_i386_backend_data elf_i386_arch_bed = +static const struct elf_x86_backend_data elf_i386_arch_bed = { - 0, /* plt0_pad_byte */ is_normal /* os */ }; @@ -2022,7 +2001,7 @@ elf_i386_relocate_section (bfd *output_bfd, local_tlsdesc_gotents = elf_x86_local_tlsdesc_gotent (input_bfd); /* We have to handle relocations in vxworks .tls_vars sections specially, because the dynamic loader is 'weird'. */ - is_vxworks_tls = (htab->is_vxworks + is_vxworks_tls = (htab->target_os == is_vxworks && bfd_link_pic (info) && !strcmp (input_section->output_section->name, ".tls_vars")); @@ -3635,7 +3614,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, resolved_plt->contents + plt_offset + htab->plt.plt_got_offset); - if (htab->is_vxworks) + if (htab->target_os == is_vxworks) { int s, k, reloc_index; @@ -4031,13 +4010,10 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, { /* Fill in the special first entry in the procedure linkage table. */ - const struct elf_i386_backend_data *abed - = get_elf_i386_backend_data (output_bfd); - memcpy (htab->elf.splt->contents, htab->plt.plt0_entry, htab->lazy_plt->plt0_entry_size); memset (htab->elf.splt->contents + htab->lazy_plt->plt0_entry_size, - abed->plt0_pad_byte, + htab->plt0_pad_byte, htab->plt.plt_entry_size - htab->lazy_plt->plt0_entry_size); if (!bfd_link_pic (info)) { @@ -4054,7 +4030,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, htab->elf.splt->contents + htab->lazy_plt->plt0_got2_offset); - if (htab->is_vxworks) + if (htab->target_os == is_vxworks) { Elf_Internal_Rela rel; int num_plts = (htab->elf.splt->size @@ -4195,7 +4171,7 @@ elf_i386_get_synthetic_symtab (bfd *abfd, lazy_plt = NULL; non_lazy_ibt_plt = NULL; lazy_ibt_plt = NULL; - switch (get_elf_i386_backend_data (abfd)->os) + switch (get_elf_x86_backend_data (abfd)->target_os) { case is_normal: non_lazy_plt = &elf_i386_non_lazy_plt; @@ -4354,25 +4330,24 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info) { struct elf_x86_init_table init_table; - init_table.normal_target = FALSE; - init_table.is_vxworks = FALSE; - switch (get_elf_i386_backend_data (info->output_bfd)->os) + switch (get_elf_x86_backend_data (info->output_bfd)->target_os) { case is_normal: + init_table.plt0_pad_byte = 0x0; init_table.lazy_plt = &elf_i386_lazy_plt; init_table.non_lazy_plt = &elf_i386_non_lazy_plt; init_table.lazy_ibt_plt = &elf_i386_lazy_ibt_plt; init_table.non_lazy_ibt_plt = &elf_i386_non_lazy_ibt_plt; - init_table.normal_target = TRUE; break; case is_vxworks: + init_table.plt0_pad_byte = 0x90; init_table.lazy_plt = &elf_i386_lazy_plt; init_table.non_lazy_plt = NULL; init_table.lazy_ibt_plt = NULL; init_table.non_lazy_ibt_plt = NULL; - init_table.is_vxworks = TRUE; break; case is_nacl: + init_table.plt0_pad_byte = 0x90; init_table.lazy_plt = &elf_i386_nacl_plt; init_table.non_lazy_plt = NULL; init_table.lazy_ibt_plt = NULL; @@ -4728,7 +4703,7 @@ static const bfd_byte elf_i386_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_i386_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 */ @@ -4782,9 +4757,8 @@ static const struct elf_x86_lazy_plt_layout elf_i386_nacl_plt = sizeof (elf_i386_nacl_eh_frame_plt) /* eh_frame_plt_size */ }; -static const struct elf_i386_backend_data elf_i386_nacl_arch_bed = +static const struct elf_x86_backend_data elf_i386_nacl_arch_bed = { - 0x90, /* plt0_pad_byte: nop insn */ is_nacl /* os */ }; @@ -4828,9 +4802,8 @@ elf32_i386_nacl_elf_object_p (bfd *abfd) #undef elf_backend_plt_alignment #define elf_backend_plt_alignment 4 -static const struct elf_i386_backend_data elf_i386_vxworks_arch_bed = +static const struct elf_x86_backend_data elf_i386_vxworks_arch_bed = { - 0x90, /* plt0_pad_byte */ is_vxworks /* os */ }; |