external/binutils.git
8 years agogdbserver: Fix C++ build errors in tracepoint.c
Marcin Kościelnicki [Thu, 31 Mar 2016 21:29:08 +0000 (23:29 +0200)]
gdbserver: Fix C++ build errors in tracepoint.c

These were introduced by 1cda1512689aabb36588a01370002632a0c8e560
and a13c46966d308297a1273e35ccc807a3912d573d .  One is a simple
missing cast, the other is const usage on global function pointers
exported from IPA: in C++, consts are static, and thus won't be
exported from the DSO (the build error was because of non-applicable
visibility("default")).

gdb/gdbserver/ChangeLog:

* tracepoint.c (gdb_collect_ptr): Remove const qualifier.
(get_raw_reg_ptr): Likewise.
(get_trace_state_variable_value_ptr): Likewise.
(set_trace_state_variable_value_ptr): Likewise.
(initialize_tracepoint): Cast alloc_jump_pad_buffer result to
char *.

8 years agoAdd regression test for PR gdb/19858 (JIT code registration on attach)
Pedro Alves [Thu, 31 Mar 2016 18:28:47 +0000 (19:28 +0100)]
Add regression test for PR gdb/19858 (JIT code registration on attach)

This test would fail without the previous gdb/jit.c fix:

  (gdb) attach 23031
  Attaching to program: .../build/gdb/testsuite/outputs/gdb.base/jit/jit-main, process 23031
  [...]
  207           WAIT_FOR_GDB; i = 0;  /* gdb break here 1 */
  (gdb) PASS: gdb.base/jit.exp: attach: one_jit_test-2: attach
  set var wait_for_gdb = 0
  (gdb) PASS: gdb.base/jit.exp: attach: one_jit_test-2: set var wait_for_gdb = 0
  info function ^jit_function
  All functions matching regular expression "^jit_function":
  (gdb) FAIL: gdb.base/jit.exp: attach: one_jit_test-2: info function ^jit_function

gdb/testsuite/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

PR gdb/19858
* gdb.base/jit-main.c: Include unistd.h.
(ATTACH): Define to 0 if not already defined.
(wait_for_gdb, mypid): New globals.
(WAIT_FOR_GDB): New macro.
(MAIN): Set an alarm.  Store the process's pid.  Wait for GDB at
some breakpoint locations.
* gdb.base/jit.exp (clean_reattach, continue_to_test_location):
New procedures.
(one_jit_test): Add REATTACH parameter, and handle it.  Use
continue_to_test_location.
(top level): Test attach, and adjusts calls to one_jit_test.

8 years agoMake gdb.base/jit.exp binaries unique
Pedro Alves [Thu, 31 Mar 2016 18:28:47 +0000 (19:28 +0100)]
Make gdb.base/jit.exp binaries unique

This testcase compiles the same program and library differently
multiple times using the same file names.  Make them unique, to make
it easier to debug test problems.

gdb/testsuite/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

PR gdb/19858
* gdb.base/jit.exp (compile_jit_test): Add intro comment.  Add
BINSUFFIX parameter, and handle it.
(top level): Adjust calls compile_jit_test.

8 years agoFix PR gdb/19858: GDB doesn't register the JIT libraries on attach
Yichao Yu [Thu, 31 Mar 2016 18:28:47 +0000 (19:28 +0100)]
Fix PR gdb/19858: GDB doesn't register the JIT libraries on attach

Ref: https://sourceware.org/ml/gdb/2016-03/msg00023.html

GDB currently fails to fetch the list of already-registered JIT
modules on attach.

Nothing is calling jit_inferior_init, which is what is responsible for
walking the JIT object list at init time.

Despite the misleading naming, jit_inferior_created_hook ->
jit_inferior_init is only called when the inferior execs.

This regressed with the fix for PR gdb/13431 (03bef283c2d3):
 https://sourceware.org/ml/gdb-patches/2012-02/msg00023.html which
removed the inferior_created (jit_inferior_created_observer)
observer.

Adding an inferior_created observer back fixes the issue.

In turn, this exposes a bug in jit_breakpoint_re_set_internal as well,
which is returning the wrong result when we already have the
breakpoint at the right address.

gdb/ChangeLog:
2016-03-31  Yichao Yu  <yyc1992@gmail.com>

PR gdb/19858
* jit.c (jit_breakpoint_re_set_internal): Return 0 if we already
got the breakpoint at the right address.
(jit_inferior_created): New function.
(_initialize_jit): Install jit_inferior_created as
inferior_created observer.

Signed-off-by: Pedro Alves <palves@redhat.com>
8 years agogdb/NEWS: Add mention of powerpc*-linux tracepoints.
Marcin Kościelnicki [Thu, 31 Mar 2016 13:49:25 +0000 (15:49 +0200)]
gdb/NEWS: Add mention of powerpc*-linux tracepoints.

gdb/ChangeLog:

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

