platform/upstream/binutils.git
7 years agoFix umulh and smulh bugs. Fix bugs in last week's sumov.s testsuite.
Jim Wilson [Fri, 3 Mar 2017 21:10:45 +0000 (13:10 -0800)]
Fix umulh and smulh bugs.  Fix bugs in last week's sumov.s testsuite.

sim/aarch64/
* simulator.c (mul64hi): Shift carry left by 32.
(smulh): Change signum to negate.  If negate, invert result, and add
carry bit if low part of multiply result is zero.

sim/testsuite/sim/aarch64/
* sumov.s: Correct compare test values.
* sumulh.s: New.

7 years agoUse range-based for loop in remote_add_target_side_commands
Simon Marchi [Fri, 3 Mar 2017 17:58:24 +0000 (12:58 -0500)]
Use range-based for loop in remote_add_target_side_commands

gdb/ChangeLog:

* remote.c (remote_add_target_side_commands): Use range-based
for loop.

7 years agoFetch lazy value before calling val_print
Yao Qi [Fri, 3 Mar 2017 17:16:19 +0000 (17:16 +0000)]
Fetch lazy value before calling val_print

As reported in PR 21165,

(gdb) info locals^M
gv = /home/yao/SourceCode/gnu/gdb/git/gdb/value.c:372: internal-error: int value_bits_any_optimized_out(const value*, int, int): Assertion `!value->lazy' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.ada/info_locals_renaming.exp: info locals (GDB internal error)
Resyncing due to internal error.

This internal error is caused by e8b24d9 (Remove parameter valaddr from
la_val_print).  Commit e8b24d9 removes some calls to
value_contents_for_printing, but value_fetch_lazy is not called, so the
internal error above is triggered.  This patch adds value_fetch_lazy
call before val_print.

gdb:

2017-03-03  Yao Qi  <yao.qi@linaro.org>

PR gdb/21165
* ada-valprint.c (ada_val_print_ref): Call value_fetch_lazy if
value is lazy.
* valprint.c (common_val_print): Likewise.

7 years agoMake the linker fail if asked to create more than 1^16 ordinal values for PE targets.
Nick Clifton [Fri, 3 Mar 2017 11:35:03 +0000 (11:35 +0000)]
Make the linker fail if asked to create more than 1^16 ordinal values for PE targets.

PR 12969
* pe-dll.c (generate_edata): Fail if the input file(s) require too
many ordinals.

7 years agoFix thinko in previous changelog entry.
Nick Clifton [Fri, 3 Mar 2017 10:22:16 +0000 (10:22 +0000)]
Fix thinko in previous changelog entry.

PR ld/21212
* elf.c (rewrite_elf_program_header): Do not issue a warning for
empty segments which have a zero filesz, but a non-zero memsz.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 3 Mar 2017 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoSupport merging build notes in sections without the SHF_GNU_BUILD_NOTE flag set.
Nick Clifton [Thu, 2 Mar 2017 17:10:20 +0000 (17:10 +0000)]
Support merging build notes in sections without the SHF_GNU_BUILD_NOTE flag set.

* objcopy.c (is_merged_note_section): Support build note sections
without the SHF_GNU_BUILD_NOTE section flag set.

7 years agoDisable warning message about a program header with no associated sections when that...
Nick Clifton [Thu, 2 Mar 2017 14:47:29 +0000 (14:47 +0000)]
Disable warning message about a program header with no associated sections when that header's file size is non-zero.

PR ld/21212
* elf.c (rewrite_elf_program_header): Do not issue a warning for
empty segments which have a non-zero filesz.

7 years agoFix snafu parsing GNU_BUILD_NOTEs on ARM and AArch64 architectures.
Nick Clifton [Thu, 2 Mar 2017 10:52:51 +0000 (10:52 +0000)]
Fix snafu parsing GNU_BUILD_NOTEs on ARM and AArch64 architectures.

* readelf.c (print_gnu_build_attribute_description): Use global
symbols for OPEN attributes if at all possible.

7 years agoNew debug_displays_assert
Jan Kratochvil [Thu, 2 Mar 2017 09:58:19 +0000 (10:58 +0100)]
New debug_displays_assert

binutils/
2017-03-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c (debug_displays_assert): New static assertion.

7 years agoFix dwarf_section_display_enum regression by DWARF-5
Jan Kratochvil [Thu, 2 Mar 2017 09:06:00 +0000 (10:06 +0100)]
Fix dwarf_section_display_enum regression by DWARF-5

binutils/
2017-03-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.h (enum dwarf_section_display_enum): Add loclists and rnglists.

7 years agoGAS: Fix bogus "attempt to move .org backwards" relaxation errors
Maciej W. Rozycki [Thu, 2 Mar 2017 01:24:15 +0000 (01:24 +0000)]
GAS: Fix bogus "attempt to move .org backwards" relaxation errors

Fix a commit 6afe8e98a664 ("internal error for backwards .org"),
<https://www.sourceware.org/ml/binutils/2008-06/msg00212.html>,
GAS regression that caused legitimate code to fail assembly with an
"attempt to move .org backwards" error.

For example with the `mips-linux' target we get:

$ cat org.s
.set mips16
la $2, foo
.org 0x1000
.align 2
foo:
.half 0
$ as -o org.o org.s
org.s: Assembler messages:
org.s:3: Error: attempt to move .org backwards
$

where the location pointer is obviously not moved backwards with `.org'.

The cause is positive `stretch' in relaxation due to a PC-relative ADDIU
instruction (produced from the LA macro used) getting expanded from 2 to
4 bytes as `foo' is noticed to be out of range for the short encoding.
This in turn triggers logic in `relax_segment' which concludes in the
processing of an `rs_org' frag produced that the location pointer is
moved backwards while in fact only the amount to space forward to the
location requested has shrunk, resulting in a negative growth of the
frag.

Correct the bad logic then and instead verify that the fixed part of an
`rs_org' frag has not overrun the location requested, as per the comment
already included with the error message:

/* Growth may be negative, but variable part of frag
   cannot have fewer than 0 chars.  That is, we can't
   .org backwards.  */

which accurately describes the regression scenario.  Move the comment
ahead the conditional noted, for clarity.

