external/binutils.git
8 years agoFix MSP430 assembler's detection of NOP and EINT.
Nick Clifton [Wed, 6 Apr 2016 14:57:19 +0000 (15:57 +0100)]
Fix MSP430 assembler's detection of NOP and EINT.

* config/tc-msp430.c (msp430_operands): Check for a NOP preceding
an EINT instruction.  Warn/fix as necessary.
* testsuite/gas/msp430/bad.s: Add test of EINT without preceding NOP.
* testsuite/gas/msp430/bad.l: Update expected messages.

8 years agoRevert check-in by a mistake in the previous commit.
Jan Kratochvil [Wed, 6 Apr 2016 14:48:27 +0000 (16:48 +0200)]
Revert check-in by a mistake in the previous commit.

gdb/ChangeLog
2016-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

* remote.c: Revert check-in by a mistake in the previous commit.

8 years agoPrint the "file" command suggestion in exec_file_locate_attach
Jan Kratochvil [Wed, 6 Apr 2016 13:57:08 +0000 (15:57 +0200)]
Print the "file" command suggestion in exec_file_locate_attach

currently:
$ gdbserver-7.9 :1234 true &
$ gdb -q -ex 'target remote :1234' # that -q is not relevant here
Remote debugging using :1234
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0x00007ffff7ddcc80 in ?? ()
(gdb) b main
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) _

Provide more suggestive message to use the "file" command.

gdb/ChangeLog
2016-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Pedro Alves  <palves@redhat.com>

* exec.c (exec_file_locate_attach): Print warning for unsupported
target_pid_to_exec_file.
* symfile-mem.c (add_vsyscall_page): Remove the "file" command
message part.

8 years agoFix memory leak in ld ARM backend
Thomas Preud'homme [Wed, 6 Apr 2016 08:26:42 +0000 (09:26 +0100)]
Fix memory leak in ld ARM backend

2016-04-06  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (elf32_arm_size_stubs): Move error_ret_free_local to be
a fall through from error_ret_free_internal.  Free local_syms in
error_ret_free_local if allocated from bfd_elf_get_elf_syms ().

8 years agotestsuite: Update py-mi-objfile to expect console format print
Catalin Udma [Tue, 5 Apr 2016 09:55:14 +0000 (12:55 +0300)]
testsuite: Update py-mi-objfile to expect console format print

Starting with this commit:

  commit e7ea3ec7c623be0b9be1eaf4929794652a84be11
  Author: Catalin Udma <catalin.udma@freescale.com>
  Date:   Mon Feb 29 16:16:19 2016 +0200

    python: Use console format for output of gdb.execute command

the python script would use console format for gdb.execute output.
This patch fixes py-mi-objfile to expect the console format when is
checking for gdb.execute printing.

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

        * gdb.python/py-mi-objfile-gdb.py: Use "list main" command.
        * gdb.python/py-mi-objfile.exp: Match "list main" output
        in console format.

Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
8 years agoFix IPA detection in ftrace-insn-reloc.exp
Simon Marchi [Wed, 6 Apr 2016 00:35:42 +0000 (20:35 -0400)]
Fix IPA detection in ftrace-insn-reloc.exp

In commit 6e774b13c3b, I forgot to update this test.

gdb/testsuite/ChangeLog:

* gdb.arch/ftrace-insn-reloc.exp: Check for IPA basename instead of
absolute.

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

8 years agold/arc: Fix linker for big-endian arc targets
Andrew Burgess [Tue, 29 Mar 2016 14:57:40 +0000 (15:57 +0100)]
ld/arc: Fix linker for big-endian arc targets

This aims to bring the linker for big-endian arc targets into line with
the linker for (the default) little endian arc targets.

The bulk of the changes are to extend the target pattern in the test
files from 'arc-*...' to 'arc*-*...' and so match both big and little
endian arc targets.

In the ld/emulparams/ directory the existing scripts checked for a
variable ARC_ENDIAN to switch between big and little endian targets,
however, this variable is never set up.

So, a new script snippet is introduced which sets up ARC_ENDIAN based on
the value of target, this snippet is then included from all of the
existing arc scripts.

The existing big-endian variants of all the scripts, which existed, but
were never used, are deleted in this commit.

ld/ChangeLog:

* emulparams/arc-endianness.sh: New file.
* emulparams/arcebelf.sh: Deleted.
* emulparams/arcebelf_prof.sh: Deleted.
* emulparams/arceblinux.sh: Deleted.
* emulparams/arceblinux_prof.sh: Deleted.
* emulparams/arcelf.sh: Include arc-endinness.sh.
* emulparams/arcelf_prof.sh: Include arc-endinness.sh.
* emulparams/arclinux.sh: Include arc-endinness.sh.
* emulparams/arclinux_prof.sh: Include arc-endinness.sh.
* emulparams/arcv2elf.sh: Include arc-endinness.sh.
* emulparams/arcv2elfx.sh: Include arc-endinness.sh.
* testsuite/ld-elf/compressed1d.d: Update pattern for big and
little endian arc targets.
* testsuite/ld-elf/eh-frame-hdr.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr19162.d: Likewise.
* testsuite/ld-elf/sec64k.exp: Likewise.
* testsuite/lib/ld-lib.exp: Likewise.

8 years agoarc/nps400: Add additional instructions
Andrew Burgess [Mon, 21 Mar 2016 18:49:34 +0000 (18:49 +0000)]
arc/nps400: Add additional instructions

Adds the movbi, decode1, fbset, fbclear, encode0, encode1, rflt, crc16,
and crc32 instructions for the nps400 arc machine type.

gas/ChangeLog:

* testsuite/gas/arc/nps400-1.d: Update expected results.
* testsuite/gas/arc/nps400-1.s: Additional test cases.

