external/binutils.git
6 years agoAdd a check for a NULL table pointer before attempting to compute a DWARF filename.
Nick Clifton [Tue, 17 Apr 2018 13:30:07 +0000 (14:30 +0100)]
Add a check for a NULL table pointer before attempting to compute a DWARF filename.

PR 23065
* dwarf2.c (concat_filename): Check for a NULL table pointer.

6 years agoResync libiberty sources with master version in GCC repository.
Nick Clifton [Tue, 17 Apr 2018 12:53:38 +0000 (13:53 +0100)]
Resync libiberty sources with master version in GCC repository.

2018-04-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

PR lto/81968
* simple-object.c (handle_lto_debug_sections): Keep .comment
section.

2018-03-02  David Malcolm  <dmalcolm@redhat.com>

* cp-demangle.c: Update URL for g++ V3 ABI.

2018-01-20  Eli Zaretskii  <eliz@gnu.org>

* simple-object-xcoff.c (simple_object_xcoff_find_sections): Use
ulong_type to avoid warning about 32-bit shift.

2018-01-11  Richard Biener  <rguenther@suse.de>
Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

PR lto/81968
* simple-object-common.h (struct simple_object_functions):
Change copy_lto_debug_sections callback signature.
* simple-object-elf.c (SHN_HIRESERVE, SHT_SYMTAB_SHNDX,
SHF_INFO_LINK): Add defines.
(simple_object_elf_copy_lto_debug_sections): Instead of
leaving not to be copied sections empty unnamed SHT_NULL
remove them from the target section headers and adjust section
reference everywhere.  Handle SHN_XINDEX in the symbol table
processing properly.
* simple-object.c (handle_lto_debug_sections): Change
interface to return a modified string and handle renaming
of relocation sections.

2018-01-10  Daniel van Gerpen  <daniel@vangerpen.de>

* argv.c (expandargv): Correct check for dynamically
allocated argv.

6 years agoFix tests to avoid cldemote encoding.
Igor Tsimbalist [Tue, 17 Apr 2018 11:57:34 +0000 (13:57 +0200)]
Fix tests to avoid cldemote encoding.

gas/
* testsuite/gas/i386/nops.s: Revert back deleted lines and
change encoding to 0x0f1c /1 to map to NOP.
* testsuite/gas/i386/x86-64-nops.s: Likewise.
* testsuite/gas/i386/nops.d: Likewise.
* testsuite/gas/i386/x86-64-nops.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops.d: Likewis.

6 years agoFix illegal memory access when parsing corrupt DWARF information.
Nick Clifton [Tue, 17 Apr 2018 11:35:55 +0000 (12:35 +0100)]
Fix illegal memory access when parsing corrupt DWARF information.

PR 23064
* dwarf.c (process_cu_tu_index): Test for a potential buffer
overrun before copying signature pointer.

6 years agoEnable Intel CLDEMOTE instruction.
Igor Tsimbalist [Mon, 16 Apr 2018 21:09:01 +0000 (23:09 +0200)]
Enable Intel CLDEMOTE instruction.

gas/
* config/tc-i386.c (cpu_arch): Add .cldemote.
* doc/c-i386.texi: Document cldemote/.cldemote.
* testsuite/gas/i386/cldemote-intel.d: New.
* testsuite/gas/i386/cldemote.d: Likewise.
* testsuite/gas/i386/cldemote.s: Likewise.
* testsuite/gas/i386/i386.exp: Run new tests.
* testsuite/gas/i386/x86-64-cldemote-intel.d: New.
* testsuite/gas/i386/x86-64-cldemote.d: Likewise.
* testsuite/gas/i386/x86-64-cldemote.s: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops.d: Remove 0x0f1c
NOP encoding that maps to cldemote.
* testsuite/gas/i386/nops.d: Likewise.
* testsuite/gas/i386/nops.s: Likewise.
* testsuite/gas/i386/x86-64-nops.d: Likewise.
* testsuite/gas/i386/x86-64-nops.s: Likewise.

opcode/
* i386-dis.c: Add REG_0F1C_MOD_0, MOD_0F1C_PREFIX_0,
PREFIX_0F1C.
* i386-gen.c (cpu_flag_init): Add CPU_CLDEMOTE_FLAGS,
(cpu_flags): Add CpuCLDEMOTE.
* i386-init.h: Regenerate.
* i386-opc.h (enum): Add CpuCLDEMOTE,
(i386_cpu_flags): Add cpucldemote.
* i386-opc.tbl: Add cldemote.
* i386-tbl.h: Regenerate.

6 years agoReinstate readelf decoding of i860, i960 and i370 relocs
Alan Modra [Mon, 16 Apr 2018 23:30:57 +0000 (09:00 +0930)]
Reinstate readelf decoding of i860, i960 and i370 relocs

include/
* elf/i370.h: Revert removal.
* elf/i860.h: Likewise.
* elf/i960.h: Likewise.
binutils
* readelf.c: Revert 2018-04-16 and 2018-04-11 changes.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 17 Apr 2018 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agolinux_spu_make_corefile_notes: return note_data instead of nullptr
Simon Marchi [Mon, 16 Apr 2018 20:47:06 +0000 (16:47 -0400)]
linux_spu_make_corefile_notes: return note_data instead of nullptr

Since commit

  9018be2 ("Make target_read_alloc & al return vectors")

the test gdb.threads/gcore-stale-thread.exp test results in UNSUPPORTED:

  UNSUPPORTED: gdb.threads/gcore-stale-thread.exp: save a corefile

The problem is that the linux_spu_make_corefile_notes started returning
nullptr when reading TARGET_OBJECT_SPU fails.  The previous (and proper)
behaviour is to return the note_data received as a parameter, so that
other functions may continue to append to this buffer.

With this patch, the test goes back to PASS.

gdb/ChangeLog:

* linux-tdep.c (linux_spu_make_corefile_notes): Return note_data
instead of nullptr.

6 years agoAdjust more test cases to changed output of info var/func/type
Andreas Arnez [Mon, 16 Apr 2018 18:58:14 +0000 (20:58 +0200)]
Adjust more test cases to changed output of info var/func/type

After this commit:

  b744723f57 -- Show line numbers in output for "info var/func/type"

the test cases dbx.exp and info-fun.exp yield new FAILs because two
regular expressions have not been adjusted to the changed output yet.
This is fixed.

gdb/testsuite/ChangeLog:

* gdb.base/dbx.exp (test_whereis): Adjust regexp to added line
number information in output of "whereis" command.
* gdb.base/info-fun.exp: Likewise, for "info fun" command.

6 years agoFix illegal memory accesses in the assembler when attempting to parse corrup tinput...
Nick Clifton [Mon, 16 Apr 2018 15:39:15 +0000 (16:39 +0100)]
Fix illegal memory accesses in the assembler when attempting to parse corrup tinput files.

PR 23054
* cond.c (s_ifsef): Replace use of obstack_copy with obstack_alloc
followed by memcpy.
(s_if, s_ifb, s_ifc, s_ifeqs): Likewise.
* obj-elf.c (elf_adjust_symtab): Check for local symbols before
attempting to dereference the sy_next field of a symbol.
* stabs.c (get_stab_string_offset): Fail if there is no string
following the stab directive.

6 years agoRemove sunos.em
Alan Modra [Mon, 16 Apr 2018 12:45:14 +0000 (22:15 +0930)]
Remove sunos.em

Should have been removed with the m68k and sparc aout targets.

* emultempl/sunos.em: Delete.

6 years agoFix i960 machine name
Alan Modra [Mon, 16 Apr 2018 13:51:58 +0000 (23:21 +0930)]
Fix i960 machine name

* readelf.c (get_machine_name): Correct typo.

6 years agogdb: Remove support for SH-5/SH64
Pedro Alves [Mon, 16 Apr 2018 11:50:03 +0000 (12:50 +0100)]
gdb: Remove support for SH-5/SH64

Since bfd dropped support for SH-5, there's no point in keeping it in
GDB either.

This restores --enable-targets=all builds.

gdb/ChangeLog:
2018-04-16  Pedro Alves  <palves@redhat.com>

* MAINTAINERS (sh): Remove.
* Makefile.in (ALL_TARGET_OBS): Remove sh64-tdep.o.
(HFILES_NO_SRCDIR): Remove sh64-tdep.h.
(ALLDEPFILES): Remove sh64-tdep.c.
* NEWS: Mentions that support for SH-5/SH64 is removed.
* configure.tgt (sh*-*-linux*): Remove reference to sh64-tdep.o.
(sh*-*-openbsd*): Ditto.
(sh64-*-elf*): Remove.
(sh*): Remove.
* regcache.c (cooked_write_test): Remove bfd_mach_sh5 case.
* sh-linux-tdep.c: Remove reference to bfd_mach_sh5.
* sh-tdep.c: No longer include "sh64-tdep.h".
(sh_gdbarch_init): Remove reference to bfd_mach_sh5.
* sh64-tdep.c, sh64-tdep.h: Remove files.

6 years agogdb: Remove OpenBSD/m88k support
Pedro Alves [Mon, 16 Apr 2018 12:16:22 +0000 (13:16 +0100)]
gdb: Remove OpenBSD/m88k support

Support for m88k was fully removed from bfd, which broke gdb
--enable-targets=all builds:

  > gdb/m88k-tdep.c: In function void _initialize_m88k_tdep():
  > gdb/m88k-tdep.c:867:21: error: bfd_arch_m88k was not declared in this scope
  >    gdbarch_register (bfd_arch_m88k, m88k_gdbarch_init, NULL);

There's no point in keeping GDB support for OpenBSD/m88k with no bfd
support, so this commit simply removes the port.

gdb/ChangeLog:
2018-04-16  Pedro Alves  <palves@redhat.com>

* MAINTAINERS: Remove m88k.
* Makefile.in (ALL_TARGET_OBS): Remove m88k-tdep.o.
(HFILES_NO_SRCDIR): Remove m88k-tdep.h.
(ALLDEPFILES): Remove m88k-bsd-nat.c and m88k-tdep.c.
* NEWS: Mention that support for OpenBSD/m88k was removed.
* configure.host (m88*-*-*): Remove support.
* configure.nat (m88k-*-*): Remove support.
* configure.tgt (m88*-*-openbsd*): Remove.
* m88k-bsd-nat.c, m88k-tdep.c, m88k-tdep.h: Delete.

6 years agoPrevent an illegal memory access via an out of range fixup pointer.
Nick Clifton [Mon, 16 Apr 2018 11:59:37 +0000 (12:59 +0100)]
Prevent an illegal memory access via an out of range fixup pointer.

PR 23061
* coffgen.c (coff_pointerize_aux): Check for an out of range
fixup.

6 years agoRemove arm-epoc-pe support
Alan Modra [Mon, 16 Apr 2018 10:59:05 +0000 (20:29 +0930)]
Remove arm-epoc-pe support

bfd/
* Makefile.am: Remove arm-epoc-pe support.
* coff-arm.c: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* epoc-pe-arm.c: Delete.
* epoc-pei-arm.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* configure.ac: Remove arm-epoc-pe support.
* dlltool.c: Likewise.
* configure: Regenerate.
gas/
* Makefile.am: Remove arm-epoc-pe support.
* config/tc-arm.h: Likewise.
* configure.tgt: Likewise.
* testsuite/gas/all/gas.exp: Likewise.
* testsuite/gas/arm/local_label_coff.d: Likewise.
* testsuite/gas/arm/undefined.d: Likewise.
* testsuite/gas/arm/undefined_coff.d: Likewise.
* config/te-epoc-pe.h: Delete.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* Makefile.am: Remove arm-epoc-pe support.
* configure.tgt: Likewise.
* emultempl/pe.em: Likewise.
* pe-dll.c: Likewise.
* testsuite/ld-scripts/fill.d: Likewise.
* testsuite/ld-scripts/fill16.d: Likewise.
* emulparams/arm_epoc_pe.sh: Delete.
* scripttempl/epocpe.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agosparc-coff removal leftover
Alan Modra [Mon, 16 Apr 2018 10:55:42 +0000 (20:25 +0930)]
sparc-coff removal leftover

* coff/sparc.h: Delete.

6 years agoRemove sparc-aout and sparc-coff support
Alan Modra [Mon, 16 Apr 2018 06:03:26 +0000 (15:33 +0930)]
Remove sparc-aout and sparc-coff support

bfd/
* Makefile.am: Remove sparc-aout and sparc-coff support.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* aout-sparcle.c: Delete.
* aoutf1.h: Delete.
* cf-sparclynx.c: Delete.
* coff-sparc.c: Delete.
* demo64.c: Delete.
* sparclinux.c: Delete.
* sparclynx.c: Delete.
* sparcnetbsd.c: Delete.
* sunos.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* testsuite/lib/binutils-common.exp: Remove sparc-aout and
sparc-coff support.
gas/
* Makefile.am: Remove sparc-aout and sparc-coff support.
* config/obj-coff.h: Likewise.
* config/tc-sparc.c: Likewise.
* config/tc-sparc.h: Likewise.
* configure.tgt: Likewise.
* config/te-sparcaout.h: Delete.
* testsuite/gas/sun4/addend.d: Delete.
* testsuite/gas/sun4/addend.exp: Delete.
* testsuite/gas/sun4/addend.s: Delete.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* Makefile.am: Remove sparc-aout and sparc-coff support.
* configure.tgt: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-shared/shared.exp: Likewise.
* emulparams/coff_sparc.sh: Delete.
* emulparams/sparcaout.sh: Delete.
* emulparams/sparclinux.sh: Delete.
* emulparams/sparcnbsd.sh: Delete.
* emulparams/sun4.sh: Delete.
* scripttempl/sparccoff.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove m68k-aout and m68k-coff support
Alan Modra [Mon, 16 Apr 2018 06:01:36 +0000 (15:31 +0930)]
Remove m68k-aout and m68k-coff support

include/
* aout/host.h: Remove m68k-aout and m68k-coff support.
* aout/hp300hpux.h: Delete.
* coff/apollo.h: Delete.
* coff/aux-coff.h: Delete.
* coff/m68k.h: Delete.
bfd/
* Makefile.am: Remove m68k-aout and m68k-coff support.
* aoutf1.h: Likewise.
* aoutx.h: Likewise.
* archive.c: Likewise.
* bfd-in.h: Likewise.
* bfd.c: Likewise.
* coffcode.h: Likewise.
* coffswap.h: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* configure.host: Likewise.
* doc/bfd.texinfo: Likewise.
* doc/bfdint.texi: Likewise.
* freebsd.h: Likewise.
* gen-aout.c: Likewise.
* hpux-core.c: Likewise.
* libaout.h: Likewise.
* libbfd-in.h: Likewise.
* pdp11.c: Likewise.
* peicode.h: Likewise.
* riscix.c: Likewise.
* targets.c: Likewise.
* aout0.c: Delete.
* coff-apollo.c: Delete.
* coff-aux.c: Delete.
* coff-m68k.c: Delete.
* coff-svm68k.c: Delete.
* coff-u68k.c: Delete.
* hosts/delta68.h: Delete.
* hosts/hp300bsd.h: Delete.
* hosts/m68kaux.h: Delete.
* hosts/news.h: Delete.
* hp300bsd.c: Delete.
* hp300hpux.c: Delete.
* liboasys.h: Delete.
* m68k4knetbsd.c: Delete.
* m68klinux.c: Delete.
* m68knetbsd.c: Delete.
* oasys.c: Delete.
* versados.c: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* libbfd.h: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* testsuite/binutils-all/copy-2.d: Remove m68k-aout and m68k-coff
support.
* testsuite/binutils-all/copy-3.d: Likewise.
* testsuite/binutils-all/objcopy.exp: Likewise.
* testsuite/lib/binutils-common.exp: Likewise.
gas/
* Makefile.am: Remove m68k-aout and m68k-coff support.
* config/tc-m68k.c: Likewise.
* config/tc-m68k.h: Likewise.
* configure.ac: Likewise.
* configure.tgt: Likewise.
* testsuite/gas/all/weakref1u.d: Likewise.
* testsuite/gas/m68k/all.exp: Likewise.
* testsuite/gas/m68k/br-isaa.d: Likewise.
* testsuite/gas/m68k/br-isab.d: Likewise.
* testsuite/gas/m68k/br-isac.d: Likewise.
* config/te-psos.h: Delete.
* config/te-sun3.h: Delete.
* testsuite/gas/m68k-coff/gas.exp: Delete.
* testsuite/gas/m68k-coff/p2389.s: Delete.
* testsuite/gas/m68k-coff/p2389a.s: Delete.
* testsuite/gas/m68k-coff/p2430.s: Delete.
* testsuite/gas/m68k-coff/p2430a.s: Delete.
* testsuite/gas/m68k-coff/t1.s: Delete.
* testsuite/gas/m68k/p3041.d: Delete.
* testsuite/gas/m68k/p3041.s: Delete.
* testsuite/gas/m68k/p3041data.d: Delete.
* testsuite/gas/m68k/p3041data.s: Delete.
* testsuite/gas/m68k/p3041pcrel.d: Delete.
* testsuite/gas/m68k/p3041pcrel.s: Delete.
* testsuite/gas/m68k/t2.d: Delete.
* Makefile.in: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* Makefile.am: Remove m68k-aout and m68k-coff support.
* configure.tgt: Likewise.
* emultempl/m68kelf.em: Likewise.
* ld.texinfo: Likewise.
* mri.c: Likewise.
* emulparams/delta68.sh: Delete.
* emulparams/hp300bsd.sh: Delete.
* emulparams/hp3hpux.sh: Delete.
* emulparams/m68k4knbsd.sh: Delete.
* emulparams/m68kaout.sh: Delete.
* emulparams/m68kaux.sh: Delete.
* emulparams/m68kcoff.sh: Delete.
* emulparams/m68klinux.sh: Delete.
* emulparams/m68knbsd.sh: Delete.
* emulparams/m68kpsos.sh: Delete.
* emulparams/sun3.sh: Delete.
* emultempl/m68kcoff.em: Delete.
* scripttempl/delta68.sc: Delete.
* scripttempl/m68kaux.sc: Delete.
* scripttempl/m68kcoff.sc: Delete.
* scripttempl/psos.sc: Delete.
* testsuite/ld-versados/t1-1.ro: Delete.
* testsuite/ld-versados/t1-2.ro: Delete.
* testsuite/ld-versados/t1.ld: Delete.
* testsuite/ld-versados/t1.ook: Delete.
* testsuite/ld-versados/t2-1.ro: Delete.
* testsuite/ld-versados/t2-2.ro: Delete.
* testsuite/ld-versados/t2-3.ro: Delete.
* testsuite/ld-versados/t2.ld: Delete.
* testsuite/ld-versados/t2.ook: Delete.
* testsuite/ld-versados/versados.exp: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove sh5 and sh64 support
Alan Modra [Mon, 16 Apr 2018 05:59:39 +0000 (15:29 +0930)]
Remove sh5 and sh64 support

