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

6 years agoMake psymbols and psymtabs independent of the program space
Tom Tromey [Thu, 3 May 2018 22:36:21 +0000 (16:36 -0600)]
Make psymbols and psymtabs independent of the program space

This patch finally makes partial symbols and partial symtabs
independent of the program space.

Specifically:

It changes add_psymbol_to_list to accept a section index, and changes
the psymbol readers to pass this.  At the same time it removes the
code to add the objfile's section offset to the psymbol.

It adds an objfile argument to the psymtab textlow and texthigh
accessors and changes some code to use the raw variants instead.

It removes the "relocate" method from struct quick_symbol_functions,
as it is no longer needed any more.

It changes partial_symbol::address so that the relevant offset is now
applied at the point of use.

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

* dwarf-index-write.c (add_address_entry): Don't add objfile
offsets.
* dbxread.c (find_stab_function): Rename from
find_stab_function_addr.  Return a bound_minimal_symbol.
(read_dbx_symtab): Use raw_text_low, raw_text_high.
Don't add objfile offsets.
(end_psymtab): Use raw_text_low, raw_text_high,
MSYMBOL_VALUE_RAW_ADDRESS.
(read_ofile_symtab): Update.
(process_one_symbol): Update.
* dwarf2read.c (create_addrmap_from_index): Don't add objfile
offsets.
(dw2_relocate): Remove.
(dw2_find_pc_sect_symtab): Bias PC by the text offset before
searching addrmap.
(dwarf2_gdb_index_functions, dwarf2_debug_names_functions):
Update.
(process_psymtab_comp_unit_reader, add_partial_symbol)
(add_partial_subprogram, dwarf2_ranges_read): Update.
(load_partial_dies): Update.
(add_address_entry): Don't add objfile offsets.
(dwarf2_build_include_psymtabs): Update.
(create_addrmap_from_aranges): Don't add objfile offsets.
(dw2_find_pc_sect_compunit_symtab): Update.
* mdebugread.c (parse_symbol): Don't add objfile offsets.
(parse_lines): Remove 'pst' parameter, replace with 'textlow'.
Update.
(parse_partial_symbols): Don't add objfile offsets.  Use
raw_text_low, raw_text_high.  Update.
(handle_psymbol_enumerators, psymtab_to_symtab_1): Update.
* objfiles.c (objfile_relocate1): Don't relocate psymtabs_addrmap
or call 'relocate' quick function.  Clear psymbol_map.
* psympriv.h (struct partial_symbol) <address>: Add section
offset.
<set_unrelocated_address>: Rename from set_address.
<raw_text_low, raw_text_high>: New methods.
<text_low, text_high>: Add objfile parameter.
(add_psymbol_to_bcache): Add 'section' parameter.  Call
set_unrelocated_address.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_psymbol): Update.
(fixup_psymbol_section, relocate_psymtabs): Remove.
(dump_psymtab, psym_functions): Update.
(add_psymbol_to_bcache, add_psymbol_to_list): Add 'section'
parameter.
(maintenance_info_psymtabs, maintenance_check_psymtabs): Update.
(start_psymtab_common): Update.
* symfile-debug.c (debug_qf_relocate): Remove.
(debug_sym_quick_functions): Update.
* symfile.h (struct quick_symbol_functions) <relocate>: Remove.
* xcoffread.c (scan_xcoff_symtab): Don't add objfile offsets.
Update.

6 years agoAdd validity bits for psymtab high and low fields
Tom Tromey [Thu, 3 May 2018 22:36:20 +0000 (16:36 -0600)]
Add validity bits for psymtab high and low fields

Right now some psymtab code checks whether a psymtab's textlow or
texthigh fields are valid by comparing against 0.

I imagine this is mildly wrong in the current environment, but once
psymtabs are relocated dynamically, it will no longer be correct,
because it will be much more normal to see a psymtab with a textlow of
zero -- this will just mean it appears at the start of the text
section.

This patch introduces validity bits to handle this situation more
nicely, and changes users of the code to follow.

gdb/ChangeLog
2018-07-26  Tom Tromey  <tromey@redhat.com>

