external/binutils.git
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.

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

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

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

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

6 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

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

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

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

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

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

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

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

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

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

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

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

6 years agoCombine ,gnu.build.attributes.* sections into one .gnu.build.attributes section durin...
Nick Clifton [Mon, 30 Jul 2018 08:34:40 +0000 (09:34 +0100)]
Combine ,gnu.build.attributes.* sections into one .gnu.build.attributes section during linking.

gold * layout.cc (section_name_mapping): Add an entry for
.gnu.build.attributes.

ld * scripttempl/elf.sc: Place .gnu.build.attributes sections with
other read-only sections.

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

6 years agoFix unwind offset for start_symbol.
John David Anglin [Sun, 29 Jul 2018 16:51:23 +0000 (12:51 -0400)]
Fix unwind offset for start_symbol.

* config/tc-hppa.c: Include "struc-symbol.h".
(pa_build_unwind_subspace): Use call_info->start_symbol->sy_frag
instead of frag_now for local symbol replacement.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 29 Jul 2018 00:00:51 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agogdb: Don't call gdb_load_shlib unless GDB is running
Andrew Burgess [Wed, 11 Jul 2018 15:58:47 +0000 (16:58 +0100)]
gdb: Don't call gdb_load_shlib unless GDB is running

The gdb_load_shlib function will, on remote targets, try to run some
GDB commands.  This obviously isn't going to work unless GDB is
running.

The gdb.trace/tspeed.exp test calls gdb_load_shlib before starting
GDB.  Don't do that.

The failure that's triggered is actually DeJaGNU complaining that the
variable $use_gdb_stub doesn't exist, this is only created when GDB is
started.  Something like this should trigger a failure:

  make check-gdb \
    RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost \
                  gdb.trace/tspeed.exp"

This commit also adds a check to gdb_load_shlib that GDB is running.
The check is always performed, so this should catch cases where a GDB
developer adds a use of gdb_load_shlib but doesn't test their code
with a remote target.

gdb/testsuite/ChangeLog:

* gdb.trace/tspeed.exp: Only call gdb_load_shlib after gdb has
started.
* lib/gdb.exp (gdb_load_shlib): Call perror if GDB is not running.

6 years ago[gdb/exp] Interpret size of vla with unknown size as <optimized out>
Tom de Vries [Wed, 18 Jul 2018 11:38:35 +0000 (13:38 +0200)]
[gdb/exp] Interpret size of vla with unknown size as <optimized out>

At -O3 -g -gstrict-dwarf, gcc generates for an optimized out vla 'a' a
DW_TAG_variable with type DW_TAG_array_type containing one
DW_TAG_subrange_type, but without DW_AT_upper_bound or DW_AT_count, which
makes the upper bound value 'unknown':
...
.uleb128 0x15   # (DIE (0x161) DW_TAG_variable)
        .long   0xec    # DW_AT_abstract_origin
        .long   0x170   # DW_AT_type
...
        .uleb128 0xa    # (DIE (0x170) DW_TAG_array_type)
        .long   0x110   # DW_AT_type
        .long   0x17f   # DW_AT_sibling
        .uleb128 0x17   # (DIE (0x179) DW_TAG_subrange_type)
        .long   0xc6    # DW_AT_type
        .byte   0       # end of children of DIE 0x170
...

But gdb prints '0' for the size of 'a':
...
/gdb ./vla-1.exe -batch -ex "b f1" -ex "run" -ex "p sizeof(a)"
Breakpoint 1 at 0x4004c0: f1. (2 locations)

Breakpoint 1, f1 (i=<optimized out>) at vla-1.c:18
18      }
$1 = 0
...
while <optimized out> would be more appropriate.

This patch fixes that in evaluate_subexp_for_sizeof.

Build and reg-tested on x86_64-linux.

2018-07-28  Tom de Vries  <tdevries@suse.de>

* eval.c (evaluate_subexp_for_sizeof): Interpret size of dynamic type
with undefined upper bound as <optimized out>.

* gdb.base/vla-optimized-out-o3-strict.exp: New file.

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

6 years agoRISC-V: Fix gas configure support for riscv*-*-*.
Jim Wilson [Fri, 27 Jul 2018 21:35:29 +0000 (14:35 -0700)]
RISC-V: Fix gas configure support for riscv*-*-*.

gas/
* configure.tgt (riscv*): Accept as alias for riscv32*.

6 years agoImprove gcore manpage and clarify "-o" option
Sergio Durigan Junior [Fri, 27 Jul 2018 04:52:23 +0000 (00:52 -0400)]
Improve gcore manpage and clarify "-o" option

Ref.: https://bugs.debian.org/904628

It has been reported that gcore's manpage is a bit imprecise when it
comes to two things:

- It doesn't explicity say that the command accepts more than one PID
  on its CLI.

- It fails to mention that the argument passed through the "-o" option
  is actually a prefix that will be used to compose the corefile's
  filename, and not the actual filename.

I decided to give it a try and rewrite parts of the text to further
clarify these two points.  I ended up rewording the "Description"
section because, IMHO, it was a bit confuse to understand.

