aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-10-16ELF: Call check_relocs after opening all inputsH.J. Lu97-3644/+277
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): Likewise. 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.
2017-10-16Regenerate gdbserver/configureYao Qi2-3/+14
4fa7574 (Fix gdb 8.1 Solaris compilation) changes warning.m4 and updates configure, but gdbserver/configure is not updated. gdb/gdbserver: 2017-10-16 Yao Qi <yao.qi@linaro.org> * configure: Regenerated.
2017-10-16Remove features/tic6x-*.c filesYao Qi9-443/+14
features/*.c are generated from *.xml files, in order to get pre-defined target descriptions, (for native debugging, for example). However, these pre-generated tdesc_tic6x_* are not used in GDB at all. This patch removes features/tic6x-*.c files. gdb: 2017-10-16 Yao Qi <yao.qi@linaro.org> * features/Makefile (XMLTOC): Remove tic6x-*.xml. * features/tic6x-c62x.c: Remove. * features/tic6x-c64x-linux.c: Remove. * features/tic6x-c64x.c: Remove. * features/tic6x-c64xp-linux.c: Remove. * features/tic6x-c64xp.c: Remove. * tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Don't call initialize_tdesc_tic6x_*_linux functions. * tic6x-tdep.c (_initialize_tic6x_tdep): Don't call initialize_tdesc_tic6x_* functions.
2017-10-16Remove regformats/tic6x-{c62x,c64x,c64xp}.datYao Qi5-185/+8
tic6x-uclinux GDBserver uses linux target descriptions, instead of these non-linux target descriptions. So we can remove these *.dat files. gdb: 2017-10-16 Yao Qi <yao.qi@linaro.org> * features/Makefile (WHICH): Remove tic6x-c64xp, tic6x-c64x tic6x-c62x. * regformats/tic6x-c62x.dat: Remove. * regformats/tic6x-c64x.dat: Remove. * regformats/tic6x-c64xp.dat: Remove.
2017-10-15Fix GDB build without expatSimon Marchi2-1/+6
An earlier patch of mine changed parse_traceframe_info to make it return a unique_ptr. I forgot to update the version of the function used in an expat-less build, this patch fixes it. gdb/ChangeLog: * tracepoint.c (parse_traceframe_info): Return a unique_ptr (the !HAVE_LIBEXPAT version).
2017-10-16Automatic date update in version.inGDB Administrator1-1/+1
2017-10-15Automatic date update in version.inGDB Administrator1-1/+1
2017-10-14x86: Add elf_x86_backend_dataH.J. Lu5-88/+104
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-14x86: Add _bfd_x86_elf_finish_dynamic_sectionsH.J. Lu5-487/+376
Extract the common parts of elf_i386_finish_dynamic_sections and elf_x86_64_finish_dynamic_sections into a separate function in elfxx-x86.c. * elf32-i386.c (elf_i386_finish_dynamic_sections): Call _bfd_x86_elf_finish_dynamic_sections. * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Likewise. * elfxx-x86.c (_bfd_x86_elf_finish_dynamic_sections): New function. * elfxx-x86.h (_bfd_x86_elf_finish_dynamic_sections): New prototype.
2017-10-14cris: Don't hide symbol which was forced to be dynamicH.J. Lu2-0/+7
h->root.dynamic is set on symbols which were forced to be dynamic due to a version script file. Don't remove such symbols from dynamic symbol table. This fixes: FAIL: ld-elf/pr21384 PR ld/21384 * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Don't hide symbol which was forced to be dynamic.
2017-10-14cris: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu4-11/+28
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. bfd/ PR ld/22269 * elf32-cris.c (cris_elf_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (cris_elf_check_relocs): Don't allocate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. ld/ PR ld/22269 * testsuite/ld-cris/weakhiddso.d: Update and remove R_CRIS_NONE.
2017-10-14sh: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-4/+17
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elf32-sh.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (sh_elf_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14s390: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu3-4/+28
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elf32-s390.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (elf_s390_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. * elf64-s390.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (elf_s390_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14nios2: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-4/+20
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elf32-nios2.c (nios2_elf32_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14microblaze: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-2/+19
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elf32-microblaze.c (microblaze_elf_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14m68k: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-4/+23
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elf32-m68k.c (elf_m68k_check_relocs): Don't allocate dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (elf_m68k_adjust_dynamic_symbol): Don't make symbol dynamic if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (elf_m68k_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14hppa: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-2/+19
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elf32-hppa.c (ensure_undef_dynamic): Don't make undefined symbol dynamic if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (elf32_hppa_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14ia64: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-5/+31
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elfnn-ia64.c (elfNN_ia64_check_relocs): Don't allocate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (allocate_fptr): Don't allocate function pointer if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (allocate_dynrel_entries): Don't allocate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (set_got_entry): Don't set GOT entry if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (set_pltoff_entry): Don't set PLTOFF entry if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (elfNN_ia64_relocate_section): Don't install dynamic relocation UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14mips: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-2/+17
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elfxx-mips.c (mips_elf_calculate_relocation): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (allocate_dynrelocs): Don't allocate dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14arm: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-3/+18
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC 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 UNDEFWEAK_NO_DYNAMIC_RELOC is true. (allocate_dynrelocs_for_symbol): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14tile: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu3-6/+28
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elf32-tilepro.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (tilepro_elf_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. * elfxx-tilegx.c (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (tilegx_elf_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14aarch64: Check UNDEFWEAK_NO_DYNAMIC_RELOCH.J. Lu2-2/+17
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC 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 UNDEFWEAK_NO_DYNAMIC_RELOC is true. (elfNN_aarch64_allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
2017-10-14Move UNDEFWEAK_NO_DYNAMIC_RELOC to elf-bfd.hH.J. Lu4-14/+13
Move UNDEFWEAK_NO_DYNAMIC_RELOC to elf-bfd.h so that it can be used by other ELF linker backends. * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Moved to ... * elf-bfd.h (UNDEFWEAK_NO_DYNAMIC_RELOC): Here. * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Removed.
2017-10-14Fix build failure in linux-osdata.cSimon Marchi2-1/+6
Commit Use std::vector in linux_xfer_osdata_processgroups b129dcac882da87767cb863ad8b2572f90e9e5bc broke the build with older gcc (at least 4.7 and 4.8): In file included from /usr/include/c++/4.7/algorithm:63:0, from /home/emaisin/src/binutils-gdb/gdb/nat/linux-osdata.c:40: /usr/include/c++/4.7/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pid_pgid_entry*, std::vector<pid_pgid_entry> >; _Tp = pid_pgid_entry]’: /usr/include/c++/4.7/bits/stl_algo.h:2315:70: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pid_pgid_entry*, std::vector<pid_pgid_entry> >]’ /usr/include/c++/4.7/bits/stl_algo.h:2347:54: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pid_pgid_entry*, std::vector<pid_pgid_entry> >; _Size = long int]’ /usr/include/c++/4.7/bits/stl_algo.h:5483:4: required from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<pid_pgid_entry*, std::vector<pid_pgid_entry> >]’ /home/emaisin/src/binutils-gdb/gdb/nat/linux-osdata.c:480:57: required from here /usr/include/c++/4.7/bits/stl_algo.h:2277:4: error: passing ‘const pid_pgid_entry’ as ‘this’ argument of ‘bool pid_pgid_entry::operator<(const pid_pgid_entry&)’ discards qualifiers [-fpermissive] Making the operator< method const fixes it. gdb/ChangeLog: * nat/linux-osdata.c (struct pid_pgid_entry) <operator<>: Make const.
2017-10-14gdbserver: use std::list for all_threadsSimon Marchi15-454/+345
Remove the usage of inferior_list for the all_threads list in gdbserver. The entry field in thread_info is removed, and replaced by a simple ptid field. I added some functions to iterate (for_each_thread) and find threads (find_thread). However, changing all the users of find_inferior & co to use these new functions would have made the patch way too big. So I opted instead to make find_inferior & co some shims, so that the existing code only needs to be updated minimally. We can then update the existing code to use the new functions incrementally (I've started to do the work, but I'll post it afterwards, see [1] if you want a peek). This patch has been built-tested on all relevant platforms, except lynx. I also regtested using the native-gdbserver and native-extended-gdbserver boards on x86. [1] https://github.com/simark/binutils-gdb/commits/kill-inferior-list-entry gdb/gdbserver/ChangeLog: * inferiors.h: (struct inferior_list): Remove. (struct inferior_list_entry); Remove. (add_inferior_to_list, clear_inferior_list, one_inferior_p, A_I_NEXT, ALL_INFERIORS_TYPE, ALL_INFERIORS, remove_inferior, get_first_inferior): Remove. (for_each_inferior, for_each_inferior_with_data, find_inferior, find_inferior_id, find_inferior_in_random): Change signature. * inferiors.c (all_threads): Change type to std::list<thread_info *>. (get_thread): Remove macro. (find_inferior, find_inferior_id): Change signature, implement using find_thread. (find_inferior_in_random): Change signature, implement using find_thread_in_random. (for_each_inferior, for_each_inferior_with_data): Change signature, implement using for_each_thread. (add_inferior_to_list, remove_inferior): Remove. (add_thread, get_first_thread, thread_of_pid, find_any_thread_of_pid, free_one_thread, remove_thread): Update. (get_first_inferior, one_inferior_p, clear_inferior_list): Remove. (clear_inferiors, get_thread_process): Update. * gdbthread.h: Include <list>. (struct thread_info) <entry>: Remove field. <id>: New field. (all_threads): Change type to std::list<thread_info *>. (get_first_inferior): Add doc. (find_thread, for_each_thread, find_thread_in_random): New functions. (current_ptid, pid_of, ptid_of, lwpid_of): Update. * linux-arm-low.c (update_registers_callback): Update. * linux-low.c (second_thread_of_pid_p): Update. (kill_one_lwp_callback, linux_detach_lwp_callback, delete_lwp_callback, status_pending_p_callback, same_lwp, find_lwp_pid, num_lwps, iterate_over_lwps_filter, iterate_over_lwps, not_stopped_callback, resume_stopped_resumed_lwps, count_events_callback, select_singlestep_lwp_callback, select_event_lwp_callback, unsuspend_one_lwp, linux_wait_1, send_sigstop_callback, suspend_and_send_sigstop_callback, wait_for_sigstop, stuck_in_jump_pad_callback, move_out_of_jump_pad_callback, lwp_running, linux_set_resume_request, resume_status_pending_p, need_step_over_p, start_step_over, linux_resume_one_thread, proceed_one_lwp, unsuspend_and_proceed_one_lwp, reset_lwp_ptrace_options_callback): Update. * linux-mips-low.c (update_watch_registers_callback): Update. * regcache.c (regcache_invalidate_one, regcache_invalidate): Update. (free_register_cache_thread_one): Remove. (regcache_release): Update. * server.c (handle_btrace_enable_bts, handle_btrace_enable_pt, handle_qxfer_threads_worker): Update. (handle_query): Update, use list iterator. (visit_actioned_threads, handle_pending_status, queue_stop_reply_callback, gdb_wants_all_threads_stopped, clear_pending_status_callback, set_pending_status_callback, find_status_pending_thread_callback, handle_status, process_serial_event): Update. * target.c (thread_search_callback): Update. * thread-db.c (thread_db_get_tls_address): Update. * tracepoint.c (tracepoint_finished_step, tracepoint_was_hit): Update. * win32-i386-low.c (update_debug_registers_callback): Update. * win32-low.c (delete_thread_info, child_delete_thread, continue_one_thread, suspend_one_thread, get_child_debug_event): Adjust.
2017-10-14gdbserver: Use std::list for all_processesSimon Marchi8-190/+225
Remove the usage of inferior_list for the all_processes list in gdbserver, replace it with an std::list. The entry field in process_info is removed, and replaced by a simple pid field. The pid_of macro, used for both processes and threads, is replaced with separate functions. For completeness, I changed ptid_of and lwpid_of to functions as well. gdb/gdbserver/ChangeLog: * gdbthread.h (ptid_of, pid_of, lwpid_of): New functions. * inferiors.h: Include <list>. (struct process_info) <entry>: Remove field. <pid>: New field. (pid_of): Change macro to function. (ptid_of, lwpid_of): Remove macro. (all_processes): Change type to std::list<process_info *>. (ALL_PROCESSES): Remove macro. (for_each_process, find_process): New function. * inferiors.c (all_processes): Change type to std::list<process_info *>. (find_thread_process): Adjust. (add_process): Likewise. (remove_process): Likewise. (find_process_pid): Likewise. (get_first_process): Likewise. (started_inferior_callback): Remove. (have_started_inferiors_p): Adjust. (attached_inferior_callback): Remove. (have_attached_inferiors_p): Adjust. * linux-low.c (check_zombie_leaders): Likewise. * linux-x86-low.c (x86_arch_setup_process_callback): Remove. (x86_linux_update_xmltarget): Adjust. * server.c (handle_query): Likewise. (gdb_reattached_process): Remove. (handle_status): Adjust. (kill_inferior_callback): Likewise. (detach_or_kill_inferior): Remove. (print_started_pid): Likewise. (print_attached_pid): Likewise. (detach_or_kill_for_exit): Update. (process_serial_event): Likewise. * linux-arm-low.c (arm_new_fork): Likewise.
2017-10-14gdbserver: Use std::list for all_dllsSimon Marchi4-71/+47
As a small step towards removing inferior_list/inferior_list_entry, this patch replaces the usage of inferior_list for the list of dlls by an std::list. The dll_info type now uses an std::string for name and has a simple constructor. I am able to build gdbserver with mingw on Linux, but I am not able to test this on a Windows machine (the only platform that uses this code). gdb/gdbserver/ChangeLog: * dll.h: Include <list>. (struct dll_info): Add constructor. <entry>: Remove field. (all_dlls): Change type to std::list<dll_info>. * dll.c: Include <algorithm>. (get_dll): Remove macro. (all_dlls): Change type to std::list<dll_info *>. (free_one_dll): Remove. (match_dll): Likewise. (loaded_dll): Adjust. (unloaded_dll): Adjust to all_dlls type change, use std::find_if. Inline code from match_dll. (clear_dlls): Adjust to all_dlls type change. * server.c (emit_dll_description): Remove. (handle_qxfer_libraries): Adjust to all_dlls type change, integrate emit_dll_description's functionality.
2017-10-14Make to_traceframe_info return a unique_ptrSimon Marchi9-63/+63
Since this target method returns an allocated object, return a unique_ptr. It allows getting rid a some cleanups here and there. I had to shuffle the includes around. First, target.h now needs to include tracepoint.h, to get the definition of traceframe_info_up. However, the definition of enum trace_find_type was later in target, so I had to move it to tracepoint.h, so that the declaration of tfind_1 could know about it. I then had to remove the include of target.h from tracepoint.h, which caused a circular dependency (it was probably included to get enum trace_find_type in the first place anyway). Regression tested on the buildbot. gdb/ChangeLog: * target.h: Include tracepoint.h. (enum trace_find_type): Move to tracepoint.h. (struct target_ops) <to_traceframe_info>: Return a unique ptr. * tracepoint.h: Don't include target.h (enum trace_find_type): Move from target.h. (parse_traceframe_info): Return a unique ptr. * tracepoint.c (current_traceframe_info): Change type to unique ptr. (free_traceframe_info): Remove. (clear_traceframe_info): Don't manually free current_traceframe_info. (free_result): Remove. (parse_traceframe_info): Return a unique ptr. (get_traceframe_info): Adjust to unique ptr. * ctf.c (ctf_traceframe_info): Return a unique ptr. * remote.c (remote_traceframe_info): Return a unique ptr. * tracefile-tfile.c (tfile_traceframe_info): Return a unique ptr. * target-debug.h (target_debug_print_traceframe_info_up): New macro. * target-delegates.c: Regenerate.
2017-10-14Use std::vector for traceframe_info::memorySimon Marchi6-26/+30
Straightforward change from a VEC to std::vector. This allows making the destruction of a traceframe_info trivial. I added a constructor with parameters to mem_range to be able to emplace_back directly with the values. It is necessary to leave a default constructor there because mem_range is still used in a VEC. gdb/ChangeLog: * memrange.h (struct mem_range): Add constructors. * tracepoint.h (struct traceframe_info) <memory>: Change type to std::vector<mem_range>. * tracepoint.c (free_traceframe_info): Don't manually free vector. (traceframe_info_start_memory): Adjust to vector change. (traceframe_available_memory): Likewise. * tracefile-tfile.c (build_traceframe_info): Likewise. * ctf.c (ctf_traceframe_info): Likewise.
2017-10-14Use std::vector for traceframe_info::tvarsSimon Marchi6-15/+25
Straightforward change to get rid of a VEC. We need to new/delete traceframe_info instead of malloc/free it. I found three places that allocate a traceframe_info (ctf_traceframe_info, tfile_traceframe_info and parse_traceframe_info) and only one that frees it (free_traceframe_info). gdb/ChangeLog: * tracepoint.h (struct traceframe_info) <tvars>: Change type to std::vector<int>. * tracepoint.c (free_traceframe_info): Deallocate with delete. (traceframe_info_start_tvar): Adjust to vector change. (parse_traceframe_info): Allocate with new. * ctf.c (ctf_traceframe_info): Allocate with new, adjust to vector change. * tracefile-tfile.c (build_traceframe_info): Adjust to vector change. tfile_traceframe_info): Allocate with new. * mi/mi-main.c (mi_cmd_trace_frame_collected): Adjust to vector change.
2017-10-14Rename traceframe_info variable to current_traceframe_infoSimon Marchi2-6/+13
... so it doesn't shadow the traceframe_info type. It think it's a clearer name anyway. gdb/ChangeLog: * tracepoint.c (traceframe_info): Rename to... (current_traceframe_info): ...this. (clear_traceframe_info): Adjust. (get_traceframe_info): Adjust.
2017-10-14Use std::vector in linux_xfer_osdata_processgroupsSimon Marchi2-56/+48
This simplifies the code quite a bit, by removing the array of PID_T that's actually an array of pairs of PID_T. This code is only used to implement "info os procgroups". I tested by hand as well as by running gdb.base/info-os.exp for unix, native-gdbserver and native-extended-gdbserver. gdb/ChangeLog: * nat/linux-osdata.c: Include algorithm. (compare_processes): Remove. (struct pid_pgid_entry): New struct. (linux_xfer_osdata_processgroups): Use std::vector instead of XNEWVEC.
2017-10-14Replace psymbol_allocation_list with std::vectorSimon Marchi11-217/+162
psymbol_allocation_list is basically a vector implementation. We can replace it with an std::vector, now that objfile has been C++-ified. I sent this to the buildbot, there are a few suspicious failures, but I don't think they are related to this patch. For example on powerpc: new FAIL: gdb.base/catch-syscall.exp: execve: syscall execve has returned new FAIL: gdb.base/catch-syscall.exp: execve: continue to main new FAIL: gdb.base/catch-syscall.exp: execve: continue until exit I get the same failures when testing manually on gcc112, without this patch. gdb/ChangeLog: * objfiles.h: Don't include symfile.h. (struct partial_symbol): Remove forward-declaration. (struct objfile) <global_psymbols, static_psymbols>: Change type to std::vector<partial_symbol *>. * objfiles.c (objfile::objfile): Don't memset those fields. (objfile::~objfile): Don't free those fields. * psympriv.h (struct psymbol_allocation_list): Remove forward-declaration. (add_psymbol_to_list): Change psymbol_allocation_list parameter to std::vector. (start_psymtab_common): Change parameters to std::vector. * psymtab.c: Include algorithm. (require_partial_symbols): Call shrink_to_fit. (find_pc_sect_psymbol): Adjust to vector change. (match_partial_symbol): Likewise. (lookup_partial_symbol): Likewise. (psym_relocate): Likewise. (dump_psymtab): Likewise. (recursively_search_psymtabs): Likewise. (compare_psymbols): Remove. (sort_pst_symbols): Adjust to vector change. (start_psymtab_common): Likewise. (end_psymtab_common): Likewise. (psymbol_bcache_full): De-constify return value. (add_psymbol_to_bcache): Likewise. (extend_psymbol_list): Remove. (append_psymbol_to_list): Adjust to vector change. (add_psymbol_to_list): Likewise. (init_psymbol_list): Likewise. (maintenance_info_psymtabs): Likewise. (maintenance_check_psymtabs): Likewise. * symfile.h (struct psymbol_allocation_list): Remove. * symfile.c (reread_symbols): Adjust to vector change. * dbxread.c (start_psymtab): Change type of parameters. (dbx_symfile_read): Adjust to vector change. (read_dbx_symtab): Likewise. (start_psymtab): Change type of parameters. * dwarf2read.c (dwarf2_build_psymtabs): Adjust to vector change. (create_partial_symtab): Likewise. (add_partial_symbol): Likewise. (write_one_signatured_type): Likewise. (recursively_write_psymbols): Likewise. * mdebugread.c (parse_partial_symbols): Likewise. * xcoffread.c (xcoff_start_psymtab): Change type of parameters. (scan_xcoff_symtab): Adjust to vector change. (xcoff_initial_scan): Likewise.
2017-10-13ada: Use std::string in print_dynamic_range_boundSimon Marchi2-7/+7
Replace this usage of GROW_VECT with an std::string. I don't think there's a reason for this variable to be static, other than it was cumbersome to manage its lifetime (i.e. use a cleanup) before. Tested by comparing the gdb.ada/*.exp test results before and after the patch. gdb/ChangeLog: * ada-typeprint.c (print_dynamic_range_bound): Use std::string.
2017-10-14Automatic date update in version.inGDB Administrator1-1/+1
2017-10-13Skip a few tests on targets that can't use the "run" commmand.Pedro Alves7-21/+35
These tests want to use raw "run", so skip them on targets that can't do that. Also adds a small utility procedure that clearly conveys intent instead of explicitly checking use_gdb_stub in the testcases. This makes sure these testcases continue to be skipped with --target_board=native-gdbserver once that board stops setting is_remote. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * lib/gdb.exp (target_can_use_run_cmd): New procedure. * gdb.base/annota1.exp: Use it instead of is_remote. * gdb.base/annota3.exp: Use it instead of is_remote. * gdb.cp/annota2.exp: Use it instead of is_remote. * gdb.cp/annota3.exp: Use it instead of is_remote. * gdb.multi/bkpt-multi-exec.exp: Use it instead of is_remote.
2017-10-13Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserverPedro Alves2-68/+138
Currently we get: Running ..../src/gdb/testsuite/gdb.base/testenv.exp ... FAIL: gdb.base/testenv.exp: test no TEST_GDB var FAIL: gdb.base/testenv.exp: test with one TEST_GDB var FAIL: gdb.base/testenv.exp: test with two TEST_GDB var FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset The problem is that the testcase relies on stdio. While we could fix this for gdbserver by read output from inferior_spawn_id, a better fix it to not rely on stdio at all. That's what this commit does. Instead, it reads variables off of the inferior to extract the necessary information. Along the way, most of the .exp file is reimplemented/cleaned up using more modern mechanisms. E.g., with_test_prefix, proc_with_prefix, save_vars, etc. Also, a missing check for "is_remote host" is added. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote. (test_num_test_vars, run_and_count_vars, find_env) (test_set_unset_env, test_inherit_env_var): New procedures. (top level): Use them.
2017-10-13Don't run gdb.gdb/ selftests if use_gdb_stub is truePedro Alves2-2/+22
If we make the native-gdbserver board be !is_remote, then the few tests that use the selftest-support.exp routines to debug gdb itself start running, and fail, with something like: Running ..../src/gdb/testsuite/gdb.gdb/selftest.exp ... ERROR: tcl error sourcing ..../src/gdb/testsuite/gdb.gdb/selftest.exp. ERROR: gdbserver does not support run [....] without extended-remote while executing "error "gdbserver does not support $command without extended-remote"" (procedure "gdb_test_multiple" line 25) invoked from within "gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" { -re "Starting program.*Breakpoint \[0-9\]+,.*$function \\(\\).* at .*main.c:.*$gdb..." (procedure "selftest_setup" line 45) This commit makes sure those tests continue to be skipped. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * lib/selftest-support.exp (selftest_setup): Extend comments, and also skip on stub-like targets.
2017-10-13Make gdb.base/find-unmapped.exp pass on remote targetsPedro Alves2-13/+61
Currently, with --target_board=native-extended-gdbserver, we get: Running .../src/gdb/testsuite/gdb.base/find-unmapped.exp ... FAIL: gdb.base/find-unmapped.exp: find global_var_0, global_var_2, 0xff FAIL: gdb.base/find-unmapped.exp: find global_var_1, global_var_2, 0xff FAIL: gdb.base/find-unmapped.exp: find global_var_2, (global_var_2 + 16), 0xff This commit makes the test pass there, and also enables in on --target_board=native-gdbserver, and other remote targets. I've filed PR gdb/22293 to track the missing-warning problem. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> PR gdb/22293 * gdb.base/find-unmapped.exp: Don't skip if is_remote target. (top level): Move some tests to ... (test_not_found): ... this new procedure. (top level): Call it.
2017-10-13Simplify tic6x and s390x expedite registersYao Qi2-13/+7
Nowadays, we have six tic6x expedite registers, which are duplicated. tic6x-c64xp-expedite = A15,PC tic6x-c64x-expedite = A15,PC tic6x-c62x-expedite = A15,PC tic6x-c64xp-linux-expedite = A15,PC tic6x-c64x-linux-expedite = A15,PC tic6x-c62x-linux-expedite = A15,PC in features/Makefile, we have echo "expedite:$(if $($*-expedite),$($*-expedite),$($(firstword $(subst -, ,$(notdir $*)))-expedite))" \ >> $(outdir)/$*.tmp which means for a given bar/foo-baz.xml, we'll look for either bar/foo-baz-expedite or foo-expedite. We can define only one generic expedite register for all different ti6cx and s390x target descriptions. Actually, we've done that for x86 target descriptions. Re-run 'make GDB=/path/build/gdb all' to regenerate regformats/*.dat files, and they are not changed. gdb: 2017-10-13 Yao Qi <yao.qi@linaro.org> * features/Makefile: Remove tic6x-*-expedite, add tic6x-expedite. Remove s390x-*-expedite, add s390x-expedite.
2017-10-13Regenerate features/s390-gs-linux64.c and features/s390x-gs-linux64.cYao Qi3-8/+13
gdb: 2017-10-13 Yao Qi <yao.qi@linaro.org> * features/s390-gs-linux64.c: Regenerated. * features/s390x-gs-linux64.c: Regenerated.
2017-10-14PR22263 testcaseAlan Modra3-3/+12
A number of targets need dynamic relocs in PIEs for reasons other than relocating thread variables. The PR is about text relocations, and, reading between the lines, unnecessary dynamic tprel relocations. Change the test to check for those conditions rather than no dynamic relocations PR ld/22263 * testsuite/ld-elf/tls.exp: Link with -z text. * testsuite/ld-elf/pr22263-1.rd: Test for tprel relocs.
2017-10-13Change objfile to use new/deleteTom Tromey7-131/+131
This changes objfiles to use new and delete rather than xmalloc and free. Simon noticed that it uses a non-POD and so shouldn't be allocated with XCNEW; and I wanted to be able to use another non-POD as a member; this patch is the result. Regression tested by the buildbot. 2017-10-13 Tom Tromey <tom@tromey.com> * compile/compile-object-run.c (do_module_cleanup): Use delete. * solib.c (update_solib_list, reload_shared_libraries_1): Use delete. * symfile.c (symbol_file_add_with_addrs): Use new. (symbol_file_add_separate): Update comment. (syms_from_objfile_1, remove_symbol_file_command): Use delete. * jit.c (jit_object_close_impl): Use new. (jit_unregister_code): Use delete. * objfiles.c (objfile::objfile): Rename from allocate_objfile. (~objfile): Rename from free_objfile. (free_objfile_separate_debug, do_free_objfile_cleanup) (free_all_objfiles, objfile_purge_solibs): Use delete. * objfiles.h (struct objfile): Add constructor and destructor. Use DISABLE_COPY_AND_ASSIGN. Add initializers to data members. (allocate_objfile, free_objfile): Don't declare. (struct objstats): Add initializers.
2017-10-13Fix gdb.base/term.exp on non-"target native" boardsPedro Alves2-8/+16
With --target_board=native-extended-gdbserver, we get: Running .../src/gdb/testsuite/gdb.base/term.exp ... FAIL: gdb.base/term.exp: info terminal at breakpoint (gdb) info terminal No saved terminal information. Fix it by running the test everywhere, and expecting different output on non-native targets. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * gdb.base/term.exp: Don't skip if is_remote target. Instead, expect different "info terminal" output if testing with a non-native target.
2017-10-13Remove is_remote kfail from gdb.python/py-evthreads.expPedro Alves2-6/+6
This testcase works fine with gdbserver nowadays. So remove the kfail. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> Simon Marchi <simon.marchi@polymtl.ca> PR python/12966 * gdb.python/py-evthreads.exp: Remove is_remote target kfail.
2017-10-13Fix gdb.python/py-evthreads.exp with --target_board=native-extended-gdbserverPedro Alves2-2/+10
Fixes: Running ..../src/gdb/testsuite/gdb.python/py-evthreads.exp ... FAIL: gdb.python/py-evthreads.exp: run to breakpoint 1 FAIL: gdb.python/py-evthreads.exp: reached breakpoint 2 FAIL: gdb.python/py-evthreads.exp: thread 2 FAIL: gdb.python/py-evthreads.exp: reached breakpoint 3 FAIL: gdb.python/py-evthreads.exp: thread 3 FAIL: gdb.python/py-evthreads.exp: continue thread 1 [... cascading time outs ...] By following the usual pattern that makes sure that non-stop is enabled before connecting to gdbserver. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * gdb.python/py-evthreads.exp: Start GDB with "set non-stop on" already.
2017-10-13kfail gdb.python/py-evsignal.exp on RSP targets properlyPedro Alves2-1/+7
Fixes, with --target_board=native-extended-gdbserver: Running ..../src/gdb/testsuite/gdb.python/py-evsignal.exp ... FAIL: gdb.python/py-evsignal.exp: signal Thread 3 gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * gdb.python/py-evsignal.exp: Check gdb_protocol instead of is_remote.
2017-10-13Skip gdb.threads/thread_events.exp on RSP targets properlyPedro Alves2-3/+9
Fixes, with --target_board=native-extended-gdbserver: Running ..../src/gdb/testsuite/gdb.threads/thread_events.exp ... FAIL: gdb.threads/thread_events.exp: continue to after_join_func with messages enabled (saw 0, expected 1) gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * gdb.threads/thread_events.exp: Check gdb_protocol instead of is_remote.
2017-10-13Tweak gdb.base/corefile.exp is_remote checkPedro Alves2-1/+26
1. Otherwise, when we make native-gdbserver board no longer is_remote, we get: Running .../src/gdb/testsuite/gdb.base/corefile.exp ... ERROR: tcl error sourcing .../src/gdb/testsuite/gdb.base/corefile.exp. ERROR: gdbserver does not support attach 9327 without extended-remote while executing "error "gdbserver does not support $command without extended-remote"" That's fixed by using can_spawn_for_attach instead. 2. The gdb_protocol check fixes this current problem with --target_board=extended-remote-gdbserver: Running .../src/gdb/testsuite/gdb.base/corefile.exp ... FAIL: gdb.base/corefile.exp: run: with core FAIL: gdb.base/corefile.exp: run: core file is cleared FAIL: gdb.base/corefile.exp: attach: with core FAIL: gdb.base/corefile.exp: attach: core file is cleared gdb.log: (...) attach 10859 Don't know how to attach. Try "help target". (...) The fix for #2 alone would fix #1 too, but can_spawn_for_attach expresses the requirement directly, so I still left it there. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * gdb.base/corefile.exp (corefile_test_run): Skip if gdb_protocol is set. (corefile_test_attach): Likewise. Check can_spawn_for_attach instead of is_remote.
2017-10-13Fix is_remote check in gdb.base/remote.expPedro Alves2-4/+12
1. Otherwise, when the native-gdbserver board stops setting is_remote, this test would stop running there. 2. Makes the test run with --target_board=native-extended-gdbserver too. gdb/testsuite/ChangeLog: 2017-10-13 Pedro Alves <palves@redhat.com> * gdb.base/remote.exp: Check gdb_protocol instead of is_remote. (top level): Add comment.