opcodes/ChangeLog:

* arc-nps400-tbl.h: Add movbi, decode1, fbset, fbclear, encode0,
encode1, rflt, crc16, and crc32 instructions.
* arc-opc.c (arc_flag_operands): Add F_NPS_R.
(arc_flag_classes): Add C_NPS_R.
(insert_nps_bitop_size_2b): New function.
(extract_nps_bitop_size_2b): Likewise.
(insert_nps_bitop_uimm8): Likewise.
(extract_nps_bitop_uimm8): Likewise.
(arc_operands): Add new operand entries.

8 years agoMake ftrace tests work with remote targets
Simon Marchi [Tue, 5 Apr 2016 17:59:50 +0000 (13:59 -0400)]
Make ftrace tests work with remote targets

When we build a shared library for testing, it is built differently
whether it is meant for the local system or a remote one.  When it is
for the local system, the library is built with no SONAME.  So when the
executable is built, roughly in this way:

  $ gcc testfile.c /path/to/library.so

the executable will contain an absolute reference to the library.  For
example:

  $ readelf -a testsuite/gdb.python/py-shared | grep NEEDED
   0x0000000000000001 (NEEDED)             Shared library: [/home/emaisin/build/binutils-gdb/gdb/testsuite/gdb.python/py-shared-sl.sl]

When testing is done remotely, the absolute path obviously doesn't work.
Therefore, we build the library with an SONAME:

  $ readelf -a testsuite/gdb.python/py-shared-sl.sl | grep SONAME
   0x000000000000000e (SONAME)             Library soname: [py-shared-sl.sl]

which ends up in the executable's NEEDED field:

  $ readelf -a testsuite/gdb.python/py-shared | grep NEEDED
   0x0000000000000001 (NEEDED)             Shared library: [py-shared-sl.sl]

The executable and the library are then uploaded side-by-side on the
remote system.  To allow the dynamic linker to find the shared library,
we have to add the special RPATH value $ORIGIN, which tells it to search
in the executable's directory:

  $ readelf -a testsuite/gdb.python/py-shared | grep ORIGIN
   0x000000000000000f (RPATH)              Library rpath: [$ORIGIN]

The problem with the IPA library is that it doesn't have an SONAME,
making it very difficult to do testing on a remote board.  When a
test executable is linked with it, it contains an absolute reference to
the library path.  Therefore, unless the paths on the target are the
same as on the build system, it won't work.

To make it possible for tests using the IPA library to run test on
remote boards, I suggest adding an SONAME to libinproctrace.so.  I don't
think it should be a big problem for users.  All the libraries installed
on my system have an SONAME, so it should be fine if libinproctrace.so
does too.

As a consequence, native testing does not work anymore, since
executables do not contain the absolute path to the library anymore.  To
keep them working, we can have gdb_load_shlibs copy the library to the
test directory when testing natively.  That's done by modifying
gdb_load_shlibs.  We also have to add RPATH=$ORIGIN to executables, even
when testing natively.

I think it's a good change in general, as it reduces the differences
between testing a native and a remote target.  To further reduce those
differences, we can also always build test shared libraries with an
SONAME.

ftrace.exp and ftrace-lock.exp need to be modified slightly.  The code
checks that the IPA library is loaded using the absolute path on the
build machine.  That obviously doesn't work if the test is done
remotely, as the path will be different.  I changed the tests to only
search for the library basename (e.g. libinproctrace.so).

gdb/gdbserver/ChangeLog:

* Makefile.in ($(IPA_LIB)): Set SONAME of the IPA lib.

gdb/testsuite/ChangeLog:

* gdb.trace/ftrace-lock.exp: Check for IPA basename instead of
absolute.
* gdb.trace/ftrace.exp: Likewise.
* lib/gdb.exp (gdb_compile): Set rpath $ORIGIN for non-remote
targets as well.
(gdb_compile_shlib): Set SONAME for non-remote targets as well.
(gdb_load_shlibs): Copy libraries to test directory when testing
natively.  Only set solib-search-path if testing remotely.
* lib/mi-support.exp (mi_load_shlibs): Likewise.

8 years agoImprove gdb_remote_download, remove gdb_download
Simon Marchi [Tue, 5 Apr 2016 17:59:49 +0000 (13:59 -0400)]
Improve gdb_remote_download, remove gdb_download

This patch removes gdb_download in favor of gdb_remote_download, since
they are very close in functionality.  Also, in preparation for the
following patch about shared library handling during tests, it improves
gdb_remote_download so that it uses standard_output_file for any
destination board that is local, not only host.

If the destination board is remote, gdb_remote_download will use the
standard remote_download from DejaGnu, resulting in the file being
transferred on the remote system.

If the destination is local, gdb_remote_download will copy the file to
the standard test directory (found using standard_output_file).  Tcl's
file copy seems to handle gracefully cases where the source file is the
same as the destination, so I don't think it's necessary to check for
that case ourselves, as a previous version of the patch did.

I'd prefer to keep the name gdb_download instead of gdb_remote_download,
since I don't like the fact that gdb_remote_download implies that the
destination is remote, when it's not always the case.  However,
gdb_remote_download is used at many more places than gdb_download, so
it's easier to reuse that.  Also, since it's a wrapper around DejaGnu's
remote_download, it might be better to keep that name.  I don't know.

I ran the testsuite native, with native-gdbserver and with a
remote gdbserver, and didn't see any related failure.

gdb/testsuite/ChangeLog:

