platform/upstream/binutils.git
6 years agoS12Z: Make disassebler work for --enable-targets=all config.
John Darrington [Sat, 8 Sep 2018 04:59:09 +0000 (06:59 +0200)]
S12Z: Make disassebler work for --enable-targets=all config.

    opcodes/
    * disassemble.c (ARCH_s12z): Define if ARCH_all.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 8 Sep 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agogdb/testsuite: Make test names unique in gdb.base/watchpoint.exp
Andrew Burgess [Fri, 7 Sep 2018 13:06:53 +0000 (14:06 +0100)]
gdb/testsuite: Make test names unique in gdb.base/watchpoint.exp

Extend test names and add test name prefixes to make test names
unique.

gdb/testsuite/ChangeLog:

* gdb.base/watchpoint.exp (test_complex_watchpoint): Extend test
names, and add test prefixes to make test names unique.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 7 Sep 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoGenerate NT_PROCSTAT_{AUXV,VMMAP,PS_STRINGS} in FreeBSD coredumps
Simon Ser [Thu, 6 Sep 2018 22:03:19 +0000 (15:03 -0700)]
Generate NT_PROCSTAT_{AUXV,VMMAP,PS_STRINGS} in FreeBSD coredumps

gcore generates NT_AUXV and NT_FILE notes for Linux targets.  On
FreeBSD auxv is stored in a NT_PROCSTAT_AUXV section, virtual memory
mappings are stored in a NT_PROCSTAT_VMMAP, and both are prefixed with
the struct size.  In addition, store a NT_PROCSTAT_PS_STRINGS note
saving the initial location of the argv[] and environment[] arrays.

gdb/ChangeLog:

PR gdb/23105
* fbsd-nat.c (fbsd_nat_target::xfer_partial): Add support for
TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
* fbsd-tdep.c (fbsd_make_note_desc): New.
(fbsd_make_corefile_notes): Write NT_PROCSTAT_AUXV,
NT_PROCSTAT_VMMAP and NT_PROCSTAT_PS_STRINGS notes.
* target.h (enum target_object) Add FreeBSD-specific
TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.

6 years agocompile: Remove non-const reference parameters
Simon Marchi [Thu, 6 Sep 2018 12:48:10 +0000 (13:48 +0100)]
compile: Remove non-const reference parameters

As mentioned here:

  https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Avoid_non-const_reference_parameters.2C_use_pointers_instead

we prefer to avoid non-const references.  This patch changes the
non-const references I could find in the compile/ directory, either by
making them rvalue-reference (&&) or changing them to pointers.

I'd say all the changes are pretty obvious, except the one in
compile_cplus_instance::enter_scope which might require more attention.

gdb/ChangeLog:

* compile/compile-c.h (generate_c_for_variable_locations):
Change reference to pointer.
* compile/compile-c-support.c (compile_program) <compute>:
Likewise.
* compile/compile-c-symbols.c (generate_vla_size): Likewise.
(generate_c_for_for_one_variable): Likewise
(generate_c_for_variable_locations): Likewise
* compile/compile-c-types.c (compile_c_instance::convert_type):
Likewise
* compile/compile-cplus-symbols.c (convert_one_symbol):
std::move the scope passed to enter_scope.
* compile/compile-cplus-types.c
(compile_cplus_instance::enter_scope): Make parameter
rvalue-reference.
(compile_cplus_instance::new_scope): Change reference to
pointer.
(compile_cplus_instance::convert_type): Likewise
(compile_cplus_convert_typedef): std::move the scope passed to
enter_scope.
(compile_cplus_convert_struct_or_union): Likewise.
(compile_cplus_convert_enum): Likewise.
(compile_cplus_convert_namespace): Likewise.
* compile/compile-cplus.h (compile_cplus_instance)
<enter_scope>: Make parameter rvalue-reference.
* compile/compile-internal.h (compile_instance)
<get_cached_type>: Likewise
* compile/compile-loc2c.c (push): Likewise
(pushf): Likewise
(unary): Likewise
(binary): Likewise
(print_label): Likewise
(pushf_register_address): Likewise
(pushf_register): Likewise
(do_compile_dwarf_expr_to_c): Likewise
(compile_dwarf_expr_to_c): Likewise
(compile_dwarf_bounds_to_c): Likewise
* compile/compile.c (compile_instance::get_cached_type):
Likewise
* compile/compile.h (compile_dwarf_expr_to_c): Likewise.
(compile_dwarf_bounds_to_c): Likewise
* dwarf2loc.c (locexpr_generate_c_location): Likewise.
(dwarf2_compile_property_to_c): Likewise
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Likewise

6 years agoRemove unused tui_win_element::highlight
Simon Marchi [Thu, 6 Sep 2018 12:35:32 +0000 (13:35 +0100)]
Remove unused tui_win_element::highlight

gdb/ChangeLog:

* tui/tui-data.h (struct tui_win_element) <highlight>: Remove.
* tui/tui-data.c (init_content_element): Don't initialize it.

6 years agoRemove unused tui_win_info::detail::opaque
Simon Marchi [Thu, 6 Sep 2018 11:08:33 +0000 (12:08 +0100)]
Remove unused tui_win_info::detail::opaque

gdb/ChangeLog:

* tui/tui-data.h (struct tui_win_info)
<detail::opaque>: Remove.
* tui/tui-data.c (init_win_info): Remove assignment.

6 years agoPR23570, AVR .noinit section defaults to PROGBITS
Alan Modra [Tue, 4 Sep 2018 00:43:26 +0000 (10:13 +0930)]
PR23570, AVR .noinit section defaults to PROGBITS

Revert commit 8744470deab and instead use the standard special_sections
support.

PR 23570
bfd/
* elf32-avr.c (elf_avr_special_sections): New.
(elf_backend_special_sections): Define.
gas/
* config/tc-avr.c: Revert 2018-09-03 change.

6 years agoMake -Wformat-nonliteral work with gcc
Tom Tromey [Wed, 5 Sep 2018 19:46:47 +0000 (13:46 -0600)]
Make -Wformat-nonliteral work with gcc

After looking into why the build failed for Simon but not for me, we
found that the underlying cause was due to how gcc treats
-Wformat-nonliteral.  gcc requires -Wformat to be given first; but
warning.m4 was not doing this, so -Wformat-nonliteral was not being
used.

This patch changes warning.m4 to account gcc's requirement.

This then showed that the target-float.c build change in the earlier
Makefile patch was also incorrect.  Simon didn't see this in his
build, but gcc now points it out.  So, this patch fixes this problem
as well.

2018-09-05  Tom Tromey  <tom@tromey.com>

* warning.m4 (AM_GDB_WARNINGS): Add -Wformat when testing
-Wformat-nonliteral.
* target-float.c (host_float_ops<T>::to_string)
(host_float_ops<T>::from_string): Use
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL.
* configure: Rebuild.

gdb/gdbserver/ChangeLog
2018-09-05  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.

6 years agoDisable -Wformat-nonliteral in parts of printcmd.c
Simon Marchi [Thu, 6 Sep 2018 03:21:51 +0000 (21:21 -0600)]
Disable -Wformat-nonliteral in parts of printcmd.c

commit 3322c5d9a1 ("Remove unneeded explicit .o targets") broke the
build with clang, because -Wno-format-nonliteral was in fact needed.
This patch fixes the problem by introducing
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL and using it in printcmd.c.  This
seems preferable to reverting the patch because now the warning
suppression is more targeted.

gdb/ChangeLog
2018-09-05  Simon Marchi  <simon.marchi@ericsson.com>

* printcmd.c (printf_c_string): Use
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL.
(printf_wide_c_string, printf_pointer, ui_printf): Likewise.

include/ChangeLog
2018-09-05  Simon Marchi  <simon.marchi@ericsson.com>

* diagnostics.h (DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL): New macro.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Sep 2018 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRemove unnecessary casts from cli-cmds.c
Tom Tromey [Wed, 5 Sep 2018 06:00:31 +0000 (00:00 -0600)]
Remove unnecessary casts from cli-cmds.c

I noticed a couple of unnecessary casts in cli-cmds.c.  This patch
removes them.

Tested by rebuilding.  I'm checking this in.

gdb/ChangeLog
2018-09-05  Tom Tromey  <tom@tromey.com>

* cli/cli-cmds.c (shell_escape, edit_command): Remove cast.

6 years ago[gdb/exp] Handle DW_OP_GNU_variable_value refs to abstract dies
Tom de Vries [Fri, 24 Aug 2018 10:01:10 +0000 (12:01 +0200)]
[gdb/exp] Handle DW_OP_GNU_variable_value refs to abstract dies

Consider a vla variable 'a' in function f1:
...
 <2><1a7>: Abbrev Number: 11 (DW_TAG_variable)
    <1a8>   DW_AT_description : a
    <1aa>   DW_AT_abstract_origin: <0x311>
...
with abstract origin 'a':
...
 <2><311>: Abbrev Number: 3 (DW_TAG_variable)
    <312>   DW_AT_name        : a
    <317>   DW_AT_type        : <0x325>
...
and inherited abstract vla type:
...
 <1><325>: Abbrev Number: 9 (DW_TAG_array_type)
    <326>   DW_AT_type        : <0x33a>
 <2><32e>: Abbrev Number: 10 (DW_TAG_subrange_type)
    <32f>   DW_AT_type        : <0x2ea>
    <333>   DW_AT_upper_bound : 5 byte block: fd 1b 3 0 0
                                (DW_OP_GNU_variable_value: <0x31b>)
...
where the upper bound refers to this artificial variable D.1922 without location
attribute:
...
 <2><31b>: Abbrev Number: 8 (DW_TAG_variable)
    <31c>   DW_AT_description : (indirect string, offset: 0x39a): D.1922
    <320>   DW_AT_type        : <0x2ea>
    <324>   DW_AT_artificial  : 1
...

Currently, when we execute "p sizeof (a)" in f1, the upper bound is calculated
by evaluating the DW_OP_GNU_variable_value expression referring to D.1922, but
since that die doesn't have a location attribute, we get:
...
value has been optimized out
...

However, there's also artificial variable D.4283 that is sibling of vla
variable 'a', has artificial variable D.1922 as abstract origin, and has a
location attribute:
...
 <2><1ae>: Abbrev Number: 12 (DW_TAG_variable)
    <1af>   DW_AT_description : (indirect string, offset: 0x1f8): D.4283
    <1b3>   DW_AT_abstract_origin: <0x31b>
    <1b7>   DW_AT_location    : 11 byte block: 75 1 8 20 24 8 20 26 31 1c 9f
                                (DW_OP_breg5 (rdi):1; DW_OP_const1u: 32;
 DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra;
 DW_OP_lit1; DW_OP_minus; DW_OP_stack_value)
...

The intended behaviour for DW_OP_GNU_variable_value is to find a die that
refers to D.1922 as abstract origin, has a location attribute and is
'in scope', so the expected behaviour is:
...
$1 = 6
...

The 'in scope' concept can be thought of as variable D.1922 having name
attribute "D.1922", and variable D.4283 inheriting that attribute, resulting
in D.4283 being declared with name "D.1922" alongside vla a in f1, and when we
lookup "DW_OP_GNU_variable_value D.1922", it should work as if we try to find
the value of a variable named "D.1922" on the gdb command line using
"p D.1922", and we should return the value of D.4283.

This patch fixes the case described above, by:
- adding a field abstract_to_concrete to struct dwarf2_per_objfile,
- using that field to keep track of which concrete dies are instances of an
  abstract die, and
- using that information when getting the value DW_OP_GNU_variable_value.

Build and reg-tested on x86_64-linux.

2018-09-05  Tom de Vries  <tdevries@suse.de>

* dwarf2loc.c (sect_variable_value): Call indirect_synthetic_pointer
with resolve_abstract_p == true.
(indirect_synthetic_pointer): Add resolve_abstract_p parameter,
defaulting to false. Propagate resolve_abstract_p to
dwarf2_fetch_die_loc_sect_off.
* dwarf2loc.h (dwarf2_fetch_die_loc_sect_off): Add resolve_abstract_p
parameter, defaulting to false.
* dwarf2read.c (read_variable): Add variable to abstract_to_concrete.
(dwarf2_fetch_die_loc_sect_off): Add and handle resolve_abstract_p
parameter.
* dwarf2read.h (struct die_info): Forward-declare.
(die_info_ptr): New typedef.
(struct dwarf2_per_objfile): Add abstract_to_concrete field.

* gdb.dwarf2/varval.exp: Add test.

6 years agoDocument the GDB 8.2 release in gdb/ChangeLog
Joel Brobecker [Wed, 5 Sep 2018 08:02:27 +0000 (10:02 +0200)]
Document the GDB 8.2 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 8.2 released.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Sep 2018 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agobfd, sparc: avoid duplicated error messages on invalid relocations.
Jose E. Marchesi [Tue, 4 Sep 2018 18:19:06 +0000 (20:19 +0200)]
bfd, sparc: avoid duplicated error messages on invalid relocations.

