external/binutils.git
6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Mar 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoSupport bare-identifier field initializers in Rust
Tom Tromey [Mon, 19 Mar 2018 16:25:05 +0000 (10:25 -0600)]
Support bare-identifier field initializers in Rust

In Rust one can initialize a struct member from an identically-named
local variable by simply mentioning the member name in the
initializer, like:

    let x = 0;
    let y = Struct { x };

This initializes "Struct::x" from "x".

This patch adds this form of initializer to the Rust expression parser
and adds a test.

Tested on x86-64 Fedora 26 using rustc 1.23.

2018-03-19  Tom Tromey  <tom@tromey.com>

* rust-exp.y (struct_expr_tail, struct_expr_list): Add plain
"IDENT" production.

2018-03-19  Tom Tromey  <tom@tromey.com>

* gdb.rust/simple.rs (main): Add local variables field1, field2,
y0.
* gdb.rust/simple.exp: Test bare identifier form of struct
initializer.

6 years agoConvert observers to C++
Tom Tromey [Sun, 2 Oct 2016 16:50:20 +0000 (10:50 -0600)]
Convert observers to C++

This converts observers from using a special source-generating script
to be plain C++.  This version of the patch takes advantage of C++11
by using std::function and variadic templates; incorporates Pedro's
patches; and renames the header file to "observable.h" (this change
eliminates the need for a clean rebuild).

Note that Pedro's patches used a template lambda in tui-hooks.c, but
this failed to compile on some buildbot instances (presumably due to
differing C++ versions); I replaced this with an ordinary template
function.

Regression tested on the buildbot.

gdb/ChangeLog
2018-03-19  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tom@tromey.com>