* gdb.base/jit-so.exp: Use gdb_remote_download instead of
gdb_download.  Use it even if the target is not remote.
* gdb.base/jit.exp (compile_jit_test): Likewise.
* lib/gdb.exp (gdb_remote_download): Copy files to the standard
output directory if the destination board is local, otherwise use
the standard remote_download from DejaGnu.
(gdb_download): Remove.
(gdb_load_shlibs): Use gdb_remote_download instead of
gdb_download.
* lib/gdbserver-support.exp (gdbserver_download_current_prog):
Use gdb_remote_download instead of gdb_download.  Use it even if
the target is not remote.
* lib/mi-support.exp (mi_load_shlibs): Use gdb_remote_download
instead of gdb_download.

8 years agoIPA: Move getauxval out of #ifndef IN_PROCESS_AGENT
Marcin Kościelnicki [Tue, 5 Apr 2016 13:23:35 +0000 (15:23 +0200)]
IPA: Move getauxval out of #ifndef IN_PROCESS_AGENT

The getauxval code was wrongly included in code area only compiled for
gdbserver.  Move it to a #ifdef IN_PROCESS_AGENT area that already
contains lots of IPA-only code.

gdb/gdbserver/ChangeLog:

* tracepoint.c (getauxval): Move to #ifdef IN_PROCESS_AGENT.

8 years ago[ARC] Fix support for double assist instructions.
Claudiu Zissulescu [Tue, 5 Apr 2016 15:37:29 +0000 (17:37 +0200)]
[ARC] Fix support for double assist instructions.

opcodes/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-regs.h: Add a new subclass field.  Add double assist
        accumulator register values.
        * arc-tbl.h: Use DPA subclass to mark the double assist
        instructions.  Use DPX/SPX subclas to mark the FPX instructions.
        * arc-opc.c (RSP): Define instead of SP.
        (arc_aux_regs): Add the subclass field.

include/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * opcode/arc.h (DPA, DPX, SPX): New subclass enums.
        (ARC_FPUDA): Define.
        (arc_aux_reg): Add new field.

gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * config/tc-arc.c (is_code_density_p): Compare directly the
        subclass field.
        (is_spfp_p, is_dpfp_p, is_spfp_p): Define.
        (check_cpu_feature): New function.
        (find_opcode_match): Use check_cpu_feature function.
        (preprocess_operands): Likewise.
        (md_parse_option): Use mfpuda, mdpfp, mspfp options.
        * testsuite/gas/arc/tdpfp.d: New file.
        * testsuite/gas/arc/tfpuda.d: Likewise.
        * testsuite/gas/arc/tfpx.s: Likewise.

8 years ago[ARC] PLT content endianess awareness.
Claudiu Zissulescu [Tue, 5 Apr 2016 15:23:24 +0000 (17:23 +0200)]
[ARC] PLT content endianess awareness.

bfd/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (plt_do_relocs_for_symbol): Changed.
(relocate_plt_for_entry): Likewise.

8 years ago[ARC] Fix to pass ld-elf-ehdr_start-shared.
Claudiu Zissulescu [Tue, 5 Apr 2016 15:14:03 +0000 (17:14 +0200)]
[ARC] Fix to pass ld-elf-ehdr_start-shared.

bfd/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (elf_arc_check_relocs): Changed

8 years ago[ARC] 24 bit reloc and overflow detection fix.
Claudiu Zissulescu [Tue, 5 Apr 2016 15:05:09 +0000 (17:05 +0200)]
[ARC] 24 bit reloc and overflow detection fix.

bfd/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (name_for_global_symbol): Changed assert.
(get_replace_function): Created.:
(struct arc_relocation_data): Changed to signed types.
(defines S, L, P, PDATA): Casted to signed type.
(defines SECTSTART, _SDA_BASE_, TLS_REL): Likewise.
(PRINT_DEBUG_RELOC_INFO_BEFORE): Changed.
(arc_do_relocation): Changed.

include/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* opcode/arc-func.h (replace_bits24): Changed.
(replace_bits24_be): Created.

8 years ago[ARM] Add ARMv8.2 FP16 vmul/vmla/vmls (by scalar)
Jiong Wang [Tue, 5 Apr 2016 14:54:00 +0000 (15:54 +0100)]
[ARM] Add ARMv8.2 FP16 vmul/vmla/vmls (by scalar)

gas/
  * config/tc-arm.c (do_neon_mac_maybe_scalar): Allow F16.
  * testsuite/gas/arm/armv8-2-fp16-simd.s: New tests.
  * testsuite/gas/arm/armv8-2-fp16-simd.d: New expected results.
  * testsuite/gas/arm/armv8-2-fp16-simd-thum.d: Likewise for Thumb.
  * testsuite/gas/arm/armv8-2-fp16-simd-warning.l: New warning results.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.s: New test source.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.d: New testcase.
  * testsuite/gas/arm/simd_by_scalar_low_regbank_thumb.d: Likewise for Thumb.
  * testsuite/gas/arm/simd_by_scalar_low_regbank.l: New warning results.

opcodes/
  * arm-dis.c: Support FP16 vmul, vmla, vmls (by scalar).

8 years ago[ARC] Dynamic relocs verification for dynindx == -1.
Claudiu Zissulescu [Tue, 5 Apr 2016 14:34:12 +0000 (16:34 +0200)]
[ARC] Dynamic relocs verification for dynindx == -1.

bfd/
2016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (name_for_global_symbol): Added assert to check for
symbol index.
(elf_arc_relocate_section): Added and changed asserts, validating
the synamic symbol index.
(elf_arc_finish_dynamic_symbol): Do not fill the dynamic
relocation if symbol has dynindx set to -1.

8 years ago[ARC] Don't allow pc-rel relocations for J* instructions.
Claudiu Zissulescu [Tue, 5 Apr 2016 14:22:19 +0000 (16:22 +0200)]
[ARC] Don't allow pc-rel relocations for J* instructions.