8 years agogdbserver: Add emit_ops for powerpc.
Marcin Kościelnicki [Mon, 14 Mar 2016 16:29:09 +0000 (17:29 +0100)]
gdbserver: Add emit_ops for powerpc.

gdb/gdbserver/ChangeLog:

2016-03-31  Wei-cheng Wang  <cole945@gmail.com>
    Marcin Kościelnicki  <koriakin@0x04.net>

PR/17221
* linux-ppc-low.c (emit_insns): New function.
(__EMIT_ASM, _EMIT_ASM, EMIT_ASM): New macros.
(ppc_emit_prologue): New function.
(ppc_emit_epilogue): New function.
(ppc_emit_add): New function.
(ppc_emit_sub): New function.
(ppc_emit_mul): New function.
(ppc_emit_lsh): New function.
(ppc_emit_rsh_signed): New function.
(ppc_emit_rsh_unsigned): New function.
(ppc_emit_ext): New function.
(ppc_emit_zero_ext): New function.
(ppc_emit_log_not): New function.
(ppc_emit_bit_and): New function.
(ppc_emit_bit_or): New function.
(ppc_emit_bit_xor): New function.
(ppc_emit_bit_not): New function.
(ppc_emit_equal): New function.
(ppc_emit_less_signed): New function.
(ppc_emit_less_unsigned): New function.
(ppc_emit_ref): New function.
(ppc_emit_const): New function.
(ppc_emit_reg): New function.
(ppc_emit_pop): New function.
(ppc_emit_stack_flush): New function.
(ppc_emit_swap): New function.
(ppc_emit_stack_adjust): New function.
(ppc_emit_call): New function.
(ppc_emit_int_call_1): New function.
(ppc_emit_void_call_2): New function.
(ppc_emit_if_goto): New function.
(ppc_emit_goto): New function.
(ppc_emit_eq_goto): New function.
(ppc_emit_ne_goto): New function.
(ppc_emit_lt_goto): New function.
(ppc_emit_le_goto): New function.
(ppc_emit_gt_goto): New function.
(ppc_emit_ge_goto): New function.
(ppc_write_goto_address): New function.
(ppc_emit_ops_impl): New static variable.
(ppc64v1_emit_prologue): New function.
(ppc64v2_emit_prologue): New function.
(ppc64_emit_epilogue): New function.
(ppc64_emit_add): New function.
(ppc64_emit_sub): New function.
(ppc64_emit_mul): New function.
(ppc64_emit_lsh): New function.
(ppc64_emit_rsh_signed): New function.
(ppc64_emit_rsh_unsigned): New function.
(ppc64_emit_ext): New function.
(ppc64_emit_zero_ext): New function.
(ppc64_emit_log_not): New function.
(ppc64_emit_bit_and): New function.
(ppc64_emit_bit_or): New function.
(ppc64_emit_bit_xor): New function.
(ppc64_emit_bit_not): New function.
(ppc64_emit_equal): New function.
(ppc64_emit_less_signed): New function.
(ppc64_emit_less_unsigned): New function.
(ppc64_emit_ref): New function.
(ppc64_emit_const): New function.
(ppc64v1_emit_reg): New function.
(ppc64v2_emit_reg): New function.
(ppc64_emit_pop): New function.
(ppc64_emit_stack_flush): New function.
(ppc64_emit_swap): New function.
(ppc64v1_emit_call): New function.
(ppc64v2_emit_call): New function.
(ppc64v1_emit_int_call_1): New function.
(ppc64v2_emit_int_call_1): New function.
(ppc64v1_emit_void_call_2): New function.
(ppc64v2_emit_void_call_2): New function.
(ppc64_emit_if_goto): New function.
(ppc64_emit_eq_goto): New function.
(ppc64_emit_ne_goto): New function.
(ppc64_emit_lt_goto): New function.
(ppc64_emit_le_goto): New function.
(ppc64_emit_gt_goto): New function.
(ppc64_emit_ge_goto): New function.
(ppc64v1_emit_ops_impl): New static variable.
(ppc64v2_emit_ops_impl): New static variable.
(ppc_emit_ops): New function.
(linux_low_target): Wire in ppc_emit_ops.

8 years agogdbserver: Add powerpc fast tracepoint support.
Marcin Kościelnicki [Thu, 10 Mar 2016 00:38:18 +0000 (01:38 +0100)]
gdbserver: Add powerpc fast tracepoint support.

gdb/gdbserver/ChangeLog:

2016-03-31  Wei-cheng Wang  <cole945@gmail.com>
    Marcin Kościelnicki  <koriakin@0x04.net>