Add generic and MIPS test cases for the `.org' pseudo-op, including the
test case discussed though not integrated with the offending commit in
particular, adjusted to work across all targets.

gas/
* write.c (relax_segment) <rs_org>: Only bail out if the fixed
part of the frag has overrun the location requested.

* testsuite/gas/all/org-1.d: New test.
* testsuite/gas/all/org-2.d: New test.
* testsuite/gas/all/org-3.d: New test.
* testsuite/gas/all/org-4.d: New test.
* testsuite/gas/all/org-5.d: New test.
* testsuite/gas/all/org-6.d: New test.
* testsuite/gas/all/org-1.l: New stderr output.
* testsuite/gas/all/org-2.l: New stderr output.
* testsuite/gas/all/org-3.l: New stderr output.
* testsuite/gas/all/org-1.s: New test source.
* testsuite/gas/all/org-2.s: New test source.
* testsuite/gas/all/org-3.s: New test source.
* testsuite/gas/all/org-4.s: New test source.
* testsuite/gas/all/org-5.s: New test source.
* testsuite/gas/all/org-6.s: New test source.
* testsuite/gas/all/gas.exp: Run the new tests.

* testsuite/gas/mips/org-1.d: New test.
* testsuite/gas/mips/org-2.d: New test.
* testsuite/gas/mips/org-3.d: New test.
* testsuite/gas/mips/org-4.d: New test.
* testsuite/gas/mips/org-5.d: New test.
* testsuite/gas/mips/org-6.d: New test.
* testsuite/gas/mips/org-7.d: New test.
* testsuite/gas/mips/org-8.d: New test.
* testsuite/gas/mips/org-9.d: New test.
* testsuite/gas/mips/org-10.d: New test.
* testsuite/gas/mips/org-11.d: New test.
* testsuite/gas/mips/org-12.d: New test.
* testsuite/gas/mips/org-1.l: New stderr output.
* testsuite/gas/mips/org-4.l: New stderr output.
* testsuite/gas/mips/org-5.l: New stderr output.
* testsuite/gas/mips/org-6.l: New stderr output.
* testsuite/gas/mips/org-10.l: New stderr output.
* testsuite/gas/mips/org-1.s: New test source.
* testsuite/gas/mips/org-2.s: New test source.
* testsuite/gas/mips/org-3.s: New test source.
* testsuite/gas/mips/org-4.s: New test source.
* testsuite/gas/mips/org-5.s: New test source.
* testsuite/gas/mips/org-6.s: New test source.
* testsuite/gas/mips/org-7.s: New test source.
* testsuite/gas/mips/org-8.s: New test source.
* testsuite/gas/mips/org-9.s: New test source.
* testsuite/gas/mips/org-10.s: New test source.
* testsuite/gas/mips/org-11.s: New test source.
* testsuite/gas/mips/org-12.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

7 years agoPowerPC VLE typo fix
Alan Modra [Wed, 1 Mar 2017 23:54:14 +0000 (10:24 +1030)]
PowerPC VLE typo fix

* elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.

7 years agoAvoid gcc-7 warning killing ld testcases
Alan Modra [Wed, 1 Mar 2017 23:53:42 +0000 (10:23 +1030)]
Avoid gcc-7 warning killing ld testcases

* testsuite/ld-elf/shared.exp: Pass -ansi when compiling new.cc
and dl3.cc.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Mar 2017 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoSync libiberty sources with GCC mainline.
Nick Clifton [Wed, 1 Mar 2017 15:09:29 +0000 (15:09 +0000)]
Sync libiberty sources with GCC mainline.

Brings in:
  2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>

PR PR c++/70182
* cp-demangle.c (d_unqualified_name): Handle "on" for
operator names.
* testsuite/demangle-expected: Add tests.

 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>

PR c++/77489
* cp-demangle.c (d_discriminator): Handle discriminator >= 10.
* testsuite/demangle-expected: Add tests for discriminator.

 2016-12-13  Jakub Jelinek  <jakub@redhat.com>

PR c++/78761
* cp-demangle.c (cplus_demangle_type): Demangle Dc as decltype(auto).
* testsuite/demangle-expected: Add test for decltype(auto).

7 years ago[AArch64] Document +rcpc weak release consistency extension
Szabolcs Nagy [Wed, 1 Mar 2017 14:51:13 +0000 (14:51 +0000)]
[AArch64] Document +rcpc weak release consistency extension

gas/
* doc/c-aarch64.texi (AArch64 Extensions): Document rcpc.

7 years agoAdd support for displaying and merging GNU_BUILD_NOTEs.
Nick Clifton [Wed, 1 Mar 2017 11:09:46 +0000 (11:09 +0000)]
Add support for displaying and merging GNU_BUILD_NOTEs.

include * elf/common.h (SHF_GNU_BUILD_NOTE): Define.
(NT_GNU_PROPERTY_TYPE_0): Define.
(NT_GNU_BUILD_ATTRIBUTE_OPEN): Define.
(NT_GNU_BUILD_ATTRIBUTE_FUN): Define.
(GNU_BUILD_ATTRIBUTE_TYPE_NUMERIC): Define.
(GNU_BUILD_ATTRIBUTE_TYPE_STRING): Define.
(GNU_BUILD_ATTRIBUTE_TYPE_BOOL_TRUE): Define.
(GNU_BUILD_ATTRIBUTE_TYPE_BOOL_FALSE): Define.
(GNU_BUILD_ATTRIBUTE_VERSION): Define.
(GNU_BUILD_ATTRIBUTE_STACK_PROT): Define.
(GNU_BUILD_ATTRIBUTE_RELRO): Define.
(GNU_BUILD_ATTRIBUTE_STACK_SIZE): Define.
(GNU_BUILD_ATTRIBUTE_TOOL): Define.
(GNU_BUILD_ATTRIBUTE_ABI): Define.
(GNU_BUILD_ATTRIBUTE_PIC): Define.
(NOTE_GNU_PROPERTY_SECTION_NAME): Define.
(GNU_BUILD_ATTRS_SECTION_NAME): Define.
(GNU_PROPERTY_STACK_SIZE): Define.
(GNU_PROPERTY_NO_COPY_ON_PROTECTED): Define.
(GNU_PROPERTY_X86_ISA_1_USED): Define.
(GNU_PROPERTY_X86_ISA_1_NEEDED): Define.
(GNU_PROPERTY_X86_ISA_1_486): Define.
(GNU_PROPERTY_X86_ISA_1_586): Define.
(GNU_PROPERTY_X86_ISA_1_686): Define.
(GNU_PROPERTY_X86_ISA_1_SSE): Define.
(GNU_PROPERTY_X86_ISA_1_SSE2): Define.
(GNU_PROPERTY_X86_ISA_1_SSE3): Define.
(GNU_PROPERTY_X86_ISA_1_SSSE3): Define.
(GNU_PROPERTY_X86_ISA_1_SSE4_1): Define.
(GNU_PROPERTY_X86_ISA_1_SSE4_2): Define.
(GNU_PROPERTY_X86_ISA_1_AVX): Define.
(GNU_PROPERTY_X86_ISA_1_AVX2): Define.
(GNU_PROPERTY_X86_ISA_1_AVX512F): Define.
(GNU_PROPERTY_X86_ISA_1_AVX512CD): Define.
(GNU_PROPERTY_X86_ISA_1_AVX512ER): Define.
(GNU_PROPERTY_X86_ISA_1_AVX512PF): Define.
(GNU_PROPERTY_X86_ISA_1_AVX512VL): Define.
(GNU_PROPERTY_X86_ISA_1_AVX512DQ): Define.
(GNU_PROPERTY_X86_ISA_1_AVX512BW): Define.

binutils* readelf.c (get_note_type): Add support for GNU_BUILD_NOTEs.
(get_gnu_elf_note_type): Add support for GNU_PROPERTY_NOTEs.
(decode_x86_isa): New function.
(print_gnu_property_note): New function.
(print_gnu_note): Handle GNU_PROPERTY_NOTEs.
(print_gnu_build_attribute_description): New function.
(print_gnu_build_attribute_name): New function.
(process_note): Add support for GNU_BUILD_NOTEs.
* objcopy.c (--merge-notes): New command line option.
(copy_options): Add merge-notes.
(copy_usage): Likewise.
(is_merge_note_section): New function.
(merge_gnu_build_notes): New function.
(copy_object): Merge note sections if asked to do so.
(skip_section): Add skip_copy parameter.  Add support for skipping
merged note sections.
(copy_relocations_in_section): Update call to skip_section.
(copy_section): Likewise.
(copy_main): Add support for merge-notes option.
* doc/binutils.texi: Document the new option to objcopy.
* NEWS: Mention the new feature.
* testsuite/binutils-all/note-2-32.d: New test.  Checks note
merging on 32-bit targets.
* testsuite/binutils-all/note-2-32.s: New test source file.
* testsuite/binutils-all/note-2-64.d: New test.  Like note-2-32.d
but for 64-bit targets.
* testsuite/binutils-all/note-2-64.s: New test source file.
* testsuite/binutils-all/objcopy.exp: Run the new test.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Mar 2017 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in

7 years agoGDB: Add support for the new set/show disassembler-options commands.
Peter Bergner [Tue, 28 Feb 2017 18:32:07 +0000 (12:32 -0600)]
GDB: Add support for the new set/show disassembler-options commands.

This commit adds support to GDB so that it can modify the disassembler-options
value that is passed to the disassembler, similar to objdump's -M option.
Currently, the only supported targets are ARM, PowerPC and S/390, but
adding support for a new target(s) is not difficult.

include/
* dis-asm.h (disasm_options_t): New typedef.
(parse_arm_disassembler_option): Remove prototype.
(set_arm_regname_option): Likewise.
(get_arm_regnames): Likewise.
(get_arm_regname_num_options): Likewise.
(disassemble_init_s390): New prototype.
(disassembler_options_powerpc): Likewise.
(disassembler_options_arm): Likewise.
(disassembler_options_s390): Likewise.
(remove_whitespace_and_extra_commas): Likewise.
(disassembler_options_cmp): Likewise.
(next_disassembler_option): New inline function.
(FOR_EACH_DISASSEMBLER_OPTION): New macro.

opcodes/
* disassemble.c Include "safe-ctype.h".
(disassemble_init_for_target): Handle s390 init.
(remove_whitespace_and_extra_commas): New function.
(disassembler_options_cmp): Likewise.
* arm-dis.c: Include "libiberty.h".
(NUM_ELEM): Delete.
(regnames): Use long disassembler style names.
Add force-thumb and no-force-thumb options.
(NUM_ARM_REGNAMES): Rename from this...
(NUM_ARM_OPTIONS): ...to this.  Use ARRAY_SIZE.
(get_arm_regname_num_options): Delete.
(set_arm_regname_option): Likewise.
(get_arm_regnames): Likewise.
(parse_disassembler_options): Likewise.
(parse_arm_disassembler_option): Rename from this...
(parse_arm_disassembler_options): ...to this.  Make static.
Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options.
(print_insn): Use parse_arm_disassembler_options.
(disassembler_options_arm): New function.
(print_arm_disassembler_options): Handle updated regnames.
* ppc-dis.c: Include "libiberty.h".
(ppc_opts): Add "32" and "64" entries.
(ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp.
(powerpc_init_dialect): Add break to switch statement.
Use new FOR_EACH_DISASSEMBLER_OPTION macro.
(disassembler_options_powerpc): New function.
(print_ppc_disassembler_options): Use ARRAY_SIZE.
Remove printing of "32" and "64".
* s390-dis.c: Include "libiberty.h".
(init_flag): Remove unneeded variable.
(struct s390_options_t): New structure type.
(options): New structure.
(init_disasm): Rename from this...
(disassemble_init_s390): ...to this.  Add initializations for
current_arch_mask and option_use_insn_len_bits_p.  Remove init_flag.
(print_insn_s390): Delete call to init_disasm.
(disassembler_options_s390): New function.
(print_s390_disassembler_options): Print using information from
struct 'options'.
* po/opcodes.pot: Regenerate.

binutils/
* objdump.c (main): Use remove_whitespace_and_extra_commas.

gdb/
* NEWS: Mention new set/show disassembler-options commands.
* doc/gdb.texinfo: Document new set/show disassembler-options commands.
* disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h".
(prospective_options): New static variable.
(gdb_disassembler::gdb_disassembler): Initialize
m_di.disassembler_options.
(gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options.
(get_disassembler_options): New function.
(set_disassembler_options): Likewise.
(set_disassembler_options_sfunc): Likewise.
(show_disassembler_options_sfunc): Likewise.
(disassembler_options_completer): Likewise.
(_initialize_disasm): Likewise.
* disasm.h (get_disassembler_options): New prototype.
(set_disassembler_options): Likewise.
* gdbarch.sh (gdbarch_disassembler_options): New variable.
(gdbarch_verify_disassembler_options): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* arm-tdep.c (num_disassembly_options): Delete.
(set_disassembly_style): Likewise.
(arm_disassembler_options): New static variable.
(set_disassembly_style_sfunc): Convert short style name into long
option name.  Call set_disassembler_options.
(show_disassembly_style_sfunc): New function.
(arm_gdbarch_init): Call set_gdbarch_disassembler_options and
set_gdbarch_verify_disassembler_options.
(_initialize_arm_tdep): Delete regnames variable and update callers.
(arm_disassembler_options): Initialize.
(disasm_options): New variable.
(num_disassembly_options): Rename from this...
(num_disassembly_styles): ...to this.  Compute by scanning through
disasm_options.
(valid_disassembly_styles): Initialize using disasm_options.
Remove calls to parse_arm_disassembler_option, get_arm_regnames and
set_arm_regname_option.
Pass show_disassembly_style_sfunc to the "disassembler" setshow command.
* rs6000-tdep.c (powerpc_disassembler_options): New static variable.
(rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and
set_gdbarch_verify_disassembler_options.
* s390-tdep.c (s390_disassembler_options): New static variable.
(s390_gdbarch_init):all set_gdbarch_disassembler_options and
set_gdbarch_verify_disassembler_options.

gdb/testsuite/
* gdb.arch/powerpc-power.exp: Delete test.
* gdb.arch/powerpc-power.s: Likewise.
* gdb.disasm/disassembler-options.exp: New test.
* gdb.arch/powerpc-altivec.exp: Likewise.
* gdb.arch/powerpc-altivec.s: Likewise.
* gdb.arch/powerpc-altivec2.exp: Likewise.
* gdb.arch/powerpc-altivec2.s: Likewise.
* gdb.arch/powerpc-altivec3.exp: Likewise.
* gdb.arch/powerpc-altivec3.s: Likewise.
* gdb.arch/powerpc-power7.exp: Likewise.
* gdb.arch/powerpc-power7.s: Likewise.
* gdb.arch/powerpc-power8.exp: Likewise.
* gdb.arch/powerpc-power8.s: Likewise.
* gdb.arch/powerpc-power9.exp: Likewise.
* gdb.arch/powerpc-power9.s: Likewise.
* gdb.arch/powerpc-vsx.exp: Likewise.
* gdb.arch/powerpc-vsx.s: Likewise.
* gdb.arch/powerpc-vsx2.exp: Likewise.
* gdb.arch/powerpc-vsx2.s: Likewise.
* gdb.arch/powerpc-vsx3.exp: Likewise.
* gdb.arch/powerpc-vsx3.s: Likewise.
* gdb.arch/arm-disassembler-options.exp: Likewise.
* gdb.arch/powerpc-disassembler-options.exp: Likewise.
* gdb.arch/s390-disassembler-options.exp: Likewise.

7 years agoRevert "Add symbol called __nm_<name> to exported symbols created by dlltool."
Nick Clifton [Tue, 28 Feb 2017 16:54:16 +0000 (16:54 +0000)]
Revert "Add symbol called __nm_<name> to exported symbols created by dlltool."

This reverts commit 47612ae91c5f2de8960df1d96adf225d2455123f.

7 years agoPowerPC addpcis fix again
Alan Modra [Tue, 28 Feb 2017 13:12:29 +0000 (23:42 +1030)]
PowerPC addpcis fix again

In the last patch I said "The patch also fixes overflow checking".
In fact, there wasn't anything wrong with the previous code.  So,
revert that change.  The new checks are OK too, so this is just a
tidy.

* elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
(ppc64_elf_relocate_section): Likewise.

7 years agox86: fix handling of 64-bit operand size VPCMPESTR{I,M}
Jan Beulich [Tue, 28 Feb 2017 09:53:35 +0000 (10:53 +0100)]
x86: fix handling of 64-bit operand size VPCMPESTR{I,M}

Just like REX.W affects operand size of the implicit rAX/rDX inputs to
PCMPESTR{I,M}, VEX.W does for VPCMPESTR{I,M}. Allow Q or L suffixes on
the instructions.

Similarly the disassembler needs to be adjusted to no longer require
VEX.W to be zero for the instructions to be valid, and to emit proper
suffixes.

Note, however, that this doesn't address the problem of there being no
way to control (at least) {,E}VEX.W for 32- or 16-bit code. Nor does it
address the problem of the many WIG instructions not getting properly
disassembled when VEX.W=1.

7 years agoNios2 dynobj handling fixes
Alan Modra [Tue, 28 Feb 2017 00:08:51 +0000 (10:38 +1030)]
Nios2 dynobj handling fixes

A number of places in elf32-nios.c created dynamic sections but didn't
set the hash table dynobj.  That meant we could have duplicate dynamic
sections connected to a number of bfds, so size_dynamic_sections
didn't properly discard or allocate contents.

Also, the entire set of dynamic sections was created in check_relocs
on seeing GOT relocs, when only .got related sections are needed,
probably done to hide segfaults later in finish_dynamic_sections.

The patch fixes these issues and makes the assembler emit errors when
nios2 lacks the necessary pc-relative relocs for subtraction
expressions, rather than silently generating bad code.
eg. ld-elf/merge.  I've also tidied uses of elf32_nios2_hash_table and
elf_hash_table.

bfd/
PR 20995
* elf32-nios2.c (nios2_elf32_relocate_section): Use htab
rather than elf32_nios2_hash_table or elf_hash_table.
(create_got_section): Likewise.
(nios2_elf32_finish_dynamic_symbol): Likewise.
(nios2_elf32_adjust_dynamic_symbol): Likewise.
(nios2_elf32_size_dynamic_sections): Likewise.
(nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
vars.  Use htab equivalents directly instead.  Don't create
all dynamic sections on needing just the GOT.  Use a goto
rather than a fall-through with reloc test.  Ensure
htab->dynobj is set when making dynamic sreloc section.
(nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
equivalent directly instead.  Don't segfault on looking for
.dynamic when dynamic sections have not been created.  Don't
segfault on .got.plt being discarded.
(nios2_elf32_size_dynamic_sections): Delete plt and got vars.
Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
fixme and another not so relevant comment.
(nios2_elf_add_symbol_hook): Delete dynobj var.  If not
already set, set hash table dynobj on creating .sbss.
gas/
* config/tc-nios2.h (TC_FORCE_RELOCATION_SUB_LOCAL): Define.
ld/
* testsuite/ld-elf/merge.d: xfail for nios.

7 years agoPowerPC addpcis fix
Alan Modra [Mon, 27 Feb 2017 22:02:36 +0000 (08:32 +1030)]
PowerPC addpcis fix

This came up because I was looking at ld/tmpdir/addpcis.o and noticed
the odd addends on REL16DX_HA.  They ought to both be -4.  The error
crept in due REL16DX_HA howto being pc-relative (as indeed it should
be), and code at gas/write.c:1001 after this comment
      /* Make it pc-relative.  If the back-end code has not
 selected a pc-relative reloc, cancel the adjustment
 we do later on all pc-relative relocs.  */
*not* cancelling the pc-relative adjustment.  So I've made a dummy
non-relative split reloc so that the generic code handles this, rather
than attempting to add hacks later in md_apply_fix which would not be
very robust.  Having the new internal reloc also makes it easy to
support

 addpcis rx,sym@ha

as an equivalent to

 addpcis rx,(sym-0f)@ha
0:

The patch also fixes overflow checking, which must test whether the
addi will overflow too since @l relocs don't have any overflow check.

Lastly, since I was poking at md_apply_fix, I arranged to have the
generic gas/write.c code emit errors for subtraction expressions where
we lack reloc support.

include/
* elf/ppc64.h (R_PPC64_16DX_HA): New.  Expand fake reloc comment.
* elf/ppc.h (R_PPC_16DX_HA): Likewise.
bfd/
* reloc.c (BFD_RELOC_PPC_16DX_HA): New.
* elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
(ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
(ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
(ppc64_elf_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
(ppc_elf_reloc_type_lookup): Translate new bfd reloc.
(ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
gas/
* config/tc-ppc.c (md_assemble): Use BFD_RELOC_PPC_16DX_HA for addpcis.
(md_apply_fix): Remove fx_subsy check.  Move code converting to
pcrel reloc earlier and handle BFD_RELOC_PPC_16DX_HA.  Remove code
emiiting errors on seeing fx_pcrel set on unexpected relocs, as
that is done now by the generic code via..
* config/tc-ppc.h (TC_FORCE_RELOCATION_SUB_LOCAL): ..this. Define.
(TC_VALIDATE_FIX_SUB): Define.
ld/
* testsuite/ld-powerpc/addpcis.d: Define ext1 and ext2 at
limits of addpcis range.

7 years agoDon't make dynamic .data.rel.ro SEC_READONLY
Alan Modra [Mon, 27 Feb 2017 21:36:02 +0000 (08:06 +1030)]
Don't make dynamic .data.rel.ro SEC_READONLY

I'd made this dynamic section read-only so a flag test distinguished
it from .dynbss, but like any other .data.rel.ro section it really
should be marked read-write.  (It is read-only after relocation, not
before.)  When using the standard linker scripts this usually doesn't
matter since the output section is among other read-write sections and
not page aligned.  However, it might matter in the extraordinary case
of the dynamic section being the only .data.rel.ro section with the
output section just happening to be page aligned and a multiple of a
page in size.  In that case the output section would be read-only, and
live it its own read-only PT_LOAD segment, which is incorrect.

* elflink.c (_bfd_elf_create_dynamic_sections): Don't make
dynamic .data.rel.ro read-only.
* elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
rather than section flags when deciding where copy reloc goes.
* elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
* elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
* elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
* elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
* elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
* elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
* elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
* elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
* elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
* elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
* elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
* elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
* elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
* elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.

7 years agoMIPS/BFD: Also handle `jalr $0, $25' with R_MIPS_JALR
Maciej W. Rozycki [Tue, 28 Feb 2017 00:14:08 +0000 (00:14 +0000)]
MIPS/BFD: Also handle `jalr $0, $25' with R_MIPS_JALR

Interpret the `jalr $0, $25' instruction encoding with an R_MIPS_JALR
relocation attached as an alias to `jr $25' and convert the jump to an
equivalent branch where possible, consequently covering the MIPSr6
architecture for the purpose of this optimization too.

bfd/
* elfxx-mips.c (mips_elf_perform_relocation): Also handle the
`jalr $0, $25' instruction encoding.

