platform/upstream/binutils.git
6 years agoMinor formatting fixes in riscv-tdep.h
Tom Tromey [Thu, 9 Aug 2018 16:46:01 +0000 (10:46 -0600)]
Minor formatting fixes in riscv-tdep.h

This fixes some minor formatting issues in riscv-tdep.h, including one
pointed out by ARI.

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

* riscv-tdep.h: Minor formatting fixes.

6 years agoFix some gettext ARI warnings
Simon Marchi [Thu, 9 Aug 2018 17:17:21 +0000 (13:17 -0400)]
Fix some gettext ARI warnings

ARI produces this warning for the lines touched in this patch:

  warning: gettext: All messages should be marked up with _.

However, in these cases, the message is not translatable (they are
syscall names).  Adding an extra set of parentheses silences the
warning.

gdb/ChangeLog:

* common/scoped_mmap.c (mmap_file): Silence ARI warning.
* dwarf-index-cache.c (create_dir_and_check): Likewise.
(test_mkdir_recursive): Likewise.
* dwarf-index-write.c (write_psymtabs_to_index): Likewise.

6 years agoas --help: Display default option for --elf-stt-common=
H.J. Lu [Thu, 9 Aug 2018 16:57:11 +0000 (09:57 -0700)]
as --help: Display default option for --elf-stt-common=

* as.c (show_usage): Display default option for --elf-stt-common=.

6 years agox86: Display default x86-specific options for "as --help"
H.J. Lu [Thu, 9 Aug 2018 16:48:12 +0000 (09:48 -0700)]
x86: Display default x86-specific options for "as --help"

* config/tc-i386.c (md_show_usage): Display default options.

6 years agogdb: Check element of optimised out vla exists
Andrew Burgess [Wed, 25 Jul 2018 16:33:08 +0000 (17:33 +0100)]
gdb: Check element of optimised out vla exists

If a vla is not in memory, and the upper bound is not defined, then we
can't know that an array element exists or not, and we should not try
to access the array element.  One case where this happens is for
arrays that have been optimised out, the array will then have
VALUE_LVAL of not_lval, and an undefined upper bound, if we then try
to access an element of this array we will index into random GDB
memory.

An argument could be made that even for arrays that are in inferior
memory, if the upper bound is not defined then we should not try to
access the array element, however, in some of the Fortran tests, it
seems as though we do rely indexing from a base address into an array
which has no bounds defined.  In this case GDBs standard protection
for detecting unreadable target memory prevents bad thing happening.

gdb/ChangeLog:

* valarith.c (value_subscripted_rvalue): If an array is not in
memory, and we don't know the upper bound, then we can't know that
the requested element exists or not.

gdb/testsuite/ChangeLog:

* gdb.base/vla-optimized-out.exp: Add new test.

6 years agogdb: Merge similar tests into a single test script
Andrew Burgess [Sat, 28 Jul 2018 19:55:04 +0000 (20:55 +0100)]
gdb: Merge similar tests into a single test script

The three test scripts:

  gdb/testsuite/gdb.base/vla-optimized-out.exp
  gdb/testsuite/gdb.base/vla-optimized-out-o3.exp
  gdb/testsuite/gdb.base/vla-optimized-out-o3-strict.exp

are all pretty similar, with differences in the compile flags used,
and some of the expected results.

Instead of maintaining 3 files, merge them into a single test script,
and use parameters to control the test behaviour.

gdb/testsuite/ChangeLog:

* gdb.base/vla-optimized-out-o3.exp: Delete.
* gdb.base/vla-optimized-out-o3-strict.exp: Delete.
* gdb.base/vla-optimized-out.exp: Extend to cover all of the
deleted tests.

6 years agoarm - Add some comments about the versions of ARM ELF that define various e_flags...
Richard Earnshaw [Thu, 9 Aug 2018 15:51:09 +0000 (16:51 +0100)]
arm - Add some comments about the versions of ARM ELF that define various e_flags values

This patch adds a few comments to include/elf/arm.h to clarify which
versions of the ARM ELF specification defined which headers.  Given
that the EABI is pretty ubiquitous these days, I've marked anything
not based on that as deprecated.

There are no plans to remove any deprecated definitions at this time,
but any new development shouldn't be building upon support for
deprecated definitions remaining in the long term.

* elf/arm.h: Updated comments for e_flags definitions.

6 years agoConvert .note.gnu.property section between ELF32 and ELF64
H.J. Lu [Thu, 9 Aug 2018 04:00:04 +0000 (21:00 -0700)]
Convert .note.gnu.property section between ELF32 and ELF64

.note.gnu.property section has different alignments and section
sizes for 32-bit and 64-bit ELF binaries.  This patch updated
bfd_convert_section_size and bfd_convert_section_contents to
properly convert .note.gnu.property section between 32-bit and
64-bit ELF binaries.

bfd/

PR binutils/23494
* bfd.c (bfd_convert_section_size): Check BFD_DECOMPRESS after
calling _bfd_elf_convert_gnu_property_size to convert
.note.gnu.property section size.
(bfd_convert_section_contents): Check BFD_DECOMPRESS after
calling _bfd_elf_convert_gnu_properties to convert
.note.gnu.property section.
* elf-bfd.h (_bfd_elf_convert_gnu_property_size): New prototype.
(_bfd_elf_convert_gnu_properties): Likewise.
* elf-properties.c (elf_get_gnu_property_section_size): New
function.
(elf_write_gnu_properties): Likewise.
(_bfd_elf_convert_gnu_property_size): Likewise.
(_bfd_elf_convert_gnu_properties): Likewise.
(_bfd_elf_link_setup_gnu_properties): Use
elf_get_gnu_property_section_size and elf_write_gnu_properties.

binutils/

PR binutils/23494
* testsuite/binutils-all/x86-64/pr23494a-x32.d: New file.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.s: 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.

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

6 years agoFix some comments in target.c
Simon Marchi [Wed, 8 Aug 2018 22:13:18 +0000 (18:13 -0400)]
Fix some comments in target.c

Fix a typo and add a missing one.

gdb/ChangeLog:

* target.c (str_comma_list_concat_elem): Fix typo in comment.
(target_options_to_string): Add comment.

6 years agoCheck result of "write"
Tom Tromey [Wed, 8 Aug 2018 17:57:39 +0000 (11:57 -0600)]
Check result of "write"

Some distros enable _FORTIFY_SOURCE by default, which caught a failure
to check the result of "write" in scoped_mmap-selftests.c.  This patch
fixes the problem.

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

* unittests/scoped_mmap-selftests.c: Check result of "write".

6 years agoRISC-V: Add software single step support.
Jim Wilson [Wed, 8 Aug 2018 17:53:12 +0000 (10:53 -0700)]
RISC-V: Add software single step support.

This adds software single step support that is needed by the linux native port.
This is modeled after equivalent code in the MIPS port.

This also fixes a few bugs in the compressed instruction decode support.  Some
instructions are RV32/RV64 specific, and this wasn't being checked.  Also, a
few instructions were accidentally using the non-compressed is_* function.

This has been tested on a HiFive Unleashed running Fedora, by putting a
breakpoint on start, typing stepi, and then holding down the return key until
it finishes, and observing that I see everything I expect to see along the way.
There is a problem in _dl_addr where I get into an infinite loop, but it seems
to be some synchronization code that doesn't agree with single step, so I have
to find the end of the loop, put a breakpoint there, continue, and then single
step again until the end.

gdb/
* riscv-tdep.c (enum opcode): Add jump, branch, lr, and sc opcodes.
(decode_register_index_short): New.
(decode_j_type_insn, decode_cj_type_insn): New.
(decode_b_type_insn, decode_cb_type_insn): New.
(riscv_insn::decode): Add support for jumps, branches, lr, and sc.  New
local xlen.  Check xlen when decoding ambiguous compressed insns.  In
compressed decode, use is_c_lui_insn instead of is_lui_insn, and
is_c_sw_insn instead of is_sw_insn.
(riscv_next_pc, riscv_next_pc_atomic_sequence): New.
(riscv_software_single_step): New.
* riscv-tdep.h (riscv_software_single_step): Declare.

6 years agoRISC-V: Make riscv_isa_xlen a global function.
Jim Wilson [Wed, 8 Aug 2018 17:48:09 +0000 (10:48 -0700)]
RISC-V: Make riscv_isa_xlen a global function.

This allows the function to be used from riscv OS files, which also need to
depend on XLEN size.

gdb/
* riscv-tdep.c (riscv_isa_xlen): Drop static.
* riscv-tdep.h (riscv_isa_xlen): Add extern declaration.

6 years agoAdd support for DW_OP_GNU_variable_value to readelf
Kevin Buettner [Mon, 30 Jul 2018 22:35:45 +0000 (15:35 -0700)]
Add support for DW_OP_GNU_variable_value to readelf

As indicated by the subject, this patch adds support for the DWARF
expression opcode DW_OP_GNU_variable_value to readelf.

It's pretty much a copy/paste of DW_OP_call_ref with the obvious name
changes for the printf statements.  The FIXME comment comes from that
copy/paste.

binutils/ChangeLog:

* dwarf.c (decode_location_expresion): Add case for
DW_OP_GNU_variable_value.

6 years agox86: Properly merge GNU_PROPERTY_X86_ISA_1_USED
H.J. Lu [Wed, 8 Aug 2018 13:09:15 +0000 (06:09 -0700)]
x86: Properly merge GNU_PROPERTY_X86_ISA_1_USED

Without the GNU_PROPERTY_X86_ISA_1_USED property, all ISAs may be used.
If a bit in the GNU_PROPERTY_X86_ISA_1_USED property is unset, the
corresponding x86 instruction set isn’t used.  When merging properties
from 2 input files and one input file doesn't have the
GNU_PROPERTY_X86_ISA_1_USED property, the output file shouldn't have
it neither.  This patch removes the GNU_PROPERTY_X86_ISA_1_USED
property if an input file doesn't have it.