PR/17221
* Makefile.in: Add powerpc-*-ipa.o
* configure.srv: Add ipa_obj for powerpc*-linux.
* linux-ppc-ipa.c: New file.
* linux-ppc-low.c: Added linux-ppc-tdesc.h, ax.h, tracepoint.h
includes.
(PPC_FIELD): New macro.
(PPC_SEXT): New macro.
(PPC_OP6): New macro.
(PPC_BO): New macro.
(PPC_LI): New macro.
(PPC_BD): New macro.
(init_registers_*): Move prototype to linux-ppc-tdesc.h.
(tdesc_*): Move declaration to linux-ppc-tdesc.h.
(ppc_get_hwcap): Rename to ppc_get_auxv and add type parameter.
(ppc_get_thread_area): New function.
(is_elfv2_inferior): New function.
(gen_ds_form): New function.
(GEN_STD): New macro.
(GEN_STDU): New macro.
(GEN_LD): New macro.
(GEN_LDU): New macro.
(gen_d_form): New function.
(GEN_ADDI): New macro.
(GEN_ADDIS): New macro.
(GEN_LI): New macro.
(GEN_LIS): New macro.
(GEN_ORI): New macro.
(GEN_ORIS): New macro.
(GEN_LWZ): New macro.
(GEN_STW): New macro.
(GEN_STWU): New macro.
(gen_xfx_form): New function.
(GEN_MFSPR): New macro.
(GEN_MTSPR): New macro.
(GEN_MFCR): New macro.
(GEN_MTCR): New macro.
(GEN_SYNC): New macro.
(GEN_LWSYNC): New macro.
(gen_x_form): New function.
(GEN_OR): New macro.
(GEN_MR): New macro.
(GEN_LWARX): New macro.
(GEN_STWCX): New macro.
(GEN_CMPW): New macro.
(gen_md_form): New function.
(GEN_RLDICL): New macro.
(GEN_RLDICR): New macro.
(gen_i_form): New function.
(GEN_B): New macro.
(GEN_BL): New macro.
(gen_b_form): New function.
(GEN_BNE): New macro.
(GEN_LOAD): New macro.
(GEN_STORE): New macro.
(gen_limm): New function.
(gen_atomic_xchg): New function.
(gen_call): New function.
(ppc_relocate_instruction): New function.
(ppc_install_fast_tracepoint_jump_pad): New function.
(ppc_get_min_fast_tracepoint_insn_len): New function.
(ppc_get_ipa_tdesc_idx): New function.
(the_low_target): Wire in the new functions.
(initialize_low_arch) [!__powerpc64__]: Don'it initialize 64-bit
tdescs.
* linux-ppc-tdesc.h: New file.

8 years agoIPA: Add alloc_jump_pad_buffer target hook.
Marcin Kościelnicki [Sat, 12 Mar 2016 23:30:11 +0000 (00:30 +0100)]
IPA: Add alloc_jump_pad_buffer target hook.

Targets may have various requirements on the required location of the jump
pad area.  Currently IPA allocates it at the lowest possible address,
so that it is reachable by branches from the executable.  However, this
fails on powerpc, which has executable link address (0x10000000) much
larger than branch reach (+/- 32MiB).

This makes jump pad buffer allocation a target hook instead.  The current
implementations are as follows:

- i386 and s390: Branches can reach anywhere, so just mmap it.  This
  avoids the linear search dance.
- x86_64: Branches have +/-2GiB of reach, and executable is loaded low,
  so just call mmap with MAP_32BIT.  Likewise avoids the linear search.
- aarch64: Branches have +-128MiB of reach, executable loaded at 4MiB.
  Do a linear search from 4MiB-size downwards to page_size.
- s390x: Branches have +-4GiB of reach, executable loaded at 2GiB.
  Do like on aarch64.

gdb/gdbserver/ChangeLog:

* linux-aarch64-ipa.c: Add <sys/mman.h> and <sys/auxv.h> includes.
(alloc_jump_pad_buffer): New function.
* linux-amd64-ipa.c: Add <sys/mman.h> include.
(alloc_jump_pad_buffer): New function.
* linux-i386-ipa.c (alloc_jump_pad_buffer): New function.
* linux-s390-ipa.c: Add <sys/mman.h> and <sys/auxv.h> includes.
(alloc_jump_pad_buffer): New function.
* tracepoint.c (getauxval) [!HAVE_GETAUXVAL]: New function.
(initialize_tracepoint): Delegate to alloc_jump_pad_buffer.
* tracepoint.h (alloc_jump_pad_buffer): New prototype.
(getauxval) [!HAVE_GETAUXVAL]: New prototype.

8 years agoopcodes: Fix date in ChangeLog entry
Andrew Burgess [Thu, 31 Mar 2016 13:16:10 +0000 (14:16 +0100)]
opcodes: Fix date in ChangeLog entry

Previous commit had wrong date on ChangeLog entry.  Fixed.

8 years agoopcodes/arc/nps: Fix some operand flags
Andrew Burgess [Thu, 24 Mar 2016 17:18:41 +0000 (17:18 +0000)]
opcodes/arc/nps: Fix some operand flags

Some operands accidentally had the ARC_OPERAND_NCHK flag (due to copy &
paste mistake), meaning the operand value was skipping the overflow
check before being inserted.  This commit removes the unwanted flags.

opcodes/ChangeLog:

* arc-opc.c (arc_operands): Fix operand flags for NPS_R_DST, and
NPS_R_SRC1.