gas/
* testsuite/gas/mips/jalr4.s: Add `jalr $0, $25' instructions.
* testsuite/gas/mips/jalr4.d: Adjust accordingly.  Remove MIPSr6
encoding patterns.
* testsuite/gas/mips/jalr4-n64.d: Likewise.
* testsuite/gas/mips/mipsr6@jalr4.d: New test.
* testsuite/gas/mips/mipsr6@jalr4-n32.d: New test.
* testsuite/gas/mips/mipsr6@jalr4-n64.d: New test.

ld/
* testsuite/ld-mips-elf/jalr4.dd: Adjust for `jalr $0, $25'
instructions.
* testsuite/ld-mips-elf/jalr4-r6.dd: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 28 Feb 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix compilation with GCC 4.4.7.
Jan Kratochvil [Mon, 27 Feb 2017 22:22:53 +0000 (23:22 +0100)]
Fix compilation with GCC 4.4.7.

binutils/
2017-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix compilation with GCC 4.4.7.
* dwarf.c (display_loclists_list, display_debug_rnglists_list):
Initialize begin and end.

7 years agoRemove struct keyword from range-based for loop
Simon Marchi [Mon, 27 Feb 2017 19:09:34 +0000 (14:09 -0500)]
Remove struct keyword from range-based for loop

The previous patch introduced this error with recent-ish GCCs:

../../binutils-gdb/gdb/remote.c: In function ‘int remote_add_target_side_condition(gdbarch*, bp_target_info*, char*, char*)’:
../../binutils-gdb/gdb/remote.c:9668:8: error: types may not be defined in a for-range-declaration [-Werror]
   for (struct agent_expr *aexpr : bp_tgt->conditions)
        ^~~~~~

Removing the struct keyword fixes the error.

gdb/ChangeLog:

* remote.c (remote_add_target_side_condition): Remove "struct"
keyword from range-based for loop.

7 years agoUse range-based for loop in remote_add_target_side_condition
Simon Marchi [Mon, 27 Feb 2017 18:54:53 +0000 (13:54 -0500)]
Use range-based for loop in remote_add_target_side_condition

Using a range based for loop makes this code a bit more clean and
readable.

The comment above is clearly erroneous, so I've updated it.

gdb/ChangeLog:

* remote.c (remote_add_target_side_condition): Use range-based
for loop.  Update comment.

7 years agoFix array out of bound access
Yao Qi [Mon, 27 Feb 2017 17:27:17 +0000 (17:27 +0000)]
Fix array out of bound access

ASAN reports the following error,