This patch replaces the GNU_PROPERTY_X86_ISA_1_USED property with the
GNU_PROPERTY_X86_ISA_1_NEEDED property which is the minimum ISA
requirement.

bfd/

PR ld/23486
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove
GNU_PROPERTY_X86_ISA_1_USED if an input file doesn't have it.
(_bfd_x86_elf_link_setup_gnu_properties): Adding the
GNU_PROPERTY_X86_ISA_1_NEEDED, instead of
GNU_PROPERTY_X86_ISA_1_USED, property.

ld/

PR ld/23486
* testsuite/ld-i386/i386.exp: Run PR ld/23486 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr23486a.d: New file.
* testsuite/ld-i386/pr23486b.d: Likewise.
* testsuite/ld-x86-64/pr23486a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486a.d: Likewise.
* testsuite/ld-x86-64/pr23486a.s: Likewise.
* testsuite/ld-x86-64/pr23486b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486b.d: Likewise.
* testsuite/ld-x86-64/pr23486b.s: Likewise.
* testsuite/ld-i386/property-3.r: Remove "x86 ISA used".
* testsuite/ld-i386/property-4.r: Likewise.
* testsuite/ld-i386/property-5.r: Likewise.
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
* testsuite/ld-x86-64/property-3.r: Likewise.
* testsuite/ld-x86-64/property-4.r: Likewise.
* testsuite/ld-x86-64/property-5.r: 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-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.

6 years agogdb: Fix assert for extended-remote target (PR gdb/18050)
Andrew Burgess [Fri, 22 Jun 2018 19:39:26 +0000 (20:39 +0100)]
gdb: Fix assert for extended-remote target (PR gdb/18050)

Consider the following GDB session:

   (gdb) target extended-remote :2347
   (gdb) file /path/to/exe
   (gdb) set remote exec-file /path/to/exe
   (gdb) set detach-on-fork off
   (gdb) break breakpt
   (gdb) run
   # ... hits breakpoint
   (gdb) info inferiors
     Num  Description       Executable
   * 1    process 17001     /path/to/exe
     2    process 17002     /path/to/exe
   (gdb) kill
   (gdb) info inferiors
     Num  Description       Executable
   * 1    <null>            /path/to/exe
     2    process 17002     /path/to/exe
   (gdb) target extended-remote :2348
   ../../src/gdb/thread.c:660: internal-error: thread_info* any_thread_of_process(int): Assertion `pid != 0' failed.
   A problem internal to GDB has been detected,
   further debugging may prove unreliable.

Or, from bug PR gdb/18050:

   (gdb) start
   (gdb) add-inferior -exec /path/to/exe
   (gdb) target extended-remote :2347
   ../../src/gdb/thread.c:660: internal-error: thread_info* any_thread_of_process(int): Assertion `pid != 0' failed.
   A problem internal to GDB has been detected,
   further debugging may prove unreliable.

The issue is calling target.c:dispose_inferior with a killed inferior in
the inferior list.  This assertion is fixed in this commit.

The new test for this issue only runs on platforms that support
'detach-on-fork', and when using
'--target_board=native-extended-gdbserver'.

gdb/ChangeLog:

PR gdb/18050:
* target.c (dispose_inferior): Don't dispose of inferiors that are
already killed.

gdb/testsuite/ChangeLog:

PR gdb/18050:
* gdb.server/extended-remote-restart.c: New file.
* gdb.server/extended-remote-restart.exp: New file.

6 years agoFix gdb/remote.c build failure
Szabolcs Nagy [Wed, 8 Aug 2018 10:14:20 +0000 (11:14 +0100)]
Fix gdb/remote.c build failure

Add const qualifier to fix

/S/gdb/common/gdb_locale.h:35:27: error: deprecated conversion from string constant to 'char*' [-Werror=write-strings]
 # define _(String) (String)
                           ^
/S/gdb/remote.c:12844:19: note: in expansion of macro '_'
   char *err_msg = _("Tracepoint packet too large for target.");
                   ^
gdb/ChangeLog:

* remote.c (remote_target::download_tracepoint): Change char* to
const char*.

6 years agoFix "may be used uninitialized" warning.
Tulio Magno Quites Machado Filho [Wed, 8 Aug 2018 05:39:23 +0000 (22:39 -0700)]
Fix "may be used uninitialized" warning.

* object.cc (Sized_relobj_file::map_to_kept_section): Initialize
kept_file.

6 years agoProperly merge GNU_PROPERTY_X86_ISA_1_USED (x86_64).
Cary Coutant [Wed, 8 Aug 2018 04:35:12 +0000 (21:35 -0700)]
Properly merge GNU_PROPERTY_X86_ISA_1_USED (x86_64).

gold/
PR ld/23486
* x86_64.cc (Target_x86_64::Target_x86_64): Initialize
object_isa_1_used_.
(Target_x86_64::object_isa_1_used_): New data member.
(Target_x86_64::record_gnu_property): Save ISA_1_USED bits for object.
(Target_x86_64::merge_gnu_properties): Merge ISA_1_USED bits.

6 years agoFix gdb.fortran/nested-funcs.exp failure
Simon Marchi [Wed, 8 Aug 2018 02:45:43 +0000 (22:45 -0400)]
Fix gdb.fortran/nested-funcs.exp failure

Commit 87d6a7aa931f ("Add DWARF index cache") broke
gdb.fortran/nested-funcs.exp.  Because of the new "set index-cache"
command, the expression "set index = 42" now fails:

  set index = 42
  Undefined set index-cache command: "= 42".  Try "help set index-cache".
  (gdb) PASS: gdb.fortran/nested-funcs.exp: set index = 42

Fix it by changing it to "set variable index = 42".  Also, use
gdb_test_no_output to confirm that it worked (since that particular test
wrongfully passed).

gdb/testsuite/ChangeLog:

* gdb.fortran/nested-funcs.exp: Replace "set index = 42" with
"set variable index = 42".

6 years agoMake target_options_to_string return an std::string
Simon Marchi [Wed, 8 Aug 2018 01:37:40 +0000 (21:37 -0400)]
Make target_options_to_string return an std::string

Return an std::string instead of a char *, saving some manual freeing.

I only manually tested with "set debug target 1" and "set debug lin-lwp
1", since this only deals with debug output.

gdb/ChangeLog:

* target.h (target_options_to_string): Return an std::string.
* target.c (str_comma_list_concat_elem): Return void, use
std::string.
(do_option): Likewise.
(target_options_to_string): Return an std::string.
* linux-nat.c (linux_nat_target::wait): Adjust.
* target-debug.h (target_debug_print_options): Adjust.

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

6 years agoAllow CPPFLAGS to be set on the make command line
Tom Tromey [Tue, 7 Aug 2018 18:07:36 +0000 (12:07 -0600)]
Allow CPPFLAGS to be set on the make command line

While looking into PR build/8751 (which seems to be fixed), I noticed
that it's not possible to change CPPFLAGS for gdb on the "make"
command line.  It's reasonable to want to do this sometimes, and I
think this patch should suffice.

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

* Makefile.in (CPPFLAGS): New variable.
(INTERNAL_CPPFLAGS): Use it.

6 years agoAdd doc and news for DWARF index cache
Simon Marchi [Tue, 7 Aug 2018 22:15:28 +0000 (18:15 -0400)]
Add doc and news for DWARF index cache

New in v3:

- Address Eli's comments.

This patch adds doc and news for the feature introduced by the previous
patch.

gdb/ChangeLog:

* NEWS: Mention the index cache.

gdb/doc/ChangeLog:

* gdb.texinfo (Index Files Speed Up GDB): Add section about
symbol index cache.

6 years agoAdd DWARF index cache
Simon Marchi [Tue, 7 Aug 2018 22:14:20 +0000 (18:14 -0400)]
Add DWARF index cache

New in v3:

- Remove things related to the dwarf-5 format.
- Fix compilation on mingw (scoped_mmap.c).

GDB can generate indexes for DWARF debug information, which, when
integrated in the original binary, can speed up loading object files.
This can be done using the gdb-add-index script or directly by the
linker itself.  However, not many people know about this.  And even
among those who do, because it requires additional steps, I don't know a
lot of people who actually go through that trouble.

To help make using the DWARF index more transparent, this patch
introduces a DWARF index cache.  When enabled, loading an index-less
binary in GDB will automatically save an index file in ~/.cache/gdb.
When loading that same object file again, the index file will be looked
up and used to load the DWARF index.  You therefore get the benefit of
the DWARF index without having to do additional manual steps or
modifying your build system.  When an index section is already present
in the file, GDB will prefer that one over looking up the cache.

When doing my edit-compile-debug cycle, I often debug multiple times the
same build, so the cache helps reducing the load time of the debug
sessions after the first one.

- The saved index file is exactly the same as the output of the "save
  gdb-index" command.  It is therefore the exact same content that would
  be found in the .gdb_index or .debug_names section.  We just leave it
  as a standalone file instead of merging it in the binary.

- The cache is just a directory with files named after the object
  file's build-id.  It is not possible to save/load the index for an
  object file without build-id in the cache.

- The cache uses the gdb index format.  The problem with the dwarf-5
  format is that we can generate an addendum to the .debug_str section
  that you're supposed to integrate to the original binary.  This
  complicates a little bit loading the data from the cached index files,
  so I would leave this for later.

- The size taken up by ~/.cache/gdb is not limited.  I was thinking we
  could add configurable limit (like ccache does), but that would come
  after.  Also, maybe a command to flush the cache.