include/
* dis-asm.h: Remove sh5 and sh64 support.
bfd/
* Makefile.am: Remove sh5 and sh64 support.
* archures.c: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* cpu-sh.c: Likewise.
* elf32-sh-relocs.h: Likewise.
* elf32-sh.c: Likewise.
* targets.c: Likewise.
* elf32-sh64-com.c: Delete.
* elf32-sh64.c: Delete.
* elf32-sh64.h: Delete.
* elf64-sh64.c: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* Makefile.am: Remove sh5 and sh64 support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* sh-dis.c: Likewise.
* sh64-dis.c: Delete.
* sh64-opc.c: Delete.
* sh64-opc.h: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
bintuils/
* testsuite/binutils-all/objcopy.exp: Remove sh5 and sh64 support.
gas/
* Makefile.am: Remove sh5 and sh64 support.
* config/tc-sh.c: Likewise.
* configure.tgt: Likewise.
* doc/Makefile.am: Likewise.
* doc/as.texinfo: Likewise.
* testsuite/gas/cfi/cfi.exp: Likewise.
* testsuite/gas/sh/basic.exp: Likewise.
* config/tc-sh64.c: Delete.
* config/tc-sh64.h: Delete.
* doc/c-sh64.texi: Delete.
* testsuite/gas/sh/sh64/abi-32.d: Delete.
* testsuite/gas/sh/sh64/abi-32.s: Delete.
* testsuite/gas/sh/sh64/abi-64.d: Delete.
* testsuite/gas/sh/sh64/abi-64.s: Delete.
* testsuite/gas/sh/sh64/basic-1.d: Delete.
* testsuite/gas/sh/sh64/basic-1.s: Delete.
* testsuite/gas/sh/sh64/case-1.d: Delete.
* testsuite/gas/sh/sh64/case-1.s: Delete.
* testsuite/gas/sh/sh64/case-noexp-1.d: Delete.
* testsuite/gas/sh/sh64/crange1-1.d: Delete.
* testsuite/gas/sh/sh64/crange1-2.d: Delete.
* testsuite/gas/sh/sh64/crange1.s: Delete.
* testsuite/gas/sh/sh64/crange2-1.d: Delete.
* testsuite/gas/sh/sh64/crange2-2.d: Delete.
* testsuite/gas/sh/sh64/crange2-noexp-1.d: Delete.
* testsuite/gas/sh/sh64/crange2.s: Delete.
* testsuite/gas/sh/sh64/crange3-1.d: Delete.
* testsuite/gas/sh/sh64/crange3.s: Delete.
* testsuite/gas/sh/sh64/crange4-1.d: Delete.
* testsuite/gas/sh/sh64/crange4.s: Delete.
* testsuite/gas/sh/sh64/crange5-1.d: Delete.
* testsuite/gas/sh/sh64/crange5.s: Delete.
* testsuite/gas/sh/sh64/creg-1.d: Delete.
* testsuite/gas/sh/sh64/creg-1.s: Delete.
* testsuite/gas/sh/sh64/creg-2.d: Delete.
* testsuite/gas/sh/sh64/creg-2.s: Delete.
* testsuite/gas/sh/sh64/datal-1.s: Delete.
* testsuite/gas/sh/sh64/datal-2.d: Delete.
* testsuite/gas/sh/sh64/datal-2.s: Delete.
* testsuite/gas/sh/sh64/datal-3.s: Delete.
* testsuite/gas/sh/sh64/datal32-1.d: Delete.
* testsuite/gas/sh/sh64/datal32-3.d: Delete.
* testsuite/gas/sh/sh64/datal64-1.d: Delete.
* testsuite/gas/sh/sh64/datal64-3.d: Delete.
* testsuite/gas/sh/sh64/eh-1.d: Delete.
* testsuite/gas/sh/sh64/eh-1.s: Delete.
* testsuite/gas/sh/sh64/endian-1.d: Delete.
* testsuite/gas/sh/sh64/endian-1.s: Delete.
* testsuite/gas/sh/sh64/endian-2.d: Delete.
* testsuite/gas/sh/sh64/endian-2.s: Delete.
* testsuite/gas/sh/sh64/err-1.s: Delete.
* testsuite/gas/sh/sh64/err-2.s: Delete.
* testsuite/gas/sh/sh64/err-3.s: Delete.
* testsuite/gas/sh/sh64/err-4.s: Delete.
* testsuite/gas/sh/sh64/err-abi-32.s: Delete.
* testsuite/gas/sh/sh64/err-abi-64.s: Delete.
* testsuite/gas/sh/sh64/err-dsp.s: Delete.
* testsuite/gas/sh/sh64/err-movi-noexp-1.s: Delete.
* testsuite/gas/sh/sh64/err-noexp-cmd1.s: Delete.
* testsuite/gas/sh/sh64/err-pt-1.s: Delete.
* testsuite/gas/sh/sh64/err-pt32-cmd1.s: Delete.
* testsuite/gas/sh/sh64/err-pt32-cmd2.s: Delete.
* testsuite/gas/sh/sh64/err-pt32-cmd3.s: Delete.
* testsuite/gas/sh/sh64/err-ptb-1.s: Delete.
* testsuite/gas/sh/sh64/err-ptb-2.s: Delete.
* testsuite/gas/sh/sh64/err.exp: Delete.
* testsuite/gas/sh/sh64/immexpr1.s: Delete.
* testsuite/gas/sh/sh64/immexpr2.s: Delete.
* testsuite/gas/sh/sh64/immexpr32-1.d: Delete.
* testsuite/gas/sh/sh64/immexpr32-2.d: Delete.
* testsuite/gas/sh/sh64/immexpr64-1.d: Delete.
* testsuite/gas/sh/sh64/immexpr64-2.d: Delete.
* testsuite/gas/sh/sh64/lineno.d: Delete.
* testsuite/gas/sh/sh64/lineno.s: Delete.
* testsuite/gas/sh/sh64/localcom-1.d: Delete.
* testsuite/gas/sh/sh64/localcom-1.s: Delete.
* testsuite/gas/sh/sh64/mix-1.d: Delete.
* testsuite/gas/sh/sh64/mix-1.s: Delete.
* testsuite/gas/sh/sh64/mix-noexp-1.d: Delete.
* testsuite/gas/sh/sh64/movi-1.s: Delete.
* testsuite/gas/sh/sh64/movi-2.s: Delete.
* testsuite/gas/sh/sh64/movi-3.d: Delete.
* testsuite/gas/sh/sh64/movi-3.s: Delete.
* testsuite/gas/sh/sh64/movi32-1.d: Delete.
* testsuite/gas/sh/sh64/movi32-2.d: Delete.
* testsuite/gas/sh/sh64/movi32-noexp-2.d: Delete.
* testsuite/gas/sh/sh64/movi64-1.d: Delete.
* testsuite/gas/sh/sh64/movi64-2.d: Delete.
* testsuite/gas/sh/sh64/movi64-2.s: Delete.
* testsuite/gas/sh/sh64/movi64-3.d: Delete.
* testsuite/gas/sh/sh64/movi64-noexp-2.d: Delete.
* testsuite/gas/sh/sh64/pt-1.d: Delete.
* testsuite/gas/sh/sh64/pt-1.s: Delete.
* testsuite/gas/sh/sh64/pt-2.s: Delete.
* testsuite/gas/sh/sh64/pt-noexp-1.d: Delete.
* testsuite/gas/sh/sh64/pt32-1.d: Delete.
* testsuite/gas/sh/sh64/pt32-noexp-2.d: Delete.
* testsuite/gas/sh/sh64/pt64-1.d: Delete.
* testsuite/gas/sh/sh64/pt64-32-1.d: Delete.
* testsuite/gas/sh/sh64/pt64-32-2.d: Delete.
* testsuite/gas/sh/sh64/pt64-noexp-2.d: Delete.
* testsuite/gas/sh/sh64/ptc-1.s: Delete.
* testsuite/gas/sh/sh64/ptc32-1.d: Delete.
* testsuite/gas/sh/sh64/ptc32-noexp-1.d: Delete.
* testsuite/gas/sh/sh64/ptc64-1.d: Delete.
* testsuite/gas/sh/sh64/ptc64-32-1.d: Delete.
* testsuite/gas/sh/sh64/ptc64-noexp-1.d: Delete.
* testsuite/gas/sh/sh64/ptext-1.s: Delete.
* testsuite/gas/sh/sh64/ptext32-1.d: Delete.
* testsuite/gas/sh/sh64/ptext32-noexp-1.d: Delete.
* testsuite/gas/sh/sh64/ptext64-1.d: Delete.
* testsuite/gas/sh/sh64/ptext64-32-1.d: Delete.
* testsuite/gas/sh/sh64/ptext64-noexp-1.d: Delete.
* testsuite/gas/sh/sh64/rel-1.s: Delete.
* testsuite/gas/sh/sh64/rel-2.s: Delete.
* testsuite/gas/sh/sh64/rel-3.s: Delete.
* testsuite/gas/sh/sh64/rel-4.s: Delete.
* testsuite/gas/sh/sh64/rel-5.s: Delete.
* testsuite/gas/sh/sh64/rel32-1.d: Delete.
* testsuite/gas/sh/sh64/rel32-2.d: Delete.
* testsuite/gas/sh/sh64/rel32-3.d: Delete.
* testsuite/gas/sh/sh64/rel32-4.d: Delete.
* testsuite/gas/sh/sh64/rel32-5.d: Delete.
* testsuite/gas/sh/sh64/rel64-1.d: Delete.
* testsuite/gas/sh/sh64/rel64-2.d: Delete.
* testsuite/gas/sh/sh64/rel64-3.d: Delete.
* testsuite/gas/sh/sh64/rel64-4.d: Delete.
* testsuite/gas/sh/sh64/rel64-5.d: Delete.
* testsuite/gas/sh/sh64/relax-1.d: Delete.
* testsuite/gas/sh/sh64/relax-1.s: Delete.
* testsuite/gas/sh/sh64/relax-2.d: Delete.
* testsuite/gas/sh/sh64/relax-2.s: Delete.
* testsuite/gas/sh/sh64/relax-3.d: Delete.
* testsuite/gas/sh/sh64/relax-3.s: Delete.
* testsuite/gas/sh/sh64/sh64.exp: Delete.
* testsuite/gas/sh/sh64/shift-1.s: Delete.
* testsuite/gas/sh/sh64/shift-2.s: Delete.
* testsuite/gas/sh/sh64/shift-3.s: Delete.
* testsuite/gas/sh/sh64/shift32-1.d: Delete.
* testsuite/gas/sh/sh64/shift32-3.d: Delete.
* testsuite/gas/sh/sh64/shift32-noexp-3.d: Delete.
* testsuite/gas/sh/sh64/shift64-1.d: Delete.
* testsuite/gas/sh/sh64/shift64-2.d: Delete.
* testsuite/gas/sh/sh64/shift64-3.d: Delete.
* testsuite/gas/sh/sh64/shift64-noexp-3.d: Delete.
* testsuite/gas/sh/sh64/syntax-1.d: Delete.
* testsuite/gas/sh/sh64/syntax-1.s: Delete.
* testsuite/gas/sh/sh64/syntax-2.d: Delete.
* testsuite/gas/sh/sh64/syntax-2.s: Delete.
* testsuite/gas/sh/sh64/ua-1.s: Delete.
* testsuite/gas/sh/sh64/ua32-1.d: Delete.
* testsuite/gas/sh/sh64/ua64-1.d: Delete.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* Makefile.am: Remove sh5 and sh64 support.
* configure.tgt: Likewise.
* ldlang.c: Likewise.
* testsuite/ld-elfcomm/elfcomm.exp: Likewise.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-gc/pr13683.d: Likewise.
* testsuite/ld-scripts/crossref.exp: Likewise.
* testsuite/ld-selective/selective.exp: Likewise.
* testsuite/ld-sh/ld-r-1.d: Likewise.
* testsuite/ld-sh/rd-sh.exp: Likewise.
* testsuite/ld-sh/sh.exp: Likewise.
* testsuite/ld-srec/srec.exp: Likewise.
* testsuite/ld-undefined/undefined.exp: Likewise.
* emulparams/shelf32.sh: Delete.
* emulparams/shelf32_linux.sh: Delete.
* emulparams/shelf32_nbsd.sh: Delete.
* emulparams/shelf64.sh: Delete.
* emulparams/shelf64_nbsd.sh: Delete.
* emulparams/shlelf32.sh: Delete.
* emulparams/shlelf32_linux.sh: Delete.
* emulparams/shlelf32_nbsd.sh: Delete.
* emulparams/shlelf64.sh: Delete.
* emulparams/shlelf64_nbsd.sh: Delete.
* emultempl/sh64elf.em: Delete.
* testsuite/ld-sh/sh64/abi32.sd: Delete.
* testsuite/ld-sh/sh64/abi32.xd: Delete.
* testsuite/ld-sh/sh64/abi64.sd: Delete.
* testsuite/ld-sh/sh64/abi64.xd: Delete.
* testsuite/ld-sh/sh64/abixx-noexp.sd: Delete.
* testsuite/ld-sh/sh64/cmpct1.sd: Delete.
* testsuite/ld-sh/sh64/cmpct1.xd: Delete.
* testsuite/ld-sh/sh64/crange-1.s: Delete.
* testsuite/ld-sh/sh64/crange-2a.s: Delete.
* testsuite/ld-sh/sh64/crange-2b.s: Delete.
* testsuite/ld-sh/sh64/crange-2c.s: Delete.
* testsuite/ld-sh/sh64/crange-2d.s: Delete.
* testsuite/ld-sh/sh64/crange-2e.s: Delete.
* testsuite/ld-sh/sh64/crange-2f.s: Delete.
* testsuite/ld-sh/sh64/crange-2g.s: Delete.
* testsuite/ld-sh/sh64/crange-2h.s: Delete.
* testsuite/ld-sh/sh64/crange-2i.s: Delete.
* testsuite/ld-sh/sh64/crange1.rd: Delete.
* testsuite/ld-sh/sh64/crange2.rd: Delete.
* testsuite/ld-sh/sh64/crange3-cmpct.rd: Delete.
* testsuite/ld-sh/sh64/crange3-media.rd: Delete.
* testsuite/ld-sh/sh64/crange3.dd: Delete.
* testsuite/ld-sh/sh64/crange3.rd: Delete.
* testsuite/ld-sh/sh64/crangerel1.rd: Delete.
* testsuite/ld-sh/sh64/crangerel2.rd: Delete.
* testsuite/ld-sh/sh64/dlsection-1.s: Delete.
* testsuite/ld-sh/sh64/dlsection.sd: Delete.
* testsuite/ld-sh/sh64/endian.dbd: Delete.
* testsuite/ld-sh/sh64/endian.dld: Delete.
* testsuite/ld-sh/sh64/endian.ld: Delete.
* testsuite/ld-sh/sh64/endian.s: Delete.
* testsuite/ld-sh/sh64/endian.sbd: Delete.
* testsuite/ld-sh/sh64/endian.sld: Delete.
* testsuite/ld-sh/sh64/gotplt.d: Delete.
* testsuite/ld-sh/sh64/gotplt.map: Delete.
* testsuite/ld-sh/sh64/gotplt.s: Delete.
* testsuite/ld-sh/sh64/init-cmpct.d: Delete.
* testsuite/ld-sh/sh64/init-media.d: Delete.
* testsuite/ld-sh/sh64/init.s: Delete.
* testsuite/ld-sh/sh64/init64.d: Delete.
* testsuite/ld-sh/sh64/mix1-noexp.sd: Delete.
* testsuite/ld-sh/sh64/mix1.sd: Delete.
* testsuite/ld-sh/sh64/mix1.xd: Delete.
* testsuite/ld-sh/sh64/mix2-noexp.sd: Delete.
* testsuite/ld-sh/sh64/mix2.sd: Delete.
* testsuite/ld-sh/sh64/mix2.xd: Delete.
* testsuite/ld-sh/sh64/rd-sh64.exp: Delete.
* testsuite/ld-sh/sh64/rel-1.s: Delete.
* testsuite/ld-sh/sh64/rel-2.s: Delete.
* testsuite/ld-sh/sh64/rel32.xd: Delete.
* testsuite/ld-sh/sh64/rel64.xd: Delete.
* testsuite/ld-sh/sh64/relax.exp: Delete.
* testsuite/ld-sh/sh64/relax1.s: Delete.
* testsuite/ld-sh/sh64/relax2.s: Delete.
* testsuite/ld-sh/sh64/relax3.s: Delete.
* testsuite/ld-sh/sh64/relax4.s: Delete.
* testsuite/ld-sh/sh64/reldl-1.s: Delete.
* testsuite/ld-sh/sh64/reldl-2.s: Delete.
* testsuite/ld-sh/sh64/reldl32.rd: Delete.
* testsuite/ld-sh/sh64/reldl64.rd: Delete.
* testsuite/ld-sh/sh64/relfail.exp: Delete.
* testsuite/ld-sh/sh64/relfail.s: Delete.
* testsuite/ld-sh/sh64/sh64-1.s: Delete.
* testsuite/ld-sh/sh64/sh64-2.s: Delete.
* testsuite/ld-sh/sh64/sh64.exp: Delete.
* testsuite/ld-sh/sh64/shcmp-1.s: Delete.
* testsuite/ld-sh/sh64/shdl-1.s: Delete.
* testsuite/ld-sh/sh64/shdl-2.s: Delete.
* testsuite/ld-sh/sh64/shdl32.xd: Delete.
* testsuite/ld-sh/sh64/shdl64.sd: Delete.
* testsuite/ld-sh/sh64/shdl64.xd: Delete.
* testsuite/ld-sh/sh64/shmix-1.s: Delete.
* testsuite/ld-sh/sh64/shmix-2.s: Delete.
* testsuite/ld-sh/sh64/shmix-3.s: Delete.
* testsuite/ld-sh/sh64/stobin-0-dso.d: Delete.
* testsuite/ld-sh/sh64/stobin-1.d: Delete.
* testsuite/ld-sh/sh64/stobin.s: Delete.
* testsuite/ld-sh/sh64/stolib.s: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove sh-symbianelf support
Alan Modra [Mon, 16 Apr 2018 05:57:45 +0000 (15:27 +0930)]
Remove sh-symbianelf support