8 years agopython: Use console format for output of gdb.execute command
Catalin Udma [Mon, 29 Feb 2016 14:16:19 +0000 (16:16 +0200)]
python: Use console format for output of gdb.execute command

When gdb is started in MI mode, the output of gdb.execute
command is in MI-format in case when it is executed from python stop
handler while for all other cases the output is in console-format.

To assure consistent output format, this is fixed by using the console
format for all python gdb command executions.

PR python/19743

gdb/ChangeLog:
2016-03-31  Catalin Udma  <catalin.udma@freescale.com>

PR python/19743
* python/python.c (execute_gdb_command): Use console uiout
when executing gdb command.
* utils.c (restore_ui_out_closure): New structure.
(do_restore_ui_out): New function.
(make_cleanup_restore_ui_out): Likewise.
* utils.h (make_cleanup_restore_ui_out): Declare.

gdb/testsuite/ChangeLog:
2016-03-31  Catalin Udma  <catalin.udma@freescale.com>

PR python/19743
* gdb.python/py-mi-events-gdb.py: New file.
* gdb.python/py-mi-events.c: New file.
* gdb.python/py-mi-events.exp: New file.

Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
8 years agoRemove support for "target m32rsdi" and "target mips/pmon/ddb/rockhopper/lsi"
Pedro Alves [Thu, 31 Mar 2016 12:24:34 +0000 (13:24 +0100)]
Remove support for "target m32rsdi" and "target mips/pmon/ddb/rockhopper/lsi"

This removes support for:

 | target            | source                |
 |-------------------+-----------------------|
 | target m32rsdi    | gdb/remote-m32r-sdi.c |
 | target mips       | gdb/remote-mips.c     |
 | target pmon       | gdb/remote-mips.c     |
 | target ddb        | gdb/remote-mips.c     |
 | target rockhopper | gdb/remote-mips.c     |
 | target lsi        | gdb/remote-mips.c     |

That is:

 - Remote M32R debugging over SDI.

 - Debugging boards using the MIPS remote debugging protocol
   over a serial line, PMON, and a few variants.

These are the last non-"target remote" remote targets in the tree, if
you don't count "target sim".

Refs:

 https://sourceware.org/ml/gdb/2016-03/msg00004.html
 https://sourceware.org/ml/gdb-patches/2016-03/msg00580.html

gdb/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

* NEWS: Mention that support for "target m32rsdi", "target mips",
"target pmon", "target ddb", "target rockhopper", and "target lsi"
was removed.
* Makefile.in (ALL_TARGET_OBS): Remove remote-m32r-sdi.o and
remote-mips.o.
(ALLDEPFILES): Remove remote-m32r-sdi.c and remote-mips.c.
* configure.tgt: Remove all references to remote-m32r-sdi.o and
remote-mips.o.
* mips-tdep.c (deprecated_mips_set_processor_regs_hack): Delete
function.
* mips-tdep.h (deprecated_mips_set_processor_regs_hack): Delete
declaration.
* remote-m32r-sdi.c, remote-mips.c: Delete files.
* symfile.c (generic_load, generic_load): Remove comments.

gdb/doc/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

* gdb.texinfo (M32R/SDI): Delete node.
(MIPS Embedded): Remove references to the MIPS remote debugging
protocol, PMON and variants, and the associated commands.

8 years agoenable -Wwrite-strings for gas
Trevor Saunders [Sun, 20 Mar 2016 01:48:35 +0000 (21:48 -0400)]
enable -Wwrite-strings for gas

We add a new AC_SUBST to warning.m4 so that the test if the warning is
supported is centralized, but the warning can be enabled per directory.

binutils/ChangeLog:

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

* configure: Regenerate.

gprof/ChangeLog:

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

* configure: Regenerate.

ld/ChangeLog:

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

* configure: Regenerate.

opcodes/ChangeLog:

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

* configure: Regenerate.

bfd/ChangeLog:

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

* configure: Regenerate.
* warning.m4: Add WARN_WRITE_STRINGS AC_SUBST.

gold/ChangeLog:

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

* configure: Regenerate.

gas/ChangeLog:

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

* Makefile.am: Add WARN_WRITE_STRINGS to WARN_CFLAGS.
* Makefile.in: Regenerate.
* configure: Likewise.

8 years agomake xtensa_section_rename () take const char *
Trevor Saunders [Sun, 20 Mar 2016 05:37:55 +0000 (01:37 -0400)]
make xtensa_section_rename () take const char *

Xtensa uses it in several macros passing it a literal string, so its convenient
for the argument type to be const char *.  However some of the code in
symbols.c seems to assume tc_canonicalize_symbol_name () will return a non
const pointer, and some other target's implementations even modify the
argument, so it seems best to return a char * which means casting away const on
the argument when we return it instead of another string.

gas/ChangeLog:

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

* config/tc-xtensa.c (struct rename_section_struct): Make old_name
const.
(xtensa_section_rename): Make argument type const char *.
* config/tc-xtensa.h (xtensa_section_rename): Adjust.