gas/
2016-04-05  Claudiu Zissulescu  <claziss@synopsys.com>

        * config/tc-arc.c (assemble_insn): Prohibit pc-rel relocations for
        JUMP instructions type.
        * testsuite/gas/arc/relocs-errors.d: New file.
        * testsuite/gas/arc/relocs-errors.err: Likewise.
        * testsuite/gas/arc/relocs-errors.s: Likewise.

8 years agoELF/LD: Avoid producing hidden and internal dynamic symbols
Maciej W. Rozycki [Tue, 5 Apr 2016 14:10:05 +0000 (15:10 +0100)]
ELF/LD: Avoid producing hidden and internal dynamic symbols

Always turn hidden and internal symbols which have a dynamic index into
local ones.  This is required by the the ELF gABI[1]:

"A hidden symbol contained in a relocatable object must be either
removed or converted to STB_LOCAL binding by the link-editor when the
relocatable object is included in an executable file or shared object."

"An internal symbol contained in a relocatable object must be either
removed or converted to STB_LOCAL binding by the link-editor when the
relocatable object is included in an executable file or shared object."

The ELF linker usually respects this requirement, however in the case
where a dynamic symbol has been preallocated due to a reference of the
default export class aka visibility from the object being linked, and
then merged with a hidden or internal symbol definition from within the
same object, then the original export class is carried over to the
output dynamic symbol table, because while merging the generic ELF
linker only converts affected dynamic symbols to local when they are
defined or referenced by the object being linked and a dynamic object
involved in the link both at a time.

The dynamic symbol produced confuses then the dynamic loader at the run
time -- the hidden or internal export class is ignored and the symbol
follows preemption rules as with the default export class.

In the MIPS target it happens when `mips_elf_record_global_got_symbol'
creates a dynamic symbol when a call relocation is encountered.
Additionally if the undefined symbol referred by such a relocation does
specify the intended export class, then a local dynamic symbol is
created instead, which is harmless and allowed, but useless.  Normally
no local dynamic symbols are created, except for a single dummy one at
the beginning.

Correct the problem by removing the extra check for a dynamic symbol
being defined or referenced by the object being linked and a dynamic
object involved in the link both at a time.  The test cases included
cover the internal and hidden symbol cases, as well as a protected
symbol for a reference, the handling of which is unchanged by this fix.
Both cases described above are covered, that is where an internal or
hidden dynamic symbol is produced and where a local one is.

NB this change affects CRIS results where some symbols in the static
table produced in a final link are now converted from STV_HIDDEN to
STB_LOCAL.  This happens whenever the `elf_backend_hide_symbol' handler
is called, so the affected symbols must have been chosen for entering
into the dynamic symbol table, except in these test cases no such symbol
table is produced.  In fully linked binaries the static symbol table is
only used for debugging though, so such a change is fine.

References:

[1] "System V Application Binary Interface - DRAFT - 24 April 2001",
    The Santa Cruz Operation, Inc., "Symbol Table",
    <http://www.sco.com/developers/gabi/2001-04-24/ch4.symtab.html>

bfd/
PR ld/19908
* elflink.c (elf_link_add_object_symbols): Always turn hidden
and internal symbols which have a dynamic index into local
ones.

ld/
PR ld/19908
* testsuite/ld-cris/tls-e-20.d: Adjust for hidden symbol
handling fix.
* testsuite/ld-cris/tls-e-20a.d: Likewise.
* testsuite/ld-cris/tls-e-21.d: Likewise.
* testsuite/ld-cris/tls-e-23.d: Likewise.
* testsuite/ld-cris/tls-e-80.d: Likewise.
* testsuite/ld-cris/tls-gd-3h.d: Likewise.
* testsuite/ld-cris/tls-leie-19.d: Likewise.
* testsuite/ld-mips-elf/export-class-ref-lib.sd: New test.
* testsuite/ld-mips-elf/export-hidden-ref.sd: New test.
* testsuite/ld-mips-elf/export-internal-ref.sd: New test.
* testsuite/ld-mips-elf/export-protected-ref.sd: New test.
* testsuite/ld-mips-elf/export-class-ref-f0.s: New test source.
* testsuite/ld-mips-elf/export-class-ref-f1.s: New test source.
* testsuite/ld-mips-elf/export-class-ref-f2.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

8 years ago[ARC] Fix ld testsuite failures.
Claudiu Zissulescu [Tue, 5 Apr 2016 11:46:44 +0000 (13:46 +0200)]
[ARC] Fix ld testsuite failures.

ld/
016-04-05  Cupertino Miranda  <cmiranda@synopsys.com>

* testsuite/ld-discard/extern.d: Removed xfail for ARC.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/orphan3.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/warn1.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elf/warn3.d: Likewise.
* testsuite/ld-scripts/crossref.exp: Add __SDATA_BEGIN__ symbol
through linker flags.
* testsuite/ld-srec/srec.exp: Set as xfail.

8 years agoDon't use vec_disp8 encoding with the .d32 suffix
H.J. Lu [Tue, 5 Apr 2016 04:19:27 +0000 (21:19 -0700)]
Don't use vec_disp8 encoding with the .d32 suffix

Since the .d32 suffix prefers 32-bit displacement in encoding, try
vec_disp8 encoding only if i.disp_encoding != disp_encoding_32bit.

PR gas/19909
* config/tc-i386.c (check_VecOperands): Try vec_disp8 encoding
only if i.disp_encoding != disp_encoding_32bit.
* gas/testsuite/gas/i386/disp32.s: Add tests for vmovdqu64.d32.
* gas/testsuite/gas/i386/x86-64-disp32.s: Likewise.
* gas/testsuite/gas/i386/disp32.d: Updated.
* gas/testsuite/gas/i386/x86-64-disp32.d: Likewise.