bfd/
* Makefile.am: Remove sh-symbianelf support.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* elf32-sh-symbian.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
gas/
* config/tc-sh.c: Remove sh-symbianelf support.
* config/tc-sh.h: Likewise.
* configure.ac: Likewise.
* configure.tgt: Likewise.
* testsuite/gas/sh/reg-prefix.d: Likewise.
* testsuite/gas/sh/sh2a-pic.d: Likewise.
* config.in: Regenerate.
* configure: Regenerate.
ld/
* Makefile.am: Remove sh-symbianelf support.
* configure.tgt: Likewise.
* emulparams/shlsymbian.sh: Delete.
* scripttempl/elf32sh-symbian.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove vax-bsd and vax-ultrix support
Alan Modra [Mon, 16 Apr 2018 05:56:56 +0000 (15:26 +0930)]
Remove vax-bsd and vax-ultrix support

bfd/
* Makefile.am: Remove vax-bsd and vax-ultrix support.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* vaxbsd.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
ld/
* Makefile.am: Remove vax-bsd and vax-ultrix support.
* configure.tgt: Likewise.
* emulparams/vax.sh: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove w65 support
Alan Modra [Mon, 16 Apr 2018 05:56:05 +0000 (15:26 +0930)]
Remove w65 support

include/
* coff/internal.h: Remove w65 support.
* coff/w65.h: Delete.
bfd/
* Makefile.am: Remove w65 support.
* archures.c: Likewise.
* coffcode.h: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* coff-w65.c: Delete.
* cpu-w65.c: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* Makefile.am: Remove w65 support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* w65-dis.c: Delete.
* w65-opc.h: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
binutils/
* testsuite/binutils-all/objcopy.exp: Remove w65 support.
ld/
* Makefile.am: Remove w65 support.
* configure.tgt: Likewise.
* emulparams/w65.sh: Delete.
* scripttempl/w65.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove we32k support
Alan Modra [Mon, 16 Apr 2018 05:54:43 +0000 (15:24 +0930)]
Remove we32k support

include/
* coff/we32k.h: Delete.
bfd/
* Makefile.am: Remove we32k support.
* archures.c: Likewise.
* coffcode.h: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* coff-we32k.c: Delete.
* cpu-we32k.c: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* configure.ac: Remove we32k support.
* configure: Regenerate.
bintuils/
* testsuite/binutils-all/objdump.exp: Remove we32k support.

6 years agoRemove m88k support
Alan Modra [Mon, 16 Apr 2018 05:53:38 +0000 (15:23 +0930)]
Remove m88k support

include/
* coff/internal.h: Remove m88k support.
* coff/m88k.h: Delete.
* opcode/m88k.h: Delete.
bfd/
* Makefile.am: Remove m88k support.
* aoutx.h: Likewise.
* archures.c: Likewise.
* coffcode.h: Likewise.
* coffswap.h: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* cpu-ns32k.c: Likewise.
* elf32-nds32.c: Likewise.
* mach-o.c: Likewise.
* netbsd-core.c: Likewise.
* reloc.c: Likewise.
* targets.c: Likewise.
* coff-m88k.c: Delete.
* cpu-m88k.c: Delete.
* elf32-m88k.c: Delete.
* hosts/m88kmach3.h: Delete.
* m88kmach3.c: Delete.
* m88kopenbsd.c: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* Makefile.am: Remove m88k support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* m88k-dis.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
binutils/
* MAINTAINERS (Mark Kettenis): Move to past maintainers.
* testsuite/binutils-all/objdump.exp: Remove m88k support.
gas/
* configure.ac: Remove m88k support.
* config.in: Regenerate.
* configure: Regenerate.
ld/
* Makefile.am: Remove m88k support.
* configure.host: Likewise.
* configure.tgt: Likewise.
* testsuite/ld-elf/sec-to-seg.exp: Likewise.
* emulparams/m88kbcs.sh: Delete.
* scripttempl/m88kbcs.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove i370 support
Alan Modra [Mon, 16 Apr 2018 05:51:56 +0000 (15:21 +0930)]
Remove i370 support

include/
* elf/i370.h: Delete.
* opcode/i370.h: Delete.
bfd/
* Makefile.am: Remove i370 support.
* archures.c: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* cpu-i370.c: Delete.
* elf32-i370.c: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* Makefile.am: Remove i370 support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* i370-dis.c: Delete.
* i370-opc.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
binutils/
* readelf.c: Remove i370 support.
* testsuite/binutils-all/objdump.exp: Likewise.
gas/
* Makefile.am: Remove i370 support.
* app.c: Likewise.
* config/obj-elf.c: Likewise.
* configure.tgt: Likewise.
* doc/Makefile.am: Likewise.
* doc/as.texinfo: Likewise.
* testsuite/gas/all/gas.exp: Likewise.
* testsuite/gas/elf/warn-2.s: Likewise.
* testsuite/gas/lns/lns.exp: Likewise.
* config/tc-i370.c: Delete.
* config/tc-i370.h: Delete.
* doc/c-i370.texi: Delete.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* Makefile.am: Remove i370 support.
* configure.tgt: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr22677.d: Likewise.
* testsuite/lib/ld-lib.exp: Likewise.
* emulparams/elf32i370.sh: Delete.
* scripttempl/elfi370.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove h8500 support
Alan Modra [Mon, 16 Apr 2018 05:49:41 +0000 (15:19 +0930)]
Remove h8500 support

include/
* coff/h8500.h: Delete.
* coff/internal.h: Remove h8500 support.
bfd/
* Makefile.am: Remove h8500 support.
* archures.c: Likewise.
* coffcode.h: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* coff-h8500.c: Delete.
* cpu-h8500.c: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* Makefile.am: Remove h8500 support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* h8500-dis.c: Delete.
* h8500-opc.h: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
binutils/
* testsuite/binutils-all/objcopy.exp: Remove h8500 support.
* testsuite/lib/binutils-common.exp: Likewise.
gas/
* config/obj-coff.h: Remove h8500 support.
ld/
* Makefile.am: Remove h8500 support.
* configure.tgt: Likewise.
* emulparams/h8500.sh: Delete.
* emulparams/h8500b.sh: Delete.
* emulparams/h8500c.sh: Delete.
* emulparams/h8500m.sh: Delete.
* emulparams/h8500s.sh: Delete.
* scripttempl/h8500.sc: Delete.
* scripttempl/h8500b.sc: Delete.
* scripttempl/h8500c.sc: Delete.
* scripttempl/h8500m.sc: Delete.
* scripttempl/h8500s.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove h8300-coff support
Alan Modra [Mon, 16 Apr 2018 05:47:57 +0000 (15:17 +0930)]
Remove h8300-coff support

include/
* coff/h8300.h: Delete.
bfd/
* Makefile.am: Remove h8300-coff support.
* coffcode.h: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* reloc16.c: Likewise.
* targets.c: Likewise.
* coff-h8300.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* testsuite/binutils-all/objcopy.exp: Remove h8300-coff support.
gas/
* config/obj-coff.h: Remove h8300-coff support.
* config/tc-h8300.c: Likewise.
* config/tc-h8300.h: Likewise.
* testsuite/gas/h8300/h8300.exp: Likewise.
* testsuite/gas/h8300/branch-coff.s: Delete.
* testsuite/gas/h8300/branchh-coff.s: Delete.
* testsuite/gas/h8300/branchs-coff.s: Delete.
* testsuite/gas/h8300/ffxx1-coff.d: Delete.
* testsuite/gas/h8300/ffxx1-coff.s: Delete.
* testsuite/gas/h8300/h8300-coff.exp: Delete.
ld/
* Makefile.am: Remove h8300-coff support.
* configure.tgt: Likewise.
* testsuite/ld-h8300/h8300.exp: Likewise.
* emulparams/h8300.sh: Delete.
* emulparams/h8300h.sh: Delete.
* emulparams/h8300hn.sh: Delete.
* emulparams/h8300s.sh: Delete.
* emulparams/h8300sn.sh: Delete.
* emulparams/h8300sx.sh: Delete.
* emulparams/h8300sxn.sh: Delete.
* scripttempl/h8300.sc: Delete.
* scripttempl/h8300h.sc: Delete.
* scripttempl/h8300hn.sc: Delete.
* scripttempl/h8300s.sc: Delete.
* scripttempl/h8300sn.sc: Delete.
* scripttempl/h8300sx.sc: Delete.
* scripttempl/h8300sxn.sc: Delete.
* testsuite/ld-h8300/relax-3-coff.d: Delete.
* testsuite/ld-h8300/relax-4-coff.d: Delete.
* testsuite/ld-h8300/relax-5-coff.d: Delete.
* testsuite/ld-h8300/relax-6-coff.d: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove IEEE 695 object support
Alan Modra [Mon, 16 Apr 2018 05:46:00 +0000 (15:16 +0930)]
Remove IEEE 695 object support

include/
* ieee.h: Delete.
bfd/
* Makefile.am: Remove IEEE 695 support.
* archures.c: Likewise.
* bfd.c: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* doc/bfd.texinfo: Likewise.
* doc/bfdint.texi: Likewise.
* doc/bfdsumm.texi: Likewise.
* section.c: Likewise.
* targets.c: Likewise.
* ieee.c: Delete.
* libieee.h: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* Makefile.am: Remove IEEE 695 support.
* budbg.h: Likewise.
* doc/binutils.texi: Likewise.
* makefile.vms: Likewise.
* objcopy.c: Likewise.
* objdump.c: Likewise.
* rddbg.c: Likewise.
* ieee.c: Delete.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
gas/
* app.c: Remove IEEE 695 support.
* symbols.c: Likewise.
ld/
* ld.texinfo: Remove IEEE 695 support.
* mri.c: Likewise.

6 years agoRemove tandem support
Alan Modra [Mon, 16 Apr 2018 05:44:19 +0000 (15:14 +0930)]
Remove tandem support

bfd/
* config.bfd: Remove tandem support.
ld/
* Makefile.am: Remove tandem support.
* configure.tgt: Likewise.
* emulparams/st2000.sh: Delete.
* scripttempl/st2000.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove sony newsos3 support
Alan Modra [Mon, 16 Apr 2018 05:43:07 +0000 (15:13 +0930)]
Remove sony newsos3 support

include/
* aout/host.h: Remove newsos3 support.
bfd/
* Makefile.am: Remove newsos3 support.
* aoutx.h: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* newsos3.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* testsuite/binutils-all/copy-2.d: Remove newsos3 support.
* testsuite/binutils-all/nm.exp: Likewise.
ld/
* Makefile.am: Remove newsos3 support.
* configure.tgt: Likewise.
* emulparams/news.sh: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove netware support
Alan Modra [Mon, 16 Apr 2018 05:41:22 +0000 (15:11 +0930)]
Remove netware support

include/
* nlm/ChangeLog-9315: Delete.
* nlm/alpha-ext.h: Delete.
* nlm/common.h: Delete.
* nlm/external.h: Delete.
* nlm/i386-ext.h: Delete.
* nlm/internal.h: Delete.
* nlm/ppc-ext.h: Delete.
* nlm/sparc32-ext.h: Delete.
bfd/
* Makefile.am: Remove netware support.
* bfd-in.h: Likewise.
* bfd.c: Likewise.
* config.bfd: Likewise.
* configure.ac: Likewise.
* doc/bfdint.texi: Likewise.
* ecoff.c: Likewise.
* targets.c: Likewise.
* libnlm.h: Delete.
* nlm-target.h: Delete.
* nlm.c: Delete.
* nlm32-alpha.c: Delete.
* nlm32-i386.c: Delete.
* nlm32-ppc.c: Delete.
* nlm32-sparc.c: Delete.
* nlm32.c: Delete.
* nlm64.c: Delete.
* nlmcode.h: Delete.
* nlmswap.h: Delete.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* .gitignore: Remove netware support.
* Makefile.am: Likewise.
* configure.ac: Likewise.
* doc/Makefile.am: Likewise.
* doc/binutils.texi: Likewise.
* testsuite/binutils-all/nm.exp: Likewise.
* nlmconv.c: Delete.
* nlmconv.h: Delete.
* nlmheader.y: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
gas/
* Makefile.am: Remove netware support.
* config/tc-i386.c: Likewise.
* configure.tgt: Likewise.
* config/te-netware.h: Delete.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
gprof/
* corefile.c: Remove netware support.
ld/
* Makefile.am: Remove netware support.
* configure.tgt: Likewise.
* testsuite/ld-powerpc/powerpc.exp: Likewise.
* emulparams/i386nw.sh: Delete.
* emulparams/ppcnw.sh: Delete.
* scripttempl/nw.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoRemove tahoe support
Alan Modra [Mon, 16 Apr 2018 05:38:40 +0000 (15:08 +0930)]
Remove tahoe support

include/
* opcode/tahoe.h: Delete.
bfd/
* archures.c: Remove tahoe support.
* config.bfd: Likewise.
* configure.ac: Likewise.
* hosts/tahoe.h: Delete.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
opcodes/
* configure.ac: Remove tahoe support.
* configure: Regenerate.
binutils/
* testsuite/binutils-all/objdump.exp: Remove tahoe support.
gprof/
* Makefile.am: Remove tahoe support.
* corefile.c: Likewise.
* tahoe.c: Delete.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.

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

6 years agoAdd x86-tdep.o to i386/amd64 target build
Simon Marchi [Sun, 15 Apr 2018 16:52:27 +0000 (12:52 -0400)]
Add x86-tdep.o to i386/amd64 target build

We get this error when doing a build with a single amd64 target (the
default when doing just ./configure on x86-64 GNU/Linux):

/home/simark/src/binutils-gdb/gdb/i386-tdep.c:4431: error: undefined reference to 'x86_in_indirect_branch_thunk(unsigned long, char const**, int, int)'
/home/simark/src/binutils-gdb/gdb/amd64-tdep.c:3045: error: undefined reference to 'x86_in_indirect_branch_thunk(unsigned long, char const**, int, int)'

The problem is that commit

  1d509aa625f8 ("infrun: step through indirect branch thunks")

missed adding x86-tdep.o to the list of object file included in an amd64
or i386 build.  The problem is not seen with --enable-targets=all
because that file is included in ALL_TARGET_OBS.

Built-tested using:

  * --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
  * --host=armv7-rpi2-linux-gnueabihf --target=x86_64-pc-linux-gnu

gdb/ChangeLog:

* configure.tgt (x86_tobjs): New variable.
(amd64_tobjs, i386_tobjs): Use it.

6 years agox86: Allow 32-bit registers for tpause and umwait
H.J. Lu [Sun, 15 Apr 2018 15:38:23 +0000 (08:38 -0700)]
x86: Allow 32-bit registers for tpause and umwait

Since only the first 32 bits of input operand are used for tpause and
umwait, the REX.W bit is skipped.  Both 32-bit registers and 64-bit
registers are allowed.

gas/

* testsuite/gas/i386/x86-64-waitpkg.s: Add 32-bit registers
tests for tpause and umwait.
* testsuite/gas/i386/x86-64-waitpkg-intel.d: Updated.
* testsuite/gas/i386/x86-64-waitpkg.d: Likewise.

opcodes/

* i386-dis.c (prefix_table): Replace Em with Edq on tpause and
umwait.
* i386-opc.tbl: Allow 32-bit registers for tpause and umwait in
64-bit mode.
* i386-tbl.h: Regenerated.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 15 Apr 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix bug where --icf=safe triggers segfault when linking ARM.
Cary Coutant [Sat, 14 Apr 2018 22:58:07 +0000 (15:58 -0700)]
Fix bug where --icf=safe triggers segfault when linking ARM.