This patch avoids a duplicated error message when an invalid
relocation number is read from an object file in sparc-* ELF targets:

$ strip -g test.o
strip: test.o: unsupported relocation type 0xd7
strip: test.o: unsupported relocation type 0xd7
strip: test.o: bad value

Tested in x86_64-linux-gnu, sparc64-linux-gnu and sparc-linux-gnu
targets.

bfd/ChangeLog:

2018-09-04  Jose E. Marchesi  <jose.marchesi@oracle.com>

* elfxx-sparc.c (_bfd_sparc_elf_info_to_howto): Do not issue an
error when an invalid relocation is passed;  this is already done
by `_bfd_sparc_elf_info_to_howto_ptr'.

6 years agobfd, sparc: issue an error when reading relocations with invalid symbol references.
Jose E. Marchesi [Tue, 4 Sep 2018 17:02:38 +0000 (19:02 +0200)]
bfd, sparc: issue an error when reading relocations with invalid symbol references.

The function `elf64_sparc_slurp_one_reloc_table' in elf64-sparc.c
currently checks that the symbol indexes read in the r_sym fields of
relocations are in range.  This is done for both dynamic and
non-dynamic symbols.  This avoids subsequent invalid memory accesses.
However, no error is issued to the user.

This patch makes BFD to issue an error when the read symbol index is
out of range, following the same behavior implemented in both the
generic ELF routines and other ELF backends (such as mips64).

Tested in x86_64-linux-gnu, sparc64-linux-gnu, and
--enable-targets=all.

2018-09-04  Jose E. Marchesi  <jose.marchesi@oracle.com>

            * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Issue an
            error when an invalid symbol index is retrieved in ELF64_R_SYM of
            a relocation seen in an input file.

6 years agoAutomatically update "aclocal_m4_deps" when updating gnulib
Sergio Durigan Junior [Sun, 2 Sep 2018 21:11:46 +0000 (17:11 -0400)]
Automatically update "aclocal_m4_deps" when updating gnulib

When we update gnulib using our "update-gnulib.sh" tool, it doesn't
automatically update the list of M4 files present at
gnulib/Makefile.in:aclocal_m4_deps.  This patch extends the tool to do
that.  It also puts "aclocal_m4_deps" in its own file (a Makefile
fragment), so that it's easier to update it programatically.

Tested by generating the file and diff'ing the results against the
current version of "aclocal_m4_deps".

gdb/ChangeLog:
2018-09-04  Sergio Durigan Junior  <sergiodj@redhat.com>
    Pedro Alves  <palves@redhat.com>

* gnulib/Makefile.in (aclocal_m4_deps): Move to
"aclocal-m4-deps.mk".  Include file here.
$(srcdir)/aclocal.m4: Add "configure.ac".
* gnulib/aclocal-m4-deps.mk: New file.
* gnulib/update-gnulib.sh: Automatically update
"aclocal-m4-deps.mk".

6 years agoRemove --enable-multi-ice
Tom Tromey [Sat, 1 Sep 2018 16:30:18 +0000 (10:30 -0600)]
Remove --enable-multi-ice

gdb's configure script accepts --enable-multi-ice, but the code this
refers to is long gone.  This patch removes the option entirely.

gdb/ChangeLog
2018-09-04  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.
* configure.ac: Remove multi-ice code.

6 years agoSimplify ada-exp.o rule
Tom Tromey [Sat, 1 Sep 2018 16:28:34 +0000 (10:28 -0600)]
Simplify ada-exp.o rule

The ada-exp.o rule no longer needs to pass -Wno-old-style-definition
to the compiler, as this option has no meaning in C++.  So, This patch
simplifies the explicit ada-exp.o rule in the Makefile.  The rule is
still needed because, according to the comment, ada-exp.c may appear
in the srcdir.

gdb/ChangeLog
2018-09-04  Tom Tromey  <tom@tromey.com>

* Makefile.in (GDB_WARN_CFLAGS_NO_DEFS): Remove.
(ada-exp.o): Update.

6 years agoRemove unneeded explicit .o targets
Tom Tromey [Sat, 1 Sep 2018 16:23:48 +0000 (10:23 -0600)]
Remove unneeded explicit .o targets

Makefile.in had special cases to compile printcmd.o and target-float.o
with a different set of warnings.  However, this is no longer
required, so this patch removes those rules.

gdb/ChangeLog
2018-09-04  Tom Tromey  <tom@tromey.com>

* Makefile.in (printcmd.o, target-float.o): Remove.
(GDB_WARN_CFLAGS_NO_FORMAT): Remove.

6 years agoRemove obsolete comments from Makefiles
Tom Tromey [Sat, 1 Sep 2018 16:23:15 +0000 (10:23 -0600)]
Remove obsolete comments from Makefiles

This removes an obsolete comment from Makefile.in.  This was copied
into gnulib/Makefile.in, so this removes that comment as well.

gdb/ChangeLog
2018-09-04  Tom Tromey  <tom@tromey.com>

* gnulib/Makefile.in: Remove obsolete comment.
* Makefile.in: Remove obsolete comment.

6 years agoFix batch exit status test failure on Fedora 28
Gary Benson [Mon, 3 Sep 2018 15:14:55 +0000 (16:14 +0100)]
Fix batch exit status test failure on Fedora 28

This commit adds calls to remote_close and clear_gdb_spawn_id to
gdb.base/batch-exit-status.exp, fixing failures reported by buildbot
on Fedora 28 where gdb_spawn_id not being reset by the previous test
caused default_gdb_spawn to return without spawning.