8 years agoAdd missing pr19827-nacl.rd for i386/x86-64 NaCl
H.J. Lu [Tue, 5 Apr 2016 03:50:19 +0000 (20:50 -0700)]
Add missing pr19827-nacl.rd for i386/x86-64 NaCl

PR ld/19827
* testsuite/ld-i386/pr19827-nacl.rd: New file.
* testsuite/ld-x86-64/pr19827-nacl.rd: Likewise.

8 years agoAdd a testcase for PR gas/19498
H.J. Lu [Tue, 5 Apr 2016 03:45:30 +0000 (20:45 -0700)]
Add a testcase for PR gas/19498

PR gas/19498
* testsuite/gas/i386/i386.exp: Run pr19498.
* testsuite/gas/i386/pr19498.d: New file.
* testsuite/gas/i386/pr19498.s: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 5 Apr 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoObvious function doc and formatting
Simon Marchi [Mon, 4 Apr 2016 20:46:36 +0000 (16:46 -0400)]
Obvious function doc and formatting

gdb/ChangeLog:

* cli/cli-decode.c (help_cmd_list): Fix function doc and remove
trailing spaces.

8 years agoFix gdb.mi/mi-breakpoint-changed.exp for remote targets
Simon Marchi [Mon, 4 Apr 2016 14:31:30 +0000 (10:31 -0400)]
Fix gdb.mi/mi-breakpoint-changed.exp for remote targets

The libraries are never downloaded to the target for the first test
(test_insert_delete_modify), so the executable can't run properly.

I also added some with_test_prefix to help differentiate between the
different test case phases.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-breakpoint-changed.exp: Add some with_test_prefix.
(test_insert_delete_modify): Call mi_load_shlibs before trying to
run.

8 years agoMore fixes for COFF/PE lanker garbage collection.
Nick Clifton [Mon, 4 Apr 2016 12:44:57 +0000 (13:44 +0100)]
More fixes for COFF/PE lanker garbage collection.

PR 19803
* emultempl/pe.em (change_undef): New function.  Encapsulates
duplicated code in pe_fixup_stdcalls and adds the newly defined
sym to the gc root list.
(pe_fixup_stdcall): Use the new function.
* pe-dll.c (process_def_file_and_drectve); Add alias of exported
symbol to gc root list.

8 years agoIgnore DWARF debug information with a version of 0 - assume that it is padding.
Nick Clifton [Mon, 4 Apr 2016 11:53:33 +0000 (12:53 +0100)]
Ignore DWARF debug information with a version of 0 - assume that it is padding.

PR 19872
bfd * dwarf2.c (parse_comp_unit): Skip warning about unrecognised
version number if the version is zero.

bin * dwarf.c (display_debug_aranges): Skip warning about unrecognised
version number if the version is zero.

8 years agogas/arc: Use #define from include/opcode/arc.h
Andrew Burgess [Fri, 1 Apr 2016 17:35:29 +0000 (18:35 +0100)]
gas/arc: Use #define from include/opcode/arc.h

In tc-arc.h we redefine constants that are also defined in the
include/opcode/arc.h header file.  The problem is that changing one
without changing the other resulting in strange crashes.

We could comment both locations to stress the importance of remembering
to update the other location too, or we could just include the
opcode/arc.h header file into the assembler.

Given that other targets include their opcode/ARCH.h header file, and
only having a single definition, where possible, is usually the safest
solution, that's what I switch too with this commit.

gas/ChangeLog:

* config/tc-arc.h: Include 'opcode/arc.h'.
(MAX_INSN_ARGS): Delete.
(MAX_INSN_FLGS): Delete.

8 years agoPR19498, Invalid "symbol definition loop"
Alan Modra [Mon, 4 Apr 2016 06:49:27 +0000 (16:19 +0930)]
PR19498, Invalid "symbol definition loop"

PR 19498
* symbols.c (resolve_symbol_value): Clear sy_resolving on exit
from function on all paths that set sy_resolving.

8 years agouse XNEW and related macros more
Trevor Saunders [Fri, 1 Apr 2016 13:26:30 +0000 (09:26 -0400)]
use XNEW and related macros more

gas/ChangeLog:

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