- The cache is disabled by default.  I think once it's been out there
  and tested for a while, it could be turned on by default, so that
  everybody can enjoy it.

- The code was made to follow the XDG specification: if the
  XDG_CACHE_HOME environment variable, it is used, otherwise it falls
  back to ~/.cache/gdb.  It is possible to change it using "set
  index-cache directory".  On other OSes than GNU/Linux, ~/.cache may
  not be the best place to put such data.  On macOS it should probably
  default to ~/Library/Caches/...  On Windows, %LocalAppData%/...  I
  don't intend to do this part, but further patches are welcome.

- I think that we need to be careful that multiple instances of GDB
  don't interfere with each other (not far fetched at all if you run GDB
  in some automated script) and the cache is always coherent (either the
  file is not found, or it is found and entirely valid).  Writing the
  file directly to its final location seems like a recipe for failure.
  One GDB could read a file in the index while it is being written by
  another GDB.  To mitigate this, I made write_psymtabs_to_index write
  to temporary files and rename them once it's done.  Two GDB instances
  writing the index for the same file should not step on each other's
  toes (the last file to be renamed will stay).  A GDB looking up a file
  will only see a complete file or no file.  Also, if GDB crashes while
  generating the index file, it will leave a work-in-progress file, but
  it won't be picked up by other instances looking up in the cache.

gdb/ChangeLog:

* common/pathstuff.h (get_standard_cache_dir): New.
* common/pathstuff.c (get_standard_cache_dir): New.
* build-id.h (build_id_to_string): New.
* dwarf-index-common.h (INDEX4_SUFFIX, INDEX5_SUFFIX,
DEBUG_STR_SUFFIX): Move to here.
* dwarf-index-write.c (INDEX4_SUFFIX, INDEX5_SUFFIX,
DEBUG_STR_SUFFIX): Move from there.
(write_psymtabs_to_index): Make non-static, add basename
parameter.  Write to temporary files, rename when done.
(save_gdb_index_command): Adjust call to
write_psymtabs_to_index.
* dwarf2read.h (dwarf2_per_objfile) <index_cache_res>: New
field.
* dwarf2read.c (dwz_file) <index_cache_res>: New field.
(get_gdb_index_contents_from_cache): New.
(get_gdb_index_contents_from_cache_dwz): New.
(dwarf2_initialize_objfile): Read index from cache.
(dwarf2_build_psymtabs): Save to index.
* dwarf-index-cache.h: New file.
* dwarf-index-cache.c: New file.
* dwarf-index-write.h: New file.

gdb/testsuite/ChangeLog:

* boards/index-cache-gdb.exp: New file.
* gdb.dwarf2/index-cache.exp: New file.
* gdb.dwarf2/index-cache.c: New file.
* gdb.base/maint.exp: Check if we are using the index cache.

6 years agoImport gnulib's mkdir module
Simon Marchi [Tue, 7 Aug 2018 22:13:52 +0000 (18:13 -0400)]
Import gnulib's mkdir module

The following patch makes use of the mkdir function.  Import the mkdir
gnulib module to ensure proper operation on all platforms.

gdb/ChangeLog:

* gnulib/aclocal.m4: Re-generate.
* gnulib/config.in: Re-generate.
* gnulib/configure: Re-generate.
* gnulib/import/Makefile.am: Re-generate.
* gnulib/import/Makefile.in: Re-generate.
* gnulib/import/m4/gnulib-cache.m4: Re-generate.
* gnulib/import/m4/gnulib-comp.m4: Re-generate.
* gnulib/import/m4/mkdir.m4: New file.
* gnulib/import/mkdir.c: New file.
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add mkdir
module.

6 years agoIntroduce mmap_file function
Simon Marchi [Tue, 7 Aug 2018 22:10:29 +0000 (18:10 -0400)]
Introduce mmap_file function

New in v2:

- As Tom pointed out, we don't need to keep the fd around after
  mmapping.  This simplifies things quite a bit, since we don't need a
  new class.  It's now just a function that returns a scoped_mmap.

We already have scoped_mmap, which is a thin RAII layer over mmap.  If
one simply wants to mmap an entire file for reading, it takes a bit of
boilerplate.  This patch introduces the mmap_file function to make this
easier.

gdb/ChangeLog:

* Makefile.in (COMMON_SFILES): Add common/scoped_mmap.c.
* common/scoped_mmap.c: New file.
* common/scoped_mmap.h (destroy): New method.
(~scoped_mmap, reset): Use destroy.
(scoped_mmap): New move constructor.
(mmap_file): New declaration.
* unittests/scoped_mmap-selftests.c (test_normal,
test_invalid_filename, run_tests): New functions.
(_initialize_scoped_mmap_selftests): Register selftest.

6 years agoMake index reading functions more modular
Simon Marchi [Tue, 7 Aug 2018 22:08:57 +0000 (18:08 -0400)]
Make index reading functions more modular

New in v3:

- Remove changed to dwarf-5 functions.

The read_gdb_index_from_section and read_debug_names_from_section
functions read the index content, as their names state, from sections of
object files.  A following patch will make it possible to read index
content from standalone files.

This patch therefore decouples the code that reads the index content
from the code that processes that content.  Functions
dwarf2_read_gdb_index and dwarf2_read_debug_names receive callbacks that
are responsible for providing the index contents (for both the main file
and the potential dwz file).

gdb/ChangeLog:

* dwarf2read.c (read_gdb_index_from_section): Rename to...
(read_gdb_index_from_buffer): ... this.  Remove section
parameter, add buffer parameter.
(get_gdb_index_contents_ftype,
get_gdb_index_contents_dwz_ftype): New typedefs.
(dwarf2_read_gdb_index): Add callback parameters to get the
index contents.
(get_gdb_index_contents_from_section): New.
(dwarf2_initialize_objfile): Update call to
dwarf2_read_gdb_index.

6 years agoReplace some uses of xstrprintf with string_printf
Simon Marchi [Tue, 7 Aug 2018 21:43:08 +0000 (17:43 -0400)]
Replace some uses of xstrprintf with string_printf

This patch replaces some simple uses of xstrprintf with with
string_printf, removing the need to do manual memory freeing.

The change in ada-lang.c fixes an apparent memory leak.

Regtested on the buildbot.

gdb/ChangeLog:

* common/filestuff.h (gdb_fopen_cloexec): New overload.
(gdb_open_cloexec): Likewise.
* nat/linux-osdata.c (command_from_pid): Use string_printf.
(commandline_from_pid): Likewise.
(linux_xfer_osdata_threads): Likewise.
(linux_xfer_osdata_fds): Likewise.
* ada-lang.c (is_package_name): Likewise.
* auxv.c (procfs_xfer_auxv): Likewise.
* breakpoint.c (print_one_breakpoint_location): Use
uiout::field_fmt.
(print_one_catch_solib): Use string_printf.
* coff-pe-read.c (add_pe_exported_sym): Likewise.
(add_pe_forwarded_sym): Likewise.
* dwarf2read.c (create_type_unit_group): Likewise.
(build_error_marker_type): Likewise.
* infcall.c (get_function_name): Likewise.
* valprint.c (print_converted_chars_to_obstack): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.

6 years agoSupport parallel make check with GNU make 4.2+
Rainer Orth [Tue, 7 Aug 2018 11:20:40 +0000 (13:20 +0200)]
Support parallel make check with GNU make 4.2+

I noticed that make -jN check would run make check-single when using GNU
make 4.2.1.

In the end, it turned out that this is due to this change from the make
4.2 NEWS file:

* The amount of parallelism can be determined by querying MAKEFLAGS, even when
  the job server is enabled (previously MAKEFLAGS would always contain only
  "-j", with no number, when job server was enabled).

The fix is trivial: just accept an optional arg to -j in Makefile.in
(saw_dash_j).  Tested on i386-pc-solaris2.11 with just make and make
-j/-jN with both make 3.82 and 4.2.1.

* Makefile.in (saw_dash_j): Allow for GNU make 4.2+ passing -jN in
MAKEFLAGS.

6 years agoPowerPC64 EH info for _notoc linkage stubs
Alan Modra [Mon, 6 Aug 2018 12:13:51 +0000 (21:43 +0930)]
PowerPC64 EH info for _notoc linkage stubs

This patch generates EH info for the new _notoc linkage stubs, to
support unwinding from asynchronous signal handlers.  Unwinding
through the __tls_get_addr_opt stub was already supported, but that
was just a single stub.  With multiple stubs the EH opcodes need to be
emitted and sized when iterating over stubs, so this is done when
emitting and sizing the stub code.  Emitting the CIEs and FDEs is done
when sizing the stubs, as we did before in order to have the linker
generated FDEs indexed in .eh_frame_hdr.  I moved the final tweaks to
FDEs from ppc64_elf_finish_dynamic_sections to ppc64_elf_build_stubs
simply because it's tidier to be done with them at that point.

bfd/
* elf64-ppc.c (struct map_stub): Delete tls_get_addr_opt_bctrl.
Add lr_restore, eh_size and eh_base.
(eh_advance, eh_advance_size): New functions.
(build_tls_get_addr_stub): Emit EH info for stub.
(ppc_build_one_stub): Likewise for _notoc stubs.
(ppc_size_one_stub): Size EH info for stub.
(group_sections): Init new map_stub fields.
(stub_eh_frame_size): Delete.
(ppc64_elf_size_stubs): Size EH info for stubs.  Set up dummy EH
program for stubs.
(ppc64_elf_build_stubs): Reinit new map_stub fields.  Set FDE
offset to stub section here..
(ppc64_elf_finish_dynamic_sections): ..rather than here.
ld/
* testsuite/ld-powerpc/notoc.s: Generate some cfi.
* testsuite/ld-powerpc/notoc.d: Adjust.
* testsuite/ld-powerpc/notoc.wf: New file.
* testsuite/ld-powerpc/powerpc.exp: Run "ext" and "notoc" tests
as run_ld_link_tests rather than run_dump_test.

