external/binutils.git
8 years agoMissing TO_ADDR
Alan Modra [Wed, 30 Mar 2016 07:10:37 +0000 (17:40 +1030)]
Missing TO_ADDR

* ldlang.c (lang_size_sections_1): Correct code detecting a
backward non-overlapping move.

8 years agoUse consistent test for .tbss sections in ldlang.c
Alan Modra [Wed, 30 Mar 2016 07:09:36 +0000 (17:39 +1030)]
Use consistent test for .tbss sections in ldlang.c

Some places tested SEC_LOAD, others SEC_HAS_CONTENTS.

* ldlang.c (IS_TBSS): New macro, extracted from..
(IGNORE_SECTION): ..here.
(lang_size_sections_1): Use IS_TBSS and IGNORE_SECTION.
(lang_size_sections, lang_do_assignments_1): Use IS_TBSS.

8 years agopython/py-utils.c (host_string_to_python_string): New function.
Doug Evans [Wed, 30 Mar 2016 06:48:35 +0000 (23:48 -0700)]
python/py-utils.c (host_string_to_python_string): New function.

gdb/ChangeLog:

* python/py-utils.c (host_string_to_python_string): New function.
* python/python-internal.h (host_string_to_python_string): Declare it.
* python/py-*.c (*): Update all calls to
PyString_Decode (str, strlen (str), host_charset (), NULL);
to use host_string_to_python_string instead.

8 years agouse xstrdup and friends more
Trevor Saunders [Mon, 28 Mar 2016 10:29:47 +0000 (06:29 -0400)]
use xstrdup and friends more

gas/ChangeLog:

2016-03-29  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-hppa.c (pa_space): Use xstrdup where appropriate.
(pa_subspace): Likewise.
(create_new_space): Likewise.
(create_new_subspace): Likewise.
* config/tc-mips.c (mips_lookup_insn): Likewise.
* config/tc-tic4x.c (tic4x_asg): Likewise.
* config/tc-tic54x.c (tic54x_eval): Likewise.
(stag_add_field): Likewise.
(tic54x_usect): Likewise.
(tic54x_clink): Likewise.
(tic54x_set_default_include): Likewise.
(tic54x_include): Likewise.
(tic54x_message): Likewise.
(tic54x_sblock): Likewise.
(tic54x_var): Likewise.
(subsym_ismember): Likewise.
(subsym_substitute): Likewise.
* config/tc-xtensa.c (xg_replace_opname): Likewise.
(xg_translate_sysreg_op): Likewise.
(xg_translate_idioms): Likewise.
(md_assemble): Likewise.
(cache_literal_section): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 Mar 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agogdbserver: Handle 'v' packet while processing qSymbol.
Marcin Kościelnicki [Sat, 12 Mar 2016 13:03:26 +0000 (14:03 +0100)]
gdbserver: Handle 'v' packet while processing qSymbol.

On powerpc64, qSymbol query may require gdb to read a function
descriptor, sending a vFile packet to gdbserver.  Thus, we need
to handle 'v' packet in look_up_one_symbol.

vFile replies may be quite long, and require reallocating own_buf.
Since handle_v_requests assumes the buffer is the static global own_buf
from server.c and reallocates it, we need to make own_buf global and
use it from look_up_one_symbol instead of using our own auto variable.
I've also done the same change in relocate_instruction, just in case.

On gdb side, in remote_check_symbols, rs->buf may be clobbered by vFile
handling, yet we need its contents for the reply (the symbol name is
stored there).  Allocate a new buffer instead.

This broke fast tracepoints on powerpc64, due to errors in reading IPA
symbols.

gdb/ChangeLog:

* remote.c (remote_check_symbols): Allocate own buffer for reply.

gdbserver/ChangeLog:

* remote-utils.c (look_up_one_symbol): Remove own_buf, handle 'v'
packets.
(relocate_instruction): Remove own_buf.
* server.c (own_buf): Make global.
(handle_v_requests): Make global.
* server.h (own_buf): New declaration.
(handle_v_requests): New prototype.

8 years agogdb: xtensa: fix frame initialization when PC is invalid
Max Filippov [Sun, 27 Mar 2016 17:45:54 +0000 (20:45 +0300)]
gdb: xtensa: fix frame initialization when PC is invalid

When gdb is used on core dump and PC is not pointing to a readable
memory read_memory_integer call in the xtensa_frame_cache throws an
error, making register inspection/backtracing impossible in that thread.

Use safe_read_memory_integer instead.

2016-03-29  Max Filippov  <jcmvbkbc@gmail.com>
gdb/
* xtensa-tdep.c (xtensa_frame_cache): Change op1 type to LONGEST.
Use safe_read_memory_integer instead of read_memory_integer.

8 years agogdb/NEWS: Add mention of s390*-linux tracepoints.
Marcin Kościelnicki [Tue, 29 Mar 2016 21:18:19 +0000 (23:18 +0200)]
gdb/NEWS: Add mention of s390*-linux tracepoints.

gdb/ChangeLog:

* NEWS: Mention support for tracepoints on s390*-linux.

8 years agogdbserver/s390: Add support for compiled agent expressions.
Marcin Kościelnicki [Sun, 15 Nov 2015 01:52:34 +0000 (02:52 +0100)]
gdbserver/s390: Add support for compiled agent expressions.

These sequences assume a z900+ CPU, like the rest of fast tracepoint
support.

gdb/gdbserver/ChangeLog:

PR 18377
* linux-s390-low.c (add_insns): New function.
(s390_emit_prologue): New function.
(s390_emit_epilogue): New function.
(s390_emit_add): New function.
(s390_emit_sub): New function.
(s390_emit_mul): New function.
(s390_emit_lsh): New function.
(s390_emit_rsh_signed): New function.
(s390_emit_rsh_unsigned): New function.
(s390_emit_ext): New function.
(s390_emit_log_not): New function.
(s390_emit_bit_and): New function.
(s390_emit_bit_or): New function.
(s390_emit_bit_xor): New function.
(s390_emit_bit_not): New function.
(s390_emit_equal): New function.
(s390_emit_less_signed): New function.
(s390_emit_less_unsigned): New function.
(s390_emit_ref): New function.
(s390_emit_if_goto): New function.
(s390_emit_goto): New function.
(s390_write_goto_address): New function.
(s390_emit_litpool): New function.
(s390_emit_const): New function.
(s390_emit_call): New function.
(s390_emit_reg): New function.
(s390_emit_pop): New function.
(s390_emit_stack_flush): New function.
(s390_emit_zero_ext): New function.
(s390_emit_swap): New function.
(s390_emit_stack_adjust): New function.
(s390_emit_set_r2): New function.
(s390_emit_int_call_1): New function.
(s390_emit_void_call_2): New function.
(s390_emit_eq_goto): New function.
(s390_emit_ne_goto): New function.
(s390_emit_lt_goto): New function.
(s390_emit_le_goto): New function.
(s390_emit_gt_goto): New function.
(s390_emit_ge_goto): New function.
(s390x_emit_prologue): New function.
(s390x_emit_epilogue): New function.
(s390x_emit_add): New function.
(s390x_emit_sub): New function.
(s390x_emit_mul): New function.
(s390x_emit_lsh): New function.
(s390x_emit_rsh_signed): New function.
(s390x_emit_rsh_unsigned): New function.
(s390x_emit_ext): New function.
(s390x_emit_log_not): New function.
(s390x_emit_bit_and): New function.
(s390x_emit_bit_or): New function.
(s390x_emit_bit_xor): New function.
(s390x_emit_bit_not): New function.
(s390x_emit_equal): New function.
(s390x_emit_less_signed): New function.
(s390x_emit_less_unsigned): New function.
(s390x_emit_ref): New function.
(s390x_emit_if_goto): New function.
(s390x_emit_const): New function.
(s390x_emit_call): New function.
(s390x_emit_reg): New function.
(s390x_emit_pop): New function.
(s390x_emit_stack_flush): New function.
(s390x_emit_zero_ext): New function.
(s390x_emit_swap): New function.
(s390x_emit_stack_adjust): New function.
(s390x_emit_int_call_1): New function.
(s390x_emit_void_call_2): New function.
(s390x_emit_eq_goto): New function.
(s390x_emit_ne_goto): New function.
(s390x_emit_lt_goto): New function.
(s390x_emit_le_goto): New function.
(s390x_emit_gt_goto): New function.
(s390x_emit_ge_goto): New function.
(s390_emit_ops): New function.
(struct linux_target_ops): Fill in emit_ops hook.

8 years agogdbserver/s390: Add fast tracepoint support.
Marcin Kościelnicki [Sun, 17 Jan 2016 21:59:06 +0000 (22:59 +0100)]
gdbserver/s390: Add fast tracepoint support.