This commit also changes the test to use detect GDB's exit using
gdb_test_multiple expecting 'eof', rather than using 'wait -i' alone.
This means the testcase won't hang forever on failure as fixed in
gdb.base/quit.exp by commit 15763a09d4ae ("Fix 'gdb.base/quit.exp
hangs forever' if the test fails").

gdb/testsuite/ChangeLog:

* gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect
'eof' before 'wait -i'.  Use remote_close and clear_gdb_spawn_id.

6 years agogas, sparc: Allow non-fpop2 instructions before floating point branches
Daniel Cederman [Tue, 4 Sep 2018 13:25:52 +0000 (06:25 -0700)]
gas, sparc: Allow non-fpop2 instructions before floating point branches

Sparc V8 does not allow fpop2 instructions (floating point
comparisons) immediately before floating point branches.  From the
SPARC Architecture Manual Version 8, section B.22 "Branch on
Floating-point Condition Codes Instructions":

"If the instruction executed immediately before an FBfcc is an FPop2
instruction, the result of the FBfcc is undefined.  Therefore, at
least one non FPop2 instruction should be executed between the FPop2
instruction and the FBfcc instruction."

The existing check in GAS, however, does not allow any kind of
floating point instruction before the branch.  This patch adds an
extra condition to only disallow fpop2 instructions.

gas/ChangeLog:

2018-09-04  Daniel Cederman  <cederman@gaisler.com>

* config/tc-sparc.c (md_assemble): Allow non-fpop2 instructions
            before floating point branches for Sparc V8 and earlier.
* testsuite/gas/sparc/sparc.exp: Execute the new test.
* testsuite/gas/sparc/v8branch.d: New test.
* testsuite/gas/sparc/v8branch.s: New test.

6 years agogdb/riscv: Fix an ARI warning
Andrew Burgess [Tue, 4 Sep 2018 10:51:10 +0000 (11:51 +0100)]
gdb/riscv: Fix an ARI warning

This patch fixes an ARI violation in riscv-tdep.c (line ends with
'+').

gdb/ChangeLog:

* riscv-tdep.c (riscv_frame_cache): Fix ARI warning, don't end a
line with '+'.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Sep 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoChange the .section directive for the AVR assembler so that the .noinit section is...
Nick Clifton [Mon, 3 Sep 2018 16:06:05 +0000 (17:06 +0100)]
Change the .section directive for the AVR assembler so that the .noinit section is always given the ELF NOBITS section type.

PR gas/23570
* config/tc-avr.c (md_pseudo_table): Add entry for "secction".
(avr_set_section): New function.  Ensures that the .noinit section
gets the NOBITS ELF section type.

6 years agogdb/riscv: Provide non-DWARF stack unwinder
Andrew Burgess [Tue, 17 Jul 2018 14:22:39 +0000 (15:22 +0100)]
gdb/riscv: Provide non-DWARF stack unwinder

Collects information during the prologue scan and uses this to unwind
registers when no DWARF information is available.

This patch has been tested by disabling the DWARF stack unwinders, and
running the complete GDB testsuite against a range of RISC-V targets.
The results are comparable to running with the DWARF unwinders in
place.

gdb/ChangeLog:

* riscv-tdep.c: Add 'prologue-value.h' include.
(struct riscv_unwind_cache): New struct.
(riscv_debug_unwinder): New global.
(riscv_scan_prologue): Update arguments, capture register details
from prologue scan.
(riscv_skip_prologue): Reformat arguments line, move end of
prologue calculation into riscv_scan_prologue.
(riscv_frame_cache): Update return type, create
riscv_unwind_cache, scan the prologue, and fill in remaining cache
details.
(riscv_frame_this_id): Use frame id computed in riscv_frame_cache.
(riscv_frame_prev_register): Use the trad_frame within the
riscv_unwind_cache.
(_initialize_riscv_tdep): Add 'set/show debug riscv unwinder'
flag.

6 years agogdb: Extend the trad-frame API
Andrew Burgess [Fri, 17 Aug 2018 07:54:26 +0000 (08:54 +0100)]
gdb: Extend the trad-frame API

Adds two new functions to the trad-frame API and update the internals
of trad-frame to use the new functions.  These functions will be used
in later commits.

gdb/ChangeLog:

* trad-frame.h (trad_frame_set_realreg): Declare.
(trad_frame_set_addr): Declare.
* trad-frame.c (trad_frame_set_realreg): Define new function.
(trad_frame_set_addr): Define new function.
(trad_frame_set_reg_realreg): Use new function.
(trad_frame_set_reg_addr): Use new function.

6 years agoUpdated Japanese translation for the binutils sub-directory.
Nick Clifton [Mon, 3 Sep 2018 14:04:34 +0000 (15:04 +0100)]
Updated Japanese translation for the binutils sub-directory.

6 years agoUpdated Finnish translation for the ld sub-directory.
Nick Clifton [Mon, 3 Sep 2018 12:40:32 +0000 (13:40 +0100)]
Updated Finnish translation for the ld sub-directory.

* po/fi.po: Updated Finnish translation.

6 years agoPR23595, simple objcopy of executable failure for msp430-elf
Jozef Lawrynowicz [Mon, 3 Sep 2018 01:34:05 +0000 (11:04 +0930)]
PR23595, simple objcopy of executable failure for msp430-elf

VMA of the first section in the segment containing the ELF file header
(and possibly section headers too) can't be used to reliably find the
size of the headers plus padding.  What's really needed is sh_offset
of the first section assuming it has contents (vma does have a
relationship to sh_offset, but is only guaranteed in demand paged
executables).

If the first section is SHT_NOBITS and it hasn't been converted to
have file contents by the existence of a following SHT_PROGBITS
section in the same segment, the sh_offset value also isn't reliable.

PR 23595
elf.c (copy_elf_program_header): When first segment contains
only the headers and SHT_NOBITS sections, use segment p_filesz
to calculate header and padding size.  Use filepos of the first
section otherwise.

6 years agoRe: ld: Lookup section in output with the same name
Alan Modra [Mon, 3 Sep 2018 01:19:57 +0000 (10:49 +0930)]
Re: ld: Lookup section in output with the same name

Fixes pr23591 test failures on hppa64-hpux and score-elf, and xfails
frv-linux and lm32-linux.

PR ld/23591
* testsuite/ld-elf/pr23591a.s,
* testsuite/ld-elf/pr23591b.s,
* testsuite/ld-elf/pr23591c.s: Don't start directives in first column.
* testsuite/ld-elf/pr23591.d: xfail frv-linux and lm32-linux.
Allow __start___sancov_cntrs as a local symbol.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Sep 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Sep 2018 00:00:59 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix ARI violations in c++compile
Keith Seitz [Thu, 30 Aug 2018 16:26:47 +0000 (09:26 -0700)]
Fix ARI violations in c++compile

This patch fixes two violations of the ARI (use of ATTRIBUTE_UNUSED and
"%ll").

gdb/ChangeLog

* compile/compile-cplus-types.c (compile_cplus_debug_output_1): Use
pulongest instead of "%lld".
* compile/compile-cplus-symbols.c (gcc_cplus_convert_symbol): Remove
ATTRIBUTE_UNUSED.

6 years agoAllow an IR object with unknown architecture
H.J. Lu [Sat, 1 Sep 2018 02:56:25 +0000 (19:56 -0700)]
Allow an IR object with unknown architecture

An IR object may have an unknown architecture.  But it is compatible
with other architecture.

PR ld/23600
* archures.c (bfd_arch_get_compatible): Allow an IR object with
unknown architecture.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Sep 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRISC-V: Correct the requirement of compressed floating point instructions
Jim Wilson [Fri, 31 Aug 2018 19:23:05 +0000 (12:23 -0700)]
RISC-V: Correct the requirement of compressed floating point instructions

2018-08-31  Kito Cheng  <kito@andestech.com>
gas/
* testsuite/gas/riscv/c-fld-fsd-fail.d: New.
* testsuite/gas/riscv/c-fld-fsd-fail.l: Likewise.
* testsuite/gas/riscv/c-fld-fsd-fail.s: Likewise.
opcodes/
* riscv-opc.c (riscv_opcodes): Fix incorrect subset info for
compressed floating point instructions.

6 years agoSet TYPE_LENGTH on a variant part
Tom Tromey [Thu, 30 Aug 2018 21:04:03 +0000 (15:04 -0600)]
Set TYPE_LENGTH on a variant part

gdb represents a DW_TAG_variant_part as a union.  While normally DWARF
would not set the size of a DW_TAG_variant_part, gdb's representation
requires the TYPE_LENGTH to be set.

This patch arranges to set the TYPE_LENGTH of a variant part if it has
not already been set.

This fixes some Rust regressions when testing against a version of
rustc that emits DW_TAG_variant_part.

gdb/ChangeLog
2018-08-31  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (dwarf2_add_field): Set the TYPE_LENGTH of the
variant part type.

6 years agoFix a small bug in gdb.rust/simple.rs
Tom Tromey [Wed, 29 Aug 2018 17:08:46 +0000 (11:08 -0600)]
Fix a small bug in gdb.rust/simple.rs

I noticed that gdb.rust/simple.rs had two local variables named "v".
This didn't previous cause problems, but with a newer rust compiler
this resulted in a test failure.  (It should have failed all along, so
I suppose earlier passes were due to a compiler bug.)

This patch renames the second variable.

gdb/testsuite/ChangeLog
2018-08-31  Tom Tromey  <tom@tromey.com>

* gdb.rust/simple.rs: Rename second variable "v".

6 years agoRegenerate gdbarch.h
Pedro Alves [Fri, 31 Aug 2018 17:55:59 +0000 (18:55 +0100)]
Regenerate gdbarch.h

The previous commit included a stale gdbarch.h from an earlier version
of that patch by mistake.

gdb/ChangeLog:
2018-08-31  Pedro Alves  <palves@redhat.com>

* gdbarch.h: Regenerate.

6 years agoAdd comment describing continuable/steppable/non-steppable watchpoints
Pedro Alves [Fri, 31 Aug 2018 13:24:13 +0000 (14:24 +0100)]
Add comment describing continuable/steppable/non-steppable watchpoints

These weren't described anywhere in the sources.

gdb/ChangeLog:
2018-08-31  Pedro Alves  <palves@redhat.com>

* gdbarch.sh (have_nonsteppable_watchpoint): Add comment.
* target.h (Hardware watchpoint interfaces): Describe
continuable/steppable/non-steppable watchpoints.
* gdbarch.h, gdbarch.c: Regenerate.

6 years agoEliminate target_have_continuable_watchpoint
Pedro Alves [Fri, 31 Aug 2018 17:47:12 +0000 (18:47 +0100)]
Eliminate target_have_continuable_watchpoint

target_have_continuable_watchpoint isn't used anywhere so remove it.
The property isn't necessary because checking for "continuable" is the
same as checking for "!steppable && !non-steppable".

gdb/ChangeLog:
2018-08-31  Pedro Alves  <palves@redhat.com>

* nto-procfs.c (nto_procfs_target::have_continuable_watchpoint):
Delete.
* s390-linux-nat.c
(s390_linux_nat_target::have_continuable_watchpoint): Delete.
* target.h (target_ops::have_continuable_watchpoint): Delete.
(target_have_continuable_watchpoint): Delete.
* x86-nat.h (x86_nat_target::have_continuable_watchpoint): Delete.
* target-delegates.c: Regenerate.

6 years agogas/elf/section14.d: Change skip to xfail
H.J. Lu [Fri, 31 Aug 2018 16:40:54 +0000 (09:40 -0700)]
gas/elf/section14.d: Change skip to xfail

We will get an XPASS when h8300 port peculiarities are fixed, and will
fix the testsuite too.

* testsuite/gas/elf/section14.d: Change skip to xfail.
* testsuite/lib/gas-defs.exp (run_dump_test): Add xfail support.

6 years agold: Lookup section in output with the same name
H.J. Lu [Fri, 31 Aug 2018 16:25:31 +0000 (09:25 -0700)]
ld: Lookup section in output with the same name

When there are more than one input sections with the same section name,
SECNAME, linker picks the first one to define __start_SECNAME and
__stop_SECNAME symbols.  When the first input section is removed by
comdat group, we need to check if there is still an output section
with section name SECNAME.

PR ld/23591
* ldlang.c (undef_start_stop): Lookup section in output with
the same name.
* testsuite/ld-elf/pr23591.d: New file.
* testsuite/ld-elf/pr23591a.s: Likewise.
* testsuite/ld-elf/pr23591b.s: Likewise.
* testsuite/ld-elf/pr23591c.s: Likewise.

6 years agoUpdate gnulib/Makefile.in:aclocal_m4_deps
Sergio Durigan Junior [Wed, 29 Aug 2018 19:47:22 +0000 (15:47 -0400)]
Update gnulib/Makefile.in:aclocal_m4_deps

It was pointed by Pedro that gnulib/Makefile.in should be updated
accordingly after our local gnulib is also updated.  The specific part
that needs to be refreshed is the "aclocal_m4_deps" variable, which
lists the .m4 files present under the "gnulib/import/m4/" directory.
This patch does that.

No regressions introduced.

gdb/ChangeLog:
2018-08-31  Sergio Durigan Junior  <sergiodj@redhat.com>

* gnulib/Makefile.in (aclocal_m4_deps): Update according to
the files present in "gnulib/import/m4/".

6 years agoPowerPC64 --emit-relocs support for notoc stubs
Alan Modra [Wed, 29 Aug 2018 13:01:25 +0000 (22:31 +0930)]
PowerPC64 --emit-relocs support for notoc stubs

This patch uses the newly defined high-part REL16 relocs to emit
relocations on the notoc stubs as we already do for other stubs.

* elf64-ppc.c (num_relocs_for_offset): New function.
(emit_relocs_for_offset): New function.
(use_global_in_relocs): New function, split out from..
(ppc_build_one_stub): ..here.  Output relocations for notoc stubs.
(ppc_size_one_stub): Calculate reloc count for notoc stubs.
(ppc64_elf_size_stubs): Don't count undefined syms in stub_globals.

6 years agoPowerPC64 higher REL16 relocations
Alan Modra [Wed, 29 Aug 2018 03:58:21 +0000 (13:28 +0930)]
PowerPC64 higher REL16 relocations

There are occasions where someone might want to build a 64-bit
pc-relative offset from 16-bit pieces.  This adds the necessary REL16
relocs corresponding to existing ADDR16 relocs that can be used to
build 64-bit absolute values.

include/
* elf/ppc64.h (R_PPC64_REL16_HIGH, R_PPC64_REL16_HIGHA),
(R_PPC64_REL16_HIGHER, R_PPC64_REL16_HIGHERA),
(R_PPC64_REL16_HIGHEST, R_PPC64_REL16_HIGHESTA): Define.
(R_PPC64_LO_DS_OPT, R_PPC64_16DX_HA): Bump value.
bfd/
* reloc.c (BFD_RELOC_PPC64_REL16_HIGH, BFD_RELOC_PPC64_REL16_HIGHA),
(BFD_RELOC_PPC64_REL16_HIGHER, BFD_RELOC_PPC64_REL16_HIGHERA),
(BFD_RELOC_PPC64_REL16_HIGHEST, BFD_RELOC_PPC64_REL16_HIGHESTA):
Define.
* elf64-ppc.c (ppc64_elf_howto_raw): Add new REL16 howtos.
(ppc64_elf_reloc_type_lookup): Translate new REL16 relocs.
(ppc64_elf_check_relocs, ppc64_elf_relocate_section): Handle them.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.h (TC_FORCE_RELOCATION_SUB_LOCAL): Allow ADDR16
HIGH, HIGHA, HIGHER, HIGHERA, HIGHEST, and HIGHESTA relocs.
Group 16-bit relocs.
* config/tc-ppc.c (md_apply_fix): Translate those ADDR16 relocs
to REL16 when pcrel.  Sort relocs.

6 years agoRearrange ppc_size_one_stub and correct _notoc stub examples
Alan Modra [Wed, 29 Aug 2018 04:41:25 +0000 (14:11 +0930)]
Rearrange ppc_size_one_stub and correct _notoc stub examples

This patch rearranges ppc_size_one_stub to make it a little easier to
compare against ppc_build_one_stub, and makes a few other random
changes that might help for future maintenance.  There should be no
functional changes here.

The patch also fixes code examples in comments.  A couple of "ori"
instructions lacked the source register operand, and "@high" is the
correct reloc modifier to use in a sequence building a 64-bit value.
(@hi reports overflow of a 32-bit signed value.)

* elf64-ppc.c: Correct _notoc stub comments.
(ppc_build_one_stub): Simplify output of branch for notoc
long branch stub.  Don't include label offset of 8 bytes in
"off" calculation for notoc plt stub.  Don't emit insns to get pc.
(build_offset): Emit insns to get pc here instead.
(size_offset): Add 4 extra insns.
(plt_stub_size): Adjust for "off" and size_offset changes.
(ppc_size_one_stub): Rearrange code into a switch, duplicating
some to better match ppc_build_one_stub.

6 years agold: Pass -z separate-code to ld for property-x86-4a tests
H.J. Lu [Fri, 31 Aug 2018 12:11:03 +0000 (05:11 -0700)]
ld: Pass -z separate-code to ld for property-x86-4a tests

Pass -z separate-code to ld for property-x86-4a tests to generate
the expected .note.gnu.property section.  Also run i386 tests for
x86_64-*-elf* targets.

* testsuite/ld-i386/i386.exp: Also run for x86_64-*-elf* targets.
* testsuite/ld-i386/property-x86-4a.d: Pass -z separate-code to
ld.
* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a.d: Likewise.

6 years agold: Append -mx86-used-note=no to ASFLAGS
H.J. Lu [Fri, 31 Aug 2018 11:47:41 +0000 (04:47 -0700)]
ld: Append -mx86-used-note=no to ASFLAGS

Since x86 assembler may generate .note.gnu.property section, append
-mx86-used-note=no to tests which don't expect .note.gnu.property
section on ELF/x86 targets.

* testsuite/ld-elf/elf.exp (ASFLAGS): Save, append
-mx86-used-note=no and restore.
* testsuite/ld-ifunc/ifunc.exp (ASFLAGS): Likewise.
* testsuite/ld-scripts/defined.exp (ASFLAGS): Likewise.
* testsuite/ld-scripts/overlay-size.exp (ASFLAGS): Likewise

6 years agold: Append -Wa,-mx86-used-note=no for S-records tests
H.J. Lu [Fri, 31 Aug 2018 11:44:45 +0000 (04:44 -0700)]
ld: Append -Wa,-mx86-used-note=no for S-records tests

Since x86 assembler may generate .note.gnu.property section and S-records
can't handle .note.gnu.property sections, add -mx86-used-note=no to
S-records tests on ELF/x86 targets to avoid .note.gnu.property section.

* testsuite/ld-srec/srec.exp: Append -Wa,-mx86-used-note=no to
CC and CXX on ELF/x86 targets.

6 years agogas: Pass -mx86-used-note=no to assembler
H.J. Lu [Fri, 31 Aug 2018 11:42:51 +0000 (04:42 -0700)]
gas: Pass -mx86-used-note=no to assembler

Since x86 assembler may generate .note.gnu.property section, pass
-mx86-used-note=no to assembler for section2 test on ELF/x86 targets
to avoid .note.gnu.property section.

* testsuite/gas/elf/elf.exp: Pass -mx86-used-note=no to
assembler for section2 test on ELF/x86 targets.

6 years agox86: pass -mx86-used-note=no to assembler
H.J. Lu [Fri, 31 Aug 2018 11:39:21 +0000 (04:39 -0700)]
x86: pass -mx86-used-note=no to assembler

Since cfi/cfi-label.d is ELF/x86 specific, we can pass -mx86-used-note=no
to assembler.

* testsuite/gas/cfi/cfi-label.d: Pass -mx86-used-note=no to
assembler.

6 years agobinutils: Adjusted tests for .note.gnu.property section
H.J. Lu [Fri, 31 Aug 2018 11:38:12 +0000 (04:38 -0700)]
binutils: Adjusted tests for .note.gnu.property section

Since x86 assembler may generate .note.gnu.property section, adjust
binutils tests to handle it.

* testsuite/binutils-all/readelf.s-64: Adjusted for
.note.gnu.property section.
* testsuite/binutils-all/strip-3.d: Also strip
.note.gnu.property section.

6 years agox86: Add explicit -mx86-used-note=[yes|no] to tests
H.J. Lu [Fri, 31 Aug 2018 11:35:46 +0000 (04:35 -0700)]
x86: Add explicit -mx86-used-note=[yes|no] to tests

Pass explicit -mx86-used-note=[yes|no] to x86 assembler and update
expected outputs from "readelf -n" if needed.

binutils/

* testsuite/binutils-all/i386/compressed-1b.d: Pass
-mx86-used-note=no to assembler.
* testsuite/binutils-all/i386/compressed-1c.d: Likewise.
* testsuite/binutils-all/x86-64/compressed-1b.d: Likewise.
* testsuite/binutils-all/x86-64/compressed-1c.d: Likewise.
* testsuite/binutils-all/i386/empty.d: Pass -mx86-used-note=yes
to assembler and update expected output from "readelf -n".
* testsuite/binutils-all/i386/ibt.d: Likewise.
* testsuite/binutils-all/i386/pr21231a.d: Likewise.
* testsuite/binutils-all/i386/pr21231b.d: Likewise.
* testsuite/binutils-all/i386/shstk.d: Likewise.
* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
* testsuite/binutils-all/x86-64/empty.d: Likewise.
* testsuite/binutils-all/x86-64/ibt-x32.d: Likewise.
* testsuite/binutils-all/x86-64/ibt.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231a.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
* testsuite/binutils-all/x86-64/shstk-x32.d: Likewise.
* testsuite/binutils-all/x86-64/shstk.d: Likewise.

gas/

* testsuite/gas/i386/bss.d: Pass -mx86-used-note=no to assembler.
* testsuite/gas/i386/ilp32/quad.d: Likewise.
* testsuite/gas/i386/ilp32/reloc64.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-1.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-3.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-5.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-unwind.d: Likewise.
* testsuite/gas/i386/property-1.d: Likewise.
* testsuite/gas/i386/relax.d: Likewise.
* testsuite/gas/i386/reloc64.d: Likewise.
* testsuite/gas/i386/size-1.d: Likewise.
* testsuite/gas/i386/size-3.d: Likewise.
* testsuite/gas/i386/x86-64-property-1.d: Likewise.
* testsuite/gas/i386/x86-64-size-1.d: Likewise.
* testsuite/gas/i386/x86-64-size-3.d: Likewise.
* testsuite/gas/i386/x86-64-size-5.d: Likewise.
* testsuite/gas/i386/x86-64-unwind.d: Likewise.
* testsuite/gas/i386/divide.d: Append "#pass".

ld/

* testsuite/ld-i386/i386.exp: (ASFLAGS): Save, append
-mx86-used-note=no and restore.  Pass -mx86-used-note=yes and
-mx86-used-note=no to assembler.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/no-plt.exp: Pass -mx86-used-note=yes to
assembler.
* testsuite/ld-i386/tls.exp: Likewise.
* testsuite/ld-x86-64/no-plt.exp: Likewise.
* testsuite/ld-x86-64/tls.exp: Likewise.
* testsuite/ld-i386/pr23486a.d: Pass -mx86-used-note=no to
assembler.
* testsuite/ld-i386/pr23486b.d: Likewise.
* testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
* testsuite/ld-x86-64/pr23486a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486a.d: Likewise.
* testsuite/ld-x86-64/pr23486b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486b.d: Likewise.
* testsuite/ld-i386/property-x86-3.d: Pass -mx86-used-note=yes
to assembler and update expected output from "readelf -n".
* testsuite/ld-i386/property-x86-4a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt2.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt4.d: Likewise.
* testsuite/ld-i386/property-x86-ibt5.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk2.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk4.d: Likewise.
* testsuite/ld-i386/property-x86-shstk5.d: Likewise.
* testsuite/ld-x86-64/property-x86-3-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-3.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5.d: Likewise.
* testsuite/ld-i386/property-1a.r: New file.
* testsuite/ld-i386/property-2a.r: Likewise.
* testsuite/ld-i386/property-3a.r: Likewise.
* testsuite/ld-i386/property-4a.r: Likewise.
* testsuite/ld-i386/property-5a.r: Likewise.
* testsuite/ld-i386/property-7a.r: Likewise.
* testsuite/ld-x86-64/property-1a.r: Likewise.
* testsuite/ld-x86-64/property-2a.r: Likewise.
* testsuite/ld-x86-64/property-3a.r: Likewise.
* testsuite/ld-x86-64/property-4a.r: Likewise.
* testsuite/ld-x86-64/property-5a.r: Likewise.
* testsuite/ld-x86-64/property-7a.r: Likewise.
* testsuite/ld-x86-64/mpx.exp: Pass -mx86-used-note=no to
assembler.

6 years agox86: Extend assembler to generate GNU property notes
H.J. Lu [Fri, 31 Aug 2018 11:31:08 +0000 (04:31 -0700)]
x86: Extend assembler to generate GNU property notes

Add -mx86-used-note=[yes|no] option to generate (or not) GNU property
notes with GNU_PROPERTY_X86_FEATURE_2_USED and GNU_PROPERTY_X86_ISA_1_USED
properties.  If the assembly input contains no instructions, set the
GNU_PROPERTY_X86_UINT32_VALID bit in GNU_PROPERTY_X86_FEATURE_2_USED
property.  Add a --enable-x86-used-note configure time option to set the
default behavior.  Set the default if the configure option is not used
to "no".

* NEWS: Mention -mx86-used-note=[no|yes].
* configure.ac: Add --enable-x86-used-note.  Define
DEFAULT_X86_USED_NOTE.
* config.in: Regenerated.
* configure: Likewise.
* config/tc-i386.c (x86_isa_1_used): New.
(x86_feature_2_used): Likewise.
(x86_used_note): Likewise.
(_i386_insn): Add has_regmmx, has_regxmm, has_regymm and
has_regzmm.
(build_modrm_byte): Set i.has_regmmx, i.has_regzmm.
i.has_regymm and i.has_regxmm.
(x86_cleanup): New function.
(output_insn): Update x86_isa_1_used and x86_feature_2_used.
(OPTION_X86_USED_NOTE): New.
(md_longopts): Add -mx86-used-note=.
(md_parse_option): Handle OPTION_X86_USED_NOTE.
(md_show_usage): Display -mx86-used-note=.
* config/tc-i386.h (x86_cleanup): New prototype.
(md_cleanup): New.
* doc/c-i386.texi: Document -mx86-used-note=.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 31 Aug 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agosparc: gas: leon.d: disassemble assuming v8 also in sparc64 targets.
Jose E. Marchesi [Thu, 30 Aug 2018 21:37:45 +0000 (23:37 +0200)]
sparc: gas: leon.d: disassemble assuming v8 also in sparc64 targets.

gas/ChangeLog:

2018-08-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

* testsuite/gas/sparc/leon.d: Disassemble v8 code also in sparc64
targets.

6 years agoRISC-V: Allow instruction require more than one extension
Jim Wilson [Thu, 30 Aug 2018 20:23:12 +0000 (13:23 -0700)]
RISC-V: Allow instruction require more than one extension

2018-08-29  Kito Cheng  <kito@andestech.com>

gas/
* config/tc-riscv.c (riscv_subset_supports): New argument:
xlen_required.
(riscv_multi_subset_supports): New function, able to check more
than one extension.
(riscv_ip): Use riscv_multi_subset_supports instead of
riscv_subset_supports.
(riscv_set_arch): Update call-site for riscv_subset_supports.
(riscv_after_parse_args): Likewise.

include/
*opcode/riscv.h (MAX_SUBSET_NUM): New.
(riscv_opcode): Add xlen_requirement field and change type of
subset.

opcodes/
* riscv-dis.c (riscv_disassemble_insn): Check XLEN by
riscv_opcode.xlen_requirement.
* riscv-opc.c (riscv_opcodes): Update for struct change.

6 years agoSkip elf/section14 test for h8300 targets
H.J. Lu [Thu, 30 Aug 2018 18:06:16 +0000 (11:06 -0700)]
Skip elf/section14 test for h8300 targets

Skip elf/section14 test for h8300 targets since the h8300 port issues a
warning message for new sections created without atrributes.

* testsuite/gas/elf/section14.d: Skip h8300 targets.

6 years agogdb/riscv: Extend instruction decode to cover more instructions
Andrew Burgess [Thu, 16 Aug 2018 13:56:19 +0000 (14:56 +0100)]
gdb/riscv: Extend instruction decode to cover more instructions

Extends the instruction decoder used during prologue scan and software
single step to cover more instructions.  These instructions are
encountered when running the current GDB testsuite with the DWARF
stack unwinders turned off.

gdb/ChangeLog:

* riscv-tdep.c (riscv_insn::decode): Decode c.addi4spn, c.sd,
c.sw, c.swsp, and c.sdsp.

6 years agogdb/riscv: remove extra caching of misa register
Andrew Burgess [Mon, 9 Apr 2018 21:38:07 +0000 (22:38 +0100)]
gdb/riscv: remove extra caching of misa register

The RISC-V had a mechanism in place to cache the contents of the misa
register per-inferior, the original intention behind this was to
reduce the number of times the misa register had to be read (as the
contents should be constant), but it was pointed out on the mailing
list[1] that the register cache will mean the register is only
accessed once each time GDB stops, and any additional caching is
probably just unneeded extra complexity.

As such, until it can be shown that there's a real need for additional
caching, this commit removes all of the additional caching of the misa
register, and just accesses the misa register like a normal register.

[1] https://sourceware.org/ml/gdb-patches/2018-03/msg00136.html

gdb/ChangeLog:

* riscv-tdep.c (struct riscv_inferior_data): Delete.
(riscv_read_misa_reg): Don't cache value read into inferior data.
(riscv_new_inferior_data): Delete.
(riscv_inferior_data_cleanup): Delete.
(riscv_inferior_data): Delete.
(riscv_invalidate_inferior_data): Delete.
(_initialize_riscv_tdep): Remove initialisation of inferior data.

6 years agogdb: Ensure compiler doesn't optimise variable out in test
Andrew Burgess [Wed, 29 Aug 2018 17:49:51 +0000 (18:49 +0100)]
gdb: Ensure compiler doesn't optimise variable out in test

In the test gdb.base/funcargs.exp, there's this function:

    void recurse (SVAL a, int depth)
    {
      a.s = a.i = a.l = --depth;
      if (depth == 0)
        hitbottom ();
      else
        recurse (a, depth);
    }

The test script places a breakpoint in hitbottom, and runs the
executable which calls recurse with an initial depth of 4.

When GDB hits the breakpoint in hitbottom the testscript performs a
backtrace, and examines 'a' at each level.

The problem is that 'a' is not live after either the call to
'hitbottom' or the call to 'recurse', and as a result the test fails.

In the particular case I was looking at GCC for RISC-V 32-bit, the
variable 'a' is on the stack and GCC selects the register $ra (the
return address register) to hold the pointer to 'a'.  This is fine,
because, by the time the $ra register is needed to hold a return
address (calling hitbottom or recurse) then 'a' is dead.

In this patch I propose that a use of 'a' is added after the calls to
hitbottom and recurse, this should cause the compiler to keep 'a'
around, which should ensure GDB can find it.

gdb/testsuite/ChangeLog:

* gdb.base/funcargs.c (use_a): New function.
(recurse): Call use_a.

6 years agoFix compile-cplus-types.c build errors
Simon Marchi [Thu, 30 Aug 2018 15:09:48 +0000 (11:09 -0400)]
Fix compile-cplus-types.c build errors

I see these errors when building with clang:

  CXX    compile/compile-cplus-types.o
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:306:56: error: cannot pass non-trivial object of type 'compile_scope' to variadic function; expected type from format string was 'void *' [-Wnon-pod-varargs]
        fprintf_unfiltered (gdb_stdlog, "leaving scope %p\n", current);
                                                       ~~     ^~~~~~~
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:1058:13: error: comparison of two values with different enumeration types ('enum_flags<gcc_cp_qualifiers>::enum_type' (aka 'gcc_cp_qualifiers') and 'gcc_cp_ref_qualifiers') [-Werror,-Wenum-compare]
  if (quals != GCC_CP_REF_QUAL_NONE)
      ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~

Fix the first one by using host_address_to_string.

Fix the second one by comparing to 0 instead.  I think the current
comparison simply uses the wrong enum type.  Comparing to 0 seems like
the right thing to do, because we want to check whether any flags are
specified.

gdb/ChangeLog:

* compile/compile-cplus-types.c
(compile_cplus_instance::leave_scope): Take the address of scope
object.
(compile_cplus_instance::convert_qualified_base): Compare quals
to 0.

6 years agoTreat SHT_FINI_ARRAY and SHT_PREINIT_ARRAY as relocatable sections
H.J. Lu [Thu, 30 Aug 2018 15:01:36 +0000 (08:01 -0700)]
Treat SHT_FINI_ARRAY and SHT_PREINIT_ARRAY as relocatable sections

Since SHT_FINI_ARRAY and SHT_PREINIT_ARRAY sections are relocatable,
this patch fixes readelf and adds a testcase.

binutils/

* readelf.c (process_section_headers): Treat SHT_FINI_ARRAY and
SHT_PREINIT_ARRAY as relocatable sections.

gas/

* testsuite/gas/elf/elf.exp: Run section14.
* testsuite/gas/elf/section14.d: New file.
* testsuite/gas/elf/section14.s: Likewise.

6 years agoUse host_address_to_string in compile_cplus_instance::enter_scope
Keith Seitz [Thu, 30 Aug 2018 14:47:03 +0000 (07:47 -0700)]
Use host_address_to_string in compile_cplus_instance::enter_scope

This patch fixes a problem being reported by the buildbot with an
invalid argument to a "%p" printf format. Instead of "%p", the
debug output is changed to use "%s" and host_address_to_string.

gdb/ChangeLog

* compile/compile-cplus-types.c (compile_cplus_instance::enter_scope):
Use "%s" and host_address_to_string instead of "%p" in printf.

6 years ago[MIPS] Add myself as a MIPS port maintainer.
Chenghua Xu [Thu, 30 Aug 2018 00:30:36 +0000 (08:30 +0800)]
[MIPS] Add myself as a MIPS port maintainer.

binutils/
* MAINTAINERS: Add myself as a MIPS port maintainer.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 30 Aug 2018 00:01:03 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoC++ compile support
Keith Seitz [Wed, 29 Aug 2018 22:12:24 +0000 (15:12 -0700)]
C++ compile support

This patch adds *basic* support for C++ to the compile feature.  It does
most simple type conversions, including everything that C compile does and
your basic "with-classes" type of C++.

I've written a new compile-support.exp support file which adds a new test
facility for automating and simplifying "compile print" vs "compile code"
testing.  See testsuite/lib/compile-support.exp and CompileExpression
for more on that.  The tests use this facility extensively.

This initial support has several glaring omissions:
- No template support at all
  I have follow-on patches for this, but they add much complexity
  to this "basic" support.  Consequently, they will be submitted separately.
- Cannot print functions
  The code template needs tweaking, and I simply haven't gotten to it yet.
- So-called "special function" support is not included
  Using constructors, destructors, operators, etc will not work. I have
  follow-on patches for that, but they require some work because of the
  recent churn in symbol searching.
- There are several test suite references to "compile/1234" bugs.
  I will file bugs and update the test suite's bug references before pushing
  these patches.

The test suite started as a copy of the original C-language support, but
I have written tests to exercise the basic functionality of the plug-in.

I've added a new option for outputting debug messages for C++ type-conversion
("debug compile-cplus-types").

gdb/ChangeLog:

* Makefile.in (SUBDIR_GCC_COMPILE_SRCS): Add compile-cplus-symbols.c
and compile-cplus-types.c.
(HFILES_NO_SRCDIR): Add gcc-cp-plugin.h.
* c-lang.c (cplus_language_defn): Set C++ compile functions.
* c-lang.h (cplus_get_compile_context, cplus_compute_program):
Declare.
* compile/compile-c-support.c: Include compile-cplus.h.
(load_libcompile): Templatize.
(get_compile_context): "New" function.
(c_get_compile_context): Use get_compile_context.
(cplus_get_compile_context): New function.
(cplus_push_user_expression, cplus_pop_user_expression)
(cplus_add_code_header, cplus_add_input, cplus_compile_program)
(cplus_compute_program): Define new structs/functions.
* compile/compile-cplus-symmbols.c: New file.
* compile/compile-cplus-types.c: New file.
* compile/compile-cplus.h: New file.
* compile/compile-internal.h (debug_compile_oracle, GCC_TYPE_NONE):
Declare.
* compile/compile-object-load.c (get_out_value_type): Use
strncmp_iw when comparing symbol names.
(compile_object_load): Add mst_bss and mst_data.
* compile/compile.c (_initialize_compile): Remove
-Wno-implicit-function-declaration from `compile_args'.
* compile/gcc-cp-plugin.h: New file.
* NEWS: Mention C++ compile support and new debug options.

gdb/testsuite/ChangeLog:

* gdb.compile/compile-cplus-anonymous.cc: New file.
* gdb.compile/compile-cplus-anonymous.exp: New file.
* gdb.compile/compile-cplus-array-decay.cc: New file.
* gdb.compile/compile-cplus-array-decay.exp: New file.
* gdb.compile/compile-cplus-inherit.cc: New file.
* gdb.compile/compile-cplus-inherit.exp: New file.
* gdb.compile/compile-cplus-member.cc: New file.
* gdb.compile/compile-cplus-member.exp: New file.
* gdb.compile/compile-cplus-method.cc: New file.
* gdb.compile/compile-cplus-method.exp: New file.
* gdb.compile/compile-cplus-mod.c: "New" file.
* gdb.compile/compile-cplus-namespace.cc: New file.
* gdb.compile/compile-cplus-namespace.exp: New file.
* gdb.compile/compile-cplus-nested.cc: New file.
* gdb.compile/compile-cplus-nested.exp: New file.
* gdb.compile/compile-cplus-print.c: "New" file.
* gdb.compile/compile-cplus-print.exp: "New" file.
* gdb.compile/compile-cplus-virtual.cc: New file.
* gdb.compile/compile-cplus-virtual.exp: New file.
* gdb.compile/compile-cplus.c: "New" file.
* gdb.compile/compile-cplus.exp: "New" file.
* lib/compile-support.exp: New file.

doc/ChangeLog:

* gdb.texinfo (Compiling and injecting code in GDB): Document
set/show "compile-oracle" and "compile-cplus-types" commands.

6 years agoAdd new search_symbols_multiple API
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)]
Add new search_symbols_multiple API

This patch adds a new symbol searching API based on linespec.c's parser
implementation.  This allows users to find "all* matching symbols instead
of the first found match (a la lookup_symbol).

gdb/ChangeLog:

* linespec.c (collect_info::add_symbol): Make virtual.
(struct symbol_searcher_collect_info): New struct.
(symbol_searcher::find_all_symbols): New method.
* symtab.h (class symbol_searcher): New class.

6 years agoUse block_symbol in linespec APIs
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)]
Use block_symbol in linespec APIs

This patch changes the linespec.c APIs to use block_symbol instead of just
a symbol.  lookup_symbol et al already return block_symbol's.

gdb/ChangeLog:

* linespec.c (struct linespec) <function_symbols, label_symbols>:
Change to vector of block_symbol.  Update all users.
(struct collect_info) <symbols>: Likewise.
(collect_info::add_symbol): Take block_symbol as argument.
Update all callers.
(decode_compound_collector) <m_symbols>: Change type to vector
of block_symbol.  Update all users.
(decode_compound_collector::operator ()): Change parameter type
to block_symbol.
(find_method, find_function_symbols, find_linespec_symbols)
(find_label_symbols_in_block, find_label_symbols): Change symbol
vectors to block_symbol vectors.
* symtab.h (symbol_found_callback_ftype): Change parameter type to
block_symbol.

6 years agoRemove VEC definitions from linespec.c
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)]
Remove VEC definitions from linespec.c

Since they are now no longer necessary, this patch removes the typedefs
and VEC definitions for bound_minimal_symbol_d and symbolp.

gdb/ChangeLog:

* linespec.c (symbolp): Remove typedef and VEC definitions.
(bound_minimal_symbol_d): Likewise.

6 years agoChange decode_compound_collector to use std::vector
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)]
Change decode_compound_collector to use std::vector

This patch changes decode_compound_collector to use std::vector instead of
VEC, eliminating a cleanup in the process.

gdb/ChangeLog:

* linespec.c (decode_compound_collector::decode_compound_collector):
Remove initialization for `m_symtabs'.
(decode_compound_collector::release_symbols): Change return type
to std::vector.  Update all callers.
(class decode_compound_collector) <m_symbols>: Change type to
std::vector.
(lookup_prefix_sym): Change return type to std::vector.  Update all
callers.
(compare_symbols): Remove.
(std_compare_symbols): Rename to `compare_symbols'.
(find_method): Change `sym_classes' parameter to std::vector.
Update all callers.  Use std::sort to sort sym_classes.
(find_linespec_symbols): Remove cleanup.

6 years agoChange `minimal_symbols' to std::vector in linespec.c structures
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)]
Change `minimal_symbols' to std::vector in linespec.c structures

This patch converts linespec.c's linespec.label_symbols member from a
VEC to a std::vector.

gdb/ChangeLog:

* linespec.c (struct linespec) <minimal_symbols>: Change type to
std::vector.  Update all users.
(convert_linespec_to_sals): Use std::sort to sort minimal symbols.
(struct collect_info) <minimal_symbols>: Likewise.
(compare_msymbols): Return bool.  Change parameters to const
bound_minimal_symbol references.
(find_method, find_function_symbols, find_linespec_symbols): Change
`minsyms' parameter to std::vector.  Update all callers.

6 years agoChange `label_symbols' to std::vector in linespec.c structures
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)]
Change `label_symbols' to std::vector in linespec.c structures

This patch converts linespec.c's linespec.label_symbols member from a
VEC to a std::vector.

gdb/ChangeLog:

* linespec.c (struct linespec) <label_symbols>: Change type to
std::vector.  Update all users.
(find_label_symbols_in_block): Change `result' parameter to
std::vector.  Update all callers.
(find_label_symbols): Return std::vector.  Update all callers.

