deliverable/binutils-gdb.git
5 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*.

5 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.

5 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.

5 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".

5 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.

5 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

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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

5 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

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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

5 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.

5 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.

5 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.

5 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

5 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.

5 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

5 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.

5 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").

5 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.

5 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.

5 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.

5 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.

5 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

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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

5 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.

5 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.

5 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.

5 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

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 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.

5 years agox86: add more exhaustive tests for invalid AVX512 zeroing-masking
Jan Beulich [Tue, 31 Jul 2018 08:56:09 +0000 (10:56 +0200)] 
x86: add more exhaustive tests for invalid AVX512 zeroing-masking

Before changing how things get handled, install a full set of tests,
such that it can be demonstrated that the subsequent change doesn't
break things.

5 years agox86/Intel: correct permitted operand sizes for AVX512 scatter/gather
Jan Beulich [Tue, 31 Jul 2018 08:55:17 +0000 (10:55 +0200)] 
x86/Intel: correct permitted operand sizes for AVX512 scatter/gather

AVX gather insns correctly allow the element size to be specified rather
than the full vector size. Make AVX512 ones match.

5 years agox86: don't abort() upon DATA16 prefix on (E)VEX encoded insn
Jan Beulich [Tue, 31 Jul 2018 08:54:05 +0000 (10:54 +0200)] 
x86: don't abort() upon DATA16 prefix on (E)VEX encoded insn

Instead of hitting the abort() in output_insn() (commented by "There
should be no other prefixes for instructions with VEX prefix"), report
a proper diagnostic instead, just like we do e.g. for invalid REP
prefixes.

5 years agox86: drop CpuVREX
Jan Beulich [Tue, 31 Jul 2018 08:52:37 +0000 (10:52 +0200)] 
x86: drop CpuVREX

It is fully redundant with CpuAVX512F.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 31 Jul 2018 00:00:34 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoMatch any kind of error after "cannot resolve name" on lib/gdbserver-support.exp...
Sergio Durigan Junior [Mon, 30 Jul 2018 19:23:27 +0000 (15:23 -0400)] 
Match any kind of error after "cannot resolve name" on lib/gdbserver-support.exp:gdbserver_start

On commit:

commit 7f1f7e23939adc7d71036a17fc6081e3af7ca585
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Fri Jul 13 16:20:34 2018 -0400

    Expect for another variant of error message when gdbserver cannot resolve hostname

I extended the regular expression being used to identify whether
gdbserver could not resolve a (host)name.  This was needed because the
error message being printed had a different variation across some
systems.  However, as it turns out, I've just noticed that the message
has yet another variation:

  target remote tcp8:123:2353
  tcp8:123:2353: cannot resolve name: System error
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  tcp8:123:2353: No such file or directory.
  (gdb) FAIL: gdb.server/server-connect.exp: tcp8: connect to gdbserver using tcp8:123

which is causing FAILs on some systems (namely, Fedora-i686 on
BuildBot).

So instead of trying to predict everything that can be printed, I
decided to just match anything after the "cannot resolve name: " part.
This patch implements that.

Regression tested on the BuildBot.

gdb/testsuite/ChangeLog:
2018-07-30  Sergio Durigan Junior  <sergiodj@redhat.com>

* lib/gdbserver-support.exp (gdbserver_start): Match any kind of
error after "cannot resolve name" string.

5 years agoRISC-V: Set insn info fields correctly when disassembling.
Jim Wilson [Mon, 30 Jul 2018 20:55:41 +0000 (13:55 -0700)] 
RISC-V: Set insn info fields correctly when disassembling.

include/
* opcode/riscv.h (INSN_TYPE, INSN_BRANCH, INSN_CONDBRANCH, INSN_JSR)
(INSN_DREF, INSN_DATA_SIZE, INSN_DATA_SIZE_SHIFT, INSN_1_BYTE)
(INSN_2_BYTE, INSN_4_BYTE, INSN_8_BYTE, INSN_16_BYTE): New.

opcodes/
* riscv-dis.c (riscv_disassemble_insn): Set insn_type and data_size
fields.
* riscv-opc.c (riscv_opcodes): Use new INSN_* flags to annotate insns.

5 years agogdb: Fix sizeof for dynamic types other than arrays
Andrew Burgess [Sun, 29 Jul 2018 21:14:33 +0000 (22:14 +0100)] 
gdb: Fix sizeof for dynamic types other than arrays

In commit:

   commit 37cc0caeca4c9a8552370040f4cfeaeceaa03369
   Date:   Wed Jul 18 13:38:35 2018 +0200
   [gdb/exp] Interpret size of vla with unknown size as <optimized out>

All dynamic types are treated as arrays in the 'sizeof' code path,
which means that structures can incorrectly be treated as arrays.
This can cause a failure in the gdb.base/vla-datatypes.exp test
script.

This commit adds a check that we do have an array before checking the
array bounds, and I also check that the array index type is dynamic
too.  This second check probably isn't strictly necessary, but
shouldn't hurt, a non-dynamic index type shouldn't have undefined high
bound.

gdb/ChangeLog:

* eval.c (evaluate_subexp_for_sizeof): Check for array type before
checking array bounds are defined.

5 years agox86: don't mistakenly scale non-8-bit displacements
Jan Beulich [Mon, 30 Jul 2018 15:25:05 +0000 (17:25 +0200)] 
x86: don't mistakenly scale non-8-bit displacements

In commit b5014f7af2 I've removed (instead of replaced) a conditional,
resulting in addressing forms not allowing 8-bit displacements to now
get their displacements scaled under certain circumstances. Re-add the
missing conditional.

5 years ago * MAINTAINERS (C-SKY): Add Yunhai Shang as co-maintainer.
Andrew Jenner [Mon, 30 Jul 2018 15:22:21 +0000 (08:22 -0700)] 
* MAINTAINERS (C-SKY): Add Yunhai Shang as co-maintainer.

5 years ago * MAINTAINERS (C-SKY): Add Lifang Xia as maintainer.
Andrew Jenner [Mon, 30 Jul 2018 14:53:38 +0000 (07:53 -0700)] 
* MAINTAINERS (C-SKY): Add Lifang Xia as maintainer.

5 years agoFix crash with -D_GLIBCXX_DEBUG
Tom Tromey [Fri, 20 Jul 2018 03:10:09 +0000 (21:10 -0600)] 
Fix crash with -D_GLIBCXX_DEBUG

I noticed a buildbot failure where gdb crashed in info-os.exp, when
compiled with -D_GLIBCXX_DEBUG:

    (gdb) info os procgroups
    /usr/include/c++/7/bits/stl_algo.h:4834:
    Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).
    Objects involved in the operation:
