Commit Graph

90982 Commits

Author SHA1 Message Date
Nick Clifton 0bae9e9ec5 Fix compile time warnings building the binutils with gcc 7.1.1.
bfd	* elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
	plt_name buffer.
	(elf_xtensa_get_gotplt_section): Increase length of got_name
	buffer.
	* mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
	default return of FALSE.
	* mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
	default return of FALSE.

binutils * dwarf.c (dwarf_vmatoa_1): Do not pass a NULL string pointer to
	sprintf.
	* srconv.c (walk_tree_type): Initialise the spare field of the
	IT_dty structure.

gas	* config/tc-pru.c (md_assemble): Add continue statement after
	handling 'E' operand character.
	* config/tc-v850.c (md_assemble): Initialise the 'insn' variable.
2017-07-12 12:17:02 +01:00
Alan Modra 2fe40b6792 rs6000 testsuite update
* testsuite/ld-scripts/align.exp: Exclude powerpc*-*-aix*.
	* testsuite/ld-scripts/assign-loc.d: Likewise.
	* testsuite/ld-scripts/defined3.d: Likewise.
	* testsuite/ld-scripts/defined4.d: Likewise.
	* testsuite/ld-scripts/defined5.d: Likewise.
	* testsuite/ld-scripts/expr2.d: Likewise.
	* testsuite/ld-scripts/provide.exp: Likewise.
	* testsuite/ld-scripts/sane1.d: Likewise.
	* testsuite/ld-scripts/size.exp: Likewise.
	* testsuite/ld-scripts/defined2.d: Don't xfail rs6000-*-aix*.
2017-07-12 19:31:26 +09:30
Alan Modra d42c267e9b bfd_error_handler bfd_vma and bfd_size_type args
This patch uses the new %L _bfd_error_handler support for printing
bfd_vma arguments, and fixes a many other format and/or argument
errors in error messages.