6 years ago__tls_get_addr_opt stubs and tocsave optimization
Alan Modra [Sun, 5 Aug 2018 10:14:03 +0000 (19:44 +0930)]
__tls_get_addr_opt stubs and tocsave optimization

This patch fixes a bug in the handling of the __tls_get_addr_opt
stub.  Calls via this stub don't have a toc restoring instruction
following the "bl", and the stub itself doesn't have an initial toc
save instruction.  Thus it is incorrect to skip over the first
instruction when a __tls_get_addr call is marked with a tocsave
reloc.

* elf64-ppc.c (ppc64_elf_relocate_section): Don't skip first
instruction of __tls_get_addr_opt stub.
(plt_stub_size): Omit ALWAYS_EMIT_R2SAVE condition when
dealing with __tls_get_addr_opt stub.
(build_tls_get_addr_stub, ppc_size_one_stub): Likewise.

6 years agoExplain what happens for PE targeted linkers in the case where the user actually...
Martin Storsjo [Tue, 7 Aug 2018 07:45:14 +0000 (08:45 +0100)]
Explain what happens for PE targeted linkers in the case where the user actually tries to provide __CTOR_LIST__ and/or __DTOR_LIST__ symbols.

* scripttempl/pe.sc: Improve the comment about overriding
__CTOR_LIST__ and __DTOR_LIST__ symbols.
* scripttemp/pep.sc: Likewise.

6 years agoCorrect the parsing of derferred register addressing in the PDP11 assembler.
James Patrick Conlon [Tue, 7 Aug 2018 07:34:08 +0000 (08:34 +0100)]
Correct the parsing of derferred register addressing in the PDP11 assembler.

PR 23481
* config/tc-pdp11.c (parse_op_noreg): Check for deferred register
addressing before assuming non-deferred addressing.
* testsuite/gas/pdp11/pr23481.s: New test source file.
* testsuite/gas/pdp11/pr23481.d: New test driver file.
* testsuite/gas/pdp11/pdp11.exp: Run the new test.

6 years agoUpdated Bulgarian translation for the ld/ directory
Nick Clifton [Tue, 7 Aug 2018 07:16:03 +0000 (08:16 +0100)]
Updated Bulgarian translation for the ld/ directory

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 7 Aug 2018 00:00:59 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd --warn-drop-version option; by default, do not warn when discarding version info.
Cary Coutant [Mon, 6 Aug 2018 21:08:48 +0000 (14:08 -0700)]
Add --warn-drop-version option; by default, do not warn when discarding version info.

gold/
PR gold/23455
* options.h (General_options): Add --warn-drop-version option.
* symtab.cc (Symbol_table::set_dynsym_indexes): Check it.

6 years agoFix compilation failure in remote.c
Simon Marchi [Mon, 6 Aug 2018 20:54:47 +0000 (16:54 -0400)]
Fix compilation failure in remote.c

A recent patch introduced a few of these:

/home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security]
     error (err_msg);
                   ^

Fix them by replacing the call to error with

  error ("%s", err_msg);

gdb/ChangeLog:

* remote.c (remote_target::download_tracepoint): Fix format
string errors.

6 years agoFix type checking errors.
Cary Coutant [Mon, 6 Aug 2018 20:36:42 +0000 (13:36 -0700)]
Fix type checking errors.

gold/
* target.h (Sized_target::record_gnu_property): Change first two
parameters to unsigned int.
* x86_64.cc (Target_x86_64::record_gnu_property): Likewise.

6 years agoAllow larger regblock sizes when saving tracefiles
Pedro Franco de Carvalho [Mon, 6 Aug 2018 19:24:55 +0000 (16:24 -0300)]
Allow larger regblock sizes when saving tracefiles

The tracefile.c:trace_save function assumes trace_regblock_size won't
be larger than the MAX_TRACE_UPLOAD constant, used to size the buffer
which holds trace data.  This can cause buffer overruns when this is
not the case.  This patch changes this function so that the larger
size is used to size the buffer.

gdb/ChangeLog:
2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* tracefile.c: Include common/byte-vector.h.
(trace_save): Change type of buf to gdb::byte_vector.  Initialize
with trace_regblock_size if needed.  Update uses of buf.

6 years agoVariable size for regs mask in collection list
Pedro Franco de Carvalho [Mon, 6 Aug 2018 19:24:55 +0000 (16:24 -0300)]
Variable size for regs mask in collection list

This patch changes collection_list to allow larger register masks.

The mask is changed from an array to a vector and is initialized to
hold the maximum possible remote register number.  The stringify
method is updated to resize temp_buf if needed.

gdb/ChangeLog:
2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* tracepoint.h (collection_list) <m_regs_mask>: Change type to
std::vector<unsigned char>.
* tracepoint.c (collection_list::collection_list): Remove
m_regs_mask initializer from initializer list.  Resize
m_regs_mask using the largest remote register number.
(collection_list::add_remote_register): Remove size check on
m_regs_mask.  Use at to access element.
(collection_list::stringify): Change type of temp_buf to
gdb::char_vector.  Update uses of temp_buf.  Resize if needed to
stringify the register mask.  Use pack_hex_byte for the register
mask.

6 years agoUse remote register numbers in tracepoint mask
Pedro Franco de Carvalho [Mon, 6 Aug 2018 19:24:55 +0000 (16:24 -0300)]
Use remote register numbers in tracepoint mask

Currently, tracepoint register masks in the QTDP packets include both
internal and remote register numbers, as well as pseudo-register
numbers.

This patch changes this so that the mask only includes remote register
numbers.

Register numbers from agent expressions are already set in the mask
using remote numbers.  Other tracepoint actions used internal numbers,
e.g. "collect $regs" or "collect $<pseudoreg>".  To handle pseudoreg
numbers, an empty agent expression is created and ax_reg_mask is
called for this expression and the pseudoreg.  This will cause the ax
to set its mask with the corresponding remote raw register
numbers (using ax_regs_mask, which calls
gdbarch_ax_pseudo_register_collect).

If ax_regs_mask and gdbarch_ax_pseudo_register_collect also generate
more ax bytecode, the ax is also appended to the collection list.  It
isn't clear that this was the original intent for
gdbarch_ax_pseudo_register_collect, and none of the arches seem to do
this, but if this changes in the future, it should work.

The patch also refactors the code used by validate_action line to
validate axs into a function that is now called from every place that
generates axs.  Previously, some parts of tracepoint.c that generated
axs didn't check if the ax length was greater than MAX_AGENT_EXPR_LEN.

gdb/ChangeLog:
2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* tracepoint.h (class collection_list) <add_register>: Remove.
<add_remote_register, add_ax_registers, add_local_register>:
Declare.
<add_memrange>: Add scope parameter.
* tracepoint.c (encode_actions_1): Likewise.
(collection_list::add_register): Rename to ...
(collection_list::add_remote_register): ... this.  Update
comment.
(collection_list::add_ax_registers, add_local_register): New
methods.
(collection_list::add_memrange): Add scope parameter.  Call
add_local_register instead of add_register.
(finalize_tracepoint_aexpr): New function.
(collection_list::collect_symbol): Update calls to add_memrange.
Call add_local_register instead of add_register.  Call
add_ax_registers.  Call finalize_tracepoint_aexpr.
(encode_actions_1): Get remote regnos for $reg action.  Call
add_remote_register, add_ax_registers, and add_local_register.
Update call to add_memrange.  Call finalize_tracepoint_aexpr.
(validate_actionline): Call finalize_tracepoint_aexpr.

6 years agoUse get_remote_packet_size in download_tracepoint
Pedro Franco de Carvalho [Mon, 6 Aug 2018 19:24:55 +0000 (16:24 -0300)]
Use get_remote_packet_size in download_tracepoint

This patch changes the remote target to use the remote packet size to
build QTDP packets, and to check if there is enough room for the
packet.

I changed the function to raise an error if the packet is too small,
instead of aborting gdb (through xsnprintf).  It isn't clear if gdb
will be in a consistent state with respect to the stub after this,
since it's possible that some packets will be sent but not others, and
there could be an incomplete tracepoint on the stub.

The char array used to build the packets is changed to a
gdb::char_vector and sized with the result from
get_remote_packet_size.

When checking if the buffer is large enough to hold the tracepoint
condition agent expression, the length of the expression is multiplied
by two, since it is encoded with two hex digits per expression
byte.  For simplicity, I assume that the result won't overflow, which
can happen for very long condition expressions.

gdb/ChangeLog:
2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* remote.c (remote_target::download_tracepoint): Remove BUF_SIZE.
Replace array buf with gdb::char_vector buf, of size
get_remote_packet_size ().  Replace references to buf and
BUF_SIZE to buf.data () and buf.size ().  Replace strcpy, strcat
and xsnprintf with snprintf.  Raise errors if the buffer is too
small.

6 years agoRemove trailing '-' from the last QTDP action packet
Pedro Franco de Carvalho [Mon, 6 Aug 2018 19:24:55 +0000 (16:24 -0300)]
Remove trailing '-' from the last QTDP action packet

The has_more predicate in remote_target::download_tracepoint always
evaluates to true, so the last action packet will be sent with a
trailing '-'.  This patch changes the predicate to remove the last
trailing '-'.

gdb/ChangeLog:
2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* remote.c (remote_target::download_tracepoint): Fix the has_more
predicate in the QTDP action list iteration.

6 years agoFix indentation in remote_target::download_tracepoint
Pedro Franco de Carvalho [Mon, 6 Aug 2018 19:24:55 +0000 (16:24 -0300)]
Fix indentation in remote_target::download_tracepoint