When checking a R_ARM_TARGET[12] relocation, we need a valid target
pointer, but the garbage collection code was passing a NULL instead.

gold/
PR gold/23046
* gc.h (gc_process_relocs): Pass target to
scan.global_reloc_may_be_function_pointer.

6 years agopowerpc common-page-size
Alan Modra [Sat, 14 Apr 2018 06:53:56 +0000 (16:23 +0930)]
powerpc common-page-size

max-page-size only matters for demand paged executables or shared
libraries, and the ideal size is the largest value used by your
operating system.  Values larger than necessary just waste file space
and memory.  common-page-size also affects file and memory size,
trading a possible small increase in file size for a decrease in
memory size when the operating system is using a common-page-size
page.  With a powerpc max-page-size of 64k and common-page-size of 4k
many executables will use no more memory pages when the system page
size is 4k than an executable linked with -z max-page-size=0x1000,
yet will still run on a system using 64k pages.  However, when running
on a system using 64k pages relro protection will not be completely
effective.

Due to the relro problem, powerpc binutils has been using a default
common-page-size of 64k since 2014-12-18 (git commit 04c6a44c7),
leading to complaints about increased file and memory sizes.  People
not using relro do have a valid reason to complain..

So this patch introduces an extra back-end value to use as the default
for common-page-size when generating relro executables, and enables
the support for powerpc.  Non relro executables will now be generated
with a default common-page-size of 4k.

