external/binutils.git
7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Dec 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix comment typo
Andreas Schwab [Wed, 28 Dec 2016 17:28:22 +0000 (18:28 +0100)]
Fix comment typo

* copy-relocs.h: Fix comment typo.

7 years agoAdd explicit instantiations for build_compressed_section_map().
Cary Coutant [Wed, 28 Dec 2016 16:29:43 +0000 (08:29 -0800)]
Add explicit instantiations for build_compressed_section_map().

gold/
PR gold/20996
* object.cc (build_compressed_section_map): Add explicit instantiations.

7 years agoFix last ChangeLog entry.
Cary Coutant [Wed, 28 Dec 2016 16:22:59 +0000 (08:22 -0800)]
Fix last ChangeLog entry.

* copy-relocs.cc (Copy_relocs::make_copy_reloc): Use .data.rel.ro for
read-only data when linking with -z relro.

7 years agoCheck bfd support for bfd_mips_elf_get_abiflags in mips make rule
Alan Modra [Wed, 28 Dec 2016 11:29:34 +0000 (21:59 +1030)]
Check bfd support for bfd_mips_elf_get_abiflags in mips make rule

The previous scheme with a dependency in opcodes on libbfd.la
broke "make distclean".

* configure.ac: Revert 2016-12-23.
* Makefile.am: Likewise.
(MIPS_DEFS): Define.
(mips-dis.lo): Add rule.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.

7 years agoUse dynrelro for symbols in relro sections too
Alan Modra [Wed, 28 Dec 2016 06:34:15 +0000 (17:04 +1030)]
Use dynrelro for symbols in relro sections too

PR ld/20995
bfd/
* elflink.c (elf_link_add_object_symbols): Mark relro sections
in dynamic objects SEC_READONLY.
ld/
* testsuite/ld-elf/pr20995c.s: New test file.
* testsuite/ld-elf/pr20995-2so.r: Likewise.
* testsuite/ld-elf/elf.exp: Run it.

7 years agoPlace copy relocations in .dynbss when target is read-only.
Cary Coutant [Wed, 28 Dec 2016 04:50:47 +0000 (20:50 -0800)]
Place copy relocations in .dynbss when target is read-only.

gold/
PR ld/20995
* copy-relocs.cc (Copy_relocs::make_copy_reloc): Use .dynbss for
read-only data when linking with -z relro.
* copy-relocs.h (Copy_relocs::dynrelro_): New data member.
* testsuite/Makefile.am (copy_test_relro): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/copy_test_relro.cc: New source file.
* testsuite/copy_test_relro_1.cc: New source file.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Dec 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 27 Dec 2016 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agodynrelro section for read-only dynamic symbols copied into executable
Alan Modra [Sun, 25 Dec 2016 14:00:45 +0000 (00:30 +1030)]
dynrelro section for read-only dynamic symbols copied into executable

Variables defined in shared libraries are copied into an executable's
.bss section when code in the executable is non-PIC and thus would
require dynamic text relocations to access the variable directly in
the shared library.  Recent x86 toolchains also copy variables into
the executable to gain a small speed improvement.

The problem is that if the variable was originally read-only, the copy
in .bss is writable, potentially opening a security hole.  This patch
cures that problem by putting the copy in a section that becomes
read-only after ld.so relocation, provided -z relro is in force.

The patch also fixes a microblaze linker segfault on attempting to
use dynamic bss variables.

