diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-10-14 11:32:29 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-10-14 11:32:52 -0700 |
commit | 851b6fa13707d187e068c8773f21d376391387a9 (patch) | |
tree | dd1c0760f2b6f885909eb2a22e5213e9fc7ab645 /bfd/elfxx-x86.c | |
parent | 9577f60b5a19ce93536f49cba3af4be39e39c327 (diff) | |
download | binutils-gdb-851b6fa13707d187e068c8773f21d376391387a9.tar.gz |
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/elfxx-x86.c')
-rw-r--r-- | bfd/elfxx-x86.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 1aad33f12d2..f4466ebd592 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -261,7 +261,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } } - if (htab->is_vxworks && !bfd_link_pic (info)) + if (htab->target_os == is_vxworks && !bfd_link_pic (info)) { /* VxWorks has a second set of relocations for each PLT entry in executables. They go in a separate relocation section, @@ -405,7 +405,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } } - if (htab->is_vxworks) + if (htab->target_os == is_vxworks) { struct elf_dyn_relocs **pp; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) @@ -799,6 +799,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd) } } ret->target_id = bed->target_id; + ret->target_os = get_elf_x86_backend_data (abfd)->target_os; ret->loc_hash_table = htab_try_create (1024, _bfd_x86_elf_local_htab_hash, @@ -924,7 +925,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, linker script /DISCARD/, so we'll be discarding the relocs too. */ } - else if (htab->is_vxworks + else if (htab->target_os == is_vxworks && strcmp (p->sec->output_section->name, ".tls_vars") == 0) { @@ -1285,7 +1286,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, return FALSE; } } - if (htab->is_vxworks + if (htab->target_os == is_vxworks && !elf_vxworks_add_dynamic_entries (output_bfd, info)) return FALSE; } @@ -1377,7 +1378,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, switch (dyn.d_tag) { default: - if (htab->is_vxworks + if (htab->target_os == is_vxworks && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn)) break; continue; @@ -1835,7 +1836,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (ELIMINATE_COPY_RELOCS && (bed->target_id == X86_64_ELF_DATA || (!eh->gotoff_ref - && !htab->is_vxworks))) + && htab->target_os != is_vxworks))) { for (p = eh->dyn_relocs; p != NULL; p = p->next) { @@ -2440,13 +2441,14 @@ error_alignment: if (htab == NULL) return pbfd; - htab->is_vxworks = init_table->is_vxworks; htab->r_info = init_table->r_info; htab->r_sym = init_table->r_sym; if (bfd_link_relocatable (info)) return pbfd; + htab->plt0_pad_byte = init_table->plt0_pad_byte; + use_ibt_plt = info->ibtplt || info->ibt; if (!use_ibt_plt && pbfd != NULL) { @@ -2498,11 +2500,15 @@ error_alignment: } } + /* Return if there are no normal input files. */ + if (dynobj == NULL) + return pbfd; + /* Even when lazy binding is disabled by "-z now", the PLT0 entry may still be used with LD_AUDIT or LD_PROFILE if PLT entry is used for canonical function address. */ htab->plt.has_plt0 = 1; - normal_target = init_table->normal_target; + normal_target = htab->target_os == is_normal; if (normal_target) { @@ -2565,11 +2571,7 @@ error_alignment: htab->plt.eh_frame_plt = htab->lazy_plt->eh_frame_plt; } - /* Return if there are no normal input files. */ - if (dynobj == NULL) - return pbfd; - - if (htab->is_vxworks + if (htab->target_os == is_vxworks && !elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2)) { |