8 years agotc-i960.c: add some casts when assigning literals to args[i]
Trevor Saunders [Thu, 24 Mar 2016 11:52:39 +0000 (07:52 -0400)]
tc-i960.c: add some casts when assigning literals to args[i]

parse_ldconst () takes a char ** as a in / out argument, and sometimes points
args[0] to a constant string.  Then in some cases after parse_ldconst ()
     returns md_assemble () twiddles the contents of arg[0].  So it seems like
     it would take some work to avoid these casts, and its not really clear
     that work is worth it.

gas/ChangeLog:

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

* config/tc-i960.c (parse_ldconst): Cast to char * when assigning to
args[0].

8 years agocast the arg to md_assemble () to char *
Trevor Saunders [Sun, 20 Mar 2016 05:13:05 +0000 (01:13 -0400)]
cast the arg to md_assemble () to char *

For these targets its not clear how md_assemble can usefully be split up so
that part can take const char *.  There is also a fair number of targets that
need md_assemble () to take a char *, so we can't easily make the argument
const.  So since there isn't many callers it seems easiest to just add a couple
of casts.

gas/ChangeLog:

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

* config/tc-m32c.c (m32c_md_end): cast the argument to md_assemble to
char *.
(m32c_indirect_operand): Likewise.
* config/tc-nds32.c (do_pseudo_b): Likewise.
(do_pseudo_bal): Likewise.
(do_pseudo_ls_bhw): Likewise.

8 years agocast to char * when assigning to optarg
Trevor Saunders [Mon, 22 Feb 2016 22:27:30 +0000 (17:27 -0500)]
cast to char * when assigning to optarg

gas/ChangeLog:

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

* as.c (parse_args): Cast literal to char * when assigning to optarg.

8 years agowork around get_symbol_name () in sparc and ia64
Trevor Saunders [Sun, 28 Feb 2016 22:21:12 +0000 (17:21 -0500)]
work around get_symbol_name () in sparc and ia64

get_symbol_name () returns a char * in a out arg, which means we need to cast
to assign a literal to the variable passed to get_symbol_name ().  It seems
like better APIs than get_symbol_name () could be provided, but that seems like
a fair amount of work so just casting seems to be the betterthing to do for
now.

gas/ChangeLog:

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

* config/tc-ia64.c (md_assemble): Add temporary variable to pass to
get_symbol_name ().
* config/tc-sparc.c (s_register): Cast a literal to char * in
assignment.

8 years agocast literal to char * when assigning to input_line_ptr
Trevor Saunders [Mon, 22 Feb 2016 21:17:14 +0000 (16:17 -0500)]
cast literal to char * when assigning to input_line_ptr

various places either directly or indirectly set input_line_pointer to point at
a literal.  Currently lots of places modify the string input_line_pointer
points at, so making it const isn't easy.  Since most if not all of these
places assign to input_line_pointer to parse an expression it would probably be
best to add ways to generate and deal with expressions that doesn't involve
parsing strings, but for now adding some casts seems easiest.

gas/ChangeLog:

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

* config/tc-i960.c (parse_expr): Cast to char * when assigning to
input_line_pointer.
* config/tc-m32r.c (expand_debug_syms): Likewise.
* config/tc-msp430.c (msp430_dstoperand): Likewise.
* config/tc-z80.c (md_begin): Likewise.
* stabs.c (stabs_generate_asm_func): Likewise.

8 years agoMore cases of missing TO_ADDR in ldlang.c
Alan Modra [Thu, 31 Mar 2016 04:32:14 +0000 (15:02 +1030)]
More cases of missing TO_ADDR in ldlang.c

and one extraneous occurrence.

* ldlang.c (TO_ADDR, TO_SIZE, opb_shift): Move earlier in file.
(lang_insert_orphan): Use TO_ADDR in __stop sym calculation.
(print_input_section): Don't use TO_ADDR when printing section
size.
(lang_size_sections_1): Use TO_ADDR in overlay lma calculation.
(lang_size_sections): Use TO_ADDR in relro end calculation.

8 years agoget rid of K&R style args
Trevor Saunders [Sun, 27 Mar 2016 08:30:31 +0000 (04:30 -0400)]
get rid of K&R style args

gas/ChangeLog:

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

* cgen.c: Modernize the way functions declare arguments.
* config/tc-bfin.c: Likewise.
* config/tc-pdp11.c: Likewise.
* literal.c: Likewise.
* read.c: Likewise.
* stabs.c: Likewise.

8 years agomake some variables unsigned
Trevor Saunders [Sun, 27 Mar 2016 11:07:27 +0000 (07:07 -0400)]
make some variables unsigned

these places define char arrays containing values greater than 0x80 which
doesn't fit in an 8 bit signed char, but does fit in an unsigned one.

gas/ChangeLog:

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

* config/tc-aarch64.c (aarch64_handle_align): Make the type of some
variables unsigned char[].
* config/tc-alpha.c (alpha_handle_align): Likewise.
* config/tc-arm.c (arm_handle_align): Likewise.
* config/tc-z80.c: Likewise.