(gdb) PASS: gdb.fortran/vla-ptr-info.exp: continue to breakpoint: pvla-associated
print &pvla^M
=================================================================^M
^[[1m^[[31m==14331==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000ea569f at pc 0x0000008eb546 bp 0x7ffde0c1dc70 sp 0x7ffde0c1dc60^M
^[[1m^[[0m^[[1m^[[34mREAD of size 1 at 0x000000ea569f thread T0^[[1m^[[0m^M
    #0 0x8eb545 in f_print_type(type*, char const*, ui_file*, int, int, type_print_options const*) ../../binutils-gdb/gdb/f-typeprint.c:89^M
    #1 0xb611e2 in type_print(type*, char const*, ui_file*, int) ../../binutils-gdb/gdb/typeprint.c:365^M
    #2 0x7b3471 in c_value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/c-valprint.c:650^M
    #3 0xb99517 in value_print(value*, ui_file*, value_print_options const*) ../../binutils-gdb/gdb/valprint.c:1233^M
    #4 0xa42be8 in print_formatted ../../binutils-gdb/gdb/printcmd.c:321^M
    #5 0xa46ac9 in print_value(value*, format_data const*) ../../binutils-gdb/gdb/printcmd.c:1233^M
    #6 0xa46d82 in print_command_1 ../../binutils-gdb/gdb/printcmd.c:1261^M
    #7 0xa46e3e in print_command ../../binutils-gdb/gdb/printcmd.c:1267

on this line of code

      demangled_args = varstring[strlen (varstring) - 1] == ')';

because varstring is an empty string and strlen () is 0, so "strlen () - 1"
is definitely out of the bound of "varstring",

(gdb) bt 10
    at /home/yao/SourceCode/gnu/gdb/git/gdb/f-typeprint.c:56
    at /home/yao/SourceCode/gnu/gdb/git/gdb/typeprint.c:365
    at /home/yao/SourceCode/gnu/gdb/git/gdb/c-valprint.c:650
    at /home/yao/SourceCode/gnu/gdb/git/gdb/valprint.c:1236

This patch adds a pre-check that varstring is empty or not.

gdb:

2017-02-27  Yao Qi  <yao.qi@linaro.org>

* f-typeprint.c (f_print_type): Check "varstring" is empty first.

7 years agoPlace read-only data in the text section on AVR Tiny targets.
Georg-Johann Lay [Mon, 27 Feb 2017 17:05:53 +0000 (17:05 +0000)]
Place read-only data in the text section on AVR Tiny targets.

PR target/20849
        * scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
        (.rodata): New section.
        (.data): Remove .rodata*.

7 years agoAdd symbol called __nm_<name> to exported symbols created by dlltool.
Rudy Y [Mon, 27 Feb 2017 15:02:52 +0000 (15:02 +0000)]
Add symbol called __nm_<name> to exported symbols created by dlltool.

PR 20881
* dlltool.c (secdata): Align .idata$6 on 2 byte boundary.
(make_one_lib_file): Export a symbol called __nm_<symbol> for use
with auto-importing.

7 years agoFix segfault in microblaze linker when garbage collection removes a symbol scheduled...
Nick Clifton [Mon, 27 Feb 2017 11:33:05 +0000 (11:33 +0000)]
Fix segfault in microblaze linker when garbage collection removes a symbol scheduled for a slot in the PLT.

PR ld/21180
* elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
generating a seg-fault when encountering a symbol that has been
deleted by garbage collection.

7 years agoRemove MAX_REGISTER_SIZE from remote.c
Alan Hayward [Mon, 27 Feb 2017 09:58:35 +0000 (09:58 +0000)]
Remove MAX_REGISTER_SIZE from remote.c

gdb/
* regcache.c (regcache_raw_update): New function.
(regcache_raw_read): Move code to regcache_raw_update.
* regcache.h (regcache_raw_update): New declaration.
* remote.c (remote_prepare_to_store): Call regcache_raw_update.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 27 Feb 2017 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoDWARF-5: Initialization due to a false compiler warning
Jan Kratochvil [Sun, 26 Feb 2017 15:54:51 +0000 (16:54 +0100)]
DWARF-5: Initialization due to a false compiler warning

gcc-6.3.1-1.fc25.x86_64

dwarf2read.c: In function ‘void create_debug_type_hash_table(dwo_file*, dwarf2_section_info*, htab*&, rcuh_kind)’:
dwarf2read.c:4776:32: error: ‘header.comp_unit_head::type_offset_in_tu.cu_offset::cu_off’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
dwarf2read.c:4816:21: error: ‘header.comp_unit_head::signature’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1plus: all warnings being treated as errors

gdb/ChangeLog
2017-02-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf2read.c (create_debug_type_hash_table): Initialize
header.signature and header.type_offset_in_tu.

7 years agoAdd missing smov support, and clean up existing umov support.
Jim Wilson [Sun, 26 Feb 2017 04:06:36 +0000 (20:06 -0800)]
Add missing smov support, and clean up existing umov support.

sim/aarch64/
* simulator.c (do_vec_SMOV_into_scalar): New.
(do_vec_UMOV_into_scalar): Renamed from do_vec_MOV_into_scalar.
Rewritten.
(do_vec_UMOV): Merged into do_vec_UMOV_into_scalar and deleted.
(do_vec_op1): Move do_vec_TRN call and do_vec_UZP call.  Add
do_vec_SMOV_into_scalar call.  Delete do_vec_MOV_into_scalar and
do_vec_UMOV calls.  Add do_vec_UMOV_into_scalar call.

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

7 years agoAdd missing cnt (popcount) instruction support.
Jim Wilson [Sun, 26 Feb 2017 04:04:09 +0000 (20:04 -0800)]
Add missing cnt (popcount) instruction support.

sim/aarch64/
* simulator.c (popcount): New.
(do_vec_CNT): New.
(do_vec_op1): Add do_vec_CNT call.

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

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 26 Feb 2017 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoTestsuite fixes for hppa64-hpux
Alan Modra [Fri, 24 Feb 2017 13:32:27 +0000 (00:02 +1030)]
Testsuite fixes for hppa64-hpux

HPUX has a different .comm syntax, and anything in the first column
is a label.

gas/
* testsuite/gas/elf/strtab.s: Don't put directives on first
column or continuation with labels not in first column.
ld/
* testsuite/ld-elf/elf.exp: Xfail pr20995 tests on hppa64-hpux.
Set up HPUX defsym.  Run pr14170 tests and build symbol3 objects,
defining HPUX where necessary.  Define HPUX for implib tests.
* testsuite/ld-elf/comm-data4.d: Run for hpux.
* testsuite/ld-elf/endsym.d: Likewise.
* testsuite/ld-elf/linkoncerdiff.d: Likewise.
* testsuite/ld-elf/comm-data4.s: Add alternate .comm when HPUX.
* testsuite/ld-elf/comm-data5.s: Likewise.
* testsuite/ld-elf/endsym.s: Likewise.
* testsuite/ld-elf/pr14170c.s: Likewise.
* testsuite/ld-elf/symbol3.s: Likewise.
* testsuite/ld-elf/implib.s: Likewise.  Don't start directives
in first column.
* testsuite/ld-elf/linkoncerdiff2.s: Don't use numeric labels.
* testsuite/ld-elf/warn3.d: Run for hpux.
* testsuite/ld-scripts/rgn-at10.d: Xfail for hpux.
* testsuite/ld-scripts/rgn-at11.d: Likewise.
* testsuite/ld-scripts/size-2.d: Remove xfail for hpux.

7 years agoFixes for new dw5 test
Alan Modra [Fri, 24 Feb 2017 13:28:50 +0000 (23:58 +1030)]
Fixes for new dw5 test

On some targets, .string does not add a NUL string terminator.

* testsuite/binutils-all/dw5.S: Replace .string with .asciz.
Support hpux .comm variant.
* testsuite/binutils-all/readelf.exp: Define HPUX when assembling
dw5 test for hppa64-hpux.

7 years agoARC naughtiness causing assertion fail at elf-strtab.c:302
Alan Modra [Sat, 25 Feb 2017 05:14:29 +0000 (15:44 +1030)]
ARC naughtiness causing assertion fail at elf-strtab.c:302

This patch fixes a number of issues in the ARC backend.

- The ARC size_dynamic_sections was trashing dynamic section contents,
  in particular the .gnu.version_d contents.  Those versions
  definitions are therefore lost so they do not drain from the strtab,
  resulting in assertion failures.
- The code attempting to set DT_TEXTREL was completely bogus.
- The ARC finish_dynamic_sections would segfault on trying to set
  sh_entsize for .rela.plt if that section had been discarded.
- arc_create_dynamic_sections wouldn't have ever created dynamics
  sections, which was just as well since the places it was called were
  way too late to create dynamic sections.  Its usefulness then
  devolved down to finding just one dynamic section.  All the others
  packaged into a struct were unused.
- .interp wasn't set for PIEs.

* elf32-arc.c (struct dynamic_sections): Delete.
(enum dyn_section_types): Delete.
(dyn_section_names): Delete.
(arc_create_dynamic_sections): Delete.
(elf_arc_finish_dynamic_sections): Don't call the above.  Don't
segfault on discarded .rela.plt section.
(elf_arc_size_dynamic_sections): Formatting.  Don't call
arc_create_dynamic_sections.  Don't allocate memory for sections
handled by the generic linker.  Correct code finding relocs in
read-only sections.  Set SEC_EXCLUDE on zero size .got,
.got.plt, and .dynbss sections.  Do set .interp for pies.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 25 Feb 2017 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years ago[AArch64] Additional SVE instructions
Richard Sandiford [Fri, 24 Feb 2017 18:29:00 +0000 (18:29 +0000)]
[AArch64] Additional SVE instructions

This patch supports some additions to the SVE architecture prior to
its public release.

include/
* opcode/aarch64.h (AARCH64_OPND_SVE_ADDR_RI_S4x16)
(AARCH64_OPND_SVE_IMM_ROT1, AARCH64_OPND_SVE_IMM_ROT2)
(AARCH64_OPND_SVE_Zm3_INDEX, AARCH64_OPND_SVE_Zm3_22_INDEX)
(AARCH64_OPND_SVE_Zm4_INDEX): New aarch64_opnds.

opcodes/
* aarch64-tbl.h (OP_SVE_HMH, OP_SVE_VMU_HSD, OP_SVE_VMVU_HSD)
(OP_SVE_VMVV_HSD, OP_SVE_VMVVU_HSD, OP_SVE_VM_HSD, OP_SVE_VUVV_HSD)
(OP_SVE_VUV_HSD, OP_SVE_VU_HSD, OP_SVE_VVVU_H, OP_SVE_VVVU_S)
(OP_SVE_VVVU_HSD, OP_SVE_VVV_D, OP_SVE_VVV_D_H, OP_SVE_VVV_H)
(OP_SVE_VVV_HSD, OP_SVE_VVV_S, OP_SVE_VVV_S_B, OP_SVE_VVV_SD_BH)
(OP_SVE_VV_BHSDQ, OP_SVE_VV_HSD, OP_SVE_VZVV_HSD, OP_SVE_VZV_HSD)
(OP_SVE_V_HSD): New macros.
(OP_SVE_VMU_SD, OP_SVE_VMVU_SD, OP_SVE_VM_SD, OP_SVE_VUVV_SD)
(OP_SVE_VU_SD, OP_SVE_VVVU_SD, OP_SVE_VVV_SD, OP_SVE_VZVV_SD)
(OP_SVE_VZV_SD, OP_SVE_V_SD): Delete.
(aarch64_opcode_table): Add new SVE instructions.
(aarch64_opcode_table): Use imm_rotate{1,2} instead of imm_rotate
for rotation operands.  Add new SVE operands.
* aarch64-asm.h (ins_sve_addr_ri_s4): New inserter.
(ins_sve_quad_index): Likewise.
(ins_imm_rotate): Split into...
(ins_imm_rotate1, ins_imm_rotate2): ...these two inserters.
* aarch64-asm.c (aarch64_ins_imm_rotate): Split into...
(aarch64_ins_imm_rotate1, aarch64_ins_imm_rotate2): ...these two
functions.
(aarch64_ins_sve_addr_ri_s4): New function.
(aarch64_ins_sve_quad_index): Likewise.
(do_misc_encoding): Handle "MOV Zn.Q, Qm".
* aarch64-asm-2.c: Regenerate.
* aarch64-dis.h (ext_sve_addr_ri_s4): New extractor.
(ext_sve_quad_index): Likewise.
(ext_imm_rotate): Split into...
(ext_imm_rotate1, ext_imm_rotate2): ...these two extractors.
* aarch64-dis.c (aarch64_ext_imm_rotate): Split into...
(aarch64_ext_imm_rotate1, aarch64_ext_imm_rotate2): ...these two
functions.
(aarch64_ext_sve_addr_ri_s4): New function.
(aarch64_ext_sve_quad_index): Likewise.
(aarch64_ext_sve_index): Allow quad indices.
(do_misc_decoding): Likewise.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc.h (FLD_SVE_i3h, FLD_SVE_rot1, FLD_SVE_rot2): New
aarch64_field_kinds.
(OPD_F_OD_MASK): Widen by one bit.
(OPD_F_NO_ZR): Bump accordingly.
(get_operand_field_width): New function.
* aarch64-opc.c (fields): Add new SVE fields.
(operand_general_constraint_met_p): Handle new SVE operands.
(aarch64_print_operand): Likewise.
* aarch64-opc-2.c: Regenerate.

gas/
* doc/c-aarch64.texi: Document that sve implies fp16, simd and compnum.
* config/tc-aarch64.c (parse_vector_type_for_operand): Allow .q
to be used with SVE registers.
(parse_operands): Handle new SVE operands.
(aarch64_features): Make "sve" require F16 rather than FP.  Also
require COMPNUM.
* testsuite/gas/aarch64/sve.s: Add tests for new instructions.
Include compnum tests.
* testsuite/gas/aarch64/sve.d: Update accordingly.
* testsuite/gas/aarch64/sve-invalid.s: Add tests for new instructions.
* testsuite/gas/aarch64/sve-invalid.l: Update accordingly.  Also
update expected output for new FMOV and MOV alternatives.

7 years ago[AArch64] Add a "compnum" feature
Richard Sandiford [Fri, 24 Feb 2017 18:27:26 +0000 (18:27 +0000)]
[AArch64] Add a "compnum" feature

This patch adds a named "compnum" feature for the ARMv8.3-A FCADD
and FCMLA extensions.

include/
* opcode/aarch64.h (AARCH64_FEATURE_COMPNUM): New macro.
(AARCH64_ARCH_V8_3): Include AARCH64_FEATURE_COMPNUM.

opcodes/
* aarch64-tbl.h (aarch64_feature_simd_v8_3): Replace with...
(aarch64_feature_compnum): ...this.
(SIMD_V8_3): Replace with...
(COMPNUM): ...this.
(CNUM_INSN): New macro.
(aarch64_opcode_table): Use it for the complex number instructions.

gas/
* doc/c-aarch64.texi: Add a "compnum" entry.
* config/tc-aarch64.c (aarch64_features): Likewise,
* testsuite/gas/aarch64/advsimd-compnum.s: New test.
* testsuite/gas/aarch64/advsimd-compnum.d: Likewise.

7 years agoFix snafu with booleans in readelf patch - lack of a program header is not a reason...
Nick Clifton [Fri, 24 Feb 2017 18:15:12 +0000 (18:15 +0000)]
Fix snafu with booleans in readelf patch - lack of a program header is not a reason for a function to return false.

(process_program_headers): Fix snafu - if the program headers are
not available then this is not a cause to fail.
(process_corefile_note_segments): Likewise.

7 years agosymtab.c: Small refactor
Pedro Alves [Fri, 24 Feb 2017 17:42:51 +0000 (17:42 +0000)]
symtab.c: Small refactor

add_symtab_completions does the exact same as the code that it is
replacing.

gdb/ChangeLog:
2017-02-24  Pedro Alves  <palves@redhat.com>

* symtab.c (make_file_symbol_completion_list_1): Use
add_symtab_completions.

7 years agobfd: RISC-V: relax to gp in more cases.
Andrew Waterman [Wed, 22 Feb 2017 05:56:57 +0000 (21:56 -0800)]
bfd: RISC-V: relax to gp in more cases.

bfd/ChangeLog:

2017-02-24  Andrew Waterman  <andrew@sifive.com>

* elfnn-riscv.c (GP_NAME): New macro.
(riscv_global_pointer_value): Use it.
(_bfd_riscv_relax_lui): If symbol and global pointer are in same
output section, consider only that section's alignment.

7 years agoAdd new counter-enable CSRs
Andrew Waterman [Thu, 23 Feb 2017 05:23:05 +0000 (21:23 -0800)]
Add new counter-enable CSRs

include/ChangeLog:

2017-02-22  Andrew Waterman  <andrew@sifive.com>

       * opcode/riscv-opc.h (CSR_SCOUNTEREN): New define.
       (CSR_MCOUNTEREN): Likewise.
       (scounteren): Declare register.
       (mcounteren): Likewise.

7 years agoRemove use of MAX_REGISTER_SIZE
Alan Hayward [Fri, 24 Feb 2017 16:09:48 +0000 (16:09 +0000)]
Remove use of MAX_REGISTER_SIZE

gdb/
* stack.c (frame_info): Use frame_unwind_register_value to avoid buf.

7 years agoUse I386_MAX_REGISTER_SIZE and M68K_MAX_REGISTER_SIZE
Alan Hayward [Fri, 24 Feb 2017 16:09:43 +0000 (16:09 +0000)]
Use I386_MAX_REGISTER_SIZE and M68K_MAX_REGISTER_SIZE

gdb/
* i386-tdep.c (i386_pseudo_register_read_into_value): Use
I386_MAX_REGISTER_SIZE.
(i386_pseudo_register_write): Likewise.
(i386_process_record): Likewise.
* i387-tdep.c (i387_supply_xsave): Likewise.
* m68k-linux-nat.c (fetch_register): Use M68K_MAX_REGISTER_SIZE.
(store_register): Likewise.

7 years agoTidy up readelf's use of boolean values.
Nick Clifton [Fri, 24 Feb 2017 14:48:19 +0000 (14:48 +0000)]
Tidy up readelf's use of boolean values.

* readelf.c (show_name, do_dynamic, do_syms, do_dyn_syms,
(do_reloc, do_sections, do_section_groups, do_section_details,
(do_segments, do_unwind, do_using_dynamic, do_header, do_dump,
(do_version, do_histogram, do_debugging, do_arch, do_notes,
(do_archive_index, is_32bit_elf, decompress_dumps): Use
bfd_boolean type.
(parse_args): Treat the do_* variables as booleans.
(print_vma): Return an unsigned int.
(print_symbol): Change width parameter to signed int.
(is_ia64_vms): Change return type to bfd_boolean.
(guess_is_rela): Likewise.
(slurp_rela_relocs): Likewise.
(slurp_rel_relocs): Likewise.
(dump_relocations): Likewise.
(process_file_header): Likewise.
(get_program_headers): Likewise.
(process_program_headers): Likewise.
(process_section_headers): Likewise.
(process_section_groups): Likewise.
(dump_ia64_vms_dynamic_fixups): Likewise.
(dump_ia64_vms_dynamic_relocs): Likewise.
(process_ia64_vms_dynamic_relocs): Likewise.
(process_relocs): Likewise.
(dump_ia64_unwind): Likewise.
(ia64_process_unwind): Likewise.
(dump_hppa_unwind): Likewise.
(slurp_hppa_unwind_table): Likewise.
(hppa_process_unwind): Likewise.
(decode_arm_unwind_bytecode): Likewise.
(decode_tic6x_unwind_bytecode): Likewise.
(decode_arm_unwind): Likewise.
(dump_arm_unwind): Likewise.
(arm_process_unwind): Likewise.
(process_unwind): Likewise.
(get_32bit_dynamic_section): Likewise.
(get_64bit_dynamic_section): Likewise.
(process_dynamic_section): Likewise.
(process_version_sections): Likewise.
(process_symbol_table): Likewise.
(process_syminfo): Likewise.
(apply_relocations): Likewise.
(disassemble_section): Likewise.
(dump_section_as_strings): Likewise.
(dump_section_as_bytes): Likewise.
(load_specific_debug_section): Likewise.
(load_debug_section): Likewise.
(display_debug_section): Likewise.
(process_section_contents): Likewise.
(process_attributes): Likewise.
(process_nds32_specific): Likewise.
(process_gnu_liblist): Likewise.
(print_core_note): Likewise.
(print_gnu_note): Likewise.
(print_v850_note): Likewise.
(process_netbsd_elf_note): Likewise.
(print_stapsdt_note): Likewise.
(print_ia64_vms_note): Likewise.
(process_note): Likewise.
(process_notes_at): Likewise.
(process_corefile_note_segments): Likewise.
(process_v850_notes): Likewise.
(process_note_sections): Likewise.
(process_notes): Likewise.
(process_arch_specific): Likewise.
(get_file_header): Likewise.
(process_object): Likewise.
(process_archive): Likewise.
(process_file): Likewise.
(section_subset): Make static.
(get_mips_reg_size): Return a signed integer.
(process_object): Reverse the logic of the return value.
(process_archive): Likewise.
(process_file): Likewise.

7 years agoreadelf: Correct version flag formatting
Maciej W. Rozycki [Thu, 23 Feb 2017 18:18:51 +0000 (18:18 +0000)]
readelf: Correct version flag formatting

Remove a trailing space or a leading pipe character from version flags
printed with `readelf --version-info'.

For example with the `mips-linux' target we get:

$ cat ver_def.s
.data
.globl new_foo
.type new_foo, %object
new_foo:
.symver new_foo, foo@@ver_foo
$ cat ver_def.ver
{ global: *foo*; local: *; };
$ as -o ver_def.o ver_def.s
$ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o
$ readelf -V ver_def

Version symbols section '.gnu.version' contains 4 entries:
 Addr: 000000000000007e  Offset: 0x01007e  Link: 2 (.dynsym)
  000:   0 (*local*)       2 (ver_foo)       1 (*global*)      2 (ver_foo)

Version definition section '.gnu.version_d' contains 2 entries:
  Addr: 0x0000000000000088  Offset: 0x010088  Link: 3 (.dynstr)
  000000: Rev: 1  Flags: BASE   Index: 1  Cnt: 1  Name: ver_def
  0x001c: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: ver_foo
$

which includes an unnecessary space after `BASE'; both call sites
already provide suitable separation from output that follows.  Also if
only unknown flags were present, then lone `| <unknown>' would be
printed.

binutils/
* readelf.c (get_ver_flags): Tidy the formatting of the string
returned

7 years agoreadelf: Make version section index sum unsigned
Maciej W. Rozycki [Thu, 23 Feb 2017 18:16:55 +0000 (18:16 +0000)]
readelf: Make version section index sum unsigned

Make `isum' unsigned like data it is calculated from.

binutils/
* readelf.c (process_version_sections) <SHT_GNU_verdef>: Make
`isum' unsigned.
<SHT_GNU_verneed>: Likewise.

7 years agoreadelf: Fix incorrect "Version definition past end of section" message
Maciej W. Rozycki [Thu, 23 Feb 2017 18:16:11 +0000 (18:16 +0000)]
readelf: Fix incorrect "Version definition past end of section" message

Fix a commit 74e1a04b9787 ("More fixes for reading corrupt ELF files.")
`readelf --version-info' regression that caused "Version definition past
end of section" to be always printed at the end, even with good section
data.

For example with the `mips-linux' target we get:

$ cat ver_def.s
.data
.globl new_foo
.type new_foo, %object
new_foo:
.symver new_foo, foo@@ver_foo
$ cat ver_def.ver
{ global: *foo*; local: *; };
$ as -o ver_def.o ver_def.s
$ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o
$ readelf -V ver_def

Version symbols section '.gnu.version' contains 4 entries:
 Addr: 000000000000007e  Offset: 0x01007e  Link: 2 (.dynsym)
  000:   0 (*local*)       2 (ver_foo)       1 (*global*)      2 (ver_foo)

Version definition section '.gnu.version_d' contains 2 entries:
  Addr: 0x0000000000000088  Offset: 0x010088  Link: 3 (.dynstr)
  000000: Rev: 1  Flags: BASE   Index: 1  Cnt: 1  Name: ver_def
  0x001c: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: ver_foo
  Version definition past end of section
$

The cause is the `if (idx + ent.vd_next <= idx)' condition introduced to
ensure forward progress, which however always triggers for good version
definition section data as the last entry will have its `vd_next' value
set to 0.

Adjust the condition then, to say `if (idx + ent.vd_next < idx)' instead
and to ensure forward progress limit the number of entries processed to
the size of the version definition section, removing the problematic
message from output quoted above, while ensuring the original PR 17531
test case is still handled gracefully.

Add a suitable test case so that we have `readelf --version-info'
coverage; due to the lack of infrastructure needed to run the linker in
the `binutils' test suite and limited justification to implement it add
a new `readelf.exp' script to the `ld' test suite instead, intended to
gather any `readelf' test cases that require the linker to be run.  If
ever we decide to have linker infrastructure added to the `binutils'
test suite, then the script can be moved between the test suites.

binutils/
* readelf.c (process_version_sections) <SHT_GNU_verdef>: Limit
the number of entries processed by the section size.  Don't
break out of the loop if `ent.vd_next' is 0.

ld/
* testsuite/ld-elf/ver_def.d: New test.
* testsuite/ld-elf/ver_def.ld: New test linker script.
* testsuite/ld-elf/ver_def.ver: New test version script.
* testsuite/ld-elf/ver_def.s: New test source.
* testsuite/ld-elf/readelf.exp: New test script.

7 years agox86: also correctly support TEST opcode aliases
Jan Beulich [Fri, 24 Feb 2017 09:04:26 +0000 (10:04 +0100)]
x86: also correctly support TEST opcode aliases

Opcodes F6/1 and F7/1 are aliases of F6/0 and F7/0 in all modes. This
complements commit 8b89fe14b5 ("X86: Decode opcode 0x82 as opcode 0x80
in 32-bit mode"), just that here 64-bit mode is also covered.

7 years agogas: test cases for the architecture level aware SPARC ASI work.
Sheldon Lobo [Fri, 24 Feb 2017 08:23:50 +0000 (00:23 -0800)]
gas: test cases for the architecture level aware SPARC ASI work.

gas/ChangeLog:

Test cases for the architecture level aware SPARC ASI work.
* gas/testsuite/gas/sparc/sparc.exp: 2 new tests
* gas/testsuite/gas/sparc/asi-bump-warn.s: New test
* gas/testsuite/gas/sparc/asi-bump-warn.l: Likewise
* gas/testsuite/gas/sparc/asi-arch-error.s: Likewise
* gas/testsuite/gas/sparc/asi-arch-error.l: Likewise

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 24 Feb 2017 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoMIPS/BFD: Remove duplicate NewABI JALR relocation handling
Maciej W. Rozycki [Thu, 23 Feb 2017 22:27:50 +0000 (22:27 +0000)]
MIPS/BFD: Remove duplicate NewABI JALR relocation handling

Remove separate original NewABI JALR relocation handling, introduced
with commit d06471104a83 ("relax jalr $t9 [R_MIPS_JALR symbol] to bal
symbol"), <https://sourceware.org/ml/binutils/2003-03/msg00394.html>,
and only used by LD with the `--relax' option specified, and rely solely
on `mips_elf_perform_relocation' code, which has been introduced with
commit 1367d393bb74 ("On the RM9000 convert jal to bal if in range"),
<https://www.sourceware.org/ml/binutils/2004-12/msg00088.html> and since
made more complete, across all the three ABIs.

Also remove the `--relax' option, now irrelevant, from the tests added
with the former commit.

bfd/
* elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
* elfxx-mips.c (_bfd_mips_relax_section): Remove function.
* elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
* elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.

ld/
* testsuite/ld-mips-elf/relax-jalr-n32.d: Remove `--relax'
option.
* testsuite/ld-mips-elf/relax-jalr-n32-shared.d: Likewise.
* testsuite/ld-mips-elf/relax-jalr-n64.d: Likewise.
* testsuite/ld-mips-elf/relax-jalr-n64-shared.d: Likewise.

7 years agoMIPS/BFD: Discard ineligible JALR relocations right away
Maciej W. Rozycki [Thu, 23 Feb 2017 19:26:53 +0000 (19:26 +0000)]
MIPS/BFD: Discard ineligible JALR relocations right away

Discard R_MIPS_JALR and R_MICROMIPS_JALR relocations associated with
jumps that cannot be converted to an equivalent branch right away in
`mips_elf_calculate_relocation' rather than letting them through to
`mips_elf_perform_relocation'.  This includes cross-mode jumps which
need to flip the ISA bit or jumps to a misaligned location that cannot
be encoded with a branch, in addition to preemptible symbol references
already handled.

Cross-mode jumps are actually already rejected as the conversion is made
in `mips_elf_perform_relocation', so in this case this change only saves
some processing.  Jumps to a misaligned location are however converted,
with bits causing misalignment lost, making resulting code functionally
different even if the lone effect is avoiding an address error exception
with an instruction fetch at the jump destination requested.

Add test cases suitable, also including GAS verification to confirm that
the JALR relocations explicitly requested have indeed been output in the
intermediate objects used.

bfd/
* elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
<R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
or misaligned.

gas/
* testsuite/gas/mips/jalr4.d: New test.
* testsuite/gas/mips/jalr4-n32.d: New test.
* testsuite/gas/mips/jalr4-n64.d: New test.
* testsuite/gas/mips/jalr4.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

ld/
* testsuite/ld-mips-elf/jalr4.dd: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.

7 years agoDWARF-5: testcase
Jan Kratochvil [Thu, 23 Feb 2017 21:54:02 +0000 (22:54 +0100)]
DWARF-5: testcase

binutils/
2017-02-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* testsuite/binutils-all/dw5.S: New file.
* testsuite/binutils-all/dw5.W: New file.
* testsuite/binutils-all/readelf.exp (readelf -wiaoRlL): New test.

7 years agoDWARF-5: DW_FORM_data16
Jan Kratochvil [Thu, 23 Feb 2017 21:54:02 +0000 (22:54 +0100)]
DWARF-5: DW_FORM_data16

binutils/
2017-02-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c (read_and_display_attr_value): Support DW_FORM_data16.

7 years agoDWARF-5: Macros
Jan Kratochvil [Thu, 23 Feb 2017 21:54:01 +0000 (22:54 +0100)]
DWARF-5: Macros

binutils/
2017-02-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c (display_debug_macro): Support DWARF-5.  Rename
DW_MACRO_GNU_*.

7 years agoDWARF-5: call sites
Jan Kratochvil [Thu, 23 Feb 2017 21:54:01 +0000 (22:54 +0100)]
DWARF-5: call sites

binutils/
2017-02-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c (decode_location_expression): Support DW_OP_implicit_pointer,
DW_OP_const_type, DW_OP_regval_type, DW_OP_deref_type, DW_OP_convert
and DW_OP_reinterpret.
(read_and_display_attr_value): Support DW_AT_call_value,
DW_AT_call_data_value, DW_AT_call_target and
DW_AT_call_target_clobbered.

7 years agoDWARF-5 basic functionality
Jan Kratochvil [Thu, 23 Feb 2017 21:54:01 +0000 (22:54 +0100)]
DWARF-5 basic functionality

binutils/
2017-02-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c (fetch_indirect_line_string): New function.
(abbrev_attr): New field implicit_const.
(add_abbrev_attr): New parameter implicit_const.
(process_abbrev_section): Support DW_FORM_implicit_const.
(decode_location_expression): Support DW_OP_entry_value.
(read_and_display_attr_value): Add parameter implicit_const.  Support
DW_FORM_line_strp and DW_FORM_implicit_const.
(read_and_display_attr): Add parameter implicit_const.
(process_debug_info): Support line_str and DWARF-5.
(read_debug_line_header): Support DWARF-5.
(display_formatted_table): New function.
(display_debug_lines_raw): New parameter file.  Support DWARF-5.
(display_debug_lines_decoded): New parameter fileptr.  Support DWARF-5.
(display_debug_lines): Pass file parameter.
(display_debug_macro): Update read_and_display_attr_value caller.
(display_debug_abbrev): Support DW_FORM_implicit_const.
(display_loclists_list): New function.
(display_loc_list): Support .debug_loclists.
(display_debug_ranges_list): New function from display_debug_ranges.
(display_debug_rnglists_list): New function.
(display_debug_ranges): Support .debug_rnglists.
(debug_displays): Add .debug_line_str, .debug_loclists and
.debug_rnglists.
* dwarf.h: Include dwarf2.h
(DWARF2_Internal_LineInfo): Add li_offset_size.
(DWARF2_Internal_CompUnit): Add cu_unit_type.
(enum dwarf_section_display_enum): Add line_str.
* readelf.c (process_section_headers): Add rnglists and loclists.

7 years agoDWARF attrs: add delimiter
Jan Kratochvil [Thu, 23 Feb 2017 21:54:00 +0000 (22:54 +0100)]
DWARF attrs: add delimiter

binutils/
2017-02-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c (display_block): Add parameter delimiter.
(decode_location_expression): Update display_block callers.
(read_and_display_attr_value): Add parameter delimiter.
(read_and_display_attr, display_debug_macro): Update
read_and_display_attr_value caller.

7 years agoPR21166: Validate rdrand/rdseed support separately in gdb.reverse/insn-reverse-x86.c
Luis Machado [Thu, 23 Feb 2017 20:36:58 +0000 (14:36 -0600)]
PR21166: Validate rdrand/rdseed support separately in gdb.reverse/insn-reverse-x86.c

As reported in PR21166, there are Intel processors out there that support
rdrand but not rdseed. The fix is to verify both features separately and only
run rdrand/rdseed tests if supported.

gdb/testsuite/ChangeLog:
2017-02-23  Luis Machado  <lgustavo@codesourcery.com>

* gdb.reverse/insn-reverse.x86.c (check_rdrand_support): Renamed to ...
(check_supported_features): ... this. Changed return type to void.
(supports_rdseed): New static global.
(rdseed): Check supports_rdseed.
(initialize): Call check_supported_features.

7 years agodwarf.c: Use more dwarf_vma
Jan Kratochvil [Thu, 23 Feb 2017 20:37:31 +0000 (21:37 +0100)]
dwarf.c: Use more dwarf_vma

binutils/
2017-02-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c (display_loc_list): Use dwarf_vma for offset, base_address
and off.
(display_loc_list_dwo): Use dwarf_vma for offset.
(display_debug_loc): Use dwarf_vma for offset, base_address.
(struct range_entry, range_entry_compar): Use dwarf_vma for
ranges_offset.
(display_debug_ranges): Use dwarf_vma for ranges_offset, offset and
base_address.

7 years agoS/390: Add support for new cpu architecture - arch12.
Andreas Krebbel [Mon, 2 Jan 2017 15:40:29 +0000 (16:40 +0100)]
S/390: Add support for new cpu architecture - arch12.

This adds support of new instructions to the S/390 specific parts.

The important feature of the new instruction set is the support of
single and extended precision floating point vector operations.

Note: arch12 is NOT the official name of the new CPU.  It just
continues the series of archXX options supported as alternate names.
The archXX terminology refers to the edition number of the Principle
of Operations manual.  The official CPU name will be added later while
keeping support of the arch12 for backwards compatibility.

No testsuite regressions.

Committed to mainline.

Bye,

-Andreas-

opcodes/ChangeLog:

2017-02-23  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-mkopc.c (main): Accept arch12 as cpu string and vx2 as
facility.
* s390-opc.c: Add new operand description macros, new instruction
types, instruction masks, and new .insn instruction types.
* s390-opc.txt: Add new arch12 instructions.

include/ChangeLog:

2017-02-23  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* opcode/s390.h (enum s390_opcode_cpu_val): New value
S390_OPCODE_ARCH12.
(S390_INSTR_FLAG_VX2): New macro definition.

gas/ChangeLog:

2017-02-23  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* config/tc-s390.c (s390_parse_cpu): New entry for arch12.
* doc/as.texinfo: Document arch12 as cpu type.
* doc/c-s390.texi: Likewise.
* testsuite/gas/s390/s390.exp: Run arch12 specific tests.
* testsuite/gas/s390/zarch-arch12.d: New test.
* testsuite/gas/s390/zarch-arch12.s: New test.
* testsuite/gas/s390/zarch-z13.d: Rename some mnemonics in the
output patterns.

7 years agoUse gdb::function_view in iterate_over_symtabs & co
Pedro Alves [Wed, 22 Feb 2017 14:43:35 +0000 (14:43 +0000)]
Use gdb::function_view in iterate_over_symtabs & co

I wanted to pass a lambda to iterate_over_symtabs (see following
patch), so I converted it to function_view, and then the rest is
cascaded from that.

This gets rid of a bunch of single-use callback functions and
corresponding manually managed callback capture types
(add_partial_datum, search_symbols_data, etc.) in favor of letting the
compiler generate them for us by using lambdas with a capture.  In a
couple cases, it was more natural to convert the existing function
callbacks to function objects (i.e., operator(), e.g.,
decode_compound_collector).

gdb/ChangeLog:
2017-02-23  Pedro Alves  <palves@redhat.com>

* ada-lang.c: Include "common/function-view.h".
(ada_iterate_over_symbols): Adjust to use function_view as
callback type.
(struct add_partial_datum, ada_complete_symbol_matcher): Delete.
(ada_make_symbol_completion_list): Use a lambda.
(ada_exc_search_name_matches): Delete.
(name_matches_regex): New.
(ada_add_global_exceptions): Use a lambda and name_matches_regex.
* compile/compile-c-support.c: Include "common/function-view.h".
(print_one_macro): Change prototype to accept a ui_file pointer.
(write_macro_definitions): Use a lambda.
* dwarf2read.c: Include "common/function-view.h".
(dw2_map_expand_apply, dw2_map_symtabs_matching_filename)
(dw2_expand_symtabs_matching): Adjust to use function_view as
callback type.
* language.h: Include "common/function-view.h".
(struct language_defn) <la_iterate_over_symbols>: Adjust to use
function_view as callback type.
(LA_ITERATE_OVER_SYMBOLS): Remove DATA parameter.
* linespec.c: Include "common/function-view.h".
(collect_info::add_symbol): New method.
(struct symbol_and_data_callback, iterate_inline_only, struct
symbol_matcher_data, iterate_name_matcher): Delete.
(iterate_over_all_matching_symtabs): Adjust to use function_view
as callback type and lambdas.
(iterate_over_file_blocks): Adjust to use function_view as
callback type.
(decode_compound_collector): Now a class with private fields.
(decode_compound_collector::release_symbols): New method.
(collect_one_symbol): Rename to...
(decode_compound_collector::operator()): ... this and adjust.
(lookup_prefix_sym): decode_compound_collector construction bits
move to decode_compound_collector ctor.  Pass the
decode_compound_collector object directly as callback.  Remove
cleanups and use decode_compound_collector::release_symbols
instead.
(symtab_collector): Now a class with private fields.
(symtab_collector::release_symtabs): New method.
(add_symtabs_to_list): Rename to...
(symtab_collector::operator()): ... this and adjust.
(collect_symtabs_from_filename): symtab_collector construction
bits move to symtab_collector ctor.  Pass the symtab_collector
object directly as callback.  Remove cleanups and use
symtab_collector::release_symtabs instead.
(collect_symbols): Delete.
(add_matching_symbols_to_info): Use lambdas.
* macrocmd.c (print_macro_callback): Delete.
(info_macro_command): Use a lambda.
(info_macros_command): Pass print_macro_definition as callable
directly.
(print_one_macro): Remove 'ignore' parameter.
(macro_list_command): Adjust.
* macrotab.c (macro_for_each_data::fn): Now a function_view.
(macro_for_each_data::user_data): Delete field.
(foreach_macro): Adjust to call the function_view.
(macro_for_each): Adjust to use function_view as callback type.
(foreach_macro_in_scope): Adjust to call the function_view.
(macro_for_each_in_scope): Adjust to use function_view as callback
type.
* macrotab.h: Include "common/function-view.h".
(macro_callback_fn): Declare a prototype instead of a pointer.
Remove "user_data" parameter.
(macro_for_each, macro_for_each_in_scope): Adjust to use
function_view as callback type.
* psymtab.c (partial_map_expand_apply)
(psym_map_symtabs_matching_filename, recursively_search_psymtabs):
Adjust to use function_view as callback type and to return bool.
(psym_expand_symtabs_matching): Adjust to use function_view as
callback types.
* symfile-debug.c (debug_qf_map_symtabs_matching_filename): Adjust
to use function_view as callback type and to return bool.
(debug_qf_expand_symtabs_matching): Adjust to use function_view as
callback types.
* symfile.c (expand_symtabs_matching): Adjust to use function_view
as callback types.
* symfile.h: Include "common/function-view.h".
(expand_symtabs_file_matcher_ftype)
(expand_symtabs_symbol_matcher_ftype)
(expand_symtabs_exp_notify_ftype): Remove "data" parameter and
return bool.
(quick_symbol_functions::map_symtabs_matching_filename)
(quick_symbol_functions::expand_symtabs_matching): Adjust to use
function_view as callback type and return bool.
(expand_symtabs_matching): Adjust to use function_view as callback
type.
(maintenance_expand_name_matcher)
(maintenance_expand_file_matcher): Delete.
(maintenance_expand_symtabs): Use lambdas.
* symtab.c (iterate_over_some_symtabs): Adjust to use
function_view as callback types and return bool.
(iterate_over_symtabs): Likewise.  Use unique_xmalloc_ptr instead
of a cleanup.
(lookup_symtab_callback): Delete.
(lookup_symtab): Use a lambda.
(iterate_over_symbols): Adjust to use function_view as callback
type.
(struct search_symbols_data, search_symbols_file_matches)
(search_symbols_name_matches): Delete.
(search_symbols): Use a pair of lambdas.
(struct add_name_data, add_macro_name, symbol_completion_matcher)
(symtab_expansion_callback): Delete.
(default_make_symbol_completion_list_break_on_1): Use lambdas.
* symtab.h: Include "common/function-view.h".
(iterate_over_some_symtabs): Adjust to use function_view as
callback type and return bool.
(iterate_over_symtabs): Adjust to use function_view as callback
type.
(symbol_found_callback_ftype): Remove 'data' parameter and return
bool.
(iterate_over_symbols): Adjust to use function_view as callback
type.

7 years agoIntroduce gdb::function_view
Pedro Alves [Thu, 23 Feb 2017 16:14:08 +0000 (16:14 +0000)]
Introduce gdb::function_view

This commit adds a new function_view type.  This type holds a
non-owning reference to a callable.  It is meant to be used as
callback type of functions, instead of using the C-style pair of
function pointer and 'void *data' arguments.  function_view allows
passing references to stateful function objects / lambdas with
captures as callbacks efficiently, while function pointer + 'void *'
does not.

See the intro in the new function-view.h header for more.

Unit tests included, put into a new gdb/unittests/ subdir.

gdb/ChangeLog:
2017-02-23  Pedro Alves  <palves@redhat.com>

* Makefile.in (SUBDIR_UNITTESTS_SRCS, SUBDIR_UNITTESTS_OBS): New.
(%.o) <unittests/%.c>: New pattern.
* configure.ac ($development): Add $(SUBDIR_UNITTESTS_OBS) to
CONFIG_OBS, and $(SUBDIR_UNITTESTS_SRCS) to CONFIG_SRCS.
* common/function-view.h: New file.
* unittests/function-view-selftests.c: New file.
* configure: Regenerate.

7 years agoopcodes,gas: associate SPARC ASIs with an architecture level.
Sheldon Lobo [Thu, 23 Feb 2017 15:49:37 +0000 (07:49 -0800)]
opcodes,gas: associate SPARC ASIs with an architecture level.

With this change an architecture level bump due to assembly ASIs will show
up as a warning/error depending on options passed to gas.

Tested with sparc64-linux-gnu, and it does not introduce any regressions.

gas/ChangeLog:

Add support for associating SPARC ASIs with an architecture level.
* config/tc-sparc.c (parse_sparc_asi): New encode SPARC ASIs.

opcodes/ChangeLog:

Add support for associating SPARC ASIs with an architecture level.
* include/opcode/sparc.h (sparc_asi): New sparc_asi struct.
* opcodes/sparc-opc.c (asi_table): Updated asi_table and encoding/
decoding of SPARC ASIs.

7 years agoFix usage of inferior_ptid in two thread_alive implementations
Simon Marchi [Thu, 23 Feb 2017 15:36:20 +0000 (10:36 -0500)]
Fix usage of inferior_ptid in two thread_alive implementations

While inspecting some target code, I noticed that in these two
implementations of thread_alive, inferior_ptid is referenced directly
instead of using the ptid passed as parameters.  I guess that it is
wrong, although I can't really test it in both cases.

gdb/ChangeLog:

* bsd-uthread.c (bsd_uthread_thread_alive): Use ptid instead of
inferior_ptid.
* go32-nat.c (go32_thread_alive): Likewise.

7 years agoAdd support to readelf for displaying gnu attributes in architectures not known to...
Nick Clifton [Thu, 23 Feb 2017 13:45:21 +0000 (13:45 +0000)]
Add support to readelf for displaying gnu attributes in architectures not known to support them.

* readelf.c (display_tag_value): Use an explicit signed type for
the tag parameter.
(display_gnu_attributes): Use an unsigned integer type for
attribute tags.
(display_power_gnu_attribute): Likewise.
(display_s390_gnu_attribute): Likewise.
(display_sparc_hwcaps): Likewise.
(display_sparc_hwcaps2): Likewise.
(display_sparc_gnu_attribute): Likewise.
(display_mips_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(display_raw_attribute): Likewise.
(process_attributes): Likewise.
(process_arm_specific): Delete redundant function.
(process_power_specific): Likewise.
(process_s390_specific): Likewise.
(process_sparc_specific): Likewise.
(process_tic6x_specific): Likewise.
(process_msp430x_specific): Likewise.
(display_public_gnu_attributes): New function.  Displays known
information about an unknown gnu attribute.
(display_generic_attribute): New function.  Calls
display_tag_value for non-nul tags.
(process_arch_specific): Call process_attributes even for
architectures not known to specifically support gnu attributes.

7 years agoUse xfree rather than delete for varobj_iter
Yao Qi [Thu, 23 Feb 2017 11:57:46 +0000 (11:57 +0000)]
Use xfree rather than delete for varobj_iter

ASAN reports an error,

-var-create container @ c^M
=================================================================^M
^[[1m^[[31m==21639==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x6030000805c0^M
^[[1m^[[0m    #0 0x7f2449b01b2a in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99b2a)^M
    #1 0xbb601d in update_dynamic_varobj_children ../../binutils-gdb/gdb/varobj.c:794^M
    #2 0xbb6556 in varobj_get_num_children(varobj*) ../../binutils-gdb/gdb/varobj.c:854^M
    #3 0x580cb4 in print_varobj ../../binutils-gdb/gdb/mi/mi-cmd-var.c:61^M
    #4 0x58138b in mi_cmd_var_create(char*, char**, int) ../../binutils-gdb/gdb/mi/mi-cmd-var.c:145^M
    #5 0x5967ce in mi_cmd_execute ../../binutils-gdb/gdb/mi/mi-main.c:2301^M
    #6 0x594b05 in captured_mi_execute_command ../../binutils-gdb/gdb/mi/mi-main.c:2001
....
^M
^[[1m^[[32m0x6030000805c0 is located 0 bytes inside of 32-byte region [0x6030000805c0,0x6030000805e0)^M
^[[1m^[[0m^[[1m^[[35mallocated by thread T0 here:^[[1m^[[0m^M
    #0 0x7f2449b00602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)^M
    #1 0x7d1596 in xmalloc ../../binutils-gdb/gdb/common/common-utils.c:43^M
    #2 0x604176 in py_varobj_iter_new ../../binutils-gdb/gdb/python/py-varobj.c:159^M
    #3 0x6042da in py_varobj_get_iterator(varobj*, _object*) ../../binutils-gdb/gdb/python/py-varobj.c:198^M
    #4 0xbb5806 in varobj_get_iterator ../../binutils-gdb/gdb/varobj.c:720^M
    #5 0xbb5b9b in update_dynamic_varobj_children ../../binutils-gdb/gdb/varobj.c:758^M

gdb:

2017-02-23  Yao Qi  <yao.qi@linaro.org>

* varobj-iter.h (varobj_iter_delete): Call xfree instead of
delete.

7 years agoUse delete instead of xfree for varobj_item
Yao Qi [Thu, 23 Feb 2017 11:05:03 +0000 (11:05 +0000)]
Use delete instead of xfree for varobj_item

In commit 2f408ec (Use ui_file_as_string throughout more), we start to
new varobj_item,

> -  vitem = XNEW (struct varobj_item);
> +  vitem = new varobj_item ();

but we still use xfree.  This causes some ASAN errors,

-var-update container^M
=================================================================^M
^[[1m^[[31m==20660==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x602000090c10^M
^[[1m^[[0m    #0 0x2baa77d03631 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54631)^M
    #1 0x80e0c8 in xfree(void*) /home/yao/SourceCode/gnu/gdb/git/gdb/common/common-utils.c:100^M
    #2 0xc13670 in varobj_clear_saved_item /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:727^M
    #3 0xc13957 in update_dynamic_varobj_children /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:752^M
    #4 0xc1841c in varobj_update(varobj**, int) /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:1699^M
    #5 0x5a2bf7 in varobj_update_one /home/yao/SourceCode/gnu/gdb/git/gdb/mi/mi-cmd-var.c:712^M
    #6 0x5a2a41 in mi_cmd_var_update(char*, char**, int) /home/yao/SourceCode/gnu/gdb/git/gdb/mi/mi-cmd-var.c:695^
........
^M
^[[1m^[[32m0x602000090c10 is located 0 bytes inside of 16-byte region [0x602000090c10,0x602000090c20)^M
^[[1m^[[0m^[[1m^[[35mallocated by thread T0 here:^[[1m^[[0m^M
    #0 0x2baa77d0415f in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5515f)^M
    #1 0x63613e in py_varobj_iter_next /home/yao/SourceCode/gnu/gdb/git/gdb/python/py-varobj.c:112^M
    #2 0xc13b89 in update_dynamic_varobj_children /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:776^M
    #3 0xc1841c in varobj_update(varobj**, int) /home/yao/SourceCode/gnu/gdb/git/gdb/varobj.c:1699^M
    #4 0x5a2bf7 in varobj_update_one /home/yao/SourceCode/gnu/gdb/git/gdb/mi/mi-cmd-var.c:712^M
    #5 0x5a2a41 in mi_cmd_var_update(char*, char**, int) /home/yao/SourceCode/gnu/gdb/git/gdb/mi/mi-cmd-var.c:695^M

gdb:

2017-02-23  Yao Qi  <yao.qi@linaro.org>

* varobj.c (varobj_clear_saved_item): Use delete instead of
xfree.
(update_dynamic_varobj_children): Likewise.

7 years agogas: slightly relax .startof.()/.sizeof.() testcase
Jan Beulich [Thu, 23 Feb 2017 10:21:10 +0000 (11:21 +0100)]
gas: slightly relax .startof.()/.sizeof.() testcase

7 years agox86: drop stray VEX opcode 82 references
Jan Beulich [Thu, 23 Feb 2017 10:03:55 +0000 (11:03 +0100)]
x86: drop stray VEX opcode 82 references

No such ModR/M-less opcode has ever existed in public documentation
afaict, so I can't see why it had been added in the first place.
Furthermore opcode 77 is special only with implied prefix 0F.

7 years agox86: extend 64-bit invalid MPX insn forms testcase
Jan Beulich [Thu, 23 Feb 2017 10:00:44 +0000 (11:00 +0100)]
x86: extend 64-bit invalid MPX insn forms testcase

7 years agoCorrect VLE 16D and SDAREL relocations
Alan Modra [Thu, 23 Feb 2017 01:50:42 +0000 (12:20 +1030)]
Correct VLE 16D and SDAREL relocations

PR 20744
bfd/
* elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
16D relocations.
(ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
(ppc_elf_relocate_section): Correct calculation for VLE SDAREL
relocs.
ld/
* testsuite/ld-powerpc/vle-reloc-2.s: Use r6 for last insn of
each group.
* testsuite/ld-powerpc/vle-reloc-2.d: Update for above change
and sdarel reloc fix.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 23 Feb 2017 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoDisplay user op byte
Jan Kratochvil [Wed, 22 Feb 2017 19:22:59 +0000 (20:22 +0100)]
Display user op byte

binutils/
2017-02-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c (decode_location_expression): Display also OP.

7 years agoreadelf: Restore a lost new line in version information
Maciej W. Rozycki [Wed, 22 Feb 2017 18:09:41 +0000 (18:09 +0000)]
readelf: Restore a lost new line in version information

Fix a commit 74e1a04b9787 ("More fixes for reading corrupt ELF files.")
`readelf --version-info' output formatting regression where a dropped
new line caused section header information from the `.gnu.version_d'
version definition section to be printed on the same line as this
section's first entry.

For example with the `mips-linux' target we get:

$ cat ver_def.s
.data
.globl new_foo
.type new_foo, %object
new_foo:
.symver new_foo, foo@@ver_foo
$ cat ver_def.ver
{ global: *foo*; local: *; };
$ as -o ver_def.o ver_def.s
$ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o
$ readelf -V ver_def

Version symbols section '.gnu.version' contains 4 entries:
 Addr: 000000000000007e  Offset: 0x01007e  Link: 2 (.dynsym)
  000:   0 (*local*)       2 (ver_foo)       1 (*global*)      2 (ver_foo)

Version definition section '.gnu.version_d' contains 2 entries:
  Addr: 0x0000000000000088  Offset: 0x010088  Link: 3 (.dynstr)  000000: Rev: 1  Flags: BASE   Index: 1  Cnt: 1  Name: ver_def
  0x001c: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: ver_foo
  Version definition past end of section
$

Add the new line then, to get:

$ readelf -V ver_def

Version symbols section '.gnu.version' contains 4 entries:
 Addr: 000000000000007e  Offset: 0x01007e  Link: 2 (.dynsym)
  000:   0 (*local*)       2 (ver_foo)       1 (*global*)      2 (ver_foo)

Version definition section '.gnu.version_d' contains 2 entries:
  Addr: 0x0000000000000088  Offset: 0x010088  Link: 3 (.dynstr)
  000000: Rev: 1  Flags: BASE   Index: 1  Cnt: 1  Name: ver_def
  0x001c: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: ver_foo
  Version definition past end of section
$

instead.

binutils/
* readelf.c (process_version_sections) <SHT_GNU_verdef>: Print a
new line between the heading and the first version definition
entry.

7 years agoPR ld/20828: Move symbol version processing ahead of GC symbol sweep
Maciej W. Rozycki [Tue, 21 Feb 2017 01:46:42 +0000 (01:46 +0000)]
PR ld/20828: Move symbol version processing ahead of GC symbol sweep

Complement commit b531344c34b0 ("PR ld/20828: Reorder the symbol sweep
stage of section GC") and commit 81ff47b3a546 ("PR ld/20828: Fix linker
script symbols wrongly forced local with section GC") and move symbol
version processing ahead of the symbol sweep stage of section GC, all in
`bfd_elf_size_dynamic_sections', so that version symbols created stay in
the global scope and are not output as local symbols to the dynamic
symbol table in the presence of corresponding symbol definitions pulled
from a DSO involved in a link.

Consolidate the whole of symbol version processing into a single block
from all parts scattered across the function and rearranging the local
variables used as necessary, however leaving the setting of dynamic
entries associated with the DT_VERDEF, DT_VERDEFNUM, DT_VERNEED and
DT_VERNEEDNUM tags and the SEC_EXCLUDE flag for unused `.gnu.version'
section in the original places.

With the rearrangement of code blocks `Elf_Internal_Verneed *t' would
shadow the previous definition of `struct bfd_elf_version_tree *t', so
rename the former variable to `vn'.

bfd/
PR ld/20828
* elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
processing ahead of the call to `elf_gc_sweep_symbol'.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828-d.sd: New test.
* testsuite/ld-elf/pr20828-e.sd: New test.
* testsuite/ld-elf/pr20828-v.od: New test.
* testsuite/ld-elf/pr20828-v.ver: New test version script.
* testsuite/ld-elf/pr20828-v.ld: New test linker script.
* testsuite/ld-elf/pr20828.ld: Add `.gnu.version' and
`.gnu.version_d'.
* testsuite/ld-elf/shared.exp: Run the new tests.

7 years agoGAS: Consistently fix labels at the `.end' pseudo-op
Maciej W. Rozycki [Fri, 17 Feb 2017 20:30:55 +0000 (20:30 +0000)]
GAS: Consistently fix labels at the `.end' pseudo-op

Fix a functional regression with the `.end' pseudo-op, introduced with
commit ecb4347adecd ("Last take: approval for MIPS_STABS_ELF killing"),
<https://sourceware.org/ml/binutils/2002-06/msg00443.html>, and commit
dcd410fe1544 ("GNU as 2.14 on IRIX 6: crashes with shared libs"),
<https://sourceware.org/ml/binutils/2003-07/msg00415.html>, which caused
symbol values for labels placed between the end of a function's contents
and its terminating `.end' followed by one of the alignment pseudo-ops
to be different depending on whether either `-mdebug', or `-mno-pdr', or
neither of the command-line options is in effect, be it implied or
specified.

Given debug-label-end.s as follows and the `mips-linux' target we have:

$ cat debug-label-end.s
.text

.globl foo
.globl bar
.align 4, 0
.ent foo
foo:
nop
.aent bar
bar:
.insn
.end foo
.align 4, 0
.space 16

.globl baz
.ent baz
baz:
nop
.end baz
.align 4, 0
.space 16
$ as -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
     9: 00000004     0 FUNC    GLOBAL DEFAULT    1 bar
$ as -mdebug -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
     9: 00000010     0 FUNC    GLOBAL DEFAULT    1 bar
$ as -mno-pdr -o debug-label-end.o debug-label-end.s
$ readelf -s debug-label-end.o | grep bar
     8: 00000010     0 FUNC    GLOBAL DEFAULT    1 bar
$

The reason is the call to `md_flush_pending_output', which in the case
of `mips*-*-*' targets expands to `mips_emit_delays', which in turn
calls `mips_no_prev_insn', which calls `mips_clear_insn_labels', which
clears the list of outstanding labels.  That list is in turn consulted
in `mips_align', called in the interpretation of alignment directives,
and the labels adjusted to the current location.

A call to `md_flush_pending_output' is only made from `s_mips_end' and
then only if `-mpdr' is in effect, which is the default for `*-*-linux*'
and some other `mips*-*-*' targets.  A call to `md_flush_pending_output'
is never made from `ecoff_directive_end', which is used in place of
`s_mips_end' when `-mdebug' is in effect.  Consequently if `-mno-pdr' or
`-mdebug' is in effect the list of outstanding labels makes it through
to any alignment directive that follows and the labels are differently
interpreted depending on the command-lines options used.  And we want
code produced to be always the same.

Call `md_flush_pending_output' unconditionally then in `s_mips_end' and
add such a call from `ecoff_directive_end' as well, as long as the macro
is defined.  While `ecoff_directive_end' is shared among targets, the
only one other than `mips*-*-*' actually using it is `alpha*-*-*' and it
does not define `md_flush_pending_output'.  So the semantics isn't going
to change for it and neither it has to have its `s_alpha_end' updated
or have code in `ecoff_directive_end' conditionalized.

gas/
* ecoff.c (ecoff_directive_end) [md_flush_pending_output]: Call
`md_flush_pending_output'.
* config/tc-mips.c (s_mips_end) [md_flush_pending_output]: Call
`md_flush_pending_output' unconditionally.
* testsuite/gas/mips/debug-label-end-1.d: New test.
* testsuite/gas/mips/debug-label-end-2.d: New test.
* testsuite/gas/mips/debug-label-end-3.d: New test.
* testsuite/gas/mips/debug-label-end.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

7 years agoAlign .gnu_debuglink sections on a 4-byte boundary.
Nick Clifton [Wed, 22 Feb 2017 17:28:33 +0000 (17:28 +0000)]
Align .gnu_debuglink sections on a 4-byte boundary.

PR binutils/21193
* opncls.c (bfd_create_gnu_debuglink_section): Give the newly
created section 4-byte alignment.

7 years agoFix gas/all/err-sizeof.s for cris*-*-*
Hans-Peter Nilsson [Wed, 22 Feb 2017 13:17:33 +0000 (14:17 +0100)]
Fix gas/all/err-sizeof.s for cris*-*-*

7 years agoSkip ARM vcmp-noprefix-imm test on non-ELF targets
Nick Clifton [Wed, 22 Feb 2017 11:57:49 +0000 (11:57 +0000)]
Skip ARM vcmp-noprefix-imm test on non-ELF targets

7 years agogas: require an operand to .startof.()/.sizeof.()
Jan Beulich [Wed, 22 Feb 2017 09:37:52 +0000 (10:37 +0100)]
gas: require an operand to .startof.()/.sizeof.()

7 years agoaarch64: actually copy first operand in convert_bfc_to_bfm()
Jan Beulich [Wed, 22 Feb 2017 09:36:05 +0000 (10:36 +0100)]
aarch64: actually copy first operand in convert_bfc_to_bfm()

Commit 93562a343c ("[AArch64] PR target/20666, fix wrong encoding of
new introduced BFC pseudo") changed the destination operand to 0,
making the whole function invocation a no-op. We really want to copy
operand 0 (a register) to operand 1 (an immediate before coming here),
even if right now this likely is only a latent bug.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 22 Feb 2017 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix a regression by: Code cleanup: Split dwarf2_ranges_read to a callback
Jan Kratochvil [Tue, 21 Feb 2017 23:13:03 +0000 (00:13 +0100)]
Fix a regression by: Code cleanup: Split dwarf2_ranges_read to a callback

On some Fedora 23 systems an internal error has been printed.

gdb/ChangeLog
2017-02-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf2read.c (dwarf2_record_block_ranges): Add forgotten BASEADDR.

7 years agoPowerPC ld segfault on script discarding dynamic sections
Alan Modra [Tue, 21 Feb 2017 21:40:58 +0000 (08:10 +1030)]
PowerPC ld segfault on script discarding dynamic sections

bfd/
* elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
on .got or .plt output section being discarded by script.
* elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
vxworks splt temp.
gold/
* powerpc.cc (Target_powerpc::make_iplt_section): Check that
output_section exists before attempting add_output_section_data.
(Target_powerpc::make_brlt_section): Likewise.

7 years agoDefault initialize enum flags to 0
Simon Marchi [Tue, 21 Feb 2017 16:48:49 +0000 (11:48 -0500)]
Default initialize enum flags to 0

... so that we don't need to do it manually, and potentially forget.
For example, this allows to do:

  my_flags flags;

  ...

  flags |= some_flag;

gdb/ChangeLog:

* common/enum-flags.h (enum_flags::enum_flags): Initialize
m_enum_value to 0 in default constructor.

7 years ago[ppc64] Add POWER8/ISA 2.07 atomic sequences single-stepping support
Edjunior Barbosa Machado [Tue, 21 Feb 2017 14:14:56 +0000 (11:14 -0300)]
[ppc64] Add POWER8/ISA 2.07 atomic sequences single-stepping support

gdb/
2017-02-21  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* rs6000-tdep.c (LOAD_AND_RESERVE_MASK): Rename from LWARX_MASK.
(STORE_CONDITIONAL_MASK): Rename from STWCX_MASK.
(LBARX_INSTRUCTION, LHARX_INSTRUCTION, LQARX_INSTRUCTION,
STBCX_INSTRUCTION, STHCX_INSTRUCTION, STQCX_INSTRUCTION): New defines.
(IS_LOAD_AND_RESERVE_INSN, IS_STORE_CONDITIONAL_INSN): New macros.
(ppc_displaced_step_copy_insn): Use IS_LOAD_AND_RESERVE_INSN.
(ppc_deal_with_atomic_sequence): Use IS_LOAD_AND_RESERVE_INSN and
IS_STORE_CONDITIONAL_INSN.

gdb/testsuite/
2017-02-21  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* gdb.arch/ppc64-isa207-atomic-inst.exp: New testcase based on
gdb.arch/ppc64-atomic-inst.exp.  Add tests for lbarx/stbcx, lharx/sthcx
and lqarx/stqcx.
* gdb.arch/ppc64-isa207-atomic-inst.S: New file.
* gdb.arch/ppc64-isa207-atomic-inst.c: Likewise.

7 years agoFix test names starting with uppercase in gdb.arch/ppc64-atomic-inst.exp
Edjunior Barbosa Machado [Tue, 21 Feb 2017 13:59:29 +0000 (10:59 -0300)]
Fix test names starting with uppercase in gdb.arch/ppc64-atomic-inst.exp

gdb/testsuite/
2017-02-21  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* gdb.arch/ppc64-atomic-inst.exp: Fix test names starting with
uppercase.

7 years agoFix compile time warning message in linker testsuite test.
Nick Clifton [Tue, 21 Feb 2017 11:00:21 +0000 (11:00 +0000)]
Fix compile time warning message in linker testsuite test.

* testsuite/ld-ifunc/pr18808b.c (bar): Fix compile time warning
about non-void function returning without a result.

7 years agoFix recent compiler warnings.
Jan Kratochvil [Tue, 21 Feb 2017 08:14:37 +0000 (09:14 +0100)]
Fix recent compiler warnings.

gcc-4.8.5-11.el7.x86_64

dwarf2read.c: In function ‘pc_bounds_kind dwarf2_get_pc_bounds(die_info*, CORE_ADDR*, CORE_ADDR*, dwarf2_cu*, partial_symtab*)’:
dwarf2read.c:12134:7: error: ‘range_end’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
dwarf2read.c:12133:7: error: ‘range_beginning’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

gdb/ChangeLog
2017-02-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf2_rnglists_process: Initialize range_beginning and range_end.