gdb/ChangeLog:
2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* remote.c (remote_target::download_tracepoint): Fix indentation
in for block.

6 years agoUpdate binutils/MAINTAINERS for ARC.
Claudiu Zissulescu [Mon, 6 Aug 2018 14:07:34 +0000 (17:07 +0300)]
Update binutils/MAINTAINERS for ARC.

       binutils/
       * MAINTAINERS: Add myself as ARC maintainer.

6 years agoUpdate dg-extract-results.* from gcc
Rainer Orth [Mon, 6 Aug 2018 14:05:16 +0000 (16:05 +0200)]
Update dg-extract-results.* from gcc

When looking at the gdb.sum file produced by dg-extract-results.sh on
Solaris 11/x86, I noticed some wrong sorting, like this:

PASS: gdb.ada/addr_arith.exp: print something'address + 0
PASS: gdb.ada/addr_arith.exp: print 0 + something'address
PASS: gdb.ada/addr_arith.exp: print something'address - 0
PASS: gdb.ada/addr_arith.exp: print 0 - something'address

Looking closer, I noticed that while dg-extract-results.sh had been
copied over from contrib in the gcc repo, the corresponding
dg-extract-results.py file had not.  The latter not only fixes the
sorting problem I'd observed, but is also way faster than the shell
version (like a factor of 50 faster).

Therefore I propose to update both files from the gcc repo.  The changes
to the .sh version are trivial, just counting the number of DejaGnu
ERROR lines, too.

The files are moved to toplevel contrib:

* This way, they can easily be used should someone decide to parallelize
  one or more of the binutils, gas, or ld testsuites.

* They are less easily overlooked for updates from the gcc repo when
  they reside in the same place in both.

* The test_summary script needs to live in contrib since the toplevel
  Makefile's mail-report.log target expects it there.

Tested on amd64-pc-solaris2.11 with

make -j16 check
and
make -j16 -k RACY_ITER=5 check

gdb/testsuite:
* dg-extract-results.sh: Move to toplevel contrib.
* Makefile.in (check-parallel): Reflect dg-extract-results.sh move.
* Makefile.in (check-parallel-racy): Likewise.

contrib:
* dg-extract-results.sh: Move from gdb/testsuite.
Update from gcc repo.
* dg-extract-results.py: New from gcc repo.

6 years ago[ARC] Check if an input asm file is rf16 compliant
claziss [Mon, 6 Aug 2018 13:41:32 +0000 (16:41 +0300)]
[ARC] Check if an input asm file is rf16 compliant

Check if an input asm file is rf16 compliant; if not, and the tag says
otherwise, fix the tag and emit a warning.

gas/
2017-09-20  Claudiu Zissulescu <claziss@synopsys.com>

* config/tc-arc.c (rf16_only): New static variable.
(autodetect_attributes): Check if we are rf16 compliant.
(arc_set_public_attributes): Fix and emit the warning is required.
* testsuite/gas/arc/attr-rf16.d: New file.
* testsuite/gas/arc/attr-rf16.err: Likewise.
* testsuite/gas/arc/attr-rf16.s: Likewise.

6 years ago[ARC] Update warning reporting.
Claudiu Zissulescu [Mon, 6 Aug 2018 13:41:32 +0000 (16:41 +0300)]
[ARC] Update warning reporting.

MWDT compiler doesn't use eflags and makes use of 0x0c section. For
those, silence the gnu warning system.

bfd/
  Claudiu Zissulescu <claziss@synopsys.com>

        * elf32-arc.c (arc_elf_merge_private_bfd_data): Complain about
        efalgs only when in/out exists.
        (elf32_arc_section_from_shdr): Don't complain about 0x0c section
        type.  It is mwdt compiler specific.

6 years ago[ARC] Update merging attributes.
claziss [Mon, 6 Aug 2018 13:41:32 +0000 (16:41 +0300)]
[ARC] Update merging attributes.

Some attributes were ignored during merging. Fix that, and add some
errors.

bfd/
2017-09-19  Claudiu Zissulescu <claziss@synopsys.com>

* elf32-arc.c (arc_elf_merge_attributes): Fix merge attributes.

ld/
2017-09-19  Claudiu Zissulescu <claziss@synopsys.com>

* testsuite/ld-arc/attr-merge-6.d: New file.
* testsuite/ld-arc/attr-merge-6a.s: Likewise.
* testsuite/ld-arc/attr-merge-6b.s: Likewise.
* testsuite/ld-arc/attr-merge-6bis.d: Likewise.

6 years ago[ARC] Add Tag_ARC_ATR_version.
claziss [Mon, 6 Aug 2018 13:41:32 +0000 (16:41 +0300)]
[ARC] Add Tag_ARC_ATR_version.

Add a new tag (Tag_ARC_ATR_version) used to indicate if current
attributes are interpreted in GNU way. This attribute is used by
Synopsys custom compiler to correctly identify and interpret the
object attributes section as generated by GNU tools.

gas/
2017-08-02  Claudiu Zissulescu <claziss@synopsys.com>

* config/tc-arc.c (arc_set_public_attributes): Add
Tag_ARC_ATR_version.
(arc_convert_symbolic_attribute): Likewise.
* testsuite/gas/arc/attr-arc600.d: Update test.
* testsuite/gas/arc/attr-arc600_mul32x16.d: Likewise.
* testsuite/gas/arc/attr-arc600_norm.d: Likewise.
* testsuite/gas/arc/attr-arc601.d: Likewise.
* testsuite/gas/arc/attr-arc601_mul32x16.d: Likewise.
* testsuite/gas/arc/attr-arc601_mul64.d: Likewise.
* testsuite/gas/arc/attr-arc601_norm.d: Likewise.
* testsuite/gas/arc/attr-arc700.d: Likewise.
* testsuite/gas/arc/attr-arcem.d: Likewise.
* testsuite/gas/arc/attr-archs.d: Likewise.
* testsuite/gas/arc/attr-autodetect-1.d: Likewise.
* testsuite/gas/arc/attr-cpu-a601.d: Likewise.
* testsuite/gas/arc/attr-cpu-a700.d: Likewise.
* testsuite/gas/arc/attr-cpu-em.d: Likewise.
* testsuite/gas/arc/attr-cpu-hs.d: Likewise.
* testsuite/gas/arc/attr-em.d: Likewise.
* testsuite/gas/arc/attr-em4.d: Likewise.
* testsuite/gas/arc/attr-em4_dmips.d: Likewise.
* testsuite/gas/arc/attr-em4_fpuda.d: Likewise.
* testsuite/gas/arc/attr-em4_fpus.d: Likewise.
* testsuite/gas/arc/attr-hs.d: Likewise.
* testsuite/gas/arc/attr-hs34.d: Likewise.
* testsuite/gas/arc/attr-hs38.d: Likewise.
* testsuite/gas/arc/attr-hs38_linux.d: Likewise.
* testsuite/gas/arc/attr-mul64.d: Likewise.
* testsuite/gas/arc/attr-name.d: Likewise.
* testsuite/gas/arc/attr-nps400.d: Likewise.
* testsuite/gas/arc/attr-override-mcpu.d: Likewise.
* testsuite/gas/arc/attr-quarkse_em.d: Likewise.

bfd/
2017-08-02  Claudiu Zissulescu <claziss@synopsys.com>

* elf32-arc.c (arc_elf_merge_attributes): Handle
Tag_ARC_ATR_version.

binutils/
2017-08-02  Claudiu Zissulescu <claziss@synopsys.com>

* readelf.c (display_arc_attribute): Print Tag_ARC_ATR_version.

include/
2017-08-02  Claudiu Zissulescu <claziss@synopsys.com>

* elf/arc.h (Tag_ARC_ATR_version): New tag.

ld/
2017-08-02  Claudiu Zissulescu <claziss@synopsys.com>

* testsuite/ld-arc/attr-merge-0.d: Update test.
* testsuite/ld-arc/attr-merge-1.d: Likewise.
* testsuite/ld-arc/attr-merge-2.d: Likewise.
* testsuite/ld-arc/attr-merge-3.d: Likewise.
* testsuite/ld-arc/attr-merge-5.d: Likewise.

6 years ago[ARC] Update handling AUX-registers.
claziss [Mon, 6 Aug 2018 13:41:32 +0000 (16:41 +0300)]
[ARC] Update handling AUX-registers.

Update aux-registers data-base, and accept aux-registers names with
upper/lowercase names.

opcode/
2017-07-18  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-regs.h: Update aux-registers.

gas/
2017-07-18  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (find_opcode_match): Accept uppercase aux-regs
names.
* testsuite/gas/arc/ld2.d: Update test.
* testsuite/gas/arc/taux.d: Likewise.
* testsuite/gas/arc/taux.s: Likewise.

include/
2017-07-18  Claudiu Zissulescu  <claziss@synopsys.com>

* opcode/arc.h (ARC_OPCODE_ARCV1): Define.

6 years agoRemove unused variables in procfs.c etc.
Rainer Orth [Mon, 6 Aug 2018 11:54:34 +0000 (13:54 +0200)]
Remove unused variables in procfs.c etc.

The recent patch to enable -Wunused-variable uncovered a couple of
instances in Solaris-specific files:

/vol/src/gnu/gdb/hg/master/dist/gdb/proc-api.c: In function ‘void _initialize_proc_api()’:
/vol/src/gnu/gdb/hg/master/dist/gdb/proc-api.c:422:28: error: unused variable ‘c’ [-Werror=unused-variable]
   struct cmd_list_element *c;
                            ^

/vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In function ‘void procfs_init_inferior(target_ops*, int)’:
/vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:2895:12: error: unused variable ‘signals’ [-Werror=unused-variable]
   sigset_t signals;
            ^~~~~~~
/vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In member function ‘virtual char* procfs_target::make_corefile_notes(bfd*, int*)’:
/vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:3845:19: error: unused variable ‘old_chain’ [-Werror=unused-variable]
   struct cleanup *old_chain;
                   ^~~~~~~~~
/vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:3847:18: error: unused variable ‘fpregs’ [-Werror=unused-variable]
   gdb_fpregset_t fpregs;
                  ^~~~~~

Fixed as follows.  Tested on amd64-pc-solaris2.11, installed as obvious.

* proc-api.c (_initialize_proc_api): Remove c, unused.
* procfs.c (procfs_init_inferior): Remove signals, unused.
(procfs_target::make_corefile_notes): Remove old_chain, fpregs,
unused.

6 years agogdb: Only run scheduler-locking tests if feature is supported
Andrew Burgess [Tue, 3 Jul 2018 15:44:08 +0000 (16:44 +0100)]
gdb: Only run scheduler-locking tests if feature is supported

Not all targets support scheduler-locking.  Add a check to see if the
taraget supports scheduler locking, and if it doesn't, don't run the
scheduler-locking tests that will otherwise fail.

There are actually a set of tests that try to use scheduler-locking
however, in most of these cases the test will not be run on smaller
targets (those that might not support threads and scheduler-locking)
due to the targets lack of support for threads, or some other larger
feature.

In the gdb.mi/mi-cmd-param-changed.exp test though, there's no
dependence on threads, or any other larger feature, and so, for the
small target I was using the test would otherwise try to run, only to
fail due to lack of support for scheduler-locking.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (target_supports_scheduler_locking): New proc.
* gdb.mi/mi-cmd-param-changed.exp: Only run scheduler locking
tests if the target supports scheduler locking.

6 years agogdb: Avoid using W_STOPCODE(0) as this is ambiguous on MIPS
Andrew Burgess [Tue, 3 Jul 2018 18:02:48 +0000 (19:02 +0100)]
gdb: Avoid using W_STOPCODE(0) as this is ambiguous on MIPS

The MIPS target supports 127 signals, and this can create an ambiguity
in process wait statuses.  A status value of 0x007f could potentially
indicate a process that has exited with signal 127, or a process that
has stopped with signal 0.

In uClibc-ng the interpretation of 0x007f is that the process has
exited with signal 127 rather than stopped with signal 0, and so,
WIFSTOPPED (W_STOPCODE (0)) will be false rather than true as it would
be on most other platforms.

Given that it's pretty easy to avoid using W_STOPCODE (0), lets do that.

gdb/ChangeLog:

* linux-nat.c (linux_nat_target::follow_fork): Avoid using
'W_STOPCODE (0)' as this could be ambiguous.

6 years agox86: fold RegEip/RegRip and RegEiz/RegRiz
Jan Beulich [Mon, 6 Aug 2018 06:34:36 +0000 (08:34 +0200)]
x86: fold RegEip/RegRip and RegEiz/RegRiz

This allows to simplify the code in a number of places.

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

6 years agox86: Update assembler tests for non-ELF targets
H.J. Lu [Sun, 5 Aug 2018 17:05:52 +0000 (10:05 -0700)]
x86: Update assembler tests for non-ELF targets

evex-no-scale.s has ELF directive:

.section .probe, "", @progbits

and non-ELF targets may pad text sections.

* testsuite/gas/i386/i386.exp: Run evex-no-scale-32 and
evex-no-scale-64 only for ELF targets.
* testsuite/gas/i386/prefix32.s: Append ".p2align 4,0".
* testsuite/gas/i386/prefix64.s: Likewise.
* testsuite/gas/i386/prefix32.l: Updated.
* testsuite/gas/i386/prefix64.l: Likewise.

6 years agoR_PPC64_REL24_NOTOC support
Alan Modra [Fri, 3 Aug 2018 07:11:22 +0000 (16:41 +0930)]
R_PPC64_REL24_NOTOC support

R_PPC64_REL24_NOTOC is used on calls like "bl foo@notoc" to tell the
linker that linkage stubs for PLT calls or long branches can't use r2
for pic addressing.  Instead, new stubs that generate pc-relative
addresses are used.  One complication is that pc-relative offsets to
the PLT may need to be 64-bit in large programs, in contrast to the
toc-relative addressing used by older PLT linkage stubs where a 32-bit
offset is sufficient until the PLT itself exceeds 2G in size.

.eh_frame info to cover the _notoc stubs is yet to be implemented.

bfd/
* elf64-ppc.c (ADDI_R12_R11, ADDI_R12_R12, LIS_R12),
(ADDIS_R12_R11, ORIS_R12_R12_0, ORI_R12_R12_0),
(SLDI_R12_R12_32, LDX_R12_R11_R12, ADD_R12_R11_R12): Define.
(ppc64_elf_howto_raw): Add R_PPC64_REL24_NOTOC entry.
(ppc64_elf_reloc_type_lookup): Support R_PPC64_REL24_NOTOC.
(ppc_stub_type): Add ppc_stub_long_branch_notoc,
ppc_stub_long_branch_both, ppc_stub_plt_branch_notoc,
ppc_stub_plt_branch_both, ppc_stub_plt_call_notoc, and
ppc_stub_plt_call_both.
(is_branch_reloc): Add R_PPC64_REL24_NOTOC.
(build_offset, size_offset): New functions.
(plt_stub_size): Support plt_call_notoc and plt_call_both.
(ppc_build_one_stub, ppc_size_one_stub): Support new stubs.
(toc_adjusting_stub_needed): Handle R_PPC64_REL24_NOTOC.
(ppc64_elf_size_stubs): Likewise, and new stubs.
(ppc64_elf_build_stubs, ppc64_elf_relocate_section): Likewise.
* reloc.c: Add BFD_RELOC_PPC64_REL24_NOTOC.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.c (ppc_elf_suffix): Support @notoc.
(ppc_force_relocation, ppc_fix_adjustable): Handle REL24_NOTOC.
ld/
* testsuite/ld-powerpc/ext.d,
* testsuite/ld-powerpc/ext.s,
* testsuite/ld-powerpc/ext.lnk,
* testsuite/ld-powerpc/notoc.d,
* testsuite/ld-powerpc/notoc.s: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.

6 years agoLose _r2off in powerpc64 stub names
Alan Modra [Fri, 3 Aug 2018 07:15:25 +0000 (16:45 +0930)]
Lose _r2off in powerpc64 stub names

Not a lot is conveyed by putting _r2off in a stub symbol that can't be
seen by inspecting the stub code or the toc restoring instruction
immediately after a call via such a stub.  Also, we don't distinguish
plt_call stub symbols from plt_call_r2save stub symbols, so this patch
makes long branch and plt branch stub symbols consistent with that
decision.

bfd/
* elf64-ppc.c (ppc_build_one_stub): Lose "_r2off" in stub symbols.
ld/
* testsuite/ld-powerpc/elfv2exe.d: Adjust for stub symbol change.
* testsuite/ld-powerpc/tocopt6.d: Likewise.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Aug 2018 00:01:09 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years ago[gdb/testsuite] Fix regexp in py-rbreak.exp
Tom de Vries [Fri, 3 Aug 2018 17:15:30 +0000 (19:15 +0200)]
[gdb/testsuite] Fix regexp in py-rbreak.exp

This fails for me on openSUSE leap 15.0:
...
FAIL: gdb.python/py-rbreak.exp: check number of returned breakpoints is 11
...

The rbreak "" command expects 11 breaks, but I see two extra for
__libc_csu_fini and __libc_csu_init:
...
Breakpoint 13 at 0x4005b0: file elf-init.c, line 106.^M
Breakpoint 14 at 0x400540: file elf-init.c, line 68.^M
...

This patch fixes the failing test by excluding functions starting with an
underscore.

Tested on x86_64-linux.

2018-08-04  Tom de Vries  <tdevries@suse.de>

* gdb.python/py-rbreak.exp: Fix rbreak regexp.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Aug 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agox32: Align the .note.gnu.property section to 4 bytes
H.J. Lu [Fri, 3 Aug 2018 22:47:26 +0000 (15:47 -0700)]
x32: Align the .note.gnu.property section to 4 bytes

The .note.gnu.property section should be aligned to 4 bytes for x32.

* testsuite/ld-x86-64/property-x86-3.s: Use ".p2align 2" to
align .note.gnu.property section if __64_bit__ is undefined.

6 years agoFix thinko when deciding whether to disable TCP's Nagle algorithm
Sergio Durigan Junior [Fri, 3 Aug 2018 22:04:38 +0000 (18:04 -0400)]
Fix thinko when deciding whether to disable TCP's Nagle algorithm

This patch fixes a thinko that happened when I was implementing the
IPv6 support on GDB/gdbserver.  On certain situations, it is necessary
to disable TCP's Nagle algorithm (NODELAY).  For obvious reasons, this
only applies when we are dealing with a TCP connection.

While implementing the IPv6 patch, I noticed that the net_open
function (on gdb/ser-tcp.c) kept a flag indicating whether the
connection type was UDP or TCP.  I eliminated that flag, and started
using the 'struct addrinfo *' related to the successful connection
directly.  However, I made a mistake:

  if (success_ainfo->ai_socktype == IPPROTO_TCP)
                     ^^^^^^^^^^^
    {
      /* Disable Nagle algorithm.  Needed in some cases.  */
      int tmp = 1;

      setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY,
  (char *) &tmp, sizeof (tmp));
    }

The 'ai_socktype' field specifies the socket type (SOCK_STREAM or
SOCK_DGRAM), and not the protocol.  This test was always failing, and
the Nagle algorithm was never being disabled.