* app.c (app_push): use XNEW macro.
* as.c: Likewise.
* config/obj-elf.c (obj_elf_change_section): Likewise.
(elf_copy_symbol_attributes): Likewise.
(obj_elf_size): Likewise.
(build_group_lists): Likewise.
* config/tc-aarch64.c (add_operand_error_record): Likewise.
(md_assemble): Likewise.
(tc_gen_reloc): Likewise.
(get_upper_str): Likewise.
(aarch64_parse_features): Likewise.
* config/tc-arm.c (insert_reg_alias): Likewise.
(insert_neon_reg_alias): Likewise.
(find_or_make_literal_pool): Likewise.
(s_arm_elf_cons): Likewise.
(add_unwind_opcode): Likewise.
(arm_parse_extension): Likewise.
* config/tc-avr.c (create_record_for_frag): Likewise.
* config/tc-crx.c: Likewise.
* config/tc-d30v.c: Likewise.
* config/tc-dlx.c (s_proc): Likewise.
* config/tc-ft32.c: Likewise.
* config/tc-h8300.c: Likewise.
* config/tc-hppa.c (pa_proc): Likewise.
(create_new_space): Likewise.
(create_new_subspace): Likewise.
* config/tc-i860.c: Likewise.
* config/tc-i960.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-iq2000.c (iq2000_add_macro): Likewise.
(iq2000_record_hi16): Likewise.
* config/tc-m32c.c (m32c_indirect_operand): Likewise.
* config/tc-m32r.c (debug_sym): Likewise.
(m32r_record_hi16): Likewise.
* config/tc-m68k.c (m68k_ip): Likewise.
(md_begin): Likewise.
* config/tc-mcore.c: Likewise.
* config/tc-microblaze.c (check_got): Likewise.
* config/tc-mips.c (append_insn): Likewise.
(s_mipsset): Likewise.
(mips_record_label): Likewise.
(s_mips_end): Likewise.
* config/tc-mmix.c (mmix_frob_file): Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-moxie.c: Likewise.
* config/tc-msp430.c: Likewise.
* config/tc-nds32.c (nds32_elf_save_pseudo_pattern): Likewise.
* config/tc-ns32k.c: Likewise.
* config/tc-or1k.c: Likewise.
* config/tc-pdp11.c: Likewise.
* config/tc-pj.c (fake_opcode): Likewise.
* config/tc-ppc.c (ppc_apuinfo_section_add): Likewise.
(ppc_macro): Likewise.
(ppc_dwsect): Likewise.
(ppc_machine): Likewise.
* config/tc-rl78.c (rl78_frag_init): Likewise.
* config/tc-rx.c (rx_frag_init): Likewise.
* config/tc-s390.c (s390_lit_suffix): Likewise.
(s390_machine): Likewise.
(s390_machinemode): Likewise.
* config/tc-score.c (s3_insert_reg): Likewise.
(s3_gen_reloc): Likewise.
* config/tc-score7.c (s7_insert_reg): Likewise.
(s7_gen_reloc): Likewise.
* config/tc-tic30.c (tic30_operand): Likewise.
* config/tc-tic4x.c (tic4x_inst_make): Likewise.
* config/tc-tic54x.c (stag_add_field): Likewise.
(tic54x_struct): Likewise.
(tic54x_space): Likewise.
(tic54x_field): Likewise.
(tic54x_mlib): Likewise.
(subsym_substitute): Likewise.
* config/tc-tic6x.c (tic6x_frob_label): Likewise.
* config/tc-vax.c: Likewise.
* config/tc-xc16x.c: Likewise.
* config/tc-xtensa.c (xtensa_add_insn_label): Likewise.
(directive_push): Likewise.
(xtensa_begin_directive): Likewise.
(tokenize_arguments): Likewise.
(xtensa_add_literal_sym): Likewise.
(new_resource_table): Likewise.
(resize_resource_table): Likewise.
(emit_single_op): Likewise.
(xtensa_create_trampoline_frag): Likewise.
(xtensa_maybe_create_literal_pool_frag): Likewise.
(xtensa_add_config_info): Likewise.
(xtensa_realloc_fixup_cache): Likewise.
(add_subseg_info): Likewise.
(cache_literal_section): Likewise.
(add_xt_block_frags): Likewise.
(add_xt_prop_frags): Likewise.
(init_op_placement_info_table): Likewise.
(build_section_rename): Likewise.
* config/tc-z80.c: Likewise.
* config/tc-z8k.c: Likewise.
* depend.c (register_dependency): Likewise.
* dwarf2dbg.c (get_line_subseg): Likewise.
(dwarf2_gen_line_info_1): Likewise.
(get_filenum): Likewise.
* ecoff.c (allocate_scope): Likewise.
(allocate_vlinks): Likewise.
(allocate_shash): Likewise.
(allocate_thash): Likewise.
(allocate_tag): Likewise.
(allocate_forward): Likewise.
(allocate_thead): Likewise.
(allocate_lineno_list): Likewise.
* expr.c (make_expr_symbol): Likewise.
* hash.c (hash_new_sized): Likewise.
* input-file.c (input_file_push): Likewise.
* listing.c (file_info): Likewise.
(listing_newline): Likewise.
* macro.c (new_formal): Likewise.
(define_macro): Likewise.
* remap.c (add_debug_prefix_map): Likewise.
* symbols.c (symbol_find_noref): Likewise.
(define_dollar_label): Likewise.
(fb_label_instance_inc): Likewise.
(symbol_relc_make_value): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 4 Apr 2016 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agouse xstrdup and friends more
Trevor Saunders [Sat, 2 Apr 2016 13:27:18 +0000 (09:27 -0400)]
use xstrdup and friends more

gas/ChangeLog:

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

* config/obj-elf.c (obj_elf_vendor_attribute): Use xstrdup.
* config/tc-ppc.c (ppc_frob_file_before_adjust): Likewise.
(ppc_znop): Likewise.
(ppc_pe_section): Likewise.
(ppc_frob_symbol): Likewise.
* config/tc-tic30.c (tic30_operand): Likewise.
* config/tc-tic4x.c (tic4x_sect): Likewise.
(tic4x_usect): Likewise.

8 years agocleanup FLT_CHARS and EXP_CHARS
Trevor Saunders [Sat, 2 Apr 2016 20:38:40 +0000 (16:38 -0400)]
cleanup FLT_CHARS and EXP_CHARS

Providing declarations in tc.h points out that alpha wasn't properly marking
FLT_CHARS as const.  We can also get rid of the confusing redefinition of
X_CHARS to mmix_x_chars.  Finally we can get rid of some now redundant
declarations of these constants.

gas/ChangeLog:

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

* config/tc-alpha.c: Const qualify FLT_CHARS.
* config/atof-ieee.c: Remove declarations of FLT_CHARS and EXP_CHARS.
* config/tc-cris.h: Likewise.
* expr.c: Likewise.
* config/tc-mmix.c (md_atof): Adjust comment.
* config/tc-mmix.h: Stop defining FLT_CHARS and EXP_CHARS as macros.
* tc.h: Declare FLT_CHARS and EXP_CHARS.

8 years agoupdate ChangeLog for previous commit
Trevor Saunders [Sun, 3 Apr 2016 23:49:05 +0000 (19:49 -0400)]
update ChangeLog for previous commit

8 years agomake score build again
Trevor Saunders [Sat, 2 Apr 2016 20:30:13 +0000 (16:30 -0400)]
make score build again