6 years agoChange `function_symbols' to std::vector
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)]
Change `function_symbols' to std::vector

This patch changes the `function_symbols'  members in linespec.c structures
from a VEC to a std::vector.

gdb/ChangeLog:

* linespec.c (struct linespec) <function_symbols>: Change type to
std::vector.  Update all users.
(struct collect_info) <function_symbols>: Likewise.
(convert_linespec_to_sals): Use std::sort to sort function_symbols.
(std_compare_symbols): New function.
(find_method, find_function_symbols, find_linespec_symbols)
(find_label_symbols_in_block): Change `symbols' parameter to
std::vector.  Update all callers.
(find_label_symbols): Likewise for `function_symbols' and
`label_funcs_ret'.

6 years agoChange `file_symtabs' to std::vector
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)]
Change `file_symtabs' to std::vector

This patch changes the `file_symtabs' members in linespec.c structures
from a VEC to a std::vector (or unique_ptr thereof), eliminating a cleanup
in the process.

gdb/ChangeLog:

* linespec.c (symtab_vector_up): Define.
(struct linespec) <file_symtabs>: Change type to std::vector *.
Update all uses.
(struct collect_info) <file_symtabs>: Likewise.
(collect_symtabs_from_filename): Return symtab_vector_up.
Update all callers.
(decode_objc): Remove cleanup.
(symtab_collector::symtab_collector): Initialize `m_symtabs'.
(symtab_collector::release_symtabs): Return symtab_vector_up.
Update all callers.
(class symtab_collector) <m_symtabs>: Change type to symtab_vector_up.
Update all users.
(collect_symtabs_from_filename, symtabs_from_filename): Return
symtab_vector_up.  Update all callers.