8 years agoDon't override definition a shared object by one in a later shared object.
Cary Coutant [Thu, 31 Mar 2016 02:14:16 +0000 (19:14 -0700)]
Don't override definition a shared object by one in a later shared object.

In PR 16979, a reference to malloc is being resolved to an unversioned
reference in libmalloc.so. When linked with --as-needed, however, the
dynamic table does not list libmalloc.so as a DT_NEEDED library.

If we have a reference to an unversioned symbol in a shared object,
and we later see a versioned definition in another shared object, we
were overriding the first definition with the second in the process of
defining the default version. As a result, we no longer think that the
first shared object was actually needed to resolve any symbols, and we
don't list it as a DT_NEEDED library.

This patch fixes the problem by treating the two definitions as separate
symbols, so the second definition does not override the first.

2016-03-30  Cary Coutant  <ccoutant@gmail.com>

gold/
PR gold/16979
* symtab.cc (Symbol_table::define_default_version): Check for case
where symbols are both in different shared objects.

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

8 years agogdbserver/IPA: Export some functions via global function pointers.
Marcin Kościelnicki [Fri, 11 Mar 2016 14:51:29 +0000 (15:51 +0100)]
gdbserver/IPA: Export some functions via global function pointers.

On powerpc64, qSymbol for a function returns the function code address,
and not the descriptor address.  Since we emit code calling gdb_collect
and some other functions, we need the descriptor (no way to know the
proper TOC address without it).  To get the descriptor address, make
global function pointer variables in the IPA pointing to the relevant
functions and read them instead of asking for them directly via qSymbol.

gdb/gdbserver/ChangeLog:

* linux-aarch64-ipa.c: Rename gdb_agent_get_raw_reg to get_raw_reg.
* linux-amd64-ipa.c: Likewise.
* linux-i386-ipa.c: Likewise.
* linux-s390-ipa.c: Likewise.
* tracepoint.c: IPA-export gdb_collect_ptr instead of gdb_collect,
ditto for get_raw_reg_ptr, get_trace_state_variable_value_ptr,
set_trace_state_variable_value_ptr.
(struct ipa_sym_addresses): Likewise.
(symbol_list): Likewise.
(install_fast_tracepoint): Dereference gdb_collect_ptr instead of
accessing gdb_collect directly.
(gdb_collect_ptr_type): New typedef.
(get_raw_reg_ptr_type): New typedef.
(get_trace_state_variable_value_ptr_type): New typedef.
(set_trace_state_variable_value_ptr_type): New typedef.
(gdb_collect_ptr): New global.
(get_raw_reg_ptr): New global.
(get_trace_state_variable_value_ptr): New global.
(set_trace_state_variable_value_ptr): New global.
(get_raw_reg_func_addr): Dereference get_raw_reg_ptr instead of
accessing get_raw_reg directly.
(get_get_tsv_func_addr): Likewise for
get_trace_state_variable_value_ptr.
(get_set_tsv_func_addr): Likewise for
set_trace_state_variable_value_ptr.
* tracepoint.h: Rename gdb_agent_get_raw_reg to get_raw_reg.

8 years agoopcodes/arc: Comment and whitespace fixes in opcode table
Andrew Burgess [Wed, 30 Mar 2016 17:13:31 +0000 (18:13 +0100)]
opcodes/arc: Comment and whitespace fixes in opcode table

Add a new comment, and clean up some whitespace issues in the
instruction table.

opcode/ChangeLog:

* arc-nps400-tbl.h: Add a header comment, and fix some whitespace
issues.  No functional changes.

8 years agold/testing: Fix error and warning checks in run_dump_test
Andrew Burgess [Wed, 30 Mar 2016 13:34:34 +0000 (14:34 +0100)]
ld/testing: Fix error and warning checks in run_dump_test

The options warning_output and error_output to the run_dump_test
function were incorrectly checking the return value from the regexp_diff
function, and so, as a result failing tests were showing as a pass.
Fixed in this commit.

ld/ChangeLog:

* testsuite/lib/ld-lib.exp (run_dump_test): Fix check of return
value from regexp_diff.
* testsuite/ld-elf/orphan-5.l: Fix expected output.
* testsuite/ld-elf/orphan-6.l: Likewise.

8 years agoCheck func against 0 rather than NULL
Yao Qi [Wed, 30 Mar 2016 16:02:46 +0000 (17:02 +0100)]
Check func against 0 rather than NULL

Variable 'func''s type is CORE_ADDR, so it should be compared with 0
rather than NULL.  This causes a build error.

This patch fixes this.

gdb:

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

* arm-tdep.c (arm_epilogue_frame_this_id): Check 'func' against
0 rather than NULL.

8 years agoAdd arm epilogue unwinder
Yao Qi [Wed, 30 Mar 2016 15:44:24 +0000 (16:44 +0100)]
Add arm epilogue unwinder