The obvious fix is to use the 'ai_protocol' field.  This is what this
patch does.

Huge "thank you" to Joel Brobecker who reported the regression (he was
experiencing an unusual delay while debugging a bare-metal program
running under QEMU) and helped me set up a proper reproducer for the
bug.

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

* ser-tcp.c (net_open): Fix thinko when deciding whether to
disable TCP's Nagle algorithm (use "ai_protocol" instead of
"ai_socktype").

6 years agoImprove objcopy's ability to merge build notes.
Nick Clifton [Fri, 3 Aug 2018 16:08:11 +0000 (17:08 +0100)]
Improve objcopy's ability to merge build notes.

* objcopy.c (merge_gnu_build_notes): Delete empty notes.  Merge
identical function notes.

6 years agoUpdate PRU assembler to corect hardware register numbering for DWARF.
Dimitar Dimitrov [Fri, 3 Aug 2018 09:02:39 +0000 (10:02 +0100)]
Update PRU assembler to corect hardware register numbering for DWARF.

A small rework of the PRU GCC port exposed that CIE data alignment is
erroneously set to 4 for PRU in GAS. In fact PRU stack must be aligned to 1.
Set the macro to -1, to allow output from GCC to be assembled without errors.

Also, while at it, set DWARF2 HW register numbering to follow latest

* config/tc-pru.c (pru_regname_to_dw2regnum): Return the starting HW
byte-register number.
(pru_frame_initial_instructions): Use byte-numbering for FP index.
* config/tc-pru.h (DWARF2_DEFAULT_RETURN_COLUMN): Use number from
latest GCC.
(DWARF2_CIE_DATA_ALIGNMENT): Set to -1.

6 years agox86: drop NoRex64 from {,v}pmov{s,z}x*
Jan Beulich [Fri, 3 Aug 2018 07:30:58 +0000 (09:30 +0200)]
x86: drop NoRex64 from {,v}pmov{s,z}x*

They're pointless with IgnoreSize also specified, and even more so when
no Qword operand exists.

6 years agox86: drop "mem" operand type attribute
Jan Beulich [Fri, 3 Aug 2018 07:30:02 +0000 (09:30 +0200)]
x86: drop "mem" operand type attribute

No template specifies this bit, so there's no point recording it in the
templates. Use a flags[] bit instead.

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

6 years agoRISC-V: Fix TLS and --gc-sections conflict.
Jim Wilson [Thu, 2 Aug 2018 23:13:49 +0000 (16:13 -0700)]
RISC-V: Fix TLS and --gc-sections conflict.

bfd/
* elfnn-riscv.c (riscv_elf_create_dynamic_sections): For .tdata.dyn,
add SEC_LINKER_CREATED flag.

6 years agoAllow "info address" of a template parameter
Tom Tromey [Thu, 19 Jul 2018 17:24:49 +0000 (11:24 -0600)]
Allow "info address" of a template parameter

PR symtab/16842 shows that gdb will crash when the user tries to
invoke "info address" of a template parameter.

The bug here is that dwarf2read.c does not set the symtab on the
template parameter symbols.  This is pedantically correct, given that
the template symbols do not appear in a symtab.  However, gdb
primarily uses the symtab backlink to find the symbol's objfile.  So,
this patch simply sets the symtab on these symbols.

Tested by the buildbot.

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

PR symtab/16842.
* dwarf2read.c (read_func_scope): Set symtab on template parameter
symbols.
(process_structure_scope): Likewise.

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

PR symtab/16842.
* gdb.cp/temargs.exp: Test "info address" of a template
parameter.

6 years agoFix kill issue leading to zombie process on MacOS Sierra
Xavier Roirand [Thu, 8 Jun 2017 16:10:18 +0000 (18:10 +0200)]
Fix kill issue leading to zombie process on MacOS Sierra

Starting with MacOS version Sierra, the gdb kill command
seems to work but inferior remains as zombie on the host.
Notice that, as zombie process, the inferior is not killable
by the user, nor by root.

The kill signal gdb sent to the inferior is not handled
in gdb as a signal sent by gdb thus no reply is made and
the process remains (since MacOS does not "release" the
inferior because no reply have been made to the signal
message).

This patch fixes this problem.

gdb/ChangeLog
2018-08-02  Xavier Roirand  <roirand@adacore.com>

PR gdb/22629:
        * darwin-nat.c (darwin_kill_inferior): Fix handling of
        kill inferior.

6 years agoCheck results of get_darwin_inferior
Tom Tromey [Fri, 13 Jul 2018 18:45:07 +0000 (12:45 -0600)]
Check results of get_darwin_inferior

I noticed that the existing kill-detach-inferiors-cmd.exp test was
causing gdb to crash on macOS 10.13.  The bug was that an inferior
that hadn't yet been started would cause get_darwin_inferior to return
NULL, and this was not checked.

I went through the places calling get_darwin_inferior and added checks
where appropriate.  This makes the test get a bit further.  Not all of
these spots are exercised by the test, but they seem safe enough in
any case.

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

* darwin-nat.c (find_inferior_task_it, darwin_find_thread)
(darwin_suspend_inferior, darwin_resume_inferior)
(darwin_decode_notify_message, darwin_resume_inferior_threads)
(darwin_check_new_threads): Check result of get_darwin_inferior.

6 years agoBackport gettext fixes to get rid of warnings on macOS
Simon Marchi [Thu, 2 Aug 2018 18:53:34 +0000 (14:53 -0400)]
Backport gettext fixes to get rid of warnings on macOS

Two fixes were committed recently to the gettext repo in order to make
gdb build warning-free on macOS.  This patch backports them both:

  - Make the format_arg attribute effective also in the case _INTL_REDIRECT_INLINE.
    113893dce80358a4ae0d9463ce73c5670c81cf0c
    http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=113893dce80358a4ae0d9463ce73c5670c81cf0c

  - Enable the format_arg attribute also on clang on Mac OS X.
    bd6a52241c7c83c90e043ace2082a2508d273f55
    http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=bd6a52241c7c83c90e043ace2082a2508d273f55

intl/ChangeLog:

* libgnuintl.h (_INTL_MAY_RETURN_STRING_ARG, gettext, dgettext,
dcgettext, ngettext, dngettext, dcngettext): Backport changes
from upstream gettext.

6 years agoDisable the PR12982 test for HPPA targets.
Nick Clifton [Thu, 2 Aug 2018 15:37:12 +0000 (16:37 +0100)]
Disable the PR12982 test for HPPA targets.

PR 23463
* testsuite/ld-plugin/pr12982.d: Revert previous delta.
* testsuite/ld-plugin/lto.exp: Skip the pr12982 test for HPPA
targets.

6 years agoifunc.exp: Always build static_nonifunc_prog
H.J. Lu [Thu, 2 Aug 2018 12:42:53 +0000 (05:42 -0700)]
ifunc.exp: Always build static_nonifunc_prog

Since static_nonifunc_prog isn't linked against libc.a, we can always
build it.

* testsuite/ld-ifunc/ifunc.exp: Always build static_nonifunc_prog.

6 years agoAdd a testcase for PR binutils/23460
H.J. Lu [Thu, 2 Aug 2018 12:00:45 +0000 (05:00 -0700)]
Add a testcase for PR binutils/23460

Add a testcase to limit open files to 16 for AR with plugin.  Before

commit 103da91bc083f94769e3758175a96d06cef1f8fe
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Aug 1 14:34:41 2018 +0100

    Close resource leaks in the BFD library's plugin handler.

it failed with:

../binutils/ar: tmpdir/pr23460f.o: plugin needed to handle lto object

PR binutils/23460
* testsuite/ld-plugin/lto.exp: Run the PR binutils/23460 test.
* testsuite/ld-plugin/pr23460a.c: New file.
* testsuite/ld-plugin/pr23460b.c: Likewise.
* testsuite/ld-plugin/pr23460c.c: Likewise.
* testsuite/ld-plugin/pr23460d.c: Likewise.
* testsuite/ld-plugin/pr23460e.c: Likewise.
* testsuite/ld-plugin/pr23460f.c: Likewise.

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

6 years agoFix spurious check-ld failures on aarch64-elf
Roland McGrath [Wed, 1 Aug 2018 20:36:51 +0000 (13:36 -0700)]
Fix spurious check-ld failures on aarch64-elf

ld/
* testsuite/ld-aarch64/ifunc-1-local.d: Adjust regexps to match
the offsets emitted by aarch64-elf configurations.
* testsuite/ld-aarch64/ifunc-1.d: Likewise.
* testsuite/ld-aarch64/ifunc-2-local.d: Likewise.
* testsuite/ld-aarch64/ifunc-2.d: Likewise.
* testsuite/ld-aarch64/ifunc-21.d: Likewise.
* testsuite/ld-aarch64/ifunc-3a.d: Likewise.

6 years agoAdd a note about regenerating the info files when creating a new release.
Nick Clifton [Wed, 1 Aug 2018 14:51:57 +0000 (15:51 +0100)]
Add a note about regenerating the info files when creating a new release.

* README-how-to-make-a-release: Add note about regenerating the
info files prior to the release.

6 years agoSkip the test for PR12982 on HPPA targets as they always need an executable stack.
Nick Clifton [Wed, 1 Aug 2018 14:28:37 +0000 (15:28 +0100)]
Skip the test for PR12982 on HPPA targets as they always need an executable stack.

PR 23463
* testsuite/ld-plugin/pr12982.d: Skip thios test for the HPPA
target.

6 years agoFix bug in PDP11 assembler when handling a JSr instruction with deferred auto increment.
James Patrick Conlon [Wed, 1 Aug 2018 14:14:46 +0000 (15:14 +0100)]
Fix bug in PDP11 assembler when handling a JSr instruction with deferred auto increment.