iterator::value_type "< operator type" {
  type = pid_pgid_entry;
}

The bug here is that pid_pgid_entry::operator< violates the C++
irreflexivity rule; that is, that an object cannot be less than
itself.

Tested locally by re-running info-os.exp.

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

* nat/linux-osdata.c (pid_pgid_entry::operator<): Fix
irreflexivity violation.

5 years agoRemove old lint code
Tom Tromey [Sun, 29 Jul 2018 21:23:51 +0000 (15:23 -0600)] 
Remove old lint code

This removes dead code that, according to the comments, existed to
placate lint.  I don't think this has been relevant in a long time,
and certainly not since gdb switched to C++.

Tested by rebuilding.

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

* cli/cli-decode.c (lookup_cmd): Remove lint code.
* value.c (unpack_long): Remove lint code.
* valops.c (value_ind): Remove lint code.
* valarith.c (value_x_binop, value_x_unop, value_equal)
(value_pos): Remove lint code.

5 years agoPrevent a seg-fault in the linker when trying to process SH object files with bogus...
Nick Clifton [Mon, 30 Jul 2018 12:58:15 +0000 (13:58 +0100)] 
Prevent a seg-fault in the linker when trying to process SH object files with bogus relocs.

PR 22706
* elf32-sh.c (sh_elf_relocate_section): When processing
translation relocs, fail if the relocation offset is too small.
Replace BFD_ASSERTs with more helpful error messages.

5 years agoFix thinko in the placement of the .gnu.build.attributes section.
Nick Clifton [Mon, 30 Jul 2018 11:35:37 +0000 (12:35 +0100)] 
Fix thinko in the placement of the .gnu.build.attributes section.

* scripttempl/elf.sc: Move the .gnu.build.attributes section to
after the .comment section.

5 years agoAdd support for the C_SKY series of processors.
Andrew Jenner [Mon, 30 Jul 2018 11:24:14 +0000 (12:24 +0100)] 
Add support for the C_SKY series of processors.