* dbxread.c (end_psymtab): Use text_high_valid and
text_low_valid.
* mdebugread.c (parse_partial_symbols): Use text_low_valid.
(psymtab_to_symtab_1): Use text_high_valid and text_low_valid.
* psympriv.h (struct partial_symtab) <m_text_low, m_text_high>:
Update comment.
<text_low_valid, text_high_valid>: New fields.
<set_text_low, set_text_high>: Update.
* xcoffread.c (scan_xcoff_symtab): Use text_low_valid.

6 years agoIntroduce accessors for psymtab high and low fields
Tom Tromey [Thu, 3 May 2018 22:36:19 +0000 (16:36 -0600)]
Introduce accessors for psymtab high and low fields

This introduces accessors for the partial symbol table textlow and
texthigh fields.  This lets us later arrange to relocate these values
at their point of use.

I did this conversion by renaming the fields.  I didn't rename the
fields back afterward, thinking that on the off chance that someone
has a patch touching this area, then a merge would helpfully break
their compile.

I looked at making the fields private, but this interferes with the
memset in allocate_psymtab, and I didn't want to chase this down.
This conversion can be done later if need be.

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

* dbxread.c (read_dbx_symtab, end_psymtab, read_ofile_symtab):
Update.
* dwarf2read.c (dwarf2_create_include_psymtab): Don't initialize
textlow and texthigh fields.
(process_psymtab_comp_unit_reader, dwarf2_build_include_psymtabs):
Update.
* mdebugread.c (parse_lines, parse_partial_symbols)
(psymtab_to_symtab_1): Update.
* psympriv.h (struct partial_symtab) <m_text_low, m_text_high>:
Rename fields.  Update comment.  Now private.
<text_low, text_high, set_text_low, set_text_high>: New methods.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_sect_psymbol, relocate_psymtabs, dump_psymtab)
(start_psymtab_common, maintenance_info_psymtabs)
(maintenance_check_psymtabs): Update.
* xcoffread.c (xcoff_end_psymtab): Don't initialize textlow and
texthigh fields.
(scan_xcoff_symtab): Update.

6 years agoIntroduce partial_symbol::address
Tom Tromey [Thu, 3 May 2018 22:36:18 +0000 (16:36 -0600)]
Introduce partial_symbol::address

This introduces a partial_symbol::address method.  This method takes
an objfile argument.  This is necessary so that we can later relocate
a partial symbol at its point of use.  It also adds an accessor to
compute the unrelocated value; and a method to be used for setting the
field.

Note that the new method doesn't actually perform any relocation yet.
That will come in a subsequent patch.  However, the comments are
written to reflect the intended, rather than the temporary, semantics.

gdb/ChangeLog
2018-07-26  Tom Tromey  <tromey@redhat.com>

* psympriv.h (struct partial_symbol) <unrelocated_address,
address, set_address>: New methods.
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymbol)
(fixup_psymbol_section, relocate_psymtabs): Update.
(print_partial_symbols): Add 'objfile' parameter.  Update.
(dump_psymtab, add_psymbol_to_bcache, psym_fill_psymbol_map):
Update.

6 years agoChange representation of psymbol to flush out accessors
Tom Tromey [Thu, 3 May 2018 22:36:17 +0000 (16:36 -0600)]
Change representation of psymbol to flush out accessors

This is the psymbol analog to the patch to change the representation
of minimal symbols:

    https://sourceware.org/ml/gdb-patches/2013-10/msg00524.html

It has the same rationale: namely, that we're going to change the code
to apply psymbol offsets at runtime.  This will be done by adding an
argument to the SYMBOL_VALUE_ADDRESS macro -- but since we can't
convert all the symbol types at once, we need a new approach.

Because gdb now is in C++, this patch changes partial_symbol to
inherit from general_symbol_info, rather than renaming the field.
This simplifies code in some places.

Also, as noted before, these macros implement a kind of "phony
polymorphism" that is not actually useful in practice; so this patch
removes the macros in favor of simply referring directly to members.
In a few cases -- obj_section in this patch and the symbol address in
the future -- methods will be used instead.