6 years agoUse core_addr_to_string_nz in csky_analyze_prologue
Tom Tromey [Wed, 29 Aug 2018 21:33:23 +0000 (15:33 -0600)]
Use core_addr_to_string_nz in csky_analyze_prologue

One of the buildbot builders had a failure on a recent try run:

../../binutils-gdb/gdb/csky-tdep.c: In function CORE_ADDR csky_analyze_prologue(gdbarch*, CORE_ADDR, CORE_ADDR, CORE_ADDR, frame_info*, csky_unwind_cache*, lr_type_t):
../../binutils-gdb/gdb/csky-tdep.c:1107:23: error: format %lx expects argument of type long unsigned int, but argument 3 has type CORE_ADDR {aka long long unsigned int} [-Werror=format=]
        "0x%lx\n", addr);
                       ^
../../binutils-gdb/gdb/csky-tdep.c:1419:12: error: format %lx expects argument of type long unsigned int, but argument 3 has type CORE_ADDR {aka long long unsigned int} [-Werror=format=]
        addr);
            ^

The fix is to use core_addr_to_string_nz rather than %lx in
csky-tdep.c.

Tested by rebuilding.  I'm checking this in.

gdb/ChangeLog
2018-08-29  Tom Tromey  <tom@tromey.com>

* csky-tdep.c (csky_analyze_prologue): Use
core_addr_to_string_nz.

6 years agoFix windows-nat.c for -Wnarrowing
Tom Tromey [Wed, 29 Aug 2018 17:37:42 +0000 (11:37 -0600)]
Fix windows-nat.c for -Wnarrowing

Sergio pointed out that the Windows builder was failing due to the
-Wnarrowing patch, with:

../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225477' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
   {-1, GDB_SIGNAL_UNKNOWN}};
                           ^
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225725' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '2147483651' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '2147483652' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225614' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]

Looking into this, I found two things.

First, in struct xlate_exception, it is better to have "them" be of
type DWORD, as that's the type actually in use.

Second, struct xlate_exception and xlate are not used in this file,
because the code in windows_nat_target::resume is #if'd out.

This patch changes the type of "them", but also similarly #if's out
this object.