* unittests/observable-selftests.c: New file.
* common/observable.h: New file.
* observable.h: New file.
* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c,
ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c,
python/py-breakpoint.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c,
record-btrace.c, record-full.c, record.c, regcache.c, remote.c,
riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c,
spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c,
symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c,
tui/tui-interp.c, valops.c: Update all users.
* tui/tui-hooks.c (tui_bp_created_observer)
(tui_bp_deleted_observer, tui_bp_modified_observer)
(tui_inferior_exit_observer, tui_before_prompt_observer)
(tui_normal_stop_observer, tui_register_changed_observer):
Remove.
(tui_observers_token): New global.
(attach_or_detach, tui_attach_detach_observers): New functions.
(tui_install_hooks, tui_remove_hooks): Use
tui_attach_detach_observers.
* record-btrace.c (record_btrace_thread_observer): Remove.
(record_btrace_thread_observer_token): New global.
* observer.sh: Remove.
* observer.c: Rename to observable.c.
* observable.c (namespace gdb_observers): Define new objects.
(observer_debug): Move into gdb_observers namespace.
(struct observer, struct observer_list, xalloc_observer_list_node)
(xfree_observer_list_node, generic_observer_attach)
(generic_observer_detach, generic_observer_notify): Remove.
(_initialize_observer): Update.
Don't include observer.inc.
* Makefile.in (generated_files): Remove observer.h, observer.inc.
(clean mostlyclean): Likewise.
(observer.h, observer.inc): Remove targets.
(SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c.
(COMMON_SFILES): Use observable.c, not observer.c.
* .gitignore: Remove observer.h.

gdb/doc/ChangeLog
2018-03-19  Tom Tromey  <tom@tromey.com>

* observer.texi: Remove.

gdb/testsuite/ChangeLog
2018-03-19  Tom Tromey  <tom@tromey.com>

* gdb.gdb/observer.exp: Remove.

6 years agoTestsuite: Fix ambiguous "break" due to libinproctrace
Andreas Arnez [Mon, 19 Mar 2018 12:13:09 +0000 (13:13 +0100)]
Testsuite: Fix ambiguous "break" due to libinproctrace

Some of GDB's trace test cases define a function end() and place a
breakpoint there with "break end".  However, when libinproctrace is linked
to the binary, there are multiple methods named "end", such as
std::string::end() from the C++ library or format_pieces::end() from
common/format.h.  GDB then creates multiple breakpoints instead of just a
single one, and some FAILs result, such as these:

  FAIL: gdb.trace/trace-mt.exp: ftrace on: break end
  FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

Fix this by adding the "-qualified" option to the break commands.  For
consistency, change all occurrences of "break end" (and similar) in all
trace test cases, even if the current behavior does not cause problems.
Also, consequently use the gdb_breakpoint convenience proc.

gdb/testsuite/ChangeLog:

* gdb.trace/actions-changed.exp: Call gdb_breakpoint with the
"qualified" option when setting breakpoints.
* gdb.trace/backtrace.exp: Likewise.
* gdb.trace/circ.exp: Likewise.
* gdb.trace/collection.exp: Likewise.
* gdb.trace/disconnected-tracing.exp: Likewise.
* gdb.trace/ftrace-lock.exp: Likewise.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/infotrace.exp: Likewise.
* gdb.trace/packetlen.exp: Likewise.
* gdb.trace/passc-dyn.exp: Likewise.
* gdb.trace/qtro.exp: Likewise.
* gdb.trace/read-memory.exp: Likewise.
* gdb.trace/report.exp: Likewise.
* gdb.trace/signal.exp: Likewise.
* gdb.trace/status-stop.exp: Likewise.
* gdb.trace/strace.exp: Likewise.
* gdb.trace/tfind.exp: Likewise.
* gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-condition.exp: Likewise.
* gdb.trace/trace-mt.exp: Likewise.
* gdb.trace/tstatus.exp: Likewise.
* gdb.trace/tsv.exp: Likewise.
* gdb.trace/unavailable-dwarf-piece.exp: Likewise.
* gdb.trace/unavailable.exp: Likewise.
* gdb.trace/while-dyn.exp: Likewise.

6 years agoUpdated Spanish translation for the bfd/ sub-directory, and updated Ukranian translat...
Nick Clifton [Mon, 19 Mar 2018 10:49:13 +0000 (10:49 +0000)]
Updated Spanish translation for the bfd/ sub-directory, and updated Ukranian translation for the gas/ sub-directory.

bfd * po/es.po: Updated Spanish translation.
gas * po/uk.po: Updated Ukranian translation.

6 years agoRemove some cleanups from solib.c
Tom Tromey [Fri, 10 Nov 2017 20:48:48 +0000 (13:48 -0700)]
Remove some cleanups from solib.c

This removes some cleanups from solib.c, replacing them with
gdb::def_vector.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-18  Tom Tromey  <tom@tromey.com>

* solib.c (gdb_bfd_lookup_symbol_from_symtab): Use
gdb::def_vector.
(bfd_lookup_symbol_from_dyn_symtab): Likewise.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Mar 2018 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Mar 2018 00:01:24 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoChange auto_load_objfile_script_1 to use std::string
Tom Tromey [Fri, 16 Mar 2018 23:02:11 +0000 (17:02 -0600)]
Change auto_load_objfile_script_1 to use std::string

This replaces some manual string manipulation in
auto_load_objfile_script_1 with std::string, simplifying the code and
allowing the removal of some cleanups.

Tested by the buildbot.

2018-03-17  Tom Tromey  <tom@tromey.com>

* auto-load.c (auto_load_objfile_script_1): Use std::string.

6 years agoRemove target_fileio_close_cleanup
Tom Tromey [Fri, 23 Feb 2018 21:42:26 +0000 (14:42 -0700)]
Remove target_fileio_close_cleanup

This removes target_fileio_close_cleanup in favor of a new RAII class.
The new class is similar to scoped_fd but calls
target_fileio_close_cleanup rather than close.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-17  Tom Tromey  <tom@tromey.com>

* target.c (class scoped_target_fd): New.
(target_fileio_close_cleanup): Remove.
(target_fileio_read_alloc_1): Use scoped_target_fd.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Mar 2018 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd silent Makefile rules
Simon Marchi [Fri, 16 Mar 2018 20:06:23 +0000 (16:06 -0400)]
Add silent Makefile rules

Many projects (e.g. the Linux kernel) and build systems use "silent"
rules, which means that they'll only print a summary of what's being
done instead of printing all the detailed command lines.  While chatting
on the #gdb IRC channel, I realized a few people (including me) thought
it would be nice to have it in GDB too.

The idea is that too much text is not useful, the important information
gets lost.  If there's only the essential information, it's more likely
to be useful.  Most of the time, when I look at the build output, it's
to see how it's progressing.  By just printing a brief summary of each
operation, I can easily spot what's currently being compiled and
therefore how the build progresses (with time you know the order in
which files are compiled almost by heart).

As with other projects (Linux, automake-based things, probably others),
it's possible to print the complete command lines by passing V=1 to make
(or any other non-zero value).

I had one hesitation about this: when people report build failures, we
are more likely to miss the full compile command line.  We'll probably
sometimes need to ask people to include the build log with "make V=1".
I don't think it's a big downside, if other projects the size of the
Linux kernel can live with it, I'm sure we can too.

gdb/ChangeLog:

* silent-rules.mk: New.
* Makefile.in: Include silent-rules.mk
(srcdir, VPATH, top_srcdir): Move up.
(COMPILE): Add ECHO_CXX.
(test-cp-name-parser$(EXEEXT)): Add ECHO_CXXLD.
(init.c): Add ECHO_INIT_C.
(gdb$(EXEEXT)): Add SILENCE and ECHO_CXXLD.
(version.c): Add ECHO_GEN.
(printcmd.o): Add ECHO_CXX.
(target-float.o): Add ECHO_CXX.
(ada-exp.o): Add ECHO_CXX.
(stamp-xml): Add SILENCE and ECHO_GEN_XML_BUILTIN.
(insight$(EXEEXT)): Add ECHO_CXXLD.
* gnulib/configure.ac: Add AM_SILENT_RULES.
* gnulib/aclocal.m4: Re-generate.
* gnulib/configure: Re-generate.
* gnulib/import/Makefile.in: Re-generate.

gdb/gdbserver/ChangeLog:

* Makefile.in: Include silent-rules.mk.
(srcdir, abs_top_srcdir, abs_srcdir, VPATH): Move up.
(COMPILE): Add ECHO_CXX.
(gdbserver$(EXEEXT)): Add SILENCE and ECHO_CXXLD.
(gdbreplay$(EXEEXT)): Add SILENCE and ECHO_CXXLD.
($(IPA_LIB)): Add SILENCE and ECHO_CXXLD.
(version-generated.c): Add ECHO_GEN.
(stamp-xml): Add SILENCE and ECHO_GEN_XML_BUILTIN_GENERATED.
(IPAGENT_COMPILE): Add ECHO_CXX.
(%-generated.c): Add ECHO_REGDAT.

6 years agoRemove make_cleanup_free_section_addr_info
Tom Tromey [Tue, 13 Mar 2018 03:50:33 +0000 (21:50 -0600)]
Remove make_cleanup_free_section_addr_info

This removes make_cleanup_free_section_addr_info.  Instead -- per
Simon's suggestion -- this changes section_addr_info to be a
std::vector.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-16  Tom Tromey  <tom@tromey.com>

* xcoffread.c (xcoff_symfile_offsets): Change type of "addrs".
* utils.h (make_cleanup_free_section_addr_info): Don't declare.
* utils.c (do_free_section_addr_info)
(make_cleanup_free_section_addr_info): Remove.
* symfile.h (struct other_sections): Add constructor.
(struct section_addr_info): Remove.
(section_addr_info): New typedef.
(struct sym_fns) <sym_offsets>: Change type of parameter.
(build_section_addr_info_from_objfile)
(relative_addr_info_to_section_offsets, addr_info_make_relative)
(default_symfile_offsets, symbol_file_add)
(symbol_file_add_from_bfd)
(build_section_addr_info_from_section_table): Update.
(alloc_section_addr_info, free_section_addr_info): Don't declare.
* symfile.c (alloc_section_addr_info): Remove.
(build_section_addr_info_from_section_table): Change return type.
Update.
(build_section_addr_info_from_bfd)
(build_section_addr_info_from_objfile): Likewise.
(free_section_addr_info): Remove.
(relative_addr_info_to_section_offsets): Change type of "addrs".
(addrs_section_compar): Now a std::sort comparator.
(addrs_section_sort): Change return type.
(addr_info_make_relative): Change type of "addrs".  Update.
(default_symfile_offsets, syms_from_objfile_1)
(syms_from_objfile, symbol_file_add_with_addrs): Likewise.
(symbol_file_add_separate): Update.
(symbol_file_add): Change type of "addrs".  Update.
(add_symbol_file_command): Update.  Remove cleanups.
* symfile-mem.c (symbol_file_add_from_memory): Update.  Remove
cleanups.
* symfile-debug.c (debug_sym_offsets): Change type of "info".
* solib.c (solib_read_symbols): Update.
* objfiles.c (objfile_relocate): Update.  Remove cleanups.
* machoread.c (macho_symfile_offsets): Update.
* jit.c (jit_bfd_try_read_symtab): Update.

6 years agoFix tspeed test case: copy libinproctrace to target
Andreas Arnez [Fri, 16 Mar 2018 19:40:38 +0000 (20:40 +0100)]
Fix tspeed test case: copy libinproctrace to target

The tspeed test case does not execute correctly because libinproctrace.so
is not copied to the target.  This is fixed.

gdb/testsuite/ChangeLog:

* gdb.trace/tspeed.exp: Add invocation of gdb_load_shlib to ensure
that libinproctrace is copied to the target.

6 years agoRISC-V: Emit better warning for unknown CSR.
Jim Wilson [Fri, 16 Mar 2018 17:03:57 +0000 (10:03 -0700)]
RISC-V: Emit better warning for unknown CSR.

gas/
* config/tc-riscv.c (check_absolute_expr): Expand comment.  New
parameter maybe_csr.  If maybe_csr and O_symbol, print CSR name.
(riscv_ip): Add new argument to check_absolute_expr calls.
* testsuite/gas/riscv/bad-csr.d: New.
* testsuite/gas/riscv/bad-csr.l: New.
* testsuite/gas/riscv/bad-csr.s: New.

6 years agoAdd selftest for substitute_path_component
Simon Marchi [Fri, 16 Mar 2018 02:01:56 +0000 (22:01 -0400)]
Add selftest for substitute_path_component

This patch add some unit tests for the substitute_path_component
function.

gdb/ChangeLog:

* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/utils-selftests.c.
* unittests/utils-selftests.c: New file.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 16 Mar 2018 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoxtensa: bfd: fix assertion in xlate_offset_with_removed_text
Max Filippov [Thu, 15 Mar 2018 17:35:59 +0000 (10:35 -0700)]
xtensa: bfd: fix assertion in xlate_offset_with_removed_text

Linking objects containing jumps targeting the end of a section triggers
assertion in the xlate_offset_with_removed_text. Such jumps may be
generated by a compiler as a dead code and not removed at -O0. Allow
such jumps.
While at it make bsearch argument match comparison function expectations
and use bfd_vma for address fields in the struct xlate_map_entry.

bfd/
2018-03-15  Max Filippov  <jcmvbkbc@gmail.com>

* elf32-xtensa.c (xlate_map_entry): Change types of address
fields from 'unsigned' to 'bfd_vma'.
(xlate_offset_with_removed_text): Use struct xlate_map_entry as
the key argument to bsearch. Allow offsets past the end of a
section, use the last map entry for translation of such offsets.

6 years agoRISC-V: Don't enable relaxation in relocatable link
Andreas Schwab [Sun, 11 Mar 2018 13:25:30 +0000 (14:25 +0100)]
RISC-V: Don't enable relaxation in relocatable link

PR ld/22949
* emultempl/riscvelf.em (riscv_elf_before_allocation): Don't
enable relaxation in relocatable link.

6 years agonds32: Remove the unsupported target feature.
Kuan-Lin Chen [Thu, 15 Mar 2018 06:50:51 +0000 (14:50 +0800)]
nds32: Remove the unsupported target feature.

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

6 years agoMissing testcase files for last commit.
Jim Wilson [Wed, 14 Mar 2018 23:05:44 +0000 (16:05 -0700)]
Missing testcase files for last commit.

6 years agoRISC-V: Add .insn support.
Jim Wilson [Wed, 14 Mar 2018 23:04:03 +0000 (16:04 -0700)]
RISC-V: Add .insn support.

gas/ChangeLog
2018-03-07  Kito Cheng  <kito.cheng@gmail.com>
* config/tc-riscv.c (opcode_name_list): New.
(opcode_names_hash): Likewise.
(init_opcode_names_hash): Likewise.
(opcode_name_lookup): Likewise.
(validate_riscv_insn): New argument length, and add new format
which used in .insn directive.
(md_begin): Refine hash table initialization logic into
init_opcode_hash.
(init_opcode_hash): New.
(my_getOpcodeExpression): Parse opcode name for .insn.
(riscv_ip): New argument hash, able to handle .insn directive.
(s_riscv_insn): Handler for .insn directive.
(riscv_pseudo_table): New entry for .insn.
* doc/c-riscv.texi: Add documentation for .insn directive.
* testsuite/gas/riscv/insn.d: Add testcase for .insn directive.
* testsuite/gas/riscv/insn.s: Likewise.

include/ChangeLog
2018-03-07  Kito Cheng  <kito.cheng@gmail.com>
* opcode/riscv.h (OP_MASK_FUNCT3): New.
(OP_SH_FUNCT3): Likewise.
(OP_MASK_FUNCT7): Likewise.
(OP_SH_FUNCT7): Likewise.
(OP_MASK_OP2): Likewise.
(OP_SH_OP2): Likewise.
(OP_MASK_CFUNCT4): Likewise.
(OP_SH_CFUNCT4): Likewise.
(OP_MASK_CFUNCT3): Likewise.
(OP_SH_CFUNCT3): Likewise.
(riscv_insn_types): Likewise.

opcodes/ChangeLog
2018-03-07  Kito Cheng  <kito.cheng@gmail.com>
* riscv-opc.c (riscv_insn_types): New.

6 years agoSpecial case NULL when using printf's %s format
Tom Tromey [Thu, 15 Feb 2018 03:11:16 +0000 (20:11 -0700)]
Special case NULL when using printf's %s format

This changes the printf command's %s and %ls formats to special-case
NULL, and print "(null)" for these.  This is PR cli/14977.  This
behavior seems a bit friendlier; I was undecided on whether other
invalid pointers should be handled specially somehow, so for the time
being I've left those out.

gdb/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

PR cli/14977:
* printcmd.c (printf_c_string, printf_wide_c_string): Special case
for NULL.

gdb/gdbserver/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

PR cli/14977:
* ax.c (ax_printf): Special case for NULL.

gdb/testsuite/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

PR cli/14977:
* gdb.base/printcmds.exp (test_printf): Add printf test of %s with
a null pointer.
* gdb.base/wchar.exp: Likewise.

6 years agoAllow - in %p for printf
Tom Tromey [Wed, 14 Feb 2018 18:12:17 +0000 (11:12 -0700)]
Allow - in %p for printf

PR cli/19918 points out that a printf format like "%-5p" will cause a
gdb crash.  The bug is problem is that printf_pointer doesn't take the
"-" flag into account.

gdb/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

PR cli/19918:
* printcmd.c (printf_pointer): Allow "-" in format.

gdb/testsuite/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

PR cli/19918:
* gdb.base/printcmds.exp (test_printf): Add printf test using '-'
flag.

6 years agoAdd usage to printf command
Tom Tromey [Wed, 14 Feb 2018 17:18:25 +0000 (10:18 -0700)]
Add usage to printf command

This patch adds the "Usage:" text to the printf command's help text,
and tries to improve the text a tiny bit.

gdb/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

* printcmd.c (_initialize_printcmd): Add usage to printf.

6 years agoUpdate my email address
Yao Qi [Wed, 14 Mar 2018 13:36:40 +0000 (13:36 +0000)]
Update my email address

gdb:

2018-03-14  Yao Qi  <qiyao@sourceware.org>

* MAINTAINERS: Update my email address.

6 years agoPowerPC64 debian bug 886264, out-of-line save/restore functions
Alan Modra [Wed, 14 Mar 2018 11:39:33 +0000 (22:09 +1030)]
PowerPC64 debian bug 886264, out-of-line save/restore functions

This calculation in relocate_section

      if (stub_entry->stub_type == ppc_stub_save_res)
relocation += (stub_sec->output_offset
       + stub_sec->output_section->vma
       + stub_sec->size - htab->sfpr->size
       - htab->sfpr->output_offset
       - htab->sfpr->output_section->vma);

to adjust from the original out-of-line save/restore function address
in sfpr to a copy at the end of stub_sec goes wrong when stub_sec is
padded, because the copy is no longer at the end of stub_sec.  The
solution is to pad before copying sfpr, so the copy is always at the
end of stub_sec.

* elf64-ppc.c (sfpr_define): Adjust for stub_sec size having
sfpr size added before defining alias symbols.
(ppc64_elf_build_stubs): Add stub section padding before
copying sfpr contents and defining save/restore alias symbols.

6 years agoGC: Also check the local debug definition section
H.J. Lu [Wed, 14 Mar 2018 11:23:24 +0000 (04:23 -0700)]
GC: Also check the local debug definition section

Extend

commit b7c871edcd83ccdc5fcd8148a7f433efd6b52255
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed May 17 07:57:15 2017 -0700

    Mark debug sections referenced by kept debug sections

to handle the local debug definition section.

bfd/

PR ld/20882
* elflink.c (elf_gc_mark_debug_section): Also check the local
debug definition section.

ld/

PR ld/20882
* testsuite/ld-gc/pr20882.d: Also dump and check .debug_abbrev
section.
* testsuite/ld-gc/pr20882b.s: Add .debug_abbrev section.

6 years agogc.exp: Fix a typo: $LFLAGS -> $LDFLAGS
H.J. Lu [Wed, 14 Mar 2018 11:07:54 +0000 (04:07 -0700)]
gc.exp: Fix a typo: $LFLAGS -> $LDFLAGS

* testsuite/ld-gc/gc.exp: Fix a typo: $LFLAGS -> $LDFLAGS.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 14 Mar 2018 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRemove two cleanups using std::string
Tom Tromey [Thu, 22 Feb 2018 23:31:15 +0000 (16:31 -0700)]
Remove two cleanups using std::string

This patches removes cleanups from a couple of spots by using
std::string rather than manual memory management.

Regression tested by the buildbot, though note that I don't believe
the buildbot actually exercises the machoread code.

gdb/ChangeLog
2018-03-13  Tom Tromey  <tom@tromey.com>

* machoread.c (macho_check_dsym): Change filenamep to a
std::string*.
(macho_symfile_read): Update.
* symfile.c (load_command): Use std::string.

6 years agoPrevent a buffer overrun when parsing corrupt STABS debug information.
Nick Clifton [Tue, 13 Mar 2018 17:03:04 +0000 (17:03 +0000)]
Prevent a buffer overrun when parsing corrupt STABS debug information.

PR 22957
* stabs.c (pop_binincl): Fail if the file index is off the end of
the stack.

6 years agoUpdated Russian and Brazilian Portuguese translations.
Nick Clifton [Tue, 13 Mar 2018 16:57:29 +0000 (16:57 +0000)]
Updated Russian and Brazilian Portuguese translations.

ld * po/pt_BR.po: Updated Brazilian Portuguese translation.
opcodes * po/pt_BR.po: Updated Brazilian Portuguese translation.
gas * po/ru.po: Updated Russian translation.

6 years agoAdd range changing to STABS parsing functions, in order to prevent buffer overruns.
Nick Clifton [Tue, 13 Mar 2018 16:10:45 +0000 (16:10 +0000)]
Add range changing to STABS parsing functions, in order to prevent buffer overruns.

PR 22955
* stabs.c (parse_number): Add p_end parameter and use it to check
the validity of the pp parameter.  Add checks to prevent walking
off the end of the string buffer.
(parse_stab_string): Likewise.
(parse_stab_type): Likewise.
(parse_stab_type_number): Likewise.
(parse_stab_range_type): Likewise.
(parse_stab_sun_builtin_type): Likewise.
(parse_stab_sun_floating_type): Likewise.
(parse_stab_enum_type): Likewise.
(parse_stab_struct_type): Likewise.
(parse_stab_baseclasses): Likewise.
(parse_stab_struct_fields): Likewise.
(parse_stab_cpp_abbrev): Likewise.
(parse_stab_one_struct_field): Likewise.
(parse_stab_members): Likewise.
(parse_stab_tilde_field): Likewise.
(parse_stab_array_type): Likewise.
* parse_stab: Compute the end of the string and then pass it on to
individual parser functions.

6 years agoPrevent memory access violations when attempting to parse an x86_64 PE binary contain...
Nick Clifton [Tue, 13 Mar 2018 14:02:52 +0000 (14:02 +0000)]
Prevent memory access violations when attempting to parse an x86_64 PE binary containing corrupt unwind information.

PR 22113
incldue * coff/pe.h (struct pex64_unwind_info): Add a rawUnwindCodesEnd
field.

bfd * pei-x86_64.c (pex64_get_unwind_info): Change to a boolean
function.  Add an end address parameter.  Check access of the data
pointer to make sure that they do not extend beyond the end
address.  Return FALSE if any check fails.  Add the end address
pointer to the ui structure.
(pex64_xdata_print_uwd_codes): Check accesses of the raw unwind
codes to make sure that they do not extend beyond the end address
pointer.  Print an error message and return immediately if any
check fails.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 13 Mar 2018 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agogdb/riscv: Fix some ARI issues
Andrew Burgess [Mon, 12 Mar 2018 21:41:42 +0000 (21:41 +0000)]
gdb/riscv: Fix some ARI issues

Fix some ARI issues in recently added riscv code, the ARI email is:

  https://sourceware.org/ml/gdb-patches/2018-03/msg00156.html

gdb/ChangeLog:

* riscv-tdep.c (riscv_sw_breakpoint_from_kind): Add localization
to error message string.
(riscv_register_name): Use xsnprintf instead of sprintf.
(riscv_insn::fetch_instruction): Use gdb_assert instead of
internal_error.
(riscv_print_arg_location): Use gdb_assert_not_reached instead of
error.
(riscv_push_dummy_call): Likewise.

6 years agoUse gdb::byte_vector when reading section data
Tom Tromey [Fri, 9 Mar 2018 05:28:54 +0000 (22:28 -0700)]
Use gdb::byte_vector when reading section data

This changes a couple of spots that read section data to use
gdb::byte_vector rather than a cleanup.

Regression tested by the buildbot.  I am not certain that the buildbot
actually tests the code in question, so I recommend careful review.

gdb/ChangeLog
2018-03-12  Tom Tromey  <tom@tromey.com>

* rs6000-aix-tdep.c (rs6000_aix_core_xfer_shared_libraries_aix):
Use gdb::byte_vector.
* arm-tdep.c (arm_exidx_new_objfile): Use gdb::byte_vector.

6 years agoFix ia64 GDB build
Yao Qi [Mon, 12 Mar 2018 09:15:39 +0000 (09:15 +0000)]
Fix ia64 GDB build

Commit 849d0ba8 breaks GDB build for ia64 with --with-libunwind-ia64=yes.
This patch fixes it.

gdb:

2018-03-12  Yao Qi  <yao.qi@linaro.org>

* ia64-libunwind-tdep.c (libunwind_get_reg_special): Change
parameter type to readable_regcache.
* ia64-libunwind-tdep.h (libunwind_get_reg_special): Update
the declaration.

6 years agoUse std::vector for field lists in dwarf2read.c
Tom Tromey [Sun, 11 Mar 2018 03:47:06 +0000 (20:47 -0700)]
Use std::vector for field lists in dwarf2read.c

This changes dwarf2read.c to use std::vector rather than a linked list
when managing the fields and base classes to be added to a type.  This
removes some bookkeeping types and also allows the removal of some
cleanups.

gdb/ChangeLog
2018-03-11  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (struct nextfield): Add initializers.
(struct nextfnfield): Remove.
(struct fnfieldlist): Add initializers.  Remove "length" and
"head", use std::vector.
(struct decl_field_list): Remove.
(struct field_info): Add initializers.
<fields, baseclasses>: Now std::vector.
<nbaseclasses, nfnfields, typedef_field_list_count,
nested_types_list_count>: Remove.
(dwarf2_add_field, dwarf2_add_type_defn)
(dwarf2_attach_fields_to_type, dwarf2_add_member_fn)
(dwarf2_attach_fn_fields_to_type, handle_struct_member_die)
(process_structure_scope): Update.

6 years agoRemove cleanup from build_type_psymtabs_1
Tom Tromey [Sun, 25 Feb 2018 18:11:59 +0000 (11:11 -0700)]
Remove cleanup from build_type_psymtabs_1

This removes a cleanup from build_type_psymtabs_1, by using
std::vector rather than manual memory management.

gdb/ChangeLog
2018-03-11  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (sort_tu_by_abbrev_offset): Change to be suitable
for use by std::sort.
(build_type_psymtabs_1): Use std::vector.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 12 Mar 2018 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 11 Mar 2018 00:01:12 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 10 Mar 2018 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agox86: Encode EVEX instructions with VEX128 if possible
H.J. Lu [Fri, 9 Mar 2018 16:10:27 +0000 (08:10 -0800)]
x86: Encode EVEX instructions with VEX128 if possible

If EVEX encoding isn't required, we can encode EVEX instructions with
VEX128.

* config/tc-i386.c (optimize_encoding): Encode EVEX instructions
with VEX128 if EVEX encoding isn't required.
* testsuite/gas/i386/optimize-1.d: Updated.
* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.

6 years agoFix Sparc, s390 and AArch64 targets so that they can handle relocs against ifunc...
Nick Clifton [Fri, 9 Mar 2018 14:37:36 +0000 (14:37 +0000)]
Fix Sparc, s390 and AArch64 targets so that they can handle relocs against ifunc symbols found in note sections.

  Following on from PR 22929, I have found the same problem exists with
  other ifunc supporting targets too.  Plus see this link for the bug
  being reported against the s390x binutils for Fedora rawhide:

     https://bugzilla.redhat.com/show_bug.cgi?id=1553705

  So I am going to check in the patch below which applies the same
  change that H.J. made for the x86_64 target to the other affected
  targets.  (Specifically: S390, AArch64 and Sparc).  Plus it adds a new
  test to the linker testsuite to make sure that this problem stays
  fixed.

bfd * elf64-s390.c (elf_s390_relocate_section): Move check for
relocations against non-allocated sections to before the code that
handles ifunc relocations.
* elf32-s390.c (elf_s390_relocate_section): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Treat
relocs against IFUNC symbols in non-allocated sections as relocs
against FUNC symbols.
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.

ld * testsuite/ld-ifunc/ifuncmod5.s: New test.  Checks that targets
that support IFUNC symbols can handle relocations against those
symbols in NOTE sections.
* testsuite/ld-ifunc/ifuncmod5.d: New file:  Driver for the new
test.
* testsuite/ld-ifunc/ifunc.exp: Run the new test.

6 years agoUpdate "gdb --configuration" with recently added features
Eli Zaretskii [Fri, 9 Mar 2018 13:59:11 +0000 (15:59 +0200)]
Update "gdb --configuration" with recently added features

This adds display of a few recently added optional features.

gdb/ChangeLog:
2018-03-09  Eli Zaretskii  <eliz@gnu.org>

* top.c (print_gdb_configuration): Reflect LIBIPT, LIBMEMCHECK,
and LIBMPFR in the printed configuration.

6 years agox86: Strip whitespace in check_VecOperations
H.J. Lu [Fri, 9 Mar 2018 11:51:19 +0000 (03:51 -0800)]
x86: Strip whitespace in check_VecOperations

Since the addition of pseudo prefixes changed how the scrubber treats
'{', we need to explicitly strip whitespace in check_VecOperations ().

* config/tc-i386.c (check_VecOperations): Strip whitespace.
* testsuite/gas/i386/optimize-1.s: Add whitespaces before
{%k7} and {z},
* testsuite/gas/i386/x86-64-optimize-2.s: Likewise.

6 years agoUse scoped_fd in more places
Tom Tromey [Thu, 22 Feb 2018 22:21:42 +0000 (15:21 -0700)]
Use scoped_fd in more places

This changes a few more places to use scoped_fd.  This allows the
removal of some cleanups.

Regression tested by the buildbot, though note that I'm not sure
whether the buildbot actually builds anything using all of these
files.

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

* source.c (get_filename_and_charpos): Use scoped_fd.
* nto-procfs.c (procfs_open_1): Use scoped_fd.
(procfs_pidlist): Likewise.
* procfs.c (proc_get_LDT_entry): Use scoped_fd.
(iterate_over_mappings): Likewise.

6 years agoChange enable_thread_stack_temporaries to an RAII class
Tom Tromey [Wed, 7 Mar 2018 22:55:01 +0000 (15:55 -0700)]
Change enable_thread_stack_temporaries to an RAII class

This started as a patch to change enable_thread_stack_temporaries to
be an RAII class, but then I noticed that this code used a VEC, so I
went ahead and did a bit more C++-ification, changing
stack_temporaries_enabled to a bool and changing stack_temporaries to
a std::vector.

Regression tested by the buildbot.

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

* infcall.c (struct call_return_meta_info)
<stack_temporaries_enabled>: Remove.
(get_call_return_value, call_function_by_hand_dummy): Update.
* thread.c (disable_thread_stack_temporaries): Remove.
(enable_thread_stack_temporaries): Remove.
(thread_stack_temporaries_enabled_p): Return bool.
(push_thread_stack_temporary, value_in_thread_stack_temporaries)
(get_last_thread_stack_temporary): Update.
* eval.c (evaluate_subexp): Update.
* gdbthread.h (class enable_thread_stack_temporaries): Now a
class, not a function.
(value_ptr, value_vec): Remove typedefs.
(class thread_info) <stack_temporaries_enabled>: Now bool.
<stack_temporaries>: Now a std::vector.
(thread_stack_temporaries_enabled_p)
(value_in_thread_stack_temporaries): Return bool.

6 years agox86: Optimize with EVEX128 encoding for AVX512VL
H.J. Lu [Fri, 9 Mar 2018 03:57:35 +0000 (19:57 -0800)]
x86: Optimize with EVEX128 encoding for AVX512VL

We can optimize AVX512 instructions with EVEX128 only if AVX512VL is
enabled:

1. Instruction is an AVX512VL instruction. Or
2. AVX512VL is enabled explicitly by -march=+avx512vl/".arch .avx512vl".

We should optimize EVEX instructions with EVEX128 encoding when pseudo
{evex} prefix is used.

* config/tc-i386.c (set_cpu_arch): Set cpu_arch_isa_flags.
(md_parse_option): Likewise.
(optimize_encoding): Check i.tm.cpu_flags and cpu_arch_isa_flags
for cpuavx512vl instead of cpu_arch_flags.  Optimize EVEX with
EVEX128 when EVEX encoding is required.
* testsuite/gas/i386/i386.exp: Run optimize-4, optimize-5,
x86-64-optimize-5 and x86-64-optimize-6.
* testsuite/gas/i386/optimize-1.d: Updated.
* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
* testsuite/gas/i386/optimize-4.d: New file.
* testsuite/gas/i386/optimize-4.s: Likewise.
* testsuite/gas/i386/optimize-5.d: Likewise.
* testsuite/gas/i386/optimize-5.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-5.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-5.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-6.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-6.s: Likewise.

6 years agoFix misreporting of omitted bytes for large remote packets
Simon Marchi [Fri, 9 Mar 2018 00:00:03 +0000 (19:00 -0500)]
Fix misreporting of omitted bytes for large remote packets

In remote.c, when the output of "set debug remote" is truncated, the
number of characters reported is incorrect.  What is reported is the
number of characters added by the quoting, not the number of characters
that were truncated.

gdb/ChangeLog:

* remote.c (putpkt_binary): Fix omitted bytes reporting.
(getpkt_or_notif_sane_1): Likewise.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 9 Mar 2018 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoUse std::string to simplify build_id_to_debug_bfd
Simon Marchi [Thu, 8 Mar 2018 23:57:53 +0000 (18:57 -0500)]
Use std::string to simplify build_id_to_debug_bfd

Using std::string here makes the string building simpler thank playing
with char*.  A stack allocation is replaced with heap allocation, but
I don't think this is really performance-critical code.

gdb/ChangeLog:

* build-id.c (build_id_to_debug_bfd): Use std::string.

6 years agoMake find_separate_debug_file* return std::string
Simon Marchi [Thu, 8 Mar 2018 23:56:23 +0000 (18:56 -0500)]
Make find_separate_debug_file* return std::string

This patch makes the find_separate_debug_file* functions return
std::string, which allows to get rid of some manual memory management
and one cleanup.

gdb/ChangeLog:

* build-id.c (find_separate_debug_file_by_buildid): Return
std::string.
* build-id.h (find_separate_debug_file_by_buildid): Return
std::string.
* coffread.c (coff_symfile_read): Adjust to std::string.
* elfread.c (elf_symfile_read): Adjust to std::string.
* symfile.c (separate_debug_file_exists): Change parameter to
std::string.
(find_separate_debug_file): Return std::string.
(find_separate_debug_file_by_debuglink): Return std::string.
* symfile.h (find_separate_debug_file_by_debuglink): Return
std::string.

6 years agoAdd xml_escape_text_append and use it
Simon Marchi [Thu, 8 Mar 2018 23:04:46 +0000 (18:04 -0500)]
Add xml_escape_text_append and use it

[This patch should go on top of "linux_qxfer_libraries_svr4: Use
 std::string", I should have sent them together as a series.]

I noticed that linux_qxfer_libraries_svr4 used xml_escape_text, which
returns an std::string.  That string is then copied into a larger
buffer.  It would be more efficient if we had a version of
xml_escape_text which appended to an existing string instead of
returning a new one.  This is what this patch does.

I manually verified that the output of linux_qxfer_libraries_svr4 didn't
change before/after the patch.

gdb/ChangeLog:

* common/xml-utils.c (xml_escape_text): Move code to...
(xml_escape_text_append): ... this new function.
* common/xml-utils.h (xml_escape_text_append): New declaration.
* unittests/xml-utils-selftests.c (test_xml_escape_text_append):
New function.
(_initialize_xml_utils): register test_xml_escape_text_append as
a selftest.

gdb/gdbserver/ChangeLog:

* linux-low.c (linux_qxfer_libraries_svr4): Use
xml_escape_text_append.

6 years agolinux_qxfer_libraries_svr4: Use std::string
Simon Marchi [Thu, 8 Mar 2018 23:04:07 +0000 (18:04 -0500)]
linux_qxfer_libraries_svr4: Use std::string

Use std::string, removing some manual memory management.

gdb/gdbserver/ChangeLog:

* linux-low.c (linux_qxfer_libraries_svr4): Use std::string.

6 years agoremote-stdio-gdbserver: Pass "target" to remote_exec to delete file
Simon Marchi [Thu, 8 Mar 2018 22:54:25 +0000 (17:54 -0500)]
remote-stdio-gdbserver: Pass "target" to remote_exec to delete file

As described here

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

there seems to be situations where the remote-stdio-gdbserver board
fails to delete the uploaded binary file.  Passing "target" fixes the
issue for Christian who reported the bug.

I did not experience this problem, but passing "target" to remote_exec
still works for me, so I'm fine with changing it.

Any objection?

gdb/testsuite/ChangeLog:

PR gdb/22841
* boards/remote-stdio-gdbserver.exp (${board}_file): Pass
"target" to remote_exec.

6 years agoDon't redefine upload/download/file in gdbserver-base
Simon Marchi [Thu, 8 Mar 2018 22:53:57 +0000 (17:53 -0500)]
Don't redefine upload/download/file in gdbserver-base

Before patch

  Make native gdbserver boards no longer be "remote" (in DejaGnu terms)
  739b3f1d8ff7072dcc66240c25b026c6433bda1a

the local gdbserver boards (except native-extended-gdbserver...) were
considered as remote by DejaGNU.  To avoid DejaGNU trying to use ssh/scp
to download the files to the target (which is actually local), the
gdbserver-base.exp file defined some _download, _upload and _file board
operations to override the default behavior, and instead just use local
operations.

The same patch also changed remote-stdio-gdbserver.exp to make it
inherit from gdbserver-base.exp.  Since then, this board (which is
actually remote) uses the overrides with local file operations.  As a
result, files are never actually copied to the target.

I think we can simply remove the overrides from gdbserver-base.exp.
Because all boards should be properly considered local or remote by
DejaGNU, it should by default use the right method for transferring
files.

gdb/testsuite/ChangeLog:

PR gdb/22841
* boards/gdbserver-base.exp (${board}_file, ${board}_download,
${board}_upload): Remove.

6 years agox86-64: Also optimize "clr reg64"
H.J. Lu [Thu, 8 Mar 2018 14:41:34 +0000 (06:41 -0800)]
x86-64: Also optimize "clr reg64"

"clr reg" is an alias of "xor reg, reg".  We can encode "clr reg64" as
"xor reg32, reg32".

gas/

* config/tc-i386.c (optimize_encoding): Also encode "clr reg64"
as "xor reg32, reg32".
* testsuite/gas/i386/x86-64-optimize-1.s: Add "clr reg64" tests.
* testsuite/gas/i386/x86-64-optimize-1.d: Updated.

opcodes/

* i386-opc.tbl: Add Optimize to clr.
* i386-tbl.h: Regenerated.

6 years agox86: Treat relocation against IFUNC symbol as FUNC
H.J. Lu [Thu, 8 Mar 2018 14:36:40 +0000 (06:36 -0800)]
x86: Treat relocation against IFUNC symbol as FUNC

When resolving a relocation against IFUNC symbol in a SHT_NOTE section
without SHF_ALLOC, we treat it as relocation against FUNC symbol since
it needs the address of IFUNC symbol, not the address returned by IFUNC
function.

bfd/

PR ld/22929
* elf32-i386.c (elf_i386_relocate_section): Treat relocation
against IFUNC symbol in SHT_NOTE section without SHF_ALLOC as
relocation against FUNC symbol.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

ld/

PR ld/22929
* testsuite/ld-i386/i386.exp: Run PR ld/22929 test.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr22929.d: New file.
* testsuite/ld-i386/pr22929.s: Likewise.
* testsuite/ld-x86-64/pr22929.d: Likewise.
* testsuite/ld-x86-64/pr22929.s: Likewise.

6 years agox86: Remove support for old (<= 2.8.1) versions of gcc
H.J. Lu [Thu, 8 Mar 2018 14:31:32 +0000 (06:31 -0800)]
x86: Remove support for old (<= 2.8.1) versions of gcc

Old (<= 2.8.1) versions of gcc generate broken fsubp, fsubrp, fdivp and
fdivrp instructions.  Assembler translates them to correct ones with a
warning:

[hjl@gnu-cfl-1 gas]$ cat x.s
fsubp %st(3),%st
[hjl@gnu-cfl-1 gas]$ gcc -c x.s
x.s: Assembler messages:
x.s:1: Warning: translating to `fsubp %st,%st(3)'
[hjl@gnu-cfl-1 gas]$

This patch removes support for old (<= 2.8.1) versions of gcc:

[hjl@gnu-cfl-1 gas]$ ./as-new -o x.o x.s
x.s: Assembler messages:
x.s:1: Error: operand type mismatch for `fsubp'
[hjl@gnu-cfl-1 gas]$

gas/

* NEWS: Mention -mold-gcc removal.
* config/tc-i386.c (i386_error): Remove old_gcc_only.
(old_gcc): Removed.
(match_template): Remove old gcc support.
(OPTION_MOLD_GCC): Removed.
(OPTION_MRELAX_RELOCATIONS): Updated.
(md_longopts): Remove OPTION_MOLD_GCC.
(md_parse_option): Likewise.
(md_show_usage): Remove -mold-gcc.
* testsuite/gas/i386/general.s: Convert fsub/fdiv tests for old
(<= 2.8.1) versions of gcc.
* testsuite/gas/i386/intel.s: Likewise.
* testsuite/gas/i386/general.l: Updated.
* testsuite/gas/i386/intel-intel.d: Likewise.
* testsuite/gas/i386/intel.d: Likewise.
* testsuite/gas/i386/intel.e: Likewise.
* testsuite/gas/i386/i386.exp: Don't pass -mold-gcc to general.

include/

* opcode/i386 (OLDGCC_COMPAT): Removed.

opcodes/

* i386-gen.c (opcode_modifiers): Remove OldGcc.
* i386-opc.h (OldGcc): Removed.
(i386_opcode_modifier): Remove oldgcc.
* i386-opc.tbl: Remove fsubp, fsubrp, fdivp and fdivrp
instructions for old (<= 2.8.1) versions of gcc.
* i386-tbl.h: Regenerated.

6 years agoRemove MAX_REGISTER_SIZE define
Alan Hayward [Thu, 8 Mar 2018 09:42:21 +0000 (09:42 +0000)]
Remove MAX_REGISTER_SIZE define

gdb/
* defs.h: Remove MAX_REGISTER_SIZE.
* regcache.c (init_regcache_descr): Remove MAX_REGISTER_SIZE
asserts.
* python/py-unwind.c (pyuw_sniffer): Likewise.

6 years agox86: fold several AVX512VL templates
Jan Beulich [Thu, 8 Mar 2018 07:58:55 +0000 (08:58 +0100)]
x86: fold several AVX512VL templates

The differences between some of the register and memory forms of the
same insn often don't really require the templates to be separate. For
example, Disp8MemShift is simply irrelevant to register forms. Fold
these as far as possible, and also fold register-only forms. Further
folding is possible, but needs other prereq work done first.

A note regarding EVEXDYN: This is intended to be used only when no other
properties of the template would make is_evex_encoding() return true. In
all "normal" cases I think it is preferable to omit this indicator, to
keep the table half way readable.

6 years agox86: fold certain AVX512 rotate and shift templates
Jan Beulich [Thu, 8 Mar 2018 07:58:05 +0000 (08:58 +0100)]
x86: fold certain AVX512 rotate and shift templates

Their memory forms were bogusly using VexLWP instead of VexNDD. Adjust
VexNDD handling to cope with these, allowing their register and memory
forms to be folded.

6 years agox86: fold VEX-encoded GFNI templates
Jan Beulich [Thu, 8 Mar 2018 07:57:19 +0000 (08:57 +0100)]
x86: fold VEX-encoded GFNI templates

6 years agox86: fold a few AVX512F templates
Jan Beulich [Thu, 8 Mar 2018 07:56:47 +0000 (08:56 +0100)]
x86: fold a few AVX512F templates

The differences between some of the register and memory forms of the
same insn often don't really require the templates to be separate. For
example, Disp8MemShift is simply irrelevant to register forms. Fold them
as far as possible. Further folding is possible, but needs other prereq
work done first.

6 years agox86: fold LWP templates
Jan Beulich [Thu, 8 Mar 2018 07:56:08 +0000 (08:56 +0100)]
x86: fold LWP templates

Also drop the no longer necessary explicit Disp<N> from them.

6 years agox86: fold FMA and FMA4 templates
Jan Beulich [Thu, 8 Mar 2018 07:55:37 +0000 (08:55 +0100)]
x86: fold FMA and FMA4 templates

6 years agox86: drop {X,Y,Z}MMWORD_MNEM_SUFFIX
Jan Beulich [Thu, 8 Mar 2018 07:52:27 +0000 (08:52 +0100)]
x86: drop {X,Y,Z}MMWORD_MNEM_SUFFIX

They aren't really useful (anymore?): The conflicting operand size check
isn't applicable to any insn validly using respective memory operand
sizes (and if they're used wrongly, another error would result), and the
logic in process_suffix() can be easily changed to work without them.

While re-structuring conditionals in process_suffix() also drop the
CMPXCHG8B special case in favor of a NoRex64 attribute in the opcode
table.

6 years agox86: correct operand size match checks for BMI/BMI2 insns
Jan Beulich [Thu, 8 Mar 2018 07:51:18 +0000 (08:51 +0100)]
x86: correct operand size match checks for BMI/BMI2 insns

Some BMI/BMI2 insns allow their middle operands to be a memory one. In
such a case, matching register types between operands 0 and 1 as well as
1 and 2 won't help - operands 0 and 2 also need to be checked.

6 years agox86: fold redundant expressions in process_suffix()
Jan Beulich [Thu, 8 Mar 2018 07:50:13 +0000 (08:50 +0100)]
x86: fold redundant expressions in process_suffix()

There's no point repeatedly evaluating i.types[op].bitfield.reg.

6 years agox86: simplify result processing of cpu_flags_match()
Jan Beulich [Thu, 8 Mar 2018 07:48:10 +0000 (08:48 +0100)]
x86: simplify result processing of cpu_flags_match()

Make more obvious what the success and failure paths are, and in
particular that what used to be at the "skip" label can't be reached
by what used to be straight line code.

6 years agox86: add GFNI, VAES, and VPCLMUL checking to cpu_flags_match()
Jan Beulich [Thu, 8 Mar 2018 07:47:32 +0000 (08:47 +0100)]
x86: add GFNI, VAES, and VPCLMUL checking to cpu_flags_match()

Just like for the AVX/AES and AVX/PCLMUL combinations, AVX/GFN,
AVX512F/GFNI, AVX512F/VAES, and AVX512F/PCLMUL need special handling to
deal with the pair of required checks specified in the templates.

6 years agox86: change AVX512VL handling in cpu_flags_match()
Jan Beulich [Thu, 8 Mar 2018 07:45:56 +0000 (08:45 +0100)]
x86: change AVX512VL handling in cpu_flags_match()

In order to add an AVX512F counterpart to the present AVX checking, it
is better to move the AVX512VL check out of the conditional it's
currently in.

6 years agox86: drop CPU_FLAGS_32BIT_MATCH
Jan Beulich [Thu, 8 Mar 2018 07:45:25 +0000 (08:45 +0100)]
x86: drop CPU_FLAGS_32BIT_MATCH

It has become a plain alias of CPU_FLAGS_ARCH_MATCH now.

6 years agox86: simplify AVX checks in cpu_flags_match()
Jan Beulich [Thu, 8 Mar 2018 07:44:52 +0000 (08:44 +0100)]
x86: simplify AVX checks in cpu_flags_match()

No caller cares about the specifics of CPU_FLAGS_{AES,AVX,PCLMUL}_MATCH,
so drop those and fold the nested if()-s.

6 years agox86: avoid cpu_flags_match() bogusly setting CPU_FLAGS_ARCH_MATCH
Jan Beulich [Thu, 8 Mar 2018 07:44:12 +0000 (08:44 +0100)]
x86: avoid cpu_flags_match() bogusly setting CPU_FLAGS_ARCH_MATCH

6 years agox86: drop bogus NoAVX
Jan Beulich [Thu, 8 Mar 2018 07:36:41 +0000 (08:36 +0100)]
x86: drop bogus NoAVX

These are meaningful only for insns with CpuSSE* (and a few other Cpu*)
attribute.

6 years agox86: avoid SSE check for LDMXCSR/STMXCSR
Jan Beulich [Thu, 8 Mar 2018 07:35:48 +0000 (08:35 +0100)]
x86: avoid SSE check for LDMXCSR/STMXCSR

Neither touches any XMM register, so the check is pointless. It is imo
even questionable whether in SSE2AVX mode the two should be converted to
their AVX counterparts.

6 years agox86: extend SSE check to PCLMULQDQ, AES, and GFNI insns
Jan Beulich [Thu, 8 Mar 2018 07:35:01 +0000 (08:35 +0100)]
x86: extend SSE check to PCLMULQDQ, AES, and GFNI insns

When aiming at not mixing SSE and AVX insns, these should be warned
about the same way other non-AVX ones are treated.

6 years agox86: drop FloatD
Jan Beulich [Thu, 8 Mar 2018 07:34:09 +0000 (08:34 +0100)]
x86: drop FloatD

It can be expressed by D, when making the consumer look at operand size
to tell apart both uses.

6 years agox86/Intel: correct disassembly of fsub*/fdiv*
Jan Beulich [Thu, 8 Mar 2018 07:33:06 +0000 (08:33 +0100)]
x86/Intel: correct disassembly of fsub*/fdiv*

fsub/fsubr/fsubp/fsubrp as well as fdiv/fdivr/fdivp/fdivrp disassembly
should match (a) the Intel SDM and (b) respective input fed to gas (both
of course with the exception of when we intentionally convert bogus
insns, accompanied by a warning).

6 years agox86: adjust 4-XMM-register-group related warning
Jan Beulich [Thu, 8 Mar 2018 07:27:28 +0000 (08:27 +0100)]
x86: adjust 4-XMM-register-group related warning

Drop "second": For one there's no other source register (the other
source operand is in memory), and in Intel syntax such numbering would
also be wrong.

Take the opportunity and also
- properly place declarations ahead of statements
- use %u format for unsigned int arguments
- fix indentation

6 years agox86: bogus VMOVD with 64-bit operands should only allow for registers
Jan Beulich [Thu, 8 Mar 2018 07:26:35 +0000 (08:26 +0100)]
x86: bogus VMOVD with 64-bit operands should only allow for registers

These templates exist solely to satisfy gcc's needs, and gcc only
produces these with register operands.

6 years agox86: fold AVX vcvtpd2ps memory forms
Jan Beulich [Thu, 8 Mar 2018 07:25:31 +0000 (08:25 +0100)]
x86: fold AVX vcvtpd2ps memory forms

This requires a change to ModR/M handling: Recording of displacement
types must not discard operand size information. Change the respective
code to alter only .disp<N>.

6 years agoReally remove unnecessary power9 group terminating nop
Alan Modra [Thu, 8 Mar 2018 04:04:09 +0000 (14:34 +1030)]
Really remove unnecessary power9 group terminating nop

Oops, not tested well enough.  -mpower9 sets all the PPC_OPCODE_POWERn
for n <= 9.

* config/tc-ppc.c (ppc_handle_align): Correct last patch.  Really
don't emit a group terminating nop for power9.  Simplify cpu
tests.

6 years agoRemove unnecessary power9 group terminating nop
Alan Modra [Wed, 7 Mar 2018 23:47:41 +0000 (10:17 +1030)]
Remove unnecessary power9 group terminating nop

Power9 doesn't have a group terminating nop, so we may as well emit a
normal nop for power9.  Not that it matters a great deal, I believe
ori 2,2,0 will be treated exactly as ori 0,0,0 by the hardware.

* config/tc-ppc.c (ppc_handle_align): Don't emit a group
terminating nop for power9.

6 years agoFix PR binutils/22923.
Paul Pluzhnikov [Thu, 8 Mar 2018 02:16:34 +0000 (18:16 -0800)]
Fix PR binutils/22923.

A static buffer in get_ver_flags may overflow when e.g. German translation
is longer than English original. Avoid that by expanding the buffer.

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

6 years agoReturn gdb::optional<std::string> from target_fileio_readlink
Tom Tromey [Thu, 23 Nov 2017 06:37:38 +0000 (23:37 -0700)]
Return gdb::optional<std::string> from target_fileio_readlink

This changes to_fileio_readlink and target_fileio_readlink to return a
gdb::optional<std::sring>, and then fixes up the callers and
implementations.  This allows the removal of some cleanups.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-07  Tom Tromey  <tom@tromey.com>

* linux-tdep.c (linux_info_proc): Update.
* target.h (struct target_ops) <to_fileio_readlink>: Return
optional<string>.
(target_fileio_readlink): Return optional<string>.
* remote.c (remote_hostio_readlink): Return optional<string>.
* inf-child.c (inf_child_fileio_readlink): Return
optional<string>.
* target.c (target_fileio_readlink): Return optional<string>.

6 years agoxtensa: ld: support -z relro
Max Filippov [Tue, 6 Mar 2018 05:49:35 +0000 (21:49 -0800)]
xtensa: ld: support -z relro

ld/
2018-03-07  Max Filippov  <jcmvbkbc@gmail.com>

* emulparams/elf32xtensa.sh (COMMONPAGESIZE): Define.

6 years agoNew option -z,keep-text-section prefix.
Sriraman Tallam [Wed, 7 Mar 2018 20:15:49 +0000 (12:15 -0800)]
New option -z,keep-text-section prefix.

This option does not merge certain text sections with prefixes
.text.hot, .text.unlikely, .text.startup and .text.exit.

* layout.cc (Layout::default_section_order): Check for text section
prefixes.
(Layout::text_section_name_mapping): New static member.
(Layout::text_section_name_mapping_count): New static member.
(Layout::match_section_name): New static function.
(Layout::output_section_name): Check for text section prefixes.
* layout.h (Output_section_order::ORDER_TEXT_HOT): New enum value.
(Output_section_order::ORDER_TEXT_STARTUP): New enum value.
(Output_section_order::ORDER_TEXT_EXIT): New enum value.
(Output_section_order::ORDER_TEXT_UNLIKELY): New enum value.
(Layout::text_section_name_mapping): New static member.
(Layout::text_section_name_mapping_count): New static member.
(Layout::match_section_name): New static function.
* options.h (keep_text_section_prefix): New -z option.
* testsuite/Makefile.am (keep_text_section_prefix): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/keep_text_section_prefix.cc: New test source.
* testsuite/keep_text_section_prefix.sh: New test script.

6 years agogdb: Add riscv to list of architectures with a save_reggroup
Andrew Burgess [Tue, 6 Mar 2018 16:27:13 +0000 (16:27 +0000)]
gdb: Add riscv to list of architectures with a save_reggroup

The regcache cooked_read test needs to know which architectures have a
save_reggroup, riscv does and needs adding to the list.

gdb/ChangeLog:

* regcache.c (cooked_read_test): Add riscv to the list of
architectures that have a save_reggroup.

6 years ago[PR20402][LD][AARCH64]Don't emit RELATIVE relocation for absolute symbols which are...
Renlin Li [Wed, 7 Mar 2018 09:27:45 +0000 (09:27 +0000)]
[PR20402][LD][AARCH64]Don't emit RELATIVE relocation for absolute symbols which are resolved at static linking time.

For absolute symbols which are forced local or not dynamic, the ABS relocation
should be resolved at static linking time.

Originally, an RELATIVE/ABS relocation will be generated even for absolution
symbols for the dynamic linker to resolve.

bfd/

2018-03-07  Renlin Li  <renlin.li@arm.com>

PR ld/20402
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Check absolute symbol,
and don't emit relocation in specific case.

ld/

2018-03-07  Renlin Li  <renlin.li@arm.com>

PR ld/20402
* testsuite/ld-aarch64/aarch64-elf.exp: Run new test.
* testsuite/ld-aarch64/pr20402.s: New.
* testsuite/ld-aarch64/pr20402.d: New.

6 years agoFix watching structs in C++
Andreas Arnez [Wed, 7 Mar 2018 13:29:19 +0000 (14:29 +0100)]
Fix watching structs in C++

Some of the watchpoint logic depends on the fact that the head of the
value chain represents the user-specified value to watch.  Thus no
additional values should be added to the value chain after that.  However,
if a watchpoint is defined for a C++ structure/class object, then run-time
type information (RTTI) may be present.  Thus, while constructing the
value chain for the watchpoint, the dynamic type is fetched by
gnuv3_rrti_type, which invokes value_addr, which then adds a new value to
the head of the value chain.  This new value represents the pointer to the
structure instead of the structure itself.

With such a "polluted" value chain the watchpoint logic does not recognize
when the user intended to watch a struct, and can_use_hardware_watchpoint
returns zero.  Instead of a hardware watchpoint, a software watchpoint
will then be set for no apparent reason.

This is fixed by adding an early exit to gnuv3_rtti_type when the input
value is not a dynamic class object.

gdb/testsuite/ChangeLog:

* gdb.cp/watch-cp.cc: New test.
* gdb.cp/watch-cp.exp: New file.

gdb/ChangeLog:

* gnu-v3-abi.c (gnuv3_rtti_type): Add early exit if the given
value is not a dynamic class object.

6 years agox86: Rewrite NOP generation for fill and alignment
H.J. Lu [Wed, 7 Mar 2018 12:18:45 +0000 (04:18 -0800)]
x86: Rewrite NOP generation for fill and alignment

Rewrite NOP generation for fill and code alignment by:

1. Add a 11-byte NOP with another 0x66 prefix.
2. Remove the multi-byte NOP entries which consist of 2 instructions.
3. Select proper NOPs based on ISA and processor tuning.
4. Generate multiple NOPs with the longer NOPs first followed by the
shorter NOP.
5. Use jump for larger NOP padding:
   a. > 8 bytes (2 NOPs) in 16-bit mode.
   b. > 14 bytes (2 NOPs) for older processors.
   c. > 77 bytes (7 NOPs) for newer processors.
6. Update MAX_MEM_FOR_RS_ALIGN_CODE to 4095.

PR gas/22874
* config/tc-i386.c (f32_5): Removed.
(f32_8): Likewise.
(f32_9): Likewise.
(f32_10): Likewise.
(f32_11): Likewise.
(f32_12): Likewise.
(f32_13): Likewise.
(f32_14): Likewise.
(f16_5): Likewise.
(f16_6): Likewise.
(f16_7): Likewise.
(f16_8): Likewise.
(jump_31): Likewise.
(alt64_11): Likewise.
(alt64_patt): Likewise.
(jump_disp8): New.
(jump32_disp32): Likewise.
(jump16_disp32): Likewise.
(alt_11): Likewise.
(f32_patt): Updated.
(f16_patt): Likewise.
(alt_patt): Add alt_11.
(i386_align_code): Merged with ...
(i386_generate_nops): This.  Rewritten.
(fits_in_imm7): Moved before i386_generate_nops.
(fits_in_imm31): Likewise.
* config/tc-i386.h (MAX_MEM_FOR_RS_ALIGN_CODE): Updated to
4095.
(i386_align_code): Removed.
(HANDLE_ALIGN): Rewritten with i386_generate_nops.
* doc/as.texinfo: Update limits of control byte for x86 .nops
directive.
* testsuite/gas/i386/i386.exp: Run nops-7 and x86-64-nops-7.
* gas/testsuite/gas/i386/noavx-3.l: Updated.
* gas/testsuite/gas/i386/nop-1.d: Likewise.
* gas/testsuite/gas/i386/nop-1.s: Likewise.
* gas/testsuite/gas/i386/nop-2.d: Likewise.
* gas/testsuite/gas/i386/nop-2.s: Likewise.
* gas/testsuite/gas/i386/nop-3.d: Likewise.
* gas/testsuite/gas/i386/nop-4.d: Likewise.
* gas/testsuite/gas/i386/nop-5.d: Likewise.
* gas/testsuite/gas/i386/nop-5.s: Likewise.
* gas/testsuite/gas/i386/nop-6.d: Likewise.
* gas/testsuite/gas/i386/nop-bad-1.l: Likewise.
* gas/testsuite/gas/i386/nops-1-core2.d: Likewise.
* gas/testsuite/gas/i386/nops-1-i386-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-1-i386.d: Likewise.
* gas/testsuite/gas/i386/nops-1-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-1-k8.d: Likewise.
* gas/testsuite/gas/i386/nops-1.d: Likewise.
* gas/testsuite/gas/i386/nops-2-core2.d: Likewise.
* gas/testsuite/gas/i386/nops-2-i386.d: Likewise.
* gas/testsuite/gas/i386/nops-2.d: Likewise.
* gas/testsuite/gas/i386/nops-3-i386.d: Likewise.
* gas/testsuite/gas/i386/nops-3-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-3.d: Likewise.
* gas/testsuite/gas/i386/nops-4-i386.d: Likewise.
* gas/testsuite/gas/i386/nops-4-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-4.d: Likewise.
* gas/testsuite/gas/i386/nops-4a-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-5-i686.d: Likewise.
* gas/testsuite/gas/i386/nops-5.d: Likewise.
* gas/testsuite/gas/i386/nops-6.d: Likewise.
* gas/testsuite/gas/i386/nops16-1.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nop-1.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nop-2.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nop-5.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1-core2.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1-g64.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1-k8.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1-pentium.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-1.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-2.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-3.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-4-core2.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-4-k8.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-4.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-5-k8.d: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-5.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-1.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-2.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-3.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-4.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise.
* gas/testsuite/gas/i386/ilp32/x86-64-nops-5.d: Likewise.
* gas/testsuite/gas/i386/nops-7.d: New file.
* gas/testsuite/gas/i386/nops-7.s: Likewise.
* gas/testsuite/gas/i386/x86-64-nops-7.d: Likewise.

6 years agoXCOFF disassembler
Alan Modra [Wed, 7 Mar 2018 00:36:15 +0000 (11:06 +1030)]
XCOFF disassembler

xcoff (32-bit) objdump accepted but ignored -M options unless
-mpowerpc was also given.  This patch fixes that, leaving the default
as -Mpwr for xcoff.  I've also enabled more tests for xcoff targets.

binutils/
* configure.ac: Add objdump_private_desc_xcoff for rs6000.
* configure: Regenerate.
gas/
* testsuite/gas/ppc/aix.exp: Run for rs6000 too.
* testsuite/gas/ppc/ppc.exp: Run more tests for non-ELF targets.
* testsuite/gas/ppc/machine.d: Don't run for PE targets.
opcodes/
* disassemble.c (disassembler): Use bfd_arch_powerpc entry for
bfd_arch_rs6000.
* disassemble.h (print_insn_rs6000): Delete.
* ppc-dis.c (powerpc_init_dialect): Handle rs6000.
(disassemble_init_powerpc): Call powerpc_init_dialect for rs6000.
(print_insn_rs6000): Delete.

6 years agomips64 rtype_to_howto error status
Alan Modra [Mon, 5 Mar 2018 04:01:05 +0000 (14:31 +1030)]
mips64 rtype_to_howto error status

* elf64-mips.c (mips_elf64_rtype_to_howto): Return NULL on error.
(mips_elf64_slurp_one_reloc_table): Pass on error.