It needs a few more things to be const now.

gas/ChangeLog:

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

* config/tc-score.c (s3_gen_reloc): Add const qualifiers.
* config/tc-score7.c (s7_gen_reloc): Likewise.

8 years agoarm: change the type of a variable to bfd_reloc_code_real_type
Trevor Saunders [Thu, 31 Mar 2016 23:49:05 +0000 (19:49 -0400)]
arm: change the type of a variable to bfd_reloc_code_real_type

It is only ever assigned values in the enum, and it is passed to functions that
expect the argument's type to be the enum.

gas/ChangeLog:

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

* config/tc-arm.c (do_t_branch): Change the type of reloc to
bfd_reloc_code_real_type.

8 years agobfin: simplify current_inputline
Trevor Saunders [Sat, 2 Apr 2016 12:22:05 +0000 (08:22 -0400)]
bfin: simplify current_inputline

Its not used for anything outside of md_assemble () so it doesn't need to be
extern.  While we are there we can replace free () and xmalloc () with
XRESIZEVEC which should be faster.

gas/ChangeLog:

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

* config/bfin-parse.y (current_inputline): Remove definition.
* config/tc-bfin.c (md_assemble): Simplify use of current_inputline.

8 years agoavr: simplify some option parsing with strcasecmp ()
Trevor Saunders [Sat, 2 Apr 2016 11:57:10 +0000 (07:57 -0400)]
avr: simplify some option parsing with strcasecmp ()

     Instead of canonicalizing the argument we can just use a case insensitive
     compare.

gas/ChangeLog:

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

* config/tc-avr.c (md_parse_option): Use strcasecmp () to compare
strings.

8 years agoIPA: Fix build problem on !HAVE_GETAUXVAL
Marcin Kościelnicki [Sun, 3 Apr 2016 12:25:25 +0000 (14:25 +0200)]
IPA: Fix build problem on !HAVE_GETAUXVAL

These files need AT_PHDR, which is defined in elf.h.  If HAVE_GETAUXVAL
is set, it's implicitely included by sys/auxv.h.  Include it manually
for the opposite case.

gdb/gdbserver/ChangeLog:

* linux-aarch64-ipa.c: Add <elf.h> include.
* linux-ppc-ipa.c: Add <elf.h> include.
* linux-s390-ipa.c: Add <elf.h> include.

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

8 years agoPR19896, Segmentation fault on bad input
Alan Modra [Sat, 2 Apr 2016 06:47:26 +0000 (17:17 +1030)]
PR19896, Segmentation fault on bad input

PR 19896
* read.c (assign_symbol): Consume rest of line after an error
rather than continuing to process the line.

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

8 years agogdb: allow enumeration constants as second operand of BINOP_REPEAT
Artemiy Volkov [Fri, 1 Apr 2016 15:00:59 +0000 (16:00 +0100)]
gdb: allow enumeration constants as second operand of BINOP_REPEAT

This patch adds support for TYPE_CODE_ENUM values to be supplied
as right-hand side operand of the BINOP_REPEAT (@) operator. The
following should now work:

enum {
  sz = 17
};

int
main ()
{
  int arr[sz + 1] = { 0 };
  return 0; /* line 9 here */
}

(gdb) b 9
(gdb) r
(gdb) p arr@sz
$1 = {0 <repeats 17 times>}
(gdb)

A couple of tests is also included in this patch to demonstrate that it is
working as intended.

gdb/Changelog:

2016-04-01  Artemiy Volkov  <artemiyv@acm.org>

PR gdb/19820
* eval.c (evaluate_subexp_standard): Allow TYPE_CODE_ENUM to be
        the type of BINOP_REPEAT's second operand.

gdb/testsuite/Changelog:

2016-04-01  Artemiy Volkov  <artemiyv@acm.org>

PR gdb/19820
* gdb.base/printcmds.exp: Add artificial arrays tests.

8 years agogas/arc: Change 'LENGHT' to 'LENGTH'
Andrew Burgess [Mon, 28 Mar 2016 21:48:34 +0000 (22:48 +0100)]
gas/arc: Change 'LENGHT' to 'LENGTH'

Small spelling mistake in a #define, fixed in this commit.

gas/ChangeLog:

* config/tc-arc.h (MAX_FLAG_NAME_LENGHT): Rename to...
(MAX_FLAG_NAME_LENGTH): ...this.
(struct arc_flags): Update to use MAX_FLAG_NAME_LENGTH.
* config/tc-arc.c (tokenize_flags): Likewise.

8 years agoPR19886, --as-needed regression
Alan Modra [Fri, 1 Apr 2016 06:38:45 +0000 (17:08 +1030)]
PR19886, --as-needed regression

This isn't perfect in checking whether libraries will be loaded since
elf_link_add_object_symbols doesn't recurse down DT_NEEDED links.
(That happens later in ld/emultempl/elf32.em after_open.)  So in
effect this recursive check really only looks one level down the
DT_NEEDED tree.  Which is enough for the most common case, and
libc.so/ld.so in particular.

PR 19886
* elflink.c (on_needed_list): Recursively check needed status.
(elf_link_add_object_symbols): Adjust.

8 years agoConstify more
Alan Modra [Fri, 1 Apr 2016 12:07:50 +0000 (22:37 +1030)]
Constify more

