aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2017-09-14Fix address violation when parsing a corrupt PE binary.Nick Clifton2-2/+9
PR binutils/22113 * peXXigen.c (pe_print_idata): Extend check for HintName vector entries.
2017-09-14Automatic date update in version.inGDB Administrator1-1/+1
2017-09-13elfxx-x86.h: Fix a typo in commentsH.J. Lu2-1/+5
* elfxx-x86.h: Fix a typo in comments.
2017-09-13Automatic date update in version.inGDB Administrator1-1/+1
2017-09-12Automatic date update in version.inGDB Administrator1-1/+1
2017-09-11nds32: Rename __BIT() to N32_BIT().Kuan-Lin Chen2-13/+17
2017-09-11Automatic date update in version.inGDB Administrator1-1/+1
2017-09-10Automatic date update in version.inGDB Administrator1-1/+1
2017-09-10PowerPC64 --plt-alignAlan Modra2-3/+21
This changes the PowerPC64 --plt-align option to perform the usual alignment of code as suggested by its name, as well as the previous behaviour of padding so as to reduce boundary crossing. The old behaviour is had by using a negative parameter. The default is also changed to align plt stub code by default to 32 byte boundaries, the point being to get better bctr branch prediction on power8 and power9 hardware. bfd/ * elf64-ppp.c (plt_stub_pad): Handle positive and negative plt_stub_align. ld/ * ld.texinfo (--plt-align): Describe new behaviour of option. * emultempl/ppc64elf.em (params): Default plt_stub_align to 5. * testsuite/ld-powerpc/powerpc.exp: Pass --no-plt-align for selected tests. * testsuite/ld-powerpc/relbrlt.d: Pass --no-plt-align. * testsuite/ld-powerpc/elfv2so.d: Adjust expected output.
2017-09-09x86: Update UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu5-36/+23
Since the only information which SYMBOL_REFERENCES_LOCAL_P doesn't check is relocations, UNDEFINED_WEAK_RESOLVED_TO_ZERO only needs to check for relocations with SYMBOL_REFERENCES_LOCAL_P. * elf32-i386.c (elf_i386_relocate_section): Update usage of UNDEFINED_WEAK_RESOLVED_TO_ZERO. (elf_i386_finish_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise. (_bfd_x86_elf_fixup_symbol): Likewise.
2017-09-09x86: Don't check has_non_got_relocH.J. Lu2-3/+7
_bfd_x86_elf_link_symbol_references_local should depend only on symbol references, not relocations, to work in check_relocs. * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't check has_non_got_reloc.
2017-09-09x86: Properly handle __ehdr_startH.J. Lu5-23/+77
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-09Automatic date update in version.inGDB Administrator1-1/+1
2017-09-08x86: Update comments in elfxx-x86.hH.J. Lu2-2/+6
* elfxx-x86.h: Update comments.
2017-09-08x86: Replace elf_x86_plt_layout_table with elf_x86_init_tableH.J. Lu5-54/+66
* elf32-i386.c (elf_i386_link_setup_gnu_properties): Replace elf_x86_plt_layout_table with elf_x86_init_table. * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise. * elfxx-x86.h (elf_x86_plt_layout_table): Renamed to ... (elf_x86_init_table): This. (_bfd_x86_elf_link_setup_gnu_properties): Replace elf_x86_plt_layout_table with elf_x86_init_table.
2017-09-07x86; Don't add elf64-x86-64.lo nor elf64.lo together with elfxx-x86.loH.J. Lu7-26/+38
Don't set r_info and r_sym fields in _bfd_x86_elf_link_hash_table_create. Instead, set them in _bfd_x86_elf_link_setup_gnu_properties. We can avoid adding elf64-x86-64.lo and elf64.lo together with elfxx-x86.lo to bfd_backends. * configure.ac (bfd_backends): Don't add elf64-x86-64.lo nor elf64.lo together with elfxx-x86.lo for 64-bit BFD. * configure: Regenerated. * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set r_info and r_sym fields of plt_layout. * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise. * elfxx-x86.c (elf_x86_64_is_reloc_section): Remove BFD64 check. (_bfd_x86_elf_link_hash_table_create): Likewise. Don't set r_info nor r_sym fields. (_bfd_x86_elf_link_setup_gnu_properties): Set r_info and r_sym fields of htab. * elfxx-x86.h (elf_x86_plt_layout_table): Add r_info and r_sym.
2017-09-08Automatic date update in version.inGDB Administrator1-1/+1
2017-09-07RISC-V: Print an error when unable to align a sectionPalmer Dabbelt2-2/+14
This used to just print "can't relax section: Success", which is a silly error message. bfd/ChangeLog 2017-09-07 Palmer Dabbelt <palmer@dabbelt.com> * elfnn-riscv.c (_bfd_riscv_relax_align): Call bfd_set_error and print an error message when unable to relax a .align directive.
2017-09-07RISC-V: Support PCREL_* relocations agaist weak undefined symbolsPalmer Dabbelt2-5/+76
I recently modified our Linux port's base address such the absolute address 0 is no longer addressable as a 32-bit PC-relative offset. Since Linux links a weak undefined symbol in an intermediate binary, it needs to be able to reference absolute address 0. This patch changes R_RISCV_PCREL_* relocations to absolute relocations while resolving them in order to allow these symbols to be referenced in PC-relative programs linked at high addresses. Note that this doesn't apply to PIC, which also uses PC-relative relocations, just to position-dependent objects, which we use to allow programs to be linked at high addresses. In case some of our embedded users are using R_RISCV_PCREL_* as a hacked up method of getting position-independent binaries (which can work if you have very simple programs), we only convert the relocations when the PC-relative version would overflow. bfd/ChangeLog: 2017-09-07 Palmer Dabbelt <palmer@dabbelt.com> * elfnn-riscv.c (riscv_zero_pcrel_hi_reloc): New function. (riscv_record_pcrel_hi_reloc): Add absolute argument. (riscv_elf_relocate_section): Call riscv_zero_pcrel_hi_reloc for R_RISCV_PCREL_HI20 relocs, and pass the result to riscv_record_pcrel_hi_reloc.
2017-09-07x86: Remove _bfd_{i386,x86_64}_elf_convert_loadH.J. Lu5-307/+137
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-07Automatic date update in version.inGDB Administrator1-1/+1
2017-09-06x86-64: Add R_X86_64_converted_reloc_bitH.J. Lu3-16/+47
Add R_X86_64_converted_reloc_bit to relocation type to indicate if a relocation is converted from a GOTPCREL relocation. Linker now generates failed to convert GOTPCREL relocation; relink with --no-relax for all cases, including relocations against local symbols. bfd/ * elf64-x86-64.c (R_X86_64_converted_reloc_bit): New. (elf_x86_64_info_to_howto): Get the real relocation type by masking out R_X86_64_converted_reloc_bit. (elf_x86_64_check_tls_transition): Get the real relocation type by masking out R_X86_64_converted_reloc_bit. (elf_x86_64_convert_load_reloc): Set R_X86_64_converted_reloc_bit instead of setting converted_reloc. (elf_x86_64_relocate_section): Check R_X86_64_converted_reloc_bit instead of converted_reloc. Get the real relocation type by masking out R_X86_64_converted_reloc_bit. (elf_x86_64_link_setup_gnu_properties): Verify that the value of R_X86_64_converted_reloc_bit is valid. * elfxx-x86.h (converted_reloc): Removed. ld/ * testsuite/ld-x86-64/pr19609-2a.d: Updated. * testsuite/ld-x86-64/pr19609-2b.d: Likewise. * testsuite/ld-x86-64/pr19609-4a.d: Likewise. * testsuite/ld-x86-64/pr19609-4c.d: Likewise.
2017-09-06x86: Don't change r_type when performing TLS transitionsH.J. Lu3-25/+36
Don't change r_type when performing TLS transitions to avoid getting the relocation type with ELF32_R_TYPE again. * elf32-i386.c (elf_i386_relocate_section): Don't change r_type when calling elf_i386_tls_transition. Don't use ELF32_R_TYPE to get the relocation type again. * elf64-x86-64.c (elf_x86_64_relocate_section): Don't change r_type when calling elf_x86_64_tls_transition. Don't use ELF32_R_TYPE to get the relocation type again.
2017-09-06Automatic date update in version.inGDB Administrator1-1/+1
2017-09-05x86-64: Properly set converted_relocH.J. Lu2-1/+6
Linker now generates failed to convert GOTPCREL relocation; relink with --no-relax for more cases. bfd/ * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Properly set converted_reloc. ld/ * testsuite/ld-x86-64/pr19609-5d.d: Updated. * testsuite/ld-x86-64/pr19609-7a.d: Likewise. * testsuite/ld-x86-64/pr19609-7c.d: Likewise.
2017-09-05x86-64: Improve GOTPCREL relocation conversionH.J. Lu3-107/+41
When GOTPCREL relocation conversion leads to relocation overflow, we may get a mysterious linker message, like relocation truncated to fit: R_X86_64_32S against symbol `foo' This patch changes the linker message to failed to convert GOTPCREL relocation; relink with --no-relax bfd/ * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Remove the sec argument. Don't check relocation overflow. Avoid relocation overflow if --no-relax is used. Set converted_reloc on symbol if a GOTPCREL relocation is converted. (elf_x86_64_relocate_section): Issue a fatal error and suggest --no-relax if GOTPCREL relocation conversion leads to relocation overflow. * elfxx-x86.h (elf_x86_link_hash_entry): Add converted_reloc. ld/ * testsuite/ld-x86-64/pr19609-4e.d: Updated. * testsuite/ld-x86-64/pr19609-6a.d: Likewise.
2017-09-05Automatic date update in version.inGDB Administrator1-1/+1
2017-09-05Missing relocation R_PPC_VLE_ADDR20 and add VLE flag to details in readelfAlexander Fedotov-B556132-0/+45
include/ * elf/ppc.h (R_PPC_VLE_ADDR20): New relocation. bfd/ * elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_VLE_ADDR20. (ppc_elf_check_relocs): Handle it. (ppc_elf_vle_split20): New function. (ppc_elf_relocate_section): Handle R_PPC_VLE_ADDR20. binutils/ * readelf.c (get_elf_section_flags): Add VLE. (process_section_headers): Add VLE key to details. gas/ * config/tc-ppc.c (md_parse_option): Handle "mno-vle" flag. (ppc_elf_section_letter): New function. * config/tc-ppc.h (md_elf_section_letter): New. * testsuite/gas/elf/section10.d: Adjust for VLE.
2017-09-04Automatic date update in version.inGDB Administrator1-1/+1
2017-09-03x86-64: Set tlsdesc_plt if GOT_TLS_GDESC_P is trueH.J. Lu2-1/+11
We need to set tlsdesc_plt for x86-64 if GOT_TLS_GDESC_P is true when allocating dynamic relocations so that _bfd_x86_elf_size_dynamic_sections will generate TLSDESC_PLT and TLSDESC_GOT in x86-64 output. bfd/ PR ld/22071 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Set tlsdesc_plt for x86-64 if GOT_TLS_GDESC_P is true. ld/ PR ld/22071 * testsuite/ld-x86-64/pr22071.d: New file. * testsuite/ld-x86-64/pr22071.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr22071.
2017-09-03PR22067, x86 check_relocs invalid readAlan Modra2-1/+7
PR 22067 * elfxx-x86.h (elf_x86_hash_table): Check is_elf_hash_table first.
2017-09-02Initialize tls_get_addr for x86-64 in one placeH.J. Lu2-2/+6
* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize tls_get_addr for x86-64 in one place.
2017-09-02Add missing ChangeLog entriesH.J. Lu1-0/+29
2017-09-02Add elf64-x86-64.lo together with elfxx-x86.lo for 64-bit BFDH.J. Lu3-4/+10
Since elfxx-x86.lo needs elf64-x86-64.lo with 64-bit BFD now, add elf64-x86-64.lo together with elfxx-x86.lo to bfd_backends for 64-bit BFD. * configure.ac (bfd_backends): Add elf64-x86-64.lo together with elfxx-x86.lo for 64-bit BFD. * configure: Regenerated.
2017-09-03Automatic date update in version.inGDB Administrator1-1/+1
2017-09-02x86: Add _bfd_x86_elf_size_dynamic_sectionsH.J. Lu4-815/+483
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-02x86: Rearrange fields and update commentsH.J. Lu2-8/+14
* elfxx-x86.h (elf_x86_link_hash_table): Rearrange fields and update comments.
2017-09-02i386: Update sgotplt_jump_table_size settingH.J. Lu2-1/+7
elf_i386_size_dynamic_sections has htab->next_tls_desc_index = htab->elf.srelplt->reloc_count; htab->sgotplt_jump_table_size = htab->next_tls_desc_index * 4; This patch changes it to htab->sgotplt_jump_table_size = elf_x86_compute_jump_table_size (htab) Since elf_x86_compute_jump_table_size is defined as ((htab)->elf.srelplt->reloc_count * (htab)->got_entry_size) there is no change in output. It makes elf_i386_size_dynamic_sections the same as elf_x86_64_size_dynamic_sections. * elf32-i386.c (elf_i386_size_dynamic_sections): Set sgotplt_jump_table_size with elf_x86_compute_jump_table_size.
2017-09-02x86: Define PLT_CIE_LENGTH and PLT_FDE_* in elfxx-x86.hH.J. Lu4-8/+14
Since PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET and PLT_FDE_LEN_OFFSET are identical in elf32-i386.c and elf64-x86-64.c, they can be defined in elfxx-x86.h. * elf32-i386.c (PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Moved to ... * elfxx-x86.h (PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Here. * elf64-x86-64.c (PLT_CIE_LENGTH, PLT_FDE_LENGTH, PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Removed.
2017-09-02x86: Add _bfd_x86_elf_allocate_dynrelocsH.J. Lu5-862/+502
Share _bfd_x86_elf_allocate_dynrelocs in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_allocate_dynrelocs): Removed. (elf_i386_allocate_local_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Replace elf_i386_allocate_dynrelocs/elf_i386_allocate_local_dynrelocs with _bfd_x86_elf_allocate_dynrelocs and _bfd_x86_elf_allocate_local_dynrelocs. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Removed. (elf_x86_64_allocate_local_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Replace elf_x86_64_allocate_dynrelocs/elf_x86_64_allocate_local_dynrelocs with _bfd_x86_elf_allocate_dynrelocs and _bfd_x86_elf_allocate_local_dynrelocs. * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): New function. (_bfd_x86_elf_allocate_local_dynrelocs): Likewise. * elfxx-x86.h (_bfd_x86_elf_allocate_dynrelocs): New prototype. (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
2017-09-02x86: Add is_x86_elfH.J. Lu5-20/+35
Share is_x86_elf in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (is_i386_elf): Removed. (elf_i386_check_relocs): Replace is_i386_elf with is_x86_elf. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (is_x86_64_elf): Removed. (elf_x86_64_check_relocs): Replace is_x86_64_elf with is_x86_elf. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize target_id. * elfxx-x86.h (elf_x86_link_hash_table): Add target_id. (is_x86_elf): New.
2017-09-02x86: Add elf_x86_compute_jump_table_sizeH.J. Lu5-11/+29
Share elf_x86_compute_jump_table_size in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_compute_jump_table_size): Removed. (elf_i386_allocate_dynrelocs): Replace elf_i386_compute_jump_table_size with elf_x86_compute_jump_table_size. (elf_i386_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_compute_jump_table_size): Removed. (elf_x86_64_allocate_dynrelocs): Replace elf_x86_64_compute_jump_table_size with elf_x86_compute_jump_table_size. (elf_x86_64_size_dynamic_sections): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize got_entry_size. * elfxx-x86.h (elf_x86_link_hash_table): Add got_entry_size. (elf_x86_compute_jump_table_size): New.
2017-09-02x86: Add sizeof_reloc to elf_x86_link_hash_tableH.J. Lu3-3/+12
Initialize htab->sizeof_reloc once, instead of computing it every time. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize sizeof_reloc. (_bfd_x86_elf_adjust_dynamic_symbol): Use sizeof_reloc. * elfxx-x86.h (elf_x86_link_hash_table): Add sizeof_reloc.
2017-09-02i386: Check VxWorks with htab->is_vxworksH.J. Lu2-15/+17
* elf32-i386.c (elf_i386_allocate_dynrelocs): Check VxWorks with htab->is_vxworks. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise.
2017-09-02x86: Move GOT_TLS_* in elf32-i386.c to elfxx-x86.hH.J. Lu4-28/+25
elf64-x86-64.c can use GOT_TLS_* definitions in elf32-i386.c with GOT_TLS_IE_POS, GOT_TLS_IE_NEG and GOT_TLS_IE_BOTH unused. * elf32-i386.c (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG, GOT_TLS_IE_BOTH, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P, GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Moved to ... * elfxx-x86.h (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG, GOT_TLS_IE_BOTH, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P, GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Here. * elf64-x86-64.c (GOT_TLS_IE, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P, GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Removed.
2017-09-01x86-64: Check ELF_COMMON_DEF_P for common symbolsH.J. Lu2-1/+7
bfd/ PR ld/22064 * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check ELF_COMMON_DEF_P for common symbols. ld/ PR ld/22064 * testsuite/ld-x86-64/pr22064a.S: New file. * testsuite/ld-x86-64/pr22064b.c: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run PR ld/22064 test.
2017-09-02-Og warning fixesAlan Modra4-3/+9
Found when building with gcc 4.9.4 using -Og. bfd/ * elf-eh-frame.c (offset_adjust): Avoid false positive gcc warning. * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Likewise. * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise. ld/ * emultempl/msp430.em (eval_upper_either_sections): Make base_sec_name a const char*. (eval_lower_either_sections): Likewise. (msp430_elf_after_allocation): Likewise, and don't needlessly concat and free. Warning fix.
2017-09-02Automatic date update in version.inGDB Administrator1-1/+1
2017-09-01x86: Add _bfd_x86_elf_gc_mark_hookH.J. Lu5-44/+44
Since R_X86_64_GNU_VTINHERIT == R_386_GNU_VTINHERIT and R_X86_64_GNU_VTENTRY == R_386_GNU_VTENTRY, we can share _bfd_x86_elf_gc_mark_hook in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_gc_mark_hook): Removed. (elf_backend_gc_mark_hook): Likewise. * elf64-x86-64.c (elf_x86_64_gc_mark_hook): Likewise. (elf_backend_gc_mark_hook): Likewise. * elfxx-x86.c (_bfd_x86_elf_gc_mark_hook): New function. * elfxx-x86.h (_bfd_x86_elf_gc_mark_hook): New. (elf_backend_gc_mark_hook): Likewise.
2017-09-01x86: Add _bfd_x86_elf_adjust_dynamic_symbolH.J. Lu5-389/+228
Share _bfd_x86_elf_adjust_dynamic_symbol in elf32-i386.c and elf64-x86-64.c. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Removed. (elf_backend_adjust_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise. (elf_backend_adjust_dynamic_symbol): Likewise. * elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): New function. (_bfd_x86_elf_link_setup_gnu_properties): Copy is_vxworks. * elfxx-x86.h (elf_x86_link_hash_table): Add is_vxworks. (_bfd_x86_elf_adjust_dynamic_symbol): New. (elf_backend_adjust_dynamic_symbol): Likewise.