Note that this removes the blanket memset from add_psymbol_to_bcache.
This hasn't really been needed since bcache was modified to allow
holes in objects and since psymtab took advantage of that.  This
deletion was required due to changing partial_symbol to derive from
general_symbol_info.

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

* dwarf-index-write.c (write_psymbols, debug_names::insert)
(debug_names::write_psymbols): Update.
* psympriv.h (struct partial_symbol): Derive from
general_symbol_info.
<obj_section>: New method.
(PSYMBOL_DOMAIN, PSYMBOL_CLASS): Remove.n
* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
(find_pc_sect_psymbol, fixup_psymbol_section)
(match_partial_symbol, lookup_partial_symbol, relocate_psymtabs)
(print_partial_symbols, recursively_search_psymtabs)
(compare_psymbols, psymbol_hash, psymbol_compare)
(add_psymbol_to_bcache, maintenance_check_psymtabs)
(psymbol_name_matches, psym_fill_psymbol_map): Update.

6 years agoRemove dead code in end_psymtab
Tom Tromey [Thu, 3 May 2018 22:36:16 +0000 (16:36 -0600)]
Remove dead code in end_psymtab

I noticed that there is a bit of dead code in end_psymtab.
This deletes it.

Normally I would investigate a fix for the code.  However, considering
that the code has been this way a long time (since the first import to
sourceware) and considering that dbxread.c is not as important any
more, I think it's safe to just consider that there's no bug.

gdb/ChangeLog
2018-07-26  Tom Tromey  <tromey@redhat.com>

* dbxread.c (end_psymtab): Remove dead code.

6 years ago[gdb/testsuite] Add comment in gdb.base/vla-optimized-out.c
Tom de Vries [Thu, 26 Jul 2018 08:16:06 +0000 (10:16 +0200)]
[gdb/testsuite] Add comment in gdb.base/vla-optimized-out.c

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

* gdb.base/vla-optimized-out.c: Add comment about origin of test-case.

6 years agoPowerPC Improve support for Gekko & Broadway
Alex Chadwick [Mon, 23 Jul 2018 23:51:44 +0000 (09:21 +0930)]
PowerPC Improve support for Gekko & Broadway

This is a relatively straightforward patch to improve support for the
IBM Gekko and IBM Broadway processors.  Broadway is functionally
equivalent to the IBM 750CL, while Gekko's functionality is a subset
of theirs.  The patch simplifies this reality and adds -mgekko and
-mbroadway as aliases for -m750cl.  I didn't feel it was worth wasting
a PPC_OPCODE_* bit to differentiate Gekko.  The patch adds a number of
simplified mnemonics for special purpose register access.  Notably,
Broadway adds 4 additional IBAT and DBAT registers but these are not
assigned sequential SPR numbers.

gas/
* config/tc-ppc.c (md_show_usage): Add -mgekko and -mbroadway.
* doc/as.texi (Target PowerPC options): Add -mgekko and -mbroadway.
* doc/c-ppc.texi (PowerPC-Opts): Likewise.
* testsuite/gas/ppc/broadway.d,
* testsuite/gas/ppc/broadway.s: New test for broadway.
* testsuite/gas/ppc/ppc.exp: Run new test.
include/
* opcode/ppc.h (PPC_OPCODE_750): Adjust comment.
opcodes/
* ppc-dis.c (ppc_opts): Add -mgekko and -mbroadway.
(powerpc_init_dialect): Handle bfd_mach_ppc_750.
* ppc-opc.c (insert_sprbat, extract_sprbat): New functions to
support disjointed BAT.
(powerpc_operands): Allow extra bit in SPRBAT_MASK.  Add SPRGQR.
(XSPRGQR_MASK, GEKKO, BROADWAY): Define.
(powerpc_opcodes): Add 750cl extended mnemonics for spr access.

6 years agoRe: Enhance powerpc ld -r --relax
Alan Modra [Thu, 26 Jul 2018 07:42:07 +0000 (17:12 +0930)]
Re: Enhance powerpc ld -r --relax

git commit 491993044ba6 broke the powerpc vxworks testsuite.