In order to avoid a narrowing warning from the -1 entry, at Pedro's
suggestion I have removed this and changed windows_nat_target::resume
to use ranged for.

Tested by rebuilding using the mingw toolchain on x86-64 Fedora 28.  I
also tested it by temporarily removing the "#if 0"s and rebuilding.

gdb/ChangeLog
2018-08-29  Tom Tromey  <tom@tromey.com>

* windows-nat.c (struct xlate_exception) <them>: Change type to
DWORD.
(xlate): Fix formatting.  Remove last entry.
(struct xlate_exception, xlate): Comment out.
(windows_nat_target::resume): Use ranged for.

6 years agosparc/leon: add support for partial write psr instruction
Martin Aberg [Wed, 29 Aug 2018 18:52:28 +0000 (20:52 +0200)]
sparc/leon: add support for partial write psr instruction

Partial write %PSR (PWRPSR) is a SPARC V8e option that allows the WRPSR
instruction to only affect the %PSR.ET field. When available it is enabled
by setting the rd field of the WRPSR instruction to a value other than 0.
For Leon processors with support for partial write %PSR (currently GR740
and GR716) the rd value must be 1.

opcodes/ChangeLog:

2018-08-29  Martin Aberg  <maberg@gaisler.com>

        * sparc-opc.c (sparc_opcodes): Add Leon specific partial write
        psr (PWRPSR) instruction.

gas/ChangeLog:

2018-08-29  Daniel Cederman  <cederman@gaisler.com>

        * testsuite/gas/sparc/leon.d: New test.
        * testsuite/gas/sparc/leon.s: New test.
        * testsuite/gas/sparc/sparc.exp: Execute the pwrpsr test.

6 years agoFix riscv-linux native gdb build failure.
Jim Wilson [Wed, 29 Aug 2018 17:52:42 +0000 (10:52 -0700)]
Fix riscv-linux native gdb build failure.

The linux kernel uses NT_PRFPREG.  Glibc before BZ 14890 defines NT_FPREGSET.
After it defines both.  Avoid glibc version dependency by using the gdb header
file instead of the glibc header file, and the macro name that gdb defines
which is NT_FPREGSET.

gdb/
* riscv-linux-nat.c: Include elf/common.h instead of elf.h.
(riscv_linux_nat_target::fetch_registers): Use NT_FPREGSET instead
of NT_PRFPREG.
(riscv_linux_nat_target::store_registers): Likewise.

6 years agoUpdate gnulib to current upstream master
Sergio Durigan Junior [Mon, 27 Aug 2018 22:56:03 +0000 (18:56 -0400)]
Update gnulib to current upstream master

It has been a while since we don't update our gnulib copy against
their upstream master branch, so I thought I'd propose this patch.  It
also fixes (at least) one bug reported against GDB:

  https://sourceware.org/bugzilla/show_bug.cgi?id=23558

The problem reported there is about the replacement of 'getcwd' when
cross-compiling GDB.  With our current gnulib copy, the mechanism for
deciding whether to use the system's 'getcwd' or gnulib's version is
too simplistic and pessimistic, so when cross-compiling we always end
up using gnulib's version, which has a limitation: it cannot handle
the situation when the parent directory doesn't have read permissions.

This has been reported against upstream gnulib and the fix has been
pushed here:

  https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=a96d2e67052c879b1bcc5bc461722beac75fc372

I regtested this patch on Fedora 28 x86-64, and there were no
regressions.

OK?

gdb/ChangeLog:

2018-08-29  Sergio Durigan Junior  <sergiodj@redhat.com>

PR gdb/23555
PR gdb/23558
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
* gnulib/configure: Regenerate.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/extra/snippet/_Noreturn.h: Rename to...
* gnulib/import/_Noreturn.h: ... this.
* gnulib/import/alloca.in.h: Update.
* gnulib/import/extra/snippet/arg-nonnull.h: Rename to...
* gnulib/import/arg-nonnull.h: ... this.
* gnulib/import/assure.h: Update.
* gnulib/import/at-func.c: Update.
* gnulib/import/basename-lgpl.c: Update.
* gnulib/import/extra/snippet/c++defs.h: Rename to...
* gnulib/import/c++defs.h: ... this.
* gnulib/import/canonicalize-lgpl.c: Update.
* gnulib/import/cdefs.h: Update.
* gnulib/import/chdir-long.c: Update.
* gnulib/import/chdir-long.h: Update.
* gnulib/import/cloexec.c: Update.
* gnulib/import/cloexec.h: Update.
* gnulib/import/close.c: Update.
* gnulib/import/closedir.c: Update.
* gnulib/import/config.charset: Update.
* gnulib/import/dirent-private.h: Update.
* gnulib/import/dirent.in.h: Update.
* gnulib/import/dirfd.c: Update.
* gnulib/import/dirname-lgpl.c: Update.
* gnulib/import/dirname.h: Update.
* gnulib/import/dosname.h: Update.
* gnulib/import/dup-safer-flag.c: Update.
* gnulib/import/dup-safer.c: Update.
* gnulib/import/dup.c: Update.
* gnulib/import/dup2.c: Update.
* gnulib/import/errno.in.h: Update.
* gnulib/import/error.c: Update.
* gnulib/import/error.h: Update.
* gnulib/import/exitfail.c: Update.
* gnulib/import/exitfail.h: Update.
* gnulib/import/extra/update-copyright: Update.
* gnulib/import/fchdir.c: Update.
* gnulib/import/fcntl.c: Update.
* gnulib/import/fcntl.in.h: Update.
* gnulib/import/fd-hook.c: Update.
* gnulib/import/fd-hook.h: Update.
* gnulib/import/fd-safer-flag.c: Update.
* gnulib/import/fd-safer.c: Update.
* gnulib/import/fdopendir.c: Update.
* gnulib/import/filename.h: Update.
* gnulib/import/filenamecat-lgpl.c: Update.
* gnulib/import/filenamecat.h: Update.
* gnulib/import/flexmember.h: Update.
* gnulib/import/float+.h: Update.
* gnulib/import/float.c: Update.
* gnulib/import/float.in.h: Update.
* gnulib/import/fnmatch.c: Update.
* gnulib/import/fnmatch.in.h: Update.
* gnulib/import/fnmatch_loop.c: Update.
* gnulib/import/fpucw.h: Update.
* gnulib/import/frexp.c: Update.
* gnulib/import/frexpl.c: Update.
* gnulib/import/fstat.c: Update.
* gnulib/import/fstatat.c: Update.
* gnulib/import/getcwd-lgpl.c: Update.
* gnulib/import/getcwd.c: Update.
* gnulib/import/getdtablesize.c: Update.
* gnulib/import/getlogin_r.c: Update.
* gnulib/import/getprogname.c: Update.
* gnulib/import/getprogname.h: Update.
* gnulib/import/gettext.h: Update.
* gnulib/import/gettimeofday.c: Update.
* gnulib/import/glob-libc.h: Update.
* gnulib/import/glob.c: Update.
* gnulib/import/glob.in.h: Update.
* gnulib/import/glob_internal.h: Update.
* gnulib/import/glob_pattern_p.c: Update.
* gnulib/import/globfree.c: Update.
* gnulib/import/hard-locale.c: Update.
* gnulib/import/hard-locale.h: Update.
* gnulib/import/intprops.h: Update.
* gnulib/import/inttypes.in.h: Update.
* gnulib/import/isnan.c: Update.
* gnulib/import/isnand-nolibm.h: Update.
* gnulib/import/isnand.c: Update.
* gnulib/import/isnanl-nolibm.h: Update.
* gnulib/import/isnanl.c: Update.
* gnulib/import/itold.c: Update.
* gnulib/import/libc-config.h: Update.
* gnulib/import/limits.in.h: Update.
* gnulib/import/localcharset.c: Update.
* gnulib/import/localcharset.h: Update.
* gnulib/import/localtime-buffer.c: Update.
* gnulib/import/localtime-buffer.h: Update.
* gnulib/import/lstat.c: Update.
* gnulib/import/m4/00gnulib.m4: Update.
* gnulib/import/m4/__inline.m4: Update.
* gnulib/import/m4/absolute-header.m4: Update.
* gnulib/import/m4/alloca.m4: Update.
* gnulib/import/m4/builtin-expect.m4: Update.
* gnulib/import/m4/canonicalize.m4: Update.
* gnulib/import/m4/chdir-long.m4: Update.
* gnulib/import/m4/close.m4: Update.
* gnulib/import/m4/closedir.m4: Update.
* gnulib/import/m4/configmake.m4: Update.
* gnulib/import/m4/d-ino.m4: Update.
* gnulib/import/m4/d-type.m4: Update.
* gnulib/import/m4/dirent_h.m4: Update.
* gnulib/import/m4/dirfd.m4: Update.
* gnulib/import/m4/dirname.m4: Update.
* gnulib/import/m4/double-slash-root.m4: Update.
* gnulib/import/m4/dup.m4: Update.
* gnulib/import/m4/dup2.m4: Update.
* gnulib/import/m4/eealloc.m4: Update.
* gnulib/import/m4/environ.m4: Update.
* gnulib/import/m4/errno_h.m4: Update.
* gnulib/import/m4/error.m4: Update.
* gnulib/import/m4/exponentd.m4: Update.
* gnulib/import/m4/exponentl.m4: Update.
* gnulib/import/m4/extensions.m4: Update.
* gnulib/import/m4/extern-inline.m4: Update.
* gnulib/import/m4/fchdir.m4: Update.
* gnulib/import/m4/fcntl-o.m4: Update.
* gnulib/import/m4/fcntl.m4: Update.
* gnulib/import/m4/fcntl_h.m4: Update.
* gnulib/import/m4/fdopendir.m4: Update.
* gnulib/import/m4/filenamecat.m4: Update.
* gnulib/import/m4/flexmember.m4: Update.
* gnulib/import/m4/float_h.m4: Update.
* gnulib/import/m4/fnmatch.m4: Update.
* gnulib/import/m4/fnmatch_h.m4: Update.
* gnulib/import/m4/fpieee.m4: Update.
* gnulib/import/m4/frexp.m4: Update.
* gnulib/import/m4/frexpl.m4: Update.
* gnulib/import/m4/fstat.m4: Update.
* gnulib/import/m4/fstatat.m4: Update.
* gnulib/import/m4/getcwd-abort-bug.m4: Update.
* gnulib/import/m4/getcwd-path-max.m4: Update.
* gnulib/import/m4/getcwd.m4: Update.
* gnulib/import/m4/getdtablesize.m4: Update.
* gnulib/import/m4/getlogin.m4: Update.
* gnulib/import/m4/getlogin_r.m4: Update.
* gnulib/import/m4/getpagesize.m4: Update.
* gnulib/import/m4/getprogname.m4: Update.
* gnulib/import/m4/gettimeofday.m4: Update.
* gnulib/import/m4/glibc21.m4: Update.
* gnulib/import/m4/glob.m4: Update.
* gnulib/import/m4/glob_h.m4: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-common.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/gnulib-tool.m4: Update.
* gnulib/import/m4/hard-locale.m4: Update.
* gnulib/import/m4/include_next.m4: Update.
* gnulib/import/m4/inttypes-pri.m4: Update.
* gnulib/import/m4/inttypes.m4: Update.
* gnulib/import/m4/isnand.m4: Update.
* gnulib/import/m4/isnanl.m4: Update.
* gnulib/import/m4/largefile.m4: Update.
* gnulib/import/m4/limits-h.m4: Update.
* gnulib/import/m4/localcharset.m4: Update.
* gnulib/import/m4/locale-fr.m4: Update.
* gnulib/import/m4/locale-ja.m4: Update.
* gnulib/import/m4/locale-zh.m4: Update.
* gnulib/import/m4/localtime-buffer.m4: Update.
* gnulib/import/m4/longlong.m4: Update.
* gnulib/import/m4/lstat.m4: Update.
* gnulib/import/m4/malloc.m4: Update.
* gnulib/import/m4/malloca.m4: Update.
* gnulib/import/m4/math_h.m4: Update.
* gnulib/import/m4/mbrtowc.m4: Update.
* gnulib/import/m4/mbsinit.m4: Update.
* gnulib/import/m4/mbsrtowcs.m4: Update.
* gnulib/import/m4/mbstate_t.m4: Update.
* gnulib/import/m4/memchr.m4: Update.
* gnulib/import/m4/memmem.m4: Update.
* gnulib/import/m4/mempcpy.m4: Update.
* gnulib/import/m4/memrchr.m4: Update.
* gnulib/import/m4/mkdir.m4: Update.
* gnulib/import/m4/mkstemp.m4: Update.
* gnulib/import/m4/mmap-anon.m4: Update.
* gnulib/import/m4/mode_t.m4: Update.
* gnulib/import/m4/msvc-inval.m4: Update.
* gnulib/import/m4/msvc-nothrow.m4: Update.
* gnulib/import/m4/multiarch.m4: Update.
* gnulib/import/m4/nocrash.m4: Update.
* gnulib/import/m4/off_t.m4: Update.
* gnulib/import/m4/onceonly.m4: Update.
* gnulib/import/m4/open-cloexec.m4: Update.
* gnulib/import/m4/open.m4: Update.
* gnulib/import/m4/openat.m4: Update.
* gnulib/import/m4/opendir.m4: Update.
* gnulib/import/m4/pathmax.m4: Update.
* gnulib/import/m4/rawmemchr.m4: Update.
* gnulib/import/m4/readdir.m4: Update.
* gnulib/import/m4/readlink.m4: Update.
* gnulib/import/m4/realloc.m4: Update.
* gnulib/import/m4/rename.m4: Update.
* gnulib/import/m4/rewinddir.m4: Update.
* gnulib/import/m4/rmdir.m4: Update.
* gnulib/import/m4/save-cwd.m4: Update.
* gnulib/import/m4/secure_getenv.m4: Update.
* gnulib/import/m4/setenv.m4: Update.
* gnulib/import/m4/signal_h.m4: Update.
* gnulib/import/m4/ssize_t.m4: Update.
* gnulib/import/m4/stat-time.m4: Update.
* gnulib/import/m4/stat.m4: Update.
* gnulib/import/m4/std-gnu11.m4: Update.
* gnulib/import/m4/stdbool.m4: Update.
* gnulib/import/m4/stddef_h.m4: Update.
* gnulib/import/m4/stdint.m4: Update.
* gnulib/import/m4/stdio_h.m4: Update.
* gnulib/import/m4/stdlib_h.m4: Update.
* gnulib/import/m4/strchrnul.m4: Update.
* gnulib/import/m4/strdup.m4: Update.
* gnulib/import/m4/strerror.m4: Update.
* gnulib/import/m4/string_h.m4: Update.
* gnulib/import/m4/strstr.m4: Update.
* gnulib/import/m4/strtok_r.m4: Update.
* gnulib/import/m4/sys_socket_h.m4: Update.
* gnulib/import/m4/sys_stat_h.m4: Update.
* gnulib/import/m4/sys_time_h.m4: Update.
* gnulib/import/m4/sys_types_h.m4: Update.
* gnulib/import/m4/tempname.m4: Update.
* gnulib/import/m4/time_h.m4: Update.
* gnulib/import/m4/unistd-safer.m4: Update.
* gnulib/import/m4/unistd_h.m4: Update.
* gnulib/import/m4/warn-on-use.m4: Update.
* gnulib/import/m4/wchar_h.m4: Update.
* gnulib/import/m4/wchar_t.m4: Update.
* gnulib/import/m4/wctype_h.m4: Update.
* gnulib/import/m4/wint_t.m4: Update.
* gnulib/import/malloc.c: Update.
* gnulib/import/malloc/scratch_buffer.h: Update.
* gnulib/import/malloc/scratch_buffer_grow.c: Update.
* gnulib/import/malloc/scratch_buffer_grow_preserve.c: Update.
* gnulib/import/malloc/scratch_buffer_set_array_size.c: Update.
* gnulib/import/malloca.c: Update.
* gnulib/import/malloca.h: Update.
* gnulib/import/malloca.valgrind: Update.
* gnulib/import/math.in.h: Update.
* gnulib/import/mbrtowc.c: Update.
* gnulib/import/mbsinit.c: Update.
* gnulib/import/mbsrtowcs-impl.h: Update.
* gnulib/import/mbsrtowcs-state.c: Update.
* gnulib/import/mbsrtowcs.c: Update.
* gnulib/import/memchr.c: Update.
* gnulib/import/memmem.c: Update.
* gnulib/import/mempcpy.c: Update.
* gnulib/import/memrchr.c: Update.
* gnulib/import/mkdir.c: Update.
* gnulib/import/mkstemp.c: Update.
* gnulib/import/msvc-inval.c: Update.
* gnulib/import/msvc-inval.h: Update.
* gnulib/import/msvc-nothrow.c: Update.
* gnulib/import/msvc-nothrow.h: Update.
* gnulib/import/open.c: Update.
* gnulib/import/openat-die.c: Update.
* gnulib/import/openat-priv.h: Update.
* gnulib/import/openat-proc.c: Update.
* gnulib/import/openat.c: Update.
* gnulib/import/openat.h: Update.
* gnulib/import/opendir.c: Update.
* gnulib/import/pathmax.h: Update.
* gnulib/import/pipe-safer.c: Update.
* gnulib/import/rawmemchr.c: Update.
* gnulib/import/readdir.c: Update.
* gnulib/import/readlink.c: Update.
* gnulib/import/realloc.c: Update.
* gnulib/import/ref-add.sin: Update.
* gnulib/import/ref-del.sin: Update.
* gnulib/import/rename.c: Update.
* gnulib/import/rewinddir.c: Update.
* gnulib/import/rmdir.c: Update.
* gnulib/import/same-inode.h: Update.
* gnulib/import/save-cwd.c: Update.
* gnulib/import/save-cwd.h: Update.
* gnulib/import/scratch_buffer.h: Update.
* gnulib/import/secure_getenv.c: Update.
* gnulib/import/setenv.c: Update.
* gnulib/import/signal.in.h: Update.
* gnulib/import/stat-time.c: Update.
* gnulib/import/stat-time.h: Update.
* gnulib/import/stat-w32.c: Update.
* gnulib/import/stat-w32.h: Update.
* gnulib/import/stat.c: Update.
* gnulib/import/stdbool.in.h: Update.
* gnulib/import/stddef.in.h: Update.
* gnulib/import/stdint.in.h: Update.
* gnulib/import/stdio.in.h: Update.
* gnulib/import/stdlib.in.h: Update.
* gnulib/import/str-two-way.h: Update.
* gnulib/import/strchrnul.c: Update.
* gnulib/import/strdup.c: Update.
* gnulib/import/streq.h: Update.
* gnulib/import/strerror-override.c: Update.
* gnulib/import/strerror-override.h: Update.
* gnulib/import/strerror.c: Update.
* gnulib/import/string.in.h: Update.
* gnulib/import/stripslash.c: Update.
* gnulib/import/strnlen1.c: Update.
* gnulib/import/strnlen1.h: Update.
* gnulib/import/strstr.c: Update.
* gnulib/import/strtok_r.c: Update.
* gnulib/import/sys_stat.in.h: Update.
* gnulib/import/sys_time.in.h: Update.
* gnulib/import/sys_types.in.h: Update.
* gnulib/import/tempname.c: Update.
* gnulib/import/tempname.h: Update.
* gnulib/import/time.in.h: Update.
* gnulib/import/unistd--.h: Update.
* gnulib/import/unistd-safer.h: Update.
* gnulib/import/unistd.in.h: Update.
* gnulib/import/unsetenv.c: Update.
* gnulib/import/verify.h: Update.
* gnulib/import/extra/snippet/warn-on-use.h: Update.
* gnulib/import/wchar.in.h: Update.
* gnulib/import/wctype.in.h: Update.
* gnulib/import/xalloc-oversized.h: Update.
* gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to
"53e2c179f26a890fa6685af4b6c1397ee370433b".

