aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-03-07Pass ptid to to_prepare_to_storeusers/simark/ptid-in-fetch-store-regsSimon Marchi12-28/+40
In the same vein as to_fetch_registers and to_store_registers, we can update to_prepare_to_store to take the ptid of the thread whose register we want to store as a parameter, rather than reading it from inferior_ptid. gdb/ChangeLog: * target.h (struct target_ops) <to_prepare_to_store>: Add ptid_t parameter. (target_prepare_to_store): Likewise. * target-delegates.c: Re-generate. * inf-child.c (inf_child_prepare_to_store): Add ptid parameter. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_prepare_to_store): Likewise. * ravenscar-thread.c (ravenscar_prepare_to_store): Add ptid parameter and use it instead of inferior_ptid. * ravenscar-thread.h (struct ravenscar_arch_ops) <to_prepare_to_store>: Add ptid parameter. * record-btrace.c (record_btrace_prepare_to_store): Add ptid parameter and use it instead of inferior_ptid. * record-full.c (record_full_core_prepare_to_store): Add ptid parameter. * regcache.c (regcache_raw_write): Pass ptid to target_prepare_to_store. * remote-sim.c (gdbsim_prepare_to_store): Add ptid parameter. * remote.c (remote_prepare_to_store): Add ptid parameter. * sparc-ravenscar-thread.c (sparc_ravenscar_prepare_to_store): Add ptid parameter.
2017-03-07Pass ptid to target_store_registersSimon Marchi44-222/+255
This patch adds a ptid parameter to the target_store_registers function and the to_store_registers method of target_ops. The implementations are therefore expected to rely on this and not on inferior_ptid. gdb/ChangeLog: * target-delegates.c: Re-generate. * target.h (struct target_ops) <to_store_registers>: Add ptid parameter. (target_store_registers): Likewise. * target.c (target_store_registers): Likewise. * aarch64-linux-nat.c (store_gregs_to_thread, store_fpregs_to_thread, aarch64_linux_store_inferior_registers): Add ptid parameter and use it. * aix-thread.c (aix_thread_store_registers): Add ptid parameter and use it. * amd64-linux-nat.c (amd64_linux_store_inferior_registers): Add ptid parameter and use it. * arm-linux-nat.c (store_fpregs, store_regs, store_wmmx_regs, store_vfp_regs, arm_linux_store_inferior_registers): Likewise. * arm-nbsd-nat.c (store_register, store_fp_register, armnbsd_store_registers): Likewise. * bsd-uthread.c (bsd_uthread_store_registers): Likewise. * hppa-linux-nat.c (store_register, hppa_linux_store_inferior_registers): Likewise. * i386-linux-nat.c (store_register, i386_linux_store_inferior_registers): Likewise. * ia64-linux-nat.c (ia64_linux_store_register, ia64_linux_store_registers): Likewise. * inf-child.c (inf_child_store_inferior_registers): Add ptid parameter. * inf-ptrace.c (inf_ptrace_store_register, inf_ptrace_store_registers): Likewise. * m68k-linux-nat.c (store_register, old_store_inferior_registers, m68k_linux_store_inferior_registers): Likewise. * mips-linux-nat.c (super_store_registers, mips64_linux_regsets_store_registers, mips64_linux_store_registers): Likewise. * ppc-linux-nat.c (ppc_linux_store_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_store_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_store_registers): Add ptid parameter and use it. (ppc_ravenscar_powerpc_store_registers): Likewise. (ppc_ravenscar_e500_store_registers): Likewise. * proc-service.c (ps_lsetregs, ps_lsetfpregs): Add ptid parameter and use it. Don't set/restore inferior_ptid. * procfs.c (procfs_store_registers): Add ptid parameter and use it. * ravenscar-thread.c (ravenscar_store_registers): Add ptid parameter and use it. Remove declaration at top of file. * ravenscar-thread.h (struct ravenscar_arch_ops) <to_store_registers>: Add ptid parameter. * record-btrace.c (record_btrace_store_registers): Add ptid parameter and use it. * record-full.c (record_full_store_registers): Likewise. (record_full_core_store_registers): Add ptid parameter. * regcache.c (regcache_raw_write): Pass ptid to target_store_registers. * remote.c (remote_store_registers): Add ptid parameter and use it. * remote-sim.c (gdbsim_store_register): Likewise. * rs6000-aix-tdep.c (rs6000_push_dummy_call): Pass inferior_ptid to target_store_registers. * rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise. * rs6000-nat.c (store_register, rs6000_store_inferior_registers): Add ptid parameter and use it. * s390-linux-nat.c (s390_linux_store_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_store_registers): Likewise. * sparc-nat.c (sparc_store_inferior_registers): Likewise. * sparc-nat.h (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (sparc_ravenscar_store_registers): Add ptid parameter and use it. Remove declaration at top of file. * spu-linux-nat.c (spu_store_inferior_registers): Add ptid parameter and use it. * spu-multiarch.c (spu_store_registers): Likewise. * tilegx-linux-nat.c (store_inferior_registers): Likewise. * vax-bsd-nat.c (vaxbsd_store_inferior_registers): Likewise. * windows-nat.c (windows_store_inferior_registers): Likewise. * xtensa-linux-nat.c (store_gregs, store_xtregs, xtensa_linux_store_inferior_registers): Likewise.
2017-03-07Pass ptid to target_fetch_registersSimon Marchi63-351/+403
This patch adds a ptid parameter to the target_fetch_registers and the to_fetch_registers method of target_ops. The implementations are therefore expected to rely on this and not on inferior_ptid. gdb/ChangeLog: * target-delegates.c: Re-generate. * target.h (struct target_ops) <to_fetch_registers>: Add ptid parameter. (target_fetch_registers): Likewise. * target.c (target_fetch_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread, fetch_fpregs_from_thread, aarch64_linux_fetch_inferior_registers): Add ptid parameter and use it. * aix-thread.c (aix_thread_fetch_registers): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. * arm-linux-nat.c (fetch_fpregs, fetch_regs, fetch_wmmx_regs, fetch_vfp_regs, arm_linux_fetch_inferior_registers): Likewise. * arm-nbsd-nat.c (fetch_register, fetch_regs, fetch_fp_register, fetch_fp_regs, armnbsd_fetch_registers): Likewise. * bsd-kvm.c (bsd_kvm_fetch_registers): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. * corelow.c (core_open): Pass inferior_ptid to target_fetch_registers. (get_core_registers): Add ptid parameter and use it. * ctf.c (ctf_fetch_registers): Likewise. * fbsd-tdep.c (fbsd_corefile_thread): Don't set/restore inferior_ptid, pass ptid to target_fetch_registers. * go32-nat.c (go32_fetch_registers): Add ptid parameter and use it. * hppa-linux-nat.c (fetch_register, hppa_linux_fetch_inferior_registers): Likewise. * hppa-nbsd-nat.c (hppanbsd_fetch_registers): Likewise. * hppa-obsd-nat.c (hppaobsd_fetch_registers): Likewise. * i386-bsd-nat.c (i386bsd_fetch_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. * i386-linux-nat.c (fetch_register, i386_linux_fetch_inferior_registers): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_register, ia64_linux_fetch_registers): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register, inf_ptrace_fetch_registers): Likewise. * linux-tdep.c (linux_corefile_thread): Pass ptid to target_fetch_registers, don't set/restore inferior_ptid. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Add ptid parameter and use it. * m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers): Likewise. * m68k-linux-nat.c (fetch_register, old_fetch_inferior_register, m68k_linux_fetch_inferior_registers): Likewise. * m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. * mips-linux-nat.c (super_fetch_registers, mips64_linux_regsets_fetch_registers, mips64_linux_fetch_registers): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. * mips-obsd-nat.c (mips64obsd_fetch_inferior_registers): Likewise. * nto-procfs.c (procfs_fetch_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers, ppc_ravenscar_powerpc_fetch_registers, ppc_ravenscar_e500_fetch_registers): Likewise. * proc-service.c (ps_lgetregs, ps_lgetfpregs): Pass ptid directly to target_fetch_registers, don't use inferior_ptid. * procfs.c (procfs_fetch_registers): Add ptid parameter and use it. * ravenscar-thread.c (ravenscar_fetch_registers): Add ptid parameter and use it. Remove declaration at top of file. * ravenscar-thread.h (struct ravenscar_arch_ops) <to_fetch_registers): Add ptid_t parameter. * record-btrace.c (record_btrace_fetch_registers): Add ptid parameter and use it. * record-full.c (record_full_core_open_1): Pass inferior_ptid to target_fetch_registers. (record_full_core_fetch_registers): Add ptid parameter. * regcache.c (regcache_raw_update): Pass inferior_ptid to target_fetch_registers. * remote.c (remote_fetch_registers): Add ptid parameter and use it. * remote-sim.c (gdbsim_fetch_register): Likewise. * rs6000-nat.c (fetch_register, rs6000_fetch_inferior_registers): Likewise. * s390-linux-nat.c (s390_linux_fetch_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. * sparc-nat.h (sparc_fetch_inferior_registers): Likewise. * sparc-ravenscar-thread.c (sparc_ravenscar_fetch_registers): Add ptid parameter and use it. Remove declaration at top of file. * spu-multiarch.c (spu_fetch_registers): Add ptid parameter and use it. * tilegx-linux-nat.c (fetch_inferior_registers): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * vax-bsd-nat.c (vaxbsd_fetch_inferior_registers): Likewise. * windows-nat.c (windows_fetch_inferior_registers): Likewise. * xtensa-linux-nat.c (fetch_gregs, fetch_xtregs, xtensa_linux_fetch_inferior_registers): Likewise.
2017-03-07Pass down ptid in bsd_uthread_ops layerSimon Marchi8-19/+75
The following patches will add a ptid_t parameter to target_fetch_registers and target_store_registers. In the bsd uthread implementations, there's another indirection layer in the form of bsd_uthread_ops. This patch adds the same ptid_t parameter to this layer, so that the implementations of bsd_uthread_ops don't rely on the current value of inferior_ptid. From what I understand, the register values of the userspace threads (uthreads) are stored in the memory of the "real" thread to which those userspace threads are mapped. Therefore, the implementation of these register fetching/storing functions consists of reading/writing memory. Since the memory read/write functions still rely on the value of inferior_ptid to know which thread to read/write memory from/to, it is necessary to set and restore inferior_ptid in those functions (e.g. amd64fbsd_supply_uthread). Eventually, when we add a ptid_t parameter to the memory functions, this should go away as we'll simply pass down the ptid parameter. gdb/ChangeLog: * amd64-fbsd-tdep.c (amd64fbsd_supply_uthread, amd64fbsd_collect_uthread): Add ptid parameter, set and restore inferior_ptid. * amd64-obsd.tdep.c (amd64fbsd_collect_uthread, amd64obsd_supply_uthread): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Pass ptid value to supply_uthread. (bsd_uthread_store_registers): Pass ptid value to collect_uthread. * bsd-uthread.h (bsd_uthread_supply_register_ftype, bsd_uthread_collect_register_ftype): Add ptid parameter. * i386-fbsd-tdep.c (i386fbsd_supply_uthread, i386fbsd_collect_uthread): Add ptid parameter, set and restore inferior_ptid. * i386-obsd-tdep.c (i386obsd_supply_uthread, i386obsd_collect_uthread): Add ptid parameter, set and restore inferior_ptid. * sparc-obsd-tdep.c (sparc32obsd_supply_uthread, sparc32obsd_collect_uthread): Add ptid parameter, set and restore inferior_ptid. * sparc-obsd-tdep.c (sparc64obsd_supply_uthread, sparc64obsd_collect_uthread): Add ptid parameter, set and restore inferior_ptid.
2017-03-07Define typedefs for bsd_uthread_ops fieldsSimon Marchi2-20/+19
The next patch will modify the type of the fields of bsd_uthread_ops, and will require changing parameters of the corresponding type at different places. I thought it would be more readable if typedefs were used. gdb/ChangeLog: * bsd-uthread.h (bsd_uthread_supply_register_ftype, bsd_uthread_collect_register_ftype): New typedefs. (bsd_uthread_set_supply_uthread, bsd_uthread_set_collect_uthread): Use typedefs. * bsd-uthread.c (struct bsd_uthread_ops) <supply_uthread, collect_uthread>: Likewise. (bsd_uthread_set_supply_uthread, bsd_uthread_set_collect_uthread): Likewise.
2017-03-07Add parametrized version of s390_inferior_tidSimon Marchi1-4/+12
In the next patches, we'll want to use this function with a ptid other than inferior_ptid, so I add it with a separate patch to keep things clean. gdb/ChangeLog: * s390-linux-nat.c (s390_inferior_tid): Add overload with ptid parameter.
2017-03-07windows: Don't use current_thread for register fetch/storeSimon Marchi1-22/+19
The windows_fetch_inferior_registers function sets current_thread then calls do_windows_fetch_inferior_registers, which reads current_thread. This very much looks like passing a parameter through a global variable. I think it would be more straightforward to pass the thread as a parameter. It will also fit better with the following patches, which pass a ptid to the register fetch/store target methods. I don't have access to a Windows development environment, so I couldn't even build-test this. Could somebody try it to make sure it doesn't break everything? gdb/ChangeLog: * windows-nat.c (do_windows_fetch_inferior_registers): Add windows_thread_info parameter and use it instead of current_thread. (windows_fetch_inferior_registers): Don't set current_thread, pass the thread to do_windows_fetch_inferior_registers. (do_windows_store_inferior_registers): Add windows_thread_info parameter and use it instead of current_thread. (windows_store_inferior_registers): Don't set current_thread, pass the thread to do_windows_store_inferior_registers.
2017-03-06Remove const in xtensa-linux-nat.c:fetch_gregsSimon Marchi2-1/+5
Fixes: /home/emaisin/src/binutils-gdb/gdb/xtensa-linux-nat.c: In function 'void fetch_gregs(regcache*, ptid_t, int)': /home/emaisin/src/binutils-gdb/gdb/xtensa-linux-nat.c:178:23: error: uninitialized const 'regs' [-fpermissive] const gdb_gregset_t regs; ^ gdb/ChangeLog: * xtensa-linux-nat.c (fetch_gregs): Remove const.
2017-03-06Fix reading numeric values from GNU BUILD NOTEs.Nick Clifton2-2/+11
* readelf.c (print_gnu_build_attribute_name): Read byte values from the name string as unsigned bytes. (process_notes_at): Use memcpy to copy an unterminated name string.
2017-03-06Don't decode powerpc insns with invalid fieldsAlan Modra2-49/+168
Certain insns have restrictions on fields. For example, the insn mentioned in the PR, lqarx, must specify an even general purpose register as its destination and that register cannot appear in either of the base or index reg fields. This holds even when the RA0 field is 0 (meaning a zero rather than r0). PR 21124 * ppc-opc.c (extract_esync, extract_ls, extract_ral, extract_ram) (extract_raq, extract_ras, extract_rbx): New functions. (powerpc_operands): Use opposite corresponding insert function. (Q_MASK): Define. (powerpc_opcodes): Apply Q_MASK to all quad insns with even register restriction.
2017-03-06dw2gencfi.c DWARF2_FDE_RELOC_SIZEAlan Modra2-12/+22
Add asserts that reloc size matches encoding size, and tidy. * dw2gencfi.c (encoding_size): Return unsigned int. (emit_expr_encoded): Assert size matches reloc bitsize. (output_fde): Use unsigned for offset_size and addr_size. Set addr_size earlier and use in place of constant 4 and uses of DWARF2_FDE_RELOC_SIZE. Assert it matches reloc bitsize.
2017-03-06gas/dw2gencfi.c formattingAlan Modra2-25/+35
* dw2gencfi.c: Wrap overlong lines. Add parens for emacs auto reformat. Formatting and whitespace fixes.
2017-03-06binutils: Fix warning on platforms that don't have asprintfSam Thursfield4-1/+21
* configure.ac (AC_CHECK_DECLS): Add asprintf. * config.in: Regenerate. * configure: Regenerate.
2017-03-06Automatic date update in version.inGDB Administrator1-1/+1
2017-03-05gas: Emit name, comp_dir and producer strings in .debug_str.Mark Wielaard3-21/+65
Putting the name, comp_dir and producer strings in the .debug_str section makes it possible to share them across CUs. This saves a small amount of space (about ~20K on a glibc libc.so.6 build with debuginfo). And makes it easier for tools like rpm debugedit to adjust the source paths when generating separate debuginfo files. gas/ * dwarf2dbg.c (out_debug_abbrev): Use DW_FORM_strp instead of DW_FORM_string for DW_AT_name, DW_AT_comp_dir and DW_AT_producer. (out_debug_info): Accept symbols to name, comp_dir and producer in the .debug_str section and emit those offsets not full strings. (out_debug_str): New function that outputs the strings for name, comp_dir and producer in .debug_str and generates symbols to those strings. (out_debug_line): Create a .debug_str section if necessary and call out_debug_str before calling out_debug_info. * testsuite/gas/aarch64/dwarf.d: Add extra section symbol to expected output.
2017-03-05Align eh_frame FDEs according to their encodingAlan Modra21-225/+251
bfd/ * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8. * elf-eh-frame.c (size_of_output_cie_fde): Don't align here. (next_cie_fde_offset): New function. (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8. (_bfd_elf_discard_section_eh_frame): Align zero terminator to four bytes. Align CIEs to four or eight bytes depending on per_encoding_aligned8. Align FDEs according to their encoding. Pad last FDE to output section alignment. (_bfd_elf_write_section_eh_frame): Adjust to suit. Remove assertion. * elf64-ppc.c (glink_eh_frame_cie): Delete padding. (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c. (ppc64_elf_finish_dynamic_sections): Adjust to suit. ld/ * testsuite/ld-elf/eh3.d: Adjust for eh_frame alignment change. * testsuite/ld-elf/eh6.d: Likewise. * testsuite/ld-alpha/tlsbin.dd: Likewise. * testsuite/ld-alpha/tlsbin.td: Likewise. * testsuite/ld-alpha/tlsbinr.dd: Likewise. * testsuite/ld-alpha/tlspic.dd: Likewise. * testsuite/ld-alpha/tlspic.rd: Likewise. * testsuite/ld-alpha/tlspic.sd: Likewise. * testsuite/ld-alpha/tlspic.td: Likewise. * testsuite/ld-mips-elf/eh-frame1-n64.d: Likewise. * testsuite/ld-mips-elf/eh-frame2-n64.d: Likewise. * testsuite/ld-mips-elf/eh-frame3.d: Likewise. * testsuite/ld-x86-64/pr20830a.d: Likewise. * testsuite/ld-x86-64/pr21038a.d: Likewise. * testsuite/ld-x86-64/pr21038b.d: Likewise. * testsuite/ld-x86-64/pr21038c.d: Likewise.
2017-03-05Automatic date update in version.inGDB Administrator1-1/+1
2017-03-04Automatic date update in version.inGDB Administrator1-1/+1
2017-03-03Fix umulh and smulh bugs. Fix bugs in last week's sumov.s testsuite.Jim Wilson5-9/+89
sim/aarch64/ * simulator.c (mul64hi): Shift carry left by 32. (smulh): Change signum to negate. If negate, invert result, and add carry bit if low part of multiply result is zero. sim/testsuite/sim/aarch64/ * sumov.s: Correct compare test values. * sumulh.s: New.
2017-03-03Use range-based for loop in remote_add_target_side_commandsSimon Marchi2-3/+6
gdb/ChangeLog: * remote.c (remote_add_target_side_commands): Use range-based for loop.
2017-03-03Fetch lazy value before calling val_printYao Qi3-0/+13
As reported in PR 21165, (gdb) info locals^M gv = /home/yao/SourceCode/gnu/gdb/git/gdb/value.c:372: internal-error: int value_bits_any_optimized_out(const value*, int, int): Assertion `!value->lazy' failed.^M A problem internal to GDB has been detected,^M further debugging may prove unreliable.^M Quit this debugging session? (y or n) FAIL: gdb.ada/info_locals_renaming.exp: info locals (GDB internal error) Resyncing due to internal error. This internal error is caused by e8b24d9 (Remove parameter valaddr from la_val_print). Commit e8b24d9 removes some calls to value_contents_for_printing, but value_fetch_lazy is not called, so the internal error above is triggered. This patch adds value_fetch_lazy call before val_print. gdb: 2017-03-03 Yao Qi <yao.qi@linaro.org> PR gdb/21165 * ada-valprint.c (ada_val_print_ref): Call value_fetch_lazy if value is lazy. * valprint.c (common_val_print): Likewise.
2017-03-03Make the linker fail if asked to create more than 1^16 ordinal values for PE ↵Nick Clifton2-26/+35
targets. PR 12969 * pe-dll.c (generate_edata): Fail if the input file(s) require too many ordinals.
2017-03-03Fix thinko in previous changelog entry.Nick Clifton1-1/+1
PR ld/21212 * elf.c (rewrite_elf_program_header): Do not issue a warning for empty segments which have a zero filesz, but a non-zero memsz.
2017-03-03Automatic date update in version.inGDB Administrator1-1/+1
2017-03-02Support merging build notes in sections without the SHF_GNU_BUILD_NOTE flag set.Nick Clifton2-1/+7
* objcopy.c (is_merged_note_section): Support build note sections without the SHF_GNU_BUILD_NOTE section flag set.
2017-03-02Disable warning message about a program header with no associated sections ↵Nick Clifton2-4/+15
when that header's file size is non-zero. PR ld/21212 * elf.c (rewrite_elf_program_header): Do not issue a warning for empty segments which have a non-zero filesz.
2017-03-02Fix snafu parsing GNU_BUILD_NOTEs on ARM and AArch64 architectures.Nick Clifton2-2/+25
* readelf.c (print_gnu_build_attribute_description): Use global symbols for OPEN attributes if at all possible.
2017-03-02New debug_displays_assertJan Kratochvil2-0/+7
binutils/ 2017-03-02 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (debug_displays_assert): New static assertion.
2017-03-02Fix dwarf_section_display_enum regression by DWARF-5Jan Kratochvil2-0/+6
binutils/ 2017-03-02 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.h (enum dwarf_section_display_enum): Add loclists and rnglists.
2017-03-02GAS: Fix bogus "attempt to move .org backwards" relaxation errorsMaciej W. Rozycki48-4/+411
Fix a commit 6afe8e98a664 ("internal error for backwards .org"), <https://www.sourceware.org/ml/binutils/2008-06/msg00212.html>, GAS regression that caused legitimate code to fail assembly with an "attempt to move .org backwards" error. For example with the `mips-linux' target we get: $ cat org.s .set mips16 la $2, foo .org 0x1000 .align 2 foo: .half 0 $ as -o org.o org.s org.s: Assembler messages: org.s:3: Error: attempt to move .org backwards $ where the location pointer is obviously not moved backwards with `.org'. The cause is positive `stretch' in relaxation due to a PC-relative ADDIU instruction (produced from the LA macro used) getting expanded from 2 to 4 bytes as `foo' is noticed to be out of range for the short encoding. This in turn triggers logic in `relax_segment' which concludes in the processing of an `rs_org' frag produced that the location pointer is moved backwards while in fact only the amount to space forward to the location requested has shrunk, resulting in a negative growth of the frag. Correct the bad logic then and instead verify that the fixed part of an `rs_org' frag has not overrun the location requested, as per the comment already included with the error message: /* Growth may be negative, but variable part of frag cannot have fewer than 0 chars. That is, we can't .org backwards. */ which accurately describes the regression scenario. Move the comment ahead the conditional noted, for clarity. Add generic and MIPS test cases for the `.org' pseudo-op, including the test case discussed though not integrated with the offending commit in particular, adjusted to work across all targets. gas/ * write.c (relax_segment) <rs_org>: Only bail out if the fixed part of the frag has overrun the location requested. * testsuite/gas/all/org-1.d: New test. * testsuite/gas/all/org-2.d: New test. * testsuite/gas/all/org-3.d: New test. * testsuite/gas/all/org-4.d: New test. * testsuite/gas/all/org-5.d: New test. * testsuite/gas/all/org-6.d: New test. * testsuite/gas/all/org-1.l: New stderr output. * testsuite/gas/all/org-2.l: New stderr output. * testsuite/gas/all/org-3.l: New stderr output. * testsuite/gas/all/org-1.s: New test source. * testsuite/gas/all/org-2.s: New test source. * testsuite/gas/all/org-3.s: New test source. * testsuite/gas/all/org-4.s: New test source. * testsuite/gas/all/org-5.s: New test source. * testsuite/gas/all/org-6.s: New test source. * testsuite/gas/all/gas.exp: Run the new tests. * testsuite/gas/mips/org-1.d: New test. * testsuite/gas/mips/org-2.d: New test. * testsuite/gas/mips/org-3.d: New test. * testsuite/gas/mips/org-4.d: New test. * testsuite/gas/mips/org-5.d: New test. * testsuite/gas/mips/org-6.d: New test. * testsuite/gas/mips/org-7.d: New test. * testsuite/gas/mips/org-8.d: New test. * testsuite/gas/mips/org-9.d: New test. * testsuite/gas/mips/org-10.d: New test. * testsuite/gas/mips/org-11.d: New test. * testsuite/gas/mips/org-12.d: New test. * testsuite/gas/mips/org-1.l: New stderr output. * testsuite/gas/mips/org-4.l: New stderr output. * testsuite/gas/mips/org-5.l: New stderr output. * testsuite/gas/mips/org-6.l: New stderr output. * testsuite/gas/mips/org-10.l: New stderr output. * testsuite/gas/mips/org-1.s: New test source. * testsuite/gas/mips/org-2.s: New test source. * testsuite/gas/mips/org-3.s: New test source. * testsuite/gas/mips/org-4.s: New test source. * testsuite/gas/mips/org-5.s: New test source. * testsuite/gas/mips/org-6.s: New test source. * testsuite/gas/mips/org-7.s: New test source. * testsuite/gas/mips/org-8.s: New test source. * testsuite/gas/mips/org-9.s: New test source. * testsuite/gas/mips/org-10.s: New test source. * testsuite/gas/mips/org-11.s: New test source. * testsuite/gas/mips/org-12.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests.
2017-03-02PowerPC VLE typo fixAlan Modra2-1/+5
* elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
2017-03-02Avoid gcc-7 warning killing ld testcasesAlan Modra2-4/+9
* testsuite/ld-elf/shared.exp: Pass -ansi when compiling new.cc and dl3.cc.
2017-03-02Automatic date update in version.inGDB Administrator1-1/+1
2017-03-01Sync libiberty sources with GCC mainline.Nick Clifton3-24/+87
Brings in: 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de> PR PR c++/70182 * cp-demangle.c (d_unqualified_name): Handle "on" for operator names. * testsuite/demangle-expected: Add tests. 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de> PR c++/77489 * cp-demangle.c (d_discriminator): Handle discriminator >= 10. * testsuite/demangle-expected: Add tests for discriminator. 2016-12-13 Jakub Jelinek <jakub@redhat.com> PR c++/78761 * cp-demangle.c (cplus_demangle_type): Demangle Dc as decltype(auto). * testsuite/demangle-expected: Add test for decltype(auto).
2017-03-01[AArch64] Document +rcpc weak release consistency extensionSzabolcs Nagy2-0/+6
gas/ * doc/c-aarch64.texi (AArch64 Extensions): Document rcpc.
2017-03-01Add support for displaying and merging GNU_BUILD_NOTEs.Nick Clifton12-34/+1141
include * elf/common.h (SHF_GNU_BUILD_NOTE): Define. (NT_GNU_PROPERTY_TYPE_0): Define. (NT_GNU_BUILD_ATTRIBUTE_OPEN): Define. (NT_GNU_BUILD_ATTRIBUTE_FUN): Define. (GNU_BUILD_ATTRIBUTE_TYPE_NUMERIC): Define. (GNU_BUILD_ATTRIBUTE_TYPE_STRING): Define. (GNU_BUILD_ATTRIBUTE_TYPE_BOOL_TRUE): Define. (GNU_BUILD_ATTRIBUTE_TYPE_BOOL_FALSE): Define. (GNU_BUILD_ATTRIBUTE_VERSION): Define. (GNU_BUILD_ATTRIBUTE_STACK_PROT): Define. (GNU_BUILD_ATTRIBUTE_RELRO): Define. (GNU_BUILD_ATTRIBUTE_STACK_SIZE): Define. (GNU_BUILD_ATTRIBUTE_TOOL): Define. (GNU_BUILD_ATTRIBUTE_ABI): Define. (GNU_BUILD_ATTRIBUTE_PIC): Define. (NOTE_GNU_PROPERTY_SECTION_NAME): Define. (GNU_BUILD_ATTRS_SECTION_NAME): Define. (GNU_PROPERTY_STACK_SIZE): Define. (GNU_PROPERTY_NO_COPY_ON_PROTECTED): Define. (GNU_PROPERTY_X86_ISA_1_USED): Define. (GNU_PROPERTY_X86_ISA_1_NEEDED): Define. (GNU_PROPERTY_X86_ISA_1_486): Define. (GNU_PROPERTY_X86_ISA_1_586): Define. (GNU_PROPERTY_X86_ISA_1_686): Define. (GNU_PROPERTY_X86_ISA_1_SSE): Define. (GNU_PROPERTY_X86_ISA_1_SSE2): Define. (GNU_PROPERTY_X86_ISA_1_SSE3): Define. (GNU_PROPERTY_X86_ISA_1_SSSE3): Define. (GNU_PROPERTY_X86_ISA_1_SSE4_1): Define. (GNU_PROPERTY_X86_ISA_1_SSE4_2): Define. (GNU_PROPERTY_X86_ISA_1_AVX): Define. (GNU_PROPERTY_X86_ISA_1_AVX2): Define. (GNU_PROPERTY_X86_ISA_1_AVX512F): Define. (GNU_PROPERTY_X86_ISA_1_AVX512CD): Define. (GNU_PROPERTY_X86_ISA_1_AVX512ER): Define. (GNU_PROPERTY_X86_ISA_1_AVX512PF): Define. (GNU_PROPERTY_X86_ISA_1_AVX512VL): Define. (GNU_PROPERTY_X86_ISA_1_AVX512DQ): Define. (GNU_PROPERTY_X86_ISA_1_AVX512BW): Define. binutils* readelf.c (get_note_type): Add support for GNU_BUILD_NOTEs. (get_gnu_elf_note_type): Add support for GNU_PROPERTY_NOTEs. (decode_x86_isa): New function. (print_gnu_property_note): New function. (print_gnu_note): Handle GNU_PROPERTY_NOTEs. (print_gnu_build_attribute_description): New function. (print_gnu_build_attribute_name): New function. (process_note): Add support for GNU_BUILD_NOTEs. * objcopy.c (--merge-notes): New command line option. (copy_options): Add merge-notes. (copy_usage): Likewise. (is_merge_note_section): New function. (merge_gnu_build_notes): New function. (copy_object): Merge note sections if asked to do so. (skip_section): Add skip_copy parameter. Add support for skipping merged note sections. (copy_relocations_in_section): Update call to skip_section. (copy_section): Likewise. (copy_main): Add support for merge-notes option. * doc/binutils.texi: Document the new option to objcopy. * NEWS: Mention the new feature. * testsuite/binutils-all/note-2-32.d: New test. Checks note merging on 32-bit targets. * testsuite/binutils-all/note-2-32.s: New test source file. * testsuite/binutils-all/note-2-64.d: New test. Like note-2-32.d but for 64-bit targets. * testsuite/binutils-all/note-2-64.s: New test source file. * testsuite/binutils-all/objcopy.exp: Run the new test.
2017-03-01Automatic date update in version.inGDB Administrator1-1/+1
2017-02-28GDB: Add support for the new set/show disassembler-options commands.Peter Bergner46-3095/+4603
This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28Revert "Add symbol called __nm_<name> to exported symbols created by dlltool."Nick Clifton2-26/+1
This reverts commit 47612ae91c5f2de8960df1d96adf225d2455123f.
2017-02-28PowerPC addpcis fix againAlan Modra2-9/+12
In the last patch I said "The patch also fixes overflow checking". In fact, there wasn't anything wrong with the previous code. So, revert that change. The new checks are OK too, so this is just a tidy. * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change. (ppc64_elf_relocate_section): Likewise.
2017-02-28x86: fix handling of 64-bit operand size VPCMPESTR{I,M}Jan Beulich18-218/+432
Just like REX.W affects operand size of the implicit rAX/rDX inputs to PCMPESTR{I,M}, VEX.W does for VPCMPESTR{I,M}. Allow Q or L suffixes on the instructions. Similarly the disassembler needs to be adjusted to no longer require VEX.W to be zero for the instructions to be valid, and to emit proper suffixes. Note, however, that this doesn't address the problem of there being no way to control (at least) {,E}VEX.W for 32- or 16-bit code. Nor does it address the problem of the many WIG instructions not getting properly disassembled when VEX.W=1.
2017-02-28Nios2 dynobj handling fixesAlan Modra6-102/+94
A number of places in elf32-nios.c created dynamic sections but didn't set the hash table dynobj. That meant we could have duplicate dynamic sections connected to a number of bfds, so size_dynamic_sections didn't properly discard or allocate contents. Also, the entire set of dynamic sections was created in check_relocs on seeing GOT relocs, when only .got related sections are needed, probably done to hide segfaults later in finish_dynamic_sections. The patch fixes these issues and makes the assembler emit errors when nios2 lacks the necessary pc-relative relocs for subtraction expressions, rather than silently generating bad code. eg. ld-elf/merge. I've also tidied uses of elf32_nios2_hash_table and elf_hash_table. bfd/ PR 20995 * elf32-nios2.c (nios2_elf32_relocate_section): Use htab rather than elf32_nios2_hash_table or elf_hash_table. (create_got_section): Likewise. (nios2_elf32_finish_dynamic_symbol): Likewise. (nios2_elf32_adjust_dynamic_symbol): Likewise. (nios2_elf32_size_dynamic_sections): Likewise. (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot vars. Use htab equivalents directly instead. Don't create all dynamic sections on needing just the GOT. Use a goto rather than a fall-through with reloc test. Ensure htab->dynobj is set when making dynamic sreloc section. (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab equivalent directly instead. Don't segfault on looking for .dynamic when dynamic sections have not been created. Don't segfault on .got.plt being discarded. (nios2_elf32_size_dynamic_sections): Delete plt and got vars. Don't set "relocs" on .rela.plt. Do handle .sbss. Delete fixme and another not so relevant comment. (nios2_elf_add_symbol_hook): Delete dynobj var. If not already set, set hash table dynobj on creating .sbss. gas/ * config/tc-nios2.h (TC_FORCE_RELOCATION_SUB_LOCAL): Define. ld/ * testsuite/ld-elf/merge.d: xfail for nios.
2017-02-28PowerPC addpcis fixAlan Modra14-94/+155
This came up because I was looking at ld/tmpdir/addpcis.o and noticed the odd addends on REL16DX_HA. They ought to both be -4. The error crept in due REL16DX_HA howto being pc-relative (as indeed it should be), and code at gas/write.c:1001 after this comment /* Make it pc-relative. If the back-end code has not selected a pc-relative reloc, cancel the adjustment we do later on all pc-relative relocs. */ *not* cancelling the pc-relative adjustment. So I've made a dummy non-relative split reloc so that the generic code handles this, rather than attempting to add hacks later in md_apply_fix which would not be very robust. Having the new internal reloc also makes it easy to support addpcis rx,sym@ha as an equivalent to addpcis rx,(sym-0f)@ha 0: The patch also fixes overflow checking, which must test whether the addi will overflow too since @l relocs don't have any overflow check. Lastly, since I was poking at md_apply_fix, I arranged to have the generic gas/write.c code emit errors for subtraction expressions where we lack reloc support. include/ * elf/ppc64.h (R_PPC64_16DX_HA): New. Expand fake reloc comment. * elf/ppc.h (R_PPC_16DX_HA): Likewise. bfd/ * reloc.c (BFD_RELOC_PPC_16DX_HA): New. * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto. (ppc64_elf_reloc_type_lookup): Translate new bfd reloc. (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA. (ppc64_elf_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto. (ppc_elf_reloc_type_lookup): Translate new bfd reloc. (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. gas/ * config/tc-ppc.c (md_assemble): Use BFD_RELOC_PPC_16DX_HA for addpcis. (md_apply_fix): Remove fx_subsy check. Move code converting to pcrel reloc earlier and handle BFD_RELOC_PPC_16DX_HA. Remove code emiiting errors on seeing fx_pcrel set on unexpected relocs, as that is done now by the generic code via.. * config/tc-ppc.h (TC_FORCE_RELOCATION_SUB_LOCAL): ..this. Define. (TC_VALIDATE_FIX_SUB): Define. ld/ * testsuite/ld-powerpc/addpcis.d: Define ext1 and ext2 at limits of addpcis range.
2017-02-28Don't make dynamic .data.rel.ro SEC_READONLYAlan Modra22-25/+50
I'd made this dynamic section read-only so a flag test distinguished it from .dynbss, but like any other .data.rel.ro section it really should be marked read-write. (It is read-only after relocation, not before.) When using the standard linker scripts this usually doesn't matter since the output section is among other read-write sections and not page aligned. However, it might matter in the extraordinary case of the dynamic section being the only .data.rel.ro section with the output section just happening to be page aligned and a multiple of a page in size. In that case the output section would be read-only, and live it its own read-only PT_LOAD segment, which is incorrect. * elflink.c (_bfd_elf_create_dynamic_sections): Don't make dynamic .data.rel.ro read-only. * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section rather than section flags when deciding where copy reloc goes. * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise. * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise. * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise. * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise. * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise. * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise. * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise. * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise. * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
2017-02-28MIPS/BFD: Also handle `jalr $0, $25' with R_MIPS_JALRMaciej W. Rozycki13-12/+207
Interpret the `jalr $0, $25' instruction encoding with an R_MIPS_JALR relocation attached as an alias to `jr $25' and convert the jump to an equivalent branch where possible, consequently covering the MIPSr6 architecture for the purpose of this optimization too. bfd/ * elfxx-mips.c (mips_elf_perform_relocation): Also handle the `jalr $0, $25' instruction encoding. gas/ * testsuite/gas/mips/jalr4.s: Add `jalr $0, $25' instructions. * testsuite/gas/mips/jalr4.d: Adjust accordingly. Remove MIPSr6 encoding patterns. * testsuite/gas/mips/jalr4-n64.d: Likewise. * testsuite/gas/mips/mipsr6@jalr4.d: New test. * testsuite/gas/mips/mipsr6@jalr4-n32.d: New test. * testsuite/gas/mips/mipsr6@jalr4-n64.d: New test. ld/ * testsuite/ld-mips-elf/jalr4.dd: Adjust for `jalr $0, $25' instructions. * testsuite/ld-mips-elf/jalr4-r6.dd: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2017-02-28Automatic date update in version.inGDB Administrator1-1/+1
2017-02-27Fix compilation with GCC 4.4.7.Jan Kratochvil2-3/+11
binutils/ 2017-02-27 Jan Kratochvil <jan.kratochvil@redhat.com> Fix compilation with GCC 4.4.7. * dwarf.c (display_loclists_list, display_debug_rnglists_list): Initialize begin and end.
2017-02-27Remove struct keyword from range-based for loopSimon Marchi2-1/+6
The previous patch introduced this error with recent-ish GCCs: ../../binutils-gdb/gdb/remote.c: In function ‘int remote_add_target_side_condition(gdbarch*, bp_target_info*, char*, char*)’: ../../binutils-gdb/gdb/remote.c:9668:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct agent_expr *aexpr : bp_tgt->conditions) ^~~~~~ Removing the struct keyword fixes the error. gdb/ChangeLog: * remote.c (remote_add_target_side_condition): Remove "struct" keyword from range-based for loop.
2017-02-27Use range-based for loop in remote_add_target_side_conditionSimon Marchi2-4/+7
Using a range based for loop makes this code a bit more clean and readable. The comment above is clearly erroneous, so I've updated it. gdb/ChangeLog: * remote.c (remote_add_target_side_condition): Use range-based for loop. Update comment.
2017-02-27Fix array out of bound accessYao Qi2-2/+8
ASAN reports the following error, (gdb) PASS: gdb.fortran/vla-ptr-info.exp: continue to breakpoint: pvla-associated print &pvla^M =================================================================^M ^[[1m^[[31m==14331==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000ea569f at pc 0x0000008eb546 bp 0x7ffde0c1dc70 sp 0x7ffde0c1dc60^M ^[[1m^[[0m^[[1m^[[34mREAD of size 1 at 0x000000ea569f thread T0^[[1m^[[0m^M #0 0x8eb545 in f_print_type(type*, char const*, ui_file*, int, int, type_print_options const*) ../../binutils-gdb/gdb/f-typeprint.c:89^M #1 0xb611e2 in type_print(type*, char const*, ui_file*, int) ../../binutils-gdb/gdb/typeprint.c:365^M #2 0x7b3471 in c_value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/c-valprint.c:650^M #3 0xb99517 in value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/valprint.c:1233^M #4 0xa42be8 in print_formatted ../../binutils-gdb/gdb/printcmd.c:321^M #5 0xa46ac9 in print_value(value*, format_data const*) ../../binutils-gdb/gdb/printcmd.c:1233^M #6 0xa46d82 in print_command_1 ../../binutils-gdb/gdb/printcmd.c:1261^M #7 0xa46e3e in print_command ../../binutils-gdb/gdb/printcmd.c:1267 on this line of code demangled_args = varstring[strlen (varstring) - 1] == ')'; because varstring is an empty string and strlen () is 0, so "strlen () - 1" is definitely out of the bound of "varstring", (gdb) bt 10 at /home/yao/SourceCode/gnu/gdb/git/gdb/f-typeprint.c:56 at /home/yao/SourceCode/gnu/gdb/git/gdb/typeprint.c:365 at /home/yao/SourceCode/gnu/gdb/git/gdb/c-valprint.c:650 at /home/yao/SourceCode/gnu/gdb/git/gdb/valprint.c:1236 This patch adds a pre-check that varstring is empty or not. gdb: 2017-02-27 Yao Qi <yao.qi@linaro.org> * f-typeprint.c (f_print_type): Check "varstring" is empty first.