* testsuite/ld-powerpc/vxworks-relax-2.rd: Update for 2018-07-25
ppc_elf_relax_section changes.

6 years agogdb: Add switch to disable DWARF stack unwinders
Andrew Burgess [Fri, 13 Jul 2018 11:01:16 +0000 (12:01 +0100)]
gdb: Add switch to disable DWARF stack unwinders

Add a maintenance command to disable the DWARF stack unwinders.
Normal users would not need this feature, but it is useful to allow
extended testing of fallback stack unwinding strategies, for example,
prologue scanners.

This is a partial implementation of the idea discussed in pr gdb/8434,
which talks about a generic ability to disable any frame unwinder.

Being able to arbitrarily disable any frame unwinder would be a more
complex patch, and I was unsure how useful such a feature would really
be, however, I can see (and have) a real need to disable DWARF
unwinders.  That's why this patch only targets that specific set of
unwinders.

If in the future we find ourselves adding more switches to disable
different unwinders, then we should probably move to a more generic
solution, and remove this patch.

gdb/ChangeLog:

* dwarf2-frame-tailcall.c (tailcall_frame_sniffer): Exit early if
DWARF unwinders are disabled.
* dwarf2-frame.c: Add dwarf2read.h include.
(dwarf2_frame_sniffer): Exit early if DWARF unwinders are
disabled.
(dwarf2_frame_unwinders_enabled_p): Define.
(show_dwarf_unwinders_enabled_p): New function.
(_initialize_dwarf2_frame): Register switch to control DWARF
unwinder use.
* dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Declare.
* dwarf2read.c (set_dwarf_cmdlist): Remove static keyword.
(show_dwarf_cmdlist): Remove static keyword.
* dwarf2read.h (set_dwarf_cmdlist): Declare.
(show_dwarf_cmdlist): Declare.
* NEWS: Document new feature.

gdb/doc/ChangeLog:

* gdb.texinfo (Maintenance Commands): Add description of
maintenance command to control dwarf unwinders.

gdb/testsuite/ChangeLog:

* gdb.base/maint.exp: Add check that dwarf unwinders control flag
is visible.

6 years agoImplement PowerPC64 .localentry for value 1
Alan Modra [Thu, 26 Jul 2018 02:41:11 +0000 (12:11 +0930)]
Implement PowerPC64 .localentry for value 1

This adds support for ".localentry 1", a new st_other
STO_PPC64_LOCAL_MASK encoding that signifies a function with a single
entry point like ".localentry 0", but unlike a ".localentry 0"
function does not preserve r2.

include/
* elf/ppc64.h: Specify byte offset to local entry for values
of two to six in STO_PPC64_LOCAL_MASK.  Clarify r2 return
value for such functions when entering via global entry point.
Specify meaning of a value of one in STO_PPC64_LOCAL_MASK.
bfd/
* elf64-ppc.c (ppc64_elf_size_stubs): Use a ppc_stub_long_branch_r2off
for calls to symbols with STO_PPC64_LOCAL_MASK bits set to 1.
gas/
* config/tc-ppc.c (ppc_elf_localentry): Allow .localentry values
of 1 and 7 to directly set value into STO_PPC64_LOCAL_MASK bits.
ld/testsuite/
* ld-powerpc/elfv2.s: Add .localentry f5,1 testcase.
* ld-powerpc/elfv2exe.d: Update.
* ld-powerpc/elfv2so.d: Update.

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

6 years ago[gdb/breakpoints] Fix sigsegv in info prog at exec catchpoint
Tom de Vries [Tue, 3 Jul 2018 15:08:42 +0000 (17:08 +0200)]
[gdb/breakpoints] Fix sigsegv in info prog at exec catchpoint

With the test-case contained in this patch and compiled for debug we run into
a segfault with trunk gdb:
...
$ gdb catch-follow-exec -batch -ex "catch exec" \
  -ex "set follow-exec-mode new" -ex "run" -ex "info prog"
Catchpoint 1 (exec)
process xxx is executing new program: /usr/bin/ls
[New inferior 2 (process 0)]
[New process xxx]