To make things consistent, I've also renamed the "$name" variable in
the gcore.in script, and expanded the usage text.

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

* gdb.texinfo (gcore man): Rewrite "Description" and "-o"
option sections to further clarify that gcore can take more
than one PID, and that "-o" is used to specify a prefix, not a
filename.

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

* gcore.in: Rename variable "name" to "prefix".  Expand
"usage" text.

6 years agox86: Check for more than 2 memory references
H.J. Lu [Fri, 27 Jul 2018 13:35:09 +0000 (06:35 -0700)]
x86: Check for more than 2 memory references

For

movsd (%esi), %ss:(%edi), %ss:(%eax)

we got

[hjl@gnu-tools-1 tmp]$ as -o x.o x.s
x.s: Assembler messages:
x.s:1: Error: too many memory references for `movsd'
munmap_chunk(): invalid pointer
x.s:1: Internal error (Aborted).
Please report this bug.
[hjl@gnu-tools-1 tmp]$

struct _i386_insn has

const seg_entry *seg[2];

3 memory references will overflow the seg array.  We should issue an
error if there are more than 2 memory references.

PR gas/23453
* config/tc-i386.c (parse_operands): Check for more than 2
memory references.
* testsuite/gas/i386/inval.s: Add a movsd test with 3 memory
references.
* testsuite/gas/i386/x86-64-inval.s: Likewise.
* testsuite/gas/i386/inval.l: Updated.
* testsuite/gas/i386/x86-64-inval.l: Likewise.

6 years agoS12Z: Remove ELF_TARGET_ID macro
John Darrington [Tue, 24 Jul 2018 10:58:44 +0000 (12:58 +0200)]
S12Z: Remove ELF_TARGET_ID macro

* elf32-s12z.c (ELF_TARGET_ID): Don't define.

6 years agoAdd functions and macros to read and write 24 bit values.
John Darrington [Tue, 24 Jul 2018 10:58:43 +0000 (12:58 +0200)]
Add functions and macros to read and write 24 bit values.

* libbfd.c (bfd_getb24, bfd_getl24): New functions.
(bfd_get_24, bfd_put_24): New macros.
* bfd-in2.h: Regenerate.

6 years agoS12Z: Remove inappropriate comment.
John Darrington [Tue, 24 Jul 2018 10:58:42 +0000 (12:58 +0200)]
S12Z: Remove inappropriate comment.

* elf32-s12z.c (s12z_elf_set_mach_from_flags): Remove comment.

6 years agoS12Z: Emit uninitialized data in the .bss segment
John Darrington [Tue, 24 Jul 2018 10:58:41 +0000 (12:58 +0200)]
S12Z: Emit uninitialized data in the .bss segment

* scripttempl/elfm9s12z.sc: Put input sections called .common
into the .bss segment.

6 years agoS12Z: Emit initialized data segment image.
John Darrington [Tue, 24 Jul 2018 10:58:40 +0000 (12:58 +0200)]
S12Z: Emit initialized data segment image.

* scripttempl/elfm9s12z.sc: Emit the data_section at the end of text.

6 years agoMIPS/GAS: Correct the AFL_ASE_MASK macro
Chenghua Xu [Fri, 27 Jul 2018 00:12:43 +0000 (01:12 +0100)]
MIPS/GAS: Correct the AFL_ASE_MASK macro

Fix an issue with commit 8095d2f70e1a ("MIPS/GAS: Split Loongson MMI
Instructions from loongson2f/3a"), AFL_ASE_MASK should be 0x0006ffff
instead of 0x0004ffff.

2018-07-27  Chenghua Xu  <paul.hua.gm@gmail.com>
            Maciej W. Rozycki  <macro@linux-mips.org>

include/
* elf/mips.h (AFL_ASE_MASK): Correct typo.

6 years agoRe: PowerPC Improve support for Gekko & Broadway
Alan Modra [Thu, 26 Jul 2018 22:49:45 +0000 (08:19 +0930)]
Re: PowerPC Improve support for Gekko & Broadway

PowerPC has replaced use of "long" for insns with "int64_t", in
preparation for 64-bit power10 insns.

* ppc-opc.c (insert_sprbat): Correct function parameter and
return type.
(extract_sprbat): Likewise, variable too.

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

6 years agoFix Cygwin compilation after target_ops C++ conversion.
Jon Turney [Sat, 14 Jul 2018 11:17:29 +0000 (12:17 +0100)]
Fix Cygwin compilation after target_ops C++ conversion.

After f6ac5f3d "Convert struct target_ops to C++", we need to explicitly use
the global namespace when calling ::close() from windows_nat_target methods,
as that object has a close() method.

gdb/ChangeLog:

2018-07-14  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (windows_nat_target::create_inferior): Update to
call close() in global namespace.

6 years agox86: Initialize broadcast_op.bytes to 0
H.J. Lu [Thu, 26 Jul 2018 15:49:12 +0000 (08:49 -0700)]
x86: Initialize broadcast_op.bytes to 0

* config/tc-i386.c (check_VecOperations): Initialize
broadcast_op.bytes to 0.