summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* sparc: Remove UNDEFINED_WEAK_RESOLVED_TO_ZERO definitionusers/hjl/pr22269H.J. Lu2017-10-111-48/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since UNDEFINED_WEAK_RESOLVED_TO_ZERO has been added to elf-bfd.h, the private copy of UNDEFINED_WEAK_RESOLVED_TO_ZERO can be removed from elfxx-sparc.c. Also replace has_got_reloc and has_non_got_reloc with zero_undefweak in elf_link_hash_entry: 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. * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Removed. (_bfd_sparc_elf_link_hash_entry): Remove has_got_reloc and has_non_got_reloc. (link_hash_newfunc): Don't initialize has_got_reloc nor has_non_got_reloc. (_bfd_sparc_elf_copy_indirect_symbol): Don't copy has_got_reloc nor has_non_got_reloc. (_bfd_sparc_elf_check_relocs): Replace has_got_reloc and has_non_got_reloc with zero_undefweak. (_bfd_sparc_elf_fixup_symbol): Updated. (allocate_dynrelocs): Likewise. (_bfd_sparc_elf_relocate_section): Likewise. (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
* sh: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-4/+9
| | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elf32-sh.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (sh_elf_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* s390: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-112-4/+16
| | | | | | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elf32-s390.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (elf_s390_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. * elf64-s390.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (elf_s390_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* nios2: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-4/+12
| | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elf32-nios2.c (nios2_elf32_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* microblaze: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-2/+10
| | | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elf32-microblaze.c (microblaze_elf_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* m68k: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-4/+13
| | | | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elf32-m68k.c (elf_m68k_check_relocs): Don't allocate dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (elf_m68k_adjust_dynamic_symbol): Don't make symbol dynamic if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (elf_m68k_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* hppa: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-2/+10
| | | | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elf32-hppa.c (ensure_undef_dynamic): Don't make undefined symbol dynamic if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (elf32_hppa_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* ia64: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-5/+15
| | | | | | | | | | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elfnn-ia64.c (elfNN_ia64_check_relocs): Don't allocate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (allocate_fptr): Don't allocate function pointer if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (allocate_dynrel_entries): Don't allocate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (set_got_entry): Don't set GOT entry if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (set_pltoff_entry): Don't set PLTOFF entry if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (elfNN_ia64_relocate_section): Don't install dynamic relocation UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* mips: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-2/+9
| | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elfxx-mips.c (mips_elf_calculate_relocation): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (allocate_dynrelocs): Don't allocate dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* arm: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-3/+10
| | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elf32-arm.c (elf32_arm_final_link_relocate): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (allocate_dynrelocs_for_symbol): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* tile: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-112-6/+16
| | | | | | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elf32-tilepro.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (tilepro_elf_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. * elfxx-tilegx.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (tilegx_elf_relocate_section): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* aarch64: Check UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-111-2/+8
| | | | | | | | | | | | | Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFINED_WEAK_RESOLVED_TO_ZERO may need to be checked in more places. PR ld/22269 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Don't generate dynamic relocation if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true. (elfNN_aarch64_allocate_dynrelocs): Discard dynamic relocations if UNDEFINED_WEAK_RESOLVED_TO_ZERO is true.
* ppc: Update UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2017-10-112-6/+2
| | | | | | | | | UNDEFWEAK_NO_DYNAMIC_RELOC is the same as UNDEFINED_WEAK_RESOLVED_TO_ZERO. PR ld/22269 * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Defined as UNDEFINED_WEAK_RESOLVED_TO_ZERO. * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Likewise.
* Update _bfd_elf_symbol_refs_local_p/add UNDEFINED_WEAK_RESOLVED_TO_ZEROH.J. Lu2017-10-116-124/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update _bfd_elf_symbol_refs_local_p to cache result and handle undefined weak symbols and check version script. Add UNDEFINED_WEAK_RESOLVED_TO_ZERO to check if an undefined weak symbol should be resolved to 0. PR ld/22269 * elf-bfd.h (elf_link_hash_entry): Add local_ref and zero_undefweak. Moved from elf_x86_link_hash_entry. (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New. Moved from elfxx-x86.h. * elf32-i386.c (elf_i386_convert_load_reloc): Replace SYMBOL_REFERENCES_LOCAL_P with SYMBOL_REFERENCES_LOCAL. (elf_i386_check_relocs): Updated access to zero_undefweak. (elf_i386_relocate_section): Update UNDEFINED_WEAK_RESOLVED_TO_ZERO. Replace SYMBOL_REFERENCES_LOCAL_P with SYMBOL_REFERENCES_LOCAL. (elf_i386_finish_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Replace SYMBOL_REFERENCES_LOCAL_P with SYMBOL_REFERENCES_LOCAL. (elf_x86_64_check_reloc): Updated access to zero_undefweak. (elf_x86_64_relocate_section): Update UNDEFINED_WEAK_RESOLVED_TO_ZERO. Replace SYMBOL_REFERENCES_LOCAL_P with SYMBOL_REFERENCES_LOCAL. (elf_x86_64_finish_dynamic_symbol): Likewise. * elflink.c (_bfd_elf_symbol_refs_local_p): Cache the result in local_ref. Handle undefined weak symbols and check version script. (_bfd_elf_link_hash_newfunc): Initialize zero_undefweak to 1. (_bfd_elf_link_hash_copy_indirect): Also copy zero_undefweak. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Update UNDEFINED_WEAK_RESOLVED_TO_ZERO. (_bfd_x86_elf_link_hash_newfunc): Update zero_undefweak. (_bfd_x86_elf_link_check_relocs): Update local_ref. (_bfd_x86_elf_copy_indirect_symbol): Remove zero_undefweak. (_bfd_x86_elf_fixup_symbol): Update UNDEFINED_WEAK_RESOLVED_TO_ZERO. (_bfd_x86_elf_adjust_dynamic_symbol): Check call to undefined weak function which shouldn't be resolved to 0. (_bfd_x86_elf_link_symbol_references_local): Removed. * elfxx-x86.h (SYMBOL_REFERENCES_LOCAL_P): Removed. (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise. (_bfd_x86_elf_link_symbol_references_local): Likewise. (RESOLVED_LOCALLY_P): Replace SYMBOL_REFERENCES_LOCAL_P with SYMBOL_REFERENCES_LOCAL. (elf_x86_link_hash_entry): Remove zero_undefweak and local_ref.
* ELF: Call check_relocs after opening all inputsH.J. Lu2017-10-1195-3644/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For all ELF targers, call check_relocs after opening all inputs and garbage collection. Since the symbol resolution is known, check_relocs can be simplified. Also garbage collection doesn't need to undo what check_relocs has done for symbols which have been garbage collected. Since ELF targets never see the removed sections, gc_sweep_hook can be removed from elf_backend_data and we can avoid GOT/PLT with garbage collection now. Set link_info.check_relocs_after_open_input to TRUE for all linker targets which use ELF linker and update garbage collection tests to remove unused GOT section. ldemul_after_check_relocs is added for powerpc to support --secure-plt, --bss-plt and --sdata-got. Tested natively without regressions on i686, x86-64 and x32. Tested cross binutils on x86-64 without regressions for aarch64-linux, alpha-linux, arm-linux, bfin-elf, cr16-elf, cris-elf, crx-elf, frv-linux, hppa64-linux, hppa-linux, ia64-linux, lm32-elf, m32r-elf, m68k-linux, mcore-elf, metag-elf, microblaze-linux, mips-linux, mmix, mn10300-elf, nds32le-linux, nios2-linux, or1k-elf, powerpc64-linux, powerpc-linux, riscv32-linux, riscv64-linux, s390-linux, s390x-linux, score-elf, sh3-linux, sparc64-linux, sparc-linux, tic6x-elf, tilegx-linux, tilepro-linux, vax-linux, x86_64-mingw32 and xtensa-linux. bfd/ * elf-bfd.h (elf_backend_data): Remove gc_sweep_hook. * elf32-arm.c (elf32_arm_gc_sweep_hook): Removed. (elf_backend_gc_sweep_hook): Likewise. * elf32-bfin.c (bfin_gc_sweep_hook): Likewise. (bfinfdpic_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-cr16.c (elf32_cr16_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-cris.c (cris_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-lm32.c (lm32_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-m68k.c (elf_m68k_got_entry): Remove elf_m68k_gc_sweep_hook from comments. (elf_m68k_remove_got_entry_type): Removed. (elf_m68k_find_got_entry_ptr): Likewise. (elf_m68k_remove_got_entry): Likewise. (elf_m68k_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-mcore.c (mcore_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-metag.c (elf_metag_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-microblaze.c (elf_backend_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-mips.c (elf_backend_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-nds32.c (nds32_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-nios2.c (nios2_elf32_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-or1k.c (or1k_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-ppc.c (ppc_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-sparc.c (elf_backend_gc_sweep_hook): Likewise. * elf32-tic6x.c (elf32_tic6x_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-tilegx.c (elf_backend_gc_sweep_hook): Likewise. * elf32-tilepro.c (tilepro_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-alpha.c (elf64_alpha_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-mips.c (elf_backend_gc_sweep_hook): Likewise. * elf64-mmix.c (mmix_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-ppc.c (elf_backend_gc_sweep_hook): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-sparc.c (elf_backend_gc_sweep_hook): Likewise. * elf64-tilegx.c (elf_backend_gc_sweep_hook): Likewise. * elflink.c (elf_link_add_object_symbols): Don't call _bfd_elf_link_check_relocs here. (gc_sweep_hook_fn): Removed. (elf_gc_sweep): Remove gc_sweep_hook. * elfnn-aarch64.c (elfNN_aarch64_gc_sweep_hook): Removed. (elf_backend_gc_sweep_hook): Likewise. * elfnn-riscv.c (riscv_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_gc_sweep_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_gc_sweep_hook): Likewise. * elfxx-sparc.h (_bfd_sparc_elf_gc_sweep_hook): Likewise. * elfxx-target.h (elf_backend_gc_sweep_hook): Likewise. (elfNN_bed): Remove elf_backend_gc_sweep_hook. * elfxx-tilegx.c (tilegx_elf_gc_sweep_hook): Removed. * elfxx-tilegx.h (tilegx_elf_gc_sweep_hook): Removed. ld/ * emulparams/elf32_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Removed. * emulparams/elf_i386_be.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_chaos.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_ldso.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_vxworks.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_iamcu.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_k1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_l1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386lynx.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386moss.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386nw.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf32.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf_nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf_vxworks.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf32_linux.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf_linux.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf_nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emultempl/aarch64elf.em (gld${EMULATION_NAME}_before_parse): Set link_info.check_relocs_after_open_input to TRUE. * emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Likewise. * emultempl/scoreelf.em (gld${EMULATION_NAME}_before_parse): Likewise. * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Add after_parse_default. * emultempl/armcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/beos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/gld960.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/gld960c.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/lnk960.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/m68kcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/msp430.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pe.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pep.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/sunos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/ticoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/vanilla.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Always set link_info.check_relocs_after_open_input to TRUE. (ld_${EMULATION_NAME}_emulation): Add $LDEMUL_AFTER_CHECK_RELOCS. * emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Set link_info.check_relocs_after_open_input to TRUE. (ld_${EMULATION_NAME}_emulation): Add after_check_relocs_default. * emultempl/mmix-elfnmmo.em (mmix_before_parse): New function. (LDEMUL_BEFORE_PARSE): New. * emultempl/mmixelf.em (elfmmix_before_parse): Replace gld${EMULATION_NAME}_before_parse with mmix_before_parse. * emultempl/ppc32elf.em (ppc_after_open): Renamed to ... (ppc_after_check_relocs): This. Call after_check_relocs_default instead of gld${EMULATION_NAME}_after_open. (LDEMUL_AFTER_OPEN): Removed. (LDEMUL_AFTER_CHECK_RELOCS): New. * ldemul.c (ldemul_after_check_relocs): New. (after_check_relocs_default): Likewise. * ldemul.h (ldemul_after_check_relocs): Likewise. (after_check_relocs_default): Likewise. (ld_emulation_xfer_struct): Add after_check_relocs. * ldlang.c (lang_process): Call ldemul_after_check_relocs after lang_check_relocs. * testsuite/ld-aarch64/gc-got-relocs.d: Don't expect GOT section. * testsuite/ld-aarch64/gc-tls-relocs.d: Likewise. * testsuite/ld-cris/tls-gc-68.d: Likewise. * testsuite/ld-cris/tls-gc-69.d: Likewise. * testsuite/ld-cris/tls-gc-70.d: Likewise. * testsuite/ld-cris/tls-gc-75.d: Likewise. * testsuite/ld-cris/tls-gc-79.d: Likewise. * testsuite/ld-mmix/bpo-10.d: Don't expect .MMIX.reg_contents section.
* x86: Run PR ld/19636 tests with -z dynamic-undefined-weakH.J. Lu2017-10-1115-0/+190
| | | | | | | | | | | | | | | | | | | | | | | "-z dynamic-undefined-weak" makes undefined weak symbols dynamic, but undefined weak symbols are still resolved to 0 at link-time if there is no dynamic linker in executable. * testsuite/ld-i386/i386.exp: Run pr19636-1j, pr19636-1k, pr19636-1l, pr19636-3h and pr19636-3i. * testsuite/ld-i386/pr19636-1j.d: New file. * testsuite/ld-i386/pr19636-1k.d: Likewise. * testsuite/ld-i386/pr19636-1l.d: Likewise. * testsuite/ld-i386/pr19636-3h.d: Likewise. * testsuite/ld-i386/pr19636-3i.d: Likewise. * testsuite/ld-x86-64/pr19636-1h.d: Likewise. * testsuite/ld-x86-64/pr19636-1i.d: Likewise. * testsuite/ld-x86-64/pr19636-1j.d: Likewise. * testsuite/ld-x86-64/pr19636-2j.d: Likewise. * testsuite/ld-x86-64/pr19636-2k.d: Likewise. * testsuite/ld-x86-64/pr19636-2l.d: Likewise. * testsuite/ld-x86-64/pr19636-2m.d: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr19636-1h, pr19636-1i, pr19636-1j, pr19636-2j, pr19636-2k, pr19636-2l and pr19636-2m.
* Add native target for FreeBSD/arm.John Baldwin2017-10-116-0/+167
| | | | | | | | | | gdb/ChangeLog: * Makefile.in (ALLDEPFILES): Add arm-fbsd-nat.c. * NEWS: Mention new FreeBSD/arm native configuration. * configure.host: Add arm*-*-freebsd*. * configure.nat: Likewise. * arm-fbsd-nat.c: New file.
* Add FreeBSD/arm architecture.John Baldwin2017-10-116-0/+313
| | | | | | | | | | | | | | | | | | | Support for collecting and supplying general purpose and floating point registers is provided along with signal frame unwinding. While FreeBSD/arm kernels do populate NT_FPREGSET notes, they are always zero-filled, so this implementation ignores them. Recent FreeBSD/arm kernels generate NT_ARM_VFP notes which are used to supply floating-point registers. As with Linux, the AT_HWCAP feature flags are used to determine the correct target description. gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Add arm-fbsd-tdep.o. (ALLDEPFILES): Add arm-fbsd-tdep.c. * NEWS: Mention new FreeBSD/arm target. * configure.tgt: Add arm*-*-freebsd*. * arm-fbsd-tdep.c: New file. * arm-fbsd-tdep.h: New file.
* Disable the inclusion of logical input files in the assembler listing output ↵Nick Clifton2017-10-114-13/+38
| | | | | | | | | | | | unless high level source listing has been enabled. PR 21977 * listing.c (listing_newline): Use the name of the current physical input file, rather than the current logical input file, unless including high level source in the listing. * input-scrub.c (as_where_physical): New function. Returns the name of the current physical input file. * as.h: Add prototype for as_where_physical.
* GDB: Remove Linux core PRPSINFO note writer overrideMaciej W. Rozycki2017-10-115-69/+17
| | | | | | | | | | | | | | | | Revert parts of commit b3ac9c77560a ("Put more info in NT_PRPSINFO Linux notes"), <https://sourceware.org/ml/binutils/2013-02/msg00024.html>, and remove support for a Linux core PRPSINFO note writer override, now that all variants are handled automatically within BFD itself. gdb/ * linux-tdep.c (linux_make_corefile_notes): Remove call to `gdbarch_elfcore_write_linux_prpsinfo'. * gdbarch.sh (elfcore_write_linux_prpsinfo): Remove architecture method. (elf_internal_linux_prpsinfo): Remove declaration. * gdbarch.h: Regenerate. * gdbarch.c: Regenerate.
* ELF/BFD: Handle both variants of the 64-bit Linux core PRPSINFO noteMaciej W. Rozycki2017-10-116-10/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix commit 70a38d42c5b3 ("New entry points for writing Linux NT_PRPSINFO notes."), <https://sourceware.org/ml/binutils/2013-02/msg00023.html>, and handle both variants of the 64-bit Linux core PRPSINFO note across all targets. The 64-bit Linux core PRPSINFO note matches the 64-bit kernel structure, defined as follows: (gdb) ptype struct elf_prpsinfo type = struct elf_prpsinfo { char pr_state; char pr_sname; char pr_zomb; char pr_nice; unsigned long pr_flag; __kernel_uid_t pr_uid; __kernel_gid_t pr_gid; pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; char pr_fname[16]; char pr_psargs[80]; } (gdb) where the individual data types of most members are the same across all 64-bit Linux ports, with the exception of `__kernel_uid_t' and `__kernel_gid_t'. These are defined in <asm-generic/posix_types.h> as 32-bit `unsigned int' by default, however overridden as 16-bit `unsigned short' in port-specific <asm/posix_types.h> for the SuperH target. The default is already handled, as from the commit referred. Add the other variant then and provide a backend flag to switch between the two cases possible, with the 32-bit one being the default and the 16-bit one explicitly selected. Set the flag in the SuperH target backend. This arrangement is analogous to how the 32-bit Linux core PRPSINFO note is handled. bfd/ * elf-bfd.h (elf_backend_data): Add `linux_prpsinfo64_ugid16' member. * elf-linux-core.h (elf_external_linux_prpsinfo64): Rename to... (elf_external_linux_prpsinfo64_ugid32): ... this. (swap_linux_prpsinfo32_out): Rename to... (swap_linux_prpsinfo32_ugid32_out): ... this. (elf_external_linux_prpsinfo64_ugid16): New structure. (swap_linux_prpsinfo64_ugid16_out): New function. * elfxx-target.h [!elf_backend_linux_prpsinfo64_ugid16] (elf_backend_linux_prpsinfo64_ugid16): Define. (elfNN_bed): Initialize `linux_prpsinfo64_ugid16' member. * elf.c (elfcore_write_linux_prpsinfo64): Handle both variants of the 64-bit Linux core PRPSINFO note. * elf64-sh64.c (elf_backend_linux_prpsinfo64_ugid16): Define.
* ELF/BFD,GDB: Handle both variants of the 32-bit Linux core PRPSINFO noteMaciej W. Rozycki2017-10-1118-88/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix commit 70a38d42c5b3 ("New entry points for writing Linux NT_PRPSINFO notes."), <https://sourceware.org/ml/binutils/2013-02/msg00023.html>, and commit b3ac9c77560a ("Put more info in NT_PRPSINFO Linux notes"), <https://sourceware.org/ml/binutils/2013-02/msg00024.html>, and handle both variants of the 32-bit Linux core PRPSINFO note across all targets. The 32-bit Linux core PRPSINFO note matches the 32-bit kernel structure, defined as follows: (gdb) ptype struct elf_prpsinfo type = struct elf_prpsinfo { char pr_state; char pr_sname; char pr_zomb; char pr_nice; unsigned long pr_flag; __kernel_uid_t pr_uid; __kernel_gid_t pr_gid; pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; char pr_fname[16]; char pr_psargs[80]; } (gdb) where the individual data types of most members are the same across all 32-bit Linux ports, with the exception of `__kernel_uid_t' and `__kernel_gid_t'. These are defined in <asm-generic/posix_types.h> as 32-bit `unsigned int' by default, however overridden as 16-bit `unsigned short' in port-specific <asm/posix_types.h> for a few targets, mostly earlier ports of Linux, specifically: ARM, CRIS, FR-V, M32R, m68k, MN10300/AM33, s390, SuperH, SPARC and i386. The default is the same as the PowerPC variant already handled, as from the commits referred. Make the special PowerPC case generic then, removing the GDB part, and provide a backend flag to switch between the two cases possible, with the 32-bit one being the default and the 16-bit one explicitly selected. Set the flag in the target backends affected. bfd/ * elf-bfd.h (elf_backend_data): Add `linux_prpsinfo32_ugid16' member. (elfcore_write_ppc_linux_prpsinfo32): Remove prototype. * elf32-ppc.c (elfcore_write_ppc_linux_prpsinfo32): Remove. (elf_external_ppc_linux_prpsinfo32) (swap_ppc_linux_prpsinfo32_out): Move to... * elf-linux-core.h (elf_external_linux_prpsinfo32_ugid32) (swap_linux_prpsinfo32_ugid32_out): ... these. (elf_external_linux_prpsinfo32): Rename to... (elf_external_linux_prpsinfo32_ugid16): ... this. (swap_linux_prpsinfo32_out): Rename to... (swap_linux_prpsinfo32_ugid16_out): ... this. * elfxx-target.h [!elf_backend_linux_prpsinfo32_ugid16] (elf_backend_linux_prpsinfo32_ugid16): Define. (elfNN_bed): Initialize `linux_prpsinfo32_ugid16' member. * elf.c (elfcore_write_linux_prpsinfo32): Handle both variants of the 32-bit Linux core PRPSINFO note. * elf32-am33lin.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-arm.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-cris.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-frv.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-i386.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-m32r.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-m68k.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-s390.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-sh.c (elf_backend_linux_prpsinfo32_ugid16): Define. * elf32-sparc.c (elf_backend_linux_prpsinfo32_ugid16): Define. gdb/ * ppc-linux-tdep.c (ppc_linux_init_abi): Remove call to `set_gdbarch_elfcore_write_linux_prpsinfo'.
* ELF/BFD: Fix padding in `elf_external_linux_prpsinfo64'Maciej W. Rozycki2017-10-112-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix commit 70a38d42c5b3 ("New entry points for writing Linux NT_PRPSINFO notes."), <https://sourceware.org/ml/binutils/2013-02/msg00023.html>, and move the padding of the `elf_external_linux_prpsinfo64' structure to match the corresponding 64-bit Linux kernel `elf_prpsinfo' structure. The 64-bit kernel structure is defined as follows: (gdb) ptype struct elf_prpsinfo type = struct elf_prpsinfo { char pr_state; char pr_sname; char pr_zomb; char pr_nice; unsigned long pr_flag; __kernel_uid_t pr_uid; __kernel_gid_t pr_gid; pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; char pr_fname[16]; char pr_psargs[80]; } (gdb) print /x &((struct elf_prpsinfo *)0)->pr_nice $1 = 0x3 (gdb) print /x &((struct elf_prpsinfo *)0)->pr_flag $2 = 0x8 (gdb) print /x &((struct elf_prpsinfo *)0)->pr_uid $3 = 0x10 (gdb) print sizeof(((struct elf_prpsinfo *)0)->pr_flag) $4 = 8 (gdb) with implicit padding present before the `pr_flag' member, to correctly align it to a multiple of 8. Conversely `elf_external_linux_prpsinfo64' has padding after its `pr_flag' member: (top-gdb) ptype struct elf_external_linux_prpsinfo64 type = struct elf_external_linux_prpsinfo64 { char pr_state; char pr_sname; char pr_zomb; char pr_nice; char pr_flag[8]; char gap[4]; char pr_uid[4]; char pr_gid[4]; char pr_pid[4]; char pr_ppid[4]; char pr_pgrp[4]; char pr_sid[4]; char pr_fname[16]; char pr_psargs[80]; } (top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_nice $1 = 0x3 (top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_flag $2 = 0x4 (top-gdb) print /x &((struct elf_external_linux_prpsinfo64 *)0)->pr_uid $3 = 0x10 (top-gdb) and consequently `pr_flag' is misplaced. Move `gap' ahead of `pr_flag' then. bfd/ * elf-linux-core.h (elf_external_linux_prpsinfo64): Move the `gap' member ahead of `pr_flag'.
* Garbage collect reattach_breakpointsPedro Alves2017-10-113-43/+5
| | | | | | | | | Not used anywhere. gdb/ChangeLog: 2017-10-11 Pedro Alves <palves@redhat.com> * breakpoint.c (reattach_breakpoints): Delete. * breakpoint.h (reattach_breakpoints): Delete.
* Use std::vector for symtab_fnsSimon Marchi2017-10-112-13/+19
| | | | | | | | | | | | Simple replacement of VEC with std::vector. gdb/ChangeLog: * symfile.c (registered_sym_fns): Make struct, not typedef. (DEF_VEC_O (registered_sym_fns)): Remove. (symtab_fns): Change type to std::vector. (add_symtab_fns): Adjust. (find_sym_fns): Adjust.
* arc: Pass proper CPU value to the disassemblerAnton Kolesov2017-10-116-2/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | There was a problem with generation of the disassembler options for ARC in GDB, because a BFD architecture name was used as a CPU name, but they have different meaning even if some architectures have same name as respective CPUs. Target description specifies a BFD architecture, which is different from ARC CPU, as accepted by the disassembler (and most other ARC tools), because CPU values are much more fine grained - there can be multiple CPU values per single BFD architecture. As a result this code should translate architecture to some CPU value. Since there is no info on exact CPU configuration, it is best to use the most feature-rich CPU, so that the disassembler will recognize all instructions available to the specified architecture. gdb/ChangeLog yyyy-mm-dd Anton Kolesov <Anton.Kolesov@synopsys.com> * arc-tdep.c (arc_gdbarch_init): Pass proper cpu value to disassembler. * arc-tdep.h (arc_arch_is_em): New function. (arc_arch_is_hs): Likewise. gdb/testsuite/ChangeLog yyyy-mm-dd Anton Kolesov <Anton.Kolesov@synopsys.com> * gdb.arch/arc-tdesc-cpu.exp: New file. * gdb.arch/arc-tdesc-cpu.xml: Likewise.
* Rename _doprnt -> _bfd_doprnt to fix DJGPP bfd build (and likely others)Pedro Alves2017-10-112-6/+13
| | | | | | | | | | | | | | | | | | | | | | | Building bfd/ for DJGPP, I see: ../../src/bfd/bfd.c:642:1: error: conflicting types for '_doprnt' _doprnt (FILE *stream, const char *format, va_list ap) ^~~~~~~ In file included from ../../src/bfd/sysdep.h:37:0, from ../../src/bfd/bfd.c:367: /usr/lib64/gcc/i586-pc-msdosdjgpp/6.1.0/include-fixed/stdio.h:171:5: note: previous declaration of '_doprnt' was here int _doprnt(const char *_fmt, va_list _args, FILE *_f); ^~~~~~~ Possible fixes the build on other systems too -- _doprnt was/is an exported symbol on old Unix/BSD systems too. bfd/ChangeLog: 2017-10-11 Pedro Alves <palves@redhat.com> * bfd.c (_doprnt): Rename to ... (_bfd_doprnt): ... this. (error_handler_internal): Adjust.
* Display more information when decoding DW_AT_endianity, DW_AT_decimal_sign, ↵Nick Clifton2017-10-115-6/+283
| | | | | | | | | | | | | | | DW_AT_defaulted and DW_AT_discr_list DWARF attributes. * dwarf.c (read_and_display_attr_value): Handle DW_AT_endianity, DW_END_default, DW_END_big, DW_END_little, DW_ATE_UCS, DW_ATE_ASCII, DW_CC_pass_by_reference, DW_CC_pass_by_value, DW_CC_GNU_renesas_sh, DW_CC_GNU_borland_fastcall_i386, DW_AT_decimal_sign, DW_AT_defaulted, DW_AT_discr_list. (get_TAG_name): Report user generated tag values. * testsuite/binutils-all/dwarf-attributes.S: New test. * testsuite/binutils-all/dwarf-attributes.W. Expected output from readelf. * testsuite/binutils-all/readelf.exp: Run the new test.
* Remove unnecessary parentheses in declarationsEgeyar Bagcioglu2017-10-116-16/+27
| | | | | | | | | | | | | | | | | | | GCC commit a94975e57 ("C++ warning on vexing parse") introduces new warnings "unnecessary parentheses in the declaration of ...". These cause the build of binutils and gdb to fail. This patch removes those parentheses for a successful build. gdb/ChangeLog: 2017-10-11 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com> * macrotab.h (macro_lookup_inclusion): Remove unnecessary parentheses in the declaration. (macro_lookup_inclusion): Likewise. (macro_lookup_definition): Likewise. * p-lang.h (pascal_builtin_types): Likewise. * tui/tui-data.c (tui_win_list): Likewise. * tui/tui-data.h (tui_win_list): Likewise. * utils.h (make_cleanup_free_section_addr_info): Likewise.
* Flash memory size not aligned to addressKevin Buettner2017-10-112-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (This patch is from Mark Rages <markrages@gmail.com>.) The Nordic nRF52 memory map, reported from black magic probe: Num Enb Low Addr High Addr Attrs 0 y 0x00000000 0x00080000 flash blocksize 0x1000 nocache 1 y 0x10001000 0x10001210 flash blocksize 0x210 nocache 2 y 0x20000000 0x20010000 rw nocache The region at 0x10001000 is "UICR" and it is a section of flash that is erased all at once. Notice the odd size: 0x210 is the size of the region defined in the datasheet. But because the block size was listed as 0x210, gdb was insisting on issuing two erase commands divisible by 0x210, starting below 0x10001000. This patch fixes it by doing the alignment computation from the start of the region, not from address 0. gdb/ChangeLog: * target-memory.c (block_boundaries): Fix for block address not aligned on block size.
* ld internationalization fixesAlan Modra2017-10-1143-296/+369
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * emultempl/aarch64elf.em: Wrap einfo strings in _(). Formatting. * emultempl/aix.em: Likewise. * emultempl/armcoff.em: Likewise. * emultempl/armelf.em: Likewise. * emultempl/avrelf.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/cr16elf.em: Likewise. * emultempl/elf-generic.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/genelf.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68hc1xelf.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/m68kelf.em: Likewise. * emultempl/metagelf.em: Likewise. * emultempl/mipself.em: Likewise. * emultempl/mmix-elfnmmo.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/msp430.em: Likewise. * emultempl/nds32elf.em: Likewise. * emultempl/nios2elf.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/riscvelf.em: Likewise. * emultempl/s390.em: Likewise. * emultempl/scoreelf.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/tic6xdsbt.em: Likewise. * emultempl/v850elf.em: Likewise. * emultempl/vms.em: Likewise. * emultempl/vxworks.em: Likewise. * ldcref.c: Likewise. * ldlang.c: Likewise. * ldlex.l: Likewise. * ldmain.c: Likewise. * pe-dll.c: Likewise. * plugin.c: Likewise.
* Automatic date update in version.inGDB Administrator2017-10-111-1/+1
|
* x86: Set GOT refcount to 1H.J. Lu2017-10-103-6/+12
| | | | | | | | | | | | | | | | | | | Since x86 check_relocs is called after opening all inputs and garbage collection, they never see the removed sections. There is no need for incrementing GOT refcount. But since PLT refcount is also used in /* Don't create the PLT entry if there are only function pointer relocations which can be resolved at run-time. */ else if (htab->elf.dynamic_sections_created && (h->plt.refcount > eh->func_pointer_refcount || eh->plt_got.refcount > 0)) { we must increment it. * elf32-i386.c (elf_i386_check_relocs): Set GOT refcount to 1 instead of incrementing it. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* get_integer_valueof: Don't output value in test nameSimon Marchi2017-10-102-1/+5
| | | | | | | | | | | | | | | The get_integer_valueof outputs the value it has read as part of the test name. This causes test names to vary from run to run, and adds some noise when diffing test results. e.g.: -PASS: gdb.threads/process-dies-while-detaching.exp: multi-process: continue: killed outside: get integer valueof "mypid" (28770) +PASS: gdb.threads/process-dies-while-detaching.exp: multi-process: continue: killed outside: get integer valueof "mypid" (32238) This patch removes that, since it's probably not very useful. gdb/testsuite/ChangeLog: * lib/gdb.exp (get_integer_valueof): Don't output read value in test name.
* Bump dwarf-mode version numberTom Tromey2017-10-102-1/+5
| | | | | | | | | Bump the dwarf-mode version number, so it can be installed by package.el users who installed an earlier verision. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el: Bump to version 1.4.
* Asynchronous insertion for dwarf-mode.elTom Tromey2017-10-102-16/+68
| | | | | | | | | | | | | | | | | | | | I was recently examining a very large .debug file. I tried to use dwarf-mode, but it blocked Emacs for a very long time while reading output. This patch changes dwarf-mode to run the objdump process asynchronously. This way, I can still do other things in Emacs while waiting for the dumping to finish. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el (dwarf--process, dwarf--deletion-region): New defvar. (dwarf--check-running, dwarf--sentinel, dwarf--invoke) (dwarf--filter): New functions. (dwarf-do-insert-substructure, dwarf-do-refresh): Call dwarf--check-running, dwarf--invoke. (dwarf-browse): Initialize new variables.
* Set lexical-binding in dwarf-modeTom Tromey2017-10-102-1/+5
| | | | | | | | | Emacs has had lexical binding for a while, and it's a good practice to use it; so enable it in dwarf-mode.el. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el: Set lexical-binding.
* Bind keys in dwarf-mode-map definitionTom Tromey2017-10-102-2/+11
| | | | | | | | | | | It's bad Emacs style to define keys from a top-level form. Instead, one should define a mode map separately and binding keys in the definition. This lets users completely override the map by defining it before loading the mode. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el (dwarf-mode-map): New defvar.
* Eliminate catch_exceptions/catch_exceptions_with_msgPedro Alves2017-10-1017-426/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch gets rid of catch_exceptions / catch_exceptions_with_msg. The latter is done mostly by getting rid of the three remaining vestigial libgdb wrapper functions, which are really pointless nowadays. This results in a good number of simplifications. (I checked that Insight doesn't use those functions.) The gdb.mi/mi-pthreads.exp change is necessary because this actually fixes a bug, IMO -- the patch stops MI's -thread-select causing output on the CLI stream. I.e., before: -thread-select 123456789 &"Thread ID 123456789 not known.\n" ^error,msg="Thread ID 123456789 not known." (gdb) After: -thread-select 123456789 ^error,msg="Thread ID 123456789 not known." (gdb) gdb/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * breakpoint.c (struct captured_breakpoint_query_args) (do_captured_breakpoint_query, gdb_breakpoint_query): Delete. (print_breakpoint): New. * breakpoint.h (print_breakpoint): Declare. * common/common-exceptions.h (enum return_reason): Remove references to catch_exceptions. * exceptions.c (catch_exceptions, catch_exceptions_with_msg): Delete. * exceptions.h (catch_exceptions_ftype, catch_exceptions) (catch_exception_ftype, catch_exceptions_with_msg): Delete. * gdb.h: Delete. * gdbthread.h (thread_select): Declare. * mi/mi-cmd-break.c: Don't include gdb.h. (breakpoint_notify): Use print_breakpoint. * mi/mi-cmd-catch.c: Don't include gdb.h. * mi/mi-interp.c: Don't include gdb.h. (mi_print_breakpoint_for_event): New. (mi_breakpoint_created, mi_breakpoint_modified): Use mi_print_breakpoint_for_event. * mi/mi-main.c: Don't include gdb.h. (mi_cmd_thread_select): Parse the global thread ID here. Use thread_select instead of gdb_thread_select. (mi_cmd_thread_list_ids): Output "thread-ids" tuple here instead of using gdb_list_thread_ids. * remote-fileio.c (do_remote_fileio_request): Change type. Reply FILEIO_ENOSYS here. (remote_fileio_request): Use TRY/CATCH instead of catch_exceptions. * symfile-mem.c (struct symbol_file_add_from_memory_args) (symbol_file_add_from_memory_wrapper): Delete. (add_vsyscall_page): Use TRY/CATCH instead of catch_exceptions. * thread.c: Don't include gdb.h. (do_captured_list_thread_ids, gdb_list_thread_ids): Delete. (thread_alive): Use thread_select. (do_captured_thread_select): Delete, parts salvaged as ... (thread_select): ... this new function. (gdb_thread_select): Delete. gdb/testsuite/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> * gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Don't expect CLI output.
* Eliminate catch_errorsPedro Alves2017-10-1021-306/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you want to use catch_errors with a function with parameters, then currently you have to manually write a "capture" struct wrapping the arguments and marshall/unmarshall that. https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed adjusting catch_errors to use gdb::function_view, which would allow passing lambdas with automatic captures. However, it seems like using TRY/CATCH directly instead ends up producing clearer and easier to debug code. This is what this commit does. Note that removing catch_errors exposes further cleanup opportunities around no longer having to follow catch_errors callback type, and also removes a few cleanups. I didn't do anything to save/restore current_uiout because I think that should be the responsibility of the code that changes current_uiout in the first place. (Another approach could be to make catch_errors a variadic template like: template<typename Function, typename... Args> int catch_errors (const char *errstring, return_mask mask, Function &&func, Args... args); and then with: extern void function_with_args (int, int); extern void function_with_no_args (); calls to the above functions would be wrapped like this: catch_errors ("some error happened", RETURN_MASK_ERROR, function_with_args, arg1, arg2); catch_errors ("some error happened", RETURN_MASK_ERROR, function_with_no_args); but I'm thinking that that doesn't improve much if at all either.) gdb/ChangeLog 2017-10-10 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * breakpoint.c (breakpoint_cond_eval): Change return type to bool and reverse logic. (WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE): No longer macros. Instead ... (enum wp_check_result): They're now values of this new enumeration. (watchpoint_check): Change return type to wp_check_result and parameter type to bpstat. (bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors. (bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of catch_errors. Reverse logic of watchpoint_check call. (breakpoint_re_set_one): Now returns void and takes a breakpoint pointer as parameter. (breakpoint_re_set): Use TRY/CATCH instead of catch_errors. * common/common-exceptions.c (throw_exception_sjlj): Update comments to avoid mentioning catch_errors. * exceptions.c (catch_errors): Delete. * exceptions.h: Update comments to avoid mentioning catch_errors. (catch_errors_ftype, catch_errors): Delete. * infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors. (hook_stop_stub): Delete. (restore_selected_frame): Change return type to void, and parameter type to const frame_id &. (restore_infcall_control_state): Use TRY/CATCH instead of catch_errors. * main.c (captured_command_loop): Return void and remove parameter. Remove references to catch_errors. (captured_main): Use TRY/CATCH instead of catch_errors. * objc-lang.c (objc_submethod_helper_data) (find_objc_msgcall_submethod_helper): Delete. (find_objc_msgcall_submethod): Use TRY/CATCH instead of catch_errors. * record-full.c (record_full_message): Return void. (record_full_message_args, record_full_message_wrapper): Delete. (record_full_message_wrapper_safe): Return bool and use TRY/CATCH instead of catch_errors. * solib-aix.c (solib_aix_open_symbol_file_object): Change parameter type to int. * solib-darwin.c (open_symbol_file_object): Ditto. * solib-dsbt.c (open_symbol_file_object): Ditto. * solib-frv.c (open_symbol_file_object): Ditto. * solib-svr4.c (open_symbol_file_object): Ditto. * solib-target.c (solib_target_open_symbol_file_object): Ditto. * solib.c (update_solib_list): Use TRY/CATCH instead of catch_errors. * solist.h (struct target_so_ops) <open_symbol_file_object>: Change type. * symmisc.c (struct print_symbol_args): Remove. (dump_symtab_1): Use TRY/CATCH instead of catch_errors. (print_symbol): Change type. * windows-nat.c (handle_load_dll, handle_unload_dll): Return void and remove parameters. (catch_errors): New. (get_windows_debug_event): Adjust. gdb/testsuite/ChangeLog: 2017-10-10 Pedro Alves <palves@redhat.com> * lib/selftest-support.exp (selftest_setup): Update for captured_command_loop's prototype change.
* [ARM] PR ld/21402, only override the symbol dynamic decision on undefined ↵Renlin Li2017-10-106-21/+31
| | | | | | | | | | | | | | | | | | | | | weak symbol. Similar as aarch64 backend, arm backend only overrides the decision on undefined weak symbols. arm backend part already emits necessary relative relocation for this case. bfd/ PR ld/21402 * elf32-arm.c (allocate_dynrelocs_for_symbol): Only make undefined weak symbols into dynamic. ld/ PR ld/21402 * testsuite/ld-arm/tls-app.d: Update address. * testsuite/ld-arm/tls-app.r: Remove relocations. * testsuite/ld-arm/unresolved-1-dyn.d: Update.
* Improve the speed of the --dwarf-start option by skipping processing of any ↵Nick Clifton2017-10-102-0/+14
| | | | | | | | comp unit that ends before the specified start address. PR 22249 * dwarf.c (process_debug_info): Skip any comp unit that ends before dwarf_start_die.
* riscv: Cache the max alignment of output sectionsH.J. Lu2017-10-092-1/+24
| | | | | | | | | | | | | Cache the max alignment of output sections instead of scanning all output sections for each input section, which can take a very long time if there are millions of input/output sections. PR ld/22274 * elfnn-riscv.c (riscv_elf_link_hash_table): Add max_alignment. (riscv_elf_link_hash_table_create): Initialize max_alignment to (bfd_vma) -1. (_bfd_riscv_relax_section): Cache the max alignment of output sections if possible.
* Prepare powerpc64 for late check_relocsAlan Modra2017-10-102-59/+90
| | | | | | | | | | | | | | | | check_relocs was setting up some data used by the --gc-sections gc_mark_hook. If we change ld to run check_relocs after gc_sections that data needs to be set up elsewhere. Done by this patch in the backend check_directives function (ppc64_elf_before_check_relocs). * elf64-ppc.c (ppc64_elf_before_check_relocs): Set sec_type for .opd whenever .opd is present and non-zero size. Move code setting abiversion to/from output file earlier. Only set u.opd.func_sec when --gc-sections. Read relocs and set up u.opd.func_sec values here.. (ppc64_elf_check_relocs): ..rather than here. Simplify opd section tests. (ppc64_elf_edit_opd): Don't set sec_type for .opd here.
* Correct ld/Makefile earmelfb_fuchsia dependenciesAlan Modra2017-10-103-2/+7
| | | | | | | There were two copies of earmelf_fuchsia.c dependencies. * Makefile.am (earmelfb_fuchsia.c): Rename rule from earmelf_fuchsia.c. * Makefile.in: Regenerate.
* Automatic date update in version.inGDB Administrator2017-10-101-1/+1
|
* Remove free_splay_tree cleanupTom Tromey2017-10-093-16/+56
| | | | | | | | | | | | One spot in gdb uses a cleanup to free a splay tree. This patch introduces a unique_ptr specialization for this case. ChangeLog 2017-10-09 Tom Tromey <tom@tromey.com> * mi/mi-main.c (free_splay_tree): Remove. (list_available_thread_groups): Use splay_tree_up. * common/gdb_splay_tree.h: New file.
* Remove "do_nothing"Tom Tromey2017-10-092-6/+6
| | | | | | | | | | | | The do_nothing function in mi-main.c is used as a splay tree key-deleting function; but NULL serves the same purpose and is used elsewhere in gdb. This patch removes the unneeded function. ChangeLog 2017-10-09 Tom Tromey <tom@tromey.com> * mi/mi-main.c (do_nothing): Remove. (list_available_thread_groups): Update.
* mn10300: Don't free cached internal symbol tableH.J. Lu2017-10-092-1/+6
| | | | | | | | Since ELF linker may cache internal symbol table in init_reloc_cookie, we should check if it is cached, before free it. * elf-m10300.c (mn10300_elf_check_relocs): Don't free cached isymbuf.
* bfin: Don't create .interp section for info->nointerpH.J. Lu2017-10-092-1/+6
| | | | | | | | | | | | Don't create the .interp section with "ld --no-dynamic-linker". This fixed: FAIL: PR ld/20828 forcibly exported symbol version without section GC FAIL: PR ld/20828 forcibly exported symbol version with section GC FAIL: readelf version information * elf32-bfin.c (bfin_size_dynamic_sections): Don't create the .interp section with "ld --no-dynamic-linker".