6 years agoIndicate batch mode failures by exiting with nonzero status
Gary Benson [Wed, 29 Aug 2018 15:11:50 +0000 (16:11 +0100)]
Indicate batch mode failures by exiting with nonzero status

This commit causes GDB in batch mode to exit with nonzero status
if the last command to be executed fails.

gdb/ChangeLog:

PR gdb/13000:
* gdb/main.c (captured_main_1): Exit with nonzero status
in batch mode if the last command to be executed failed.
* NEWS: Mention the above.

gdb/testsuite/ChangeLog:

PR gdb/13000:
* gdb.base/batch-exit-status.exp: New file.
* gdb.base/batch-exit-status.good-commands: Likewise.
* gdb.base/batch-exit-status.bad-commands: Likewise.

6 years agoRemove newline at end of warning message
Simon Marchi [Wed, 29 Aug 2018 14:26:11 +0000 (10:26 -0400)]
Remove newline at end of warning message

... to fix this ARI warning:

  gdb/csky-tdep.c:1612: gettext: trailing new line: A message should not have a trailing new line
  gdb/csky-tdep.c:1612:    warning (_("Invalid breakpoint address 0x%x is an odd number.\n"),

gdb/ChangeLog:

* csky-tdep.c (csky_memory_insert_breakpoint): Remove newline at
end of warning message.

6 years ago[MIPS] Add Loongson 2K1000 proccessor support.
Chenghua Xu [Wed, 29 Aug 2018 12:55:25 +0000 (20:55 +0800)]
[MIPS] Add Loongson 2K1000 proccessor support.

bfd/
* archures.c (bfd_architecture): New machine
bfd_mach_mips_gs264e.
* bfd-in2.h (bfd_architecture): Likewise.
* cpu-mips.c (enum I_xxx): Likewise.
(arch_info_struct): Likewise.
* elfxx-mips.c (_bfd_elf_mips_mach): Handle
E_MIPS_MACH_GS264E.
(mips_set_isa_flags): Likewise.
(mips_mach_extensions): Map bfd_mach_mips_gs264e to
bfd_mach_mips_gs464e extension.

binutils/
* NEWS: Mention Loongson 2K1000 proccessor support.
* readelf.c (get_machine_flags): Handle gs264e.

elfcpp/
* mips.c (EF_MIPS_MACH): New E_MIPS_MACH_GS264E.

gas/
* config/tc-mips.c (ISA_HAS_ODD_SINGLE_FPR): Exclude CPU_GS264E.
(mips_cpu_info_table): Add gs264e descriptors.
* doc/as.texi (march table): Add gs264e.

include/
* elf/mips.h (E_MIPS_MACH_XXX): New E_MIPS_MACH_GS264E.
* opcode/mips.h (CPU_XXX): New CPU_GS264E.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp: Run good_combination
gs264e and gs464e.

opcodes/
* mips-dis.c (mips_arch_choices): Add gs264e descriptors.

6 years ago[MIPS] Add Loongson 3A2000/3A3000 proccessor support.
Chenghua Xu [Wed, 29 Aug 2018 12:36:23 +0000 (20:36 +0800)]
[MIPS] Add Loongson 3A2000/3A3000 proccessor support.

bfd/
* archures.c (bfd_architecture): New machine
bfd_mach_mips_gs464e.
* bfd-in2.h (bfd_architecture): Likewise.
* cpu-mips.c (enum I_xxx): Likewise.
(arch_info_struct): Likewise.
* elfxx-mips.c (_bfd_elf_mips_mach): Handle
E_MIPS_MACH_GS464E.
(mips_set_isa_flags): Likewise.
(mips_mach_extensions): Map bfd_mach_mips_gs464e to
bfd_mach_mips_gs464 extension.

binutils/
* NEWS: Mention Loongson 3A2000/3A3000 proccessor support.
* readelf.c (get_machine_flags): Handle gs464e.

elfcpp/
* mips.c (EF_MIPS_MACH): New E_MIPS_MACH_GS464E.

gas/
* config/tc-mips.c (ISA_HAS_ODD_SINGLE_FPR): Exclude CPU_GS464E.
(mips_cpu_info_table): Add gs464e descriptors.
* doc/as.texi (march table): Add gs464e.

include/
* elf/mips.h (E_MIPS_MACH_XXX): New E_MIPS_MACH_GS464E.
* opcode/mips.h (CPU_XXX): New CPU_GS464E.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp: Run good_combination
gs464e and gs464.

opcodes/
* mips-dis.c (mips_arch_choices): Add gs464e descriptors.

6 years ago[MIPS] Add Loongson 3A1000 proccessor support.
Chenghua Xu [Wed, 29 Aug 2018 12:13:00 +0000 (20:13 +0800)]
[MIPS] Add Loongson 3A1000 proccessor support.

bfd/
* archures.c (bfd_architecture): Rename
bfd_mach_mips_loongson_3a to bfd_mach_mips_gs464.
* bfd-in2.h (bfd_architecture): Likewise.
* cpu-mips.c (enum I_xxx): Likewise.
(arch_info_struct): Likewise.
* elfxx-mips.c (_bfd_elf_mips_mach): Likewise.
(mips_set_isa_flags): Likewise.
(mips_mach_extensions): Likewise.
(bfd_mips_isa_ext_mach): Likewise.
(bfd_mips_isa_ext): Likewise.
(print_mips_isa_ext): Delete AFL_EXT_LOONGSON_3A.

binutils/
* NEWS: Mention Loongson 3A1000 proccessor support.
* readelf.c (get_machine_flags): Rename loongson-3a to gs464.
(print_mips_isa_ext): Delete AFL_EXT_LOONGSON_3A.

elfcpp/
* mips.c (EF_MIPS_MACH): Rename E_MIPS_MACH_LS3A to
E_MIPS_MACH_GS464.

gas/
* config/tc-mips.c (ISA_HAS_ODD_SINGLE_FPR): Rename
CPU_LOONGSON_3A to CPU_GS464.
(mips_cpu_info_table): Add gs464 descriptors, Keep
loongson3a as an alias of gs464 for compatibility.
* doc/as.texi (march table): Rename loongson3a to gs464.
* testsuite/gas/mips/loongson-3a-mmi.d: Set "ISA Extension"
flag to None.

gold/
* mips.cc (Mips_mach, add_machine_extensions, elf_mips_mach):
Rename loongson3a to gs464.
(mips_isa_ext_mach, mips_isa_ext): Delete loongson3a.
(infer_abiflags): Use ases instead of isa_ext for infer ABI
flags.
(elf_mips_mach_name): Rename loongson3a to gs464.

include/
* elf/mips.h (E_MIPS_MACH_XXX): Rename E_MIPS_MACH_LS3A to
E_MIPS_MACH_GS464.
(AFL_EXT_XXX): Delete AFL_EXT_LOONGSON_3A.
* opcode/mips.h (INSN_XXX): Delete INSN_LOONGSON_3A.
(CPU_XXX): Rename CPU_LOONGSON_3A to CPU_GS464.
* opcode/mips.h (mips_isa_table): Delete CPU_LOONGSON_3A case.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp: Rename loongson3a
to gs464.

opcodes/
* mips-dis.c (mips_arch_choices): Add gs464 descriptors, Keep
loongson3a as an alias of gs464 for compatibility.
* mips-opc.c (mips_opcodes): Change Comments.

6 years ago[MIPS/GAS] Add Loongson EXT2 Instructions support.
Chenghua Xu [Wed, 29 Aug 2018 12:08:58 +0000 (20:08 +0800)]
[MIPS/GAS] Add Loongson EXT2 Instructions support.

bfd/
* elfxx-mips.c (print_mips_ases): Add Loongson EXT2 extension.

binutils/
* readelf.c (print_mips_ases): Add Loongson EXT2 extension.

gas/
* NEWS: Mention Loongson EXTensions R2 (EXT2) support.
* config/tc-mips.c (options): Add OPTION_LOONGSON_EXT2 and
OPTION_NO_LOONGSON_EXT2.
(md_longopts): Likewise.
(mips_ases): Define availability for EXT.
(mips_convert_ase_flags): Map ASE_LOONGSON_EXT2 to
AFL_ASE_LOONGSON_EXT2.
(md_show_usage): Add help for -mloongson-ext2 and
-mno-loongson-ext2.
* doc/as.texi: Document -mloongson-ext2, -mno-loongson-ext2.
* doc/c-mips.texi: Document -mloongson-ext2, -mno-loongson-ext2,
.set loongson-ext2 and .set noloongson-ext2.
* testsuite/gas/mips/loongson-ext2.d: New test.
* testsuite/gas/mips/loongson-ext2.s: New test.
* testsuite/gas/mips/mips.exp: Run loongson-ext2 test.

include/
* elf/mips.h (AFL_ASE_LOONGSON_EXT2): New macro.
(AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_EXT2.
* opcode/mips.h (ASE_LOONGSON_EXT2): New macro.

opcodes/
* mips-dis.c (parse_mips_ase_option): Handle -M loongson-ext
option.
(print_mips_disassembler_options): Document -M loongson-ext.
* mips-opc.c (LEXT2): New macro.
(mips_opcodes): Add cto, ctz, dcto, dctz instructions.

6 years ago[MIPS/GAS] Split Loongson EXT Instructions from loongson3a.
Chenghua Xu [Wed, 29 Aug 2018 11:57:39 +0000 (19:57 +0800)]
[MIPS/GAS] Split Loongson EXT Instructions from loongson3a.

bfd/
 * elfxx-mips.c (infer_mips_abiflags): Use ases instead of
 isa_ext for infer ABI flags.
 (print_mips_ases): Add Loongson EXT extension.

binutils/
 * readelf.c (print_mips_ases): Add Loongson EXT extension.

elfcpp/
 * mips.h (AFL_ASE_LOONGSON_EXT): New enum.

gas/
 * NEWS: Mention Loongson EXTensions (EXT) support.
 * config/tc-mips.c (options): Add OPTION_LOONGSON_EXT and
 OPTION_NO_LOONGSON_EXT.
 (md_longopts): Likewise.
 (mips_ases): Define availability for EXT.
 (mips_convert_ase_flags): Map ASE_LOONGSON_EXT to
 AFL_ASE_LOONGSON_EXT.
 (mips_cpu_info_table): Add ASE_LOONGSON_EXT for loongson3a.
 (md_show_usage): Add help for -mloongson-ext and
 -mno-loongson-ext.
 * doc/as.texi: Document -mloongson-ext, -mno-loongson-ext.
 * doc/c-mips.texi: Document -mloongson-ext, -mno-loongson-ext,
 .set loongson-ext and .set noloongson-ext.
 * testsuite/gas/mips/loongson-mmi.d: Add ASE flag.

include/
 * elf/mips.h (AFL_ASE_LOONGSON_EXT): New macro.
 (AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_EXT.
 * opcode/mips.h (ASE_LOONGSON_EXT): New macro.

opcodes/
 * mips-dis.c (mips_arch_choices): Add EXT to loongson3a
 descriptors.
 (parse_mips_ase_option): Handle -M loongson-ext option.
 (print_mips_disassembler_options): Document -M loongson-ext.
 * mips-opc.c (IL3A): Delete.
 * mips-opc.c (LEXT): New macro.
 (mips_opcodes): Replace IL2F|IL3A marking with LEXT for EXT
 instructions.

6 years ago[MIPS/GAS] Split Loongson CAM Instructions from loongson3a
Chenghua Xu [Wed, 29 Aug 2018 09:39:33 +0000 (17:39 +0800)]
[MIPS/GAS] Split Loongson CAM Instructions from loongson3a

bfd/
* elfxx-mips.c (print_mips_ases): Add CAM extension.

binutils/
* readelf.c (print_mips_ases): Add CAM extension.

gas/
* NEWS: Mention Loongson Content Address Memory (CAM)
support.
* config/tc-mips.c (options): Add OPTION_LOONGSON_CAM and
OPTION_NO_LOONGSON_CAM.
(md_longopts): Likewise.
(mips_ases): Define availability for CAM.
(mips_convert_ase_flags): Map ASE_LOONGSON_CAM to
AFL_ASE_LOONGSON_CAM.
(mips_cpu_info_table): Add ASE_LOONGSON_CAM for loongson3a.
(md_show_usage): Add help for -mloongson-cam and
-mno-loongson-cam.
* doc/as.texi: Document -mloongson-cam, -mno-loongson-cam.
* doc/c-mips.texi: Document -mloongson-cam, -mno-loongson-cam,
.set loongson-cam and .set noloongson-cam.
* testsuite/gas/mips/loongson-3a-2.d: Move cam test to ...
* testsuite/gas/mips/loongson-cam.d: Here.  Add ISA/ASE
flag verification.
* testsuite/gas/mips/loongson-3a-2.s: Move cam test to ...
* testsuite/gas/mips/loongson-cam.s: Here.
* testsuite/gas/mips/loongson-3a-mmi.d: Add ASE flag.
* testsuite/gas/mips/mips.exp: Run loongson-cam test.

include/
* elf/mips.h (AFL_ASE_LOONGSON_CAM): New macro.
(AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_CAM.
* opcode/mips.h (ASE_LOONGSON_CAM): New macro.

opcodes/
* mips-dis.c (mips_arch_choices): Add CAM to loongson3a
descriptors.
(parse_mips_ase_option): Handle -M loongson-cam option.
(print_mips_disassembler_options): Document -M loongson-cam.
* mips-opc.c (LCAM): New macro.
(mips_opcodes): Replace IL2F|IL3A marking with LCAM for CAM
instructions.

6 years agoinfcall-nested-structs: Test up to five fields
Alan Hayward [Wed, 29 Aug 2018 10:43:53 +0000 (11:43 +0100)]
infcall-nested-structs: Test up to five fields

Aarch64 can pass structures of up to four members of identical
types in float registers (See AAPCS 5.3 and 5.4). Expand test to
cover this.

Remove the need to specify an additional sets of structures if tB
is not defined.

gdb/testsuite/
* gdb.base/infcall-nested-structs.c (struct struct01): Remove.
(struct struct02): Likewise.
(struct struct03): Likewise.
(struct struct04): Likewise.
(struct struct_01_01): New struct.
(struct struct_01_02): Likewise.
(struct struct_01_03): Likewise.
(struct struct_01_04): Likewise.
(struct struct_02_01): Likewise.
(struct struct_02_02): Likewise.
(struct struct_02_03): Likewise.
(struct struct_02_04): Likewise.
(struct struct_04_01): Likewise.
(struct struct_04_02): Likewise.
(struct struct_04_03): Likewise.
(struct struct_04_04): Likewise.
(struct struct_05_01): Likewise.
(struct struct_05_02): Likewise.
(struct struct_05_03): Likewise.
(struct struct_05_04): Likewise.
(cmp_struct01): Remove function.
(cmp_struct02): Likewise.
(cmp_struct03): Likewise.
(cmp_struct04): Likewise.
(cmp_struct_01_01): Add Function.
(cmp_struct_01_02): Likewise.
(cmp_struct_01_03): Likewise.
(cmp_struct_01_04): Likewise.
(cmp_struct_02_01): Likewise.
(cmp_struct_02_02): Likewise.
(cmp_struct_02_03): Likewise.
(cmp_struct_02_04): Likewise.
(cmp_struct_04_01): Likewise.
(cmp_struct_04_02): Likewise.
(cmp_struct_04_03): Likewise.
(cmp_struct_04_04): Likewise.
(cmp_struct_05_01): Likewise.
(cmp_struct_05_02): Likewise.
(cmp_struct_05_03): Likewise.
(cmp_struct_05_04): Likewise.
(call_all): Add new structs.
* gdb.base/infcall-nested-structs.exp: Likewise.

6 years agoAarch64: Float register detection for return values
Alan Hayward [Wed, 29 Aug 2018 10:41:45 +0000 (11:41 +0100)]
Aarch64: Float register detection for return values

Use aapcs_is_vfp_call_or_return_candidate to detect float register
args.

gdb/
PR gdb/22943:
* aarch64-tdep.c (is_hfa_or_hva): Remove function.
(aarch64_extract_return_value): Use
aapcs_is_vfp_call_or_return_candidate.
(aarch64_return_in_memory): Likewise.
(aarch64_store_return_value): Likewise.

6 years agoAarch64: Float register detection for _push_dummy_call
Alan Hayward [Wed, 29 Aug 2018 10:40:05 +0000 (11:40 +0100)]
Aarch64: Float register detection for _push_dummy_call

Use aapcs_is_vfp_call_or_return_candidate to detect float register
args, then pass in registers if there is room.

gdb/
* aarch64-tdep.c
(aapcs_is_vfp_call_or_return_candidate): Make static
(pass_in_v_or_stack): Remove function.
(pass_in_v_vfp_candidate): New function.
(aarch64_push_dummy_call): Check for float register candidates.

6 years agoAarch64: Func to detect args passed in float regs
Alan Hayward [Wed, 29 Aug 2018 10:28:10 +0000 (11:28 +0100)]
Aarch64: Func to detect args passed in float regs

aapcs_is_vfp_call_or_return_candidate is as an eventual replacement
for is_hfa_or_hva.

This function is based on the GCC code
gcc/config/aarch64/aarch64.c:aarch64_vfp_is_call_or_return_candidate ()

gdb/
* aarch64-tdep.c (HA_MAX_NUM_FLDS): New macro.
(aapcs_is_vfp_call_or_return_candidate_1): New function.
(aapcs_is_vfp_call_or_return_candidate): Likewise.

6 years ago[MIPS/LD/testsuite] Skip o32 flags check on mips*-*-irix*
Chenghua Xu [Wed, 29 Aug 2018 09:12:44 +0000 (17:12 +0800)]
[MIPS/LD/testsuite] Skip o32 flags check on mips*-*-irix*

ld/ChangeLog:

* testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination):
Skip o32 flags checking if target is mips*-*-irix*.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 29 Aug 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoGet rid of -Wodr warning (PR build/23399)
Simon Marchi [Tue, 28 Aug 2018 17:29:32 +0000 (13:29 -0400)]
Get rid of -Wodr warning (PR build/23399)

The PR reports that building with -Wodr -flto complains about different
versions of struct ipa_sym_addresses, in common/agent.c and
gdbserver/tracepoint.c.  This patch renames the version in common to
ipa_sym_addresses_common to avoid the name clash.  Because the IPA_SYM
assumed the name ipa_sym_addresses, it now requires the includer to
define the IPA_SYM_STRUCT_NAME macro to define the name of the structure
holding the IPA symbol addresses.

gdb/ChangeLog:

PR build/23399
* common/agent.c (IPA_SYM_STRUCT_NAME): Define.
(struct ipa_sym_addresses): Rename to...
(struct ipa_sym_addresses_common): ... this.
* common/agent.h (IPA_SYM): Use IPA_SYM_STRUCT_NAME.

gdb/gdbserver/ChangeLog:

PR build/23399
* tracepoint.c (IPA_SYM_STRUCT_NAME): Define.