bfd/
PR ld/20995
* elf-bfd.h (struct elf_link_hash_table): Add sdynrelro and
sreldynrelro.
(struct elf_backend_data): Add want_dynrelro.
* elfxx-target.h (elf_backend_want_dynrelro): Define.
(elfNN_bed): Update initializer.
* elflink.c (_bfd_elf_create_dynamic_sections): Create
sdynrelro and sreldynrelro sections.
* elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Place variables
copied into the executable from read-only sections into sdynrelro.
(elf32_arm_size_dynamic_sections): Handle sdynrelro.
(elf32_arm_finish_dynamic_symbol): Select sreldynrelro for
dynamic relocs in sdynrelro.
(elf_backend_want_dynrelro): Define.
* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol)
(elf32_hppa_size_dynamic_sections, elf32_hppa_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf32-i386.c (elf_i386_adjust_dynamic_symbol)
(elf_i386_size_dynamic_sections, elf_i386_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf32-metag.c (elf_metag_adjust_dynamic_symbol)
(elf_metag_size_dynamic_sections, elf_metag_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf32-microblaze.c (microblaze_elf_adjust_dynamic_symbol)
(microblaze_elf_size_dynamic_sections)
(microblaze_elf_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf32-nios2.c (nios2_elf32_finish_dynamic_symbol)
(nios2_elf32_adjust_dynamic_symbol)
(nios2_elf32_size_dynamic_sections)
(elf_backend_want_dynrelro): As above.
* elf32-or1k.c (or1k_elf_finish_dynamic_symbol)
(or1k_elf_adjust_dynamic_symbol, or1k_elf_size_dynamic_sections)
(elf_backend_want_dynrelro): As above.
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol)
(ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf32-s390.c (elf_s390_adjust_dynamic_symbol)
(elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol)
(elf32_tic6x_size_dynamic_sections)
(elf32_tic6x_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol)
(tilepro_elf_size_dynamic_sections)
(tilepro_elf_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol)
(ppc64_elf_size_dynamic_sections, ppc64_elf_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf64-s390.c (elf_s390_adjust_dynamic_symbol)
(elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol)
(elf_x86_64_size_dynamic_sections)
(elf_x86_64_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol)
(elfNN_aarch64_size_dynamic_sections)
(elfNN_aarch64_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol)
(riscv_elf_size_dynamic_sections, riscv_elf_finish_dynamic_symbol)
(elf_backend_want_dynrelro): As above.
* elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol)
(_bfd_mips_elf_size_dynamic_sections)
(_bfd_mips_vxworks_finish_dynamic_symbol): As above.
* elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol)
(_bfd_sparc_elf_size_dynamic_sections)
(_bfd_sparc_elf_finish_dynamic_symbol): As above.
* elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol)
(tilegx_elf_size_dynamic_sections)
(tilegx_elf_finish_dynamic_symbol): As above.
* elf32-mips.c (elf_backend_want_dynrelro): Define.
* elf64-mips.c (elf_backend_want_dynrelro): Define.
* elf32-sparc.c (elf_backend_want_dynrelro): Define.
* elf64-sparc.c (elf_backend_want_dynrelro): Define.
* elf32-tilegx.c (elf_backend_want_dynrelro): Define.
* elf64-tilegx.c (elf_backend_want_dynrelro): Define.
* elf32-microblaze.c (microblaze_elf_adjust_dynamic_symbol): Tidy.
(microblaze_elf_size_dynamic_sections): Handle sdynbss.
* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Make use
of linker shortcuts to dynamic sections rather than comparing
names.  Correctly set "got" flag.
ld/
PR ld/20995
* testsuite/ld-arm/farcall-mixed-app-v5.d: Update to suit changed
stub hash table traversal caused by section id increment.  Accept
the previous output too.
* testsuite/ld-arm/farcall-mixed-app.d: Likewise.
* testsuite/ld-arm/farcall-mixed-lib-v4t.d: Likewise.
* testsuite/ld-arm/farcall-mixed-lib.d: Likewise.
* testsuite/ld-elf/pr20995a.s, * testsuite/ld-elf/pr20995b.s,
* testsuite/ld-elf/pr20995.r: New test.
* testsuite/ld-elf/elf.exp: Run it.

7 years agoPut .dynbss and .rel.bss shortcuts in main elf hash table
Alan Modra [Sun, 25 Dec 2016 13:51:06 +0000 (00:21 +1030)]
Put .dynbss and .rel.bss shortcuts in main elf hash table

Also, create .rel{,a}.bss for PIEs on all targets, not just x86.

* elf-bfd.h (struct elf_link_hash_table): Add sdynbss and srelbss.
* elflink.c (_bfd_elf_create_dynamic_sections): Set them.  Create
.rel.bss/.rela.bss for executables, both PIE and non-PIE.
* elf32-arc.c (struct elf_arc_link_hash_table): Delete srelbss.
Use ELF hash table var throughout.
* elf32-arm.c (struct elf32_arm_link_hash_table): Delete sdynbss
and srelbss.  Use ELF hash table vars throughout.
* elf32-hppa.c (struct elf32_hppa_link_hash_table): Likewise.
* elf32-i386.c (struct elf_i386_link_hash_table): Likewise.
* elf32-metag.c (struct elf_metag_link_hash_table): Likewise.
* elf32-microblaze.c (struct elf32_mb_link_hash_table): Likewise.
* elf32-nios2.c (struct elf32_nios2_link_hash_table): Likewise.
* elf32-or1k.c (struct elf_or1k_link_hash_table): Likewise.
* elf32-ppc.c (struct ppc_elf_link_hash_table): Likewise.
* elf32-s390.c (struct elf_s390_link_hash_table): Likewise.
* elf32-tic6x.c (struct elf32_tic6x_link_hash_table): Likewise.
* elf32-tilepro.c (struct tilepro_elf_link_hash_table): Likewise.
* elf64-ppc.c (struct ppc_link_hash_table): Likewise.
* elf64-s390.c (struct elf_s390_link_hash_table): Likewise.
* elf64-x86-64.c (struct elf_x86_64_link_hash_table): Likewise.
* elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Likewise.
* elfnn-riscv.c (struct riscv_elf_link_hash_table): Likewise.
* elfxx-mips.c (struct mips_elf_link_hash_table): Likewise.
* elfxx-sparc.h (struct _bfd_sparc_elf_link_hash_table): Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-tilegx.c (struct tilegx_elf_link_hash_table): Likewise.

* elf32-arc.c (arc_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-microblaze.c (microblaze_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-or1k.c (or1k_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-s390.c (elf_s390_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf64-ppc.c (ppc64_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf64-s390.c (elf_s390_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.

* elf32-tilepro.c (tilepro_elf_create_dynamic_sections): Remove
extraneous tests.
* elfnn-aarch64.c (elfNN_aarch64_create_dynamic_sections): Likewise.
* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Likewise.
* elfxx-tilegx.c (tilegx_elf_create_dynamic_sections): Likewise.

* elf32-i386.c (elf_i386_create_dynamic_sections): Don't create
".rel.bss" for executables.
* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Don't create
".rela.bss" for executables.
* elf32-nios2.c (nios2_elf32_create_dynamic_sections): Don't
ignore return status from _bfd_elf_create_dynamic_sections.

7 years agoCorrect .dynbss in script
Alan Modra [Sun, 25 Dec 2016 23:10:58 +0000 (09:40 +1030)]
Correct .dynbss in script

The only target that renames .bss is tic6x, turning .bss into .far,
and .sbss into .bss.  .dynbss is not renamed to .dynfar by BFD.

* scripttempl/elf.sc: Don't use $BSS_NAME in .dynbss.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Dec 2016 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Dec 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Dec 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoMIPS/BFD: Remove EI_ABIVERSION 5 allocation for PT_GNU_STACK support
Maciej W. Rozycki [Fri, 23 Dec 2016 20:03:36 +0000 (20:03 +0000)]
MIPS/BFD: Remove EI_ABIVERSION 5 allocation for PT_GNU_STACK support

Revert commit 17733f5be961 ("Increment the ABIVERSION to 5 for MIPS
objects with non-executable stacks.") and remove EI_ABIVERSION 5
allocation for PT_GNU_STACK support, which has not made it to glibc
and will be reassigned.

bfd/
* bfd/elfxx-mips.c (_bfd_mips_post_process_headers): Revert
2016-02-23 change and remove EI_ABIVERSION 5 support.

7 years agoMIPS16: Add ASMACRO instruction support
Maciej W. Rozycki [Fri, 23 Dec 2016 19:40:51 +0000 (19:40 +0000)]
MIPS16: Add ASMACRO instruction support

Add ASMACRO instruction support as per the MIPS16e ASE architecture
specifications [1][2], completing MIPS16e instruction set support.

[1] "MIPS32 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS32 Architecture", MIPS
    Technologies, Inc., Document Number: MD00076, Revision 2.63, July
    16, 2013, Section 4.1 "MIPS16e Instruction Descriptions", p. 65

[2] "MIPS64 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS64 Architecture", MIPS
    Technologies, Inc., Document Number: MD00077, Revision 2.60, June
    25, 2008, Section 1.1 "MIPS16e Instruction Descriptions", p. 66

include/
* opcode/mips.h: Document `0', `1', `2', `3', `4' and `s'
operand codes.

opcodes/
* mips16-opc.c (decode_mips16_operand): Add `0', `1', `2', `3',
`4' and `s' operand codes.
(mips16_opcodes): Add "asmacro" entry.

binutils/
* testsuite/binutils-all/mips/mips16-extend-insn.d: Update for
ASMACRO support.

gas/
* testsuite/gas/mips/mips16-asmacro.d: New test.
* testsuite/gas/mips/mips16-32@mips16-asmacro.d: New test.
* testsuite/gas/mips/mips16-64@mips16-asmacro.d: New test.
* testsuite/gas/mips/mips16-asmacro.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

7 years agoMIPS16: Simplify extended operand handling
Maciej W. Rozycki [Fri, 23 Dec 2016 19:40:09 +0000 (19:40 +0000)]
MIPS16: Simplify extended operand handling

Simplify extended operand handling and only specially process immediates
which require bit shuffling, using the generic operand insertion and
extraction handlers for the '<' (5-bit shift amount) operand code in
particular.  Require the least significant bit of all extended operand
forms to be (artificially) set to 0 for their special processing to
trigger.

gas/
* config/tc-mips.c (mips16_immed): Limit `mips16_immed_extend'
use to operands whose LSB position is zero.

opcodes/
* mips-dis.c (print_mips16_insn_arg): Simplify processing of
extended operands.
* mips16-opc.c (decode_mips16_operand): Switch the extended
form of the `<' operand type to LSB position 22.

7 years agoMIPS16/GAS: Clean up invalid unextended operand handling
Maciej W. Rozycki [Fri, 23 Dec 2016 18:06:55 +0000 (18:06 +0000)]
MIPS16/GAS: Clean up invalid unextended operand handling

Bail out right away when an unextended instruction encoding is required
either with the use of a `.t' suffix or by means of `.set noautoextend',
however an operand supplied requires the extended instruction form to be
used.

This is to avoid messing up with the internal state of the assembler,
even though no actual failures are known to happen as a result.  Add
test cases for the situation concerned.

gas/
* config/tc-mips.c (match_mips16_insn): Don't update
`forced_insn_length' or the instruction opcode if an operand
requires an extended instruction form, but an unextended one
has been requested.
* testsuite/gas/mips/mips16-relax-unextended-1.d: New test.
* testsuite/gas/mips/mips16-relax-unextended-2.d: New test.
* testsuite/gas/mips/mips16-relax-unextended-1.l: New stderr
output.
* testsuite/gas/mips/mips16-relax-unextended-2.l: New stderr
output.
* testsuite/gas/mips/mips16-relax-unextended-1.s: New test
source.
* testsuite/gas/mips/mips16-relax-unextended-2.s: New test
source.
* testsuite/gas/mips/mips.exp: Run the new tests.

7 years agoMIPS16: Reassign `0' and `4' operand codes
Maciej W. Rozycki [Fri, 23 Dec 2016 17:05:01 +0000 (17:05 +0000)]
MIPS16: Reassign `0' and `4' operand codes

Replace `0' and `4' operand codes with `.' and `F' respectively to free
up the `0'-`4' consecutive range.  No functional change.

gas/
* config/tc-mips.c (mips16_macro_build): Replace `0' and `4'
operand codes with `.' and `F' respectively.
(mips16_macro): Likewise.

include/
* opcode/mips.h: Replace `0' and `4' operand codes with `.' and
`F' respectively.

opcodes/
* mips16-opc.c (decode_mips16_operand): Replace `0' and `4'
operand codes with `.' and `F' respectively.
(mips16_opcodes): Likewise.

7 years agoMIPS16: Handle non-extensible instructions correctly
Maciej W. Rozycki [Fri, 23 Dec 2016 16:49:42 +0000 (16:49 +0000)]
MIPS16: Handle non-extensible instructions correctly

Identify non-extensible instructions in the MIPS16 opcode table and
disallow their use with the `.e' instruction size suffix in assembly and
do not interpret any EXTEND prefix present as a part of the instruction
in disassembly.

According to all versions of the MIPS16 ASE specifications the following
instructions encodings are not extensible [1][2][3][4][5][6]: I8/MOV32R,
I8/MOVR32, all RRR minor opcodes, all RR minor opcodes except from DSRA
and DSRL, and EXTEND itself, and as from revision 2.50 of the MIPS16e
ASE specifications it has been further clarified what was previously
implied, that non-extesiable instructions when preceded with an EXTEND
prefix must cause a Reserved Instruction exception [3][5].

Therefore in the presence of an EXTEND prefix none of these instructions
are supposed to be handled as extended instructions and supporting these
forms in disassembly causes confusion, and in the case of the RRR major
opcode it also clashes with the ASMACRO encoding.

References:

[1] "Product Description, MIPS16 Application-Specific Extension",
    Version 1.3, MIPS Technologies, Inc., 970130, Table 3. "MIPS16
    Instruction Set Summary", p. 5

[2] same, Table 5 "RR Minor Opcodes (RR-type instructions)", p.10

[3] "MIPS32 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS32 Architecture", MIPS
    Technologies, Inc., Document Number: MD00076, Revision 2.63, July
    16, 2013, Section 3.9 "MIPS16e Instruction Summaries", pp. 37-39

[4] same, Section 3.15 "Instruction Bit Encoding", pp. 46-49

[5] "MIPS64 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS64 Architecture", MIPS
    Technologies, Inc., Document Number: MD00077, Revision 2.60, June
    25, 2008, Section 1.9 "MIPS16e Instruction Summaries", pp. 38-41

[6] same, Section 1.15 "Instruction Bit Encoding", pp. 48-51

include/
* opcode/mips.h (INSN2_SHORT_ONLY): New macro.

gas/
* config/tc-mips.c (is_size_valid_16): Disallow a `.e' suffix
instruction size override for INSN2_SHORT_ONLY opcode table
entries.
* testsuite/gas/mips/mips16-extend-swap.d: Adjust output.
* testsuite/gas/mips/mips16-macro-e.l: Adjust error messages.
* testsuite/gas/mips/mips16-32@mips16-macro-e.l: Adjust error
messages.
* testsuite/gas/mips/mips16e-32@mips16-macro-e.l: Adjust error
messages.
* testsuite/gas/mips/mips16-insn-e.d: New test.
* testsuite/gas/mips/mips16-insn-t.d: New test.
* testsuite/gas/mips/mips16-32@mips16-insn-e.d: New test.
* testsuite/gas/mips/mips16-64@mips16-insn-e.d: New test.
* testsuite/gas/mips/mips16e-32@mips16-insn-e.d: New test.
* testsuite/gas/mips/mips16-32@mips16-insn-t.d: New test.
* testsuite/gas/mips/mips16-64@mips16-insn-t.d: New test.
* testsuite/gas/mips/mips16e-32@mips16-insn-t.d: New test.
* testsuite/gas/mips/mips16-insn-e.l: New stderr output.
* testsuite/gas/mips/mips16-insn-t.l: New stderr output.
* testsuite/gas/mips/mips16-32@mips16-insn-e.l: New stderr
output.
* testsuite/gas/mips/mips16-64@mips16-insn-e.l: New stderr
output.
* testsuite/gas/mips/mips16e-32@mips16-insn-e.l: New stderr
output.
* testsuite/gas/mips/mips16-32@mips16-insn-t.l: New stderr
output.
* testsuite/gas/mips/mips16-64@mips16-insn-t.l: New stderr
output.
* testsuite/gas/mips/mips16e-32@mips16-insn-t.l: New stderr
output.
* testsuite/gas/mips/mips16-insn-e.s: New test source.
* testsuite/gas/mips/mips16-insn-t.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

opcodes/
* mips-dis.c (print_insn_mips16): Disallow EXTEND prefix
matching for INSN2_SHORT_ONLY opcode table entries.
* mips16-opc.c (SH): New macro.
(mips16_opcodes): Set SH in `pinfo2' for non-extensible
instruction entries: "nop", "addu", "and", "break", "cmp",
"daddu", "ddiv", "ddivu", "div", "divu", "dmult", "dmultu",
"drem", "dremu", "dsllv", "dsll", "dsrav", "dsra", "dsrlv",
"dsrl", "dsubu", "exit", "entry", "jalr", "jal", "jr", "j",
"jalrc", "jrc", "mfhi", "mflo", "move", "mult", "multu", "neg",
"not", "or", "rem", "remu", "sllv", "sll", "slt", "sltu",
"srav", "sra", "srlv", "srl", "subu", "xor", "sdbbp", "seb",
"seh", "sew", "zeb", "zeh", "zew" and "extend".

binutils/
* testsuite/binutils-all/mips/mips16-extend-insn.d: New test.
* testsuite/binutils-all/mips/mips16-extend-insn.s: New test
source.
* testsuite/binutils-all/mips/mips.exp: Run the new tests.

7 years agoMIPS16: Remove "extended" BREAK/SDBBP handling
Maciej W. Rozycki [Fri, 23 Dec 2016 12:42:56 +0000 (12:42 +0000)]
MIPS16: Remove "extended" BREAK/SDBBP handling

Remove special casing for the `6' operand code used for the embedded
trap code of the BREAK and the SDBBP instructions to support supposedly
extended forms of these instructions.

According to all versions of the MIPS16 ASE specifications these
instructions are not extensible [1][2][3][4][5][7][8][10][11], and as
from revision 2.50 of the MIPS16e ASE specifications it has been further
clarified what was previously implied, that non-extesiable instructions
when preceded with an EXTEND prefix must cause a Reserved Instruction
exception [5][6][9][10].

Therefore supposedly extended BREAK and SDBBP instructions do not serve
their purpose anymore as they do not cause a Bp and a Debug exception
respectively and supporting these forms in disassembly only causes
confusion.

References:

[1] "Product Description, MIPS16 Application-Specific Extension",
    Version 1.3, MIPS Technologies, Inc., 970130, Table 3. "MIPS16
    Instruction Set Summary", p. 5

[2] same, Table 5 "RR Minor Opcodes (RR-type instructions)", p.10

[3] same, Table 18. "Extendable MIPS16 Instructions", p. 24

[4] "MIPS32 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS32 Architecture", MIPS
    Technologies, Inc., Document Number: MD00076, Revision 2.63, July
    16, 2013, Table 3.8 "MIPS16e Special Instructions", p. 38

[5] same, Section 3.11 "MIPS16e Extensible Instructions, p. 41

[6] same, Table 3.15 "MIPS16e Extensible Instructions", p. 41

[7] same, Table 3.24 "MIPS16e RR Encoding of the Funct Field", p. 49

[8] "MIPS64 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS64 Architecture", MIPS
    Technologies, Inc., Document Number: MD00077, Revision 2.60, June
    25, 2008, Table 1.8 "MIPS16e Special Instructions", p. 39

[9] same, Section 1.11 "MIPS16e Extensible Instructions", p. 42

[10] same, Table 1.15 "MIPS16e Extensible Instructions", pp. 42-43

[11] same, Table 1.24 "MIPS16e RR Encoding of the Funct Field", p. 50

gas/
* config/tc-mips.c (match_mips16_insn): Remove the `6' operand
code special case and its associated comment.

opcodes/
* mips16-opc.c (decode_mips16_operand) <'6'>: Remove extended
encoding support.

7 years agoMIPS16/GAS: Fix forced size suffixes with argumentless instructions
Maciej W. Rozycki [Fri, 23 Dec 2016 12:38:35 +0000 (12:38 +0000)]
MIPS16/GAS: Fix forced size suffixes with argumentless instructions

Correct the handling of `.e' and `.t' instruction size suffixes with
instruction mnemonics which are not followed by any text on the same
line, such as arguments or white space, e.g.:

$ cat test.s
.set mips16
foo:
entry.t # comment
entry.t
exit.t # comment
exit.t
nop.t # comment
nop.t
$ as -32 -o test.o test.s
test.s: Assembler messages:
test.s:4: Error: unrecognized opcode `entry.t'
test.s:6: Error: unrecognized opcode `exit.t'
test.s:8: Error: unrecognized opcode `nop.t'
$

gas/
* config/tc-mips.c (mips16_ip): Handle `.e' and `.t' instruction
suffixes followed by a null character rather than a space too.
* testsuite/gas/mips/mips16-insn-length-noargs.d: New test.
* testsuite/gas/mips/mips16-insn-length-noargs.s: New test
source.
* testsuite/gas/mips/mips.exp: Run the new test.

7 years agoMIPS16/GAS: Disallow EXTEND delay-slot scheduling
Maciej W. Rozycki [Fri, 23 Dec 2016 12:37:40 +0000 (12:37 +0000)]
MIPS16/GAS: Disallow EXTEND delay-slot scheduling

Do not allow any explicitly coded EXTEND instruction to be automatically
scheduled into a jump delay slot, as an EXTEND prefix is coupled with
the next regular MIPS16 instruction and therefore swapping it with a
jump would change program's semantics; EXTEND is not architecturally
allowed to be present in a jump delay slot anyway.

opcodes/
* mips16-opc.c (mips16_opcodes): Set NODS in `pinfo' for
"extend".

gas/
* testsuite/gas/mips/mips16-extend-swap.d: New test.
* testsuite/gas/mips/mips16-extend-swap.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new test.

7 years agoopcodes: Use autoconf to check for `bfd_mips_elf_get_abiflags' in BFD
Maciej W. Rozycki [Fri, 23 Dec 2016 12:11:12 +0000 (12:11 +0000)]
opcodes: Use autoconf to check for `bfd_mips_elf_get_abiflags' in BFD

Fix a regression introduced with commit 5e7fc731f80e ("MIPS/opcodes:
Also set disassembler's ASE flags from ELF structures"), further updated
with commit 4df995c77118 ("MIPS/opcodes: Also set disassembler's ASE
flags from ELF structures"), and use autoconf to check for the presence
of `bfd_mips_elf_get_abiflags' in BFD.

opcodes/
* mips-dis.c (set_default_mips_dis_options): Use
HAVE_BFD_MIPS_ELF_GET_ABIFLAGS rather than BFD64 to guard the
call to `bfd_mips_elf_get_abiflags'.
* configure.ac: Check for `bfd_mips_elf_get_abiflags' in BFD.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add `libbfd.la'.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* config.in: Regenerate.
* Makefile.in: Regenerate.

7 years agoFix more cases of improper test names
Luis Machado [Fri, 23 Dec 2016 16:52:18 +0000 (10:52 -0600)]
Fix more cases of improper test names

I noticed more occurrences of improper test names. The rather mechanical,
tedious and large patch below addresses, hopefully, most of the leftover cases.

As usual, another pair of eyes is welcome to check if missed something or did
an invalid substitution.

This patch also fixes the prepare_for_testing calls to pass proper test names.

gdb/testsuite/ChangeLog:

2016-12-23  Luis Machado  <lgustavo@codesourcery.com>

Fix test names for the following files:

* gdb.ada/exec_changed.exp
* gdb.ada/info_types.exp
* gdb.arch/aarch64-atomic-inst.exp
* gdb.arch/aarch64-fp.exp
* gdb.arch/altivec-abi.exp
* gdb.arch/altivec-regs.exp
* gdb.arch/amd64-byte.exp
* gdb.arch/amd64-disp-step.exp
* gdb.arch/amd64-dword.exp
* gdb.arch/amd64-entry-value-inline.exp
* gdb.arch/amd64-entry-value-param.exp
* gdb.arch/amd64-entry-value-paramref.exp
* gdb.arch/amd64-entry-value.exp
* gdb.arch/amd64-i386-address.exp
* gdb.arch/amd64-invalid-stack-middle.exp
* gdb.arch/amd64-invalid-stack-top.exp
* gdb.arch/amd64-optimout-repeat.exp
* gdb.arch/amd64-prologue-skip.exp
* gdb.arch/amd64-prologue-xmm.exp
* gdb.arch/amd64-stap-special-operands.exp
* gdb.arch/amd64-stap-wrong-subexp.exp
* gdb.arch/amd64-tailcall-cxx.exp
* gdb.arch/amd64-tailcall-noret.exp
* gdb.arch/amd64-tailcall-ret.exp
* gdb.arch/amd64-tailcall-self.exp
* gdb.arch/amd64-word.exp
* gdb.arch/arm-bl-branch-dest.exp
* gdb.arch/arm-disp-step.exp
* gdb.arch/arm-neon.exp
* gdb.arch/arm-single-step-kernel-helper.exp
* gdb.arch/avr-flash-qualifier.exp
* gdb.arch/disp-step-insn-reloc.exp
* gdb.arch/e500-abi.exp
* gdb.arch/e500-regs.exp
* gdb.arch/ftrace-insn-reloc.exp
* gdb.arch/i386-avx512.exp
* gdb.arch/i386-bp_permanent.exp
* gdb.arch/i386-byte.exp
* gdb.arch/i386-cfi-notcurrent.exp
* gdb.arch/i386-disp-step.exp
* gdb.arch/i386-dr3-watch.exp
* gdb.arch/i386-float.exp
* gdb.arch/i386-gnu-cfi.exp
* gdb.arch/i386-mpx-map.exp
* gdb.arch/i386-mpx-sigsegv.exp
* gdb.arch/i386-mpx-simple_segv.exp
* gdb.arch/i386-mpx.exp
* gdb.arch/i386-permbkpt.exp
* gdb.arch/i386-prologue.exp
* gdb.arch/i386-signal.exp
* gdb.arch/i386-size-overlap.exp
* gdb.arch/i386-unwind.exp
* gdb.arch/i386-word.exp
* gdb.arch/mips-fcr.exp
* gdb.arch/powerpc-d128-regs.exp
* gdb.arch/powerpc-stackless.exp
* gdb.arch/ppc64-atomic-inst.exp
* gdb.arch/s390-stackless.exp
* gdb.arch/s390-tdbregs.exp
* gdb.arch/s390-vregs.exp
* gdb.arch/sparc-sysstep.exp
* gdb.arch/thumb-bx-pc.exp
* gdb.arch/thumb-singlestep.exp
* gdb.arch/thumb2-it.exp
* gdb.arch/vsx-regs.exp
* gdb.asm/asm-source.exp
* gdb.base/a2-run.exp
* gdb.base/advance.exp
* gdb.base/all-bin.exp
* gdb.base/anon.exp
* gdb.base/args.exp
* gdb.base/arithmet.exp
* gdb.base/async-shell.exp
* gdb.base/async.exp
* gdb.base/attach-pie-noexec.exp
* gdb.base/attach-twice.exp
* gdb.base/auto-load.exp
* gdb.base/bang.exp
* gdb.base/bitfields.exp
* gdb.base/break-always.exp
* gdb.base/break-caller-line.exp
* gdb.base/break-entry.exp
* gdb.base/break-inline.exp
* gdb.base/break-on-linker-gcd-function.exp
* gdb.base/break-probes.exp
* gdb.base/break.exp
* gdb.base/breakpoint-shadow.exp
* gdb.base/call-ar-st.exp
* gdb.base/call-sc.exp
* gdb.base/call-signal-resume.exp
* gdb.base/call-strs.exp
* gdb.base/callfuncs.exp
* gdb.base/catch-fork-static.exp
* gdb.base/catch-gdb-caused-signals.exp
* gdb.base/catch-load.exp
* gdb.base/catch-signal-fork.exp
* gdb.base/catch-signal.exp
* gdb.base/catch-syscall.exp
* gdb.base/charset.exp
* gdb.base/checkpoint.exp
* gdb.base/chng-syms.exp
* gdb.base/code-expr.exp
* gdb.base/code_elim.exp
* gdb.base/commands.exp
* gdb.base/completion.exp
* gdb.base/complex.exp
* gdb.base/cond-expr.exp
* gdb.base/condbreak.exp
* gdb.base/consecutive.exp
* gdb.base/continue-all-already-running.exp
* gdb.base/coredump-filter.exp
* gdb.base/corefile.exp
* gdb.base/dbx.exp
* gdb.base/debug-expr.exp
* gdb.base/define.exp
* gdb.base/del.exp
* gdb.base/disabled-location.exp
* gdb.base/disasm-end-cu.exp
* gdb.base/disasm-optim.exp
* gdb.base/display.exp
* gdb.base/duplicate-bp.exp
* gdb.base/ena-dis-br.exp
* gdb.base/ending-run.exp
* gdb.base/enumval.exp
* gdb.base/environ.exp
* gdb.base/eu-strip-infcall.exp
* gdb.base/eval-avoid-side-effects.exp
* gdb.base/eval-skip.exp
* gdb.base/exitsignal.exp
* gdb.base/expand-psymtabs.exp
* gdb.base/filesym.exp
* gdb.base/find-unmapped.exp
* gdb.base/finish.exp
* gdb.base/float.exp
* gdb.base/foll-exec-mode.exp
* gdb.base/foll-exec.exp
* gdb.base/foll-fork.exp
* gdb.base/fortran-sym-case.exp
* gdb.base/freebpcmd.exp
* gdb.base/func-ptr.exp
* gdb.base/func-ptrs.exp
* gdb.base/funcargs.exp
* gdb.base/gcore-buffer-overflow.exp
* gdb.base/gcore-relro-pie.exp
* gdb.base/gcore-relro.exp
* gdb.base/gcore.exp
* gdb.base/gdb1090.exp
* gdb.base/gdb11530.exp
* gdb.base/gdb11531.exp
* gdb.base/gdb1821.exp
* gdb.base/gdbindex-stabs.exp
* gdb.base/gdbvars.exp
* gdb.base/hbreak.exp
* gdb.base/hbreak2.exp
* gdb.base/included.exp
* gdb.base/infcall-input.exp
* gdb.base/inferior-died.exp
* gdb.base/infnan.exp
* gdb.base/info-macros.exp
* gdb.base/info-os.exp
* gdb.base/info-proc.exp
* gdb.base/info-shared.exp
* gdb.base/info-target.exp
* gdb.base/infoline.exp
* gdb.base/interp.exp
* gdb.base/interrupt.exp
* gdb.base/jit-reader.exp
* gdb.base/jit-simple.exp
* gdb.base/kill-after-signal.exp
* gdb.base/kill-detach-inferiors-cmd.exp
* gdb.base/label.exp
* gdb.base/langs.exp
* gdb.base/ldbl_e308.exp
* gdb.base/line-symtabs.exp
* gdb.base/linespecs.exp
* gdb.base/list.exp
* gdb.base/long_long.exp
* gdb.base/longest-types.exp
* gdb.base/maint.exp
* gdb.base/max-value-size.exp
* gdb.base/memattr.exp
* gdb.base/mips_pro.exp
* gdb.base/morestack.exp
* gdb.base/moribund-step.exp
* gdb.base/multi-forks.exp
* gdb.base/nested-addr.exp
* gdb.base/nextoverexit.exp
* gdb.base/noreturn-finish.exp
* gdb.base/noreturn-return.exp
* gdb.base/nostdlib.exp
* gdb.base/offsets.exp
* gdb.base/opaque.exp
* gdb.base/pc-fp.exp
* gdb.base/permissions.exp
* gdb.base/print-symbol-loading.exp
* gdb.base/prologue-include.exp
* gdb.base/psymtab.exp
* gdb.base/ptype.exp
* gdb.base/random-signal.exp
* gdb.base/randomize.exp
* gdb.base/range-stepping.exp
* gdb.base/readline-ask.exp
* gdb.base/recpar.exp
* gdb.base/recurse.exp
* gdb.base/relational.exp
* gdb.base/restore.exp
* gdb.base/return-nodebug.exp
* gdb.base/return.exp
* gdb.base/run-after-attach.exp
* gdb.base/save-bp.exp
* gdb.base/scope.exp
* gdb.base/sect-cmd.exp
* gdb.base/set-lang-auto.exp
* gdb.base/set-noassign.exp
* gdb.base/setvar.exp
* gdb.base/sigall.exp
* gdb.base/sigbpt.exp
* gdb.base/siginfo-addr.exp
* gdb.base/siginfo-infcall.exp
* gdb.base/siginfo-obj.exp
* gdb.base/siginfo.exp
* gdb.base/signals-state-child.exp
* gdb.base/signest.exp
* gdb.base/sigstep.exp
* gdb.base/sizeof.exp
* gdb.base/skip.exp
* gdb.base/solib-corrupted.exp
* gdb.base/solib-nodir.exp
* gdb.base/solib-search.exp
* gdb.base/stack-checking.exp
* gdb.base/stale-infcall.exp
* gdb.base/stap-probe.exp
* gdb.base/start.exp
* gdb.base/step-break.exp
* gdb.base/step-bt.exp
* gdb.base/step-line.exp
* gdb.base/step-over-exit.exp
* gdb.base/step-over-syscall.exp
* gdb.base/step-resume-infcall.exp
* gdb.base/step-test.exp
* gdb.base/store.exp
* gdb.base/structs3.exp
* gdb.base/sym-file.exp
* gdb.base/symbol-without-target_section.exp
* gdb.base/term.exp
* gdb.base/testenv.exp
* gdb.base/ui-redirect.exp
* gdb.base/until.exp
* gdb.base/unwindonsignal.exp
* gdb.base/value-double-free.exp
* gdb.base/vla-datatypes.exp
* gdb.base/vla-ptr.exp
* gdb.base/vla-sideeffect.exp
* gdb.base/volatile.exp
* gdb.base/watch-cond-infcall.exp
* gdb.base/watch-cond.exp
* gdb.base/watch-non-mem.exp
* gdb.base/watch-read.exp
* gdb.base/watch-vfork.exp
* gdb.base/watchpoint-cond-gone.exp
* gdb.base/watchpoint-delete.exp
* gdb.base/watchpoint-hw-hit-once.exp
* gdb.base/watchpoint-hw.exp
* gdb.base/watchpoint-stops-at-right-insn.exp
* gdb.base/watchpoints.exp
* gdb.base/wchar.exp
* gdb.base/whatis-exp.exp
* gdb.btrace/buffer-size.exp
* gdb.btrace/data.exp
* gdb.btrace/delta.exp
* gdb.btrace/dlopen.exp
* gdb.btrace/enable.exp
* gdb.btrace/exception.exp
* gdb.btrace/function_call_history.exp
* gdb.btrace/gcore.exp
* gdb.btrace/instruction_history.exp
* gdb.btrace/nohist.exp
* gdb.btrace/reconnect.exp
* gdb.btrace/record_goto-step.exp
* gdb.btrace/record_goto.exp
* gdb.btrace/rn-dl-bind.exp
* gdb.btrace/segv.exp
* gdb.btrace/step.exp
* gdb.btrace/stepi.exp
* gdb.btrace/tailcall-only.exp
* gdb.btrace/tailcall.exp
* gdb.btrace/tsx.exp
* gdb.btrace/unknown_functions.exp
* gdb.btrace/vdso.exp
* gdb.compile/compile-ifunc.exp
* gdb.compile/compile-ops.exp
* gdb.compile/compile-print.exp
* gdb.compile/compile-setjmp.exp
* gdb.cp/abstract-origin.exp
* gdb.cp/ambiguous.exp
* gdb.cp/annota2.exp
* gdb.cp/annota3.exp
* gdb.cp/anon-ns.exp
* gdb.cp/anon-struct.exp
* gdb.cp/anon-union.exp
* gdb.cp/arg-reference.exp
* gdb.cp/baseenum.exp
* gdb.cp/bool.exp
* gdb.cp/breakpoint.exp
* gdb.cp/bs15503.exp
* gdb.cp/call-c.exp
* gdb.cp/casts.exp
* gdb.cp/chained-calls.exp
* gdb.cp/class2.exp
* gdb.cp/classes.exp
* gdb.cp/cmpd-minsyms.exp
* gdb.cp/converts.exp
* gdb.cp/cp-relocate.exp
* gdb.cp/cpcompletion.exp
* gdb.cp/cpexprs.exp
* gdb.cp/cplabel.exp
* gdb.cp/cplusfuncs.exp
* gdb.cp/cpsizeof.exp
* gdb.cp/ctti.exp
* gdb.cp/derivation.exp
* gdb.cp/destrprint.exp
* gdb.cp/dispcxx.exp
* gdb.cp/enum-class.exp
* gdb.cp/exception.exp
* gdb.cp/exceptprint.exp
* gdb.cp/expand-psymtabs-cxx.exp
* gdb.cp/expand-sals.exp
* gdb.cp/extern-c.exp
* gdb.cp/filename.exp
* gdb.cp/formatted-ref.exp
* gdb.cp/fpointer.exp
* gdb.cp/gdb1355.exp
* gdb.cp/gdb2495.exp
* gdb.cp/hang.exp
* gdb.cp/impl-this.exp
* gdb.cp/infcall-dlopen.exp
* gdb.cp/inherit.exp
* gdb.cp/iostream.exp
* gdb.cp/koenig.exp
* gdb.cp/local.exp
* gdb.cp/m-data.exp
* gdb.cp/m-static.exp
* gdb.cp/mb-ctor.exp
* gdb.cp/mb-inline.exp
* gdb.cp/mb-templates.exp
* gdb.cp/member-name.exp
* gdb.cp/member-ptr.exp
* gdb.cp/meth-typedefs.exp
* gdb.cp/method.exp
* gdb.cp/method2.exp
* gdb.cp/minsym-fallback.exp
* gdb.cp/misc.exp
* gdb.cp/namelessclass.exp
* gdb.cp/namespace-enum.exp
* gdb.cp/namespace-nested-import.exp
* gdb.cp/namespace.exp
* gdb.cp/nextoverthrow.exp
* gdb.cp/no-dmgl-verbose.exp
* gdb.cp/non-trivial-retval.exp
* gdb.cp/noparam.exp
* gdb.cp/nsdecl.exp
* gdb.cp/nsimport.exp
* gdb.cp/nsnested.exp
* gdb.cp/nsnoimports.exp
* gdb.cp/nsrecurs.exp
* gdb.cp/nsstress.exp
* gdb.cp/nsusing.exp
* gdb.cp/operator.exp
* gdb.cp/oranking.exp
* gdb.cp/overload-const.exp
* gdb.cp/overload.exp
* gdb.cp/ovldbreak.exp
* gdb.cp/ovsrch.exp
* gdb.cp/paren-type.exp
* gdb.cp/parse-lang.exp
* gdb.cp/pass-by-ref.exp
* gdb.cp/pr-1023.exp
* gdb.cp/pr-1210.exp
* gdb.cp/pr-574.exp
* gdb.cp/pr10687.exp
* gdb.cp/pr12028.exp
* gdb.cp/pr17132.exp
* gdb.cp/pr17494.exp
* gdb.cp/pr9067.exp
* gdb.cp/pr9167.exp
* gdb.cp/pr9631.exp
* gdb.cp/printmethod.exp
* gdb.cp/psmang.exp
* gdb.cp/psymtab-parameter.exp
* gdb.cp/ptype-cv-cp.exp
* gdb.cp/ptype-flags.exp
* gdb.cp/re-set-overloaded.exp
* gdb.cp/ref-types.exp
* gdb.cp/rtti.exp
* gdb.cp/scope-err.exp
* gdb.cp/shadow.exp
* gdb.cp/smartp.exp
* gdb.cp/static-method.exp
* gdb.cp/static-print-quit.exp
* gdb.cp/temargs.exp
* gdb.cp/templates.exp
* gdb.cp/try_catch.exp
* gdb.cp/typedef-operator.exp
* gdb.cp/typeid.exp
* gdb.cp/userdef.exp
* gdb.cp/using-crash.exp
* gdb.cp/var-tag.exp
* gdb.cp/virtbase.exp
* gdb.cp/virtfunc.exp
* gdb.cp/virtfunc2.exp
* gdb.cp/vla-cxx.exp
* gdb.disasm/t01_mov.exp
* gdb.disasm/t02_mova.exp
* gdb.disasm/t03_add.exp
* gdb.disasm/t04_sub.exp
* gdb.disasm/t05_cmp.exp
* gdb.disasm/t06_ari2.exp
* gdb.disasm/t07_ari3.exp
* gdb.disasm/t08_or.exp
* gdb.disasm/t09_xor.exp
* gdb.disasm/t10_and.exp
* gdb.disasm/t11_logs.exp
* gdb.disasm/t12_bit.exp
* gdb.disasm/t13_otr.exp
* gdb.dlang/circular.exp
* gdb.dwarf2/arr-stride.exp
* gdb.dwarf2/arr-subrange.exp
* gdb.dwarf2/atomic-type.exp
* gdb.dwarf2/bad-regnum.exp
* gdb.dwarf2/bitfield-parent-optimized-out.exp
* gdb.dwarf2/callframecfa.exp
* gdb.dwarf2/clztest.exp
* gdb.dwarf2/corrupt.exp
* gdb.dwarf2/data-loc.exp
* gdb.dwarf2/dup-psym.exp
* gdb.dwarf2/dw2-anon-mptr.exp
* gdb.dwarf2/dw2-anonymous-func.exp
* gdb.dwarf2/dw2-bad-mips-linkage-name.exp
* gdb.dwarf2/dw2-bad-unresolved.exp
* gdb.dwarf2/dw2-basic.exp
* gdb.dwarf2/dw2-canonicalize-type.exp
* gdb.dwarf2/dw2-case-insensitive.exp
* gdb.dwarf2/dw2-common-block.exp
* gdb.dwarf2/dw2-compdir-oldgcc.exp
* gdb.dwarf2/dw2-compressed.exp
* gdb.dwarf2/dw2-const.exp
* gdb.dwarf2/dw2-cp-infcall-ref-static.exp
* gdb.dwarf2/dw2-cu-size.exp
* gdb.dwarf2/dw2-dup-frame.exp
* gdb.dwarf2/dw2-entry-value.exp
* gdb.dwarf2/dw2-icycle.exp
* gdb.dwarf2/dw2-ifort-parameter.exp
* gdb.dwarf2/dw2-inline-break.exp
* gdb.dwarf2/dw2-inline-param.exp
* gdb.dwarf2/dw2-intercu.exp
* gdb.dwarf2/dw2-intermix.exp
* gdb.dwarf2/dw2-lexical-block-bare.exp
* gdb.dwarf2/dw2-linkage-name-trust.exp
* gdb.dwarf2/dw2-minsym-in-cu.exp
* gdb.dwarf2/dw2-noloc.exp
* gdb.dwarf2/dw2-op-call.exp
* gdb.dwarf2/dw2-op-out-param.exp
* gdb.dwarf2/dw2-opt-structptr.exp
* gdb.dwarf2/dw2-param-error.exp
* gdb.dwarf2/dw2-producer.exp
* gdb.dwarf2/dw2-ranges-base.exp
* gdb.dwarf2/dw2-ref-missing-frame.exp
* gdb.dwarf2/dw2-reg-undefined.exp
* gdb.dwarf2/dw2-regno-invalid.exp
* gdb.dwarf2/dw2-restore.exp
* gdb.dwarf2/dw2-restrict.exp
* gdb.dwarf2/dw2-single-line-discriminators.exp
* gdb.dwarf2/dw2-strp.exp
* gdb.dwarf2/dw2-undefined-ret-addr.exp
* gdb.dwarf2/dw2-unresolved.exp
* gdb.dwarf2/dw2-var-zero-addr.exp
* gdb.dwarf2/dw4-sig-types.exp
* gdb.dwarf2/dwz.exp
* gdb.dwarf2/dynarr-ptr.exp
* gdb.dwarf2/enum-type.exp
* gdb.dwarf2/gdb-index.exp
* gdb.dwarf2/implptr-64bit.exp
* gdb.dwarf2/implptr-optimized-out.exp
* gdb.dwarf2/implptr.exp
* gdb.dwarf2/implref-array.exp
* gdb.dwarf2/implref-const.exp
* gdb.dwarf2/implref-global.exp
* gdb.dwarf2/implref-struct.exp
* gdb.dwarf2/mac-fileno.exp
* gdb.dwarf2/main-subprogram.exp
* gdb.dwarf2/member-ptr-forwardref.exp
* gdb.dwarf2/method-ptr.exp
* gdb.dwarf2/missing-sig-type.exp
* gdb.dwarf2/nonvar-access.exp
* gdb.dwarf2/opaque-type-lookup.exp
* gdb.dwarf2/pieces-optimized-out.exp
* gdb.dwarf2/pieces.exp
* gdb.dwarf2/pr10770.exp
* gdb.dwarf2/pr13961.exp
* gdb.dwarf2/staticvirtual.exp
* gdb.dwarf2/subrange.exp
* gdb.dwarf2/symtab-producer.exp
* gdb.dwarf2/trace-crash.exp
* gdb.dwarf2/typeddwarf.exp
* gdb.dwarf2/valop.exp
* gdb.dwarf2/watch-notconst.exp
* gdb.fortran/array-element.exp
* gdb.fortran/charset.exp
* gdb.fortran/common-block.exp
* gdb.fortran/complex.exp
* gdb.fortran/derived-type-function.exp
* gdb.fortran/derived-type.exp
* gdb.fortran/logical.exp
* gdb.fortran/module.exp
* gdb.fortran/multi-dim.exp
* gdb.fortran/nested-funcs.exp
* gdb.fortran/print-formatted.exp
* gdb.fortran/subarray.exp
* gdb.fortran/vla-alloc-assoc.exp
* gdb.fortran/vla-datatypes.exp
* gdb.fortran/vla-history.exp
* gdb.fortran/vla-ptr-info.exp
* gdb.fortran/vla-ptype-sub.exp
* gdb.fortran/vla-ptype.exp
* gdb.fortran/vla-sizeof.exp
* gdb.fortran/vla-type.exp
* gdb.fortran/vla-value-sub-arbitrary.exp
* gdb.fortran/vla-value-sub-finish.exp
* gdb.fortran/vla-value-sub.exp
* gdb.fortran/vla-value.exp
* gdb.fortran/whatis_type.exp
* gdb.go/chan.exp
* gdb.go/handcall.exp
* gdb.go/hello.exp
* gdb.go/integers.exp
* gdb.go/methods.exp
* gdb.go/package.exp
* gdb.go/strings.exp
* gdb.go/types.exp
* gdb.go/unsafe.exp
* gdb.guile/scm-arch.exp
* gdb.guile/scm-block.exp
* gdb.guile/scm-breakpoint.exp
* gdb.guile/scm-cmd.exp
* gdb.guile/scm-disasm.exp
* gdb.guile/scm-equal.exp
* gdb.guile/scm-frame-args.exp
* gdb.guile/scm-frame-inline.exp
* gdb.guile/scm-frame.exp
* gdb.guile/scm-iterator.exp
* gdb.guile/scm-math.exp
* gdb.guile/scm-objfile.exp
* gdb.guile/scm-ports.exp
* gdb.guile/scm-symbol.exp
* gdb.guile/scm-symtab.exp
* gdb.guile/scm-value-cc.exp
* gdb.guile/types-module.exp
* gdb.linespec/break-ask.exp
* gdb.linespec/cpexplicit.exp
* gdb.linespec/explicit.exp
* gdb.linespec/keywords.exp
* gdb.linespec/linespec.exp
* gdb.linespec/ls-dollar.exp
* gdb.linespec/ls-errs.exp
* gdb.linespec/skip-two.exp
* gdb.linespec/thread.exp
* gdb.mi/mi-async.exp
* gdb.mi/mi-basics.exp
* gdb.mi/mi-break.exp
* gdb.mi/mi-catch-load.exp
* gdb.mi/mi-cli.exp
* gdb.mi/mi-cmd-param-changed.exp
* gdb.mi/mi-console.exp
* gdb.mi/mi-detach.exp
* gdb.mi/mi-disassemble.exp
* gdb.mi/mi-eval.exp
* gdb.mi/mi-file-transfer.exp
* gdb.mi/mi-file.exp
* gdb.mi/mi-fill-memory.exp
* gdb.mi/mi-inheritance-syntax-error.exp
* gdb.mi/mi-linespec-err-cp.exp
* gdb.mi/mi-logging.exp
* gdb.mi/mi-memory-changed.exp
* gdb.mi/mi-read-memory.exp
* gdb.mi/mi-record-changed.exp
* gdb.mi/mi-reg-undefined.exp
* gdb.mi/mi-regs.exp
* gdb.mi/mi-return.exp
* gdb.mi/mi-reverse.exp
* gdb.mi/mi-simplerun.exp
* gdb.mi/mi-solib.exp
* gdb.mi/mi-stack.exp
* gdb.mi/mi-stepi.exp
* gdb.mi/mi-syn-frame.exp
* gdb.mi/mi-until.exp
* gdb.mi/mi-var-block.exp
* gdb.mi/mi-var-child.exp
* gdb.mi/mi-var-cmd.exp
* gdb.mi/mi-var-cp.exp
* gdb.mi/mi-var-display.exp
* gdb.mi/mi-var-invalidate.exp
* gdb.mi/mi-var-list-children-invalid-grandchild.exp
* gdb.mi/mi-vla-fortran.exp
* gdb.mi/mi-watch.exp
* gdb.mi/mi2-var-child.exp
* gdb.mi/user-selected-context-sync.exp
* gdb.modula2/unbounded-array.exp
* gdb.multi/dummy-frame-restore.exp
* gdb.multi/multi-arch-exec.exp
* gdb.multi/multi-arch.exp
* gdb.multi/tids.exp
* gdb.multi/watchpoint-multi.exp
* gdb.opencl/callfuncs.exp
* gdb.opencl/convs_casts.exp
* gdb.opencl/datatypes.exp
* gdb.opencl/operators.exp
* gdb.opencl/vec_comps.exp
* gdb.opt/clobbered-registers-O2.exp
* gdb.opt/inline-break.exp
* gdb.opt/inline-bt.exp
* gdb.opt/inline-cmds.exp
* gdb.opt/inline-locals.exp
* gdb.pascal/case-insensitive-symbols.exp
* gdb.pascal/floats.exp
* gdb.pascal/gdb11492.exp
* gdb.python/lib-types.exp
* gdb.python/py-arch.exp
* gdb.python/py-as-string.exp
* gdb.python/py-bad-printers.exp
* gdb.python/py-block.exp
* gdb.python/py-breakpoint-create-fail.exp
* gdb.python/py-breakpoint.exp
* gdb.python/py-caller-is.exp
* gdb.python/py-cmd.exp
* gdb.python/py-explore-cc.exp
* gdb.python/py-explore.exp
* gdb.python/py-finish-breakpoint.exp
* gdb.python/py-finish-breakpoint2.exp
* gdb.python/py-frame-args.exp
* gdb.python/py-frame-inline.exp
* gdb.python/py-frame.exp
* gdb.python/py-framefilter-mi.exp
* gdb.python/py-infthread.exp
* gdb.python/py-lazy-string.exp
* gdb.python/py-linetable.exp
* gdb.python/py-mi-events.exp
* gdb.python/py-mi-objfile.exp
* gdb.python/py-mi.exp
* gdb.python/py-objfile.exp
* gdb.python/py-pp-integral.exp
* gdb.python/py-pp-maint.exp
* gdb.python/py-pp-re-notag.exp
* gdb.python/py-pp-registration.exp
* gdb.python/py-recurse-unwind.exp
* gdb.python/py-strfns.exp
* gdb.python/py-symbol.exp
* gdb.python/py-symtab.exp
* gdb.python/py-sync-interp.exp
* gdb.python/py-typeprint.exp
* gdb.python/py-unwind-maint.exp
* gdb.python/py-unwind.exp
* gdb.python/py-value-cc.exp
* gdb.python/py-xmethods.exp
* gdb.reverse/amd64-tailcall-reverse.exp
* gdb.reverse/break-precsave.exp
* gdb.reverse/break-reverse.exp
* gdb.reverse/consecutive-precsave.exp
* gdb.reverse/consecutive-reverse.exp
* gdb.reverse/finish-precsave.exp
* gdb.reverse/finish-reverse-bkpt.exp
* gdb.reverse/finish-reverse.exp
* gdb.reverse/fstatat-reverse.exp
* gdb.reverse/getresuid-reverse.exp
* gdb.reverse/i386-precsave.exp
* gdb.reverse/i386-reverse.exp
* gdb.reverse/i386-sse-reverse.exp
* gdb.reverse/i387-env-reverse.exp
* gdb.reverse/i387-stack-reverse.exp
* gdb.reverse/insn-reverse.exp
* gdb.reverse/machinestate-precsave.exp
* gdb.reverse/machinestate.exp
* gdb.reverse/next-reverse-bkpt-over-sr.exp
* gdb.reverse/pipe-reverse.exp
* gdb.reverse/readv-reverse.exp
* gdb.reverse/recvmsg-reverse.exp
* gdb.reverse/rerun-prec.exp
* gdb.reverse/s390-mvcle.exp
* gdb.reverse/step-precsave.exp
* gdb.reverse/step-reverse.exp
* gdb.reverse/time-reverse.exp
* gdb.reverse/until-precsave.exp
* gdb.reverse/until-reverse.exp
* gdb.reverse/waitpid-reverse.exp
* gdb.reverse/watch-precsave.exp
* gdb.reverse/watch-reverse.exp
* gdb.rust/generics.exp
* gdb.rust/methods.exp
* gdb.rust/modules.exp
* gdb.rust/simple.exp
* gdb.server/connect-with-no-symbol-file.exp
* gdb.server/ext-attach.exp
* gdb.server/ext-restart.exp
* gdb.server/ext-wrapper.exp
* gdb.server/file-transfer.exp
* gdb.server/server-exec-info.exp
* gdb.server/server-kill.exp
* gdb.server/server-mon.exp
* gdb.server/wrapper.exp
* gdb.stabs/exclfwd.exp
* gdb.stabs/gdb11479.exp
* gdb.threads/clone-new-thread-event.exp
* gdb.threads/corethreads.exp
* gdb.threads/current-lwp-dead.exp
* gdb.threads/dlopen-libpthread.exp
* gdb.threads/gcore-thread.exp
* gdb.threads/sigstep-threads.exp
* gdb.threads/watchpoint-fork.exp
* gdb.trace/actions-changed.exp
* gdb.trace/backtrace.exp
* gdb.trace/change-loc.exp
* gdb.trace/circ.exp
* gdb.trace/collection.exp
* gdb.trace/disconnected-tracing.exp
* gdb.trace/ftrace.exp
* gdb.trace/mi-trace-frame-collected.exp
* gdb.trace/mi-trace-unavailable.exp
* gdb.trace/mi-traceframe-changed.exp
* gdb.trace/mi-tsv-changed.exp
* gdb.trace/no-attach-trace.exp
* gdb.trace/passc-dyn.exp
* gdb.trace/qtro.exp
* gdb.trace/range-stepping.exp
* gdb.trace/read-memory.exp
* gdb.trace/save-trace.exp
* gdb.trace/signal.exp
* gdb.trace/status-stop.exp
* gdb.trace/tfile.exp
* gdb.trace/trace-break.exp
* gdb.trace/trace-buffer-size.exp
* gdb.trace/trace-condition.exp
* gdb.trace/tracefile-pseudo-reg.exp
* gdb.trace/tstatus.exp
* gdb.trace/unavailable.exp
* gdb.trace/while-dyn.exp
* gdb.trace/while-stepping.exp

7 years agoFix incorrect reference to source files
Luis Machado [Fri, 23 Dec 2016 16:46:38 +0000 (10:46 -0600)]
Fix incorrect reference to source files

gdb/gdbserver/ChangeLog:

2016-12-23  Luis Machado  <lgustavo@codesourcery.com>

* win32-i386-low.c: Fix incorrect reference to a couple source files.
* nto-x86-low.c: Likewise.

7 years agoBump gold version number to 1.14.
Cary Coutant [Fri, 23 Dec 2016 16:00:13 +0000 (08:00 -0800)]
Bump gold version number to 1.14.

* NEWS: Add new features in 1.14.
* version.cc (version_string): Bump to 1.14.

7 years agoCall target specific add_symbols function
Alan Modra [Fri, 23 Dec 2016 13:13:54 +0000 (23:43 +1030)]
Call target specific add_symbols function

This allows targets that have target specific code to add object
symbols to make use of the generic archive handling.

* linker.c (generic_link_check_archive_element): Call target
bfd_link_add_symbols to add element symbols.

7 years agoRemove "collect" forms of generic linker add symbols functions
Alan Modra [Fri, 23 Dec 2016 12:58:38 +0000 (23:28 +1030)]
Remove "collect" forms of generic linker add symbols functions

Nothing calls them and they were in the way of a bug fix.

* linker.c (generic_link_add_symbols): Delete.  Merge into..
(_bfd_generic_link_add_symbols): ..here.
(generic_link_check_archive_element_no_collect): Delete.
(generic_link_check_archive_element_collect): Likewise.
(generic_link_add_object_symbols): Remove "collect" param.  Update
callers.
(generic_link_add_symbol_list): Likewise.
(generic_link_check_archive_element): Likewise.  Call
bfd_link_add_symbols rather than generic_link_add_object_symbols.
* libbfd-in.h (_bfd_generic_link_add_symbols_collect): Delete.
* libbfd.h: Regenerate.

7 years agohppa-linux-gnu-ranlib: libcpp.a: File format not recognized
Alan Modra [Thu, 22 Dec 2016 02:42:07 +0000 (13:12 +1030)]
hppa-linux-gnu-ranlib: libcpp.a: File format not recognized

This stops an --enable-targets selection affecting the main target in
regards to forcing 64-bit archives.  It also means mips64 and s390x
will revert to binutils-2.25 and binutils-2.26 behaviour of not
forcing 64-bit archives at least in the common case when plugins were
enabled.

PR binutils/20464
PR binutils/14625
* configure.ac: Revert 2016-05-25 configure change setting
want_64_bit_archive for mips64 and s390x.  Revise USE_64_BIT_ARCHIVE
description.
* configure: Regenerate.
* config.in: Regenerate.

7 years agoUpdated email address.
Bernhard Heckel [Fri, 23 Dec 2016 11:29:42 +0000 (12:29 +0100)]
Updated email address.

2016-12-23  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
* MAINTAINERS (Write After Approval): Updated email address.

Change-Id: I46b81392c2bd4b04e8e2aea2bb4bef2d0b509d24

7 years ago[msp430] Sync tc-msp430.c with devices.csv
Joe Seymour [Tue, 20 Dec 2016 14:50:49 +0000 (14:50 +0000)]
[msp430] Sync tc-msp430.c with devices.csv

This patch syncs the generated data structure in tc-msp430.c with the
latest version of devices.csv released by TI.

My understanding is that the devices being removed were "invalid spins",
so can't be being used by anyone, and never will be. Current web
searches related to these devices return no relevant results.

Built and tested (no regressions) as follows:
  Configured with: --target=msp430-elf --disable-gdb
  Test variations:
    msp430-sim/-mcpu=msp430
    msp430-sim/-mcpu=msp430x
    msp430-sim/-mcpu=msp430x/-mlarge/-mdata-region=either/-mcode-region=either
    msp430-sim/-mhwmult=none
    msp430-sim/-mhwmult=f5series

gas/
* config/tc-msp430.c (msp430_mcu_data): Sync with data from TI's
devices.csv file as of September 2016.

7 years agoBump version to 2.28.51
Tristan Gingold [Fri, 23 Dec 2016 08:50:53 +0000 (09:50 +0100)]
Bump version to 2.28.51

bfd/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* version.m4: Bump version to 2.28.51
* configure: Regenerate.

binutils/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gas/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gprof/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

ld/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

opcodes/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

7 years agoAdd marker in NEWS files
Tristan Gingold [Fri, 23 Dec 2016 08:43:13 +0000 (09:43 +0100)]
Add marker in NEWS files

binutils/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.28.

gas/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.28.

ld/
2016-12-23  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.28.

7 years agoRegenerate pot files.
Tristan Gingold [Fri, 23 Dec 2016 08:32:28 +0000 (09:32 +0100)]
Regenerate pot files.

7 years agoAdd -z bndplt support (for Intel MPX).
Cary Coutant [Sat, 17 Dec 2016 03:17:38 +0000 (19:17 -0800)]
Add -z bndplt support (for Intel MPX).

gold/
PR gold/17643
* options.h (-z bndplt): New option.
* x86_64.cc (Output_data_plt_x86_64::regular_count): New method.
(Output_data_plt_x86_64::address_for_global): Move implementation into
virtual method.
(Output_data_plt_x86_64::address_for_local): Likewise.
(Output_data_plt_x86_64::got): New method.
(Output_data_plt_x86_64::got_plt): New method.
(Output_data_plt_x86_64::got_irelative): New method.
(Output_data_plt_x86_64::do_address_for_global): New virtual method.
(Output_data_plt_x86_64::do_address_for_local): New virtual method.
(class Output_data_plt_x86_64_bnd): New class.
(Target_x86_64::do_make_data_plt): Move out of line and specialize
for each size (both overloads).
(Output_data_plt_x86_64::set_final_data_size): Cosmetic changes.
* testsuite/Makefile.am (bnd_plt_1): New test case.
(bnd_ifunc_1): New test case.
(bnd_ifunc_2): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/bnd_ifunc_1.s: New source file.
* testsuite/bnd_ifunc_1.sh: New shell script.
* testsuite/bnd_ifunc_2.s: New source file.
* testsuite/bnd_ifunc_2.sh: New shell script.
* testsuite/bnd_plt_1.s: New source file.
* testsuite/bnd_plt_1.sh: New shell script.

7 years agoFix placement of forced local symbols in the dynamic symbol table.
Cary Coutant [Thu, 22 Dec 2016 22:06:24 +0000 (14:06 -0800)]
Fix placement of forced local symbols in the dynamic symbol table.

Gold was not placing forced-local symbols (e.g., hidden visibility)
at the front of the dynamic symbol table, or including them in the
count of local symbols recorded in the .dynsym section's sh_info field.

gold/
* layout.cc (Layout::finalize): Track count of forced-local symbols
in .dynsym.
(Layout::create_symtab_sections): Add local_dynamic_count parameter;
use that instead of sh_info value.
(Layout::create_dynamic_symtab): Add pforced_local_dynamic_count
parameter; pass it to Symtab::set_dynsym_indexes().  Include forced
locals in sh_info value.  Pass index of first real global to
Dynobj::create_gnu_hash_table() and Dynobj::create_elf_hash_table().
* layout.h (Layout::create_symtab_sections): Add local_dynamic_count
parameter.
(Layout::create_dynamic_symtab): Add pforced_local_dynamic_count
parameter.
* symtab.cc (Symbol_table::set_dynsym_indexes): Add pforced_local_count
parameter.  Process forced-local symbols first and return the count.
(Symbol_table::finalize): Update comments.
* symtab.h (Symbol_table::set_dynsym_indexes): Add pforced_local_count
parameter.
(Symbol_table::first_dynamic_global_index_): Update comment.
(Symbol_table::dynamic_count_): Update comment.
* testsuite/Makefile.am (ifuncmod1.sh): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/ifuncmod1.sh: New shell script.

7 years agoFix problem where version script causes predefined hidden symbol to be defined twice.
Cary Coutant [Thu, 22 Dec 2016 01:32:39 +0000 (17:32 -0800)]
Fix problem where version script causes predefined hidden symbol to be defined twice.

When creating a predefined hidden symbol like _GLOBAL_OFFSET_TABLE_, gold
was incorrectly letting a version script add a version to the symbol,
resulting in two copies of the symbol, both STB_LOCAL, but one of which
was grouped in the globals part of the symbol table.

gold/
* symtab.cc (Symbol_table::define_special_symbol): Add is_forced_local
parameter; if set, do not check version script.
(Symbol_table::do_define_in_output_data): Pass is_forced_local for
STB_LOCAL predefined symbols.
(Symbol_table::do_define_in_output_segment): Likewise.
(Symbol_table::do_define_in_output_segment): Likewise.
(Symbol_table::do_define_as_constant): Likewise.
* symtab.h (Symbol_table::define_special_symbol): Add is_forced_local
parameter. Adjust all callers.
* testsuite/Makefile.am (ver_test_8.sh): New test case.
* testsuite/Makefile.in: Regenerate.
* ver_test_8.sh: New test script.

7 years agoinfrun.c (set_step_over_info): Add comment.
Doug Evans [Thu, 22 Dec 2016 23:50:10 +0000 (15:50 -0800)]
infrun.c (set_step_over_info): Add comment.

gdb/ChangeLog:

* infrun.c (set_step_over_info): Add comment.

7 years agoNew syntax for mt print symbols,msymbols,psymbols.
Doug Evans [Mon, 19 Dec 2016 16:33:46 +0000 (08:33 -0800)]
New syntax for mt print symbols,msymbols,psymbols.

gdb/ChangeLog:

* NEWS: Document new syntax for "mt print symbols", "mt print psymbols"
and "mt print msymbols" commands.
* psymtab.c (DEV_TTY): Delete.
(dump_psymtab_addrmap): Don't dump if psymtabs_addrmap is NULL.
(maintenance_print_psymbols): Rewrite for new syntax:
mt print psymbols [-objfile objfile] [-pc address] [outfile]
mt print psymbols [-objfile objfile] [-source source] [outfile]
(_initialize_psymtab): Update help text.
* symmisc.c (maintenance_print_symbols): Rewrite for new syntax:
mt print symbols [-pc address] [outfile]
mt print symbols [-objfile objfile] [-source source] [outfile]
(maintenance_print_msymbols): Rewrite for new syntax:
mt print msymbols [-objfile objfile] [outfile]
Only print symbols for the current progspace.
(_initialize_symmisc): Update help text.

gdb/doc/ChangeLog:

* gdb.texinfo (Symbols): Update docs for symbol printing maintenance
commands.

gdb/testsuite/ChangeLog:

* gdb.base/maint.exp: Update tests for maint print symbols, psymbols
and msymbols.

7 years agoClass-ify ui_out
Simon Marchi [Thu, 22 Dec 2016 21:17:31 +0000 (16:17 -0500)]
Class-ify ui_out

This patch finalizes the C++ conversion of the ui-out subsystem, by
turning the ui_out and ui_out_impl structures into a single class
hierarchy.  ui_out functions are turned into virtual methods of that new
class, so as a result there are a lot of call sites to update.

In the previous version of the patchset, there were separate ui_out and
ui_out_impl classes, but it wasn't really useful and added boilerplate.
In this version there is simply an ui_out base class that is
extended for CLI, TUI and MI.

It's a bit hard to maintain a ChangeLog for such a big patch, I did my
best but I'm sure there are some missing or outdated info in there...

gdb/ChangeLog:

    * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header,
    ui_out_table_body,  ui_out_field_int, ui_out_field_fmt_int,
    ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream,
    ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text,
    ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags,
    ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect):
    Remove, replace with a method in class ui_out.
    (table_begin_ftype): Remove, replace with pure virtual method in
    class ui_out.
    (table_body_ftype): Likewise.
    (table_end_ftype): Likewise.
    (table_header_ftype): Likewise.
    (ui_out_begin_ftype): Likewise.
    (ui_out_end_ftype): Likewise.
    (field_int_ftype): Likewise.
    (field_skip_ftype): Likewise.
    (field_string_ftype): Likewise.
    (field_fmt_ftype): Likewise.
    (spaces_ftype): Likewise.
    (text_ftype): Likewise.
    (message_ftype): Likewise.
    (wrap_hint_ftype): Likewise.
    (flush_ftype): Likewise.
    (redirect_ftype): Likewise.
    (data_destroy_ftype): Likewise.
    (struct ui_out_impl): Remove, replace with class ui_out.
    (ui_out_new): Remove.
    (class ui_out): New class.
    * ui-out.c (struct ui_out): Remove, replaced with class ui_out.
    (current_level): Remove, replace with ui_out method.
    (push_level): Likewise.
    (pop_level): Likewise.
    (uo_table_begin, uo_table_body, uo_table_end, uo_table_header,
    uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt,
    uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush,
    uo_redirect, uo_field_string): Remove.
    (ui_out_table_begin): Replace with ...
    (ui_out::table_begin): ... this.
    (ui_out_table_body): Replace with ...
    (ui_out::table_body): ... this.
    (ui_out_table_end): Replace with ...
    (ui_out::table_end): ... this.
    (ui_out_table_header): Replace with ...
    (ui_out::table_header): ... this.
    (ui_out_begin): Replace with ...
    (ui_out::begin): ... this.
    (ui_out_end): Replace with ...
    (ui_out::end): ... this.
    (ui_out_field_int): Replace with ...
    (ui_out::field_int): ... this.
    (ui_out_field_fmt_int): Replace with ...
    (ui_out::field_fmt_int): ... this.
    (ui_out_field_core_addr): Replace with ...
    (ui_out::field_core_addr): ... this.
    (ui_out_field_stream): Replace with ...
    (ui_out::field_stream): ... this.
    (ui_out_field_skip): Replace with ...
    (ui_out::field_skip): ... this.
    (ui_out_field_string): Replace with ...
    (ui_out::field_string): ... this.
    (ui_out_field_fmt): Replace with ...
    (ui_out::field_fmt): ... this.
    (ui_out_spaces): Replace with ...
    (ui_out::spaces): ... this.
    (ui_out_text): Replace with ...
    (ui_out::text): ... this.
    (ui_out_message): Replace with ...
    (ui_out::message): ... this.
    (ui_out_wrap_hint): Replace with ...
    (ui_out::wrap_hint): ... this.
    (ui_out_flush): Replace with ...
    (ui_out::flush): ... this.
    (ui_out_redirect): Replace with ...
    (ui_out::redirect): ... this.
    (ui_out_test_flags): Replace with ...
    (ui_out::test_flags): ... this.
    (ui_out_is_mi_like_p): Replace with ...
    (ui_out::is_mi_like_p): ... this.
    (verify_field): Replace with ...
    (ui_out::verify_field): ... this.
    (ui_out_query_field): Replace with ...
    (ui_out::query_table_field): ... this.
    (ui_out_data): Remove.
    (ui_out_new): Remove, replace with ...
    (ui_out::ui_out): ... this constructor.
    (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end,
    do_cleanup_end, make_cleanup_ui_out_tuple_begin_end,
    make_cleanup_ui_out_list_begin_end): Update fallouts of struct
    ui_out -> class ui_out change.
    * cli-out.c (cli_out_data): Remove.
    (cli_uiout_dtor): Remove.
    (cli_table_begin): Replace with ...
    (cli_ui_out::do_table_begin): ... this new method.
    (cli_table_body): Replace with ...
    (cli_ui_out::do_table_body): ... this new method.
    (cli_table_end): Replace with ...
    (cli_ui_out::do_table_end): ... this new method.
    (cli_table_header): Replace with ...
    (cli_ui_out::do_table_header): ... this new method.
    (cli_begin): Replace with ...
    (cli_ui_out::do_begin): ... this new method.
    (cli_end): Replace with ...
    (cli_ui_out::do_end): ... this new method.
    (cli_field_int): Replace with ...
    (cli_ui_out::do_field_int): ... this new method.
    (cli_field_skip): Replace with ...
    (cli_ui_out::do_field_skip): ... this new method.
    (cli_field_string): Replace with ...
    (cli_ui_out::do_field_string): ... this new method.
    (cli_field_fmt): Replace with ...
    (cli_ui_out::do_field_fmt): ... this new method.
    (cli_spaces): Replace with ...
    (cli_ui_out::do_spaces): ... this new method.
    (cli_text): Replace with ...
    (cli_ui_out::do_text): ... this new method.
    (cli_message): Replace with ...
    (cli_ui_out::do_message): ... this new method.
    (cli_wrap_hint): Replace with ...
    (cli_ui_out::do_wrap_hint): ... this new method.
    (cli_flush): Replace with ...
    (cli_ui_out::do_flush): ... this new method.
    (cli_redirect): Replace with ...
    (cli_ui_out::do_redirect): ... this new method.
    (out_field_fmt): Replace with ...
    (cli_ui_out::out_field_fmt): ... this new method.
    (field_separator): Replace with ...
    (cli_ui_out::field_separator): ... this new method.
    (cli_out_set_stream): Replace with ...
    (cli_ui_out::set_stream): ... this new method.
    (cli_ui_out_impl): Remove.
    (cli_out_data_ctor): Remove.
    (cli_ui_out_impl::cli_ui_out_impl): New constructor.
    (cli_ui_out_impl::~cli_ui_out_impl): New destructor.
    (cli_out_new): Change return type to cli_ui_out *, instantiate a
    cli_ui_out.
    * cli-out.h (cli_ui_out_data): Remove, replace with class
    cli_ui_out.
    (class cli_ui_out): New class.
    (cli_ui_out_impl): Remove.
    (cli_out_data_ctor): Remove.
    (cli_out_new): Change return type to cli_ui_out*.
    (cli_out_set_stream): Remove.
    * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type
    to cli_ui_out*.
    (cli_interpreter_resume): Adapt.
    (cli_interpreter_exec): Adapt.
    * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove.
    (mi_ui_out_impl): Remove.
    (mi_table_begin): Replace with ...
    (mi_ui_out::do_table_begin): ... this.
    (mi_table_body): Replace with ...
    (mi_ui_out::do_table_body): ... this.
    (mi_table_end): Replace with ...
    (mi_ui_out::do_table_end): ... this.
    (mi_table_header): Replace with ...
    (mi_ui_out::do_table_header): ... this.
    (mi_begin): Replace with ...
    (mi_ui_out::do_begin): ... this.
    (mi_end): Replace with ...
    (mi_ui_out::do_end): ... this.
    (mi_field_int): Replace with ...
    (mi_ui_out::do_field_int): ... this.
    (mi_field_skip): Replace with ...
    (mi_ui_out::do_field_skip): ... this.
    (mi_field_string): Replace with ...
    (mi_ui_out::do_field_string): ... this.
    (mi_field_fmt): Replace with ...
    (mi_ui_out::do_field_fmt): ... this.
    (mi_spaces): Replace with ...
    (mi_ui_out::do_spaces): ... this.
    (mi_text): Replace with ...
    (mi_ui_out::do_text): ... this.
    (mi_message): Replace with ...
    (mi_ui_out::do_message): ... this.
    (mi_wrap_hint): Replace with ...
    (mi_ui_out::do_wrap_hint): ... this.
    (mi_flush): Replace with ...
    (mi_ui_out::do_flush): ... this.
    (mi_redirect): Replace with ...
    (mi_ui_out::do_redirect):
    (field_separator): Replace with ...
    (mi_ui_out::field_separator):
    (mi_open): Replace with ...
    (mi_ui_out::open): ... this.
    (mi_close): Replace with ...
    (mi_ui_out::close): ... this.
    (mi_out_rewind): Replace with ...
    (mi_ui_out::rewind): ... this.
    (mi_out_put): Replace with ...
    (mi_ui_out::put): ... this.
    (mi_version): Replace with ...
    (mi_ui_out::version): ... this.
    (mi_out_data_ctor): Replace with ...
    (mi_ui_out::mi_ui_out): ... this.
    (mi_out_data_dtor): Replace with ...
    (mi_ui_out::~mi_ui_out): ... this.
    (mi_out_new): Change return type to mi_ui_out*, instantiate
    an mi_ui_out object.
    (as_mi_ui_out): New function.
    (mi_version): Update fallouts of struct ui_out to class ui_out
    transition.
    (mi_out_put): Likewise.
    (mi_out_rewind): Likewise.
    * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*.
    * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl):
    Remove.
    (tui_field_int): Replace with ...
    (tui_ui_out::do_field_int): ... this.
    (tui_field_string): Replace with ...
    (tui_ui_out::do_field_string): ... this.
    (tui_field_fmt): Replace with ...
    (tui_ui_out::do_field_fmt): ... this.
    (tui_text): Replace with ...
    (tui_ui_out::do_text): ... this.
    (tui_out_new): Change return type to tui_ui_out*, instantiate
    tui_ui_out object.
    (tui_ui_out::tui_ui_out): New.
    * tui/tui-out.h: New file.
    * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h.
    * tui/tui-io.c: Include tui/tui-out.h.
    (tui_old_uiout): Change type to cli_ui_out*.
    (tui_setup_io): Use dynamic_cast.
    * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*.
    * tui/tui-interp.c (tui_resume): Adapt.
    * ada-lang.c (print_it_exception): Update fallouts of struct
    ui_out to class ui_out transition.
    (print_one_exception): Likewise.
    (print_mention_exception): Likewise.
    * ada-tasks.c (print_ada_task_info): Likewise.
    (info_task): Likewise.
    (task_command): Likewise.
    * auto-load.c (print_script): Likewise.
    (auto_load_info_scripts): Likewise.
    (info_auto_load_cmd): Likewise.
    * break-catch-sig.c (signal_catchpoint_print_one): Likewise.
    * break-catch-syscall.c (print_it_catch_syscall): Likewise.
    (print_one_catch_syscall): Likewise.
    * break-catch-throw.c (print_it_exception_catchpoint): Likewise.
    (print_one_exception_catchpoint): Likewise.
    (print_one_detail_exception_catchpoint): Likewise.
    (print_mention_exception_catchpoint): Likewise.
    * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise.
    (print_solib_event): Likewise.
    (watchpoint_check): Likewise.
    (wrap_indent_at_field): Likewise.
    (print_breakpoint_location): Likewise.
    (output_thread_groups): Likewise.
    (print_one_breakpoint_location): Likewise.
    (breakpoint_1): Likewise.
    (default_collect_info): Likewise.
    (watchpoints_info): Likewise.
    (print_it_catch_fork): Likewise.
    (print_one_catch_fork): Likewise.
    (print_it_catch_vfork): Likewise.
    (print_one_catch_vfork): Likewise.
    (print_it_catch_solib): Likewise.
    (print_one_catch_solib): Likewise.
    (print_it_catch_exec): Likewise.
    (print_one_catch_exec): Likewise.
    (mention): Likewise.
    (print_it_ranged_breakpoint): Likewise.
    (print_one_ranged_breakpoint): Likewise.
    (print_one_detail_ranged_breakpoint): Likewise.
    (print_mention_ranged_breakpoint): Likewise.
    (print_it_watchpoint): Likewise.
    (print_mention_watchpoint): Likewise.
    (print_it_masked_watchpoint): Likewise.
    (print_one_detail_masked_watchpoint): Likewise.
    (print_mention_masked_watchpoint): Likewise.
    (bkpt_print_it): Likewise.
    (tracepoint_print_one_detail): Likewise.
    (tracepoint_print_mention): Likewise.
    (update_static_tracepoint): Likewise.
    (tracepoints_info): Likewise.
    (save_breakpoints): Likewise.
    * cli/cli-cmds.c (complete_command): Likewise.
    * cli/cli-logging.c (set_logging_redirect): Likewise.
    (pop_output_files): Likewise.
    (handle_redirections): Likewise.
    * cli/cli-script.c (print_command_lines): Likewise.
    * cli/cli-setshow.c (do_show_command): Likewise.
    (cmd_show_list): Likewise.
    * cp-abi.c (list_cp_abis): Likewise.
    (show_cp_abi_cmd): Likewise.
    * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise.
    * disasm.c (gdb_pretty_print_insn): Likewise.
    (do_mixed_source_and_assembly_deprecated): Likewise.
    (do_mixed_source_and_assembly): Likewise.
    * gdb_bfd.c (print_one_bfd): Likewise.
    (maintenance_info_bfds): Likewise.
    * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
    * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
    * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise.
    * i386-tdep.c (i386_mpx_print_bounds): Likewise.
    * infcmd.c (run_command_1): Likewise.
    (print_return_value_1): Likewise.
    * inferior.c (print_selected_inferior): Likewise.
    (print_inferior): Likewise.
    * infrun.c (print_end_stepping_range_reason): Likewise.
    (print_signal_exited_reason): Likewise.
    (print_exited_reason): Likewise.
    (print_signal_received_reason): Likewise.
    (print_no_history_reason): Likewise.
    * interps.c (interp_set): Likewise.
    * linespec.c (decode_line_full): Likewise.
    * linux-thread-db.c (info_auto_load_libthread_db): Likewise.
    * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise.
    (mi_cmd_env_path): Likewise.
    (mi_cmd_env_dir): Likewise.
    (mi_cmd_inferior_tty_show): Likewise.
    * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise.
    (print_partial_file_name): Likewise.
    (mi_cmd_file_list_exec_source_files): Likewise.
    * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise.
    (mi_cmd_info_gdb_mi_command): Likewise.
    * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise.
    (mi_cmd_stack_list_args): Likewise.
    (list_arg_or_local): Likewise.
    * mi/mi-cmd-var.c (print_varobj): Likewise.
    (mi_cmd_var_create): Likewise.
    (mi_cmd_var_delete): Likewise.
    (mi_cmd_var_set_format): Likewise.
    (mi_cmd_var_show_format): Likewise.
    (mi_cmd_var_info_num_children): Likewise.
    (mi_cmd_var_list_children): Likewise.
    (mi_cmd_var_info_type): Likewise.
    (mi_cmd_var_info_path_expression): Likewise.
    (mi_cmd_var_info_expression): Likewise.
    (mi_cmd_var_show_attributes): Likewise.
    (mi_cmd_var_evaluate_expression): Likewise.
    (mi_cmd_var_assign): Likewise.
    (varobj_update_one): Likewise.
    * mi/mi-interp.c (as_mi_interp): Likewise.
    (mi_on_normal_stop_1): Likewise.
    (mi_tsv_modified): Likewise.
    (mi_breakpoint_created): Likewise.
    (mi_breakpoint_modified): Likewise.
    (mi_solib_loaded): Likewise.
    (mi_solib_unloaded): Likewise.
    (mi_command_param_changed): Likewise.
    (mi_memory_changed): Likewise.
    (mi_user_selected_context_changed): Likewise.
    * mi/mi-main.c (print_one_inferior): Likewise.
    (output_cores): Likewise.
    (list_available_thread_groups): Likewise.
    (mi_cmd_data_list_register_names): Likewise.
    (mi_cmd_data_list_changed_registers): Likewise.
    (output_register): Likewise.
    (mi_cmd_data_evaluate_expression): Likewise.
    (mi_cmd_data_read_memory): Likewise.
    (mi_cmd_data_read_memory_bytes): Likewise.
    (mi_cmd_list_features): Likewise.
    (mi_cmd_list_target_features): Likewise.
    (mi_cmd_add_inferior): Likewise.
    (mi_execute_command): Likewise.
    (mi_load_progress): Likewise.
    (print_variable_or_computed): Likewise.
    (mi_cmd_trace_frame_collected): Likewise.
    * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise.
    * osdata.c (info_osdata_command): Likewise.
    * probe.c (gen_ui_out_table_header_info): Likewise.
    (print_ui_out_not_applicables): Likewise.
    (print_ui_out_info): Likewise.
    (info_probes_for_ops): Likewise.
    (enable_probes_command): Likewise.
    (disable_probes_command): Likewise.
    * progspace.c (print_program_space): Likewise.
    * python/py-breakpoint.c (bppy_get_commands): Likewise.
    * python/py-framefilter.c (py_print_type): Likewise.
    (py_print_value): Likewise.
    (py_print_single_arg): Likewise.
    (enumerate_args): Likewise.
    (enumerate_locals): Likewise.
    (py_print_args): Likewise.
    (py_print_frame): Likewise.
    * record-btrace.c (btrace_ui_out_decode_error): Likewise.
    (btrace_call_history_insn_range): Likewise.
    (btrace_call_history_src_line): Likewise.
    (btrace_call_history): Likewise.
    * remote.c (show_remote_cmd): Likewise.
    * skip.c (skip_info): Likewise.
    * solib.c (info_sharedlibrary_command): Likewise.
    * source.c (print_source_lines_base): Likewise.
    * spu-tdep.c (info_spu_event_command): Likewise.
    (info_spu_signal_command): Likewise.
    (info_spu_mailbox_list): Likewise.
    (info_spu_dma_cmdlist): Likewise.
    (info_spu_dma_command): Likewise.
    (info_spu_proxydma_command): Likewise.
    * stack.c (print_stack_frame): Likewise.
    (print_frame_arg): Likewise.
    (read_frame_arg): Likewise.
    (print_frame_args): Likewise.
    (print_frame_info): Likewise.
    (print_frame): Likewise.
    * symfile.c (load_progress): Likewise.
    (generic_load): Likewise.
    (print_transfer_performance): Likewise.
    * thread.c (do_captured_list_thread_ids): Likewise.
    (print_thread_info_1): Likewise.
    (restore_selected_frame): Likewise.
    (do_captured_thread_select): Likewise.
    (print_selected_thread_frame): Likewise.
    * top.c (execute_command_to_string): Likewise.
    * tracepoint.c (tvariables_info_1): Likewise.
    (trace_status_mi): Likewise.
    (tfind_1): Likewise.
    (print_one_static_tracepoint_marker): Likewise.
    (info_static_tracepoint_markers_command): Likewise.
    * utils.c (do_ui_out_redirect_pop): Likewise.
    (fputs_maybe_filtered): Likewise.

7 years agoDon't call "error" in sysroot-prefix.exp
Alan Modra [Thu, 22 Dec 2016 01:37:31 +0000 (12:07 +1030)]
Don't call "error" in sysroot-prefix.exp

We don't want to report a test failure as a tcl error.

* testsuite/ld-scripts/sysroot-prefix.exp (sysroot_prefix_test_setup):
Call perror rather than error on "as" or "ar" failures.

7 years agoMake linker-created symbols relocatable where appropriate.
Cary Coutant [Thu, 22 Dec 2016 00:21:23 +0000 (16:21 -0800)]
Make linker-created symbols relocatable where appropriate.

Linker-created symbols like __ehdr_start, __etext, __edata, and end
should be relocatable, not absolute.

gold/
* output.cc (Output_segment::first_section): Return NULL if there are
no sections in the segment.
* output.h (Output_segment::first_section_load_address): Assert that
first section is not NULL.
* symtab.cc (Symbol_table::sized_write_globals): Attach linker-created
segment-relative symbols to first section of the segment.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Dec 2016 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix bugs with float compare and Inf operands.
Jim Wilson [Wed, 21 Dec 2016 20:33:12 +0000 (12:33 -0800)]
Fix bugs with float compare and Inf operands.

sim/aarch64/
* simulator.c (set_flags_for_float_compare): Add code to handle Inf.
Add comment to document NaN issue.
(set_flags_for_double_compare): Likewise.

sim/testsuite/sim/aarch64/
* fcmp.s: New.

7 years agoDon't make_bfd_vms_lib archive functions NULL
Alan Modra [Wed, 21 Dec 2016 14:10:54 +0000 (00:40 +1030)]
Don't make_bfd_vms_lib archive functions NULL

Contrary to the comment, they can in fact be called.

* libbfd-in.h (_bfd_vms_lib_slurp_armap): Use _bfd_noarchive function.
(_bfd_vms_lib_slurp_extended_name_table: Likewise.
(_bfd_vms_lib_construct_extended_name_table: Likewise.
(_bfd_vms_lib_truncate_arname: Likewise.
(_bfd_vms_lib_write_armap: Likewise.
(_bfd_vms_lib_read_ar_hdr: Likewise.
(_bfd_vms_lib_write_ar_hdr: Likewise.
* libbfd.h: Regenerate.

7 years agoChangeLog formatting fixes
Alan Modra [Wed, 21 Dec 2016 14:09:02 +0000 (00:39 +1030)]
ChangeLog formatting fixes

7 years agoSupport aligning text section from odd addresses
Andrew Waterman [Tue, 20 Dec 2016 22:25:39 +0000 (14:25 -0800)]
Support aligning text section from odd addresses

Previously, the alignment directives were not correctly supported
in the text section when current alignment was only 1 byte (i.e.,
when the address was odd).  Since there are no 1-byte instructions
in RISC-V, this patch resolves the bug by writing a zero byte to
obtain 2-byte alignment, at which point a 2-byte NOP can be used
to obtain 4-byte alignment.

Resolves https://github.com/riscv/riscv-gnu-toolchain/issues/205

* config/tc-riscv.c (riscv_make_nops): Emit 2-byte NOPs.
(riscv_frag_align_code): Correct frag_align_code arg.

7 years agoFix a const-safety issue on GCC-4.9 and above
Tim Newsome [Tue, 20 Dec 2016 22:25:37 +0000 (14:25 -0800)]
Fix a const-safety issue on GCC-4.9 and above

* config/tc-riscv.c (riscv_pre_output_hook): Remove const from
loc4_frag.

7 years agoAvoid creating symbol table entries for registers
Andrew Waterman [Tue, 20 Dec 2016 22:25:33 +0000 (14:25 -0800)]
Avoid creating symbol table entries for registers

Instructions like "jal t0, foo" were erroneously creating symbol table
entries for t0 as well as foo, which causes linking problems.  Fix by
reordering instruction alternatives so that t0 is first attempted to
be parsed as a register, rather than as a symbol.

* riscv-opc.c (riscv_opcodes): Reorder jal and call entries.

7 years agoDo not add padding if an output section is marked as ignored
Igor Kudrin [Wed, 21 Dec 2016 10:53:34 +0000 (21:23 +1030)]
Do not add padding if an output section is marked as ignored

* ldlang.c (size_input_section): Avoid calling insert_pad
if output_section_statement->ignored is set.

7 years agobfd: aarch64: fix word and arrdess size declaration in ilp32 mode
Yury Norov [Fri, 9 Dec 2016 16:17:58 +0000 (21:47 +0530)]
bfd: aarch64: fix word and arrdess size declaration in ilp32 mode

ILP32 has 32-bit word and address, but currently they declared as 64-bit in
bfd_aarch64_arch_ilp32, which breaks further logic of bfd. This patch fixes it.

Glibc testsuite build with patched binutils shows that next tests stop to fail:
iconvdata/mtrace-tst-loading
iconvdata/tst-loading
iconvdata/tst-tables
localedata/mtrace-tst-leaks
localedata/tst-leaks
posix/tst-getaddrinfo4
posix/tst-getaddrinfo5
posix/tst-regex2

7 years agoRemove high bit set characters
Alan Modra [Wed, 21 Dec 2016 08:43:52 +0000 (19:13 +1030)]
Remove high bit set characters

gas/
* doc/c-lm32.texi: Fix chars with high bit set.
* testsuite/gas/bfin/vector2.s: Likewise.
gold/
* arm.cc: Fix comment chars with high bit set.
include/
* coff/pe.h: Fix comment chars with high bit set.
* opcode/xgate.h: Likewise.
ld/
* testsuite/ld-scripts/sysroot-prefix.exp: Fix chars with high bit set.

7 years agoDocument character escape sequences
Alan Modra [Wed, 21 Dec 2016 08:37:55 +0000 (19:07 +1030)]
Document character escape sequences

PR gas/10946
* doc/as.texinfo (Chars): Document escape sequences.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Dec 2016 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agogdb: Constify solib_find
Pedro Alves [Tue, 20 Dec 2016 17:07:19 +0000 (17:07 +0000)]
gdb: Constify solib_find

gdb/ChangeLog:
2016-12-20  Pedro Alves  <palves@redhat.com>

* nto-tdep.c (nto_find_and_open_solib): Constify 'solib'
parameter.
* nto-tdep.h (nto_find_and_open_solib): Constify 'solib'
parameter.
* solib.c (solib_find_1, exec_file_find, solib_find): Constify
in_pathname' parameter.
* solist.h (struct target_so_ops) <find_and_open_solib>: Constify
'soname' parameter.
(exec_file_find, solib_find): Constify 'in_pathname' parameter.

7 years agoFix longjmp across readline w/ --enable-sjlj-exceptions toolchains
Pedro Alves [Tue, 20 Dec 2016 15:46:44 +0000 (15:46 +0000)]
Fix longjmp across readline w/ --enable-sjlj-exceptions toolchains

Nowadays, GDB propagates C++ exceptions across readline using
setjmp/longjmp 89525768cd08 ("Propagate GDB/C++ exceptions across
readline using sj/lj-based TRY/CATCH") because DWARF-based unwinding
can't cross C functions compiled without -fexceptions (see details
from the commit above).

Unfortunately, toolchains that use SjLj-based C++ exceptions got
broken with that fix, because _Unwind_SjLj_Unregister, which is put at
the exit of a function, is not executed due to the longjmp added by
that commit.

 (gdb) [New Thread 2936.0xb80]
 kill

 Thread 1 received signal SIGSEGV, Segmentation fault.
 0x03ff662b in ?? ()
 top?bt 15
 #0  0x03ff662b in ?? ()
 #1  0x00526b92 in stdin_event_handler (error=0, client_data=0x172ed8)
    at ../../binutils-gdb/gdb/event-top.c:555
 #2  0x00525a94 in handle_file_event (ready_mask=<optimized out>,
    file_ptr=0x3ff5cb8) at ../../binutils-gdb/gdb/event-loop.c:733
 #3  gdb_wait_for_event (block=block@entry=1)
    at ../../binutils-gdb/gdb/event-loop.c:884
 #4  0x00525bfb in gdb_do_one_event ()
    at ../../binutils-gdb/gdb/event-loop.c:347
 #5  0x00525ce5 in start_event_loop ()
    at ../../binutils-gdb/gdb/event-loop.c:371
 #6  0x0051fada in captured_command_loop (data=0x0)
    at ../../binutils-gdb/gdb/main.c:324
 #7  0x0051cf5d in catch_errors (
    func=func@entry=0x51fab0 <captured_command_loop(void*)>,
    func_args=func_args@entry=0x0,
    errstring=errstring@entry=0x7922bf <VEC_interp_factory_p_quick_push(VEC_inte rp_factory_p*, interp_factory*, char const*, unsigned int)::__PRETTY_FUNCTION__+351> "", mask=mask@entry=RETURN_MASK_ALL)
    at ../../binutils-gdb/gdb/exceptions.c:236
 #8  0x00520f0c in captured_main (data=0x328feb4)
    at ../../binutils-gdb/gdb/main.c:1149
 #9  gdb_main (args=args@entry=0x328feb4) at ../../binutils-gdb/gdb/main.c:1159
 #10 0x0071e400 in main (argc=1, argv=0x171220)
    at ../../binutils-gdb/gdb/gdb.c:32

Fix this by making the functions involved in setjmp/longjmp as
noexcept, so that the compiler knows it doesn't need to emit the
_Unwind_SjLj_Register / _Unwind_SjLj_Unregister calls for C++
exceptions.

Tested on x86_64 Fedora 23 with:
 - GCC 5.3.1 w/ DWARF-based exceptions.
 - GCC 7 built with --enable-sjlj-exceptions.

gdb/ChangeLog:
2016-12-20  Pedro Alves  <palves@redhat.com>
    Yao Qi  <yao.qi@linaro.org>

PR gdb/20977
* event-top.c (gdb_rl_callback_read_char_wrapper_noexcept): New
noexcept function, factored out from ...
(gdb_rl_callback_read_char_wrapper): ... this.
(gdb_rl_callback_handler): Mark noexcept.

7 years agoSet emacs default mode for the GDB directory to C++
Antoine Tremblay [Tue, 20 Dec 2016 13:42:10 +0000 (08:42 -0500)]
Set emacs default mode for the GDB directory to C++

Since GDB has switched to C++ but the file names are still .c emacs does
not load the proper mode when opening files in the gdb directory.

This patch fixes that by enabling c++ mode.

This patch also fixes indentation tweaks as discussed in this thread:
https://sourceware.org/ml/gdb-patches/2016-12/msg00074.html

Indent with gdb-code-style.el included and the .dir-locals.el is as such:

namespace TestNameSpace {

class test
{
public:
  test test() {}

  int m_a;
};

struct teststruct
{
  int a;
}
}

gdb/ChangeLog:

* .dir-locals.el: Set c++ mode for the directory and set indent
properly.
* gdb-code-style.el: Set c-set-offset 'innamespace as a safe value
to be used in .dir-locals.el.

7 years agoMIPS16/opcodes: Respect ISA and ASE in disassembly
Maciej W. Rozycki [Tue, 20 Dec 2016 11:38:53 +0000 (11:38 +0000)]
MIPS16/opcodes: Respect ISA and ASE in disassembly

Limit MIPS16 instruction disassembly according to the ISA level and ASE
set selected, as with the regular MIPS and microMIPS instruction sets.
Retain the property of `objdump -m mips:16' disassembling all MIPS16
instructions however, regardless of any ISA level recorded in the binary
examined.

To validate the disassembler use the GAS test suite for its convenience
of running tests across multiple ISAs, even though placing the tests in
the binutils test suite would be more appropriate.  Adjust the single
binutils test which depends on 64-bit instruction disassembly to have
the ISA level required actually recorded in the binary examined.

opcodes/
* mips-dis.c (mips_arch_choices): Use ISA_MIPS64 rather than
ISA_MIPS3 as the `isa' selection in the `bfd_mach_mips16' entry.
(print_insn_mips16): Check opcode entries for validity against
the ISA level and ASE set selected.

binutils/
* testsuite/binutils-all/mips/mips16-undecoded.s: Use `.module'
rather than `.set' to set the ISA level.

gas/
* testsuite/gas/mips/mips16-sub.d: New test.
* testsuite/gas/mips/mips16-32@mips16-sub.d: New test.
* testsuite/gas/mips/mips16e-32@mips16-sub.d: New test.
* testsuite/gas/mips/mips16e-sub.d: New test.
* testsuite/gas/mips/mips16-32@mips16e-sub.d: New test.
* testsuite/gas/mips/mips16-64@mips16e-sub.d: New test.
* testsuite/gas/mips/mips16e-64-sub.d: New test.
* testsuite/gas/mips/mips16-32@mips16e-64-sub.d: New test.
* testsuite/gas/mips/mips16-64@mips16e-64-sub.d: New test.
* testsuite/gas/mips/mips16e-32@mips16e-64-sub.d: New test.
* testsuite/gas/mips/mips16-sub.s: New test source.
* testsuite/gas/mips/mips16e-sub.s: New test source.
* testsuite/gas/mips/mips16e-64-sub.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

7 years agoMIPS/GAS/testsuite: Add RESTORE instruction to `mips16e' test
Maciej W. Rozycki [Tue, 20 Dec 2016 11:34:47 +0000 (11:34 +0000)]
MIPS/GAS/testsuite: Add RESTORE instruction to `mips16e' test

Add a RESTORE instruction smoke test to the `mips16e' GAS test.

gas/
* testsuite/gas/mips/mips16e.s: Add a RESTORE instruction.
* testsuite/gas/mips/mips16e.d: Adjust accordingly.

7 years agoMIPS/GAS/testsuite: Extend MIPS16 testing over multiple ISAs
Maciej W. Rozycki [Tue, 20 Dec 2016 11:33:49 +0000 (11:33 +0000)]
MIPS/GAS/testsuite: Extend MIPS16 testing over multiple ISAs

Run the `mips16', `mips16-64', `mips16e-64', `mips16-macro',
`mips16-macro-e' and `mips16-macro-t' GAS tests over multiple MIPS16
ISAs.

gas/
* testsuite/gas/mips/mips16.d: Adjust test for multiple MIPS16
ISA testing.
* testsuite/gas/mips/mips16-64.d: Adjust test for multiple
MIPS16 ISA testing.
* testsuite/gas/mips/mips16e-64.d: Adjust test for multiple
MIPS16 ISA testing.
* testsuite/gas/mips/mips16-macro.d: Adjust test for multiple
MIPS16 ISA testing.
* testsuite/gas/mips/mips16e-64.s: Ensure MIPS16 ISA annotation.
* testsuite/gas/mips/mips16e-64.l: Rename to...
* testsuite/gas/mips/mips16e-32@mips16e-64.l: ... this.
* testsuite/gas/mips/mips16-64@mips16.d: New test.
* testsuite/gas/mips/mips16-64@mips16-64.d: New test.
* testsuite/gas/mips/mips16e-32@mips16e-64.d: New test.
* testsuite/gas/mips/mips16-32@mips16-macro.d: New test.
* testsuite/gas/mips/mips16-64@mips16-macro.d: New test.
* testsuite/gas/mips/mips16e-32@mips16-macro.d: New test.
* testsuite/gas/mips/mips16-32@mips16-macro-e.d: New test.
* testsuite/gas/mips/mips16e-32@mips16-macro-e.d: New test.
* testsuite/gas/mips/mips16-32@mips16-macro-t.d: New test.
* testsuite/gas/mips/mips16e-32@mips16-macro-t.d: New test.
* testsuite/gas/mips/mips16e-32@mips16e-64.l: New stderr output.
* testsuite/gas/mips/mips16-32@mips16-macro.l: New stderr
output.
* testsuite/gas/mips/mips16e-32@mips16-macro.l: New stderr
output.
* testsuite/gas/mips/mips16-32@mips16-macro-e.l: New stderr
output.
* testsuite/gas/mips/mips16e-32@mips16-macro-e.l: New stderr
output.
* testsuite/gas/mips/mips16-32@mips16-macro-t.l: New stderr
output.
* testsuite/gas/mips/mips16e-32@mips16-macro-t.l: New stderr
output.
* testsuite/gas/mips/mips.exp: Run `mips16', `mips16-64',
`mips16-macro', `mips16-macro-t', `mips16-macro-e' and
`mips16e-64' testing across multiple MIPS16 ISAs.  Fold
`mips16-macro' and `mips16e-64' list test invocations into
corresponding dump tests.

7 years agoMIPS/GAS/testsuite: Implement individual MIPS16 ISA testing
Maciej W. Rozycki [Tue, 20 Dec 2016 02:23:51 +0000 (02:23 +0000)]
MIPS/GAS/testsuite: Implement individual MIPS16 ISA testing

Implement individual MIPS16 ISA GAS testing for the 32-bit and 64-bit
variants of the base MIPS16 and the MIPS16e ISA each.

gas/
* testsuite/gas/mips/mips.exp (run_dump_test_arch): Add
`mips16e' and `mips16' prefixes.
(run_list_test_arch): Likewise.
Rename `mips16' architecture to `mips16-32'.  Add `mips16-64',
`mips16e-32' and `mips16e-64' architectures.  Update `rol64',
`mips16e', `elf${el}-rel2' and `elf-rel4' test invocations
accordingly.
* testsuite/gas/mips/mips16e@branch-swap-3.d: New test.
* testsuite/gas/mips/mips16e@branch-swap-4.d: New test.
* testsuite/gas/mips/mips16e@loc-swap-dis.d: New test.
* testsuite/gas/mips/mips16e@loc-swap.d: New test.

7 years agoMIPS/GAS/testsuite: Fix trailing padding in `loc-swap.s'
Maciej W. Rozycki [Tue, 20 Dec 2016 02:10:40 +0000 (02:10 +0000)]
MIPS/GAS/testsuite: Fix trailing padding in `loc-swap.s'

Pad alignment with zeros rather than NOP instructions, for sensible
multi-ISA MIPS16 testing.

gas/
* testsuite/gas/mips/loc-swap.s: Use zeros rather than NOPs for
trailing alignment padding.
* testsuite/gas/mips/loc-swap.d: Adjust accordingly.
* testsuite/gas/mips/micromips@loc-swap.d: Likewise.
* testsuite/gas/mips/mips16@loc-swap-dis.d: Likewise.

7 years agoMIPS16: Switch to 32-bit opcode table interpretation
Maciej W. Rozycki [Tue, 20 Dec 2016 02:03:40 +0000 (02:03 +0000)]
MIPS16: Switch to 32-bit opcode table interpretation

Switch to 32-bit MIPS16 opcode table entry interpretation, similar to
how the microMIPS opcode table is handled, for both the `match' and
`mask' fields, removing special casing for JAL and JALX instructions and
their `a' and `i' operand codes throughout, while retaining automatic
processing of extendable opcodes in assembly and disassembly.

In assembly disallow size enforcement suffixes as appropriate: `.t' for
both 32-bit instructions and macros and `.e' for macros only, making
macro handling consistent with the microMIPS instruction set.

In disassembly fully decode EXTEND prefixes prepended to unsupported
instruction encodings (according to the ISA selection) rather than
dumping them as hexadecimal data along with the following instruction,
removing all special casing for the EXTEND prefix and making its
handling rely on its opcode table entry, except where it is considered a
part of an extendable instruction.

include/
* opcode/mips.h (mips_opcode_32bit_p): New inline function.

gas/
* config/tc-mips.c (micromips_insn_length): Use
`mips_opcode_32bit_p'.
(is_size_valid): Adjust description.
(is_size_valid_16): New function.
(validate_mips_insn): Use `mips_opcode_32bit_p' in MIPS16
operand decoding.
(validate_mips16_insn): Remove `a' and `i' operand code special
casing, use `mips_opcode_32bit_p' to determine instruction
width.
(append_insn): Adjust forced MIPS16 instruction size
determination.
(match_mips16_insn): Likewise.  Don't shift the instruction's
opcode with the `a' and `i' operand codes.  Use
`mips_opcode_32bit_p' in operand decoding.
(match_mips16_insns): Check for forced instruction size's
validity.
(mips16_ip): Don't force instruction size in the `noautoextend'
mode.
* testsuite/gas/mips/mips16-jal-e.d: New test.
* testsuite/gas/mips/mips16-jal-t.d: New test.
* testsuite/gas/mips/mips16-macro-e.d: New test.
* testsuite/gas/mips/mips16-macro-t.d: New test.
* testsuite/gas/mips/mips16-jal-t.l: New stderr output.
* testsuite/gas/mips/mips16-macro-e.l: New stderr output.
* testsuite/gas/mips/mips16-macro-t.l: New stderr output.
* testsuite/gas/mips/mips16-jal-e.s: New test source.
* testsuite/gas/mips/mips16-jal-t.s: New test source.
* testsuite/gas/mips/mips16-macro-e.s: New test source.
* testsuite/gas/mips/mips16-macro-t.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

opcodes/
* mips-dis.c (print_mips16_insn_arg): Always handle `extend' and
`insn' together, with `extend' as the high-order 16 bits.
(match_kind): New enum.
(print_insn_mips16): Rework for 32-bit instruction matching.
Do not dump EXTEND prefixes here.
* mips16-opc.c (mips16_opcodes): Move "extend" entry to the end.
Recode `match' and `mask' fields as 32-bit in absolute "jal" and
"jalx" entries.

binutils/
* testsuite/binutils-all/mips/mips16-extend-noinsn.d: Adjust
test for separate EXTEND prefix disassembly.

7 years agoMIPS16/opcodes: Correct 64-bit macros' ISA membership
Maciej W. Rozycki [Tue, 20 Dec 2016 01:53:03 +0000 (01:53 +0000)]
MIPS16/opcodes: Correct 64-bit macros' ISA membership

Limit the DDIV, DDIVU, DREM, DREMU and DSUBU macros to the MIPS III
rather than MIPS I ISA.  These macros expand to machine code sequences
including 64-bit instructions which require a 64-bit ISA.  Entries for
those instructions are already correctly marked, however the marking is
ignored if entries are used in the process of macro expansion rather
than directly, making it possible to indirectly produce 64-bit machine
code even when output requested has been limited to a 32-bit ISA.

opcodes/
* mips16-opc.c (mips16_opcodes): Set membership to I3 rather
than I1 for the "ddiv", "ddivu", "drem", "dremu" and "dsubu"
INSN_MACRO entries.

gas/
* testsuite/gas/mips/mips16-macro.l: New list test.
* testsuite/gas/mips/mips.exp: Run the new test.

7 years agoMIPS16/opcodes: Correct I64/SDRASP opcode's ISA membership
Maciej W. Rozycki [Tue, 20 Dec 2016 01:50:24 +0000 (01:50 +0000)]
MIPS16/opcodes: Correct I64/SDRASP opcode's ISA membership

Limit the `SD ra, offset(sp)' instruction (I64/SDRASP major/minor
opcode) to the MIPS III rather than MIPS I ISA.  This is a 64-bit
instruction requiring a 64-bit ISA.  This bug has been there since
forever.

opcodes/
* mips16-opc.c (mips16_opcodes): Set membership to I3 rather
than I1 for the SP-relative "sd"/$ra entry (SDRASP minor
opcode).

gas/
* testsuite/gas/mips/mips16-sdrasp.d: New test.
* testsuite/gas/mips/mips16-sdrasp.l: New stderr output.
* testsuite/gas/mips/mips16-sdrasp.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new test.

7 years agoMIPS/GAS/testsuite: Correct NewABI test selection
Maciej W. Rozycki [Tue, 20 Dec 2016 01:49:02 +0000 (01:49 +0000)]
MIPS/GAS/testsuite: Correct NewABI test selection

Make sure all tests that require NewABI support are only run with
`has_newabi' targets, removing numerous `mips-sgi-irix5' failures.

gas/
* testsuite/gas/mips/mips.exp: Limit remaining tests that
require NewABI support to `has_newabi' targets.

7 years agoUpdate testsuite Makefile with missing dependencies.
Cary Coutant [Tue, 20 Dec 2016 09:03:55 +0000 (01:03 -0800)]
Update testsuite Makefile with missing dependencies.

2016-12-20  Cary Coutant  <ccoutant@gmail.com>

gold/
* testsuite/Makefile.am: Add missing dependencies on gcctestdir/ld
or ../ld-new.
* testsuite/Makefile.in: Regenerate.

7 years agoFix read-beyond-end-of-buffer error in script parsing.
Cary Coutant [Tue, 20 Dec 2016 03:19:46 +0000 (19:19 -0800)]
Fix read-beyond-end-of-buffer error in script parsing.

2016-12-19  Cary Coutant  <ccoutant@gmail.com>

gold/
PR gold/20949
* script.cc (Lex::get_token): Don't look ahead past NUL characters.

7 years agoCorrect assembler mnemonic for RISC-V aqrl AMOs
Andrew Waterman [Mon, 19 Dec 2016 06:53:54 +0000 (22:53 -0800)]
Correct assembler mnemonic for RISC-V aqrl AMOs

sc is a misnomer, because they aren't inherently sc.

* riscv-opc.c (riscv_opcodes): Rename the "*.sc" instructions to
"*.aqrl".

7 years agoFix disassembly of RISC-V CSR instructions under -Mno-aliases
Andrew Waterman [Mon, 19 Dec 2016 06:53:53 +0000 (22:53 -0800)]
Fix disassembly of RISC-V CSR instructions under -Mno-aliases

This fixes https://github.com/riscv/riscv-binutils-gdb/issues/36.

* riscv-opc.c (riscv_opcodes): Mark the rd* and csr* aliases as
INSN_ALIAS.

7 years agoAdd canonical JALR for RISC-V
Andrew Waterman [Mon, 19 Dec 2016 06:53:52 +0000 (22:53 -0800)]
Add canonical JALR for RISC-V

    jalr rd,offset(rs1)

rather than

    jalr rd,rs1,offset

This matches the format of other instructions.

* riscv-opc.c (riscv_opcodes): Change jr and jalr to "o(s)"
format.

7 years agoDon't define RISC-V .p2align
Andrew Waterman [Mon, 19 Dec 2016 06:53:51 +0000 (22:53 -0800)]
Don't define RISC-V .p2align

* config/tc-riscv.c (riscv_pseudo_table): Remove "align",
"p2align", and "balign".
(s_align): Remove.
(riscv_handle_align): New function.
(riscv_frag_align_code): Likewise.
(riscv_make_nops): Likewise.
* config/tc-riscv.h (MAX_MEM_FOR_RS_ALIGN_CODE): Change to 7.
(HANDLE_ALIGN): Define.
(md_do_align): Define.
(riscv_handle_align): Declare.
(riscv_frag_align_code): Likewise.

7 years agoRe-work RISC-V gas flags: now we just support -mabi and -march
Andrew Waterman [Mon, 19 Dec 2016 06:53:50 +0000 (22:53 -0800)]
Re-work RISC-V gas flags: now we just support -mabi and -march

We've decided to standardize on two flags for RISC-V: "-march" sets the
target architecture (which determines which instructions can be
generated), and "-mabi" sets the target ABI.  We needed to rework this
because the old flag set didn't support soft-float or single-float ABIs,
and didn't support an x32-style ABI on RISC-V.

Additionally, we've changed the behavior of the -march flag: it's now a
lot stricter and only parses things we can actually understand.
Additionally, it's now lowercase-only: the rationale is that while the
RISC-V ISA manual specifies that ISA strings are case-insensitive, in
Linux-land things are usually case-sensitive.  Since this flag can be
used to determine library paths, we didn't want to bake some
case-insensitivity in there that would case trouble later.

This patch implements these two new flags and removes the old flags that
could conflict with these.  There wasn't a RISC-V release before, so we
want to just support a clean flag set.

include/
* elf/riscv.h (EF_RISCV_SOFT_FLOAT): Don't define.
(EF_RISCV_FLOAT_ABI, EF_RISCV_FLOAT_ABI_SOFT): Define.
(EF_RISCV_FLOAT_ABI_SINGLE, EF_RISCV_FLOAT_ABI_DOUBLE): Define.
(EF_RISCV_FLOAT_ABI_QUAD): Define.
bfd/
* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Use
EF_RISCV_FLOAT_ABI_SOFT instead of EF_RISCV_SOFT_FLOAT.
binutils/
* readelf.c (get_machine_flags): Use
EF_RISCV_FLOAT_ABI_{SOFT,SINGLE,DOBULE,QUAD) instead of
EF_RISCV_{SOFT,HARD}_FLOAT.
gas/
* config/tc-riscv.h (xlen): Delete.
* config/tc-riscv.c (xlen): Make static.
(abi_xlen): New variable.
(options): Replace OPTION_{M32,M64,MSOFT_FLOAT,MHARD_FLOAT,MRVC}
with OPTION_MABI.
(md_longopts): Likewise.
(md_parse_option): Likewise.
(riscv_elf_final_processing): Likewise.
* doc/as.texinfo (Target RISC-V options): Likewise.
* doc/c-riscv.texi (OPTIONS): Likewise.
* config/tc-riscv.c (float_mode): Removed.
(float_abi): New type, specifies the floating-point ABI.
(riscv_set_abi): New function.
(riscv_add_subset): Only allow lower-case ISA names and require
them to start with "rv".
(riscv_after_parse_args): Likewise.
opcodes/
* riscv-dis.c (riscv_disassemble_insn): Default to the ELF's
XLEN when none is provided.

7 years agoFix an integer overflow in RISC-V relocation handling
Andrew Waterman [Mon, 19 Dec 2016 06:53:49 +0000 (22:53 -0800)]
Fix an integer overflow in RISC-V relocation handling

* elfnn-riscv.c (bfd_riscv_get_max_alignment): Return bfd_vma
instead of unsigned int.

7 years agoRework RISC-V relocations
Andrew Waterman [Mon, 19 Dec 2016 06:53:48 +0000 (22:53 -0800)]
Rework RISC-V relocations

Before this commit we didn't cleanly support CFI directives because the
internal offsets used to get relaxed which broke them.  This patch
significantly reworks how we handle linker relaxations:

 * DWARF is now properly supported

 * There is a ".option norelax" to disable relaxations, for when users
   write assembly that can't be relaxed (if it's to be later patched up,
   for example).

 * There is an additional _RELAX relocation that specifies when previous
   relocations can be relaxed.

We're in the process of documenting the RISC-V ELF ABI, which will
include documentation of our relocations

  https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md

but we expect that this relocation set will remain ABI compatible in the
future (ie, it's safe to release).

Thanks to Kuan-Lin Chen for figuring out how to correctly relax the
debug info!

include/
* elf/riscv.h: Add R_RISCV_TPREL_I through R_RISCV_SET32.
bfd/
* reloc.c (BFD_RELOC_RISCV_TPREL_I): New relocation.
(BFD_RELOC_RISCV_TPREL_S): Likewise.
(BFD_RELOC_RISCV_RELAX): Likewise.
(BFD_RELOC_RISCV_CFA): Likewise.
(BFD_RELOC_RISCV_SUB6): Likewise.
(BFD_RELOC_RISCV_SET8): Likewise.
(BFD_RELOC_RISCV_SET8): Likewise.
(BFD_RELOC_RISCV_SET16): Likewise.
(BFD_RELOC_RISCV_SET32): Likewise.
* elfnn-riscv.c (perform_relocation): Handle the new
relocations.
(_bfd_riscv_relax_tls_le): Likewise.
(_bfd_riscv_relax_align): Likewise.
(_bfd_riscv_relax_section): Likewise.
(howto_table): Likewise.
(riscv_reloc_map): Likewise.
(relax_func_t): New type.
(_bfd_riscv_relax_call): Add reserve_size argument, which
controls the maximal offset pessimism.  Correct type of max_alignment.
(_bfd_riscv_relax_lui): Likewise.
(_bfd_riscv_relax_tls_le): Likewise.
(_bfd_riscv_relax_align): Likewise.
(_bfd_riscv_relax_section): Compute the required reserve size
when relocating and use it to when calling relax_func.
* bfd-in2.h: Regenerate.
* libbfd.h: Likewise.
gas/
* config/tc-riscv.c (riscv_set_options): Add relax.
(riscv_opts): Likewise.
(s_riscv_option): Add relax and norelax.
(riscv_apply_const_reloc): New function.
(append_insn): Move constant relocation handling to
riscv_apply_const_reloc.
(md_pcrel_from): Likewise.
(parse_relocation): Skip BFD_RELOC_UNUSED.
(md_pcrel_from): Handle BFD_RELOC_RISCV_SUB6,
BFD_RELOC_RISCV_RELAX, BFD_RELOC_RISCV_CFA.
(md_apply_fix): Likewise.
(riscv_pre_output_hook): New function.
* config/tc-riscv.h (md_pre_output_hook): Define.
(riscv_pre_output_hook): Declare.
(DWARF_CIE_DATA_ALIGNMENT): Always -4.

7 years agoFormatting changes for RISC-V
Andrew Waterman [Mon, 19 Dec 2016 06:53:47 +0000 (22:53 -0800)]
Formatting changes for RISC-V

This is a mixed bag of format changes:

 * Replacing constants with macros (0xffffffff with MINUS_ONE, for
   example).  There's one technically functional change in here (some
   MINUS_ONEs are changed to 0), but it only changes the behavior of an
   otherwise-unused field.
 * Using 0 instead of 0x0 in the relocation table.
 * There were some missing spaces before parens, the spaces have been
   added.
 * A handful of comments are now more descriptive.
 * A bunch of whitespace-only changes, mostly alignment and brace
   newlines.

bfd/
* elfnn-riscv.c: Formatting and comment fixes throughout.
* elfxx-riscv.c: Likewise.
(howto_table): Change the src_mask field from MINUS_ONE to 0 for
R_RISCV_TLS_DTPMOD32, R_RISCV_TLS_DTPMOD64, R_RISCV_TLS_DTPREL32,
R_RISCV_TLS_DTPREL64, R_RISCV_TLS_TPREL32, R_RISCV_TLS_TPREL64.
opcodes/
* riscv-opc.c: Formatting fixes.
gas/
* config/tc-riscv.c: Formatting and comment fixes throughout.

7 years agoImprove RISC-V LD error message
Palmer Dabbelt [Mon, 19 Dec 2016 06:53:46 +0000 (22:53 -0800)]
Improve RISC-V LD error message

I recently ran into this error message and found it's not helpful: it
just tells me some temporary file can't be linked.  This slightly
improved one at least tells me it's because of an elf32/elf64 conflict.

* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Improve
error message when linking elf32 and elf64.

7 years agoAdd opcodes RISC-V dependencies
Alan Modra [Tue, 20 Dec 2016 01:18:21 +0000 (11:48 +1030)]
Add opcodes RISC-V dependencies

* Makefile.am (TARGET_LIBOPCODES_CFILES): Add riscv files.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.

7 years agoFix problem where linker does not place .note sections according to script.
Cary Coutant [Tue, 20 Dec 2016 00:37:48 +0000 (16:37 -0800)]
Fix problem where linker does not place .note sections according to script.

gold/
PR gold/14676
PR gold/20983
* layout.h (Layout::choose_output_section): Add match_input_spec
parameter. Adjust all callers.
* layout.cc (Layout::choose_output_section): Likewise.  Pass
match_input_spec to Script_sections::output_section_name().
(Layout::create_note): Pass true for match_input_spec.
* script-sections.h (Script_sections::output_section_name): Add
match_input_spec parameter.
* script-sections.cc (Sections_element::output_section_name): Likewise.
(Output_section_definition::output_section_name): Likewise.
(Script_sections::output_section_name): Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Dec 2016 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix an internal error in the constructor of Target_arm.
Igor Kudrin [Mon, 19 Dec 2016 23:23:59 +0000 (15:23 -0800)]
Fix an internal error in the constructor of Target_arm.

gold/
* arm.cc (Target_arm::Target_arm): Move initialization code ...
(Target_arm::do_select_as_default_target): ... to here.
* testsuite/Makefile.am (arm_target_lazy_init): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/arm_target_lazy_init.s: New source file.
* testsuite/arm_target_lazy_init.t: New linker script.

7 years agoFix forced allocation of common (-d) during -r links.
Cary Coutant [Mon, 19 Dec 2016 18:37:23 +0000 (10:37 -0800)]
Fix forced allocation of common (-d) during -r links.

If the .bss section has other data in it besides common allocations,
gold was subtracting the wrong section start address from the symbol
value.

gold/
PR gold/20976
* symtab.cc (Symbol_table::sized_write_globals): Use address of
output section, not input section.
* testsuite/Makefile.am (pr20976): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/pr20976.c: New source file.

7 years agoClean up gdb.gdb/selftest.exp
Yao Qi [Mon, 19 Dec 2016 15:00:32 +0000 (15:00 +0000)]
Clean up gdb.gdb/selftest.exp

I recently see the test fails like this,

(gdb) PASS: gdb.gdb/selftest.exp: step over argv initialization
list^M
487       std::vector<struct cmdarg> cmdarg_vec;^M
(gdb) FAIL: gdb.gdb/selftest.exp: unknown source line (after step over argv initialization)

step^M
std::vector<cmdarg, std::allocator<cmdarg> >::vector (this=0x7fffffffdc10) at ../../binutils-gdb/gdb/main.c:487^M
487       std::vector<struct cmdarg> cmdarg_vec;^M
(gdb) FAIL: gdb.gdb/selftest.exp: step into xmalloc call

These fails are caused by using std::vector in commit
f60ee22ea1d62f7004511ec65a3ad76890032d88.  selttest.exp should match
the source code of GDB.  It is a maintenance pain, so this patch
removes do_steps_and_nexts.

gdb/testsuite:

2016-12-19  Yao Qi  <yao.qi@linaro.org>

* gdb.gdb/selftest.exp (do_steps_and_nexts): Remove.
(test_with_self): Don't call do_steps_and_nexts, and remove
code about stepping into xmalloc.

7 years agobfd/elf32-arm.c: Rename 'popcount' to 'elf32_arm_popcount'
Christian Groessler [Mon, 19 Dec 2016 12:56:22 +0000 (13:56 +0100)]
bfd/elf32-arm.c: Rename 'popcount' to 'elf32_arm_popcount'

bfd/elf32_arm.c contains a function 'popcount' which conflicts
with a function of the same name in NetBSD's libc.
This change also changes popcount's 'sum' variable to signed
since the function returns a signed integer.

bfd/
* elf32-arm.c (elf32_arm_popcount): Rename from 'popcount'.  Make
'sum' local variable signed.

7 years agoMIPS/opcodes: Only examine ELF file structures if SYMTAB_AVAILABLE
Maciej W. Rozycki [Mon, 19 Dec 2016 11:35:14 +0000 (11:35 +0000)]
MIPS/opcodes: Only examine ELF file structures if SYMTAB_AVAILABLE

Correct commit 640c0ccdc980 ("some objdump -M options, better reg
dumps"), <https://sourceware.org/ml/binutils/2002-12/msg00706.html>, and
only execute code setting up disassembler options based on ELF file
structures if SYMTAB_AVAILABLE is set.

opcodes/
* mips-dis.c (set_default_mips_dis_options) [SYMTAB_AVAILABLE]:
Only examine ELF file structures here.

7 years agoMIPS/opcodes: Only call `bfd_mips_elf_get_abiflags' if BFD64
Maciej W. Rozycki [Mon, 19 Dec 2016 11:32:05 +0000 (11:32 +0000)]
MIPS/opcodes: Only call `bfd_mips_elf_get_abiflags' if BFD64

Complement commit 5e7fc731f80e ("MIPS/opcodes: Also set disassembler's
ASE flags from ELF structures") and fix an `--enable-targets=all' GDB
build regression on 32-bit hosts where the MIPS target is a secondary:

../opcodes/libopcodes.a(mips-dis.o): In function `set_default_mips_dis_options':
mips-dis.c:(.text+0x906): undefined reference to `bfd_mips_elf_get_abiflags'
collect2: error: ld returned 1 exit status
make[2]: *** [gdb] Error 1

by avoiding making a call to the `bfd_mips_elf_get_abiflags' function,
which is not available, because there is no MIPS/ELF BFD included in
32-bit BFD builds.  This call is only made from a conditional code block
guarded by a check against `bfd_target_elf_flavour', which is dead in
such a configuration, however cannot be optimized away by the compiler.
Also some other MIPS BFDs may be available, such as a.out, ECOFF or PE,
so the disassembler has to remain functional.

opcodes/
* mips-dis.c (set_default_mips_dis_options) [BFD64]: Only call
`bfd_mips_elf_get_abiflags' here.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Dec 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Dec 2016 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Dec 2016 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoDarwin: Fix gdb compilation.
Bernhard Heckel [Thu, 15 Dec 2016 13:04:11 +0000 (14:04 +0100)]
Darwin: Fix gdb compilation.

Due to changes introduced by
commit 4d01a485d29732b19743e8b138897f3509e071b0
('struct expression *' -> gdb::unique_xmalloc_ptr<expression>)
compilation is broken on Darwin.

../gdb/darwin-nat-info.c:733:8: error: assigning to 'struct expression *'
from incompatible type
'expression_up' (aka 'std::__1::unique_ptr<expression, gdb::xfree_deleter<expression> >')
expr = parse_expression (exp);

Beside compilation, memory leak was solved as 'make_clean_up' was not called in previous
version.

2016-12-16  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
* darwin-nat-info.c (info_mach_region_command): Use expression_up.

7 years agoFix compile time warning building arm-dis.c
Nick Clifton [Fri, 16 Dec 2016 10:59:36 +0000 (10:59 +0000)]
Fix compile time warning building arm-dis.c

7 years agoImplement and document --gc-keep-exported
fincs [Fri, 16 Dec 2016 03:12:02 +0000 (13:42 +1030)]
Implement and document --gc-keep-exported

include/
* bfdlink.h (struct bfd_link_info): Add gc_keep_exported.
bfd/
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Add handling
for info->gc_keep_exported.
(bfd_elf_gc_sections): Likewise.
ld/
* ld.texinfo: Document --gc-keep-exported.
* ldlex.h (enum option_values): Add OPTION_GC_KEEP_EXPORTED.
* lexsup.c (parse_args): Add handling for --gc-keep-exported.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 16 Dec 2016 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoLinking non-ELF file broken by PR20908 fix
Alan Modra [Thu, 15 Dec 2016 10:59:44 +0000 (21:29 +1030)]
Linking non-ELF file broken by PR20908 fix

PR ld/20968
PR ld/20908
* elflink.c (bfd_elf_final_link): Revert 2016-12-02 change.  Move
reloc counting code later after ELF flavour test.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 15 Dec 2016 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoMAINTAINERS: Add myself as a MIPS maintainer
Maciej W. Rozycki [Wed, 14 Dec 2016 22:17:05 +0000 (22:17 +0000)]
MAINTAINERS: Add myself as a MIPS maintainer

* MAINTAINERS (Maintainers for particular sims): Add myself as
a MIPS maintainer.

7 years agoMIPS/opcodes: Also set disassembler's ASE flags from ELF structures
Maciej W. Rozycki [Wed, 14 Dec 2016 21:49:56 +0000 (21:49 +0000)]
MIPS/opcodes: Also set disassembler's ASE flags from ELF structures

Respect any ASE flags recorded in ELF file structures for the purpose of
selecting instructions to be disassembled, preventing code from being
hex-dumped even though having been clearly indicated as valid at the
assembly time.  Use date from the MIPS ABI flags structure if present,
and otherwise there may be an MDMX ASE flag set in the ELF file header.
For backwards compatibility only set extra flags and do not clear any,
preserving all previously set by the architecture selected to be
disassembled for.

include/
* elf/mips.h (Elf_Internal_ABIFlags_v0): Also declare struct
typedef as `elf_internal_abiflags_v0'.

bfd/
* bfd-in.h (elf_internal_abiflags_v0): New struct declaration.
(bfd_mips_elf_get_abiflags): New prototype.
* elfxx-mips.c (bfd_mips_elf_get_abiflags): New function.
* bfd-in2.h: Regenerate.

opcodes/
* mips-dis.c (mips_convert_abiflags_ases): New function.
(set_default_mips_dis_options): Also infer ASE flags from ELF
file structures.

binutils/
* testsuite/binutils-all/mips/mips-ase-1.d: New test.
* testsuite/binutils-all/mips/mips-ase-2.d: New test.
* testsuite/binutils-all/mips/mips-ase-3.d: New test.
* testsuite/binutils-all/mips/mips-ase-1.s: New test source.
* testsuite/binutils-all/mips/mips-ase-2.s: New test source.
* testsuite/binutils-all/mips/mips.exp: Run the new tests.

7 years agoMIPS/opcodes: Reorder ELF file header flag handling in disassembler
Maciej W. Rozycki [Wed, 14 Dec 2016 21:27:00 +0000 (21:27 +0000)]
MIPS/opcodes: Reorder ELF file header flag handling in disassembler

Move ELF file header flag interpretation code, used to set disassembler
options, beyond architecture setup.  No functional change as the effects
of both code sections are disjoint from each other, but this provides
for a further expansion of ELF file header flag interpretation.

opcodes/
* mips-dis.c (set_default_mips_dis_options): Reorder ELF file
header flag interpretation code.