binutils-gdb/bfd/elfxx-x86.h

727 lines
24 KiB
C
Raw Normal View History

Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
/* x86 specific support for ELF
Copyright (C) 2017-2020 Free Software Foundation, Inc.
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "hashtab.h"
x86: Move x86-specific linker options to elf_linker_x86_params Remove x86-specific linker options from bfd_link_info and put them in elf_linker_x86_params. Add _bfd_elf_linker_x86_set_options to pass x86-specific linker options from ld to bfd. bfd/ * elf-linker-x86.h: New file. * elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params to get x86-specific linker options. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise. (_bfd_x86_elf_link_setup_gnu_properties): Likewise. (_bfd_elf_linker_x86_set_options): New function. * elfxx-x86.h: Include "elf-linker-x86.h". (elf_x86_link_hash_table): Add params. include/ * bfdlink.h (bfd_link_info): Remove x86-specific linker options. ld/ * Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em. (eelf_i386_sol2.c): Also depend on $(srcdir)/emultempl/solaris2-x86.em. (eelf_x86_64_sol2.c): Likewise. * Makefile.in: Regenerated. * emulparams/call_nop.sh: Set x86-specific linker options via params. * emulparams/cet.sh: Likewise. * emulparams/reloc_overflow.sh: Likewise. * emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New. Set to "elf-x86". * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to "solaris2-x86". * emulparams/elf_x86_64_sol2.sh: Likewise. * emultempl/elf-x86.em: New file. * emultempl/solaris2-x86.em: Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't set link_info.call_nop_byte.
2019-04-06 16:25:10 +02:00
#include "elf-linker-x86.h"
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
#define PLT_CIE_LENGTH 20
#define PLT_FDE_LENGTH 36
#define PLT_FDE_START_OFFSET 4 + PLT_CIE_LENGTH + 8
#define PLT_FDE_LEN_OFFSET 4 + PLT_CIE_LENGTH + 12
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
#define ABI_64_P(abfd) \
(get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
copying dynamic variables from a shared lib into an app's dynbss
section, and instead use a dynamic relocation to point into the
shared lib. */
#define ELIMINATE_COPY_RELOCS 1
#define elf_x86_hash_table(p, id) \
(is_elf_hash_table ((p)->hash) \
&& elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) == (id) \
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
? ((struct elf_x86_link_hash_table *) ((p)->hash)) : NULL)
x86: Remove _bfd_{i386,x86_64}_elf_convert_load Instead of converting GOT relocations when sizing dynamic sections, we convert GOT relocations during relocation check. Add a field, local_ref, to elf_x86_link_hash_entry to indicate if symbol references are always local with a new function to check if symbol references are always local, which works in check_relocs. * elf32-i386.c (elf_i386_convert_load_reloc): Add an argument, r_type_p. Remove the converted argument. Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return the new relocation type via r_type_p. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (need_convert_load): Removed. (check_relocs_failed): Updated. (elf_i386_check_relocs): Call elf_i386_convert_load_reloc, instead of setting need_convert_load. (_bfd_i386_elf_convert_load): Removed. * elf64-x86-64.c (need_convert_load): Removed. (check_relocs_failed): Updated. (elf_x86_64_convert_load_reloc): Add an argument, r_type_p. Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return the new relocation type via r_type_p. (elf_x86_64_check_relocs): Call elf_x86_64_convert_load_reloc, instead of setting need_convert_load. (elf_x86_64_check_relocs): Don't check PIC if relocation has been converted. (_bfd_x86_64_elf_convert_load): Removed. (elf_x86_64_relocate_section): Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. (elf_x86_64_finish_dynamic_symbol): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Don't set convert_load. (_bfd_x86_elf_size_dynamic_sections): Don't call convert_load. (_bfd_x86_elf_link_symbol_references_local): New function. * elfxx-x86.h (SYMBOL_REFERENCES_LOCAL_P): New. (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace elf.forced_local with SYMBOL_REFERENCES_LOCAL_P. (elf_x86_link_hash_entry): Add local_ref. (elf_x86_link_hash_table): Remove convert_load. (_bfd_i386_elf_convert_load): Removed. (_bfd_x86_64_elf_convert_load): Likewise. (_bfd_x86_elf_link_symbol_references_local): New.
2017-09-07 13:03:15 +02:00
/* Will references to this symbol always be local in this object? */
#define SYMBOL_REFERENCES_LOCAL_P(INFO, H) \
_bfd_x86_elf_link_symbol_references_local ((INFO), (H))
/* TRUE if an undefined weak symbol should be resolved to 0. Local
undefined weak symbol is always resolved to 0. Reference to an
undefined weak symbol is resolved to 0 in executable if undefined
weak symbol should be resolved to 0 (zero_undefweak > 0). */
#define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, EH) \
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
((EH)->elf.root.type == bfd_link_hash_undefweak \
x86: Remove _bfd_{i386,x86_64}_elf_convert_load Instead of converting GOT relocations when sizing dynamic sections, we convert GOT relocations during relocation check. Add a field, local_ref, to elf_x86_link_hash_entry to indicate if symbol references are always local with a new function to check if symbol references are always local, which works in check_relocs. * elf32-i386.c (elf_i386_convert_load_reloc): Add an argument, r_type_p. Remove the converted argument. Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return the new relocation type via r_type_p. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (need_convert_load): Removed. (check_relocs_failed): Updated. (elf_i386_check_relocs): Call elf_i386_convert_load_reloc, instead of setting need_convert_load. (_bfd_i386_elf_convert_load): Removed. * elf64-x86-64.c (need_convert_load): Removed. (check_relocs_failed): Updated. (elf_x86_64_convert_load_reloc): Add an argument, r_type_p. Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return the new relocation type via r_type_p. (elf_x86_64_check_relocs): Call elf_x86_64_convert_load_reloc, instead of setting need_convert_load. (elf_x86_64_check_relocs): Don't check PIC if relocation has been converted. (_bfd_x86_64_elf_convert_load): Removed. (elf_x86_64_relocate_section): Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. (elf_x86_64_finish_dynamic_symbol): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Don't set convert_load. (_bfd_x86_elf_size_dynamic_sections): Don't call convert_load. (_bfd_x86_elf_link_symbol_references_local): New function. * elfxx-x86.h (SYMBOL_REFERENCES_LOCAL_P): New. (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace elf.forced_local with SYMBOL_REFERENCES_LOCAL_P. (elf_x86_link_hash_entry): Add local_ref. (elf_x86_link_hash_table): Remove convert_load. (_bfd_i386_elf_convert_load): Removed. (_bfd_x86_64_elf_convert_load): Likewise. (_bfd_x86_elf_link_symbol_references_local): New.
2017-09-07 13:03:15 +02:00
&& (SYMBOL_REFERENCES_LOCAL_P ((INFO), &(EH)->elf) \
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
|| (bfd_link_executable (INFO) \
&& (EH)->zero_undefweak > 0)))
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
/* Should copy relocation be generated for a symbol. Don't generate
copy relocation against a protected symbol defined in a shared
object with GNU_PROPERTY_NO_COPY_ON_PROTECTED. */
#define SYMBOL_NO_COPYRELOC(INFO, EH) \
((EH)->def_protected \
&& ((EH)->elf.root.type == bfd_link_hash_defined \
|| (EH)->elf.root.type == bfd_link_hash_defweak) \
&& elf_has_no_copy_on_protected ((EH)->elf.root.u.def.section->owner) \
&& ((EH)->elf.root.u.def.section->owner->flags & DYNAMIC) != 0 \
&& ((EH)->elf.root.u.def.section->flags & SEC_CODE) == 0)
/* TRUE if dynamic relocation is needed. If we are creating a shared
library, and this is a reloc against a global symbol, or a non PC
relative reloc against a local symbol, then we need to copy the reloc
into the shared library. However, if we are linking with -Bsymbolic,
we do not need to copy a reloc against a global symbol which is
defined in an object we are including in the link (i.e., DEF_REGULAR
x86-64: Use PLT address for PC-relative reloc Since PLT in PDE and PC-relative PLT in PIE can be used as function address, there is no need for dynamic PC-relative relocation against a dynamic function definition in PIE. Linker should resolve PC-relative reference to its PLT address. NB: i386 has non-PIC PLT and PIC PLT. Only non-PIC PLT in PDE can be used as function address. PIC PLT in PIE can't be used as function address. bfd/ PR ld/22842 * elf32-i386.c (elf_i386_check_relocs): Pass FALSE for non PC-relative PLT to NEED_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (elf_x86_64_check_relocs): Create PLT for R_X86_64_PC32 reloc against dynamic function in data section. Pass TRUE for PC-relative PLT to NEED_DYNAMIC_RELOCATION_P. (elf_x86_64_relocate_section): Use PLT for R_X86_64_PC32 reloc against dynamic function in data section. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Use PLT in PIE as function address only if pcrel_plt is true. (_bfd_x86_elf_link_hash_table_create): Set pcrel_plt. * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): Add PCREL_PLT for PC-relative PLT. If PLT is PC-relative, don't generate dynamic PC-relative relocation against a function definition in data secton in PIE. Remove the obsolete comments. (elf_x86_link_hash_table): Add pcrel_plt. ld/ PR ld/22842 * testsuite/ld-i386/i386.exp: Run PR ld/22842 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr22842a.c: New file. * testsuite/ld-i386/pr22842b.S: Likewise. * testsuite/ld-x86-64/pr22842a.c: Likewise. * testsuite/ld-x86-64/pr22842a.rd: Likewise. * testsuite/ld-x86-64/pr22842b.S: Likewise. * testsuite/ld-x86-64/pr22842b.rd: Likewise.
2018-02-14 12:50:40 +01:00
is set).
If PCREL_PLT is true, don't generate dynamic relocation in PIE for
PC-relative relocation against a dynamic function definition in data
section when PLT address can be used.
If on the other hand, we are creating an executable, we may need to
keep relocations for symbols satisfied by a dynamic library if we
manage to avoid copy relocs for the symbol.
We also need to generate dynamic pointer relocation against
STT_GNU_IFUNC symbol in the non-code section. */
x86-64: Use PLT address for PC-relative reloc Since PLT in PDE and PC-relative PLT in PIE can be used as function address, there is no need for dynamic PC-relative relocation against a dynamic function definition in PIE. Linker should resolve PC-relative reference to its PLT address. NB: i386 has non-PIC PLT and PIC PLT. Only non-PIC PLT in PDE can be used as function address. PIC PLT in PIE can't be used as function address. bfd/ PR ld/22842 * elf32-i386.c (elf_i386_check_relocs): Pass FALSE for non PC-relative PLT to NEED_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (elf_x86_64_check_relocs): Create PLT for R_X86_64_PC32 reloc against dynamic function in data section. Pass TRUE for PC-relative PLT to NEED_DYNAMIC_RELOCATION_P. (elf_x86_64_relocate_section): Use PLT for R_X86_64_PC32 reloc against dynamic function in data section. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Use PLT in PIE as function address only if pcrel_plt is true. (_bfd_x86_elf_link_hash_table_create): Set pcrel_plt. * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): Add PCREL_PLT for PC-relative PLT. If PLT is PC-relative, don't generate dynamic PC-relative relocation against a function definition in data secton in PIE. Remove the obsolete comments. (elf_x86_link_hash_table): Add pcrel_plt. ld/ PR ld/22842 * testsuite/ld-i386/i386.exp: Run PR ld/22842 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr22842a.c: New file. * testsuite/ld-i386/pr22842b.S: Likewise. * testsuite/ld-x86-64/pr22842a.c: Likewise. * testsuite/ld-x86-64/pr22842a.rd: Likewise. * testsuite/ld-x86-64/pr22842b.S: Likewise. * testsuite/ld-x86-64/pr22842b.rd: Likewise.
2018-02-14 12:50:40 +01:00
#define NEED_DYNAMIC_RELOCATION_P(INFO, PCREL_PLT, H, SEC, R_TYPE, \
POINTER_TYPE) \
((bfd_link_pic (INFO) \
&& (! X86_PCREL_TYPE_P (R_TYPE) \
|| ((H) != NULL \
&& (! (bfd_link_pie (INFO) \
|| SYMBOLIC_BIND ((INFO), (H))) \
|| (H)->root.type == bfd_link_hash_defweak \
x86-64: Use PLT address for PC-relative reloc Since PLT in PDE and PC-relative PLT in PIE can be used as function address, there is no need for dynamic PC-relative relocation against a dynamic function definition in PIE. Linker should resolve PC-relative reference to its PLT address. NB: i386 has non-PIC PLT and PIC PLT. Only non-PIC PLT in PDE can be used as function address. PIC PLT in PIE can't be used as function address. bfd/ PR ld/22842 * elf32-i386.c (elf_i386_check_relocs): Pass FALSE for non PC-relative PLT to NEED_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (elf_x86_64_check_relocs): Create PLT for R_X86_64_PC32 reloc against dynamic function in data section. Pass TRUE for PC-relative PLT to NEED_DYNAMIC_RELOCATION_P. (elf_x86_64_relocate_section): Use PLT for R_X86_64_PC32 reloc against dynamic function in data section. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Use PLT in PIE as function address only if pcrel_plt is true. (_bfd_x86_elf_link_hash_table_create): Set pcrel_plt. * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): Add PCREL_PLT for PC-relative PLT. If PLT is PC-relative, don't generate dynamic PC-relative relocation against a function definition in data secton in PIE. Remove the obsolete comments. (elf_x86_link_hash_table): Add pcrel_plt. ld/ PR ld/22842 * testsuite/ld-i386/i386.exp: Run PR ld/22842 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr22842a.c: New file. * testsuite/ld-i386/pr22842b.S: Likewise. * testsuite/ld-x86-64/pr22842a.c: Likewise. * testsuite/ld-x86-64/pr22842a.rd: Likewise. * testsuite/ld-x86-64/pr22842b.S: Likewise. * testsuite/ld-x86-64/pr22842b.rd: Likewise.
2018-02-14 12:50:40 +01:00
|| (!(bfd_link_pie (INFO) \
&& (PCREL_PLT) \
&& (H)->plt.refcount > 0 \
&& ((SEC)->flags & SEC_CODE) == 0 \
&& (H)->type == STT_FUNC \
&& (H)->def_dynamic) \
&& !(H)->def_regular))))) \
|| ((H) != NULL \
&& (H)->type == STT_GNU_IFUNC \
&& (R_TYPE) == POINTER_TYPE \
&& ((SEC)->flags & SEC_CODE) == 0) \
|| (ELIMINATE_COPY_RELOCS \
&& !bfd_link_pic (INFO) \
&& (H) != NULL \
&& ((H)->root.type == bfd_link_hash_defweak \
|| !(H)->def_regular)))
/* TRUE if dynamic relocation should be generated. Don't copy a
pc-relative relocation into the output file if the symbol needs
copy reloc or the symbol is undefined when building executable.
Copy dynamic function pointer relocations. Don't generate dynamic
relocations against resolved undefined weak symbols in PIE, except
when PC32_RELOC is TRUE. Undefined weak symbol is bound locally
x86: Only allow S + A relocations against absolute symbol Since value of non-preemptible absolute symbol (SHN_ABS) won't change, only relocations, which can be resolved as absolute value + addend, and GOTPCREL relocations, where absolute value + addend is stored in the GOT slot, against non-preemptible absolute symbol are allowed in PIE and shared library. Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. bfd/ PR ld/25749 PR ld/25754 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load relocation to R_386_32 for relocation against non-preemptible absolute symbol. (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_i386_relocate_section): Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved. (elf_x86_64_convert_load_reloc): Covert load relocation to R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set tls_type for GOT slot to GOT_ABS for non-preemptible absolute symbol. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_x86_64_relocate_section): Don't generate relative relocation for GOTPCREL relocations aganst local absolute symbol. Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation against non-preemptible absolute symbol. (_bfd_elf_x86_valid_reloc_p): New function. (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for GOT_ABS GOT slot. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC argument. Don't generate dynamic relocation against non-preemptible absolute symbol. (ABS_SYMBOL_P): New. (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation against non-preemptible absolute symbol. (GOT_ABS): New. (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c. (_bfd_elf_x86_valid_reloc_p): New. ld/ PR ld/25749 PR ld/25754 * testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests. * testsuite/ld-elf/pr25749-1.c: New file. * testsuite/ld-elf/pr25749-1a.c: Likewise. * testsuite/ld-elf/pr25749-1b.c: Likewise. * testsuite/ld-elf/pr25749-1b.err: Likewise. * testsuite/ld-elf/pr25749-1c.c: Likewise. * testsuite/ld-elf/pr25749-1d.c: Likewise. * testsuite/ld-elf/pr25749-2.c: Likewise. * testsuite/ld-elf/pr25749-2a.s: Likewise. * testsuite/ld-elf/pr25749-2b.s: Likewise. * testsuite/ld-elf/pr25749.rd: Likewise. * testsuite/ld-elf/pr25754-1a.c: Likewise. * testsuite/ld-elf/pr25754-1b.s: Likewise. * testsuite/ld-elf/pr25754-2a.c: Likewise. * testsuite/ld-elf/pr25754-2b.err: Likewise. * testsuite/ld-elf/pr25754-2b.s: Likewise. * testsuite/ld-elf/pr25754-3a.c: Likewise. * testsuite/ld-elf/pr25754-3b.s: Likewise. * testsuite/ld-elf/pr25754-4a.c: Likewise. * testsuite/ld-elf/pr25754-4b.s: Likewise. * testsuite/ld-elf/pr25754-4c.s: Likewise. * testsuite/ld-elf/pr25754-5a.c: Likewise. * testsuite/ld-elf/pr25754-5b.s: Likewise. * testsuite/ld-elf/pr25754-5c.s: Likewise. * testsuite/ld-elf/pr25754-6a.c: Likewise. * testsuite/ld-elf/pr25754-6b.s: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.
2020-04-01 23:31:47 +02:00
when PIC is false. Don't generate dynamic relocations against
non-preemptible absolute symbol. */
#define GENERATE_DYNAMIC_RELOCATION_P(INFO, EH, R_TYPE, SEC, \
NEED_COPY_RELOC_IN_PIE, \
RESOLVED_TO_ZERO, PC32_RELOC) \
((bfd_link_pic (INFO) \
x86: Only allow S + A relocations against absolute symbol Since value of non-preemptible absolute symbol (SHN_ABS) won't change, only relocations, which can be resolved as absolute value + addend, and GOTPCREL relocations, where absolute value + addend is stored in the GOT slot, against non-preemptible absolute symbol are allowed in PIE and shared library. Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. bfd/ PR ld/25749 PR ld/25754 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load relocation to R_386_32 for relocation against non-preemptible absolute symbol. (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_i386_relocate_section): Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved. (elf_x86_64_convert_load_reloc): Covert load relocation to R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set tls_type for GOT slot to GOT_ABS for non-preemptible absolute symbol. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_x86_64_relocate_section): Don't generate relative relocation for GOTPCREL relocations aganst local absolute symbol. Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation against non-preemptible absolute symbol. (_bfd_elf_x86_valid_reloc_p): New function. (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for GOT_ABS GOT slot. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC argument. Don't generate dynamic relocation against non-preemptible absolute symbol. (ABS_SYMBOL_P): New. (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation against non-preemptible absolute symbol. (GOT_ABS): New. (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c. (_bfd_elf_x86_valid_reloc_p): New. ld/ PR ld/25749 PR ld/25754 * testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests. * testsuite/ld-elf/pr25749-1.c: New file. * testsuite/ld-elf/pr25749-1a.c: Likewise. * testsuite/ld-elf/pr25749-1b.c: Likewise. * testsuite/ld-elf/pr25749-1b.err: Likewise. * testsuite/ld-elf/pr25749-1c.c: Likewise. * testsuite/ld-elf/pr25749-1d.c: Likewise. * testsuite/ld-elf/pr25749-2.c: Likewise. * testsuite/ld-elf/pr25749-2a.s: Likewise. * testsuite/ld-elf/pr25749-2b.s: Likewise. * testsuite/ld-elf/pr25749.rd: Likewise. * testsuite/ld-elf/pr25754-1a.c: Likewise. * testsuite/ld-elf/pr25754-1b.s: Likewise. * testsuite/ld-elf/pr25754-2a.c: Likewise. * testsuite/ld-elf/pr25754-2b.err: Likewise. * testsuite/ld-elf/pr25754-2b.s: Likewise. * testsuite/ld-elf/pr25754-3a.c: Likewise. * testsuite/ld-elf/pr25754-3b.s: Likewise. * testsuite/ld-elf/pr25754-4a.c: Likewise. * testsuite/ld-elf/pr25754-4b.s: Likewise. * testsuite/ld-elf/pr25754-4c.s: Likewise. * testsuite/ld-elf/pr25754-5a.c: Likewise. * testsuite/ld-elf/pr25754-5b.s: Likewise. * testsuite/ld-elf/pr25754-5c.s: Likewise. * testsuite/ld-elf/pr25754-6a.c: Likewise. * testsuite/ld-elf/pr25754-6b.s: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.
2020-04-01 23:31:47 +02:00
&& !(bfd_is_abs_section (SEC) \
&& ((EH) == NULL \
|| SYMBOL_REFERENCES_LOCAL (INFO, &(EH)->elf))) \
&& !(NEED_COPY_RELOC_IN_PIE) \
&& ((EH) == NULL \
|| ((ELF_ST_VISIBILITY ((EH)->elf.other) == STV_DEFAULT \
&& (!(RESOLVED_TO_ZERO) || PC32_RELOC)) \
|| (EH)->elf.root.type != bfd_link_hash_undefweak)) \
&& ((!X86_PCREL_TYPE_P (R_TYPE) && !X86_SIZE_TYPE_P (R_TYPE)) \
|| ! SYMBOL_CALLS_LOCAL ((INFO), \
(struct elf_link_hash_entry *) (EH)))) \
|| (ELIMINATE_COPY_RELOCS \
&& !bfd_link_pic (INFO) \
&& (EH) != NULL \
&& (EH)->elf.dynindx != -1 \
&& (!(EH)->elf.non_got_ref \
|| ((EH)->elf.root.type == bfd_link_hash_undefweak \
&& !(RESOLVED_TO_ZERO))) \
&& (((EH)->elf.def_dynamic && !(EH)->elf.def_regular) \
|| (EH)->elf.root.type == bfd_link_hash_undefined)))
/* TRUE if this input relocation should be copied to output. H->dynindx
may be -1 if this symbol was marked to become local. */
#define COPY_INPUT_RELOC_P(INFO, H, R_TYPE) \
((H) != NULL \
&& (H)->dynindx != -1 \
&& (X86_PCREL_TYPE_P (R_TYPE) \
|| !(bfd_link_executable (INFO) || SYMBOLIC_BIND ((INFO), (H))) \
|| !(H)->def_regular))
2017-10-05 23:36:58 +02:00
/* TRUE if this is actually a static link, or it is a -Bsymbolic link
and the symbol is defined locally, or the symbol was forced to be
local because of a version file. */
#define RESOLVED_LOCALLY_P(INFO, H, HTAB) \
(!WILL_CALL_FINISH_DYNAMIC_SYMBOL ((HTAB)->elf.dynamic_sections_created, \
bfd_link_pic (INFO), (H)) \
|| (bfd_link_pic (INFO) \
&& SYMBOL_REFERENCES_LOCAL_P ((INFO), (H))) \
|| (ELF_ST_VISIBILITY ((H)->other) \
&& (H)->root.type == bfd_link_hash_undefweak))
/* TRUE if this symbol isn't defined by a shared object. */
#define SYMBOL_DEFINED_NON_SHARED_P(H) \
((H)->def_regular \
|| (H)->root.linker_def \
|| (H)->root.ldscript_def \
|| ((struct elf_x86_link_hash_entry *) (H))->linker_def \
|| ELF_COMMON_DEF_P (H))
x86: Only allow S + A relocations against absolute symbol Since value of non-preemptible absolute symbol (SHN_ABS) won't change, only relocations, which can be resolved as absolute value + addend, and GOTPCREL relocations, where absolute value + addend is stored in the GOT slot, against non-preemptible absolute symbol are allowed in PIE and shared library. Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. bfd/ PR ld/25749 PR ld/25754 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load relocation to R_386_32 for relocation against non-preemptible absolute symbol. (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_i386_relocate_section): Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved. (elf_x86_64_convert_load_reloc): Covert load relocation to R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set tls_type for GOT slot to GOT_ABS for non-preemptible absolute symbol. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_x86_64_relocate_section): Don't generate relative relocation for GOTPCREL relocations aganst local absolute symbol. Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation against non-preemptible absolute symbol. (_bfd_elf_x86_valid_reloc_p): New function. (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for GOT_ABS GOT slot. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC argument. Don't generate dynamic relocation against non-preemptible absolute symbol. (ABS_SYMBOL_P): New. (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation against non-preemptible absolute symbol. (GOT_ABS): New. (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c. (_bfd_elf_x86_valid_reloc_p): New. ld/ PR ld/25749 PR ld/25754 * testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests. * testsuite/ld-elf/pr25749-1.c: New file. * testsuite/ld-elf/pr25749-1a.c: Likewise. * testsuite/ld-elf/pr25749-1b.c: Likewise. * testsuite/ld-elf/pr25749-1b.err: Likewise. * testsuite/ld-elf/pr25749-1c.c: Likewise. * testsuite/ld-elf/pr25749-1d.c: Likewise. * testsuite/ld-elf/pr25749-2.c: Likewise. * testsuite/ld-elf/pr25749-2a.s: Likewise. * testsuite/ld-elf/pr25749-2b.s: Likewise. * testsuite/ld-elf/pr25749.rd: Likewise. * testsuite/ld-elf/pr25754-1a.c: Likewise. * testsuite/ld-elf/pr25754-1b.s: Likewise. * testsuite/ld-elf/pr25754-2a.c: Likewise. * testsuite/ld-elf/pr25754-2b.err: Likewise. * testsuite/ld-elf/pr25754-2b.s: Likewise. * testsuite/ld-elf/pr25754-3a.c: Likewise. * testsuite/ld-elf/pr25754-3b.s: Likewise. * testsuite/ld-elf/pr25754-4a.c: Likewise. * testsuite/ld-elf/pr25754-4b.s: Likewise. * testsuite/ld-elf/pr25754-4c.s: Likewise. * testsuite/ld-elf/pr25754-5a.c: Likewise. * testsuite/ld-elf/pr25754-5b.s: Likewise. * testsuite/ld-elf/pr25754-5c.s: Likewise. * testsuite/ld-elf/pr25754-6a.c: Likewise. * testsuite/ld-elf/pr25754-6b.s: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.
2020-04-01 23:31:47 +02:00
/* Return TRUE if the symbol described by a linker hash entry H is
going to be absolute. Similar to bfd_is_abs_symbol, but excluding
all linker-script defined symbols. */
#define ABS_SYMBOL_P(H) \
(bfd_is_abs_symbol (&(H)->root) && !(H)->root.ldscript_def)
/* TRUE if relative relocation should be generated. GOT reference to
global symbol in PIC will lead to dynamic symbol. It becomes a
problem when "time" or "times" is defined as a variable in an
executable, clashing with functions of the same name in libc. If a
symbol isn't undefined weak symbol, don't make it dynamic in PIC and
x86: Only allow S + A relocations against absolute symbol Since value of non-preemptible absolute symbol (SHN_ABS) won't change, only relocations, which can be resolved as absolute value + addend, and GOTPCREL relocations, where absolute value + addend is stored in the GOT slot, against non-preemptible absolute symbol are allowed in PIE and shared library. Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. bfd/ PR ld/25749 PR ld/25754 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load relocation to R_386_32 for relocation against non-preemptible absolute symbol. (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_i386_relocate_section): Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved. (elf_x86_64_convert_load_reloc): Covert load relocation to R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set tls_type for GOT slot to GOT_ABS for non-preemptible absolute symbol. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_x86_64_relocate_section): Don't generate relative relocation for GOTPCREL relocations aganst local absolute symbol. Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation against non-preemptible absolute symbol. (_bfd_elf_x86_valid_reloc_p): New function. (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for GOT_ABS GOT slot. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC argument. Don't generate dynamic relocation against non-preemptible absolute symbol. (ABS_SYMBOL_P): New. (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation against non-preemptible absolute symbol. (GOT_ABS): New. (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c. (_bfd_elf_x86_valid_reloc_p): New. ld/ PR ld/25749 PR ld/25754 * testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests. * testsuite/ld-elf/pr25749-1.c: New file. * testsuite/ld-elf/pr25749-1a.c: Likewise. * testsuite/ld-elf/pr25749-1b.c: Likewise. * testsuite/ld-elf/pr25749-1b.err: Likewise. * testsuite/ld-elf/pr25749-1c.c: Likewise. * testsuite/ld-elf/pr25749-1d.c: Likewise. * testsuite/ld-elf/pr25749-2.c: Likewise. * testsuite/ld-elf/pr25749-2a.s: Likewise. * testsuite/ld-elf/pr25749-2b.s: Likewise. * testsuite/ld-elf/pr25749.rd: Likewise. * testsuite/ld-elf/pr25754-1a.c: Likewise. * testsuite/ld-elf/pr25754-1b.s: Likewise. * testsuite/ld-elf/pr25754-2a.c: Likewise. * testsuite/ld-elf/pr25754-2b.err: Likewise. * testsuite/ld-elf/pr25754-2b.s: Likewise. * testsuite/ld-elf/pr25754-3a.c: Likewise. * testsuite/ld-elf/pr25754-3b.s: Likewise. * testsuite/ld-elf/pr25754-4a.c: Likewise. * testsuite/ld-elf/pr25754-4b.s: Likewise. * testsuite/ld-elf/pr25754-4c.s: Likewise. * testsuite/ld-elf/pr25754-5a.c: Likewise. * testsuite/ld-elf/pr25754-5b.s: Likewise. * testsuite/ld-elf/pr25754-5c.s: Likewise. * testsuite/ld-elf/pr25754-6a.c: Likewise. * testsuite/ld-elf/pr25754-6b.s: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.
2020-04-01 23:31:47 +02:00
generate relative relocation. Don't generate relative relocation
against non-preemptible absolute symbol. */
#define GENERATE_RELATIVE_RELOC_P(INFO, H) \
((H)->dynindx == -1 \
&& !(H)->forced_local \
&& (H)->root.type != bfd_link_hash_undefweak \
x86: Only allow S + A relocations against absolute symbol Since value of non-preemptible absolute symbol (SHN_ABS) won't change, only relocations, which can be resolved as absolute value + addend, and GOTPCREL relocations, where absolute value + addend is stored in the GOT slot, against non-preemptible absolute symbol are allowed in PIE and shared library. Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. bfd/ PR ld/25749 PR ld/25754 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load relocation to R_386_32 for relocation against non-preemptible absolute symbol. (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_i386_relocate_section): Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved. (elf_x86_64_convert_load_reloc): Covert load relocation to R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set tls_type for GOT slot to GOT_ABS for non-preemptible absolute symbol. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_x86_64_relocate_section): Don't generate relative relocation for GOTPCREL relocations aganst local absolute symbol. Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation against non-preemptible absolute symbol. (_bfd_elf_x86_valid_reloc_p): New function. (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for GOT_ABS GOT slot. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC argument. Don't generate dynamic relocation against non-preemptible absolute symbol. (ABS_SYMBOL_P): New. (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation against non-preemptible absolute symbol. (GOT_ABS): New. (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c. (_bfd_elf_x86_valid_reloc_p): New. ld/ PR ld/25749 PR ld/25754 * testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests. * testsuite/ld-elf/pr25749-1.c: New file. * testsuite/ld-elf/pr25749-1a.c: Likewise. * testsuite/ld-elf/pr25749-1b.c: Likewise. * testsuite/ld-elf/pr25749-1b.err: Likewise. * testsuite/ld-elf/pr25749-1c.c: Likewise. * testsuite/ld-elf/pr25749-1d.c: Likewise. * testsuite/ld-elf/pr25749-2.c: Likewise. * testsuite/ld-elf/pr25749-2a.s: Likewise. * testsuite/ld-elf/pr25749-2b.s: Likewise. * testsuite/ld-elf/pr25749.rd: Likewise. * testsuite/ld-elf/pr25754-1a.c: Likewise. * testsuite/ld-elf/pr25754-1b.s: Likewise. * testsuite/ld-elf/pr25754-2a.c: Likewise. * testsuite/ld-elf/pr25754-2b.err: Likewise. * testsuite/ld-elf/pr25754-2b.s: Likewise. * testsuite/ld-elf/pr25754-3a.c: Likewise. * testsuite/ld-elf/pr25754-3b.s: Likewise. * testsuite/ld-elf/pr25754-4a.c: Likewise. * testsuite/ld-elf/pr25754-4b.s: Likewise. * testsuite/ld-elf/pr25754-4c.s: Likewise. * testsuite/ld-elf/pr25754-5a.c: Likewise. * testsuite/ld-elf/pr25754-5b.s: Likewise. * testsuite/ld-elf/pr25754-5c.s: Likewise. * testsuite/ld-elf/pr25754-6a.c: Likewise. * testsuite/ld-elf/pr25754-6b.s: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.
2020-04-01 23:31:47 +02:00
&& bfd_link_pic (INFO) \
&& !ABS_SYMBOL_P (H))
/* TRUE if this is a pointer reference to a local IFUNC. */
#define POINTER_LOCAL_IFUNC_P(INFO, H) \
((H)->dynindx == -1 \
|| (H)->forced_local \
|| bfd_link_executable (INFO))
/* TRUE if this is a PLT reference to a local IFUNC. */
#define PLT_LOCAL_IFUNC_P(INFO, H) \
((H)->dynindx == -1 \
|| ((bfd_link_executable (INFO) \
|| ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT) \
&& (H)->def_regular \
&& (H)->type == STT_GNU_IFUNC))
/* TRUE if TLS IE->LE transition is OK. */
#define TLS_TRANSITION_IE_TO_LE_P(INFO, H, TLS_TYPE) \
(bfd_link_executable (INFO) \
&& (H) != NULL \
&& (H)->dynindx == -1 \
&& (TLS_TYPE & GOT_TLS_IE))
/* Verify that the symbol has an entry in the procedure linkage table. */
#define VERIFY_PLT_ENTRY(INFO, H, PLT, GOTPLT, RELPLT, LOCAL_UNDEFWEAK) \
do \
{ \
if (((H)->dynindx == -1 \
&& !LOCAL_UNDEFWEAK \
&& !(((H)->forced_local || bfd_link_executable (INFO)) \
&& (H)->def_regular \
&& (H)->type == STT_GNU_IFUNC)) \
|| (PLT) == NULL \
|| (GOTPLT) == NULL \
|| (RELPLT) == NULL) \
abort (); \
} \
while (0);
/* Verify that the symbol supports copy relocation. */
#define VERIFY_COPY_RELOC(H, HTAB) \
do \
{ \
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 (); \
} \
while (0);
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
/* x86 ELF linker hash entry. */
struct elf_x86_link_hash_entry
{
struct elf_link_hash_entry elf;
unsigned char tls_type;
/* Bit 0: Symbol has no GOT nor PLT relocations.
Bit 1: Symbol has non-GOT/non-PLT relocations in text sections.
zero_undefweak is initialized to 1 and undefined weak symbol
should be resolved to 0 if zero_undefweak > 0. */
unsigned int zero_undefweak : 2;
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
/* Don't call finish_dynamic_symbol on this symbol. */
unsigned int no_finish_dynamic_symbol : 1;
/* TRUE if symbol is __tls_get_addr. */
unsigned int tls_get_addr : 1;
/* TRUE if symbol is defined as a protected symbol. */
unsigned int def_protected : 1;
x86: Remove _bfd_{i386,x86_64}_elf_convert_load Instead of converting GOT relocations when sizing dynamic sections, we convert GOT relocations during relocation check. Add a field, local_ref, to elf_x86_link_hash_entry to indicate if symbol references are always local with a new function to check if symbol references are always local, which works in check_relocs. * elf32-i386.c (elf_i386_convert_load_reloc): Add an argument, r_type_p. Remove the converted argument. Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return the new relocation type via r_type_p. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (need_convert_load): Removed. (check_relocs_failed): Updated. (elf_i386_check_relocs): Call elf_i386_convert_load_reloc, instead of setting need_convert_load. (_bfd_i386_elf_convert_load): Removed. * elf64-x86-64.c (need_convert_load): Removed. (check_relocs_failed): Updated. (elf_x86_64_convert_load_reloc): Add an argument, r_type_p. Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return the new relocation type via r_type_p. (elf_x86_64_check_relocs): Call elf_x86_64_convert_load_reloc, instead of setting need_convert_load. (elf_x86_64_check_relocs): Don't check PIC if relocation has been converted. (_bfd_x86_64_elf_convert_load): Removed. (elf_x86_64_relocate_section): Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. (elf_x86_64_finish_dynamic_symbol): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Don't set convert_load. (_bfd_x86_elf_size_dynamic_sections): Don't call convert_load. (_bfd_x86_elf_link_symbol_references_local): New function. * elfxx-x86.h (SYMBOL_REFERENCES_LOCAL_P): New. (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace elf.forced_local with SYMBOL_REFERENCES_LOCAL_P. (elf_x86_link_hash_entry): Add local_ref. (elf_x86_link_hash_table): Remove convert_load. (_bfd_i386_elf_convert_load): Removed. (_bfd_x86_64_elf_convert_load): Likewise. (_bfd_x86_elf_link_symbol_references_local): New.
2017-09-07 13:03:15 +02:00
/* 0: Symbol references are unknown.
1: Symbol references aren't local.
2: Symbol references are local.
*/
unsigned int local_ref : 2;
x86: Properly handle __ehdr_start After _bfd_i386_elf_convert_load and _bfd_x86_64_elf_convert_load are removed, elf_i386_convert_load_reloc and elf_x86_64_convert_load_reloc see __ehdr_start as an undefined symbol when they are called from check_relocs to convert GOT relocations against local symbols. But __ehdr_start will be defined as a hidden symbol by linker at the later stage if it is referenced. This patch marks __ehdr_start as a defined local symbol at the start of check_relocs if it is referenced and not defined. bfd/ PR ld/22115 * elf32-i386.c (elf_i386_convert_load_reloc): Check linker_def. Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Check linker_def. Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO. * elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set local_ref and linker_def on __ehdr_start if it is referenced and not defined. (_bfd_x86_elf_link_symbol_references_local): Also set local_ref and return TRUE when building executable, if a symbol has non-GOT/non-PLT relocations in text section or there is no dynamic linker. * elfxx-x86.h (elf_x86_link_hash_entry): Add linker_def. ld/ PR ld/22115 * ld-i386/i386.exp: Run PR ld/22115 tests, * ld/testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr22115-1.s: New file. * testsuite/ld-i386/pr22115-1a.d: Likewise. * testsuite/ld-i386/pr22115-1b.d: Likewise. * testsuite/ld-i386/pr22115-1c.d: Likewise. * testsuite/ld-i386/pr22115-1d.d: Likewise. * testsuite/ld-x86-64/pr22115-1.s: Likewise. * testsuite/ld-x86-64/pr22115-1a-x32.d: Likewise. * testsuite/ld-x86-64/pr22115-1a.d: Likewise. * testsuite/ld-x86-64/pr22115-1b-x32.d: Likewise. * testsuite/ld-x86-64/pr22115-1b.d: Likewise. * testsuite/ld-x86-64/pr22115-1c-x32.d: Likewise. * testsuite/ld-x86-64/pr22115-1c.d: Likewise. * testsuite/ld-x86-64/pr22115-1d-x32.d: Likewise. * testsuite/ld-x86-64/pr22115-1d.d: Likewise.
2017-09-09 14:05:16 +02:00
/* TRUE if symbol is defined by linker. */
unsigned int linker_def : 1;
/* TRUE if symbol is referenced by R_386_GOTOFF relocation. This is
only used by i386. */
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
unsigned int gotoff_ref : 1;
/* TRUE if a weak symbol with a real definition needs a copy reloc.
When there is a weak symbol with a real definition, the processor
independent code will have arranged for us to see the real
definition first. We need to copy the needs_copy bit from the
real definition and check it when allowing copy reloc in PIE. This
is only used by x86-64. */
unsigned int needs_copy : 1;
/* Information about the GOT PLT entry. Filled when there are both
GOT and PLT relocations against the same function. */
union gotplt_union plt_got;
/* Information about the second PLT entry. */
union gotplt_union plt_second;
/* Offset of the GOTPLT entry reserved for the TLS descriptor,
starting at the end of the jump table. */
bfd_vma tlsdesc_got;
};
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
struct elf_x86_lazy_plt_layout
{
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout ENDBR64 is added to the special TLSDESC entry, which is similar to the PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel CET. The NaCl PLT is different from the normal PLT. This patch adds plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both normal and NaCl TLSDESC entries. This fixed FAIL: TLS descriptor -fpic -shared transitions for x86_64-nacl. * elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ... (elf_x86_64_tlsdesc_plt_entry): This. (elf_x86_64_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_nacl_plt): Likewise. (elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to update TLSDESC entry. * elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments. Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end. (elf_x86_non_lazy_plt_layout): Update comments. (elf_x86_plt_layout): Likewise.
2018-05-28 19:46:16 +02:00
/* The first entry in a lazy procedure linkage table looks like this. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
const bfd_byte *plt0_entry;
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned int plt0_entry_size; /* Size of PLT0 entry. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout ENDBR64 is added to the special TLSDESC entry, which is similar to the PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel CET. The NaCl PLT is different from the normal PLT. This patch adds plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both normal and NaCl TLSDESC entries. This fixed FAIL: TLS descriptor -fpic -shared transitions for x86_64-nacl. * elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ... (elf_x86_64_tlsdesc_plt_entry): This. (elf_x86_64_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_nacl_plt): Likewise. (elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to update TLSDESC entry. * elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments. Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end. (elf_x86_non_lazy_plt_layout): Update comments. (elf_x86_plt_layout): Likewise.
2018-05-28 19:46:16 +02:00
/* Later entries in a lazy procedure linkage table look like this. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
const bfd_byte *plt_entry;
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned int plt_entry_size; /* Size of each PLT entry. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout ENDBR64 is added to the special TLSDESC entry, which is similar to the PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel CET. The NaCl PLT is different from the normal PLT. This patch adds plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both normal and NaCl TLSDESC entries. This fixed FAIL: TLS descriptor -fpic -shared transitions for x86_64-nacl. * elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ... (elf_x86_64_tlsdesc_plt_entry): This. (elf_x86_64_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_nacl_plt): Likewise. (elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to update TLSDESC entry. * elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments. Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end. (elf_x86_non_lazy_plt_layout): Update comments. (elf_x86_plt_layout): Likewise.
2018-05-28 19:46:16 +02:00
/* The TLSDESC entry in a lazy procedure linkage table looks like
this. This is for x86-64 only. */
const bfd_byte *plt_tlsdesc_entry;
unsigned int plt_tlsdesc_entry_size; /* Size of TLSDESC entry. */
/* Offsets into the TLSDESC entry that are to be replaced with
GOT+8 and GOT+TDG. These are for x86-64 only. */
unsigned int plt_tlsdesc_got1_offset;
unsigned int plt_tlsdesc_got2_offset;
/* Offset of the end of the PC-relative instructions containing
plt_tlsdesc_got1_offset and plt_tlsdesc_got2_offset. These
are for x86-64 only. */
unsigned int plt_tlsdesc_got1_insn_end;
unsigned int plt_tlsdesc_got2_insn_end;
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
/* Offsets into plt0_entry that are to be replaced with GOT[1] and
GOT[2]. */
unsigned int plt0_got1_offset;
unsigned int plt0_got2_offset;
/* Offset of the end of the PC-relative instruction containing
plt0_got2_offset. This is for x86-64 only. */
unsigned int plt0_got2_insn_end;
/* Offsets into plt_entry that are to be replaced with... */
unsigned int plt_got_offset; /* ... address of this symbol in .got. */
unsigned int plt_reloc_offset; /* ... offset into relocation table. */
unsigned int plt_plt_offset; /* ... offset to start of .plt. */
/* Length of the PC-relative instruction containing plt_got_offset.
This is used for x86-64 only. */
unsigned int plt_got_insn_size;
/* Offset of the end of the PC-relative jump to plt0_entry. This is
used for x86-64 only. */
unsigned int plt_plt_insn_end;
/* Offset into plt_entry where the initial value of the GOT entry
points. */
unsigned int plt_lazy_offset;
/* The first entry in a PIC lazy procedure linkage table looks like
this. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
const bfd_byte *pic_plt0_entry;
/* Subsequent entries in a PIC lazy procedure linkage table look
like this. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
const bfd_byte *pic_plt_entry;
/* .eh_frame covering the lazy .plt section. */
const bfd_byte *eh_frame_plt;
unsigned int eh_frame_plt_size;
};
struct elf_x86_non_lazy_plt_layout
{
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout ENDBR64 is added to the special TLSDESC entry, which is similar to the PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel CET. The NaCl PLT is different from the normal PLT. This patch adds plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both normal and NaCl TLSDESC entries. This fixed FAIL: TLS descriptor -fpic -shared transitions for x86_64-nacl. * elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ... (elf_x86_64_tlsdesc_plt_entry): This. (elf_x86_64_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_nacl_plt): Likewise. (elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to update TLSDESC entry. * elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments. Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end. (elf_x86_non_lazy_plt_layout): Update comments. (elf_x86_plt_layout): Likewise.
2018-05-28 19:46:16 +02:00
/* Entries in a non-lazy procedure linkage table look like this. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
const bfd_byte *plt_entry;
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout ENDBR64 is added to the special TLSDESC entry, which is similar to the PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel CET. The NaCl PLT is different from the normal PLT. This patch adds plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both normal and NaCl TLSDESC entries. This fixed FAIL: TLS descriptor -fpic -shared transitions for x86_64-nacl. * elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ... (elf_x86_64_tlsdesc_plt_entry): This. (elf_x86_64_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_nacl_plt): Likewise. (elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to update TLSDESC entry. * elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments. Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end. (elf_x86_non_lazy_plt_layout): Update comments. (elf_x86_plt_layout): Likewise.
2018-05-28 19:46:16 +02:00
/* Entries in a PIC non-lazy procedure linkage table look like this.
This is only used for i386 where absolute PLT and PIC PLT are
different. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
const bfd_byte *pic_plt_entry;
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned int plt_entry_size; /* Size of each PLT entry. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
/* Offsets into plt_entry that are to be replaced with... */
unsigned int plt_got_offset; /* ... address of this symbol in .got. */
/* Length of the PC-relative instruction containing plt_got_offset.
This is used for x86-64 only. */
unsigned int plt_got_insn_size;
/* .eh_frame covering the non-lazy .plt section. */
const bfd_byte *eh_frame_plt;
unsigned int eh_frame_plt_size;
};
struct elf_x86_plt_layout
{
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout ENDBR64 is added to the special TLSDESC entry, which is similar to the PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel CET. The NaCl PLT is different from the normal PLT. This patch adds plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both normal and NaCl TLSDESC entries. This fixed FAIL: TLS descriptor -fpic -shared transitions for x86_64-nacl. * elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ... (elf_x86_64_tlsdesc_plt_entry): This. (elf_x86_64_lazy_plt): Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end for TLSDESC entry. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_nacl_plt): Likewise. (elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end to update TLSDESC entry. * elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments. Add plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end. (elf_x86_non_lazy_plt_layout): Update comments. (elf_x86_plt_layout): Likewise.
2018-05-28 19:46:16 +02:00
/* The first entry in a lazy procedure linkage table looks like this. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
const bfd_byte *plt0_entry;
/* Entries in a procedure linkage table look like this. */
const bfd_byte *plt_entry;
BFD whitespace fixes Binutils is supposed to use tabs. In my git config I have whitespace = indent-with-non-tab,space-before-tab,trailing-space and I got annoyed enough seeing red in "git diff" output to fix the problems. * doc/header.sed: Trim trailing space when splitting lines. * aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h, * arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c, * archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c, * bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c, * coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c, * coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c, * coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c, * cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c, * cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c, * cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c, * cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c, * cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c, * ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c, * elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c, * elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c, * elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c, * host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c, * i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h, * libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h, * netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c, * nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c, * peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c, * riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h, * sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c, * syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c, * vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c, * xsym.c, * xsym.h: Whitespace fixes. * bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-05 23:56:00 +01:00
unsigned int plt_entry_size; /* Size of each PLT entry. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
/* 1 has PLT0. */
unsigned int has_plt0;
/* Offsets into plt_entry that are to be replaced with... */
unsigned int plt_got_offset; /* ... address of this symbol in .got. */
/* Length of the PC-relative instruction containing plt_got_offset.
This is only used for x86-64. */
unsigned int plt_got_insn_size;
/* Alignment of the .iplt section. */
unsigned int iplt_alignment;
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
/* .eh_frame covering the .plt section. */
const bfd_byte *eh_frame_plt;
unsigned int eh_frame_plt_size;
};
/* Values in tls_type of x86 ELF linker hash entry. */
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
#define GOT_UNKNOWN 0
#define GOT_NORMAL 1
#define GOT_TLS_GD 2
#define GOT_TLS_IE 4
#define GOT_TLS_IE_POS 5
#define GOT_TLS_IE_NEG 6
#define GOT_TLS_IE_BOTH 7
#define GOT_TLS_GDESC 8
x86: Only allow S + A relocations against absolute symbol Since value of non-preemptible absolute symbol (SHN_ABS) won't change, only relocations, which can be resolved as absolute value + addend, and GOTPCREL relocations, where absolute value + addend is stored in the GOT slot, against non-preemptible absolute symbol are allowed in PIE and shared library. Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. bfd/ PR ld/25749 PR ld/25754 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load relocation to R_386_32 for relocation against non-preemptible absolute symbol. (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_i386_relocate_section): Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved. (elf_x86_64_convert_load_reloc): Covert load relocation to R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set tls_type for GOT slot to GOT_ABS for non-preemptible absolute symbol. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_x86_64_relocate_section): Don't generate relative relocation for GOTPCREL relocations aganst local absolute symbol. Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation against non-preemptible absolute symbol. (_bfd_elf_x86_valid_reloc_p): New function. (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for GOT_ABS GOT slot. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC argument. Don't generate dynamic relocation against non-preemptible absolute symbol. (ABS_SYMBOL_P): New. (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation against non-preemptible absolute symbol. (GOT_ABS): New. (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c. (_bfd_elf_x86_valid_reloc_p): New. ld/ PR ld/25749 PR ld/25754 * testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests. * testsuite/ld-elf/pr25749-1.c: New file. * testsuite/ld-elf/pr25749-1a.c: Likewise. * testsuite/ld-elf/pr25749-1b.c: Likewise. * testsuite/ld-elf/pr25749-1b.err: Likewise. * testsuite/ld-elf/pr25749-1c.c: Likewise. * testsuite/ld-elf/pr25749-1d.c: Likewise. * testsuite/ld-elf/pr25749-2.c: Likewise. * testsuite/ld-elf/pr25749-2a.s: Likewise. * testsuite/ld-elf/pr25749-2b.s: Likewise. * testsuite/ld-elf/pr25749.rd: Likewise. * testsuite/ld-elf/pr25754-1a.c: Likewise. * testsuite/ld-elf/pr25754-1b.s: Likewise. * testsuite/ld-elf/pr25754-2a.c: Likewise. * testsuite/ld-elf/pr25754-2b.err: Likewise. * testsuite/ld-elf/pr25754-2b.s: Likewise. * testsuite/ld-elf/pr25754-3a.c: Likewise. * testsuite/ld-elf/pr25754-3b.s: Likewise. * testsuite/ld-elf/pr25754-4a.c: Likewise. * testsuite/ld-elf/pr25754-4b.s: Likewise. * testsuite/ld-elf/pr25754-4c.s: Likewise. * testsuite/ld-elf/pr25754-5a.c: Likewise. * testsuite/ld-elf/pr25754-5b.s: Likewise. * testsuite/ld-elf/pr25754-5c.s: Likewise. * testsuite/ld-elf/pr25754-6a.c: Likewise. * testsuite/ld-elf/pr25754-6b.s: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.
2020-04-01 23:31:47 +02:00
#define GOT_ABS 9
#define GOT_TLS_GD_BOTH_P(type) \
((type) == (GOT_TLS_GD | GOT_TLS_GDESC))
#define GOT_TLS_GD_P(type) \
((type) == GOT_TLS_GD || GOT_TLS_GD_BOTH_P (type))
#define GOT_TLS_GDESC_P(type) \
((type) == GOT_TLS_GDESC || GOT_TLS_GD_BOTH_P (type))
#define GOT_TLS_GD_ANY_P(type) \
(GOT_TLS_GD_P (type) || GOT_TLS_GDESC_P (type))
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
#define elf_x86_hash_entry(ent) \
((struct elf_x86_link_hash_entry *)(ent))
/* x86 ELF linker hash table. */
struct elf_x86_link_hash_table
{
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *interp;
asection *plt_eh_frame;
asection *plt_second;
asection *plt_second_eh_frame;
asection *plt_got;
asection *plt_got_eh_frame;
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
/* Parameters describing PLT generation, lazy or non-lazy. */
struct elf_x86_plt_layout plt;
/* Parameters describing lazy PLT generation. */
const struct elf_x86_lazy_plt_layout *lazy_plt;
/* Parameters describing non-lazy PLT generation. */
const struct elf_x86_non_lazy_plt_layout *non_lazy_plt;
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
union
{
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ld_or_ldm_got;
/* The amount of space used by the jump slots in the GOT. */
bfd_vma sgotplt_jump_table_size;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* _TLS_MODULE_BASE_ symbol. */
struct bfd_link_hash_entry *tls_module_base;
/* Used by local STT_GNU_IFUNC symbols. */
htab_t loc_hash_table;
void * loc_hash_memory;
/* The index of the next R_X86_64_JUMP_SLOT entry in .rela.plt. */
bfd_vma next_jump_slot_index;
/* The index of the next R_X86_64_IRELATIVE entry in .rela.plt. */
bfd_vma next_irelative_index;
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
/* The (unloaded but important) .rel.plt.unloaded section on VxWorks.
This is used for i386 only. */
asection *srelplt2;
/* The index of the next unused R_386_TLS_DESC slot in .rel.plt. This
is only used for i386. */
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
bfd_vma next_tls_desc_index;
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.
2017-10-14 20:32:29 +02:00
/* Value used to fill the unused bytes of the first PLT entry. This
is only used for i386. */
bfd_byte plt0_pad_byte;
x86: Remove the unused _GLOBAL_OFFSET_TABLE_ Since _GLOBAL_OFFSET_TABLE_ may be referenced implicitly on x86, checking ref_regular_nonweak leaves the unused _GLOBAL_OFFSET_TABLE_ in output. This patch checks explicit GOT references instead. ld-i386/discarded1.s and ld-x86-64/discarded1.s are updated to avoid linker optimization which removes GOT references. bfd/ PR ld/22782 * elf32-i386.c (elf_i386_check_relocs): Set got_referenced if _GLOBAL_OFFSET_TABLE_ is referenced or GOT is needed to resolve undefined weak symbol to 0. * elf64-x86-64.c (elf_x86_64_check_relocs): Set got_referenced if _GLOBAL_OFFSET_TABLE_ is referenced. * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Check got_referenced instead of ref_regular_nonweak. Remove the unused _GLOBAL_OFFSET_TABLE_ from symbol table. * elfxx-x86.h (elf_x86_link_hash_table): Add got_referenced. ld/ PR ld/22782 * testsuite/ld-i386/discarded1.s: Replace mov with div. * testsuite/ld-x86-64/discarded1.s: Likewise. * testsuite/ld-i386/i386.exp: Run pr22782. * testsuite/ld-i386/load1-nacl.d: Updated for removing _GLOBAL_OFFSET_TABLE_ from output. * testsuite/ld-i386/load1.d: Likewise. * testsuite/ld-x86-64/load1a-nacl.d: Likewise. * testsuite/ld-x86-64/load1a.d: Likewise. * testsuite/ld-x86-64/load1b-nacl.d: Likewise. * testsuite/ld-x86-64/load1b.d: Likewise. * testsuite/ld-i386/pr22782.d: New file. * testsuite/ld-i386/pr22782.s: Likewise. * testsuite/ld-x86-64/pr22782.s: Likewise. * testsuite/ld-x86-64/pr22782a.d: Likewise. * testsuite/ld-x86-64/pr22782b.d: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr22782a and pr22782b.
2018-02-05 17:38:16 +01:00
/* TRUE if GOT is referenced. */
unsigned int got_referenced : 1;
x86-64: Use PLT address for PC-relative reloc Since PLT in PDE and PC-relative PLT in PIE can be used as function address, there is no need for dynamic PC-relative relocation against a dynamic function definition in PIE. Linker should resolve PC-relative reference to its PLT address. NB: i386 has non-PIC PLT and PIC PLT. Only non-PIC PLT in PDE can be used as function address. PIC PLT in PIE can't be used as function address. bfd/ PR ld/22842 * elf32-i386.c (elf_i386_check_relocs): Pass FALSE for non PC-relative PLT to NEED_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (elf_x86_64_check_relocs): Create PLT for R_X86_64_PC32 reloc against dynamic function in data section. Pass TRUE for PC-relative PLT to NEED_DYNAMIC_RELOCATION_P. (elf_x86_64_relocate_section): Use PLT for R_X86_64_PC32 reloc against dynamic function in data section. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Use PLT in PIE as function address only if pcrel_plt is true. (_bfd_x86_elf_link_hash_table_create): Set pcrel_plt. * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): Add PCREL_PLT for PC-relative PLT. If PLT is PC-relative, don't generate dynamic PC-relative relocation against a function definition in data secton in PIE. Remove the obsolete comments. (elf_x86_link_hash_table): Add pcrel_plt. ld/ PR ld/22842 * testsuite/ld-i386/i386.exp: Run PR ld/22842 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr22842a.c: New file. * testsuite/ld-i386/pr22842b.S: Likewise. * testsuite/ld-x86-64/pr22842a.c: Likewise. * testsuite/ld-x86-64/pr22842a.rd: Likewise. * testsuite/ld-x86-64/pr22842b.S: Likewise. * testsuite/ld-x86-64/pr22842b.rd: Likewise.
2018-02-14 12:50:40 +01:00
/* TRUE if PLT is PC-relative. PLT in PDE and PC-relative PLT in PIE
can be used as function address.
NB: i386 has non-PIC PLT and PIC PLT. Only non-PIC PLT in PDE can
be used as function address. PIC PLT in PIE can't be used as
function address. */
unsigned int pcrel_plt : 1;
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
bfd_vma (*r_info) (bfd_vma, bfd_vma);
bfd_vma (*r_sym) (bfd_vma);
x86: Add _bfd_x86_elf_size_dynamic_sections elf_i386_size_dynamic_sections and elf_x86_64_size_dynamic_sections are very similar, except for the followings: 1. elf_i386_size_dynamic_sections checks GOT_TLS_IE and GOT_TLS_IE_BOTH. elf_x86_64_size_dynamic_sections checks only GOT_TLS_IE. Since GOT_TLS_IE_BOTH is never true for x86-64, it is OK to check GOT_TLS_IE for both i386 and x86-64. 2, x86-64 sets tlsdesc_plt, but i386 doesn't. We set tlsdesc_plt only if target_id == X86_64_ELF_DATA. 3. x86-64 has if (s != htab->elf.srelplt) s->reloc_count = 0; and i386 has s->reloc_count = 0; i386 did have if (s != htab->srelplt) s->reloc_count = 0; in the original commit: commit 67a4f2b710581acc83afecff55424af285ecbc28 Author: Alexandre Oliva <aoliva@redhat.com> Date: Wed Jan 18 21:07:51 2006 +0000 But it was removed by commit 5ae0bfb60a576344d7f701605346282c1144499e Author: Richard Sandiford <rdsandiford@googlemail.com> Date: Tue Feb 28 07:16:12 2006 +0000 bfd/ * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index. (elf_i386_link_hash_table_create): Initialize it. (elf_i386_compute_jump_table_size): Use it instead of srelplt->reloc_count. (allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. A later commit: commit e1f987424b7b3f5ac63a2a6ae044a202a44b8ff8 Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Oct 21 15:13:37 2011 +0000 Put IRELATIVE relocations after JUMP_SLOT. bfd/ 2011-10-21 H.J. Lu <hongjiu.lu@intel.com> PR ld/13302 * elf32-i386.c (elf_i386_link_hash_table): Add next_jump_slot_index and next_irelative_index. (elf_i386_link_hash_table_create): Initialize next_jump_slot_index and next_irelative_index. (elf_i386_allocate_dynrelocs): Increment reloc_count instead of next_tls_desc_index. (elf_i386_size_dynamic_sections): Set next_tls_desc_index and next_irelative_index from reloc_count. (elf_i386_finish_dynamic_symbol): Put R_386_IRELATIVE after R_386_JUMP_SLOT. changed it back to use reloc_count again. So it is correct to use if (s != htab->elf.srelplt) s->reloc_count = 0; for both i386 and x86-64 now. 4. i386 and x86-64 use different DT_XXXs. They are handled by adding them to elf_x86_link_hash_table. With these changes, we can share _bfd_x86_elf_size_dynamic_sections in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_convert_load): Renamed to ... (_bfd_i386_elf_convert_load): This. Remove static. (elf_i386_size_dynamic_sections): Removed. (elf_backend_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_convert_load): Renamed to ... (_bfd_x86_64_elf_convert_load): This. Remove static. (elf_x86_64_size_dynamic_sections): Removed. (elf_backend_size_dynamic_sections): Likewise. * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): Renamed to ... (elf_x86_allocate_dynrelocs): This. Make it static. (_bfd_x86_elf_allocate_local_dynrelocs): Renamed to ... (elf_x86_allocate_local_dynreloc): This. Make it static. (elf_i386_is_reloc_section): New function. (elf_x86_64_is_reloc_section): Likewise. (_bfd_x86_elf_link_hash_table_create): Initialize convert_load, is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent. Rearrange got_entry_size initialization. (_bfd_x86_elf_size_dynamic_sections): New function. * elfxx-x86.h (elf_x86_link_hash_table): Add convert_load, is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent. (_bfd_i386_elf_convert_load): New. (_bfd_x86_64_elf_convert_load): Likewise. (_bfd_x86_elf_size_dynamic_sections): Likewise. (elf_backend_size_dynamic_sections): Likewise. (_bfd_x86_elf_allocate_dynrelocs): Removed. (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
2017-09-02 16:37:05 +02:00
bfd_boolean (*is_reloc_section) (const char *);
unsigned int sizeof_reloc;
unsigned int got_entry_size;
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
unsigned int pointer_r_type;
int dynamic_interpreter_size;
const char *dynamic_interpreter;
const char *tls_get_addr;
x86: Move x86-specific linker options to elf_linker_x86_params Remove x86-specific linker options from bfd_link_info and put them in elf_linker_x86_params. Add _bfd_elf_linker_x86_set_options to pass x86-specific linker options from ld to bfd. bfd/ * elf-linker-x86.h: New file. * elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params to get x86-specific linker options. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise. (_bfd_x86_elf_link_setup_gnu_properties): Likewise. (_bfd_elf_linker_x86_set_options): New function. * elfxx-x86.h: Include "elf-linker-x86.h". (elf_x86_link_hash_table): Add params. include/ * bfdlink.h (bfd_link_info): Remove x86-specific linker options. ld/ * Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em. (eelf_i386_sol2.c): Also depend on $(srcdir)/emultempl/solaris2-x86.em. (eelf_x86_64_sol2.c): Likewise. * Makefile.in: Regenerated. * emulparams/call_nop.sh: Set x86-specific linker options via params. * emulparams/cet.sh: Likewise. * emulparams/reloc_overflow.sh: Likewise. * emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New. Set to "elf-x86". * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to "solaris2-x86". * emulparams/elf_x86_64_sol2.sh: Likewise. * emultempl/elf-x86.em: New file. * emultempl/solaris2-x86.em: Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't set link_info.call_nop_byte.
2019-04-06 16:25:10 +02:00
/* Options passed from the linker. */
struct elf_linker_x86_params *params;
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
};
struct elf_x86_init_table
{
/* The lazy PLT layout. */
const struct elf_x86_lazy_plt_layout *lazy_plt;
/* The non-lazy PLT layout. */
const struct elf_x86_non_lazy_plt_layout *non_lazy_plt;
/* The lazy PLT layout for IBT. */
const struct elf_x86_lazy_plt_layout *lazy_ibt_plt;
/* The non-lazy PLT layout for IBT. */
const struct elf_x86_non_lazy_plt_layout *non_lazy_ibt_plt;
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.
2017-10-14 20:32:29 +02:00
bfd_byte plt0_pad_byte;
bfd_vma (*r_info) (bfd_vma, bfd_vma);
bfd_vma (*r_sym) (bfd_vma);
};
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
struct elf_x86_obj_tdata
{
struct elf_obj_tdata root;
/* tls_type for each local got entry. */
char *local_got_tls_type;
/* GOTPLT entries for TLS descriptors. */
bfd_vma *local_tlsdesc_gotent;
};
enum elf_x86_plt_type
{
plt_non_lazy = 0,
plt_lazy = 1 << 0,
plt_pic = 1 << 1,
plt_second = 1 << 2,
plt_unknown = -1
};
struct elf_x86_plt
{
const char *name;
asection *sec;
bfd_byte *contents;
enum elf_x86_plt_type type;
unsigned int plt_got_offset;
unsigned int plt_entry_size;
unsigned int plt_got_insn_size; /* Only used for x86-64. */
long count;
};
x86: Only allow S + A relocations against absolute symbol Since value of non-preemptible absolute symbol (SHN_ABS) won't change, only relocations, which can be resolved as absolute value + addend, and GOTPCREL relocations, where absolute value + addend is stored in the GOT slot, against non-preemptible absolute symbol are allowed in PIE and shared library. Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. bfd/ PR ld/25749 PR ld/25754 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load relocation to R_386_32 for relocation against non-preemptible absolute symbol. (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_i386_relocate_section): Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved. (elf_x86_64_convert_load_reloc): Covert load relocation to R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set tls_type for GOT slot to GOT_ABS for non-preemptible absolute symbol. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_x86_64_relocate_section): Don't generate relative relocation for GOTPCREL relocations aganst local absolute symbol. Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation against non-preemptible absolute symbol. (_bfd_elf_x86_valid_reloc_p): New function. (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for GOT_ABS GOT slot. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC argument. Don't generate dynamic relocation against non-preemptible absolute symbol. (ABS_SYMBOL_P): New. (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation against non-preemptible absolute symbol. (GOT_ABS): New. (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c. (_bfd_elf_x86_valid_reloc_p): New. ld/ PR ld/25749 PR ld/25754 * testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests. * testsuite/ld-elf/pr25749-1.c: New file. * testsuite/ld-elf/pr25749-1a.c: Likewise. * testsuite/ld-elf/pr25749-1b.c: Likewise. * testsuite/ld-elf/pr25749-1b.err: Likewise. * testsuite/ld-elf/pr25749-1c.c: Likewise. * testsuite/ld-elf/pr25749-1d.c: Likewise. * testsuite/ld-elf/pr25749-2.c: Likewise. * testsuite/ld-elf/pr25749-2a.s: Likewise. * testsuite/ld-elf/pr25749-2b.s: Likewise. * testsuite/ld-elf/pr25749.rd: Likewise. * testsuite/ld-elf/pr25754-1a.c: Likewise. * testsuite/ld-elf/pr25754-1b.s: Likewise. * testsuite/ld-elf/pr25754-2a.c: Likewise. * testsuite/ld-elf/pr25754-2b.err: Likewise. * testsuite/ld-elf/pr25754-2b.s: Likewise. * testsuite/ld-elf/pr25754-3a.c: Likewise. * testsuite/ld-elf/pr25754-3b.s: Likewise. * testsuite/ld-elf/pr25754-4a.c: Likewise. * testsuite/ld-elf/pr25754-4b.s: Likewise. * testsuite/ld-elf/pr25754-4c.s: Likewise. * testsuite/ld-elf/pr25754-5a.c: Likewise. * testsuite/ld-elf/pr25754-5b.s: Likewise. * testsuite/ld-elf/pr25754-5c.s: Likewise. * testsuite/ld-elf/pr25754-6a.c: Likewise. * testsuite/ld-elf/pr25754-6b.s: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.
2020-04-01 23:31:47 +02:00
/* Set if a relocation is converted from a GOTPCREL relocation. */
#define R_X86_64_converted_reloc_bit (1 << 7)
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
#define elf_x86_tdata(abfd) \
((struct elf_x86_obj_tdata *) (abfd)->tdata.any)
#define elf_x86_local_got_tls_type(abfd) \
(elf_x86_tdata (abfd)->local_got_tls_type)
#define elf_x86_local_tlsdesc_gotent(abfd) \
(elf_x86_tdata (abfd)->local_tlsdesc_gotent)
#define elf_x86_compute_jump_table_size(htab) \
((htab)->elf.srelplt->reloc_count * (htab)->got_entry_size)
#define is_x86_elf(bfd, htab) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
&& elf_object_id (bfd) == (htab)->elf.hash_table_id)
extern bfd_boolean _bfd_x86_elf_mkobject
(bfd *);
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
extern void _bfd_x86_elf_set_tls_module_base
(struct bfd_link_info *);
extern bfd_vma _bfd_x86_elf_dtpoff_base
(struct bfd_link_info *);
extern bfd_boolean _bfd_x86_elf_readonly_dynrelocs
(struct elf_link_hash_entry *, void *);
extern struct elf_link_hash_entry * _bfd_elf_x86_get_local_sym_hash
(struct elf_x86_link_hash_table *, bfd *, const Elf_Internal_Rela *,
bfd_boolean);
extern hashval_t _bfd_x86_elf_local_htab_hash
(const void *);
extern int _bfd_x86_elf_local_htab_eq
(const void *, const void *);
extern struct bfd_hash_entry * _bfd_x86_elf_link_hash_newfunc
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
extern struct bfd_link_hash_table * _bfd_x86_elf_link_hash_table_create
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
(bfd *);
extern int _bfd_x86_elf_compare_relocs
(const void *, const void *);
extern bfd_boolean _bfd_x86_elf_link_check_relocs
(bfd *, struct bfd_link_info *);
x86: Only allow S + A relocations against absolute symbol Since value of non-preemptible absolute symbol (SHN_ABS) won't change, only relocations, which can be resolved as absolute value + addend, and GOTPCREL relocations, where absolute value + addend is stored in the GOT slot, against non-preemptible absolute symbol are allowed in PIE and shared library. Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. bfd/ PR ld/25749 PR ld/25754 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load relocation to R_386_32 for relocation against non-preemptible absolute symbol. (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_i386_relocate_section): Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved. (elf_x86_64_convert_load_reloc): Covert load relocation to R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they overflow. (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set tls_type for GOT slot to GOT_ABS for non-preemptible absolute symbol. Don't allocate dynamic relocation for non-preemptible absolute symbol. (elf_x86_64_relocate_section): Don't generate relative relocation for GOTPCREL relocations aganst local absolute symbol. Pass sec to GENERATE_DYNAMIC_RELOCATION_P. * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation against non-preemptible absolute symbol. (_bfd_elf_x86_valid_reloc_p): New function. (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for GOT_ABS GOT slot. * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC argument. Don't generate dynamic relocation against non-preemptible absolute symbol. (ABS_SYMBOL_P): New. (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation against non-preemptible absolute symbol. (GOT_ABS): New. (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c. (_bfd_elf_x86_valid_reloc_p): New. ld/ PR ld/25749 PR ld/25754 * testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests. * testsuite/ld-elf/pr25749-1.c: New file. * testsuite/ld-elf/pr25749-1a.c: Likewise. * testsuite/ld-elf/pr25749-1b.c: Likewise. * testsuite/ld-elf/pr25749-1b.err: Likewise. * testsuite/ld-elf/pr25749-1c.c: Likewise. * testsuite/ld-elf/pr25749-1d.c: Likewise. * testsuite/ld-elf/pr25749-2.c: Likewise. * testsuite/ld-elf/pr25749-2a.s: Likewise. * testsuite/ld-elf/pr25749-2b.s: Likewise. * testsuite/ld-elf/pr25749.rd: Likewise. * testsuite/ld-elf/pr25754-1a.c: Likewise. * testsuite/ld-elf/pr25754-1b.s: Likewise. * testsuite/ld-elf/pr25754-2a.c: Likewise. * testsuite/ld-elf/pr25754-2b.err: Likewise. * testsuite/ld-elf/pr25754-2b.s: Likewise. * testsuite/ld-elf/pr25754-3a.c: Likewise. * testsuite/ld-elf/pr25754-3b.s: Likewise. * testsuite/ld-elf/pr25754-4a.c: Likewise. * testsuite/ld-elf/pr25754-4b.s: Likewise. * testsuite/ld-elf/pr25754-4c.s: Likewise. * testsuite/ld-elf/pr25754-5a.c: Likewise. * testsuite/ld-elf/pr25754-5b.s: Likewise. * testsuite/ld-elf/pr25754-5c.s: Likewise. * testsuite/ld-elf/pr25754-6a.c: Likewise. * testsuite/ld-elf/pr25754-6b.s: Likewise. * testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.
2020-04-01 23:31:47 +02:00
extern bfd_boolean _bfd_elf_x86_valid_reloc_p
(asection *, struct bfd_link_info *, struct elf_x86_link_hash_table *,
const Elf_Internal_Rela *, struct elf_link_hash_entry *,
Elf_Internal_Sym *, Elf_Internal_Shdr *, bfd_boolean *);
x86: Add _bfd_x86_elf_size_dynamic_sections elf_i386_size_dynamic_sections and elf_x86_64_size_dynamic_sections are very similar, except for the followings: 1. elf_i386_size_dynamic_sections checks GOT_TLS_IE and GOT_TLS_IE_BOTH. elf_x86_64_size_dynamic_sections checks only GOT_TLS_IE. Since GOT_TLS_IE_BOTH is never true for x86-64, it is OK to check GOT_TLS_IE for both i386 and x86-64. 2, x86-64 sets tlsdesc_plt, but i386 doesn't. We set tlsdesc_plt only if target_id == X86_64_ELF_DATA. 3. x86-64 has if (s != htab->elf.srelplt) s->reloc_count = 0; and i386 has s->reloc_count = 0; i386 did have if (s != htab->srelplt) s->reloc_count = 0; in the original commit: commit 67a4f2b710581acc83afecff55424af285ecbc28 Author: Alexandre Oliva <aoliva@redhat.com> Date: Wed Jan 18 21:07:51 2006 +0000 But it was removed by commit 5ae0bfb60a576344d7f701605346282c1144499e Author: Richard Sandiford <rdsandiford@googlemail.com> Date: Tue Feb 28 07:16:12 2006 +0000 bfd/ * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index. (elf_i386_link_hash_table_create): Initialize it. (elf_i386_compute_jump_table_size): Use it instead of srelplt->reloc_count. (allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. A later commit: commit e1f987424b7b3f5ac63a2a6ae044a202a44b8ff8 Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Oct 21 15:13:37 2011 +0000 Put IRELATIVE relocations after JUMP_SLOT. bfd/ 2011-10-21 H.J. Lu <hongjiu.lu@intel.com> PR ld/13302 * elf32-i386.c (elf_i386_link_hash_table): Add next_jump_slot_index and next_irelative_index. (elf_i386_link_hash_table_create): Initialize next_jump_slot_index and next_irelative_index. (elf_i386_allocate_dynrelocs): Increment reloc_count instead of next_tls_desc_index. (elf_i386_size_dynamic_sections): Set next_tls_desc_index and next_irelative_index from reloc_count. (elf_i386_finish_dynamic_symbol): Put R_386_IRELATIVE after R_386_JUMP_SLOT. changed it back to use reloc_count again. So it is correct to use if (s != htab->elf.srelplt) s->reloc_count = 0; for both i386 and x86-64 now. 4. i386 and x86-64 use different DT_XXXs. They are handled by adding them to elf_x86_link_hash_table. With these changes, we can share _bfd_x86_elf_size_dynamic_sections in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_convert_load): Renamed to ... (_bfd_i386_elf_convert_load): This. Remove static. (elf_i386_size_dynamic_sections): Removed. (elf_backend_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_convert_load): Renamed to ... (_bfd_x86_64_elf_convert_load): This. Remove static. (elf_x86_64_size_dynamic_sections): Removed. (elf_backend_size_dynamic_sections): Likewise. * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): Renamed to ... (elf_x86_allocate_dynrelocs): This. Make it static. (_bfd_x86_elf_allocate_local_dynrelocs): Renamed to ... (elf_x86_allocate_local_dynreloc): This. Make it static. (elf_i386_is_reloc_section): New function. (elf_x86_64_is_reloc_section): Likewise. (_bfd_x86_elf_link_hash_table_create): Initialize convert_load, is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent. Rearrange got_entry_size initialization. (_bfd_x86_elf_size_dynamic_sections): New function. * elfxx-x86.h (elf_x86_link_hash_table): Add convert_load, is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent. (_bfd_i386_elf_convert_load): New. (_bfd_x86_64_elf_convert_load): Likewise. (_bfd_x86_elf_size_dynamic_sections): Likewise. (elf_backend_size_dynamic_sections): Likewise. (_bfd_x86_elf_allocate_dynrelocs): Removed. (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
2017-09-02 16:37:05 +02:00
extern bfd_boolean _bfd_x86_elf_size_dynamic_sections
(bfd *, struct bfd_link_info *);
extern struct elf_x86_link_hash_table *_bfd_x86_elf_finish_dynamic_sections
(bfd *, struct bfd_link_info *);
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
extern bfd_boolean _bfd_x86_elf_always_size_sections
(bfd *, struct bfd_link_info *);
extern void _bfd_x86_elf_merge_symbol_attribute
(struct elf_link_hash_entry *, const Elf_Internal_Sym *,
bfd_boolean, bfd_boolean);
extern void _bfd_x86_elf_copy_indirect_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *);
extern bfd_boolean _bfd_x86_elf_fixup_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *);
extern bfd_boolean _bfd_x86_elf_hash_symbol
(struct elf_link_hash_entry *);
extern bfd_boolean _bfd_x86_elf_adjust_dynamic_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *);
extern void _bfd_x86_elf_hide_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
x86: Remove _bfd_{i386,x86_64}_elf_convert_load Instead of converting GOT relocations when sizing dynamic sections, we convert GOT relocations during relocation check. Add a field, local_ref, to elf_x86_link_hash_entry to indicate if symbol references are always local with a new function to check if symbol references are always local, which works in check_relocs. * elf32-i386.c (elf_i386_convert_load_reloc): Add an argument, r_type_p. Remove the converted argument. Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return the new relocation type via r_type_p. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (need_convert_load): Removed. (check_relocs_failed): Updated. (elf_i386_check_relocs): Call elf_i386_convert_load_reloc, instead of setting need_convert_load. (_bfd_i386_elf_convert_load): Removed. * elf64-x86-64.c (need_convert_load): Removed. (check_relocs_failed): Updated. (elf_x86_64_convert_load_reloc): Add an argument, r_type_p. Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. Return the new relocation type via r_type_p. (elf_x86_64_check_relocs): Call elf_x86_64_convert_load_reloc, instead of setting need_convert_load. (elf_x86_64_check_relocs): Don't check PIC if relocation has been converted. (_bfd_x86_64_elf_convert_load): Removed. (elf_x86_64_relocate_section): Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P. (elf_x86_64_finish_dynamic_symbol): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Don't set convert_load. (_bfd_x86_elf_size_dynamic_sections): Don't call convert_load. (_bfd_x86_elf_link_symbol_references_local): New function. * elfxx-x86.h (SYMBOL_REFERENCES_LOCAL_P): New. (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace elf.forced_local with SYMBOL_REFERENCES_LOCAL_P. (elf_x86_link_hash_entry): Add local_ref. (elf_x86_link_hash_table): Remove convert_load. (_bfd_i386_elf_convert_load): Removed. (_bfd_x86_64_elf_convert_load): Likewise. (_bfd_x86_elf_link_symbol_references_local): New.
2017-09-07 13:03:15 +02:00
extern bfd_boolean _bfd_x86_elf_link_symbol_references_local
(struct bfd_link_info *, struct elf_link_hash_entry *);
extern asection * _bfd_x86_elf_gc_mark_hook
(asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *);
extern long _bfd_x86_elf_get_synthetic_symtab
(bfd *, long, long, bfd_vma, struct elf_x86_plt [], asymbol **,
asymbol **);
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
extern enum elf_property_kind _bfd_x86_elf_parse_gnu_properties
(bfd *, unsigned int, bfd_byte *, unsigned int);
extern bfd_boolean _bfd_x86_elf_merge_gnu_properties
[BFD, AArch64, x86] Improve warning for --force-bti The AArch64 linker option to turn on BTI (--force-bti) warns in case there are input objects which have a missing GNU NOTE section for BTI. This patch is trying to improve the warnings that come out. In order to do so, I propose adding a new argument to elf_merge_gnu_properties and the backend function merge_gnu_properties. This new argument makes sure that we now pass both the objects along with the properties to which they belong to. The x86 backend function has also been updated to match this change. *** bfd/ChangeLog *** 2019-03-21 Sudakshina Das <sudi.das@arm.com> * elf-bfd.h (struct elf_backend_data): Add argument to merge_gnu_properties. * elf-properties.c (elf_merge_gnu_properties): Add argument to itself and while calling bed->merge_gnu_properties. (elf_merge_gnu_property_list): Update the calls for elf_merge_gnu_properties. * elfnn-aarch64.c (elfNN_aarch64_merge_gnu_properties): Update handling of --force-bti warning and add argument. * elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Add warning. * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Add argument. * elfxx-x86.h (_bfd_x86_elf_merge_gnu_properties): Likewise in declaration. *** ld/ChangeLog *** 2019-03-21 Sudakshina Das <sudi.das@arm.com> * testsuite/ld-aarch64/aarch64-elf.exp: Add new test. * testsuite/ld-aarch64/bti-plt-1.s: Add .ifdef for PAC note section. * testsuite/ld-aarch64/bti-plt-6.d: Update warning. * testsuite/ld-aarch64/bti-plt-7.d: Likewise. * testsuite/ld-aarch64/bti-warn.d: New test.
2019-03-21 17:20:21 +01:00
(struct bfd_link_info *, bfd *, bfd *, elf_property *, elf_property *);
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
extern void _bfd_x86_elf_link_fixup_gnu_properties
(struct bfd_link_info *, elf_property_list **);
extern bfd * _bfd_x86_elf_link_setup_gnu_properties
(struct bfd_link_info *, struct elf_x86_init_table *);
extern void _bfd_x86_elf_link_fixup_ifunc_symbol
(struct bfd_link_info *, struct elf_x86_link_hash_table *,
struct elf_link_hash_entry *, Elf_Internal_Sym *sym);
#define bfd_elf64_mkobject \
_bfd_x86_elf_mkobject
#define bfd_elf32_mkobject \
_bfd_x86_elf_mkobject
x86: Add _bfd_x86_elf_link_hash_table_create Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and elf64-x86-64.c by: 1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout, elf_i386_plt_layout, elf_x86_64_lazy_plt_layout, elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and elf_x86_plt_layout. 2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index from elf_i386_link_hash_table to elf_x86_link_hash_table. 3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table. * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_plt_layout): Likewise. (elf_i386_link_hash_table): Likewise. (elf_i386_next_tls_desc_index): Likewise. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. (elf_i386_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_i386_lazy_plt): Updated. (elf_i386_non_lazy_plt): Likewise. (elf_i386_lazy_ibt_plt): Likewise. (elf_i386_non_lazy_ibt_plt): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_nacl_plt): Likewise. * elf64-x86-64.c (ABI_64_P): Removed. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELF32_DYNAMIC_INTERPRETER): Likewise. (elf_x86_64_lazy_plt_layout): Likewise. (elf_x86_64_non_lazy_plt_layout): Likewise. (elf_x86_64_plt_layout): Likewise. (elf_x86_64_link_hash_table): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_64_lazy_plt): Updated. (elf_x86_64_non_lazy_plt): Likewise. (elf_x86_64_lazy_bnd_plt): Likewise. (elf_x86_64_non_lazy_bnd_plt): Likewise. (elf_x86_64_lazy_ibt_plt): Likewise. (elf_x32_lazy_ibt_plt): Likewise. (elf_x86_64_non_lazy_ibt_plt): Likewise. (elf_x32_non_lazy_ibt_plt): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_nacl_plt): Likewise. * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and "elf/x86-64.h". (ELF32_DYNAMIC_INTERPRETER): New. (ELF64_DYNAMIC_INTERPRETER): Likewise. (ELFX32_DYNAMIC_INTERPRETER): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (_bfd_x86_elf_link_hash_table_free): Renamed to ... (elf_x86_link_hash_table_free): This. Make it static. * elfxx-x86.h: Don't include "objalloc.h". (ABI_64_P): New. (elf_x86_lazy_plt_layout): Likewise. (elf_x86_non_lazy_plt_layout): Likewise. (elf_x86_plt_layout): Likewise. (_bfd_x86_elf_link_hash_table_create): Likewise. (bfd_elf64_bfd_link_hash_table_create): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index. (_bfd_x86_elf_link_hash_table_free): Removed.
2017-08-30 18:10:08 +02:00
#define bfd_elf64_bfd_link_hash_table_create \
_bfd_x86_elf_link_hash_table_create
#define bfd_elf32_bfd_link_hash_table_create \
_bfd_x86_elf_link_hash_table_create
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
#define bfd_elf64_bfd_link_check_relocs \
_bfd_x86_elf_link_check_relocs
#define bfd_elf32_bfd_link_check_relocs \
_bfd_x86_elf_link_check_relocs
x86: Add _bfd_x86_elf_size_dynamic_sections elf_i386_size_dynamic_sections and elf_x86_64_size_dynamic_sections are very similar, except for the followings: 1. elf_i386_size_dynamic_sections checks GOT_TLS_IE and GOT_TLS_IE_BOTH. elf_x86_64_size_dynamic_sections checks only GOT_TLS_IE. Since GOT_TLS_IE_BOTH is never true for x86-64, it is OK to check GOT_TLS_IE for both i386 and x86-64. 2, x86-64 sets tlsdesc_plt, but i386 doesn't. We set tlsdesc_plt only if target_id == X86_64_ELF_DATA. 3. x86-64 has if (s != htab->elf.srelplt) s->reloc_count = 0; and i386 has s->reloc_count = 0; i386 did have if (s != htab->srelplt) s->reloc_count = 0; in the original commit: commit 67a4f2b710581acc83afecff55424af285ecbc28 Author: Alexandre Oliva <aoliva@redhat.com> Date: Wed Jan 18 21:07:51 2006 +0000 But it was removed by commit 5ae0bfb60a576344d7f701605346282c1144499e Author: Richard Sandiford <rdsandiford@googlemail.com> Date: Tue Feb 28 07:16:12 2006 +0000 bfd/ * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index. (elf_i386_link_hash_table_create): Initialize it. (elf_i386_compute_jump_table_size): Use it instead of srelplt->reloc_count. (allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. A later commit: commit e1f987424b7b3f5ac63a2a6ae044a202a44b8ff8 Author: H.J. Lu <hjl.tools@gmail.com> Date: Fri Oct 21 15:13:37 2011 +0000 Put IRELATIVE relocations after JUMP_SLOT. bfd/ 2011-10-21 H.J. Lu <hongjiu.lu@intel.com> PR ld/13302 * elf32-i386.c (elf_i386_link_hash_table): Add next_jump_slot_index and next_irelative_index. (elf_i386_link_hash_table_create): Initialize next_jump_slot_index and next_irelative_index. (elf_i386_allocate_dynrelocs): Increment reloc_count instead of next_tls_desc_index. (elf_i386_size_dynamic_sections): Set next_tls_desc_index and next_irelative_index from reloc_count. (elf_i386_finish_dynamic_symbol): Put R_386_IRELATIVE after R_386_JUMP_SLOT. changed it back to use reloc_count again. So it is correct to use if (s != htab->elf.srelplt) s->reloc_count = 0; for both i386 and x86-64 now. 4. i386 and x86-64 use different DT_XXXs. They are handled by adding them to elf_x86_link_hash_table. With these changes, we can share _bfd_x86_elf_size_dynamic_sections in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_convert_load): Renamed to ... (_bfd_i386_elf_convert_load): This. Remove static. (elf_i386_size_dynamic_sections): Removed. (elf_backend_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_convert_load): Renamed to ... (_bfd_x86_64_elf_convert_load): This. Remove static. (elf_x86_64_size_dynamic_sections): Removed. (elf_backend_size_dynamic_sections): Likewise. * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): Renamed to ... (elf_x86_allocate_dynrelocs): This. Make it static. (_bfd_x86_elf_allocate_local_dynrelocs): Renamed to ... (elf_x86_allocate_local_dynreloc): This. Make it static. (elf_i386_is_reloc_section): New function. (elf_x86_64_is_reloc_section): Likewise. (_bfd_x86_elf_link_hash_table_create): Initialize convert_load, is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent. Rearrange got_entry_size initialization. (_bfd_x86_elf_size_dynamic_sections): New function. * elfxx-x86.h (elf_x86_link_hash_table): Add convert_load, is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent. (_bfd_i386_elf_convert_load): New. (_bfd_x86_64_elf_convert_load): Likewise. (_bfd_x86_elf_size_dynamic_sections): Likewise. (elf_backend_size_dynamic_sections): Likewise. (_bfd_x86_elf_allocate_dynrelocs): Removed. (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
2017-09-02 16:37:05 +02:00
#define elf_backend_size_dynamic_sections \
_bfd_x86_elf_size_dynamic_sections
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
#define elf_backend_always_size_sections \
_bfd_x86_elf_always_size_sections
#define elf_backend_merge_symbol_attribute \
_bfd_x86_elf_merge_symbol_attribute
#define elf_backend_copy_indirect_symbol \
_bfd_x86_elf_copy_indirect_symbol
#define elf_backend_fixup_symbol \
_bfd_x86_elf_fixup_symbol
#define elf_backend_hash_symbol \
_bfd_x86_elf_hash_symbol
#define elf_backend_adjust_dynamic_symbol \
_bfd_x86_elf_adjust_dynamic_symbol
#define elf_backend_gc_mark_hook \
_bfd_x86_elf_gc_mark_hook
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
#define elf_backend_omit_section_dynsym \
Remove bfd stub function casts. This patch defines a bunch of new functions to use in the BFD target structs rather than casting bfd_false or bfd_true and similar stub functions. I've also renamed the stub functions to reflect their parameters and put "error" in the name if they set bfd_error. The latter change is important since there were quite a few uses of bfd_false where setting bfd_error was inappropriate, for example in elf_backend_allow_non_load_phdr and is_target_special_symbol. * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false. (_bfd_bool_bfd_true): Rename from bfd_true. (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr. (_bfd_int_bfd_0): Rename from bfd_0. (_bfd_uint_bfd_0): Rename from bfd_0u. (_bfd_long_bfd_0): Rename from bfd_0l. (_bfd_long_bfd_n1_error): Rename from _bfd_n1. (_bfd_void_bfd): Rename from bfd_void. (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false), (_bfd_bool_bfd_link_false_error), (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true), (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true), (_bfd_bool_bfd_asection_bfd_asection_true), (_bfd_bool_bfd_asymbol_bfd_asymbol_true), (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions. * archive.c (_bfd_noarchive_get_elt_at_index), (_bfd_noarchive_openr_next_archived_file), (_bfd_noarchive_construct_extended_name_table), (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname), (_bfd_noarchive_write_armap): New functions. * archures.c (_bfd_nowrite_set_arch_mach): New function. * coff-alpha.c (alpha_ecoff_swap_coff_aux_in), (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in), (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out), (alpha_ecoff_swap_coff_lineno_out), (alpha_ecoff_swap_coff_reloc_out): New functions. * coff-mips.c (mips_ecoff_swap_coff_aux_in), (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in), (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out), (mips_ecoff_swap_coff_lineno_out), (mips_ecoff_swap_coff_reloc_out): New functions. * coffcode.h (coff_set_alignment_hook): Replace define with new function. (symname_in_debug_hook): Likewise. * ecoff.c (_bfd_ecoff_set_alignment_hook): New function. * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0. * elf.c (assign_file_positions_except_relocs): Test elf_backend_allow_non_load_phdr for NULL. * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from _bfd_elf_link_omit_section_dynsym. Update uses. (_bfd_elf_omit_section_dynsym_all): New function. * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete. (_bfd_elf_omit_section_dynsym_default): Declare. (_bfd_elf_omit_section_dynsym_all): Declare. * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section), (_bfd_nolink_bfd_get_relocated_section_contents), (_bfd_nolink_bfd_lookup_section_flags), (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group), (_bfd_nolink_bfd_link_hash_table_create), (_bfd_nolink_bfd_link_just_syms), (_bfd_nolink_bfd_copy_link_hash_symbol_type), (_bfd_nolink_bfd_link_split_section), (_bfd_nolink_section_already_linked), (_bfd_nolink_bfd_define_common_symbol), (_bfd_nolink_bfd_define_start_stop): New functions. * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup), (_bfd_norelocs_bfd_reloc_name_lookup), (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions. * section.c (_bfd_nowrite_set_section_contents): New function. * syms.c (_bfd_nosymbols_canonicalize_symtab), (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info), (_bfd_nosymbols_get_symbol_version_string), (_bfd_nosymbols_bfd_is_local_label_name), (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line), (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info), (_bfd_nosymbols_bfd_make_debug_symbol), ( _bfd_nosymbols_read_minisymbols), ( _bfd_nosymbols_minisymbol_to_symbol), (_bfd_nodynamic_get_synthetic_symtab): New functions. * libbfd-in.h: Declare new functions. Update existing defines, removing casts. * aix386-core.c: Update to use new hooks. Formatting. * aout-adobe.c: Likewise. * aout-arm.c: Likewise. * aout-target.h: Likewise. * aout-tic30.c: Likewise. * aoutf1.h: Likewise. * binary.c: Likewise. * bout.c: Likewise. * cisco-core.c: Likewise. * coff-alpha.c: Likewise. * coff-i386.c: Likewise. * coff-i860.c: Likewise. * coff-i960.c: Likewise. * coff-ia64.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic30.c: Likewise. * coff-tic54x.c: Likewise. * coff-x86_64.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * elf-m10300.c: Likewise. * elf32-cr16.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32r.c: Likewise. * elf32-metag.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-target.h: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.h: Likewise. * hp300hpux.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386msdos.c: Likewise. * i386os9k.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * irix-core.c: Likewise. * libaout.h: Likewise. * libecoff.h: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mipsbsd.c: Likewise. * mmo.c: Likewise. * netbsd-core.c: Likewise. * nlm-target.h: Likewise. * oasys.c: Likewise. * osf-core.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * pe-x86_64.c: Likewise. * pef.c: Likewise. * plugin.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * sco5-core.c: Likewise. * som.c: Likewise. * sparclynx.c: Likewise. * srec.c: Likewise. * tekhex.c: Likewise. * trad-core.c: Likewise. * verilog.c: Likewise. * versados.c: Likewise. * vms-alpha.c: Likewise. * vms-lib.c: Likewise. * wasm-module.c: Likewise. * xsym.c: Likewise. * libbfd.h: Regenerate.
2018-02-15 01:28:06 +01:00
_bfd_elf_omit_section_dynsym_all
Add elfxx-x86.h and elfxx-x86.c Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c. * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo. (BFD64_BACKENDS): Likewise. (BFD32_BACKENDS_CFILES): Add elfxx-x86.c. (BFD64_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * configure.ac (bfd_backends): Add elfxx-x86.lo together with elf32-i386.lo and elf64-x86-64.lo. * configure: Regenerated. * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_i386_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_i386_hash_entry): Likewise. (elf_i386_obj_tdata): Likewise. (elf_i386_tdata): Likewise. (elf_i386_local_got_tls_type): Likewise. (elf_i386_local_tlsdesc_gotent): Likewise. (elf_i386_hash_table): Likewise. (elf_i386_link_hash_newfunc): Likewise. (elf_i386_local_htab_hash): Likewise. (elf_i386_local_htab_eq): Likewise. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_link_hash_table_free): Likewise. (elf_i386_copy_indirect_symbol): Likewise. (elf_i386_fixup_symbol): Likewise. (elf_i386_readonly_dynrelocs): Likewise. (elf_i386_always_size_sections): Likewise. (elf_i386_set_tls_module_base): Likewise. (elf_i386_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_i386_hash_symbol): Likewise. (elf_i386_parse_gnu_properties): Likewise. (elf_i386_merge_gnu_properties): Likewise. (elf_i386_link_check_relocs): Likewise. (elf_i386_merge_symbol_attribute): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_i386_mkobject): Updated. (elf_i386_link_hash_table_create): Likewise. (elf_i386_check_tls_transition): Likewise. (elf_i386_tls_transition): Likewise. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_convert_load): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol ): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_output_arch_local_syms): Likewise. (elf_i386_get_synthetic_symtab): Likewise. (elf_i386_link_setup_gnu_properties): Likewise. (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_i386_next_tls_desc_index): New. (elf_i386_srelplt2): Likewise. (elf_i386_plt): Likewise. (elf_i386_lazy_plt): Likewise. (elf_i386_non_lazy_plt): Likewise. * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h", "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h", "objalloc.h" and "hashtab.h". (ELIMINATE_COPY_RELOCS): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise. (SYMBOL_NO_COPYRELOC): Likewise. (elf_x86_64_link_hash_entry): Likewise. (GOT_UNKNOWN): Likewise. (GOT_NORMAL): Likewise. (GOT_TLS_GD): Likewise. (elf_x86_64_hash_entry): Likewise. (elf_x86_64_obj_tdata): Likewise. (elf_x86_64_tdata): Likewise. (elf_x86_64_local_got_tls_type): Likewise. (elf_x86_64_local_tlsdesc_gotent): Likewise. (elf_x86_64_hash_table): Likewise. (elf_x86_64_link_hash_newfunc): Likewise. (elf_x86_64_local_htab_hash): Likewise. (elf_x86_64_local_htab_eq): Likewise. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_link_hash_table_free): Likewise. (elf_x86_64_copy_indirect_symbol): Likewise. (elf_x86_64_fixup_symbol): Likewise. (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_always_size_sections): Likewise. (elf_x86_64_set_tls_module_base): Likewise. (elf_x86_64_dtpoff_base): Likewise. (compare_relocs): Likewise. (elf_x86_64_merge_symbol_attribute): Likewise. (elf_x86_64_hash_symbol): Likewise. (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_x86_64_link_check_relocs): Likewise. (elf_backend_copy_indirect_symbol): Likewise. (elf_backend_always_size_sections): Likewise. (bfd_elf64_bfd_link_check_relocs): Likewise. (elf_backend_merge_symbol_attribute): Likewise. (elf_backend_hash_symbol): Likewise. (elf_backend_omit_section_dynsym): Likewise. (elf_backend_fixup_symbol): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. (bfd_elf32_bfd_link_check_relocs): Likewise. (elf_x86_64_mkobject): Updated. (elf_x86_64_link_hash_table_create): Likewise. (elf_x86_64_check_tls_transition): Likewise. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_convert_load): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol ): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_output_arch_local_syms): Likewise. (elf_x86_64_get_synthetic_symtab): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table, instead of elf_link_hash_table, as base. (elf_x86_64_next_tls_desc_index): New. (elf_x86_64_srelplt2): Likewise. (elf_x86_64_plt): Likewise. (elf_x86_64_lazy_plt): Likewise. (elf_x86_64_non_lazy_plt): Likewise. * elfxx-x86.c: New file. * elfxx-x86.h: Likewise.
2017-08-28 15:23:25 +02:00
#define elf_backend_parse_gnu_properties \
_bfd_x86_elf_parse_gnu_properties
#define elf_backend_merge_gnu_properties \
_bfd_x86_elf_merge_gnu_properties
#define elf_backend_fixup_gnu_properties \
_bfd_x86_elf_link_fixup_gnu_properties