Nowadays, GDB can't unwind successfully from epilogue on arm,

 (gdb) bt
 #0  0x76ff65a2 in shr1 () from /home/yao/Source/gnu/build/gdb/testsuite/gdb.reverse/shr1.sl
 #1  0x0000869e in main () at /home/yao/Source/gnu/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.reverse/solib-reverse.c:34
 Backtrace stopped: previous frame inner to this frame (corrupt stack?)

(gdb) disassemble shr1
Dump of assembler code for function shr1:
   ....
   0x76ff659a <+10>: adds r7, #12
   0x76ff659c <+12>: mov sp, r7
   0x76ff659e <+14>: ldr.w r7, [sp], #4
   0x76ff65a2 <+18>: bx lr
End of assembler dump.

in this case, prologue unwinder is used.  It analyzes the prologue and
get the offsets of saved registers to SP.  However, in epilogue, the
SP has been restored, prologue unwinder gets the registers from the
wrong address, and even the frame id is wrong.

In reverse debugging, this case (program stops at the last instruction
of function) happens quite frequently due to the reverse execution.
There are many test fails due to missing epilogue unwinder.

This adds epilogue unwinder, but the frame cache is still get by
prologue unwinder except that SP is fixed up separately, because SP
is restored in epilogue.

This patch fixes many fails in solib-precsave.exp, and solib-reverse.exp.

gdb:

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

* arm-tdep.c: (arm_make_epilogue_frame_cache): New function.
(arm_epilogue_frame_this_id): New function.
(arm_epilogue_frame_prev_register): New function.
(arm_epilogue_frame_sniffer): New function.
(arm_epilogue_frame_unwind): New.
(arm_gdbarch_init): Append unwinder arm_epilogue_frame_unwind.

8 years agoRefactor arm_stack_frame_destroyed_p
Yao Qi [Wed, 30 Mar 2016 15:44:24 +0000 (16:44 +0100)]
Refactor arm_stack_frame_destroyed_p

This patch is to refactor arm_stack_frame_destroyed_p, so that the code
can be used in both arm_stack_frame_destroyed_p and arm epilogue
unwinder I am going to add in the next patch.  In fact, the code
is the same in two places, but checking whether it is thumb mode
is slightly different.  arm_stack_frame_destroyed_p uses
arm_pc_is_thumb, and epilogue unwinder should use arm_frame_is_thumb.

gdb:

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

* arm-tdep.c (arm_stack_frame_destroyed_p): Rename it ...
(arm_stack_frame_destroyed_p_1): ... here.  Don't call
arm_pc_is_thumb.
(arm_stack_frame_destroyed_p): Call
thumb_stack_frame_destroyed_p and
arm_stack_frame_destroyed_p_1.

8 years agoSimplify gdb.reverse/until-reverse.c
Yao Qi [Wed, 30 Mar 2016 15:36:51 +0000 (16:36 +0100)]
Simplify gdb.reverse/until-reverse.c

Nowadays, functions fprintf, printf and malloc are executed in
gdb.reverse/until-reverse.c, so that it takes much time to record
instructions inside them.  This may cause timeout, and we had several
fixes to bump the timeout,

 https://sourceware.org/ml/gdb-patches/2012-02/msg00038.html
 https://sourceware.org/ml/gdb-patches/2015-08/msg00186.html

also I still see this on arm-linux,

 continue
 Continuing.
 Do you want to auto delete previous execution log entries when record/replay buffer becomes full (record full stop-at-limit)?([y] or n) n
 Process record: stopped by user.

 Program stopped.
 0xf77021e6 in __linkin_atfork (newp=0xf7751748 <atfork_mem>) at ../nptl/sysdeps/unix/sysv/linux/register-atfork.c:117
 117     ../nptl/sysdeps/unix/sysv/linux/register-atfork.c: No such file or directory.
 (gdb) FAIL: gdb.reverse/until-precsave.exp: run to end of main (got interactive prompt)

however, I can't figure out how these functions (fprintf, printf and
malloc) are related to the test itself.  marker1 is a function from
shared library too so we don't need these complicated libc functions
at all.  IMO, recording the instructions in these libc functions has
nothing to do with the test itself except slow down the test.  This
patch is to remove the usage of fprintf and printf, and also move
malloc to a dead code path.

gdb/testsuite:

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

* gdb.reverse/until-precsave.exp: Match function name only.
* gdb.reverse/until-reverse.c (main): Don't call fprintf nor printf.
Move malloc to a condition block.
* gdb.reverse/until-reverse.exp: Match function name only.

8 years agoFix compile time warning about comparison between signed and unsigned values.
Nick Clifton [Wed, 30 Mar 2016 15:18:04 +0000 (16:18 +0100)]
Fix compile time warning about comparison between signed and unsigned values.

PR target/19880
* config/tc-arm.c (do_t_push_pop): Cast bitmask to unsigned before
shifting.