bfd/
* elf-bfd.h (struct elf_backend_data): Add relropagesize.
* elfxx-target.h (ELF_RELROPAGESIZE): Provide default and
sanity test.
(elfNN_bed): Init relropagesize.
* bfd.c (bfd_emul_get_commonpagesize): Add boolean param to
select relropagesize.
* elf32-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
(ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
(ELF_MINPAGESIZE): Don't define.
* elf64-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
(ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
* bfd-in2.h: Regenerate.
ld/
* ldmain.c (main): Move config.maxpagesize and
config.commonpagesize initialization to..
* ldemul.c (after_parse_default): ..here.
* testsuite/ld-powerpc/ppc476-shared.d: Pass -z common-page-size.
* testsuite/ld-powerpc/ppc476-shared2.d: Likewise.

6 years agopowerpc max-page-size vs __QNXTARGET__
Alan Modra [Thu, 12 Apr 2018 10:40:36 +0000 (20:10 +0930)]
powerpc max-page-size vs __QNXTARGET__

The default max-page-size on ppc32 has been 64k since 1995-02-15 (git
commit bcbe2c71).  There was a change committed 2003-07-12 to chose a
4k page if __QNXTARGET__ is defined, but that particular commit was
from an earlier posted patch
https://sourceware.org/ml/binutils/2003-07/msg00211.html that only
made the change effective for arm, rather than the later one
https://sourceware.org/ml/binutils/2003-07/msg00220.html that also
changed powerpc and sh..

Since the __QNXTARGET__ #ifdef in elf32-ppc.c is ineffective unless
the user defines it in his or her CFLAGS, I'm removing that code.

* elf32-ppc.c (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): Don't depend
on __QNXTARGET__ define.

6 years agopowerpc-lynxos and powerpc-windiss fixes
Alan Modra [Sat, 14 Apr 2018 01:21:23 +0000 (10:51 +0930)]
powerpc-lynxos and powerpc-windiss fixes

Enabling shared lib tests showed the powerpc-lynxos target is broken,
and has been for a long time.  The breakage happened in a 2005-05-07
patch of mine, git commit 3b36f7e62, I think.  There have been no bug
reports I recall so it seems the target is dead.  powerpc-windiss is
similarly broken.

This patch fixes the breakage, and puts the targets on the obsolete
list.

bfd/
* config.bfd: Add powerpc-*-lynxos* and powerpc-*-windiss*
to obsolete list.
ld/
* emulparams/elf32ppcwindiss.sh: Rewrite to use elf32ppc.sh.
* emulparams/ppclynx.sh: Likewise.

6 years agoReinstate readelf decoding of i860 and i960 machine names
Alan Modra [Sat, 14 Apr 2018 01:20:16 +0000 (10:50 +0930)]
Reinstate readelf decoding of i860 and i960 machine names

Decoding of EM_* ought to continue.

* readelf.c (get_machine_name): Revert 2018-04-11 change.

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

6 years agoShow line numbers in output for "info var/func/type"
Andreas Arnez [Fri, 13 Apr 2018 17:26:05 +0000 (19:26 +0200)]
Show line numbers in output for "info var/func/type"

The GDB commands "info variables", "info functions", and "info types" show
the appropriate list of definitions matching the given pattern.  They also
group them by source files.  But no line numbers within these source files
are shown.

The line number information is particularly useful to the user when a
simple "grep" doesn't readily point to a definition.  This is often the
case when the definition involves a macro, occurs within a namespace, or
when the identifier appears very frequently in the source file.

This patch enriches the printout of these commands by the line numbers and
adjusts affected test cases to the changed output where necessary.  The
new output looks like this:

  (gdb) i variables
  All defined variables:

  File foo.c:
  3: const char * const foo;
  1: int x;

The line number is followed by a colon and a tab character, which is then
followed by the symbol definition.  If no line number is available, the
tab is printed out anyhow, so definitions line up.

gdb/ChangeLog:

* symtab.c (print_symbol_info): Precede the symbol definition by
the line number when available.
* NEWS: Advertise this enhancement.

gdb/doc/ChangeLog:

* gdb.texinfo (Symbols): Mention the fact that "info
variables/functions/types" show source files and line numbers.

gdb/testsuite/ChangeLog:

* gdb.ada/info_types.exp: Adjust expected output to the line
numbers now printed by "info var/func/type".
* gdb.base/completion.exp: Likewise.
* gdb.base/included.exp: Likewise.
* gdb.cp/cp-relocate.exp: Likewise.
* gdb.cp/cplusfuncs.exp: Likewise.
* gdb.cp/namespace.exp: Likewise.
* gdb.dwarf2/dw2-case-insensitive.exp: Likewise.

6 years agobtrace: set/show record btrace cpu
Markus Metzger [Fri, 2 Feb 2018 11:29:48 +0000 (12:29 +0100)]
btrace: set/show record btrace cpu

Add new set/show commands to set the processor that is used for enabling
errata workarounds when decoding branch trace.

The general format is "<vendor>:<identifier>" but we also allow two
special values "auto" and "none".

The default is "auto", which is the current behaviour of having GDB
determine the processor on which the trace was recorded.

If that cpu is not known to the trace decoder, e.g. when using an old
decoder on a new system, decode may fail with "unknown cpu".  In most
cases it should suffice to 'downgrade' decode to assume an older cpu.
Unfortunately, we can't do this automatically.

The other special value, "none", disables errata workarounds.

gdb/
* NEWS (New options): announce set/show record btrace cpu.
* btrace.c: Include record-btrace.h.
(btrace_compute_ftrace_pt): Skip enabling errata workarounds if
the vendor is unknown.
(btrace_compute_ftrace_1): Add cpu parameter.  Update callers.
Maybe overwrite the btrace configuration's cpu.
(btrace_compute_ftrace): Add cpu parameter.  Update callers.
(btrace_fetch): Add cpu parameter.  Update callers.
(btrace_maint_update_pt_packets): Call record_btrace_get_cpu.
Maybe overwrite the btrace configuration's cpu.  Skip enabling
errata workarounds if the vendor is unknown.
* python/py-record-btrace.c: Include record-btrace.h.
(recpy_bt_begin, recpy_bt_end, recpy_bt_instruction_history)
(recpy_bt_function_call_history): Call record_btrace_get_cpu.
* record-btrace.c (record_btrace_cpu_state_kind): New.
(record_btrace_cpu): New.
(set_record_btrace_cpu_cmdlist): New.
(record_btrace_get_cpu): New.
(require_btrace_thread, record_btrace_info)
(record_btrace_resume_thread): Call record_btrace_get_cpu.
(cmd_set_record_btrace_cpu_none): New.
(cmd_set_record_btrace_cpu_auto): New.
(cmd_set_record_btrace_cpu): New.
(cmd_show_record_btrace_cpu): New.
(_initialize_record_btrace): Initialize set/show record btrace cpu
commands.
* record-btrace.h (record_btrace_get_cpu): New.

testsuite/
* gdb.btrace/cpu.exp: New.

doc/
* gdb.texinfo: Document set/show record btrace cpu.

6 years agorecord: fix typo in "set record" output
Markus Metzger [Mon, 5 Mar 2018 16:44:57 +0000 (17:44 +0100)]
record: fix typo in "set record" output

Alan Hayward pointed out a typo in the output of "set record btrace" that
I took from "set record".  Fix the original.

gdb/
* record.c (set_record_command): Fix typo in message.

6 years agobtrace: fix output of "set record btrace"
Markus Metzger [Thu, 1 Feb 2018 13:31:18 +0000 (14:31 +0100)]
btrace: fix output of "set record btrace"

Instead of giving a message that "set record btrace" needs a sub-command,
GDB crashed.  Fix it.  A regression test comes with the next patch.

gdb/
* record-btrace.c (cmd_set_record_btrace): Print sub-commands.

6 years agoinfrun: step through indirect branch thunks
Markus Metzger [Wed, 14 Feb 2018 13:30:57 +0000 (14:30 +0100)]
infrun: step through indirect branch thunks

With version 7.3 GCC supports new options

   -mindirect-branch=<choice>
   -mfunction-return=<choice>

The choices are:

    keep                behaves as before
    thunk               jumps through a thunk
    thunk-external      jumps through an external thunk
    thunk-inline        jumps through an inlined thunk

For thunk and thunk-external, GDB would, on a call to the thunk, step into
the thunk and then resume to its caller assuming that this is an
undebuggable function.  On a return thunk, GDB would stop inside the
thunk.

Make GDB step through such thunks instead.

Before:
    Temporary breakpoint 1, main ()
        at gdb.base/step-indirect-call-thunk.c:37
    37        x = apply (inc, 41);
    (gdb) s
    apply (op=0x80483e6 <inc>, x=41)
        at gdb.base/step-indirect-call-thunk.c:29
    29        return op (x);
    (gdb)
    30      }

After:
    Temporary breakpoint 1, main ()
        at gdb.base/step-indirect-call-thunk.c:37
    37        x = apply (inc, 41);
    (gdb) s
    apply (op=0x80483e6 <inc>, x=41)
        at gdb.base/step-indirect-call-thunk.c:29
    29        return op (x);
    (gdb)
    inc (x=41) at gdb.base/step-indirect-call-thunk.c:23
    23        return x + 1;

This is independent of the step-mode.  In order to step into the thunk,
you would need to use stepi.

When stepping over an indirect call thunk, GDB would first step through
the thunk, then recognize that it stepped into a sub-routine and resume to
the caller (of the thunk).  Not sure whether this is worth optimizing.

Thunk detection is implemented via gdbarch.  I implemented the methods for
IA.  Other architectures may run into unexpected fails.

The tests assume a fixed number of instruction steps to reach a thunk.
This depends on the compiler as well as the architecture.  They may need
adjustments when we add support for more architectures.  Or we can simply
drop those tests that cover being able to step into thunks using
instruction stepping.

When using an older GCC, the tests will fail to build and will be reported
as untested:

    Running .../gdb.base/step-indirect-call-thunk.exp ...
    gdb compile failed, \
    gcc: error: unrecognized command line option '-mindirect-branch=thunk'
    gcc: error: unrecognized command line option '-mfunction-return=thunk'

                    === gdb Summary ===

    # of untested testcases         1

gdb/
* infrun.c (process_event_stop_test): Call
gdbarch_in_indirect_branch_thunk.
* gdbarch.sh (in_indirect_branch_thunk): New.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* x86-tdep.h: New.
* x86-tdep.c: New.
* Makefile.in (ALL_TARGET_OBS): Add x86-tdep.o.
(HFILES_NO_SRCDIR): Add x86-tdep.h.
(ALLDEPFILES): Add x86-tdep.c.
* arch-utils.h (default_in_indirect_branch_thunk): New.
* arch-utils.c (default_in_indirect_branch_thunk): New.
* i386-tdep: Include x86-tdep.h.
(i386_in_indirect_branch_thunk): New.
(i386_elf_init_abi): Set in_indirect_branch_thunk gdbarch
function.
* amd64-tdep: Include x86-tdep.h.
(amd64_in_indirect_branch_thunk): New.
(amd64_init_abi): Set in_indirect_branch_thunk gdbarch function.

testsuite/
* gdb.base/step-indirect-call-thunk.exp: New.
* gdb.base/step-indirect-call-thunk.c: New.
* gdb.reverse/step-indirect-call-thunk.exp: New.
* gdb.reverse/step-indirect-call-thunk.c: New.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Apr 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix -D_GLIBCXX_DEBUG gdb-add-index regression
Jan Kratochvil [Thu, 12 Apr 2018 20:31:39 +0000 (22:31 +0200)]
Fix -D_GLIBCXX_DEBUG gdb-add-index regression

Fedora Rawhide started to use -D_GLIBCXX_DEBUG which made gdb-add-index
failing:
gdb: Out-of-bounds vector access while running gdb-add-index
https://bugzilla.redhat.com/show_bug.cgi?id=1540559

/usr/include/c++/7/debug/safe_iterator.h:270:
Error: attempt to dereference a past-the-end iterator.
Objects involved in the operation:
    iterator "this" @ 0x0x7fffffffcb90 {
      type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<unsigned char*, std::__cxx1998::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >, std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > (mutable iterator);
      state = past-the-end;
      references sequence with type 'std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > >' @ 0x0x7fffffffcc50
    }

/usr/include/c++/7/debug/vector:417:
Error: attempt to subscript container with out-of-bounds index 556, but
container only holds 556 elements.
Objects involved in the operation:
    sequence "this" @ 0x0x2e87af8 {
      type = std::__debug::vector<partial_symbol*, std::allocator<partial_symbol*> >;
    }

The two -D_GLIBCXX_DEBUG regressions were made by:

commit bc8f2430e08cc2a520db49a42686e0529be4a3bc
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Jun 12 16:29:53 2017 +0100
    Code cleanup: C++ify .gdb_index producer

commit af5bf4ada48ff65b6658be1fab8f9c8f8ab5f319
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Sat Oct 14 08:06:29 2017 -0400
    Replace psymbol_allocation_list with std::vector

gdb/ChangeLog
2018-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/23053
* dwarf-index-write.c (data_buf::grow) (write_one_signatured_type)
(recursively_write_psymbols) (debug_names::recursively_write_psymbols)
(debug_names::write_one_signatured_type): Fix -D_GLIBCXX_DEBUG
regression.

6 years agoRemove old univariant code from rust-lang.c
Tom Tromey [Thu, 29 Mar 2018 18:08:32 +0000 (12:08 -0600)]
Remove old univariant code from rust-lang.c

Since moving Rust enum handling into dwarf2read.c, some old code for
handling univariant enums in rust-lang.c has been obsolete.  This
patch removes this code.

Tested on x86-64 Fedora 26, using rustc 1.23 (1.24 emits incorrect
DWARF for enums and so can't be used for this test).

2018-04-12  Tom Tromey  <tom@tromey.com>

* rust-lang.c (rust_print_struct_def): Remove univariant code.
(rust_evaluate_subexp): Likewise.

6 years agoFix Solaris build
Pedro Alves [Thu, 12 Apr 2018 16:47:59 +0000 (17:47 +0100)]
Fix Solaris build

This commit fixes a bit of rot in procfs.c caused by recent changes.

Specifically, the target_ops::to_detach change to pass down 'inferior
*' missed updating a forward declation, and the change to use
scoped_fd in more places missed removing one do_cleanups call.

  src/gdb/procfs.c: In function â€˜target_ops* procfs_target()’:
  src/gdb/procfs.c:167:16: error: invalid conversion from â€˜void (*)(target_ops*, const char*, int)’ to â€˜void (*)(target_ops*, inferior*, int)’ [-fpermissive]
     t->to_detach = procfs_detach;
  ^
  src/gdb/procfs.c: In function â€˜ssd* proc_get_LDT_entry(procinfo*, int)’:
  src/gdb/procfs.c:1624:17: error: â€˜old_chain’ was not declared in this scope
      do_cleanups (old_chain);
   ^
  src/gdb/procfs.c: At global scope:
  src/gdb/procfs.c:90:13: error: â€˜void procfs_detach(target_ops*, const char*, int)’ declared â€˜static’ but never defined [-Werror=unused-function]
   static void procfs_detach (struct target_ops *, const char *, int);
       ^
  src/gdb/procfs.c:1923:1: error: â€˜void procfs_detach(target_ops*, inferior*, int)’ defined but not used [-Werror=unused-function]
   procfs_detach (struct target_ops *ops, inferior *inf, int from_tty)
   ^

gdb/ChangeLog:
2018-04-12  Pedro Alves  <palves@redhat.com>

* procfs.c (procfs_detach): Make forward declaration's prototype
match definition's protototype.
(proc_get_LDT_entry): Remove stale do_cleanups call.

6 years agoEliminate target_has_exited
Pedro Alves [Thu, 12 Apr 2018 16:36:01 +0000 (17:36 +0100)]
Eliminate target_has_exited

Nothing uses this.

gdb/ChangeLog:
2018-04-12  Pedro Alves  <palves@redhat.com>

* target.h (target_ops::to_has_exited): Delete.
(target_has_exited): Delete.
* target-delegates.c: Regenerate.

6 years agoFix the loading of the dynamic string table in a file without sections.
Nick Clifton [Thu, 12 Apr 2018 14:41:07 +0000 (15:41 +0100)]
Fix the loading of the dynamic string table in a file without sections.

PR 23050
* readelf.c (process_dynamic_section): Correct dynamic string
table size calculation.

6 years agoStop the assembler from overwriting its output file.
John Darrington [Thu, 12 Apr 2018 14:07:02 +0000 (15:07 +0100)]
Stop the assembler from overwriting its output file.

* as.c (main): Fail if the output is the same as one of the input
files.
* testsuite/gas/all/gas.exp: Test the new feature.

6 years agoUpdated Spanish and Russian translations for the gas sub-directory
Nick Clifton [Thu, 12 Apr 2018 11:01:50 +0000 (12:01 +0100)]
Updated Spanish and Russian translations for the gas sub-directory

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 12 Apr 2018 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoEnable Intel WAITPKG instructions.
Igor Tsimbalist [Mon, 9 Apr 2018 10:58:50 +0000 (12:58 +0200)]
Enable Intel WAITPKG instructions.

Intel has disclosed a set of new instructions for Tremont processor.
The spec is
https://software.intel.com/en-us/intel-architecture-instruction-set-extensions-programming-reference
This patch enables Intel WAITPKG instructions.

gas/
* config/tc-i386.c (cpu_arch): Add WAITPKG.
(cpu_noarch): Likewise.
* doc/c-i386.texi: Document WAITPKG.
* i386/i386.exp: Run WAITPKG tests.
* testsuite/gas/i386/waitpkg-intel.d: New test.
* testsuite/gas/i386/waitpkg.d: Likewise.
* testsuite/gas/i386/waitpkg.s: Likewise.
* testsuite/gas/i386/x86-64-waitpkg-intel.d: Likewise.
* testsuite/gas/i386/x86-64-waitpkg.d: Likewise.
* testsuite/gas/i386/x86-64-waitpkg.s: Likewise.

opcodes/
* i386-dis.c (enum): Add PREFIX_MOD_0_0FAE_REG_6,
PREFIX_MOD_1_0FAE_REG_6.
(va_mode): New.
(OP_E_register): Use va_mode.
* i386-dis-evex.h (prefix_table):
New instructions (see prefixes above).
* i386-gen.c (cpu_flag_init): Add WAITPKG.
(cpu_flags): Likewise.
* i386-opc.h (enum): Likewise.
(i386_cpu_flags): Likewise.
* i386-opc.tbl: Add umonitor, umwait, tpause.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.

6 years agoAdd test for following fork on position-independent executables
Simon Marchi [Wed, 11 Apr 2018 18:55:39 +0000 (14:55 -0400)]
Add test for following fork on position-independent executables

Commit

  b2e586e ("Defer breakpoint reset when cloning progspace for fork
  child")

fixed following fork childs when the executable is position-independent.
This patch adds a little test for it.

gdb/testsuite/ChangeLog:

* gdb.base/pie-fork.c: New file.
* gdb.base/pie-fork.exp: New file.

6 years agoAdd Rust test case for ".." struct initializer
Tom Tromey [Thu, 29 Mar 2018 18:08:32 +0000 (12:08 -0600)]
Add Rust test case for ".." struct initializer

Building with --coverage pointed out that there was no Rust test for
initializing a structure using the ".." initializer.  This patch adds
such a test.

Regression tested on x86-64 Fedora 26.

2018-04-11  Tom Tromey  <tom@tromey.com>

* gdb.rust/simple.exp: Add test for ".." struct initializer.

6 years agoRemove i860, i960, bout and aout-adobe targets
Alan Modra [Wed, 11 Apr 2018 09:16:05 +0000 (18:46 +0930)]
Remove i860, i960, bout and aout-adobe targets

Plus remove a few leftovers from the 29k support.

include/
* aout/adobe.h: Delete.
* aout/reloc.h: Delete.
* coff/i860.h: Delete.
* coff/i960.h: Delete.
* elf/i860.h: Delete.
* elf/i960.h: Delete.
* opcode/i860.h: Delete.
* opcode/i960.h: Delete.
* aout/aout64.h (enum reloc_type): Trim off 29k and other unused values.
* aout/ar.h (ARMAGB): Remove.
* coff/internal.h (struct internal_aouthdr, struct internal_scnhdr,
union internal_auxent): Remove i960 support.
bfd/
* aout-adobe.c: Delete.
* bout.c: Delete.
* coff-i860.c: Delete.
* coff-i960.c: Delete.
* cpu-i860.c: Delete.
* cpu-i960.c: Delete.
* elf32-i860.c: Delete.
* elf32-i960.c: Delete.
* hosts/i860mach3.h: Delete.
* Makefile.am: Remove i860, i960, bout, and adobe support.
* archures.c: Remove i860 and i960 support.
* coffcode.h: Likewise.
* reloc.c: Likewise.
* aoutx.h: Comment updates.
* archive.c: Remove BOUT and i960 support.
* bfd.c: Remove BOUT support.
* coffswap.h: Remove i960 support.
* config.bfd: Remove i860, i960 and adobe targets.
* configure.ac: Remove adode, bout, i860, i960, icoff targets.
* targets.c: Likewise.
* ieee.c: Remove i960 support.
* mach-o.c: Remove i860 support.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* libbfd.h: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
opcodes/
* opcodes/i860-dis.c: Delete.
* opcodes/i960-dis.c: Delete.
* Makefile.am: Remove i860 and i960 support.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
binutils/
* ieee.c: Remove i960 support.
* od-macho.c: Remove i860 support.
* readelf.c: Remove i860 and i960 support.
* testsuite/binutils-all/objcopy.exp: Likewise.
* testsuite/binutils-all/objdump.exp: Likewise.
* testsuite/lib/binutils-common.exp: Likewise.
gas/
* config/aout_gnu.h: Delete.
* config/tc-i860.c: Delete.
* config/tc-i860.h: Delete.
* config/tc-i960.c: Delete.
* config/tc-i960.h: Delete.
* doc/c-i860.texi: Delete.
* doc/c-i960.texi: Delete.
* testsuite/gas/i860/README.i860: Delete.
* testsuite/gas/i860/bitwise.d: Delete.
* testsuite/gas/i860/bitwise.s: Delete.
* testsuite/gas/i860/branch.d: Delete.
* testsuite/gas/i860/branch.s: Delete.
* testsuite/gas/i860/bte.d: Delete.
* testsuite/gas/i860/bte.s: Delete.
* testsuite/gas/i860/dir-align01.d: Delete.
* testsuite/gas/i860/dir-align01.s: Delete.
* testsuite/gas/i860/dir-intel01.d: Delete.
* testsuite/gas/i860/dir-intel01.s: Delete.
* testsuite/gas/i860/dir-intel02.d: Delete.
* testsuite/gas/i860/dir-intel02.s: Delete.
* testsuite/gas/i860/dir-intel03-err.l: Delete.
* testsuite/gas/i860/dir-intel03-err.s: Delete.
* testsuite/gas/i860/dual01.d: Delete.
* testsuite/gas/i860/dual01.s: Delete.
* testsuite/gas/i860/dual02-err.l: Delete.
* testsuite/gas/i860/dual02-err.s: Delete.
* testsuite/gas/i860/dual03.d: Delete.
* testsuite/gas/i860/dual03.s: Delete.
* testsuite/gas/i860/fldst01.d: Delete.
* testsuite/gas/i860/fldst01.s: Delete.
* testsuite/gas/i860/fldst02.d: Delete.
* testsuite/gas/i860/fldst02.s: Delete.
* testsuite/gas/i860/fldst03.d: Delete.
* testsuite/gas/i860/fldst03.s: Delete.
* testsuite/gas/i860/fldst04.d: Delete.
* testsuite/gas/i860/fldst04.s: Delete.
* testsuite/gas/i860/fldst05.d: Delete.
* testsuite/gas/i860/fldst05.s: Delete.
* testsuite/gas/i860/fldst06.d: Delete.
* testsuite/gas/i860/fldst06.s: Delete.
* testsuite/gas/i860/fldst07.d: Delete.
* testsuite/gas/i860/fldst07.s: Delete.
* testsuite/gas/i860/fldst08.d: Delete.
* testsuite/gas/i860/fldst08.s: Delete.
* testsuite/gas/i860/float01.d: Delete.
* testsuite/gas/i860/float01.s: Delete.
* testsuite/gas/i860/float02.d: Delete.
* testsuite/gas/i860/float02.s: Delete.
* testsuite/gas/i860/float03.d: Delete.
* testsuite/gas/i860/float03.s: Delete.
* testsuite/gas/i860/float04.d: Delete.
* testsuite/gas/i860/float04.s: Delete.
* testsuite/gas/i860/form.d: Delete.
* testsuite/gas/i860/form.s: Delete.
* testsuite/gas/i860/i860.exp: Delete.
* testsuite/gas/i860/iarith.d: Delete.
* testsuite/gas/i860/iarith.s: Delete.
* testsuite/gas/i860/ldst01.d: Delete.
* testsuite/gas/i860/ldst01.s: Delete.
* testsuite/gas/i860/ldst02.d: Delete.
* testsuite/gas/i860/ldst02.s: Delete.
* testsuite/gas/i860/ldst03.d: Delete.
* testsuite/gas/i860/ldst03.s: Delete.
* testsuite/gas/i860/ldst04.d: Delete.
* testsuite/gas/i860/ldst04.s: Delete.
* testsuite/gas/i860/ldst05.d: Delete.
* testsuite/gas/i860/ldst05.s: Delete.
* testsuite/gas/i860/ldst06.d: Delete.
* testsuite/gas/i860/ldst06.s: Delete.
* testsuite/gas/i860/pfam.d: Delete.
* testsuite/gas/i860/pfam.s: Delete.
* testsuite/gas/i860/pfmam.d: Delete.
* testsuite/gas/i860/pfmam.s: Delete.
* testsuite/gas/i860/pfmsm.d: Delete.
* testsuite/gas/i860/pfmsm.s: Delete.
* testsuite/gas/i860/pfsm.d: Delete.
* testsuite/gas/i860/pfsm.s: Delete.
* testsuite/gas/i860/pseudo-ops01.d: Delete.
* testsuite/gas/i860/pseudo-ops01.s: Delete.
* testsuite/gas/i860/regress01.d: Delete.
* testsuite/gas/i860/regress01.s: Delete.
* testsuite/gas/i860/shift.d: Delete.
* testsuite/gas/i860/shift.s: Delete.
* testsuite/gas/i860/simd.d: Delete.
* testsuite/gas/i860/simd.s: Delete.
* testsuite/gas/i860/system.d: Delete.
* testsuite/gas/i860/system.s: Delete.
* testsuite/gas/i860/xp.d: Delete.
* testsuite/gas/i860/xp.s: Delete.
* Makefile.am: Remove i860 and i960 support.
* configure.tgt: Likewise.
* doc/Makefile.am: Likewise.
* doc/all.texi: Likewise.
* testsuite/gas/all/gas.exp
* config/obj-coff.h: Remove i960 support.
* doc/internals.texi: Likewise.
* expr.c: Likewise.
* read.c: Likewise.
* write.c: Likewise.
* write.h: Likewise.
* testsuite/gas/lns/lns.exp: Likewise.
* testsuite/gas/symver/symver.exp: Likewise.
* config/tc-m68k.c: Remove BOUT support.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sparc.c: Likewise.
* symbols.c: Likewise.
* doc/h8.texi: Likewise.
* configure.ac: Remove BOUT and i860 support.
* doc/as.texinfo: Remove BOUT, i860 and i960 support
* Makefile.in: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* emulparams/coff_i860.sh: Delete.
* emulparams/elf32_i860.sh: Delete.
* emulparams/elf32_i960.sh: Delete.
* emulparams/gld960.sh: Delete.
* emulparams/gld960coff.sh: Delete.
* emulparams/lnk960.sh: Delete.
* emultempl/gld960.em: Delete.
* emultempl/gld960c.em: Delete.
* emultempl/lnk960.em: Delete.
* scripttempl/i860coff.sc: Delete.
* scripttempl/i960.sc: Delete.
* ld.texinfo: Remove i960 support.
* Makefile.am: Remove i860 and i960 support.
* configure.tgt: Likewise.
* testsuite/ld-discard/extern.d: Likewise.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/merge2.d: Likewise.
* testsuite/ld-elf/merge3.d: Likewise.
* testsuite/ld-elf/orphan-10.d: Likewise.
* testsuite/ld-elf/orphan-11.d: Likewise.
* testsuite/ld-elf/orphan-12.d: Likewise.
* testsuite/ld-elf/orphan-9.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/orphan3.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17550a.d: Likewise.
* testsuite/ld-elf/pr17550b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr20528a.d: Likewise.
* testsuite/ld-elf/pr20528b.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr22677.d: Likewise.
* testsuite/ld-elf/pr22836-1a.d: Likewise.
* testsuite/ld-elf/pr22836-1b.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/sec-to-seg.exp: Likewise.
* testsuite/ld-elf/sec64k.exp: Likewise.
* testsuite/ld-elf/warn1.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elf/warn3.d: Likewise.
* testsuite/lib/ld-lib.exp: Likewise.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agobinutils/testsuite: Also consider `*-*-lynxos*' and `*-*-symbianelf*' ELF
Maciej W. Rozycki [Wed, 28 Mar 2018 20:59:01 +0000 (13:59 -0700)]
binutils/testsuite: Also consider `*-*-lynxos*' and `*-*-symbianelf*' ELF

These targets use the ELF format according to `bfd/config.bfd'.

binutils/
* testsuite/lib/binutils-common.exp (is_elf_format): Also return
1 for `*-*-lynxos*' and `*-*-symbianelf*' targets.

6 years agoFile I/O file handles after target closes
Pedro Alves [Wed, 11 Apr 2018 10:35:58 +0000 (11:35 +0100)]
File I/O file handles after target closes

A future patch will propose making the remote target's target_ops be
heap-allocated (to make it possible to have multiple instances of
remote targets, for multiple simultaneous connections), and will
delete/destroy the remote target at target_close time.

That change trips on a latent problem, though.  File I/O handles
remain open even after the target is gone, with a dangling pointer to
a target that no longer exists.  This results in GDB crashing when it
calls the target_ops backend associated with the file handle:

 (gdb) Disconnect
 Ending remote debugging.
 * GDB crashes deferencing a dangling pointer

Backtrace:

   #0  0x00007f79338570a0 in main_arena () at /lib64/libc.so.6
   #1  0x0000000000858bfe in target_fileio_close(int, int*) (fd=1, target_errno=0x7ffe0499a4c8)
       at src/gdb/target.c:2980
   #2  0x00000000007088bd in gdb_bfd_iovec_fileio_close(bfd*, void*) (abfd=0x1a631b0, stream=0x223c9d0)
       at src/gdb/gdb_bfd.c:353
   #3  0x0000000000930906 in opncls_bclose (abfd=0x1a631b0) at src/bfd/opncls.c:528
   #4  0x0000000000930cf9 in bfd_close_all_done (abfd=0x1a631b0) at src/bfd/opncls.c:768
   #5  0x0000000000930cb3 in bfd_close (abfd=0x1a631b0) at src/bfd/opncls.c:735
   #6  0x0000000000708dc5 in gdb_bfd_close_or_warn(bfd*) (abfd=0x1a631b0) at src/gdb/gdb_bfd.c:511
   #7  0x00000000007091a2 in gdb_bfd_unref(bfd*) (abfd=0x1a631b0) at src/gdb/gdb_bfd.c:615
   #8  0x000000000079ed8e in objfile::~objfile() (this=0x2154730, __in_chrg=<optimized out>)
       at src/gdb/objfiles.c:682
   #9  0x000000000079fd1a in objfile_purge_solibs() () at src/gdb/objfiles.c:1065
   #10 0x00000000008162ca in no_shared_libraries(char const*, int) (ignored=0x0, from_tty=1)
       at src/gdb/solib.c:1251
   #11 0x000000000073b89b in disconnect_command(char const*, int) (args=0x0, from_tty=1)
       at src/gdb/infcmd.c:3035

This goes unnoticed in current master, because the current remote
target's target_ops is never destroyed nowadays, so we end up calling:

  remote_hostio_close -> remote_hostio_send_command

which gracefully fails with FILEIO_ENOSYS if remote_desc is NULL
(because the target is closed).

Fix this by invalidating a target's file I/O handles when the target
is closed.

With this change, remote_hostio_send_command no longer needs to handle the
case of being called with a closed remote target, originally added here:
<https://sourceware.org/ml/gdb-patches/2008-08/msg00359.html>.

gdb/ChangeLog:
2018-04-11  Pedro Alves  <palves@redhat.com>

* target.c (fileio_fh_t::t): Add comment.
(target_fileio_pwrite, target_fileio_pread, target_fileio_fstat)
(target_fileio_close): Handle a NULL target.
(invalidate_fileio_fh): New.
(target_close): Call it.
* remote.c (remote_hostio_send_command): No longer check whether
remote_desc is open.

6 years agoC++ify fileio_fh_t, replace VEC with std::vector
Pedro Alves [Wed, 11 Apr 2018 10:29:39 +0000 (11:29 +0100)]
C++ify fileio_fh_t, replace VEC with std::vector

Preparation for the next patch.

- Replace VEC with std::vector.
- Rewrite a couple macros as methods/functions.
- While at it, rename fileio_fh_t::fd as fileio_fh_t::target_fd to
  avoid confusion between target and host file descriptors.

gdb/ChangeLog:
2018-04-11  Pedro Alves  <palves@redhat.com>

* target.c (fileio_fh_t): Make it a named struct instead of a
typedef.
(fileio_fh_t::is_closed): New method.
(DEF_VEC_O (fileio_fh_t)): Remove.
(fileio_fhandles): Now a std::vector.
(is_closed_fileio_fh): Delete.
(acquire_fileio_fd): Adjust.  Rename parameters.
(release_fileio_fd): Adjust.
(fileio_fd_to_fh): Reimplement as a function instead of a macro.
(target_fileio_pwrite, target_fileio_pread, target_fileio_fstat)
(target_fileio_close): Adjust.

6 years agoSilence nds32 pic warnings
Alan Modra [Wed, 11 Apr 2018 01:40:18 +0000 (11:10 +0930)]
Silence nds32 pic warnings

Fixes:
FAIL: Build pr22471a.so
FAIL: Build pr22471b.so
FAIL: Build pr22649-1.so
FAIL: Build pr22649-2c.so
FAIL: Build pr22649-2d.so
FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: PR ld/21233 dynamic symbols with section GC (auxiliary shared library)
FAIL: Build pr22150.so
FAIL: Build shared library for pr14170
FAIL: PR ld/21703 shared
FAIL: Build shared library for broken linker script test
FAIL: Build pr17068.so
FAIL: -Bsymbolic-functions
FAIL: Build pr20995.so
FAIL: Build pr20995-2.so
FAIL: Build pr22374 shared library

* testsuite/ld-elf/shared.exp (AFLAGS_PIC): Add -mpic for nds32.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Apr 2018 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoIterate by index in auto_load_safe_path_vec_update
Simon Marchi [Tue, 10 Apr 2018 20:50:59 +0000 (16:50 -0400)]
Iterate by index in auto_load_safe_path_vec_update

As reported by Jan, we get this error when building with -D_GLIBCXX_DEBUG:

/usr/include/c++/7/debug/safe_iterator.h:297:
Error: attempt to increment a singular iterator.
Objects involved in the operation:
    iterator "this" @ 0x0x7fffffffd140 {
      type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::unique_ptr<char, gdb::xfree_deleter<char> >*, std::__cxx1998::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > > >, std::__debug::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > > > (mutable iterator);
      state = singular;
      references sequence with type 'std::__debug::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > >' @ 0x0x265db40
    }

The bug was introduced by commit

commit e80aaf6183c6692ecc167bf26cbdc53f8f1a55f0
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Fri Mar 2 23:22:06 2018 -0500
Make delim_string_to_char_ptr_vec return an std::vector

The problem is that we iterate using a range-based for on a vector to
which we push in the loop.  Pushing to the vector invalidates the
iterator used in the loop.  Instead, change the code to iterate by index
as was done in the previous code.

gdb/ChangeLog:

* auto-load.c (auto_load_safe_path_vec_update): Iterate by
index.

6 years agoFix gdb.base/fork-running-state.exp race
Pedro Alves [Tue, 10 Apr 2018 14:00:39 +0000 (15:00 +0100)]
Fix gdb.base/fork-running-state.exp race

On my multi-target branch I was occasionaly seeing a FAIL like this:

  (gdb) PASS: gdb.base/fork-running-state.exp: detach-on-fork=off: follow-fork=parent: non-stop: kill parent
  [Inferior 2 (process 32672) exited normally]
  kill inferior 2
  warning: Inferior ID 2 is not running.
  (gdb) FAIL: gdb.base/fork-running-state.exp: detach-on-fork=off: follow-fork=parent: non-stop: kill child (the program exited)
  ... other similar fails ...

Turns out to be a testcase bug/race.  A tweak like this increases the
changes of hitting the race substancially:

  --- a/gdb/testsuite/gdb.base/fork-running-state.c
  +++ b/gdb/testsuite/gdb.base/fork-running-state.c
  @@ -29,7 +29,7 @@ fork_child (void)
   {
     while (1)
       {
  -      sleep (1);
  +      usleep (100);

The testcase has two processes, parent and child fork.  The problem is
that the child exits itself if it notices the parent is gone, but the
testcase .exp does not expect that.

I first wrote a patch that handled the different combinations of
non-stop/detach-on-fork/follow-fork/schedule-multiple, making the .exp
file know when to expect the child to exit itself vs when to kill it
explicitly, but the result was that the code to kill the parent and
child was getting about as large as the test code that is the actual
point of the testcase, above the kills.

So I scratched that approach and came up with a simpler patch --
simply make the child not exit itself when the parent exits.

The .exp file is going to kill both parent and child explicitly, and,
main() already calls alarm() as a safeguard.  I don't think we lose
anything.

gdb/testsuite/ChangeLog:
2018-04-10  Pedro Alves  <palves@redhat.com>

* gdb.base/fork-running-state.c (fork_child): Don't exit if parent
exits.  Instead loop running forever.
(fork_parent): Run forever too.

6 years agoReplace finish_thread_state_cleanup with a RAII class
Pedro Alves [Tue, 10 Apr 2018 13:49:30 +0000 (14:49 +0100)]
Replace finish_thread_state_cleanup with a RAII class

gdb/ChangeLog:
2018-04-10  Pedro Alves  <palves@redhat.com>

* gdbthread.h (finish_thread_state_cleanup): Delete declaration.
(scoped_finish_thread_state): New class.
* infcmd.c (run_command_1): Use it instead of finish_thread_state
cleanup.
* infrun.c (proceed, prepare_for_detach, wait_for_inferior)
(fetch_inferior_event, normal_stop): Likewise.
* thread.c (finish_thread_state_cleanup): Delete.

6 years agoFix some strip test fails on nds32 and pru
Alan Modra [Mon, 9 Apr 2018 23:44:29 +0000 (09:14 +0930)]
Fix some strip test fails on nds32 and pru

Fixes these fails:
nds32le-linux  +FAIL: binutils-all/strip-14
nds32le-linux  +FAIL: binutils-all/strip-15
pru-elf  +FAIL: binutils-all/strip-14
pru-elf  +FAIL: binutils-all/strip-15

strip-13 fails on nds32 due to an assertion failure and out of bounds
access to nds32_elf_howto_table.

* testsuite/binutils-all/objcopy.exp (strip-14, strip-15): Choose
reloc=11 for pru and reloc=50 for nds32.
* testsuite/binutils-all/strip-15.d: Accept 0xb reloc number.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Apr 2018 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd selftests for range_contains and insert_into_bit_range_vector
Simon Marchi [Mon, 9 Apr 2018 19:45:39 +0000 (15:45 -0400)]
Add selftests for range_contains and insert_into_bit_range_vector

Add some selftests for these two functions.  To to make it easier to
compare sequences of ranges, add operator== and operator!= to compare
two gdb::array_view, and add operator== in struct range.

gdb/ChangeLog:

* value.c: Include "selftest.h" and "common/array-view.h".
(struct range) <operator ==>: New.
(test_ranges_contain): New.
(check_ranges_vector): New.
(test_insert_into_bit_range_vector): New.
(_initialize_values): Register selftests.
* common/array-view.h (operator==, operator!=): New.

6 years agoUse an std::vector for inline_states
Simon Marchi [Mon, 9 Apr 2018 19:40:45 +0000 (15:40 -0400)]
Use an std::vector for inline_states

This patch replaces VEC(inline_state) with std::vector<inline_state> and
adjusts the code that uses it.

gdb/ChangeLog:

* common/gdb_vecs.h (unordered_remove): Add overload that takes
an iterator.
* inline-frame.c: Include <algorithm>.
(struct inline_state): Add constructor.
(inline_state_s): Remove.
(DEF_VEC_O(inline_state_s)): Remove.
(inline_states): Change type to std::vector.
(find_inline_frame_state): Adjust to std::vector.
(allocate_inline_frame_state): Remove.
(clear_inline_frame_state): Adjust to std::vector.
(skip_inline_frames): Adjust to std::vector.

6 years agoRemove VEC(tsv_s), use std::vector instead
Simon Marchi [Mon, 9 Apr 2018 19:16:19 +0000 (15:16 -0400)]
Remove VEC(tsv_s), use std::vector instead

This patch removes VEC(tsv_s), using an std::vector instead.  I C++ified
trace_state_variable a bit in the process, using std::string for the
name.  I also thought it would be nicer to pass a const reference to
target_download_trace_state_variable, since we know it will never be
NULL.  This highlighted that the make-target-delegates script didn't
handle references well, so I adjusted this as well.  It will surely be
useful in the future.

gdb/ChangeLog:

* tracepoint.h (struct trace_state_variable): Add constructor.
<name>: Change type to std::string.
* tracepoint.c (tsv_s): Remove.
(DEF_VEC_O(tsv_s)): Remove.
(tvariables): Change to std::vector.
(create_trace_state_variable): Adjust to std::vector.
(find_trace_state_variable): Likewise.
(find_trace_state_variable_by_number): Likewise.
(delete_trace_state_variable): Likewise.
(trace_variable_command): Adjust to std::string.
(delete_trace_variable_command): Likewise.
(tvariables_info_1): Adjust to std::vector.
(save_trace_state_variables): Likewise.
(start_tracing): Likewise.
(merge_uploaded_trace_state_variables): Adjust to std::vector
and std::string.
* target.h (struct target_ops)
<to_download_trace_state_variable>: Pass reference to
trace_state_variable.
* target-debug.h (target_debug_print_const_trace_state_variable_r): New.
* target-delegates.c: Re-generate.
* mi/mi-interp.c (mi_tsv_created): Adjust to std::string.
(mi_tsv_deleted): Likewise.
* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
* remote.c (remote_download_trace_state_variable): Change
pointer to reference and adjust.
* make-target-delegates (parse_argtypes): Handle references.
(write_function_header): Likewise.
(munge_type): Likewise.

6 years agoAdapt and integrate string_view tests
Simon Marchi [Mon, 9 Apr 2018 17:31:06 +0000 (13:31 -0400)]
Adapt and integrate string_view tests

The previous patch copied the string_view tests from libstdc++.  This
patch adjusts them in a similar way that the libstdc++ optional tests
are integrated in our unit test suite.

Not all tests are used, some of them require language features not
present in c++11.  For example, we can't use a string_view constructor
where the length is not explicit in a constexpr, because
std::char_traits::length is not a constexpr itself (it is in c++17
though).  Nevertheless, a good number of tests are integrated, which
covers pretty well the string_view features.

gdb/ChangeLog:

* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
string_view-selftests.c.
* unittests/basic_string_view/capacity/1.cc: Adapt to GDB
testsuite.
* unittests/basic_string_view/cons/char/1.cc: Likewise.
* unittests/basic_string_view/cons/char/2.cc: Likewise.
* unittests/basic_string_view/cons/char/3.cc: Likewise.
* unittests/basic_string_view/element_access/char/1.cc:
Likewise.
* unittests/basic_string_view/element_access/char/empty.cc:
Likewise.
* unittests/basic_string_view/element_access/char/front_back.cc:
Likewise.
* unittests/basic_string_view/inserters/char/2.cc: Likewise.
* unittests/basic_string_view/modifiers/remove_prefix/char/1.cc:
Likewise.
* unittests/basic_string_view/modifiers/remove_suffix/char/1.cc:
Likewise.
* unittests/basic_string_view/modifiers/swap/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/compare/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/compare/char/13650.cc:
Likewise.
* unittests/basic_string_view/operations/copy/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/data/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/2.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/3.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/4.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/2.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/3.cc:
Likewise.
* unittests/basic_string_view/operations/substr/char/1.cc:
Likewise.
* unittests/basic_string_view/operators/char/2.cc: Likewise.
* unittests/string_view-selftests.c: New file.

6 years agoCopy string_view tests from libstdc++
Simon Marchi [Mon, 9 Apr 2018 17:31:05 +0000 (13:31 -0400)]
Copy string_view tests from libstdc++

This patch copies the string_view tests from the gcc repository (commit
02a4441f002c).

  ${gcc}/libstdc++-v3/testsuite/21_strings/basic_string_view ->
    ${binutils-gdb}/gdb/unittests/basic_string_view

The local modifications are done in the following patch, so that it's
easier to review them.

gdb/ChangeLog:

* unittests/basic_string_view/capacity/1.cc: New file.
* unittests/basic_string_view/capacity/empty_neg.cc: New file.
* unittests/basic_string_view/cons/char/1.cc: New file.
* unittests/basic_string_view/cons/char/2.cc: New file.
* unittests/basic_string_view/cons/char/3.cc: New file.
* unittests/basic_string_view/cons/wchar_t/1.cc: New file.
* unittests/basic_string_view/cons/wchar_t/2.cc: New file.
* unittests/basic_string_view/cons/wchar_t/3.cc: New file.
* unittests/basic_string_view/element_access/char/1.cc: New file.
* unittests/basic_string_view/element_access/char/2.cc: New file.
* unittests/basic_string_view/element_access/char/empty.cc: New file.
* unittests/basic_string_view/element_access/char/front_back.cc: New file.
* unittests/basic_string_view/element_access/wchar_t/1.cc: New file.
* unittests/basic_string_view/element_access/wchar_t/2.cc: New file.
* unittests/basic_string_view/element_access/wchar_t/empty.cc: New file.
* unittests/basic_string_view/element_access/wchar_t/front_back.cc: New file.
* unittests/basic_string_view/include.cc: New file.
* unittests/basic_string_view/inserters/char/1.cc: New file.
* unittests/basic_string_view/inserters/char/2.cc: New file.
* unittests/basic_string_view/inserters/char/3.cc: New file.
* unittests/basic_string_view/inserters/pod/10081-out.cc: New file.
* unittests/basic_string_view/inserters/wchar_t/1.cc: New file.
* unittests/basic_string_view/inserters/wchar_t/2.cc: New file.
* unittests/basic_string_view/inserters/wchar_t/3.cc: New file.
* unittests/basic_string_view/literals/types.cc: New file.
* unittests/basic_string_view/literals/values.cc: New file.
* unittests/basic_string_view/modifiers/remove_prefix/char/1.cc: New file.
* unittests/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc: New file.
* unittests/basic_string_view/modifiers/remove_suffix/char/1.cc: New file.
* unittests/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc: New file.
* unittests/basic_string_view/modifiers/swap/char/1.cc: New file.
* unittests/basic_string_view/modifiers/swap/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/compare/char/1.cc: New file.
* unittests/basic_string_view/operations/compare/char/13650.cc: New file.
* unittests/basic_string_view/operations/compare/char/2.cc: New file.
* unittests/basic_string_view/operations/compare/char/70483.cc: New file.
* unittests/basic_string_view/operations/compare/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/compare/wchar_t/13650.cc: New file.
* unittests/basic_string_view/operations/compare/wchar_t/2.cc: New file.
* unittests/basic_string_view/operations/copy/char/1.cc: New file.
* unittests/basic_string_view/operations/copy/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/data/char/1.cc: New file.
* unittests/basic_string_view/operations/data/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/find/char/1.cc: New file.
* unittests/basic_string_view/operations/find/char/2.cc: New file.
* unittests/basic_string_view/operations/find/char/3.cc: New file.
* unittests/basic_string_view/operations/find/char/4.cc: New file.
* unittests/basic_string_view/operations/find/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/find/wchar_t/2.cc: New file.
* unittests/basic_string_view/operations/find/wchar_t/3.cc: New file.
* unittests/basic_string_view/operations/find/wchar_t/4.cc: New file.
* unittests/basic_string_view/operations/rfind/char/1.cc: New file.
* unittests/basic_string_view/operations/rfind/char/2.cc: New file.
* unittests/basic_string_view/operations/rfind/char/3.cc: New file.
* unittests/basic_string_view/operations/rfind/wchar_t/1.cc: New file.
* unittests/basic_string_view/operations/rfind/wchar_t/2.cc: New file.
* unittests/basic_string_view/operations/rfind/wchar_t/3.cc: New file.
* unittests/basic_string_view/operations/string_conversion/1.cc: New file.
* unittests/basic_string_view/operations/substr/char/1.cc: New file.
* unittests/basic_string_view/operations/substr/wchar_t/1.cc: New file.
* unittests/basic_string_view/operators/char/2.cc: New file.
* unittests/basic_string_view/operators/wchar_t/2.cc: New file.
* unittests/basic_string_view/range_access/char/1.cc: New file.
* unittests/basic_string_view/range_access/wchar_t/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/char/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc: New file.
* unittests/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc: New file.
* unittests/basic_string_view/requirements/typedefs.cc: New file.
* unittests/basic_string_view/typedefs.cc: New file.
* unittests/basic_string_view/types/1.cc: New file.

6 years agoAdd gdb::string_view
Simon Marchi [Mon, 9 Apr 2018 17:31:04 +0000 (13:31 -0400)]
Add gdb::string_view

We had a few times the need for a data structure that does essentially
what C++17's std::string_view does, which is to give an std::string-like
interface (only the read-only operations) to an arbitrary character
buffer.

This patch adapts the files copied from libstdc++ by the previous patch
to integrate them with GDB.  Here's a summary of the changes:

  * Remove things related to wstring_view, u16string_view and
  u32string_view (I don't think we need them, but we can always add them
  later).

  * Remove usages of _GLIBCXX_BEGIN_NAMESPACE_VERSION and
  _GLIBCXX_END_NAMESPACE_VERSION.

  * Put the code in the gdb namespace.  I had to add a few "std::" in
  front of std type usages.

  * Change __throw_out_of_range_fmt() for error().

  * Make gdb::string_view an alias of std::string_view when building
  with >= c++17.

  * Remove a bunch of constexpr, because they are not valid in c++11
  (e.g. they are not a single return line).

  * Use std::common_type<_Tp>::type instead of std::common_type_t<_Tp>,
  because c++11 doesn't have the later.

  * Remove the #pragma GCC system_header, since that silences some
  warnings that we might want to have if we're doing something not
  correctly.

  * Remove operator ""sv.  It would need a lot of work to make all
  supported compilers happy, and we can easily live without it.

  * Remove operator<<.  It is implemented using __ostream_insert (a
  libstdc++ internal).  Bringing it in might be possible, but I don't
  think that would be worth the effort, since we don't really use
  streams at the moment.

  * Replace internal libstdc++ asserts ( __glibcxx_assert and
  __glibcxx_requires_string_len) with gdb_assert.

  * Remove hash helpers, because they use libstdc++ internal functions.
  If we need them we always import them later.

The string_view class in cli/cli-script.c is removed and its usage
replaced with the new gdb::string_view.

gdb/ChangeLog:

* common/gdb_string_view.h: Remove libstdc++ implementation
details, adjust to gdb reality.
* common/gdb_string_view.tcc: Likewise.
* cli/cli-script.c (struct string_view): Remove.
(user_args) <m_args>: Change element type to gdb::string_view.
(user_args::insert_args): Adjust.

6 years agoCopy string_view files from libstdc++
Simon Marchi [Mon, 9 Apr 2018 17:31:04 +0000 (13:31 -0400)]
Copy string_view files from libstdc++

This patch copies the following files from libstdc++ (commit
02a4441f002c):

  ${gcc}/libstdc++-v3/include/experimental/string_view
    -> ${binutils-gdb}/gdb/common/gdb_string_view.h

  ${gcc}/libstdc++-v3/include/experimental/bits/string_view.tcc
    -> ${binutils-gdb}/gdb/common/gdb_string_view.tcc

The local modifications are done in the following patch in order to make
it easier to review them.

gdb/ChangeLog:

* common/gdb_string_view.h: New file.
* common/gdb_string_view.tcc: New file.

6 years agoUpdate ax_cv_cxx_compile_cxx.m4
Simon Marchi [Mon, 9 Apr 2018 17:31:03 +0000 (13:31 -0400)]
Update ax_cv_cxx_compile_cxx.m4

This file provides the AX_CXX_COMPILE_STDCXX macro.  In the context of
the following patch, I wanted to build and test GDB in c++17 mode.  The
version of the macro we have in the repo does not support detecting
c++17 compilers, but the upstream version has been updated to do so.

Since we have local modifications to the file, I had to reconcile our
modifications and the updated upstream version (which was relatively
straightforward).

gdb/ChangeLog:

* ax_cxx_compile_stdcxx.m4: Sync with upstream.
* configure: Re-generate.

6 years agoRegenerate some files
Alan Modra [Mon, 9 Apr 2018 09:22:11 +0000 (18:52 +0930)]
Regenerate some files

The gold change is to pick up HJ's PR22318 AC_PLUGINS update.  The
ld change is to correct a file I generated from a modified tree.

gold/
* configure: Regenerate.
ld/
* po/BLD-POTFILES.in: Regenerate.

6 years agoApply "Convert observers to C++" edit to gdbarch.sh
Pedro Alves [Mon, 9 Apr 2018 14:34:48 +0000 (15:34 +0100)]
Apply "Convert observers to C++" edit to gdbarch.sh

Regenerating gdbarch.c results in:

  --- gdbarch.c   2018-03-26 23:18:52.905548891 +0100
  +++ new-gdbarch.c       2018-04-09 15:32:30.006712207 +0100
  @@ -44,7 +44,7 @@
   #include "reggroups.h"
   #include "osabi.h"
   #include "gdb_obstack.h"
  -#include "observable.h"
  +#include "observer.h"
   #include "regcache.h"
   #include "objfiles.h"
   #include "auxv.h"
  @@ -5457,7 +5457,7 @@
     gdb_assert (new_gdbarch != NULL);
     gdb_assert (new_gdbarch->initialized_p);
     current_inferior ()->gdbarch = new_gdbarch;
  -  gdb::observers::architecture_changed.notify (new_gdbarch);
  +  observer_notify_architecture_changed (new_gdbarch);
     registers_changed ();
   }

Clearly commit 76727919ceb5 ("Convert observers to C++") edited
gdbarch.c directly instead of gdbarch.sh.  This fixes it.

gdb/ChangeLog:
2018-04-09  Pedro Alves  <palves@redhat.com>

* gdbarch.sh: Include "observable.h" instead of "observer.h".
(set_target_gdbarch): Call
gdb::observers::architecture_changed.notify instead of
observer_notify_architecture_changed.

6 years agobinutils/testsuite: Fix a crash with STN_UNDEF in relocation
Maciej W. Rozycki [Mon, 9 Apr 2018 12:42:01 +0000 (13:42 +0100)]
binutils/testsuite: Fix a crash with STN_UNDEF in relocation

Verify that `strip' completes successfully and a correct relocation
entry is copied for a relocation encountered with the STN_UNDEF symbol
index.

binutils/
* testsuite/binutils-all/strip-15.d: New test.
* testsuite/binutils-all/strip-15rel.s: New test source.
* testsuite/binutils-all/strip-15rela.s: New test source.
* testsuite/binutils-all/strip-15mips64.s: New test source.
* testsuite/binutils-all/objcopy.exp: Run the new test.

6 years agoMIPS64/BFD: Fix a crash with STN_UNDEF in relocation
Maciej W. Rozycki [Mon, 9 Apr 2018 12:42:00 +0000 (13:42 +0100)]
MIPS64/BFD: Fix a crash with STN_UNDEF in relocation

Prevent a null BFD pointer dereference and a resulting segmentation
fault in `mips_elf64_write_rel' or `mips_elf64_write_rela':

Program received signal SIGSEGV, Segmentation fault.
0x0000000000437690 in mips_elf64_write_rela (abfd=0x71e130, sec=0x720700,
    rela_hdr=0x721ff8, count=0x7fffffffb82c, data=0x7fffffffb88c)
    at .../bfd/elf64-mips.c:4123
4123       if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
4124   && ! _bfd_elf_validate_reloc (abfd, ptr))

in the MIPS64 (n64 MIPS) ELF backend whenever the STN_UNDEF symbol index
is retrieved from the `r_sym' field of a relocation seen in input while
running `objcopy' or `strip'.  The reason for the null BFD pointer is
that internally in BFD an STN_UNDEF symbol reference resolves to an
absolute zero symbol that does not have a BFD associated.  Check the
pointer then before using it, like the generic ELF backend does in
`elf_write_relocs'.

This complements the same change made for generic ELF bundled with:

commit e35765a9a2eaff0df62757f3e6480c8ba5ab8ee8
Author: Ian Lance Taylor <ian@airs.com>
Date:   Sun Dec 15 19:59:18 1996 +0000

which (obviously due to a CVS -> GIT repository conversion inaccuracy)
seems to be one corresponding to this ChangeLog entry:

* elfcode.h (write_relocs): Handle absolute symbol.

from:

commit c86158e591edd8450f49f8cd75f82e4313d4b6d8
Author: Ian Lance Taylor <ian@airs.com>
Date:   Fri Aug 30 22:09:51 1996 +0000

("Add SH ELF support."), which also updated RELA only and not REL (which
has been since fixed with: commit 947216bf8f34 ("ELF reloc code tidy"),
<https://sourceware.org/ml/binutils/2002-11/msg00727.html>).

bfd/
* elf64-mips.c (mips_elf64_write_rel): Handle a NULL BFD pointer
in the BFD symbol referred by the relocation.
(mips_elf64_write_rela): Likewise.

6 years agobinutils/testsuite: Verify the handling of invalid `r_sym' in relocation
Maciej W. Rozycki [Mon, 9 Apr 2018 12:42:00 +0000 (13:42 +0100)]
binutils/testsuite: Verify the handling of invalid `r_sym' in relocation

Verify that `strip' terminates gracefully and a correct error message is
produced for a relocation encountered with an invalid symbol index.  No
single relocation number is valid across all targets we support, so pick
a few numbers to choose from depending on the target.

binutils/
* testsuite/binutils-all/strip-14.d: New test.
* testsuite/binutils-all/strip-14rel.s: New test source.
* testsuite/binutils-all/strip-14rela.s: New test source.
* testsuite/binutils-all/strip-14mips64.s: New test source.
* testsuite/binutils-all/objcopy.exp: Run the new test.

6 years agoMIPS64/BFD: Fix a crash with invalid `r_sym' in relocation
Maciej W. Rozycki [Mon, 9 Apr 2018 12:42:00 +0000 (13:42 +0100)]
MIPS64/BFD: Fix a crash with invalid `r_sym' in relocation

Prevent an out-of-range access and a possible segmentation fault in
`mips_elf64_slurp_one_reloc_table':

Program received signal SIGSEGV, Segmentation fault.
mips_elf64_slurp_one_reloc_table (abfd=0x71bd90, asect=0x71cf70,
    rel_hdr=<value optimized out>, reloc_count=1,
    relents=<value optimized out>, symbols=0x7218c0, dynamic=0)
    at .../bfd/elf64-mips.c:3758
3757       ps = symbols + rela.r_sym - 1;
3758       s = *ps;

in the MIPS64 (n64 MIPS) ELF backend whenever an invalid symbol index is
retrieved from the `r_sym' field of a relocation seen in input while
running `objcopy' or `strip'.  Issue an error instead, like the generic
ELF backend does, taking code from `elf_slurp_reloc_table_from_section',
except for relocation types that do not refer to a symbol.

This complements commit 1f70368c21a8 ("Stop objdump crash on corrupt
reloc table"), <https://sourceware.org/ml/binutils/2002-09/msg00332.html>,
and commit 05a487dc8c39 ("make check fails on i686-linux-gnu"),
<https://sourceware.org/ml/binutils/2002-09/msg00340.html>, where the
generic ELF backend code comes from.

bfd/
* elf64-mips.c (mips_elf64_slurp_one_reloc_table): Issue an
error for out-of-range `r_sym' values.

6 years agoInline PLT call optimization
Alan Modra [Mon, 9 Apr 2018 00:02:39 +0000 (09:32 +0930)]
Inline PLT call optimization

This patch adds the analysis part of PLT call optimization, enabling
the code added with the previous patch that actually performs the
optimization.

Gold support is not available yet.

bfd/
* elf64-ppc.c (struct _ppc64_elf_section_data): Add has_pltcall field.
(struct ppc_link_hash_table): Add can_convert_all_inline_plt.
(ppc64_elf_check_relocs): Set has_pltcall.
(ppc64_elf_adjust_dynamic_symbol): Discard some PLT entries.
(ppc64_elf_inline_plt): New function.
(ppc64_elf_size_dynamic_sections): Discard some PLT entries for locals.
* elf64-ppc.h (ppc64_elf_inline_plt): Declare.
* elf32-ppc.c (has_pltcall): Define.
(struct ppc_elf_link_hash_table): Add can_convert_all_inline_plt.
(ppc_elf_check_relocs): Set has_pltcall.
(ppc_elf_inline_plt): New function.
(ppc_elf_adjust_dynamic_symbol): Discard some PLT entries.
(ppc_elf_size_dynamic_sections): Likewise.
* elf32-ppc.h (ppc_elf_inline_plt): Declare.
ld/
* emultempl/ppc64elf.em (no_inline_plt): New var.
(ppc_before_allocation): Call ppc64_elf_inline_plt.
(enum ppc64_opt): Add OPTION_NO_INLINE_OPT.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS,
PARSE_AND_LIST_ARGS_CASES): Handle --no-inline-optimize.
* emultemps/ppc32elf.em (no_inline_opt): New var.
(prelim_size_sections): New function, extracted from..
(ppc_before_allocation): ..here.  Call ppc_elf_inline_plt.
(enum ppc32_opt): Add OPTION_NO_INLINE_OPT.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS,
PARSE_AND_LIST_ARGS_CASES): Handle --no-inline-optimize.

6 years agoPowerPC inline PLT call support
Alan Modra [Sun, 8 Apr 2018 23:55:10 +0000 (09:25 +0930)]
PowerPC inline PLT call support

In addition to the existing relocs we need two more to mark all
instructions in the call sequence, PLTCALL on the call itself (plus
the toc restore insn for ppc64), and PLTSEQ on others.  All
relocations in a particular sequence have the same symbol.

Example ppc64 ELFv2 assembly:
 .reloc .,R_PPC64_PLTSEQ,puts
std 2,24(1)
addis 12,2,puts@plt@ha # .reloc .,R_PPC64_PLT16_HA,puts
ld 12,puts@plt@l(12) # .reloc .,R_PPC64_PLT16_LO_DS,puts
 .reloc .,R_PPC64_PLTSEQ,puts
mtctr 12
 .reloc .,R_PPC64_PLTCALL,puts
bctrl
ld 2,24(1)

Example ppc32 -fPIC assembly:
addis 12,30,puts+32768@plt@ha # .reloc .,R_PPC_PLT16_HA,puts+0x8000
lwz 12,12,puts+32768@plt@l    # .reloc .,R_PPC_PLT16_LO,puts+0x8000
 .reloc .,R_PPC_PLTSEQ,puts+32768
mtctr 12
 .reloc .,R_PPC_PLTCALL,puts+32768
bctrl

Marking sequences like this allows the linker to convert them to nops
and a direct call if the target symbol turns out to be local.

When the call is __tls_get_addr, each relocation shown above is paired
with an R_PPC*_TLSLD or R_PPC*_TLSGD reloc to additionally mark the
sequence for possible TLS optimization.  The TLSLD or TLSGD relocs are
emitted first.

include/
* elf/ppc.h (R_PPC_PLTSEQ, R_PPC_PLTCALL): Define.
* elf/ppc64.h (R_PPC64_PLTSEQ, R_PPC64_PLTCALL): Define.
bfd/
* elf32-ppc.c (ppc_elf_howto_raw): Add PLTSEQ and PLTCALL howtos.
(is_plt_seq_reloc): New function.
(ppc_elf_check_relocs): Handle PLTSEQ and PLTCALL relocs.
(ppc_elf_tls_optimize): Handle inline plt call sequence.
(ppc_elf_relax_section): Handle PLTCALL reloc.
(ppc_elf_relocate_section): Nop out inline plt call sequence when
resolving locally.
* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_PLTSEQ and
R_PPC64_PLTCALL entries.  Comment R_PPC64_TOCSAVE.
(has_tls_get_addr_call): Correct comment.
(is_branch_reloc): Add PLTCALL.
(is_plt_seq_reloc): New function.
(ppc64_elf_check_relocs): Handle PLT16_LO_DS reloc.  Set
has_tls_reloc for R_PPC64_TLSGD and R_PPC64_TLSLD.  Create plt
entry for R_PPC64_PLTCALL.
(ppc64_elf_tls_optimize): Handle inline plt call sequence.
(ppc_type_of_stub): Handle PLTCALL reloc.
(toc_adjusting_stub_needed): Likewise.
(ppc64_elf_relocate_section): Set "can_plt_call" for PLTCALL
reloc insn.  Nop out inline plt call sequence when resolving
locally.  Handle __tls_get_addr inline plt call optimization.
elfcpp/
* powerpc.h (R_POWERPC_PLTSEQ, R_POWERPC_PLTCALL): Define.
gold/
* powerpc.cc (Target_powerpc::Track_tls::maybe_skip_tls_get_addr_call):
Handle inline plt sequence relocs.
(Stub_table::Plt_stub_key::Plt_stub_key): Likewise.
(Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Likewise.
(Target_powerpc::Relocate::relocate): Likewise.

6 years agoSupport PLT16 relocs against local symbols
Alan Modra [Sun, 8 Apr 2018 23:52:53 +0000 (09:22 +0930)]
Support PLT16 relocs against local symbols

Necessary if gcc is to use PLT16 relocs to implement -mlongcall, and
there isn't a good technical reason why local symbols should be
excluded from PLT16 support.  Non-ifunc local symbol PLT entries go in
a separate section to other PLT entries.  In a fixed position
executable they won't need to be relocated, and in a PIE or shared
library I chose to not implement lazy relocation.

bfd/
* elf64-ppc.c (LOCAL_PLT_ENTRY_SIZE): Define.
(struct ppc_stub_hash_entry): Add symtype field.
(PLT_KEEP): Define.
(struct ppc_link_hash_table): Add pltlocal and relpltlocal.
(create_linkage_sections): Create pltlocal and relpltlocal.
(ppc64_elf_check_relocs): Allow PLT relocs on local symbols.
Set PLT_KEEP.
(ppc64_elf_adjust_dynamic_symbol): Keep PLT entries for inline calls.
(allocate_dynrelocs): Allocate pltlocal and relpltlocal.
(ppc64_elf_size_dynamic_sections): Size pltlocal and relpltlocal.
Keep PLT entries for inline calls against locals.
(ppc_build_one_stub): Use pltlocal as appropriate.
(ppc_size_one_stub): Likewise.
(ppc64_elf_size_stubs): Set symtype.
(build_global_entry_stubs_and_plt): Init pltlocal and write
relpltlocal for globals.
(write_plt_relocs_for_local_syms): Likewise for local syms.
(ppc64_elf_relocate_section): Support PLT for local syms.
* elf32-ppc.c (PLT_KEEP): Define.
(struct ppc_elf_link_hash_table): Add pltlocal and relpltlocal.
(ppc_elf_create_glink): Create pltlocal and relpltlocal.
(ppc_elf_check_relocs): Allow PLT relocs on local symbols.
Set PLT_KEEP.  Adjust update_local_sym_info call.
(ppc_elf_adjust_dynamic_symbol): Keep PLT entries for inline calls.
(allocate_dynrelocs): Allocate pltlocal and relpltlocal.
(ppc_elf_size_dynamic_sections): Size pltlocal and relpltlocal.
(ppc_elf_relocate_section): Support PLT16 relocs for local syms.
(write_global_sym_plt): Init pltlocal and write relpltlocal.
(ppc_finish_symbols): Likewise for locals.
ld/
* emulparams/elf32ppc.sh (OTHER_RELRO_SECTIONS_2): Add .branch_lt.
(OTHER_GOT_RELOC_SECTIONS): Add .rela.branch_lt.
* testsuite/ld-powerpc/elfv2so.d: Update for symbol/stub reordering.
* testsuite/ld-powerpc/relbrlt.d: Likewise.
* testsuite/ld-powerpc/relbrlt.s: Likewise.
* testsuite/ld-powerpc/tlsso.r: Likewise.
* testsuite/ld-powerpc/tlstocso.r: Likewise.
gold/
* powerpc.cc (Target_powerpc::lplt_): New variable.
(Target_powerpc::lplt_section): Associated accessor.
(Target_powerpc::plt_off): Handle local non-ifunc symbols.
(Target_powerpc::make_lplt_section): New function.
(Target_powerpc::make_local_plt_entry): New function.
(Powerpc_relobj::do_relocate_sections): Write out lplt.
(Output_data_plt_powerpc::first_plt_entry_offset): Zero for lplt.
(Output_data_plt_powerpc::add_local_entry): New function.
(Output_data_plt_powerpc::do_write): Ignore lplt.
(Target_powerpc::make_iplt_section): Make lplt first.
(Target_powerpc::make_brlt_section): Make .branch_lt relro.
(Target_powerpc::Scan::local): Handle PLT16 relocs.

6 years agoRearrange PLT reloc output on powerpc
Alan Modra [Sun, 8 Apr 2018 23:51:59 +0000 (09:21 +0930)]
Rearrange PLT reloc output on powerpc

The current scheme where we output PLT relocs for global symbols in
finish_dynamic_symbol, and PLT relocs for local symbols when
outputting stubs does not work if PLT entries are to be used for
inline PLT sequences against non-dynamic globals or local symbols.

bfd/
* elf64-ppc.c (ppc_build_one_stub): Move output of PLT relocs
for local symbols to..
(write_plt_relocs_for_local_syms): ..here.  New function.
(ppc64_elf_finish_dynamic_symbol): Move output of PLT relocs for
global symbols to..
(build_global_entry_stubs_and_plt): ..here.  Rename from
build_global_entry_stubs.
(ppc64_elf_build_stubs): Always call build_global_entry_stubs_and_plt.
Call write_plt_relocs_for_local_syms.
* elf32-ppc.c (get_sym_h): New function.
(ppc_elf_relax_section): Use get_sym_h.
(ppc_elf_relocate_section): Move output of PLT relocs and glink
stubs for local symbols to..
(ppc_finish_symbols): ..here.  New function.
(ppc_elf_finish_dynamic_symbol): Move output of PLT relocs for
global syms to..
(write_global_sym_plt): ..here.  New function.
* elf32-ppc.h (ppc_elf_modify_segment_map): Delete attribute.
(ppc_finish_symbols): Declare.
ld/
* ppc32elf.em (ppc_finish): Call ppc_finish_symbols.

6 years agoPowerPC PLT16 relocations
Alan Modra [Sun, 8 Apr 2018 23:51:10 +0000 (09:21 +0930)]
PowerPC PLT16 relocations

The PowerPC64 ELFv2 ABI and the PowerPC SysV ABI support a number of
relocations that can be used to create and access a PLT entry.
However, the relocs are not well defined.  The PLT16 family of relocs
talk about "the section offset or address of the procedure linkage
table entry".  It's plain that we do need a relative address when PIC
as otherwise we'd have dynamic text relocations, but "section offset"
doesn't specify which section.  The most obvious one, ".plt", isn't
that useful because there is no readily available way of addressing
the start of the ".plt" section.  Much more useful would be "the
GOT/TOC-pointer relative offset of the procedure linkage table entry",
and I suppose you could argue that is a "section offset" of sorts.
For PowerPC64 it is better to use the same TOC-pointer relative
addressing even when non-PIC, since ".plt" may be located outside the
range of a 32-bit address.  However, for ppc32 we do want an absolute
address when non-PIC as a GOT pointer may not be set up.  Also, for
ppc32 PIC we have a similar situation to R_PPC_PLTREL24 in that the
GOT pointer is set to a location in the .got2 section and we need to
specify the .got2 offset in the PLT16 reloc addend.

This patch supports PLT16 relocations using these semantics.  This is
not an ABI change for ppc32 since the relocations were not previously
supported by GNU ld, but is for ppc64 where some of the PLT16 relocs
were supported.  I'm not particularly concerned since the old ppc64
PLT16 reloc semantics made them almost completely useless.

bfd/
* elf32-ppc.c (ppc_elf_check_relocs): Handle PLT16 relocs.
(ppc_elf_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_check_relocs): Handle PLT16_LO_DS.
(ppc64_elf_relocate_section): Likewise.  Correct PLT16
resolution to plt entry relative to toc pointer.
gold/
* powerpc.cc (Target_powerpc::plt_off): New functions.
(is_plt16_reloc): New function.
(Stub_table::plt_off): Use Target_powerpc::plt_off.
(Stub_table::plt_call_size): Use plt_off.
(Stub_table::do_write): Likewise.
(Target_powerpc::Scan::get_reference_flags): Return RELATIVE_REF
for PLT16 relocations.
(Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Return true
for PLT16 relocations.
(Target_powerpc::Scan::global): Make a PLT entry for PLT16 relocations.
(Target_powerpc::Relocate::relocate): Support PLT16 relocations.
(Powerpc_scan_relocatable_reloc::global_strategy): Return RELOC_SPECIAL
for ppc32 plt16 relocs.

6 years agoPowerPC indirect calls to __tls_get_addr
Alan Modra [Sun, 8 Apr 2018 23:41:44 +0000 (09:11 +0930)]
PowerPC indirect calls to __tls_get_addr

It is possible to construct indirect calls to __tls_get_addr in
assembly that confuse TLS optimization.  (PowerPC gcc doesn't support
such calls, ignoring -mlongcall for __tls_get_addr.)  This patch fixes
the problem by requiring a TLSLD or TLSGD marker reloc before any insn
in an indirect call to __tls_get_addr will be optimized.  They also
need additional marker relocs defined in a later patch, so don't
expect the optimization to work just yet.  The point here is to
prevent mis-optimization of indirect calls without any marker relocs.

The presense of a marker reloc is tracked by a new bit in the tls_mask
field of ppc_link_hash_entry and the corresponding lgot_masks unsigned
char array for local symbols.  Since the field is only 8 bits, we've
run out of space.  However, tracking TLS use for variables, and
tracking IFUNC for functions are independent, and bits can be reused.
TLS_TLS is always set for TLS usage, so can be used to select the
meaning of the other bits.  This patch does that even for elf32-ppc.c
which hasn't yet run out of space in the field.

* elf64-ppc.c (TLS_TLS, TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL,
TLS_TPRELGD, TLS_EXPLICIT):  Renumber.  Test TLS_TLS throughout
file when other TLS flags are tested in a mask.
(TLS_MARK, NON_GOT): Define.
(PLT_IFUNC): Redefine, and test TLS_TLS throughout file as well.
(update_local_sym_info): Don't create got entry when NON_GOT.
(ppc64_elf_check_relocs): Pass NON_GOT with PLT_IFUNC.
Set TLS_MARK.
(get_tls_mask): Do toc lookup if tls_mask is just TLS_MARK.
(ppc64_elf_relocate_section): Likewise.
(ppc64_elf_tls_optimize): Don't attempt to optimize indirect
__tls_get_addr calls lacking a marker reloc.
* elf32-ppc.c (TLS_TLS, TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL,
TLS_TPRELGD): Renumber.  Update comment.
(TLS_MARK, NON_GOT): Define.
(PLT_IFUNC): Redefine, and test TLS_TLS throughout file as well.
(update_local_sym_info): Don't create got entry when NON_GOT.
(ppc_elf_check_relocs): Pass NON_GOT with PLT_IFUNC.
Set TLS_MARK.
(ppc_elf_tls_optimize): Don't attempt to optimize indirect
__tls_get_addr calls lacking a marker reloc.

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

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

6 years agoFix gdb.mi/mi-stack.exp when gcc generates a stack protector
Simon Marchi [Sat, 7 Apr 2018 18:08:56 +0000 (14:08 -0400)]
Fix gdb.mi/mi-stack.exp when gcc generates a stack protector

I see some failures in the gdb.mi/mi-stack.exp test.  The test runs to
the callee4 function:

  int callee4 (void)
  {
    int A=1;
    int B=2;
    int C;
    int D[3] = {0, 1, 2};

    C = A + B;
    return 0;
  }

and expects to be stopped at the A=1 line.  However, when gcc generates
some stack protection code, it will stop at the { instead, as shown by
this disassembly (after I did "break callee4" and "run"):

  (gdb) disassemble /s
  Dump of assembler code for function callee4:
  /home/simark/src/binutils-gdb/gdb/testsuite/gdb.mi/mi-stack.c:
  26 {
     0x00005555555546ca <+0>: push   %rbp
     0x00005555555546cb <+1>: mov    %rsp,%rbp
     0x00005555555546ce <+4>: sub    $0x20,%rsp
  => 0x00005555555546d2 <+8>: mov    %fs:0x28,%rax
     0x00005555555546db <+17>: mov    %rax,-0x8(%rbp)
     0x00005555555546df <+21>: xor    %eax,%eax

  27   int A=1; /* callee4 begin */
     0x00005555555546e1 <+23>: movl   $0x1,-0x20(%rbp)

  28   int B=2;
     0x00005555555546e8 <+30>: movl   $0x2,-0x1c(%rbp)

The rest of the test relies on execution stopping on the A=1, so many things
fail after that.  This patch uses mi_continue_to_line instead, to stop at the
A=1 line precisely.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-stack.exp (test_stack_frame_listing): Use
mi_continue_to_line.
* gdb.mi/mi-stack.c (callee4): Add comment.

6 years agoFix indentation in gdb.mi/mi-stack.exp
Simon Marchi [Sat, 16 Dec 2017 14:56:50 +0000 (09:56 -0500)]
Fix indentation in gdb.mi/mi-stack.exp

This patch fixes the indentation in gdb.mi/mi-stack.exp, which is a bit
inconsistent.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-stack.exp: Fix indentation.

6 years agoReplace make_cleanup_restore_current_traceframe with RAII class
Simon Marchi [Sat, 7 Apr 2018 18:03:12 +0000 (14:03 -0400)]
Replace make_cleanup_restore_current_traceframe with RAII class

I put the constructor in tracepoint.c because it needs to read
traceframe_number, and I prefer to do that than to expose
traceframe_number.

gdb/ChangeLog:

* tracepoint.c (struct current_traceframe_cleanup): Remove.
(do_restore_current_traceframe_cleanup): Remove.
(restore_current_traceframe_cleanup_dtor): Remove.
(make_cleanup_restore_current_traceframe): Remove.
(scoped_restore_current_traceframe::scoped_restore_current_traceframe):
New.
* tracepoint.h (struct scoped_restore_current_traceframe): New.
* infrun.c (fetch_inferior_event): Use
scoped_restore_current_traceframe.

6 years agoMake dwarf2_per_objfile::all_type_units an std::vector
Simon Marchi [Sat, 7 Apr 2018 17:53:44 +0000 (13:53 -0400)]
Make dwarf2_per_objfile::all_type_units an std::vector

Make all_type_units an std::vector, remove
n_type_units/n_allocated_type_units and some manual memory management.

gdb/ChangeLog:

* dwarf2read.h (struct dwarf2_per_objfile) <n_type_units>:
Remove.
<n_allocated_type_units>: Remove.
<all_type_units>: Change to std::vector.
* dwarf2read.c (dwarf2_per_objfile::~dwarf2_per_objfile): Adjust
to std::vector change.
(dwarf2_per_objfile::get_cutu): Likewise.
(dwarf2_per_objfile::get_tu): Likewise.
(create_signatured_type_table_from_index): Likewise.
(create_signatured_type_table_from_debug_names): Likewise.
(dw2_symtab_iter_next): Likewise.
(dw2_print_stats): Likewise.
(dw2_expand_all_symtabs): Likewise.
(dw2_expand_marked_cus): Likewise.
(dw2_debug_names_iterator::next): Likewise.
(dwarf2_initialize_objfile): Likewise.
(add_signatured_type_cu_to_table): Likewise.
(create_all_type_units): Likewise.
(add_type_unit): Likewise.
(struct tu_abbrev_offset): Add constructor.
(build_type_psymtabs_1): Adjust to std::vector change.
(print_tu_stats): Likewise.
* dwarf-index-write.c (check_dwarf64_offsets): Likewise.
(write_debug_names): Likewise.

6 years agoMake dwarf2_per_objfile::all_comp_units an std::vector
Simon Marchi [Sat, 7 Apr 2018 17:53:43 +0000 (13:53 -0400)]
Make dwarf2_per_objfile::all_comp_units an std::vector

Make all_comp_units an std::vector, remove n_comp_units and some manual
memory management.

gdb/ChangeLog:

* dwarf2read.h (struct dwarf2_per_objfile) <all_comp_units>: Likewise.
Make an std::vector.
<n_comp_units>: Remove.
* dwarf2read.c (dwarf2_per_objfile::~dwarf2_per_objfile): Adjust
to std::vector change.
(dwarf2_per_objfile::get_cutu): Likewise.
(dwarf2_per_objfile::get_cu): Likewise.
(create_cus_from_index): Likewise.
(create_addrmap_from_index): Likewise.
(create_addrmap_from_aranges): Likewise.
(dwarf2_read_index): Likewise.
(dw2_find_last_source_symtab): Likewise.
(dw2_map_symtabs_matching_filename): Likewise.
(dw2_symtab_iter_next): Likewise.
(dw2_print_stats): Likewise.
(dw2_expand_all_symtabs): Likewise.
(dw2_expand_symtabs_with_fullname): Likewise.
(dw2_expand_marked_cus): Likewise.
(dw2_map_symbol_filenames): Likewise.
(create_cus_from_debug_names): Likewise.
(dwarf2_read_debug_names): Likewise.
(dw2_debug_names_iterator::next): Likewise.
(dwarf2_initialize_objfile): Likewise.
(set_partial_user): Likewise.
(dwarf2_build_psymtabs_hard): Likewise.
(read_comp_units_from_section): Remove arguments, adjust to
std::vector change.
(create_all_comp_units): Adjust to std::vector and
read_comp_units_from_section changes.
(dwarf2_find_containing_comp_unit): Adjust to std::vector
change.
* dwarf-index-write.c (check_dwarf64_offsets): Likewise.
(psyms_seen_size): Likewise.
(write_gdbindex): Likewise.
(write_debug_names): Likewise.

6 years agoRemove some usages of get_dwarf2_per_objfile
Simon Marchi [Sat, 7 Apr 2018 17:53:42 +0000 (13:53 -0400)]
Remove some usages of get_dwarf2_per_objfile

This patch removes some usages of get_dwarf2_per_objfile, where we can
get hold of the dwarf2_per_objfile object in a simpler way.  For
example, it's simpler (and slightly less work) to pass
dwarf2_per_objfile and get the objfile from it than to pass the objfile
and call get_dwarf2_per_objfile.

Ideally, get_dwarf2_per_objfile should only be used in the entry points
of the dwarf2 code, where we receive an objfile.

gdb/ChangeLog:

* dwarf2read.c (create_cus_from_index_list): Replace objfile arg
with dwarf2_per_objfile.
(create_cus_from_index): Likewise.
(create_signatured_type_table_from_index): Likewise.
(dwarf2_read_index): Likewise.
(dwarf2_initialize_objfile): Likewise.
(dwarf2_fetch_die_loc_sect_off):  Get dwarf2_per_objfile from
per_cu rather than get_dwarf2_per_objfile.

6 years agoReplace dw2_get_cu/dw2_get_cutu with methods of dwarf2_per_objfile
Simon Marchi [Sat, 7 Apr 2018 17:53:40 +0000 (13:53 -0400)]
Replace dw2_get_cu/dw2_get_cutu with methods of dwarf2_per_objfile

Those two functions look like good candidates to become methods of
dwarf2_per_objfile.  I did that, and added get_tu as well.  When
replacing usages of dw2_get_cutu, I changed some instances to get_cutu
and others to get_cu, when appropriate (when we know we want a CU and
not a TU).

gdb/ChangeLog:

* dwarf2read.h (struct signatured_type): Forward declare.
(struct dwarf2_per_objfile) <get_cutu, get_cu, get_tu>:
New methods.
* dwarf2read.c (dwarf2_per_objfile::get_cutu): Rename from...
(dw2_get_cutu): ...this.
(dwarf2_per_objfile::get_cu): Rename from...
(dw2_get_cu): ...this.
(dwarf2_per_objfile::get_tu): New.
(create_addrmap_from_index): Adjust.
(create_addrmap_from_aranges): Adjust.
(dw2_find_last_source_symtab): Adjust.
(dw2_map_symtabs_matching_filename): Adjust.
(dw2_symtab_iter_next): Adjust.
(dw2_print_stats): Adjust.
(dw2_expand_all_symtabs): Adjust.
(dw2_expand_symtabs_with_fullname): Adjust.
(dw2_expand_marked_cus): Adjust.
(dw_expand_symtabs_matching_file_matcher): Adjust.
(dw2_map_symbol_filenames): Adjust.
(dw2_debug_names_iterator::next): Adjust.
(dwarf2_initialize_objfile): Adjust.
(set_partial_user): Adjust.
(dwarf2_build_psymtabs_hard): Adjust.