PR 14480
* config/tc-pdp11.c (parse_op_noreg): Check for and handle auto
increment deferred.
* testsuite/gas/pdp11/pr14480.d: New test driver file.
* testsuite/gas/pdp11/pr14480.s: New test source file file.
* testsuite/gas/pdp11/pdp11.exp: Run the new test.

6 years agoSuppress compile time warning message when compiling coff-rs6000.c with gcc v8.
Nick Clifton [Wed, 1 Aug 2018 13:46:43 +0000 (14:46 +0100)]
Suppress compile time warning message when compiling coff-rs6000.c with gcc v8.

* coff-rs6000.c (_bfd_xcoff_put_ldsymbol_name): Suppress warnings
about potentially truncated strncpy operations.
(_bfd_xcoff_put_symbol_name): Likewise.

6 years agoFix potential illegal memory access in AVR backend.
Nick Clifton [Wed, 1 Aug 2018 13:42:37 +0000 (14:42 +0100)]
Fix potential illegal memory access in AVR backend.

* elf32-avr.c (avr_stub_name): Check for a NULL return from
bfd_malloc.

6 years agoFix compile time warning problem with gcc 8 and the NS32K assembler sources.
Nick Clifton [Wed, 1 Aug 2018 13:36:50 +0000 (14:36 +0100)]
Fix compile time warning problem with gcc 8 and the NS32K assembler sources.

* config/tc-ns32k.c (addr_mode): Replace "Drop through" comment
with "Fall through" so that it will be recognised by gcc's switch
statment error checker.

6 years agoClose resource leaks in the BFD library's plugin handler.
Nick Clifton [Wed, 1 Aug 2018 13:34:41 +0000 (14:34 +0100)]
Close resource leaks in the BFD library's plugin handler.

PR 23460
* plugin.c (bfd_plugin_open_input): Close file descriptor if the
call to fstat fails.
(try_claim): Always close the file descriptor at the end of the
function.
(try_load_plugin): If a plugin has already been registered, then
skip the dlopen and onload steps and go straight to claiming the
file.  If these is an error, close the plugin.

6 years agoCopy from GCC: Add linker_output as prefix for LTO temps (PR lto/86548).
marxin [Thu, 26 Jul 2018 12:13:14 +0000 (12:13 +0000)]
Copy from GCC: Add linker_output as prefix for LTO temps (PR lto/86548).

2018-07-26  Martin Liska  <mliska@suse.cz>

        PR lto/86548
* libiberty.h (make_temp_file_with_prefix): New function.
2018-07-26  Martin Liska  <mliska@suse.cz>

        PR lto/86548
* make-temp-file.c (TEMP_FILE): Remove leading 'cc'.
(make_temp_file): Call make_temp_file_with_prefix with
        first argument set to NULL.
(make_temp_file_with_prefix): Support also prefix.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262999 138bc75d-0d04-0410-961f-82ee72b054a4

6 years agoRe: PowerPC64 __tls_get_addr_opt stub .eh_frame fix
Alan Modra [Wed, 1 Aug 2018 09:29:03 +0000 (18:59 +0930)]
Re: PowerPC64 __tls_get_addr_opt stub .eh_frame fix

The modified test failed on some powerpc targets due to differences in
default hash style.  If the default hash style is both, then more
sections are created, bumping section ids.  Section id is used in stub
symbols and although the test is careful to not depend on id in
labels, the stub hash traversal order changes when stub names change.
That lead to the stubs being emitted in a different order and thus not
matching expected output.

* testsuite/ld-powerpc/powerpc.exp: Run tlsopt5 with hash-style
specified.

6 years agoPowerPC64 __tls_get_addr_opt stub .eh_frame fix
Alan Modra [Wed, 1 Aug 2018 02:44:22 +0000 (12:14 +0930)]
PowerPC64 __tls_get_addr_opt stub .eh_frame fix

This patch sets stub_offset in ppc_size_one_stub rather than in
ppc_build_one_stub.  That allows the plt stub alignment to be done in
just ppc_size_one_stub rather than both functions.  The patch also
corrects the place where the alignment was done, fixing a possible
error in .eh_frame data, and tidies some offset calculations.

bfd/
* elf64-ppc.c (plt_stub_pad): Delay plt_stub_size call until needed.
(ppc_build_one_stub): Don't set stub_offset, instead assert that
it is sane.  Don't adjust stub_offset for alignment.  Adjust size
calculation.  Use "targ" temp when calculating offsets.
(ppc_size_one_stub): Set stub_offset here.  Use "targ" temp when
calculating offsets.  Adjust for alignment before setting
tls_get_addr_opt_bctrl.
ld/
* testsuite/ld-powerpc/powerpc.exp: Run tlsopt5 with plt alignment.
* testsuite/ld-powerpc/tlsopt5.s: Add extra call.
* testsuite/ld-powerpc/tlsopt5.wf: Adjust expected output.
* testsuite/ld-powerpc/tlsopt5.d: Likewise.

6 years agocsky regen
Alan Modra [Wed, 1 Aug 2018 01:02:56 +0000 (10:32 +0930)]
csky regen

bfd/
* po/SRC-POTFILES.in: Regenerate.
gas/
* po/POTFILES.in: Regenerate.
ld/
* po/BLD-POTFILES.in: Regenerate.
opcodes/
* po/POTFILES.in: Regenerate.

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

6 years agoCorrect previous update - new translation for the opcodes subdirectory.
Nick Clifton [Tue, 31 Jul 2018 16:49:53 +0000 (17:49 +0100)]
Correct previous update - new translation for the opcodes subdirectory.

opcodes * po/sv.po: Updated Swedish translation.

6 years agoUpdated Swedish translation for the binutils sub-directory.
Nick Clifton [Tue, 31 Jul 2018 16:46:15 +0000 (17:46 +0100)]
Updated Swedish translation for the binutils sub-directory.

* po/sv.po: Updated Swedish translation.

6 years agoDocument the GDB 8.1.1 release in gdb/ChangeLog
Joel Brobecker [Tue, 31 Jul 2018 14:59:44 +0000 (07:59 -0700)]
Document the GDB 8.1.1 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 8.1.1 released.

6 years agoFix segfault when invoking -var-info-path-expression on a dynamic varobj
Jan Vrany [Tue, 31 Jul 2018 09:15:44 +0000 (10:15 +0100)]
Fix segfault when invoking -var-info-path-expression on a dynamic varobj

Invoking -var-info-path-expression on a dynamic varobj lead either in wrong
(nonsense) result or to a segmentation fault in cplus_describe_child().
This was caused by the fact that varobj_get_path_expr() called
cplus_path_expr_of_child() ignoring the fact the parent of the variable
is dynamic. Then, cplus_describe_child() accessed the underlaying C type
members by index, causing (i) either wrong (nonsense) expression being
returned (since dynamic child may be completely arbibtrary value)
or (ii) segmentation fault (in case the index higher than number of
underlaying C type members.

This fixes the problem by checking whether a varobj is a child of a dynamic
varobj and, if so, reporting an error as described in documentation.

gdb/ChangeLog:

* varobj.c (varobj_get_path_expr_parent): Report an error if
parent is a dynamic varobj.

gdb/testsuite/Changelog:

* gdb.python/py-mi-var-info-path-expression.c: New file.
* gdb.python/py-mi-var-info-path-expression.py: New file.
* gdb.python/py-mi-var-info-path-expression.exp: New file.

6 years agoRe-generate gnulib import
Simon Marchi [Tue, 31 Jul 2018 14:09:10 +0000 (10:09 -0400)]
Re-generate gnulib import

I noticed that re-generating our gnulib import introduced some changes.
I supposed that this comes from the recent upgrade to autoconf 2.69
(though I haven't checked).

Tested by rebuilding on GNU/Linux x86-64 and mingw (cross-compiled from
GNU/Linux).

gdb/ChangeLog:

* gnulib/aclocal.m4: Re-generate.
* gnulib/config.in: Re-generate.
* gnulib/configure: Re-generate.
* gnulib/import/Makefile.in: Re-generate.
* gnulib/import/m4/gnulib-comp.m4: Re-generate.
* gnulib/import/m4/onceonly.m4: Re-generate.

6 years agoDelete test target descriptions when exiting
Simon Marchi [Tue, 31 Jul 2018 14:06:00 +0000 (10:06 -0400)]
Delete test target descriptions when exiting

Looking at the address sanitizer output, this was a quite low hanging
fruit.  We create target_desc objects for testing that we never free.
Saving them in unique_ptrs takes care of it.

I created a small struct to hold these because I thought it would help
readability.

gdb/ChangeLog:

* target-descriptions.c (struct xml_test_tdesc): New.
(xml_tdesc): Change type to std::vector<xml_test_tdesc>.
(record_xml_tdesc): Update.
(maintenance_check_xml_descriptions): Update.
* target-descriptions.h (record_xml_tdesc): Update comment.

6 years agox86: also optimize KXOR{D,Q} and KANDN{D,Q}
Jan Beulich [Tue, 31 Jul 2018 08:58:05 +0000 (10:58 +0200)]
x86: also optimize KXOR{D,Q} and KANDN{D,Q}

These can be converted to 2-byte VEX encoding when both source registers
are the same, by using KXORW / KANDNW as replacement.

6 years agox86: fold various AVX512 templates with so far differing Masking attributes
Jan Beulich [Tue, 31 Jul 2018 08:57:09 +0000 (10:57 +0200)]
x86: fold various AVX512 templates with so far differing Masking attributes

There's no insn allowing ZEROING_MASKING alone. Re-purpose its value for
handling the not uncommon case of insns allowing either form of masking
with register operands, but only merging masking with a memory operand.