bfd/
	* binary.c (binary_set_section_contents): Don't print filepos in
	error message.
	(coff_write_object_contents): Cast size_t for error message.
	(coff_slurp_line_table): Don't use bfd_vma symndx.
	(coff_slurp_reloc_table): Remove unneeded cast.
	* dwarf2.c (read_section): Cast bfd_int64_t to long long for
	error message.
	(find_abstract_instance_name): Likewise.
	* elf32-arm.c (arm_type_of_stub): Correct error arg order.
	(bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
	(elf32_arm_check_relocs): Make r_symndx an int.
	* elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
	format string.
	* elf32-metag.c (elf_metag_relocate_section): Delete extra error
	message arg.
	* elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
	error message.
	* elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
	* elf32-s390.c (elf_s390_check_relocs): Likewise.
	* elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
	* elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
	* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
	* elf64-s390.c (elf_s390_check_relocs): Likewise.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
	* elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
	* elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
	* elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
	and use %lu for error message.
	* elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
	* mmo.c (mmo_scan): Make stab_loc a file_ptr.  Cast expression for
	error message.

	* elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
	in error message.
	(elf32_arm_final_link_relocate): Likewise.
	* coff-arm.c (bfd_arm_process_before_allocation): Likewise.
	* coffcode.h (styp_to_sec_flags): Likewise.
	* cofflink.c (_bfd_coff_write_global_sym): Likewise.
	* ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
	* elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
	* elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
	(elf32_bfin_merge_private_bfd_data): Likewise.
	* elf32-cris.c (cris_elf_relocate_section): Likewise.
	* elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
	* elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
	(i370_elf_relocate_section): Likewise.
	* elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
	* elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
	* elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
	* elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
	* elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
	* elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
	* elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
	(_bfd_mips_elf_merge_private_bfd_data): Likewise.
	* ieee.c (ieee_write_id, read_id): Likewise.
	* mach-o.c (bfd_mach_o_write_contents): Likewise.
	(bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
	(bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
	(bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
	* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
	* stabs.c (_bfd_link_section_stabs): Likewise.

	* coff-arm.c (coff_arm_relocate_section): Use L modifier in error
	format.
	* coff-mcore.c (coff_mcore_relocate_section): Likewise.
	* coff-ppc.c (coff_ppc_relocate_section): Likewise.
	* coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
	* coff-sh.c (sh_relax_section): Likewise.
	(sh_relax_delete_bytes, sh_swap_insns): Likewise.
	* coff-tic80.c (coff_tic80_relocate_section): Likewise.
	* coffcode.h (coff_slurp_reloc_table): Likewise.
	* coffgen.c (_bfd_coff_get_external_symbols): Likewise.
	(_bfd_coff_read_string_table): Likewise.
	* cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
	* compress.c (bfd_get_full_section_contents): Likewise.
	* dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
	* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
	* elf.c (bfd_elf_string_from_elf_section): Likewise.
	* elf32-arc.c (arc_special_overflow_checks): Likewise.
	* elf32-arm.c (elf32_arm_tls_relax): Likewise.
	(elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
	(elf32_arm_write_section): Likewise.
	* elf32-bfin.c (bfin_relocate_section): Likewise.
	(bfinfdpic_relocate_section): Likewise.
	* elf32-hppa.c (hppa_build_one_stub): Likewise.
	(final_link_relocate, elf32_hppa_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_tls_transition): Likewise.
	(elf_i386_relocate_section): Likewise.
	* elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
	* elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-metag.c (elf_metag_relocate_section): Likewise.
	* elf32-nds32.c (unrecognized_reloc_msg): Likewise.
	(nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
	(nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
	(nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
	(nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
	(nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
	(nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
	(nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
	(nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
	* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
	* elf32-rx.c (UNSAFE_FOR_PID): Likewise.
	* elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
	* elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
	* elf32-sh.c (sh_elf_relax_section): Likewise.
	(sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
	(sh_elf_relocate_section): Likewise.
	* elf32-sh64.c (shmedia_prepare_reloc): Likewise.
	* elf32-spu.c (spu_elf_relocate_section): Likewise.
	* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
	* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
	* elf32-v850.c (v850_elf_relax_section): Likewise.
	* elf32-vax.c (elf_vax_check_relocs): Likewise.
	(elf_vax_relocate_section): Likewise.
	* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
	(extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
	(compute_text_actions, compute_ebb_proposed_actions): Likewise.
	(do_fix_for_relocatable_link): Likewise.
	* elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
	(elf64_alpha_relax_with_lituse): Likewise.
	* elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
	(elf_hppa_final_link_relocate): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
	(elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
	(elf64_vms_link_add_object_symbols): Likewise.
	* elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
	(mmix_final_link_relocate): Likewise.
	* elf64-s390.c (invalid_tls_insn): Likewise.
	(elf_s390_relocate_section): Likewise.
	* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
	* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
	(elf_x86_64_relocate_section): Likewise.
	* elfcode.h (elf_slurp_symbol_table): Likewise.
	* elfcore.h (elf_core_file_p): Likewise.
	* elflink.c (elf_link_read_relocs_from_section): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
	(elfNN_aarch64_relocate_section): Likewise.
	* elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
	(elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
	* elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
	(_bfd_mips_elf_relocate_section): Likewise.
	(_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
	* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
	* ieee.c (ieee_slurp_external_symbols): Likewise.
	* ihex.c (ihex_write_object_content): Likewise.
	* mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
	* merge.c (_bfd_merged_section_offset): Likewise.
	* mmo.c (mmo_write_loc_chunk): Likewise.
	(mmo_write_object_contents): Likewise.
	* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
	* stabs.c (_bfd_link_section_stabs): Likewise.
	* xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
ld/
	* testsuite/ld-arc/nps-1b.err: Update.
	* testsuite/ld-x86-64/ilp32-11.d: Update.
2017-07-12 14:03:48 +09:30
GDB Administrator bd6a8c1905 Automatic date update in version.in 2017-07-12 00:00:47 +00:00
Han Shen df2f63a6a0 Fixing for PR gold/21491 - Errata workaround can produce broken images.
The problem is caused by the fact that gold is relocating the stubs
for an entire output section when it processes the relocations for a
particular input section that happened to be designated as the stub
table "owner". The Relocate_task for that input section may or may not
run before the Relocate_task for another input section that contains
the code that needs the erratum fix, but doesn't "own" the stub
table. If it runs before (or might even race with) that other task, it
ends up with a copy of the unrelocated original instruction.

In other words - when calling fix_errata() from
do_relocate_sections(), gold is going through the list of errata stubs
that are associated only with that object. This routine updates the
stored original instruction and replaces it in the output view with a
branch to the stub. Later, as gold is going through the object file's
input sections, it then checks for stub tables "owned" by each input
section, and writes out all the stubs from that stub table, regardless
of what object file each stub is associated with.

Fixed by relocating the erratum stub only after the corresponding
errata spot is fixed. That is to have fix_errata() call
Stub_table::relocate_erratum_stub() for each stub.

gold/ChangeLog
2017-07-06  Han Shen  <shenhan@google.com>

	PR gold/21491

	* aarch64.cc (Erratum_stub::invalidate_erratum_stub): New method.
	(Erratum_stub::is_invalidated_erratum_stub): New method.
	(Stub_table::relocate_reloc_stub): Renamed from "relocate_stub".
	(Stub_table::relocate_reloc_stubs): Renamed from "relocate_stubs".
	(Stub_table::relocate_erratum_stub): New method.
	(AArch64_relobj::fix_errata_and_relocate_erratum_stubs): Renamed from
	"fix_errata".
	(Target_aarch64::relocate_reloc_stub): Renamed from "relocate_stub".
2017-07-11 11:17:56 -07:00
John Baldwin 0aa37b654c Support the fs_base and gs_base registers on FreeBSD/amd64 native processes.
Use ptrace operations to fetch and store the fs_base and gs_base registers
for FreeBSD/amd64 processes.  Note that FreeBSD does not currently store the
value of these registers in core dumps, so these registers are only
available when inspecting a running process.

gdb/ChangeLog:

	* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Use
	PT_GETFSBASE and PT_GETGSBASE.
	(amd64bsd_store_inferior_registers): Use PT_SETFSBASE and
	PT_SETGSBASE.
2017-07-11 09:47:14 -07:00
John Baldwin 48aeef91c2 Include the fs_base and gs_base registers in amd64 target descriptions.
This permits these registers to be used with non-Linux targets.

gdb/ChangeLog:

	* features/Makefile (amd64.dat, amd64-avx.dat, amd64-mpx.dat)
	(amd64-avx-mpx.dat, amd64-avx-avx512.dat)
	(amd64-avx-mpx-avx512-pku.dat): Add i386/64bit-segments.xml in
	those rules.
	* features/i386/amd64-avx-avx512.xml: Add 64bit-segments.xml.
        * features/i386/amd64-avx-mpx-avx512-pku.xml: Add 64bit-segments.xml.
	* features/i386/amd64-avx-mpx.xml: Add 64bit-segments.xml.
	* features/i386/amd64-avx.xml: Add 64bit-segments.xml.
	* features/i386/amd64-mpx.xml: Add 64bit-segments.xml.
	* features/i386/amd64.xml: Add 64bit-segments.xml.
	* features/i386/amd64-avx-avx512.c: Regenerated.
	* features/i386/amd64-avx-mpx-avx512-pku.c: Regenerated.
	* features/i386/amd64-avx-mpx.c: Regenerated.
	* features/i386/amd64-avx.c: Regenerated.
	* features/i386/amd64-mpx.c: Regenerated.
	* features/i386/amd64.c: Regenerated.
	* regformats/i386/amd64-avx-avx512.dat: Regenerated.
	* regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerated.
	* regformats/i386/amd64-avx-mpx.dat: Regenerated.
	* regformats/i386/amd64-avx.dat: Regenerated.
	* regformats/i386/amd64-mpx.dat: Regenerated.
	* regformats/i386/amd64.dat: Regenerated.
2017-07-11 09:46:29 -07:00
H.J. Lu 61a0857c0f Support single digit GCC version
On Fedora 26, "g++ -dumpversion" displays "7", instead of "7.1.1".
Update selective.exp to support single digit GCC version.  Also
remove duplicated [4-9] version check.

	* testsuite/ld-selective/selective.exp: Support single digit
	GCC version.
2017-07-11 08:41:22 -07:00
Andreas Schwab 04ac15ab07 Add missing newlines in readelf -n output
* readelf.c (process_note): Print newline after description data
	in narrow mode.
	(print_core_note): Print newline if nothing was printed in wide
	mode.
2017-07-11 17:40:24 +02:00
Alan Modra e3fbc3da13 ppc32 use of %x in einfo format, typo fix
* elf32-ppc.c (ppc_elf_relocate_section): Fix typo.
2017-07-11 22:42:43 +09:30
Jiong Wang 70391b29cf [AArch64] Use "#pass" instead of "#..." to filter multiple lines
ld/
	* testsuite/ld-aarch64/dt_textrel.d: Use "#pass" instead of ".*" to
	filter out remaining lines.
2017-07-11 11:29:51 +01:00
Alan Modra 2c4d9cbe51 ppc32 use of %x in einfo format
einfo doesn't support %x.

	* elf32-ppc.c (ppc_elf_relocate_section): Emit "unexpected
	instruction" error using _bfd_error_handler, not einfo.
2017-07-11 19:18:47 +09:30
Alan Modra 4162bb66c6 Mark generated cgen files read-only
* cgen.sh: Mark generated files read-only.
	* epiphany-asm.c: Regenerate.
	* epiphany-desc.c: Regenerate.
	* epiphany-desc.h: Regenerate.
	* epiphany-dis.c: Regenerate.
	* epiphany-ibld.c: Regenerate.
	* epiphany-opc.c: Regenerate.
	* epiphany-opc.h: Regenerate.
	* fr30-asm.c: Regenerate.
	* fr30-desc.c: Regenerate.
	* fr30-desc.h: Regenerate.
	* fr30-dis.c: Regenerate.
	* fr30-ibld.c: Regenerate.
	* fr30-opc.c: Regenerate.
	* fr30-opc.h: Regenerate.
	* frv-asm.c: Regenerate.
	* frv-desc.c: Regenerate.
	* frv-desc.h: Regenerate.
	* frv-dis.c: Regenerate.
	* frv-ibld.c: Regenerate.
	* frv-opc.c: Regenerate.
	* frv-opc.h: Regenerate.
	* ip2k-asm.c: Regenerate.
	* ip2k-desc.c: Regenerate.
	* ip2k-desc.h: Regenerate.
	* ip2k-dis.c: Regenerate.
	* ip2k-ibld.c: Regenerate.
	* ip2k-opc.c: Regenerate.
	* ip2k-opc.h: Regenerate.
	* iq2000-asm.c: Regenerate.
	* iq2000-desc.c: Regenerate.
	* iq2000-desc.h: Regenerate.
	* iq2000-dis.c: Regenerate.
	* iq2000-ibld.c: Regenerate.
	* iq2000-opc.c: Regenerate.
	* iq2000-opc.h: Regenerate.
	* lm32-asm.c: Regenerate.
	* lm32-desc.c: Regenerate.
	* lm32-desc.h: Regenerate.
	* lm32-dis.c: Regenerate.
	* lm32-ibld.c: Regenerate.
	* lm32-opc.c: Regenerate.
	* lm32-opc.h: Regenerate.
	* lm32-opinst.c: Regenerate.
	* m32c-asm.c: Regenerate.
	* m32c-desc.c: Regenerate.
	* m32c-desc.h: Regenerate.
	* m32c-dis.c: Regenerate.
	* m32c-ibld.c: Regenerate.
	* m32c-opc.c: Regenerate.
	* m32c-opc.h: Regenerate.
	* m32r-asm.c: Regenerate.
	* m32r-desc.c: Regenerate.
	* m32r-desc.h: Regenerate.
	* m32r-dis.c: Regenerate.
	* m32r-ibld.c: Regenerate.
	* m32r-opc.c: Regenerate.
	* m32r-opc.h: Regenerate.
	* m32r-opinst.c: Regenerate.
	* mep-asm.c: Regenerate.
	* mep-desc.c: Regenerate.
	* mep-desc.h: Regenerate.
	* mep-dis.c: Regenerate.
	* mep-ibld.c: Regenerate.
	* mep-opc.c: Regenerate.
	* mep-opc.h: Regenerate.
	* mt-asm.c: Regenerate.
	* mt-desc.c: Regenerate.
	* mt-desc.h: Regenerate.
	* mt-dis.c: Regenerate.
	* mt-ibld.c: Regenerate.
	* mt-opc.c: Regenerate.
	* mt-opc.h: Regenerate.
	* or1k-asm.c: Regenerate.
	* or1k-desc.c: Regenerate.
	* or1k-desc.h: Regenerate.
	* or1k-dis.c: Regenerate.
	* or1k-ibld.c: Regenerate.
	* or1k-opc.c: Regenerate.
	* or1k-opc.h: Regenerate.
	* or1k-opinst.c: Regenerate.
	* xc16x-asm.c: Regenerate.
	* xc16x-desc.c: Regenerate.
	* xc16x-desc.h: Regenerate.
	* xc16x-dis.c: Regenerate.
	* xc16x-ibld.c: Regenerate.
	* xc16x-opc.c: Regenerate.
	* xc16x-opc.h: Regenerate.
	* xstormy16-asm.c: Regenerate.
	* xstormy16-desc.c: Regenerate.
	* xstormy16-desc.h: Regenerate.
	* xstormy16-dis.c: Regenerate.
	* xstormy16-ibld.c: Regenerate.
	* xstormy16-opc.c: Regenerate.
	* xstormy16-opc.h: Regenerate.
2017-07-11 19:18:06 +09:30
Iain Buclaw 11cb57160f Sync dlang demangling tests from upstream libiberty testsuite.
Rationale behind the change instead of adding a `.init$' postfix being
that "initializer for symbol" is much more informative when inspecting D
runtime type information in gdb, which is the only place where you would
encounter references to this compiler-generated symbol.

gdb/testsuite/ChangeLog:

	* gdb.dlang/demangle.exp: Update for demangling changes.
2017-07-11 09:51:03 +02:00
GDB Administrator 36cebdda80 Automatic date update in version.in 2017-07-11 00:00:41 +00:00
Anton Kolesov 6dc8d7579d Add missing ChangeLog etries
This adds the missing ChangeLog entries for my previous patch

3d99e81 Import setenv and unsetenv from gnulib
2017-07-10 20:49:28 +03:00
Nick Clifton adce5b398d Fix compile time warning about duplicate case values for powerpc-aix target.
* coffcode.h (coff_slurp_symbol_table): Do not include an entry
	for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.
2017-07-10 13:18:05 +01:00
Yao Qi 77c501bcea Re-generate i386/amd64-avx-avx512-linux.c and i386/amd64-avx-mpx-avx512-pku-linux.c
gdb:

2017-07-10  Yao Qi  <yao.qi@linaro.org>

	* features/i386/amd64-avx-avx512-linux.c: Re-generated.
	* features/i386/amd64-avx-mpx-avx512-pku-linux.c: Re-generated.
2017-07-10 12:00:35 +01:00
Yao Qi 2e1e43e140 Re-indent the code
gdb/gdbserver:

2017-07-10  Yao Qi  <yao.qi@linaro.org>

	* linux-x86-low.c (x86_linux_read_description): Re-indent the code.
2017-07-10 11:53:44 +01:00
Anton Kolesov 3d99e817a9 Import setenv and unsetenv from gnulib
This patch supersedes
https://sourceware.org/ml/gdb-patches/2017-07/msg00009.html

---

Patch [1] broke a build on MinGW hosts, because MinGW doesn't provide POSIX
functions setenv () and unsetenv ().  This can be fixed by using
implementations from gnulib.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9a6c7d9c0

gdb/ChangeLog
yyyy-mm-dd  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add setenv and
	unsetenv.
	* gnulib/aclocal.m4: Regenerate.
	* gnulib/config.in: Regenerate.
	* gnulib/configure: Regenerate.
	* gnulib/import/Makefile.am: Regenerate.
	* gnulib/import/Makefile.in: Regenerate.
	* gnulib/import/m4/gnulib-cache.m4: Regenerate.
	* gnulib/import/m4/gnulib-comp.m4: Regenerate.
	* gnulib/import/m4/environ.m4: New file.
	* gnulib/import/m4/setenv.m4: New file.
	* gnulib/import/setenv.c: New file.
	* gnulib/import/unsetenv.c: New file.
2017-07-10 13:23:12 +03:00
GDB Administrator a074796714 Automatic date update in version.in 2017-07-10 00:00:41 +00:00
Jan Kratochvil 14357de15f DWARF-5: Fix error message typo.
binutils/
2017-07-09  Rafael Fontenelle <rafaelff@gnome.org>

	* dwarf.c (display_formatted_table): Fix error message typo.
2017-07-09 20:52:18 +02:00
Simon Marchi 266934d1ad compile-loc2c: Fix uninitialized variable error
Compiling with clang gives this warning/error:

  /home/emaisin/src/binutils-gdb/gdb/compile/compile-loc2c.c:731:6: error: variable 'uoffset' is uninitialized when used here [-Werror,-Wuninitialized]
              uoffset += dwarf2_per_cu_text_offset (per_cu);
              ^~~~~~~
  /home/emaisin/src/binutils-gdb/gdb/compile/compile-loc2c.c:669:23: note: initialize the variable 'uoffset' to silence this warning
        uint64_t uoffset, reg;
                        ^
                         = 0

I am really not sure if what this patch does is good, but it is my best
guess.  DW_OP_addr means that there's an constant address provided by
the DWARF bytecode that should be pushed on the stack.  That address is
considered skipped by the "op_ptr += addr_size", but it is never read.
uoffset is indeed read just after, without having been assigned first.

So I think the intent is to read the address, it was just omitted.

gdb/ChangeLog:

	* compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Read
	address when op is DW_OP_addr.
2017-07-09 20:25:46 +02:00
Tom Tromey 0327869232 Fix size check in dwarf2_evaluate_loc_desc_full
This Rust bug report:

https://github.com/rust-lang/rust/issues/41970

noted an error from gdb.  What is happening here (for me, the original
report had a different error) is that a pieced DWARF expression is not
writing to every byte in the resulting value.  GDB errors in this
case.  However, it seems to me that it is always valid to write fewer
bytes; the issue comes from writing too many -- that is, the test is
reversed.  The test was also checking the sub-object, but this also
seems incorrect, as it's expected for the expression to write the
entirety of the enclosing object.  So, this patch reverses the test
and applies it to the outer type, not the subobject type.

Regtested on the buildbot.

gdb/ChangeLog
2017-07-09  Tom Tromey  <tom@tromey.com>

	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Reverse size
	check and apply to outer type.

gdb/testsuite/ChangeLog
2017-07-09  Tom Tromey  <tom@tromey.com>

	* gdb.dwarf2/shortpiece.exp: New file.
2017-07-09 10:46:49 -06:00
GDB Administrator f4db828807 Automatic date update in version.in 2017-07-09 00:00:41 +00:00
GDB Administrator 12c1f20d6f Automatic date update in version.in 2017-07-08 00:00:40 +00:00
John Baldwin 4b654465bf Read signal information from FreeBSD core dumps.
FreeBSD recently added a new ELF core note which dumps the entire LWP
info structure (the same structure returned by the ptrace PT_LWPINFO
operation) for each thread.  The plan is for this note to eventually
supplant the older "thrmisc" ELF core note as it contains more
information and it permits new information to be exported via both
ptrace() and core dumps using the same structure.

For signal information, the implementation is similar to the native
implementation for FreeBSD processes.  The PL_FLAG_SI flag must be
checked to determine if the embedded siginfo_t structure is valid, and
if so it is transferred into the caller's buffer.

gdb/ChangeLog:

	* fbsd-tdep.c (LWPINFO_OFFSET, LWPINFO_PL_FLAGS)
	(LWPINFO64_PL_SIGINFO, LWPINFO32_PL_SIGINFO, PL_FLAG_SI)
	(SIZE64_SIGINFO_T, SIZE32_SIGINFO_T, fbsd_core_xfer_siginfo): New.
	(fbsd_init_abi): Install gdbarch "core_xfer_siginfo" method.
2017-07-07 16:12:42 -07:00
John Baldwin e6f3b9c319 Create pseudo sections for FreeBSD NT_PTLWPINFO core notes.
bfd/ChangeLog:

	* elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO.
2017-07-07 16:11:42 -07:00
John Baldwin 0b9305edf1 Recognize the recently-added FreeBSD core dump note for LWP info.
This core dump note contains the same information returned by the
ptrace PT_LWPINFO operation for each LWP belonging to a process.

binutils/ChangeLog:

	* readelf.c (get_freebsd_elfcore_note_type): Handle
	NT_FREEBSD_PTLWPINFO.

include/ChangeLog:

	* elf/common.h (NT_FREEBSD_PTLWPINFO): Define.
2017-07-07 16:10:47 -07:00
John Baldwin 2af9fc4432 Use the thread_section_name helper class in fbsd_core_thread_name.
gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_core_thread_name): Use thread_section_name.
2017-07-07 16:09:13 -07:00
John Baldwin 382b69bbb7 Add a new gdbarch method to fetch signal information from core files.
Previously the core_xfer_partial method used core_get_siginfo to handle
TARGET_OBJECT_SIGNAL_INFO requests.  However, core_get_siginfo looked for
Linux-specific sections in the core file.  To support fetching siginfo
from cores on other systems, add a new gdbarch method (`core_xfer_siginfo`)
and move the body of the existing core_get_siginfo into a
linux_core_xfer_siginfo implementation of this method in linux-tdep.c.

gdb/ChangeLog:

	* corelow.c (get_core_siginfo): Remove.
	(core_xfer_partial): Use the gdbarch "core_xfer_siginfo" method
	instead of get_core_siginfo.
	* gdbarch.sh (core_xfer_siginfo): New gdbarch callback.
	* gdbarch.h: Re-generate.
	* gdbarch.c: Re-generate.
	* linux-tdep.c (linux_core_xfer_siginfo): New.
	(linux_init_abi): Install gdbarch "core_xfer_siginfo" method.
2017-07-07 16:08:33 -07:00
John Baldwin 6e5eab33ab Move the thread_section_name class to gdbcore.h.
This allows it to be used outside of corelow.c.
2017-07-07 16:06:45 -07:00
John Baldwin 929edea98d Fetch signal information for native FreeBSD processes.
Use the `pl_siginfo' field in the `struct ptrace_lwpinfo' object returned
by the PT_LWPINFO ptrace() request to supply the current contents of
$_siginfo for each thread.  Note that FreeBSD does not supply a way to
modify the signal information for a thread, so $_siginfo is read-only for
FreeBSD.

To handle 32-bit processes on a 64-bit host, define types for 32-bit
compatible siginfo_t and convert the 64-bit siginfo_t to the 32-bit
equivalent when supplying information for a 32-bit process.

gdb/ChangeLog:

	* fbsd-nat.c [PT_LWPINFO && __LP64__] (union sigval32)
	(struct siginfo32): New.
	[PT_LWPINFO] (fbsd_siginfo_size, fbsd_convert_siginfo): New.
	(fbsd_xfer_partial) [PT_LWPINFO]: Handle TARGET_OBJECT_SIGNAL_INFO
	via ptrace(PT_LWPINFO).
2017-07-07 16:05:47 -07:00
John Baldwin 762c974a09 Implement the "get_siginfo_type" gdbarch method for FreeBSD architectures.
As with Linux architectures, cache the created type in the gdbarch when it
is first created.  Currently FreeBSD uses an identical siginfo type on
all architectures, so there is no support for architecture-specific fields.

gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_gdbarch_data_handle, struct fbsd_gdbarch_data)
	(init_fbsd_gdbarch_data, get_fbsd_gdbarch_data)
	(fbsd_get_siginfo_type): New.
	(fbsd_init_abi): Install gdbarch "get_siginfo_type" method.
	(_initialize_fbsd_tdep): New.
2017-07-07 16:04:18 -07:00
Maciej W. Rozycki e54cb31aa3 MIPS/LD: Fix a segfault from ELF `e_flags' access with non-ELF output BFD
Fix a commit 861fb55ab5 ("Defer allocation of R_MIPS_REL32 GOT
slots"), <https://sourceware.org/ml/binutils/2008-08/msg00096.html>,
regression and a more recent:

FAIL: ld-unique/pr21529

new LD test case failure, observed with all the relevant MIPS targets
whenever the linker is invoked with one or more ELF inputs and the
output format set to `binary'.

The culprit is a segmentation fault caused in `mips_before_allocation'
by a null pointer dereference, where an attempt is made to access the
ELF file header's `e_flags' member, for the purpose of determining
whether to produce a PLT and copy relocations, without first checking
that the output BFD is ELF.  The `e_flags' member is stored in BFD's
private data pointed to by `tdep', which in the case of the `binary' BFD
is null, causing the segmentation fault.  With other non-ELF BFDs such
as SREC `tdep' is not null and consequently no crash may happen and in
that case random data will be interpreted as it was `e_flags'.

Disable the access to `e_flags' then and all the associated checks and
consequently never produce a PLT and copy relocations if output is not a
MIPS ELF BFD, matching `_bfd_mips_elf_merge_private_bfd_data' that does
not process `e_flags' in that case either and therefore does not let us
decide here anyway if all the input objects included in the link are
suitable for use with a PLT and copy relocations.

	ld/
	* emultempl/mipself.em (mips_before_allocation): Avoid ELF
	processing if not MIPS ELF.
	* testsuite/ld-mips-elf/binary.d: New test.
	* testsuite/ld-mips-elf/binary.ld: New test linker script.
	* testsuite/ld-mips-elf/binary.s: New test source.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2017-07-07 17:58:03 +01:00
Alan Modra c620a2b547 Make ppc476 testcases more robust
* testsuite/ld-powerpc/ppc476-shared.lnk: Align .bss.
	* testsuite/ld-powerpc/ppc476-shared.d: Adjust.
	* testsuite/ld-powerpc/ppc476-shared2.d: Adjust.
2017-07-07 23:53:18 +09:30
Alan Modra 7639175c9a Move print_insn_XXX to an opcodes internal header, again
88c1242dc0 changed some generated files rather than the source.

	* cgen-dis.in: Include disassemble.h, not dis-asm.h.
	* m32c-dis.c: Regenerate.
	* mep-dis.c: Regenerate.
2017-07-07 12:23:42 +09:30
Alan Modra 532cc31305 Add some missing xcoff support
* coffcode.h (coff_slurp_symbol_table): Handle C_AIX_WEAKEXT.
2017-07-07 10:35:31 +09:30
Alan Modra aff6079bc7 Apply ld/Makefile.in patch to the correct file
Makefile.in is generated.

	* Makefile.am (eelf64_s390.c): Depend on emultempl/s390.em.
2017-07-07 10:35:31 +09:30
Alan Modra 1cf9552bf1 Another _doprnt fix for %L handling
* bfd.c (_doprnt): Replace "L" with "ll" when printing bfd_vma
	as long long.  Move code replacing "ll" with "I64", and simplify.
2017-07-07 10:35:31 +09:30
GDB Administrator 9691e722c6 Automatic date update in version.in 2017-07-07 00:00:35 +00:00
David Blaikie 33c5cd7587 Fission support for multiple CUs per DWO file
In some cases a compiler may produce a single object file (& thus single
DWO file) representing multiple source files. The most common example of
this is in whole program optimization (such as LLVM's LTO). Fission may
still be a beneficial feature to use here - to avoid the need to
read/link the debug info with system libraries and the like.

This change adds basic support for multiple CUs in a single DWO file to
support LLVM's output in this situation.

There is still outstanding work to design and implement a solution for
cross-CU references (usually using DW_FORM_ref_addr) in this scenario.
For now LLVM works around this by duplicating DIEs rather than making
cross-CU references in DWO files. This degrades debugger
behavior/quality especially for file-local entities.

2017-07-06  David Blaikie  <dblaikie@gmail.com>

	* dwarf2read.c (struct dwo_file): Use a htab of dwo_unit* (rather than
	a singular dwo_unit*) to support multiple CUs in the same way that
	multiple TUs are supported.
	(create_cus_hash_table): Replace create_dwo_cu with a function for
	parsing multiple CUs from a DWO file.
	(open_and_init_dwo_file): Use create_cus_hash_table rather than
	create_dwo_cu.
	(lookup_dwo_cutu): Lookup CU in the hash table in the dwo_file with
	htab_find, rather than comparing the signature to a singleton CU in
	the dwo_file.

2017-07-06  David Blaikie  <dblaikie@gmail.com>

	* gdb.dwarf2/fission-multi-cu.S: Test containing multiple CUs in a DWO,
	built from fissiont-multi-cu{1,2}.c.
	* gdb.dwarf2/fission-multi-cu.exp: Test similar to fission-base.exp,
	except putting 'main' and 'func' in separate CUs in the same DWO file.
	* gdb.dwarf2/fission-multi-cu1.c: First CU for the multi-CU-single-DWO
	test.
	* gdb.dwarf2/fission-multi-cu2.c: Second CU in the multi-CU-single-DWO
	test.
2017-07-06 11:59:39 -07:00
H.J. Lu a0b7b10523 Convert 'L' to 'l' when setting wide_width to 1
When setting wide_width to 1, convert 'L' to 'l'.  Otherwise, %Lx/%Lu/%Ld
will be passed to fprintf which will treat the argument as long long.

	* bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
	to 1.
2017-07-06 06:52:13 -07:00
GDB Administrator 4b617f5235 Automatic date update in version.in 2017-07-06 00:00:56 +00:00
Pedro Alves 8455d26243 Fix Python unwinder frames regression
The gdb.python/py-unwind.exp test is crashing GDB / leaving core dumps
in the test dir, even though it all passes cleanly.  The crash is not
visible in gdb.sum/gdb.log because it happens as side effect of the
"quit" command, while flushing the frame cache.

The problem is simply a typo in a 'for' loop's condition, introduced
by a recent change [4fa847d78e ("Remove MAX_REGISTER_SIZE from
py-unwind.c")], resulting in infinite loop / double-free.

The new test exposes the crash, like:

 Running src/gdb/testsuite/gdb.python/py-unwind.exp ...
 ERROR: Process no longer exists

gdb/ChangeLog:
2017-07-06  Pedro Alves  <palves@redhat.com>

	* python/py-unwind.c (pyuw_dealloc_cache): Fix for loop condition.

gdb/testsuite/ChangeLog:
2017-07-06  Pedro Alves  <palves@redhat.com>

	* gdb.python/py-unwind.exp: Test flushregs.
2017-07-06 00:19:24 +01:00
H.J. Lu 1d827a720c Fix build with GCC 4.2
Fix GCC 4.2 warnings like:

cc1: warnings being treated as errors
binutils-gdb/bfd/dwarf2.c:1844: warning: declaration of ‘time’ shadows a global declaration
/usr/include/time.h:187: warning: shadowed declaration is here
binutils-gdb/bfd/dwarf2.c: In function ‘line_info_add_file_name’:
binutils-gdb/bfd/dwarf2.c:1854: warning: declaration of ‘time’ shadows a global declaration
/usr/include/time.h:187: warning: shadowed declaration is here

bfd/

	* dwarf2.c (line_info_add_include_dir_stub): Replace time with
	xtime.
	(line_info_add_file_name): Likewise.
	(decode_line_info): Likewise.

binutils/

	* dwarf.c (display_debug_names): Replace index with xindex.
2017-07-05 09:05:05 -07:00
James Greenhalgh 15a7695fdc [ARM] Add support for Cortex-A55 and Cortex-A75.
This patch adds support for the ARM Cortex-A55 and
Cortex-A75 processors.

The ARM Cortex-A55 and Cortex-A75 procsessors implement the ARMv8-A
architecture, with support for the ARMv8.1-A and ARMv8.2-A extensions,
including support for the 16-bit floating point extensions.

The 16-bit floating-point extensions are optional, and we haven't defined
an option mapping straight to them thus far, so this patch first needs to
add one of those in include/opcode/arm.h, then we can simply add the CPU names
as usual in config/tc-arm.c .

Tested on arm-none-eabi.

2017-07-05  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/tc-arm.c (arm_cpus): Add Cortex-A55 and Cortex-A75.
	* doc/c-arm.texi (-mcpu): Document Cortex-A55 and Cortex-A75.
2017-07-05 12:04:37 +01:00
Borislav Petkov e4bdd67955 X86: Disassemble primary opcode map's group 2 ModRM.reg == 6 aliases correctly
The instructions are not documented in the Intel SDM but are documented
in the AMD APM as an alias to the group 2, ModRM.reg == 4 variant.

Both AMD and Intel CPUs execute the C[0-1] and D[0-3] instructions as
expected, i.e., like the /4 aliases:

  #include <stdio.h>

  int main(void)
  {
          int a = 2;

          printf ("a before: %d\n", a);

          asm volatile(".byte 0xd0,0xf0"          /* SHL %al */
                       : "+a" (a));

          printf("a after : %d\n", a);

          return 0;
  }

  $ ./a.out
  a before: 2
  a after : 4
2017-07-05 11:27:49 +02:00
Ramana Radhakrishnan 60c96dbf02 Fixup changelog entries for previous commit
40c7d50720
2017-07-05 10:21:24 +01:00
GDB Administrator 033ea118c0 Automatic date update in version.in 2017-07-05 00:00:31 +00:00