* cgen.c (weak_operand_overflow_check): Return const char*.
* messages.c (as_internal_value_out_of_range): Formatting.
(as_warn_value_out_of_range): Consify prefix param.
(as_bad_value_out_of_range): Likewise.
* read.c (s_errwarn): Constify msg..
(s_float_space, float_cons): ..and err.
* as.h (as_warn_value_out_of_range, as_bad_value_out_of_range,
ieee_md_atof, vax_md_atof): Update prototypes.
* tc.h (md_atof): Update prototype.
* config/atof-ieee.c (ieee_md_atof): Return const char*.
* config/atof-vax.c (vax_md_atof): Likewise.
* config/obj-elf.c (obj_elf_parse_section_letters): Constify bad_msg.
* config/tc-aarch64.c (md_atof): Return const char*.
* config/tc-alpha.c (s_alpha_section_name): Likewise.
(s_alpha_comm): Constify sec_name.
(section_name): Constify.
(s_alpha_section): Consify name..
(alpha_elf_section_letter): ..and ptr_msg param..
(md_atof): ..and return.
* config/tc-alpha.h (alpha_elf_section_letter): Update prototype.
* config/tc-arc.c (md_atof): Return const char*.
* config/tc-arm.c (md_atof): Likewise.
* config/tc-avr.c (md_atof): Likewise.
* config/tc-bfin.c (md_atof): Likewise.
* config/tc-cr16.c (md_atof): Likewise.
* config/tc-cris.c (md_atof): Likewise.
* config/tc-crx.c (md_atof): Likewise.
* config/tc-d10v.c (md_atof): Likewise.
* config/tc-d30v.c (md_atof): Likewise.
* config/tc-dlx.c (md_atof): Likewise.
* config/tc-epiphany.c (md_atof): Likewise.
* config/tc-fr30.c (md_atof): Likewise.
* config/tc-frv.c (md_atof): Likewise.
* config/tc-ft32.c (md_atof): Likewise.
* config/tc-h8300.c (md_atof): Likewise.
* config/tc-hppa.c (struct default_subspace_dict): Constify name.
(struct default_space_dict): Likewise.
(create_new_space): Constify name param.
(create_new_subspace): Likewise.
(is_defined_space, is_defined_subspace): Likewise.
(pa_parse_space_stmt): Constify space_name param.
(md_atof): Return const char*.
(pa_spaces_begin): Constify name.
* config/tc-i370.c (md_atof): Return const char*.
* config/tc-i386.c (md_atof): Likewise.
(x86_64_section_letter): Constify ptr_msg param.
* config/tc-i386.h (x86_64_section_letter): Update prototype.
* config/tc-i860.c (struct i860_it): Constify error.
(md_atof): Return const char*.
* config/tc-i960.c (md_atof): Likewise.
* config/tc-ia64.c (md_atof): Likewise.
(ia64_elf_section_letter): Constify ptr_msg param.
* config/tc-ia64.h (ia64_elf_section_letter): Update prototype.
* config/tc-ip2k.c (md_atof): Return const char*.
* config/tc-iq2000.c (md_atof): Likewise.
* config/tc-lm32.c (md_atof): Likewise.
* config/tc-m32c.c (md_atof): Likewise.
* config/tc-m32r.c (md_atof): Likewise.
* config/tc-m68hc11.c (md_atof): Likewise.
* config/tc-m68k.c (md_atof): Likewise.
* config/tc-mcore.c (md_atof): Likewise.
* config/tc-mep.c (md_atof): Likewise.
(mep_elf_section_letter): Constify ptr_msg param.
* config/tc-mep.h (mep_elf_section_letter): Update prototype.
* config/tc-metag.c (md_atof): Return const char*.
* config/tc-microblaze.c (md_atof): Likewise.
* config/tc-microblaze.h (md_atof): Delete prototype.
* config/tc-mips.c (mips_parse_argument_token): Constify err.
(md_atof): Return const char*.
* config/tc-mmix.c (md_atof): Likewise.
* config/tc-mn10200.c (md_atof): Likewise.
* config/tc-mn10300.c (md_atof): Likewise.
* config/tc-moxie.c (md_atof): Likewise.
* config/tc-msp430.c (md_atof): Likewise.
* config/tc-mt.c (md_atof): Likewise.
* config/tc-nds32.c (md_atof): Likewise.
* config/tc-nios2.c (md_atof): Likewise.
(nios2_elf_section_letter): Constify ptr_msg param.
* config/tc-nios2.h (nios2_elf_section_letter): Update prototype.
* config/tc-ns32k.c (md_atof): Return const char*.
* config/tc-or1k.c (md_atof): Likewise.
* config/tc-pdp11.c (struct pdp11_code): Constify error.
(md_atof): Return const char*.
* config/tc-pj.c (md_atof): Likewise.
* config/tc-ppc.c (md_atof): Likewise.
* config/tc-rl78.c (md_atof): Likewise.
* config/tc-rx.c (md_atof): Likewise.
* config/tc-s390.c (md_atof): Likewise.
* config/tc-score.c (s3_atof, md_atof): Likewise.
* config/tc-sh.c (md_atof): Likewise.
* config/tc-sparc.c (struct sparc_it): Constify error.
(md_atof): Return const char*.
* config/tc-spu.c (md_atof): Likewise.
* config/tc-tic30.c (md_atof): Likewise.
* config/tc-tic4x.c (md_atof): Likewise.
* config/tc-tic54x.c (md_atof): Likewise.
* config/tc-tic6x.c (md_atof): Likewise.
* config/tc-tilegx.c (md_atof): Likewise.
* config/tc-tilepro.c (md_atof): Likewise.
* config/tc-v850.c (parse_register_list, md_atof): Likewise.
* config/tc-vax.c (md_atof): Likewise.
* config/tc-visium.c (md_atof): Likewise.
* config/tc-xc16x.c (md_atof): Likewise.
* config/tc-xgate.c (md_atof): Likewise.
* config/tc-xstormy16.c (md_atof): Likewise.
* config/tc-xtensa.c (md_atof): Likewise.
* config/tc-z80.c (md_atof): Likewise.
* config/tc-z8k.c (md_atof): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 1 Apr 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

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.