Thread 2.1 "ls" hit Catchpoint 1 (exec'd /usr/bin/ls), in _start () from
  /lib64/ld-linux-x86-64.so.2
Segmentation fault (core dumped)
...

The patch fixes the segfault by returning an error in info_program_command
if get_last_target_status returns minus_one_ptid.

The test-case is non-standard, because the standard approach runs into
PR23368, a problem with gdb going to the background.

Build and reg-tested on x86_64-linux.

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

PR breakpoints/23366
* infcmd.c (info_program_command): Handle ptid == minus_one_ptid.

* gdb.base/catch-follow-exec.c: New test.
* gdb.base/catch-follow-exec.exp: New file.

6 years agox86: Expand Broadcast to 3 bits
H.J. Lu [Wed, 25 Jul 2018 22:28:07 +0000 (15:28 -0700)]
x86: Expand Broadcast to 3 bits

Expand Broadcast to 3 bits so that the number of bytes to broadcast
can be computed as 1 << (Broadcast - 1).  Use it to simplify x86
assembler.

gas/

* config/tc-i386.c (Broadcast_Operation): Add bytes.
(build_evex_prefix): Use i.broadcast->bytes.
(match_broadcast_size): New function.
(check_VecOperands): Use the broadcast field to compute the
number of bytes to broadcast directly.  Set i.broadcast->bytes.
Use match_broadcast_size.

opcodes/

* i386-gen.c (adjust_broadcast_modifier): New function.
(process_i386_opcode_modifier): Add an argument for operands.
Adjust the Broadcast value based on operands.
(output_i386_opcode): Pass operand_types to
process_i386_opcode_modifier.
(process_i386_opcodes): Pass NULL as operands to
process_i386_opcode_modifier.
* i386-opc.h (BYTE_BROADCAST): New.
(WORD_BROADCAST): Likewise.
(DWORD_BROADCAST): Likewise.
(QWORD_BROADCAST): Likewise.
(i386_opcode_modifier): Expand broadcast to 3 bits.
* i386-tbl.h: Regenerated.

6 years ago[gdb/symtab] Warn about unresolved DW_AT_upper_bound/DW_AT_count
Tom de Vries [Wed, 18 Jul 2018 16:33:07 +0000 (18:33 +0200)]
[gdb/symtab] Warn about unresolved DW_AT_upper_bound/DW_AT_count

This patch generates a warning if DW_AT_upper_bound or DW_AT_count is defined,
but can't be translated.  This is triggered for current gcc in lto mode for
vla test-cases.

Build and reg-tested on x86_64-linux.

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

* dwarf2read.c (read_subrange_type): Warn if DW_AT_upper_bound or
DW_AT_count can't be translated to a dynamic prop.

6 years ago[gdb/exp] Fix exception when printing optimized out vla
Tom de Vries [Fri, 20 Jul 2018 14:41:00 +0000 (16:41 +0200)]
[gdb/exp] Fix exception when printing optimized out vla

When compiling vla-optimized-out.c with -O3 and a recent gcc, and trying to
print the vla a in f1, we run into this gdb exception:
...
Cannot find matching parameter at DW_TAG_call_site 0x4003be at main
...

This is a regression introduced by 42dc7699a2 "[gdb/exp] Fix printing of type
of optimized out vla".

This patch fixes the regression by wrapping the ctx.eval call in
dwarf2_locexpr_baton_eval in try/catch, similar to what is done in
dwarf2_evaluate_loc_desc_full.

Build and reg-tested on x86_64-linux.

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

* dwarf2loc.c (dwarf2_locexpr_baton_eval): Wrap ctx.eval call in
try/catch.

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

6 years agoNotify about breakpoint modification when enabling/disabling single location
Jan Vrany [Thu, 31 May 2018 08:56:33 +0000 (09:56 +0100)]
Notify about breakpoint modification when enabling/disabling single location

When a single breakpoint location enableness was modified by a CLI
command, observers were not notified about it. This issue is now fixed.

gdb/ChangeLog:

* breakpoint.c (enable_disable_bp_num_loc): Notify observers.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-breakpoint-location-ena-dis.cc: New file.
* gdb.mi/mi-breakpoint-location-ena-dis.exp: New file.