This patch series is a new binutils port for C-SKY processors, including support for both the V1 and V2 processor variants.  V1 is derived from the MCore architecture while V2 is substantially different, with mixed 16- and 32-bit instructions, a larger register set, a different (but overlapping) ABI, etc.  There is support for bare-metal ELF targets and Linux with both glibc and uClibc.

This code is being contributed jointly by C-SKY Microsystems and Mentor Graphics.  C-SKY is responsible for the technical content and has proposed Lifang Xia and Yunhai Shang as port maintainers.  (Note that C-SKY does have a corporate copyright assignment on file with the FSF.) Mentor Graphics' role has been cleaning up the code, adding documentation and additional test cases, etc, to address issues we anticipated reviewers would complain about.

bfd     * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES): Add C-SKY.
        (BFD32_BACKENDS, BFD_BACKENDS_CFILES): Likewise.
        * Makefile.in: Regenerated.
        * archures.c (enum bfd_architecture): Add bfd_arch_csky and
        related bfd_mach defines.
        (bfd_csky_arch): Declare.
        (bfd_archures_list): Add C-SKY.
        * bfd-in.h (elf32_csky_build_stubs): Declare.
        (elf32_csky_size_stubs): Declare.
        (elf32_csky_next_input_section: Declare.
        (elf32_csky_setup_section_lists): Declare.
        * bfd-in2.h: Regenerated.
        * config.bfd: Add C-SKY.
        * configure.ac: Likewise.
        * configure: Regenerated.
        * cpu-csky.c: New file.
        * elf-bfd.h (enum elf_target_id): Add C-SKY.
        * elf32-csky.c: New file.
        * libbfd.h: Regenerated.
        * reloc.c: Add C-SKY relocations.
        * targets.c (csky_elf32_be_vec, csky_elf32_le_vec): Declare.
        (_bfd_target_vector): Add C-SKY target vector entries.

binutils* readelf.c: Include elf/csky.h.
        (guess_is_rela): Handle EM_CSKY.
        (dump_relocations): Likewise.
        (get_machine_name): Likewise.
        (is_32bit_abs_reloc): Likewise.

include  * dis-asm.h (csky_symbol_is_valid): Declare.
         * opcode/csky.h: New file.

opcodes  * Makefile.am (TARGET_LIBOPCODES_CFILES): Add csky-dis.c.
         * Makefile.in: Regenerated.
         * configure.ac: Add C-SKY.
         * configure: Regenerated.
         * csky-dis.c: New file.
         * csky-opc.h: New file.
         * disassemble.c (ARCH_csky): Define.
         (disassembler, disassemble_init_for_target): Add case for ARCH_csky.
         * disassemble.h (print_insn_csky, csky_get_disassembler): Declare.

gas      * Makefile.am (TARGET_CPU_CFILES): Add entry for C-SKY.
         (TARGET_CPU_HFILES, TARGET_ENV_HFILES): Likewise.
         * Makefile.in: Regenerated.
         * config/tc-csky.c: New file.
         * config/tc-csky.h: New file.
         * config/te-csky_abiv1.h: New file.
         * config/te-csky_abiv1_linux.h: New file.
         * config/te-csky_abiv2.h: New file.
         * config/te-csky_abiv2_linux.h: New file.
         * configure.tgt: Add C-SKY.
         * doc/Makefile.am (CPU_DOCS): Add entry for C-SKY.
         * doc/Makefile.in: Regenerated.
         * doc/all.texi: Set CSKY feature.
         * doc/as.texi (Overview): Add C-SKY options.
         (Machine Dependencies): Likewise.
         * doc/c-csky.texi: New file.
         * testsuite/gas/csky/*: New test cases.

ld      * Makefile.am (ALL_EMULATION_SOURCES): Add C-SKY emulations.
        (ecskyelf.c, ecskyelf_linux.c): New rules.
        * Makefile.in: Regenerated.
        * configure.tgt: Add C-SKY.
        * emulparams/cskyelf.sh: New file.
        * emulparams/cskyelf_linux.sh: New file.
        * emultempl/cskyelf.em: New file.
        * gen-doc.texi: Add C-SKY.
        * ld.texi: Likewise.
        (Options specific to C-SKY targets): New section.
        * testsuite/ld-csky/*: New tests.

This page took 0.05379 seconds and 4 git commands to generate.