Fast tracepoints will only work on 6-byte intructions, and assume at least
a z900 CPU.  s390 also has 4-byte jump instructions, which also work on
pre-z900, but their range is limitted to +-64kiB, which is not very useful
(and wouldn't work at all with current jump pad allocation).

There's a little problem with s390_relocate_instruction function: it
converts BRAS/BRASL instructions to LARL of the return address + JG
to the target address.  On 31-bit, this sets the high bit of the target
register to 0, while BRAS/BRASL would set it to 1.  While this is not
a problem when the result is only used to address memory, it could
possibly break something that expects to compare such addresses for
equality without first masking the bit off.  In particular, I'm not sure
whether leaving the return address high bit unset is ABI-compliant
(could confuse some unwinder?).  If that's a problem, it could be fixed
by handling it in the jump pad (since at that point we can just modify
the GPRs in the save area without having to worry about preserving
CCs and only having that one GPR to work with - I'm not sure if it's
even possible to set the high bit with such constraints).

gdb/gdbserver/ChangeLog:

PR 18377
* Makefile.in: Add s390 IPA files.
* configure.srv: Build IPA for s390.
* linux-s390-ipa.c: New file.
* linux-s390-low.c: New includes - inttypes.h and linux-s390-tdesc.h.
(init_registers_s390_linux32): Move declaration to linux-s390-tdesc.h.
(tdesc_s390_linux32): Likewise.
(init_registers_s390_linux32v1): Likewise.
(tdesc_s390_linux32v1): Likewise.
(init_registers_s390_linux32v2): Likewise.
(tdesc_s390_linux32v2): Likewise.
(init_registers_s390_linux64): Likewise.
(tdesc_s390_linux64): Likewise.
(init_registers_s390_linux64v1): Likewise.
(tdesc_s390_linux64v1): Likewise.
(init_registers_s390_linux64v2): Likewise.
(tdesc_s390_linux64v2): Likewise.
(init_registers_s390_te_linux64): Likewise.
(tdesc_s390_te_linux64): Likewise.
(init_registers_s390_vx_linux64): Likewise.
(tdesc_s390_vx_linux64): Likewise.
(init_registers_s390_tevx_linux64): Likewise.
(tdesc_s390_tevx_linux64): Likewise.
(init_registers_s390x_linux64): Likewise.
(tdesc_s390x_linux64): Likewise.
(init_registers_s390x_linux64v1): Likewise.
(tdesc_s390x_linux64v1): Likewise.
(init_registers_s390x_linux64v2): Likewise.
(tdesc_s390x_linux64v2): Likewise.
(init_registers_s390x_te_linux64): Likewise.
(tdesc_s390x_te_linux64): Likewise.
(init_registers_s390x_vx_linux64): Likewise.
(tdesc_s390x_vx_linux64): Likewise.
(init_registers_s390x_tevx_linux64): Likewise.
(tdesc_s390x_tevx_linux64): Likewise.
(have_hwcap_s390_vx): New static variable.
(s390_arch_setup): Fill have_hwcap_s390_vx.
(s390_get_thread_area): New function.
(s390_ft_entry_gpr_esa): New const.
(s390_ft_entry_gpr_zarch): New const.
(s390_ft_entry_misc): New const.
(s390_ft_entry_fr): New const.
(s390_ft_entry_vr): New const.
(s390_ft_main_31): New const.
(s390_ft_main_64): New const.
(s390_ft_exit_fr): New const.
(s390_ft_exit_vr): New const.
(s390_ft_exit_misc): New const.
(s390_ft_exit_gpr_esa): New const.
(s390_ft_exit_gpr_zarch): New const.
(append_insns): New function.
(s390_relocate_instruction): New function.
(s390_install_fast_tracepoint_jump_pad): New function.
(s390_get_min_fast_tracepoint_insn_len): New function.
(s390_get_ipa_tdesc_idx): New function.
(struct linux_target_ops): Wire in the above functions.
(initialize_low_arch) [!__s390x__]: Don't initialize s390x tdescs.
* linux-s390-tdesc.h: New file.

8 years agogdbserver/s390: Switch on tracepoint support.
Marcin Kościelnicki [Mon, 9 Nov 2015 13:52:13 +0000 (14:52 +0100)]
gdbserver/s390: Switch on tracepoint support.

Also adds s390 support to gdb.trace testsuite.

gdb/gdbserver/ChangeLog:

* linux-s390-low.c (s390_supports_tracepoints): New function.
(struct linux_target_ops): Fill supports_tracepoints hook.

gdb/testsuite/ChangeLog:

* gdb.trace/ftrace.exp: Set arg0exp for s390.
* gdb.trace/mi-trace-frame-collected.exp: Expect 4 registers on s390.
* gdb.trace/mi-trace-unavailable.exp: Set pcnum for s390, add gpr0num
variable for GPR 0 instead of assuming it is register 0.
* gdb.trace/trace-common.h: Add s390 fast tracepoint placeholder.
* lib/trace-support.exp: Add s390 registers.

8 years ago2016-03-29 Don Breazeal <donb@codesourcery.com>
Don Breazeal [Tue, 29 Mar 2016 17:27:43 +0000 (10:27 -0700)]
2016-03-29  Don Breazeal  <donb@codesourcery.com>

* gdb/value.c (value_actual_type): Fix formatting issue.

8 years ago[ARC] Fix typo in extension instruction name.
Claudiu Zissulescu [Tue, 29 Mar 2016 17:05:31 +0000 (19:05 +0200)]
[ARC] Fix typo in extension instruction name.

opcodes/
2016-03-29  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-ext-tbl.h (dsp_fp_i2flt): Fix typo.

8 years agoCompile gdb.arch/arm-neon.exp with debug info
Yao Qi [Tue, 29 Mar 2016 13:52:48 +0000 (14:52 +0100)]
Compile gdb.arch/arm-neon.exp with debug info

Pass "debug" to prepare_for_testing otherwise, some tests fail.

gdb/testsuite:

2016-03-29  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/arm-neon.exp: Pass debug to prepare_for_testing.

8 years ago[ARC] Add support for Quarkse opcodes.
Claudiu Zissulescu [Tue, 29 Mar 2016 12:49:22 +0000 (14:49 +0200)]
[ARC] Add support for Quarkse opcodes.

gas/
2016-03-29  Claudiu Zissulescu  <claziss@synopsys.com>

        * testsuite/gas/arc/ext2op.d: New file.
        * testsuite/gas/arc/ext2op.s: Likewise.
        * testsuite/gas/arc/ext3op.d: Likewise.
        * testsuite/gas/arc/ext3op.s: Likewise.

opcodes/
2016-03-29  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-tbl.h (invld07): Remove.
        * arc-ext-tbl.h: New file.
        * arc-dis.c (FIELDA, FIELDB, FIELDC): Remove.
        * arc-opc.c (arc_opcodes): Add ext-tbl include.

include/
2016-03-29  Claudiu Zissulescu  <claziss@synopsys.com>

        * opcode/arc.h (insn_subclass_t): Add QUARKSE subclass.
        (FIELDA, FIELDB, FIELDC, FIELDF, FIELDQ, INSN3OP, INSN2OP)
        (INSN2OP, INSN3OP_ABC, INSN3OP_ALC, INSN3OP_ABL, INSN3OP_ALL)
        (INSN3OP_0BC, INSN3OP_0LC, INSN3OP_0BL, INSN3OP_0LL, INSN3OP_ABU)
        (INSN3OP_ALU, INSN3OP_0BU, INSN3OP_0LU, INSN3OP_BBS, INSN3OP_0LS)
        (INSN3OP_CBBC, INSN3OP_CBBL, INSN3OP_C0LC, INSN3OP_C0LL)
        (INSN3OP_CBBU, INSN3OP_C0LU, MINSN3OP_ABC, MINSN3OP_ALC)
        (MINSN3OP_ABL, MINSN3OP_ALL, MINSN3OP_0BC, MINSN3OP_0LC)
        (MINSN3OP_0BL, MINSN3OP_0LL, MINSN3OP_ABU, MINSN3OP_ALU)
        (MINSN3OP_0BU, MINSN3OP_0LU, MINSN3OP_BBS, MINSN3OP_0LS)
        (MINSN3OP_CBBC, MINSN3OP_CBBL, MINSN3OP_C0LC, MINSN3OP_C0LL)
        (MINSN3OP_CBBU, MINSN3OP_C0LU, INSN2OP_BC, INSN2OP_BL, INSN2OP_0C)
        (INSN2OP_0L INSN2OP_BU, INSN2OP_0U, MINSN2OP_BC, MINSN2OP_BL)
        (MINSN2OP_0C, MINSN2OP_0L, MINSN2OP_BU, MINSN2OP_0U): Define.

8 years agomake md_parse_option () take a const char *
Trevor Saunders [Sat, 27 Feb 2016 14:35:32 +0000 (09:35 -0500)]
make md_parse_option () take a const char *

This is mostly just adding const in many places, however there are a couple
interesting things.  We need to add casts in tc-s390.c and tc-cris.c because
they have functions that assign to input_line_pointer an argument that
sometimes comes from md_parse_option.  Presumably this is safe because those
targets never pass literals to md_parse_option (), but this code should
probably be improved in the future.  Also xtensa passes the argument to strtoll
which is a rather odd function, it takes a const char * as argument and returns
a pointer into that string as a char * through an out argument, but we can work
around that by adding more variables.

gas/ChangeLog:

2016-03-29  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-aarch64.c (struct aarch64_long_option_table): Ad const
qualifier.
* config/tc-alpha.c (md_parse_option): Likewise.
* config/tc-arc.c (md_parse_option): Likewise.
* config/tc-arm.c (struct arm_long_option_table): Likewise.
(md_parse_option): Likewise.
* config/tc-avr.c (md_parse_option): Likewise.
* config/tc-bfin.c (md_parse_option): Likewise.
* config/tc-cr16.c (md_parse_option): Likewise.
* config/tc-cris.c (s_cris_arch): Likewise.
(md_parse_option): Likewise.
* config/tc-crx.c (md_parse_option): Likewise.
* config/tc-d10v.c (md_parse_option): Likewise.
* config/tc-d30v.c (md_parse_option): Likewise.
* config/tc-dlx.c (md_parse_option): Likewise.
* config/tc-epiphany.c (md_parse_option): Likewise.
* config/tc-fr30.c (md_parse_option): Likewise.
* config/tc-frv.c (md_parse_option): Likewise.
* config/tc-ft32.c (md_parse_option): Likewise.
* config/tc-h8300.c (md_parse_option): Likewise.
* config/tc-hppa.c (md_parse_option): Likewise.
* config/tc-i370.c (md_parse_option): Likewise.
* config/tc-i386.c (md_parse_option): Likewise.
* config/tc-i860.c (md_parse_option): Likewise.
* config/tc-i960.c (md_parse_option): Likewise.
* config/tc-ia64.c (md_parse_option): Likewise.
* config/tc-ip2k.c (md_parse_option): Likewise.
* config/tc-iq2000.c (md_parse_option): Likewise.
* config/tc-lm32.c (md_parse_option): Likewise.
* config/tc-m32c.c (md_parse_option): Likewise.
* config/tc-m32r.c (md_parse_option): Likewise.
* config/tc-m68hc11.c (md_parse_option): Likewise.
* config/tc-m68k.c (md_parse_option): Likewise.
* config/tc-mcore.c (md_parse_option): Likewise.
* config/tc-mep.c (md_parse_option): Likewise.
* config/tc-metag.c (struct metag_long_option): Likewise.
(md_parse_option): Likewise.
* config/tc-microblaze.c (md_parse_option): Likewise.
* config/tc-microblaze.h (md_parse_option): Remove prototype.
* config/tc-mips.c (md_parse_option): Adjust.
* config/tc-mmix.c (md_parse_option): Likewise.
* config/tc-mn10200.c (md_parse_option): Likewise.
* config/tc-mn10300.c (md_parse_option): Likewise.
* config/tc-moxie.c (md_parse_option): Likewise.
* config/tc-msp430.c (md_parse_option): Likewise.
* config/tc-mt.c (md_parse_option): Likewise.
* config/tc-nds32.c (md_parse_option): Likewise.
* config/tc-nds32.h (nds32_parse_option): Likewise.
* config/tc-nios2.c (md_parse_option): Likewise.
* config/tc-ns32k.c (md_parse_option): Likewise.
* config/tc-or1k.c (md_parse_option): Likewise.
* config/tc-pdp11.c (md_parse_option): Likewise.
* config/tc-pj.c (md_parse_option): Likewise.
* config/tc-ppc.c (md_parse_option): Likewise.
* config/tc-rl78.c (md_parse_option): Likewise.
* config/tc-rx.c (md_parse_option): Likewise.
* config/tc-s390.c (s390_parse_cpu): Likewise.
* config/tc-score.c (md_parse_option): Likewise.
* config/tc-sh.c (md_parse_option): Likewise.
* config/tc-sparc.c (md_parse_option): Likewise.
* config/tc-spu.c (md_parse_option): Likewise.
* config/tc-tic30.c (md_parse_option): Likewise.
* config/tc-tic4x.c (md_parse_option): Likewise.
* config/tc-tic54x.c (md_parse_option): Likewise.
* config/tc-tic6x.c (md_parse_option): Likewise.
* config/tc-tilegx.c (md_parse_option): Likewise.
* config/tc-tilepro.c (md_parse_option): Likewise.
* config/tc-v850.c (md_parse_option): Likewise.
* config/tc-vax.c (md_parse_option): Likewise.
* config/tc-visium.c (struct visium_long_option_table): Likewise.
* config/tc-xc16x.c (md_parse_option): Likewise.
* config/tc-xgate.c (md_parse_option): Likewise.
* config/tc-xstormy16.c (md_parse_option): Likewise.
* config/tc-xtensa.c (md_parse_option): Likewise.
* config/tc-z80.c (md_parse_option): Likewise.
* config/tc-z8k.c (md_parse_option): Likewise.
* tc.h (md_parse_option): Likewise.

8 years agoapply ChangeLog for previous commit
Trevor Saunders [Tue, 29 Mar 2016 11:40:22 +0000 (07:40 -0400)]
apply ChangeLog for previous commit

8 years agoreplace some obstack_alloc () calls with the XOBNEW wrapper
Trevor Saunders [Mon, 28 Mar 2016 08:57:40 +0000 (04:57 -0400)]
replace some obstack_alloc () calls with the XOBNEW wrapper

gas/ChangeLog:

2016-03-29  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-bfin.c (gencode): Use XOBNEW obstack_alloc () wrapper.
* config/tc-hppa.c (fix_new_hppa): Likewise.
(pa_vtable_entry): Likewise.
(pa_vtable_inherit): Likewise.
* config/tc-m68k.c (md_begin): Likewise.

8 years agoTidy up AArch64 simulator code.
Nick Clifton [Tue, 29 Mar 2016 10:34:22 +0000 (11:34 +0100)]
Tidy up AArch64 simulator code.

* cpustate.c: Remove space after asterisk in function parameters.
* decode.h (greg): Delete unused function.
(vreg, shift, extension, scaling, writeback, condcode): Likewise.
* simulator.c: Use INSTR macro in more places.
(HALT_NYI): Use sim_io_eprintf in place of fprintf.
Remove extraneous whitespace.

8 years agoRelax assertion in BFIN linker to allow for discard GOT relocs.
Nick Clifton [Tue, 29 Mar 2016 09:24:16 +0000 (10:24 +0100)]
Relax assertion in BFIN linker to allow for discard GOT relocs.

PR 17334
* elf32-bfin.c (elf32_bfinfdpic_finish_dynamic_sections): Relax
assertion on the size of the got section to allow it to be bigger
than the number of relocs.

8 years agoreadelf printf format strings on mingw
Alan Modra [Tue, 29 Mar 2016 06:41:46 +0000 (17:11 +1030)]
readelf printf format strings on mingw

* readelf.c (get_data): Use BFD_VMA_FMT to print bfd_size_type vars.
(get_dynamic_data): Likewise.

8 years agoPE/COFF regression in base of code and data calculation
Toni Spets [Tue, 29 Mar 2016 03:55:23 +0000 (14:25 +1030)]
PE/COFF regression in base of code and data calculation

PR 19878
* coffcode.h (coff_write_object_contents): Revert accidental
2014-11-10 change.

8 years agoadd more const qualifiers
Trevor Saunders [Thu, 24 Mar 2016 02:39:13 +0000 (22:39 -0400)]
add more const qualifiers

gas/ChangeLog:

2016-03-28  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/obj-elf.c (obj_elf_section_name): Return const char *.
* config/obj-elf.h (obj_elf_section_name): Adjust.
* config/tc-aarch64.c (aarch64_parse_features): Likewise.
(aarch64_parse_cpu): Likewise.
(aarch64_parse_arch): Likewise.
* config/tc-arm.c (arm_parse_extension): Likewise.
(arm_parse_cpu): Likewise.
(arm_parse_arch): Likewise.
* config/tc-nds32.c: Likewise.
* config/xtensa-relax.c (parse_special_fn): Likewise.
* stabs.c (generate_asm_file): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 Mar 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Mar 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix failure to diagnose GOTOFF relocation to undef symbol in shared lib (i386).
Cary Coutant [Sun, 27 Mar 2016 23:09:56 +0000 (16:09 -0700)]
Fix failure to diagnose GOTOFF relocation to undef symbol in shared lib (i386).

gold/
PR gold/16111
* i386.cc (Target_i386): Add check for fully-resolved symbol for
R_386_GOTOFF.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Mar 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agosplit up cr16s md_assemble ()
Trevor Saunders [Sun, 20 Mar 2016 05:21:48 +0000 (01:21 -0400)]
split up cr16s md_assemble ()

gas/ChangeLog:

2016-03-25  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-cr16.c (cr16_assemble): New function.
(md_assemble): Call cr16_assemble.

8 years agorename flag_size_check to flag_allow_nonconst_size and make it a bool
Trevor Saunders [Fri, 25 Mar 2016 19:43:13 +0000 (15:43 -0400)]
rename flag_size_check to flag_allow_nonconst_size and make it a bool

This name describes what the variable means slightly better, and the enum with
two values that is only used for this one variable is kind of silly.

gas/ChangeLog:

2016-03-25  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* as.c (parse_args): Adjust.
* as.h (flag_size_check): Rename to flag_allow_nonconst_size.
* config/obj-elf.c (elf_frob_symbol): Adjust.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 Mar 2016 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 Mar 2016 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMore -Wstack-usage warnings: opcodes/aarch64-*
Jan Kratochvil [Thu, 24 Mar 2016 21:42:09 +0000 (22:42 +0100)]
More -Wstack-usage warnings: opcodes/aarch64-*

opcodes Fix -Wstack-usage warnings.
* aarch64-dis.c (print_operands): Substitute size.
* aarch64-opc.c (print_register_offset_address): Substitute tblen.

8 years agogas: sparc: allow ASR registers in the 0..31 range in V9 and later
Jose E. Marchesi [Thu, 24 Mar 2016 17:28:41 +0000 (10:28 -0700)]
gas: sparc: allow ASR registers in the 0..31 range in V9 and later

In the SPARC V9 (and later) versions of the SPARC specification, the
section C.1.1 "Register Names" specifies that:

"asr_reg.  An asr_reg is an Ancillary State Register name.  It may have
 one of the following values:

  %asr16-%asr31"

The rationale of having this restriction was that the registers from 16
to 31 are reserved to implementations, and are therefore "non-V9".  It
also assumes that the existing ASR registers in the range 0..31 will
have their own names such as %y, that can be used to access such
registers.

However, this is problematic.  When a new ASR register is introduced,
such as %mcdper a.k.a. %asr14, it is useful to be able to use %asr14 in
order to not depend on the latest version of the assembler.

The Solaris assembler is lax and allows to assembly instructions
referring to %asr0 to %asr31.  This patch makes the GNU assembler to
mimic that behavior.

gas/ChangeLog:

  2016-03-24  Jose E. Marchesi  <jose.marchesi@oracle.com>

* config/tc-sparc.c (sparc_ip): Remove the V9 restriction on ASR
registers to be in the 16..31 range.

8 years agosparc: reorder wr instructions in sparc_opcodes to fix diagnostics
Jose E. Marchesi [Thu, 24 Mar 2016 17:20:45 +0000 (10:20 -0700)]
sparc: reorder wr instructions in sparc_opcodes to fix diagnostics

This patch changes the location of several variants of the `wr'
instruction in sparc_opcodes.  This is to get the assembler to emit the
right diagnostics when an invalid %asrN register is used in an
instruction.

8 years agomake microblaze build with -Wwrite-strings
Trevor Saunders [Sun, 20 Mar 2016 01:48:07 +0000 (21:48 -0400)]
make microblaze build with -Wwrite-strings

frag_var () assigns its last argument to frag::fr_opcode, and it turns out
some targets modify the string that points to.  However it appears niether the
generic code or the microblaze code modifies what fr_opcode points to, so this
code should be safe.  So we unfortunately need to cast to char * when passing
an argument to frag_var () but otherwise microblaze can itself point to these
strings with const char *.

gas/ChangeLog:

2016-03-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-microblaze.c (md_assemble): Cast opc to char * when calling
frag_var ().

8 years agolocalize string returned from visium's md_atof ()
Trevor Saunders [Sat, 19 Mar 2016 11:38:46 +0000 (07:38 -0400)]
localize string returned from visium's md_atof ()

I'm not sure the string it returns is particularly useful, or better than the
string returned by other atof implementations on failure, but given the others
return a localized string it seems like this one should too.

gas/ChangeLog:

2016-03-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-visium.c (md_atof): Localize the string returned on
failure.

8 years agoAdd quotation mark in test message
Yao Qi [Thu, 24 Mar 2016 09:53:50 +0000 (09:53 +0000)]
Add quotation mark in test message

I happen to see a quotation mark is missing the following test,

 gdb_test "break $end_location" \
     "Breakpoint $decimal at .* line $end_location\." \
     set breakpoint at end of main"

so the test result is

PASS: gdb.reverse/break-reverse.exp: set

This patch is to add the missing quotation mark back, and the test
result becomes

PASS: gdb.reverse/break-reverse.exp: set breakpoint at end of main

gdb/testsuite:

2016-03-24  Yao Qi  <yao.qi@linaro.org>

* gdb.reverse/break-reverse.exp: Add quotation mark in the
test message.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 Mar 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMore AArch64 simulator improvements.
Nick Clifton [Wed, 23 Mar 2016 17:37:30 +0000 (17:37 +0000)]
More AArch64 simulator improvements.

* cpustate.c (aarch64_get_FP_half): New function.  Read a vector
register as a half precision floating point number.
(aarch64_set_FP_half): New function.  Similar, but for setting
a half precision register.
(aarch64_get_thread_id): New function.  Returns the value of the
CPU's TPIDR register.
(aarch64_get_FPCR): New function.  Returns the value of the CPU's
floating point control register.
(aarch64_set_FPCR): New function.  Set the value of the CPU's FPCR
register.
* cpustate.h: Add prototypes for new functions.
* sim-main.h (struct _sim_cpu): Add FPCR and tpidr fields.
* memory.c: Use unaligned core access functions for all memory
reads and writes.
* simulator.c (HALT_NYI): Generate an error message if tracing
will not tell the user why the simulator is halting.
(HALT_UNREACHABLE): Delete.  Delete (unneeded) uses of the macro.
(INSTR): New time-saver macro.
(fldrb_abs): New function.  Loads an 8-bit value using a scaled
offset.
(fldrh_abs): New function.  Likewise for 16-bit values.
(do_vec_SSHL): Allow for negative shift values.
(do_vec_USHL): Likewise.
(do_vec_SHL): Correct computation of shift amount.
(do_vec_SSHR_USHR): Correct decision of signed vs unsigned
shifts and computation of shift value.
(clz): New function.  Counts leading zero bits.
(do_vec_CLZ): New function.  Implements CLZ (vector).
(do_vec_MOV_element): Call do_vec_CLZ.
(dexSimpleFPCondCompare): Implement.
(do_FCVT_half_to_single): New function.  Implements one of the
FCVT operations.
(do_FCVT_half_to_double): New function.  Likewise.
(do_FCVT_single_to_half): New function.  Likewise.
(do_FCVT_double_to_half): New function.  Likewise.
(dexSimpleFPDataProc1Source): Call new FCVT functions.
(do_scalar_SHL): Handle negative shifts.
(do_scalar_shift): Handle SSHR.
(do_scalar_USHL): New function.
(do_double_add): Simplify to just performing a double precision
add operation.  Move remaining code into...
(do_scalar_vec): ... New function.
(dexLoadUnsignedImmediate): Call new fldrb_abs and fldrh_abs
functions.
(system_get): Add support for TPIDR, CTR, FPCR, FPSR and CPSR
registers.
(system_set): New function.
(do_MSR_immediate): New function.  Stub for now.
(do_MSR_reg): New function.  Likewise. Partially implements MSR
instruction.
(do_SYS): New function.  Stub for now,
(dexSystem): Call new functions.

8 years agoRemove comments on software_single_step in gdbarch.sh
Yao Qi [Wed, 23 Mar 2016 11:21:20 +0000 (11:21 +0000)]
Remove comments on software_single_step in gdbarch.sh

This comment is out of date.  We've already done that.  Patch is to remove
it.

gdb:

2016-03-23  Yao Qi  <yao.qi@linaro.org>

* gdbarch.sh (software_single_step): Remove comments.
* gdbarch.h: Regenerated.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 23 Mar 2016 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agomake more variables const
Trevor Saunders [Sun, 20 Mar 2016 05:34:02 +0000 (01:34 -0400)]
make more variables const

gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-h8300.c (h8300_elf_section): Add const qualifiers.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-m68hc11.c (md_begin): Likewise.
(print_opcode_list): Likewise.
* config/tc-msp430.c (msp430_section): Likewise.
* config/tc-score.c (struct s3_insn_to_dependency): Likewise.
(s3_build_dependency_insn_hsh): Likewise.
* config/tc-score7.c (struct s7_insn_to_dependency): Likewise.
(s7_build_dependency_insn_hsh): Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
(subsym_get_arg): Likewise.
* config/tc-xtensa.c (struct suffix_reloc_map): Likewise.
(get_directive): Likewise.
(cache_literal_section): Likewise.
* config/xtensa-relax.c: Likewise.
* symbols.c (symbol_create): Likewise.
(local_symbol_make): Likewise.
(symbol_relc_make_expr): Likewise.

include/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* opcode/i960.h: Add const qualifiers.
* opcode/tic4x.h (struct tic4x_inst): Likewise.

8 years agotc-pdp11.c: remove useless code
Trevor Saunders [Sun, 20 Mar 2016 05:07:55 +0000 (01:07 -0400)]
tc-pdp11.c: remove useless code

if the condition is true then we know that str already points to a'\0' in the
string passed to the function.  Since we know the latter part of the function
doesn't modify that string, and str already points to a null byte there's no
point in changing str to point to a literal empty string.

gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-pdp11.c (md_assemble): Remove useless if and assignment to
str.

8 years agotc-sparc.c: get rid of wierd usage of strchr ()
Trevor Saunders [Sun, 20 Mar 2016 05:36:16 +0000 (01:36 -0400)]
tc-sparc.c: get rid of wierd usage of strchr ()

This lets us avoid assigning a literal to a char *, and perhaps more
importantly makes it clearer what is going on here.

gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-sparc.c (sparc_regname_to_dw2regnum): Replace strchr ()
call with a switch.

8 years agouse do_align () directly in tc-ia64.c
Trevor Saunders [Sun, 28 Feb 2016 23:00:00 +0000 (18:00 -0500)]
use do_align () directly in tc-ia64.c

gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-ia64.c (ia64_do_align): Remove.
(ia64_cons_align): Call do_align () directly.
(dot_proc): Likewise.
(stmt_float_cons): Likewise.

8 years agoreplace some raw xmalloc / xrealloc with the XNEW* macros
Trevor Saunders [Sun, 14 Feb 2016 03:00:07 +0000 (22:00 -0500)]
replace some raw xmalloc / xrealloc with the XNEW* macros

This increases consistancy of how we allocate memory, and always casting the
result to the proper type.  It also helps make sure we get any use of sizeof on
the result type correct.

gas/ChangeLog:

2016-03-22  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* listing.c (listing_message): Use XNEW style allocation macros.
* read.c (read_a_source_file): Likewise.
(read_symbol_name): Likewise.
(s_mri_common): Likewise.
(assign_symbol): Likewise.
(s_reloc): Likewise.
(emit_expr_with_reloc): Likewise.
(s_incbin): Likewise.
(s_include): Likewise.
* sb.c (sb_build): Likewise.
(sb_check): Likewise.

8 years agoFix unbounded stack usage warning inside the SAFE_BYTE_GET macro.
Nick Clifton [Tue, 22 Mar 2016 13:25:22 +0000 (13:25 +0000)]
Fix unbounded stack usage warning inside the SAFE_BYTE_GET macro.

PR 19851
binutils * dwarf.c (SAFE_BYTE_GET): Replace local dynamic array allocation
with run time size check.

8 years agoImprove COFF/PE linker garbage collection by preventing the removal of sections conta...
Nick Clifton [Tue, 22 Mar 2016 12:25:08 +0000 (12:25 +0000)]
Improve COFF/PE linker garbage collection by preventing the removal of sections containing exported symbols.

PR ld/19803
* ldlang.c (lang_add_gc_name): New function.  Adds the provided
symbol name to the list of gc symbols.
(lang_process): Call lang_add_gc_name with entry_symbol_default if
entry_symbol.name is NULL.  Use lang_add_gc_name to add the init
and fini function names.
* pe-dll.c (process_def_file_and_drectve): Add exported names to
the gc symbol list.
* testsuite/ld-pe/pr19803.s: Do not export _testval symbol.
* testsuite/ld-pe/pr19803.d: Tweak expected output.

8 years agoAttribute with DW_FORM_flag_present
Alan Modra [Tue, 22 Mar 2016 12:20:18 +0000 (22:50 +1030)]
Attribute with DW_FORM_flag_present

PR 19850
* dwarf2.c (read_attribute_value): Skip info_ptr check for
DW_FORM_flag_present.

8 years agoFix tic54x regression
Alan Modra [Tue, 22 Mar 2016 12:18:37 +0000 (22:48 +1030)]
Fix tic54x regression

One of the tic54x testcases looks for a section alignment of 1.  After
9136aa49 the alignment became 0.  While it happens that an alignment
of 0 is treated as an alignment of 1, there is no reason to not apply
the explicit alignment.

* write.c (record_alignment): Revert 2016-02-18 change.

8 years agoRemove more alloca calls
Alan Modra [Tue, 22 Mar 2016 12:08:53 +0000 (22:38 +1030)]
Remove more alloca calls

* config/tc-alpha.c (load_expression): Replace alloca with xmalloc.
(emit_jsrjmp, tc_gen_reloc): Likewise.
* config/tc-i370.c (i370_macro): Likewise.

8 years agoRestore v850-rh850 as a recognised v850 architecture name for backwards compatibility.
Nick Clifton [Tue, 22 Mar 2016 11:34:26 +0000 (11:34 +0000)]
Restore v850-rh850 as a recognised v850 architecture name for backwards compatibility.

bfd * cpu-v850_rh850.c (arch_info_struct): Restore v850-rh850 as an
architecture name for backwards compatibility.

8 years agoFix possible unbounded stack use in peXXigen.c
Nick Clifton [Tue, 22 Mar 2016 10:37:42 +0000 (10:37 +0000)]
Fix possible unbounded stack use in peXXigen.c

* peXXigen.c (_bfd_XXi_write_codeview_record): Fix possible
unbounded stack use.

8 years agoAdd -Wstack-usage to the gcc warning flags list, but only if using a sufficiently...
Nick Clifton [Tue, 22 Mar 2016 09:41:16 +0000 (09:41 +0000)]
Add -Wstack-usage to the gcc warning flags list, but only if using a sufficiently recent version of gcc.

bfd * warning.m4 (GCC_WARN_CFLAGS): Only add -Wstack-usage if using a
sufficiently recent version of GCC.
* configure: Regenerate.

others * configure: Regenerate.

8 years agoFix problem where gold fails to issue an undefined symbol error during LTO.
Cary Coutant [Tue, 22 Mar 2016 02:07:55 +0000 (19:07 -0700)]
Fix problem where gold fails to issue an undefined symbol error during LTO.

During LTO, if (1) an IR file contains a COMDAT group that is kept,
(2) a later non-claimed file contains the same group, which we discard,
and (3) the plugin fails to provide a definition of the symbols in that
COMDAT group, gold silently resolves any references to those symbols
to 0.

This patch adds a check for a placeholder symbol when deciding
whether to issue an undefined symbol error. It also adds an extra
note after any undefined placeholder symbol error that explains
that a definition was expected from the plugin.

gold/
PR gold/19842
* errors.cc (Errors::undefined_symbol): Add info message when
symbol should have been provided by a plugin.
* target-reloc.h (issue_undefined_symbol_error): Check for
placeholder symbols defined in discarded sections.
* testsuite/Makefile.am (plugin_test_9b): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/plugin_test_9b_elf.cc: New test source file.
* testsuite/plugin_test_9b_ir.cc: New test source file.

8 years agoBinutils fails to build with -O0
Alan Modra [Tue, 22 Mar 2016 03:50:18 +0000 (14:20 +1030)]
Binutils fails to build with -O0

PR 19851
* plugin.c (try_load_plugin): Avoid -Wstack-usage warning.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Mar 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoarc/nps400: Add first nps400 instructions
Andrew Burgess [Tue, 15 Mar 2016 22:01:34 +0000 (22:01 +0000)]
arc/nps400: Add first nps400 instructions

Adds the first few nps400 instructions.

gas/ChangeLog:

* testsuite/gas/arc/nps400-0.d: New file.
* testsuite/gas/arc/nps400-0.s: New file.
* testsuite/gas/arc/nps400-1.d: New file.
* testsuite/gas/arc/nps400-1.s: New file.

include/ChangeLog:

* opcodes/arc.h (insn_class_t): Add BITOP type.

opcodes/ChangeLog:

* arc-nps400-tbl.h: New file.
* arc-opc.c: Add top level comment.
(insert_nps_3bit_dst): New function.
(extract_nps_3bit_dst): New function.
(insert_nps_3bit_src2): New function.
(extract_nps_3bit_src2): New function.
(insert_nps_bitop_size): New function.
(extract_nps_bitop_size): New function.
(arc_flag_operands): Add nps400 entries.
(arc_flag_classes): Add nps400 entries.
(arc_operands): Add nps400 entries.
(arc_opcodes): Add nps400 include.

8 years agoarc/opcodes: Use flag operand class to handle multiple flag matches
Andrew Burgess [Mon, 14 Mar 2016 22:17:47 +0000 (22:17 +0000)]
arc/opcodes: Use flag operand class to handle multiple flag matches

When parsing the operand instruction flags we don't currently detect the
case where multiple flags are provided from the same class set, these
will be accepted and the bit values merged together, resulting in the
wrong instruction being assembled.  For example:

    adc.n.eq r0,r0,r2

Will assemble without error, yet, upon disassembly, the instruction will
actually be:

    adc.c r0,r0,r2

In a later commit the concept of required flags will be introduced.
Required flags are just like normal instruction flags, except that they
must be present for the instruction to match.  Adding this will allow
for simpler instructions in the instruction table, and allow for more
sharing of operand extraction and insertion functions.

To solve both of the above issues (multiple flags being invalid, and
required flags), this commit reworks the flag class mechanism.
Currently the flag class is never used.  Each instruction can reference
multiple flag classes, each flag class has a class type and a set of
flags.  However, at present, the class type is never used.  The current
values identify the type of instruction that the flag will be used in,
but this is not required information.

Instead, this commit discards the old flag classes, and introduces 3 new
classes.  The first F_CLASS_NONE, is just a NULL marker value, and is
only used in the NULL marker flag class.  The other two flag classes are
F_FLAG_OPTIONAL, and F_FLAG_REQUIRED.

The class F_FLAG_OPTIONAL has the property that at most one of the flags
in the flag set for that class must be present in the instruction.  The
"at most" one means that no flags being present is fine.

The class F_FLAG_REQUIRED is not currently used, but will be soon.  With
this class, exactly one of the flags from this class must be present in
the instruction.  If the flag class contains a single flag, then of
course that flag must be present.  However, if the flag class contained
two or more, then one, and only one of them must be present.

gas/ChangeLog:

* config/tc-arc.c (find_opcode_match): Move lnflg, and i
declarations to start of block.  Reset code on all flags before
attempting to match them.  Handle multiple hits on the same flag.
Handle flag class.
* testsuite/gas/arc/asm-errors.d: New file.
* testsuite/gas/arc/asm-errors.err: New file.
* testsuite/gas/arc/asm-errors.s: New file.

include/ChangeLog:

* opcode/arc.h (flag_class_t): Remove all old flag classes, add 3
new classes instead.

opcodes/ChangeLog:

* arc-opc.c (arc_flag_classes): Convert all flag classes to use
the new class enum values.

8 years agoarc: Add nps400 machine type, and assembler flag.
Andrew Burgess [Tue, 15 Mar 2016 21:51:50 +0000 (21:51 +0000)]
arc: Add nps400 machine type, and assembler flag.

This commit introduces the nps400 machine type as a variant of arc.
There's a new flag in the assembler to select this machine type.  All
other changes are just adding handling of the new machine type into the
relevant places.

The nps400 is an arc700 variant with some vendor specific instructions
added into the instruction set.  This commit does not add any of the new
instructions, this is just laying the groundwork for future commits.
However, in preparation for these new instructions a new opcode define for
nps400 has been added to include/opcode/arc.h, this new opcode define is
used in the assembler and disassembler along with the existing define
for arc700 such that when assembling and disassembling for nps400 the
user will have access to all arc700 instructions and all the nps400
vendor extension instructions.

bfd/ChangeLog:

* archures.c (bfd_mach_arc_nps400): Define.
* bfd-in2.h: Regenerate.
* cpu-arc.c (arch_info_struct): New entry for nps400, renumber
some existing entries to make space.
* elf32-arc.c (arc_elf_object_p): Add nps400 case.
(arc_elf_final_write_processing): Likewise.

binutils/ChangeLog:

* readelf.c (decode_ARC_machine_flags): Handle nps400.

gas/ChangeLog:

* config/tc-arc.c (cpu_types): Add nps400 entry.
(check_zol): Handle nps400.

include/ChangeLog:

* elf/arc.h (E_ARC_MACH_NPS400): Define.
* opcode/arc.h (ARC_OPCODE_NPS400): Define.

opcodes/ChangeLog:

* arc-dis.c (print_insn_arc): Handle nps400.

8 years agoarc: Remove EF_ARC_CPU_GENERIC constant.
Andrew Burgess [Tue, 15 Mar 2016 21:38:30 +0000 (21:38 +0000)]
arc: Remove EF_ARC_CPU_GENERIC constant.

The constant EF_ARC_CPU_GENERIC is defined in the include/elf/arc.h
file, and is used in a few places in binutils, however, this constant
should never make it into the elf header flags; we always set a valid
cpu type in the assembler, which should then be copied over during
linking.

There are some non-gnu arc compilers that don't write an architecture
type into the e_flags field, instead leaving the field as 0, which is
the EF_ARC_CPU_GENERIC value.  This non-gnu compiler uses the machine
type to distinguish between the old and newer arc architectures, setting
the machine type to EM_ARC_COMPACT for old arc600, arc601, and arc700
architectures, while using EM_ARC_COMPACT2 for newer arcem and archs
architectures.

Previously when displaying the machine flags for an older EM_ARC_COMPACT
machine, if the e_flags had not been filled in, then we relied on the
default case statement to display the message "Generic ARCompact", while
in the EM_ARC_COMPACT2 case we specifically handled EF_ARC_CPU_GENERIC
to print "ARC Generic", leaving the default case to print a message
about unrecognised cpu flag.

After this commit EF_ARC_CPU_GENERIC has been removed, for both machine
types EM_ARC_COMPACT and EM_ARC_COMPACT2 we now rely on the default case
statement to handle the situation where the e_flags has not been filled
in.  The message displayed is now "Unknown ARCompact" (for older arc
architectures) and "Unknown ARC" (for the newer architectures).  The
switch from "Generic" to "Unknown" in the message string is for clarity,
calling the file "Generic" can give the impression that the file is
compiled for a common sub-set of the architectures, and would therefore
run on any type of machine (or at least any type of new or old machine
depending on if the machine type is ARC or ARCv2).  However, this was
not what "Generic" meant, it really meant "Unknown", so that's what we
now say.

As part of the merging of the readelf flag reading code, I have unified
the strings used in displaying the ELF ABI.  This means that for older
arc machines (arc600, arc601, and arc700) the string used for the
original ABI, and ABIv2 have changed, the current ABIv3 remains the
same.  For the newer architectures (arcem and archs) the abi strings
remain unchanged in all cases.

bfd/ChangeLog:

* elf32-arc.c (arc_elf_print_private_bfd_data): Remove use of
EF_ARC_CPU_GENERIC.
(arc_elf_final_write_processing): Don't bother setting cpu field
in e_flags, this will have been set elsewhere.

binutils/ChangeLog:

* readelf.c (get_machine_flags): Move arc processing into...
(decode_ARC_machine_flags): ... new function.  Remove use of
EF_ARC_CPU_GENERIC, change default case from "generic arc" to
"unknown arc".  Merged ABI printing between two machine types.

gas/ChangeLog:

* config/tc-arc.c (arc_select_cpu): Remove use of
EF_ARC_CPU_GENERIC.

include/ChangeLog:

* elf/arc.h (EF_ARC_CPU_GENERIC): Delete.  Update related comment.

8 years agoarc: Remove duplicated constant in include/elf/arc.h
Andrew Burgess [Tue, 15 Mar 2016 19:09:23 +0000 (19:09 +0000)]
arc: Remove duplicated constant in include/elf/arc.h

In the include/elf/arc.h there are two constants that mask out the
machine architecture field.  One is used lots (EF_ARC_MACH_MSK), the
other is used only once (EF_ARC_MACH).  Remove EF_ARC_MACH.

bfd/ChangeLog:

* elf32-arc.c (arc_elf_final_write_processing): Switch to using
EF_ARC_MACH_MSK.

include/ChangeLog:

* elf/arc.h (EF_ARC_MACH): Delete.
(EF_ARC_MACH_MSK): Remove out of date comment.

8 years agoarc/gas: default mach is arc700, initialised in md_begin
Andrew Burgess [Tue, 1 Mar 2016 11:41:12 +0000 (11:41 +0000)]
arc/gas: default mach is arc700, initialised in md_begin

This commit restructures the selection of the default cpu/mach so that
the choice is made from md_begin (if the user has not provided a command
line choice).  This will reduce the amount of change needed in a later
patch.

At the request of Synopsys, the default architecture changes to ARC700
from this commit, previously the default was a non-existent
super-architecture that contained all instructions from all arc
variants.  There's some clean up associated with removing the default
merged architecture, and a small test fix now that the default is
ARC700.

binutils/ChangeLog:

* testsuite/binutils-all/objdump.exp (cpus_expected): Add ARC700
to the architecture list.

gas/ChangeLog:

* config/tc-arc.c (arc_target): Delay initialisation until
arc_select_cpu.
(arc_target_name): Likewise.
(arc_features): Likewise.
(arc_mach_type): Likewise.
(cpu_types): Remove "all" entry.
(arc_select_cpu): New function, most of the content is from...
(md_parse_option): ... here.  Call new arc_select_cpu.
(md_begin): Call arc_select_cpu if needed, default is now arc700.

include/ChangeLog:

* opcode/arc.h (ARC_OPCODE_BASE): Delete.

opcodes/ChangeLog:

* arc-opc.c (BASE): Delete.

8 years agogas/arc: Fix test for big-endian arc
Andrew Burgess [Tue, 15 Mar 2016 22:38:41 +0000 (22:38 +0000)]
gas/arc: Fix test for big-endian arc

The inline-data test checks the specific bytes laid down by the
assembler, and so relies on the endianness of the target.  I could
change the expected results to be endian agnostic, however, I worried
that a bug in the assembler that gets the endianness wrong would then
slip through.  Instead I add a new test for big-endian arc, and restrict
the existing test to little-endian arc.

gas/ChangeLog:

* testsuite/gas/arc/inline-data-1.d: Add target restriction.
* testsuite/gas/arc/inline-data-2.d: New file.

8 years agoRemove use of alloca.
Nick Clifton [Mon, 21 Mar 2016 16:31:46 +0000 (16:31 +0000)]
Remove use of alloca.

bfd * warning.m4 (GCC_WARN_CFLAGS): Add -Wstack-usage=262144
* configure: Regenerate.
* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Replace use of
alloca with call to xmalloc.
* elf32-nds32.c: Likewise.
* elf64-hppa.c: Likewise.
* elfxx-mips.c: Likewise.
* pef.c: Likewise.
* pei-x86_64.c: Likewise.
* som.c: Likewise.
* xsym.c: Likewise.

binutils * dlltool.c: Replace use of alloca with call to xmalloc.
* dllwrap.c: Likewise.
* nlmconv.c: Likewise.
* objdump.c: Likewise.
* resrc.c: Likewise.
* winduni.c: Likewise.
* configure: Regenerate.

gas * atof-generic.c: Replace use of alloca with call to xmalloc.
* cgen.c: Likewise.
* dwarf2dbg.c: Likewise.
* macro.c: Likewise.
* remap.c: Likewise.
* stabs.c: Likewise.
* symbols.c: Likewise.
* config/obj-elf.c: Likewise.
* config/tc-aarch64.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-avr.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-mips.c: Likewise.
* config/tc-msp430.c: Likewise.
* config/tc-nds32.c: Likewise.
* config/tc-ppc.c: Likewise.
* config/tc-sh.c: Likewise.
* config/tc-tic30.c: Likewise.
* config/tc-tic54x.c: Likewise.
* config/tc-xstormy16.c: Likewise.
* config/te-vms.c: Likewise.
* configure: Regenerate.

ld * emultempl/msp430.em: Replace use of alloca with call to xmalloc.
* plugin.c: Likewise.
* pe-dll.c: Likewise.

8 years agoARM process record: median instructions
Yao Qi [Mon, 21 Mar 2016 10:41:38 +0000 (10:41 +0000)]
ARM process record: median instructions

This patch is to support some ARM median instructions in process
record.  With this patch applied, these fails are fixed:

 -FAIL: gdb.reverse/break-precsave.exp: run to end of main
 -FAIL: gdb.reverse/break-precsave.exp: go to end of main forward
 -FAIL: gdb.reverse/break-precsave.exp: end of record log
 -FAIL: gdb.reverse/break-reverse.exp: continue to breakpoint: end
 -FAIL: gdb.reverse/break-reverse.exp: end of record log
 -FAIL: gdb.reverse/until-precsave.exp: run to end of main
 -FAIL: gdb.reverse/until-precsave.exp: advance to marker2
 -FAIL: gdb.reverse/until-precsave.exp: until func, not called by current frame
 -FAIL: gdb.reverse/until-precsave.exp: reverse-advance to marker2
 -FAIL: gdb.reverse/until-precsave.exp: reverse-finish from marker2
 -FAIL: gdb.reverse/until-precsave.exp: reverse-advance to final return of factorial
 -FAIL: gdb.reverse/until-precsave.exp: reverse-until to entry of factorial
 -FAIL: gdb.reverse/until-reverse.exp: advance to marker2
 -FAIL: gdb.reverse/until-reverse.exp: until func, not called by current frame
 -FAIL: gdb.reverse/until-reverse.exp: reverse-advance to marker2
 -FAIL: gdb.reverse/until-reverse.exp: reverse-finish from marker2
 -FAIL: gdb.reverse/until-reverse.exp: reverse-advance to final return of factorial
 -FAIL: gdb.reverse/until-reverse.exp: reverse-until to entry of factorial

gdb:

2016-03-21  Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c (arm_record_media): New.
(arm_record_ld_st_reg_offset): Call arm_record_media.

8 years agoCanonicalize more arm linux syscalls
Yao Qi [Mon, 21 Mar 2016 10:22:59 +0000 (10:22 +0000)]
Canonicalize more arm linux syscalls

This patch is to canonicalize more syscalls on arm linux in process
record.  In this patch, I also comment out some syscalls which isn't
handled by GDB now.  With this patch applied, two fails are fixed.

-FAIL: gdb.reverse/fstatat-reverse.exp: continue to breakpoint: marker2
-FAIL: gdb.reverse/recvmsg-reverse.exp: continue to breakpoint: marker2

gdb:

2016-03-21  Yao Qi  <yao.qi@linaro.org>

* arm-linux-tdep.c (arm_canonicalize_syscall): Canonicalize
more syscalls.

8 years agoFix problem where gold cannot build .eh_frame_hdr from ld -r output.
Cary Coutant [Mon, 21 Mar 2016 02:15:56 +0000 (19:15 -0700)]
Fix problem where gold cannot build .eh_frame_hdr from ld -r output.

When running ld -r on objects that have comdat groups, when gold
deduplicates a function in a comdat group, it removes the relocations
from the EH information that referred to the dropped copy of the function.
When running a final link using the result of the -r link, the missing
relocation cause it to fail to recognize the FDE for the dropped
function.

This patch improves gold's FDE scanning to take into account the
possibility that an FDE corresponds to a dropped function, and drops
that FDE as well.

Gnu ld, on the other hand, leaves the relocations in the ld -r output,
but makes them R_NONE with an r_sym field of 0. This was sufficient to
let both linkers recognize the FDE properly.

With this fix, if you do an ld -r with gold, then do the final link with
Gnu ld, the .eh_frame_hdr section will not be generated. To make it work
with Gnu ld, we would have to leave the R_NONE relocations in, but I
think it's better to drop the relocations entirely. I'd hope that if
you're doing a -r link with gold, you'll also do the final link with
gold.

gold/
PR gold/19002
* ehframe.cc (Eh_frame::read_fde): Check for dropped functions.
* testsuite/Makefile.am (eh_test_2): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/eh_test_2.sh: New test script.
* testsuite/eh_test_a.cc (bar): Make it comdat.
* testsuite/eh_test_b.cc (bar): Add a duplicate copy.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Mar 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agotc-i386.c: store encoded instructions in unsigned char[]
Trevor Saunders [Sun, 14 Feb 2016 19:41:38 +0000 (14:41 -0500)]
tc-i386.c: store encoded instructions in unsigned char[]

char can be a signed type, and some of the values in these arrays are greater
than 0x80 which means they are outside of the range a signed char can store.
Fortunately it seems most compilers handle this in the obvious way by storing
the same bits as a negative number, but this is wierd and easily fixed.

gas/ChangeLog:

2016-03-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* tc-i386.c (f32_1): Change type to unsigned char[].
(f32_2): Likewise.
(f32_3): Likewise.
(f32_4): Likewise.
(f32_5): Likewise.
(f32_6): Likewise.
(f32_7): Likewise.
(f32_8): Likewise.
(f32_9): Likewise.
(f32_10): Likewise.
(f32_11): Likewise.
(f32_12): Likewise.
(f32_13): Likewise.
(f32_14): Likewise.
(f16_3): Likewise.
(f16_4): Likewise.
(f16_5): Likewise.
(f16_6): Likewise.
(f16_7): Likewise.
(f16_8): Likewise.
(jump_31): Likewise.
(f32_patt): Likewise.
(f16_patt): Likewise.
(alt_3): Likewise.
(alt_4): Likewise.
(alt_5): Likewise.
(alt_6): Likewise.
(alt_7): Likewise.
(alt_8): Likewise.
(alt_9): Likewise.
(alt_10): Likewise.
(alt_patt): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Mar 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Mar 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoRemove is_n64_ data member from Mips_relobj class.
Vladimir Radosavljevic [Fri, 18 Mar 2016 21:54:35 +0000 (14:54 -0700)]
Remove is_n64_ data member from Mips_relobj class.

elfcpp/
* mips.h (abi_64): Remove.

gold/
* mips.cc (Mips_relobj::is_n64_): Remove.
(Target_mips::ei_class_): Likewise.
(Mips_relobj::is_newabi): Call methods.
(Mips_relobj::is_n64): Change checking for N64 ABI.
(Target_mips::is_output_n64): Likewise.
(Target_mips::merge_processor_specific_flags): Remove ei_class
argument, and remove comparing ei_class.
(Target_mips::do_adjust_elf_header): Remove setting EI_CLASS field
of the ELF header.
(Target_mips::do_finalize_sections): Don't pass ei_class argument
to merge_processor_specific_flags.
(Target_mips::elf_mips_abi_name): Remove ei_class argument, and
change checking for N64 ABI.

8 years agoUpdate description of AArch64 assembler directives.
Nick Clifton [Fri, 18 Mar 2016 17:30:12 +0000 (17:30 +0000)]
Update description of AArch64 assembler directives.

gas * doc/c-aarch64.texi (AArch64 Directives): Add descriptions of
.cpu, .dword, .even, .inst. .tlsdescadd, .tlsdesccall,
.tlsdescldr and .xword directives.

8 years agoFix thinko in new GET_VEC_ELEMENT macro.
Nick Clifton [Fri, 18 Mar 2016 17:08:27 +0000 (17:08 +0000)]
Fix thinko in new GET_VEC_ELEMENT macro.

* cpustate.c: (GET_VEC_ELEMENT): And fix thinko using macro arguments.

8 years agoFix the disassembly of the AArch64's OOR instruction as a MOV instruction.
Nick Clifton [Fri, 18 Mar 2016 17:02:20 +0000 (17:02 +0000)]
Fix the disassembly of the AArch64's OOR instruction as a MOV instruction.

PR target/19721
opcodes * aarch64-tbl.h (aarch64_opcode_table): Fix type of second operand
of MOV insn that aliases an ORR insn.

gas * testsuite/gas/aarch64/pr19721.s: New test source file.
* testsuite/gas/aarch64/pr19721.d: New test driver file.

8 years agoMake sparc_software_single_step static
Yao Qi [Fri, 18 Mar 2016 15:01:47 +0000 (15:01 +0000)]
Make sparc_software_single_step static

sparc_software_single_step is not used out of sparc-tdep.c, so this
patch makes it static.

gdb:

2016-03-18  Yao Qi  <yao.qi@linaro.org>

* sparc-tdep.c (sparc_software_single_step): Make it static.
* sparc-tdep.h (sparc_software_single_step): Remove declaration.

8 years agoFix code to check for illegal element numbers when accessing AArch64 vector registers...
Nick Clifton [Fri, 18 Mar 2016 14:44:27 +0000 (14:44 +0000)]
Fix code to check for illegal element numbers when accessing AArch64 vector registers in AArch64 sim.

* cpustate.c (GET_VEC_ELEMENT): Fix off by one error checking
for an invalid element index.
(SET_VEC_ELEMENT): Likewise.

8 years ago[spu] throw error when target_read_memory fails
Yao Qi [Fri, 18 Mar 2016 14:39:09 +0000 (14:39 +0000)]
[spu] throw error when target_read_memory fails

I happen to see that 1 is returned in spu_software_single_step when
target_read_memory returns 1.  It must be wrong.  That patch changes
it to throwing an error.  Note that I choose to throw error because I
find the code in the end of spu_software_single_step throws errors.

gdb:

2016-03-18  Yao Qi  <yao.qi@linaro.org>

* spu-tdep.c (spu_software_single_step): Throw error when
target_read_memory fails.

8 years agoCheck lwp_signal_can_be_delivered for enqueue/dequeue pending signals
Yao Qi [Fri, 18 Mar 2016 14:34:37 +0000 (14:34 +0000)]
Check lwp_signal_can_be_delivered for enqueue/dequeue pending signals

The enqueue and dequeue signals in linux_resume_one_lwp_throw use one
condition and its inverted one.  This patch is to move the condition
into a function lwp_signal_can_be_delivered, so that the next patch can
change the condition in one place.

gdb/gdbserver:

2016-03-18  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (lwp_signal_can_be_delivered): New function.
(linux_resume_one_lwp_throw): Use lwp_signal_can_be_delivered.

8 years agoSet signal to 0 after enqueue_pending_signal
Yao Qi [Fri, 18 Mar 2016 14:31:40 +0000 (14:31 +0000)]
Set signal to 0 after enqueue_pending_signal

Today, we enqueue signal in linux_resume_one_lwp_throw, but set
variable 'signal' many lines below with the comment

      /* Postpone any pending signal.  It was enqueued above.  */
      signal = 0;

I feel difficult to associate code across many lines, and we should
move the code close to enqueue_pending_signal call.  This is what
this patch does in general.  After this change, variable 'signal'
is set to zero very early, so the 'signal' value in the following
debugging message makes no sense, so I remove it from the debugging
message.  The function returns early if lwp->status_pending_p is
true, so 'signal' value in the debugging message doesn't matter,
AFAICS.  Also, I move one debugging message several lines below to
make it close the real ptrace call,

  if (debug_threads)
    debug_printf ("Resuming lwp %ld (%s, signal %d, stop %s)\n",
  lwpid_of (thread), step ? "step" : "continue", signal,
  lwp->stop_expected ? "expected" : "not expected");

so that the debugging message can reflect what GDBserver does.  This
is a code refactor and only debugging messages are affected.

gdb/gdbserver:

2016-03-18  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_resume_one_lwp_throw): Set 'signal' to
0 if signal is enqueued.  Remove 'signal' from one debugging
message.  Move one debugging message to some lines below.
Remove code setting 'signal' to 0.

8 years agoRemove redundant WIFSTOPPED check
Yao Qi [Fri, 18 Mar 2016 14:28:14 +0000 (14:28 +0000)]
Remove redundant WIFSTOPPED check

WIFSTOPPED is checked linux_wstatus_maybe_breakpoint, so WIFSTOPPED
in "WIFSTOPPED (wstat) && linux_wstatus_maybe_breakpoint (wstat)"
is redundant.  This patch removes WIFSTOPPED check.

gdb/gdbserver:

2016-03-18  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_low_filter_event): Remove redundant
WIFSTOPPED check together with linux_wstatus_maybe_breakpoint.

8 years agoRemove spurious empty line in changelog entry.
Nick Clifton [Fri, 18 Mar 2016 13:09:03 +0000 (13:09 +0000)]
Remove spurious empty line in changelog entry.

8 years agoFix generation of as.1 manual page so that it can be converted to DocBook format.
Nick Clifton [Fri, 18 Mar 2016 13:07:33 +0000 (13:07 +0000)]
Fix generation of as.1 manual page so that it can be converted to DocBook format.

gas * doc/as.texinfo: Place the target specific command line options
into their own man page section.

etc * texi2pod.pl: Add TARGET to the list of recognised man page
sections.

8 years agoEnsure that the .rdata_pseudo_runtime_reloc sections are not discarded by gabage...
Awson [Fri, 18 Mar 2016 11:45:43 +0000 (11:45 +0000)]
Ensure that the .rdata_pseudo_runtime_reloc sections are not discarded by gabage collection.

PR 19531
* scripttempl/pe.sc (.rdata_runtime_pseudo_reloc): Always KEEP
this section.
* scripttempl/pep.sc (.rdata_runtime_pseudo_reloc): Likewise.

8 years agoFix possible failure in the AVR linker tests.
Senthil Kumar Selvaraj [Fri, 18 Mar 2016 09:51:47 +0000 (09:51 +0000)]
Fix possible failure in the AVR linker tests.

* ld-avr/gc-section-debugline.d: Relax regex check for CU.

8 years agoAdd simulation of MUL and NEG instructions to AArch64 simulator.
Nick Clifton [Fri, 18 Mar 2016 09:32:32 +0000 (09:32 +0000)]
Add simulation of MUL and NEG instructions to AArch64 simulator.

* cpustate.c: Remove spurious spaces from TRACE strings.
Print hex equivalents of floats and doubles.
Check element number against array size when accessing vector
registers.
* memory.c: Trace memory reads when --trace-memory is enabled.
Remove float and double load and store functions.
* memory.h (aarch64_get_mem_float): Delete prototype.
(aarch64_get_mem_double): Likewise.
(aarch64_set_mem_float): Likewise.
(aarch64_set_mem_double): Likewise.
* simulator (IS_SET): Always return either 0 or 1.
(IS_CLEAR): Likewise.
(fldrs_pcrel): Load and store floats using 32-bit memory accesses
and doubles using 64-bit memory accesses.
(fldrd_pcrel, fldrs_wb, fldrs_abs, fldrs_scale_ext): Likewise.
(fldrd_wb, fldrd_abs, fsturs, fsturd, fldurs, fldurd): Likewise.
(fstrs_abs, fstrs_wb, fstrs_scale_ext, fstrd_abs): Likewise.
(fstrd_wb, fstrd_scale_ext, store_pair_float): Likewise.
(store_pair_double, load_pair_float, load_pair_double): Likewise.
(do_vec_MUL_by_element): New function.
(do_vec_op2): Call do_vec_MUL_by_element.
(do_scalar_NEG): New function.
(do_double_add): Call do_scalar_NEG.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Mar 2016 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd mips and s390 build targets for gold.
Cary Coutant [Thu, 17 Mar 2016 22:37:10 +0000 (15:37 -0700)]
Add mips and s390 build targets for gold.

* configure.ac: Add mips and s390 to the gold target check.
* configure: Regenerate.

8 years agoAdd MIPS-64 support.
Vladimir Radosavljevic [Thu, 17 Mar 2016 22:07:49 +0000 (15:07 -0700)]
Add MIPS-64 support.

gold/
* mips.cc (enum Special_relocation_symbol): New enum type.
(is_readonly_section): New function.
(eh_reloc): Likewise.
(Mips_got_entry::is_section_symbol_): New member.
(Mips_got_entry::is_section_symbol): New method.
(Mips_got_info::record_local_got_symbol): Add is_section_symbol
argument.
(Mips_relobj::mips_elf_options_section_name): New method.
(Mips_output_data_got::record_local_got_symbol): Add
is_section_symbol argument, and pass it to
Mips_got_info::record_local_got_symbol.
(Mips_output_data_got::got_offset): Add addend argument, and pass
it to Relobj::local_got_offset.
(struct Mips_output_reloc_writer): New type.
(class Mips_output_data_reloc): New class.
(Mips_output_data_plt::Reloc_section): Change type to
Mips_output_data_reloc.
(Target_mips::Reloc_section): Likewise.
(Mips_reloc_types::get_r_addend): Remove unsigned from return type.
(Mips_classify_reloc::get_r_type2): New method.
(Mips_classify_reloc::get_r_type3): Likewise.
(Mips_classify_reloc::get_r_ssym): Likewise.
(Target_mips::Reloca_section): Remove.
(Relocate::should_apply_static_reloc): Rename from
should_apply_r_mips_32_reloc.
(Target_mips::copy_reloc): Replace Reltype parameter with r_type
and r_offset.
(Mips_relocate_functions::Valtype): New type.
(Mips_relocate_functions::Valtype64): New type.
(Mips_relocate_functions::check_overflow): New method.
(Mips_relocate_functions::mips_reloc_unshuffle): Move to public
interface.
(Mips_relocate_functions::mips_reloc_shuffle): Likewise.
(Mips_relocate_functions::rel16): Add support for resolving
relocations for Mips64.
(Mips_relocate_functions::rel32): Likewise.
(Mips_relocate_functions::reljalr): Likewise.
(Mips_relocate_functions::relpc32): Likewise.
(Mips_relocate_functions::rel26): Likewise.
(Mips_relocate_functions::relpc16): Likewise.
(Mips_relocate_functions::relmicromips_pc7_s1): Likewise.
(Mips_relocate_functions::relmicromips_pc10_s1): Likewise.
(Mips_relocate_functions::relmicromips_pc16_s1): Likewise.
(Mips_relocate_functions::do_relhi16): Likewise.
(Mips_relocate_functions::do_relgot16_local): Likewise.
(Mips_relocate_functions::rello16): Likewise.
(Mips_relocate_functions::relgot): Likewise.
(Mips_relocate_functions::relgotpage): Likewise.
(Mips_relocate_functions::relgotofst): Likewise.
(Mips_relocate_functions::relgot_hi16): Likewise.
(Mips_relocate_functions::relgot_lo16): Likewise.
(Mips_relocate_functions::relgprel): Likewise.
(Mips_relocate_functions::relgprel32): Likewise.
(Mips_relocate_functions::tlsrelhi16): Likewise.
(Mips_relocate_functions::tlsrello16): Likewise.
(Mips_relocate_functions::tlsrel32): Likewise.
(Mips_relocate_functions::relsub): Likewise.
(Mips_relocate_functions::releh): New method.
(Mips_relocate_functions::rel64): Likewise.
(Mips_got_info::record_local_got_symbol): Add is_section_symbol and
pass it to Mips_got_entry.
(Mips_got_info::add_local_entries): Pass addend argument
to code functions, and for STT_SECTION symbols call
add_symbolless_local_addend.
(Mips_got_info::add_tls_entries): Pass addend argument to code
functions.
(Mips_relobj::do_read_symbols): Read gp value that was used to
create object.
(Mips_output_data_plt::plt_entry): Remove opcode from l[wd]
instruction. Opcode for instruction will be selected later.
(Target_mips::gc_process_relocs): Add case for SHT_RELA.
(Target_mips::scan_relocatable_relocs): Likewise.
(Target_mips::emit_relocs_scan): Likewise.
(Target_mips::relocate_relocs): Likewise.
(Target_mips::do_finalize_sections): Skip objects for merging
processor specific flags in which all input sections will be
discarded.
(mips_get_size_for_reloc): Add case for R_MIPS_EH.
(Target_mips::Scan::get_reference_flags): Likewise.
(Target_mips::relocate_special_relocatable): Call rel26 method with
calculate_only and calculated_value arguments.
(Target_mips::Scan::local): Add case for R_MIPS_EH. Don't create a
dynamic relocation against a readonly sections, and pass
is_section_symbol to Mips_got_info::record_local_got_symbol.
(Target_mips::Scan::global): Add case for R_MIPS_EH. Don't create a
dynamic relocation against a readonly sections, and pass r_type
and r_offset to Target_mips::copy_reloc.
(Target_mips::Relocate::relocate): Add support for resolving
relocations for Mips64.
(Target_mips::mips_info): Add case for Mips64 default dynamic
linker name.
(Target_selector_mips): Correct emulation names.

8 years agoAdd missing Mips_output_data_la25_stub::do_print_to_mapfile.
Vladimir Radosavljevic [Thu, 17 Mar 2016 21:27:48 +0000 (14:27 -0700)]
Add missing Mips_output_data_la25_stub::do_print_to_mapfile.

gold/
* mips.cc (class Mips_output_data_la25_stub): Add
do_print_to_mapfile function.

8 years agoFix problem with --emit-relocs for Mips-32.
Vladimir Radosavljevic [Thu, 17 Mar 2016 20:28:34 +0000 (13:28 -0700)]
Fix problem with --emit-relocs for Mips-32.

gold/
* mips.cc (Mips_classify_reloc::put_r_info): Call 32bit version of
elf_r_info.

8 years agoSuggest running gdbserver for a PID in container
Jan Kratochvil [Thu, 17 Mar 2016 17:17:30 +0000 (18:17 +0100)]
Suggest running gdbserver for a PID in container

currently
gdb -p <pid from a container>
will print:
warning: Target and debugger are in different PID namespaces; thread lists and other data are likely unreliable

It correctly states the problem but it does not say how to solve it.

Originally I wanted to suggest also the Docker "-p 1234:1234" parameter but
I see the containers are more general topic than just Docker (even LxC etc.).

According to Gary future GDBs should be able to work even without gdbserver.
But currently gdbserver is still required.

gdb/ChangeLog
2016-03-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

* linux-thread-db.c (check_pid_namespace_match): Extend the message.

8 years agoPR remote/19496, timeout in forking-threads-plus-bkpt
Pedro Alves [Thu, 17 Mar 2016 10:21:37 +0000 (10:21 +0000)]
PR remote/19496, timeout in forking-threads-plus-bkpt

This patch addresses a failure in
gdb.threads/forking-threads-plus-breakpoint.exp:

FAIL: gdb.threads/forking-threads-plus-breakpoint.exp: cond_bp_target=1:
detach_on_fork=on: inferior 1 exited (timeout)

Cause:

A fork event was reported to GDB before GDB knew about the parent
thread, followed immediately by a breakpoint event in a different
thread.  The parent thread was subsequently added via
remote_notice_new_inferior in process_stop_reply, but when the thread
was added the thread_info.state was set to THREAD_STOPPED.  The fork
event was then handled correctly, but when the fork parent was resumed
via a call to keep_going, the state was unchanged.

The breakpoint event was then handled, which caused all the
non-breakpoint threads to be stopped.  When the breakpoint thread was
resumed, all the non-breakpoint threads were resumed via
infrun.c:restart_threads.  Our old fork parent wasn't restarted,
because it still had thread_info.state set to THREAD_STOPPED.
Ultimately the program under debug hung waiting for a pthread_join
while the old fork parent was stopped forever by GDB.

Fix:

Since this is non-stop, then the bug is that the thread should have
been added in THREAD_RUNNING state.  Consider that infrun may be
pulling target events out of the target_ops backend into its own event
queue, but, not process them immediately.  E.g., infrun may be
stopping all threads temporarily for a step-over-breakpoint operation
for thread A (stop_all_threads).  The waitstatus of all threads is
thus left pending in the thread structure (save_status), including the
fork event of thread B.  Right at this point, if the user does "info
threads", that should show thread B (the fork parent) running, not
stopped, even if internally, gdb is holding it paused for a little
bit.

Thus if in non-stop mode, always add new threads in the external
user-visible THREAD_RUNNING state.  Change remote_notice_new_inferior
to accept the internal executing state of the thread instead, with
EXECUTING set to 1 when we discover a thread that is running on the
target (such as through remote_update_thread_list), and 0 when the
thread is really paused (such as when we see a stop reply).

Tested on x86_64 Linux and Nios II Linux target with x86 Linux host.

gdb/ChangeLog:
2016-03-17  Pedro Alves  <palves@redhat.com>
    Don Breazeal  <donb@codesourcery.com>

PR remote/19496
* infcmd.c (notice_new_inferior): Use the 'leave_running' argument
instead of checking the 'non_stop' global.
* remote.c (remote_add_thread): New parameter 'executing'.  Use it
to set the new thread's executing state.
(remote_notice_new_inferior): Rename parameter 'running' to
'executing'.  Always set the thread state to THREAD_RUNNING in
non-stop mode, and to THREAD_STOPPED in all-stop mode.  Pass
EXECUTING to remote_add_thread and notice_new_inferior.
(remote_update_thread_list): Update to pass executing state, not
running state.

8 years agoS390: Add syscall info for syscalls up to 374
Andreas Arnez [Thu, 17 Mar 2016 09:55:55 +0000 (10:55 +0100)]
S390: Add syscall info for syscalls up to 374

Represent new Linux syscalls for s390 and s390x in GDB's syscall info.
Add the syscalls from 355 (userfaultfd) up to 374 (mlock2) as well as
the previously reserved NUMA syscalls 268-270, 287, and 310.

gdb/ChangeLog:

* syscalls/s390-linux.xml: Add NUMA syscalls and new syscalls up
to 374.
* syscalls/s390x-linux.xml: Likewise.

8 years agoS390: Fix output path for s390-multiarch test case
Andreas Arnez [Thu, 17 Mar 2016 09:55:55 +0000 (10:55 +0100)]
S390: Fix output path for s390-multiarch test case

Since test artifacts are organized in a directory hierarchy, the
s390-multiarch test case is not executed correctly any more.  This is
because it uses an obsolete way of constructing the output paths.

This fix invokes standard_testfile instead.

gdb/testsuite/ChangeLog:

* gdb.arch/s390-multiarch.exp: Use standard_testfile instead of
maintaining separate logic for constructing the output path.

8 years agolinux-record: Simplify with record_mem_at_reg()
Andreas Arnez [Thu, 17 Mar 2016 08:58:57 +0000 (09:58 +0100)]
linux-record: Simplify with record_mem_at_reg()

The function record_linux_system_call() often records a memory area
whose address is contained in a register.  So far this required two
function calls: one for fetching the register value, and another one for
recording the memory area.  These two function calls are now merged into
a new local helper function, and all occurrences are adjusted.  This
reduces the source code and makes it more readable.

gdb/ChangeLog:

* linux-record.c (record_mem_at_reg): New helper function.
(record_linux_system_call): Exploit new helper function where
applicable.

8 years agolinux-record.c: Fix whitespace issues
Andreas Arnez [Thu, 17 Mar 2016 08:58:57 +0000 (09:58 +0100)]
linux-record.c: Fix whitespace issues

This patch changes whitespace only, fixing whitespace issues in
linux-record.c.

gdb/ChangeLog:

* linux-record.c: Fix whitespace issues; tabify, remove trailing
spaces.

8 years agolinux-record: Fix bad fall-through for pipe/pipe2
Andreas Arnez [Thu, 17 Mar 2016 08:58:56 +0000 (09:58 +0100)]
linux-record: Fix bad fall-through for pipe/pipe2

This patch added handling for some syscalls to linux-record.c:

  https://sourceware.org/ml/gdb-patches/2015-10/msg00452.html

But for both `pipe' and `pipe2' the patch lacks a statement after an
`if', such that the following `break' is interpreted as the `if'-body
instead.

This adds the missing (return-) statements for the conditionals.

gdb/ChangeLog:

* linux-record.c (record_linux_system_call): Add missing return
statements to handling of pipe and pipe2 syscalls.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Mar 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in