8 years agogdbserver/tracepoint.c: Remove whitespace
Simon Marchi [Wed, 30 Mar 2016 14:54:28 +0000 (10:54 -0400)]
gdbserver/tracepoint.c: Remove whitespace

gdb/gdbserver/ChangeLog:

* tracepoint.c (cmd_qtenable_disable): Remove whitespace.

8 years ago[ARC] Allow equ redefintion tests for ARC.
Claudiu Zissulescu [Wed, 30 Mar 2016 14:21:25 +0000 (16:21 +0200)]
[ARC] Allow equ redefintion tests for ARC.

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

        * testsuite/gas/all/gas.exp: Don't xfail on ARC.
        * testsuite/gas/elf/elf.exp: Likewise.
        * testsuite/gas/all/redef3.d: Allow execution for ARC.

8 years ago[ARC] Fix warn.exp test error.
Claudiu Zissulescu [Wed, 30 Mar 2016 14:09:56 +0000 (16:09 +0200)]
[ARC] Fix warn.exp test error.

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

        * testsuite/gas/arc/warn.exp: Fix matching pattern.

8 years ago[ARC] Cleanup AUX register names.
Claudiu Zissulescu [Wed, 30 Mar 2016 14:06:54 +0000 (16:06 +0200)]
[ARC] Cleanup AUX register names.

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

        * arc-regs.h (IC_RAM_ADDRESS, IC_TAG, IC_WP, IC_DATA, CONTROL0)
        (AX2, AY2, MX2, MY2, AY0, AY1, DC_RAM_ADDR, DC_TAG, CONTROL1)
        (RTT): Remove duplicate.
        (LCDINSTR, LCDDATA, LCDSTAT, CC_*, PCT_COUNT*, PCT_SNAP*)
        (PCT_CONFIG*): Remove.
        (D1L, D1H, D2H, D2L): Define.

8 years agoFix a seg-fault in the AVR linker.
Senthil Kumar Selvaraj [Wed, 30 Mar 2016 13:52:26 +0000 (14:52 +0100)]
Fix a seg-fault in the AVR linker.

* elf32-avr.c (avr_elf32_load_records_from_section): Free
internal_relocs only if they aren't cached.

8 years agoFix more bugs in AArch64 simulator.
Nick Clifton [Wed, 30 Mar 2016 09:27:21 +0000 (10:27 +0100)]
Fix more bugs in AArch64 simulator.

* cpustate.c (aarch64_set_reg_s32): New function.
(aarch64_set_reg_u32): New function.
(aarch64_get_FP_half): Place half precision value into the correct
slot of the union.
(aarch64_set_FP_half): Likewise.
* cpustate.h: Add prototypes for aarch64_set_reg_s32 and
aarch64_set_reg_u32.
* memory.c (FETCH_FUNC): Cast the read value to the access type
before converting it to the return type.  Rename to FETCH_FUNC64.
(FETCH_FUNC32): New macro.  Duplicates FETCH_FUNC64 but for 32-bit
accesses.  Use for 32-bit memory access functions.
* simulator.c (ldrsb_wb): Use sign extension not zero extension.
(ldrb_scale_ext, ldrsh32_abs, ldrsh32_wb): Likewise.
(ldrsh32_scale_ext, ldrsh_abs, ldrsh64_wb): Likewise.
(ldrsh_scale_ext, ldrsw_abs): Likewise.
(ldrh32_abs): Store 32 bit value not 64-bits.
(ldrh32_wb, ldrh32_scale_ext): Likewise.
(do_vec_MOV_immediate): Fix computation of val.
(do_vec_MVNI): Likewise.
(DO_VEC_WIDENING_MUL): New macro.
(do_vec_mull): Use new macro.
(do_vec_mul): Use new macro.
(do_vec_MLA): Read values before writing.
(do_vec_xtl): Likewise.
(do_vec_SSHL): Select correct shift value.
(do_vec_USHL): Likewise.
(do_scalar_UCVTF): New function.
(do_scalar_vec): Call new function.
(store_pair_u64): Treat reads of SP as reads of XZR.

8 years agoMove CL entries from gdb/ChangeLog to gdb/testsuite/ChangeLog
Yao Qi [Wed, 30 Mar 2016 08:27:43 +0000 (09:27 +0100)]
Move CL entries from gdb/ChangeLog to gdb/testsuite/ChangeLog

Two ChangeLog entries in gdb/ChangeLog should be placed in
gdb/testsuite/ChangeLog.  This patch moves them to the right
place.

8 years agoPR18452, ld allows overlapping sections
Alan Modra [Wed, 30 Mar 2016 07:05:14 +0000 (17:35 +1030)]
PR18452, ld allows overlapping sections

PR 18452
* ldlang.c (maybe_overlays): New static var.
(lang_size_sections_1): Set it here.
(struct check_sec): New.
(sort_sections_by_lma): Adjust for array of structs.
(sort_sections_by_vma): New function.
(lang_check_section_addresses): Check both LMA and VMA for overlap.
* testsuite/ld-scripts/rgn-over7.d: Adjust.

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.