deliverable/binutils-gdb.git
7 years agoFixup changelog entries for previous commit
Ramana Radhakrishnan [Wed, 5 Jul 2017 09:21:07 +0000 (10:21 +0100)] 
Fixup changelog entries for previous commit

40c7d50720e04c3d1ef1695a8097f735bafbe54f

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Jul 2017 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoGarbage collect TYPE_STATIC and several TYPE_FN_FIELD_x
Pedro Alves [Tue, 4 Jul 2017 17:40:26 +0000 (18:40 +0100)] 
Garbage collect TYPE_STATIC and several TYPE_FN_FIELD_x

Nothing uses these.  Most of the TYPE_FN_FIELD_ ones were probably
used by the gcj support.

gdb/ChangeLog:
2017-07-04  Pedro Alves  <palves@redhat.com>

* gdbtypes.c (recursive_dump_type): Don't reference TYPE_STATIC.
* gdbtypes.h (TYPE_STATIC): Delete.
(struct fn_field) <is_public, is_abstract, is_static, is_final,
is_synchronized, is_native>: Delete.
<dummy>: Bump.
(TYPE_FN_FIELD_PUBLIC, TYPE_FN_FIELD_STATIC, TYPE_FN_FIELD_FINAL)
(TYPE_FN_FIELD_SYNCHRONIZED, TYPE_FN_FIELD_NATIVE)
(TYPE_FN_FIELD_ABSTRACT): Delete.

7 years ago[Patch ARM] Support MVFR2 VFP Coprocessor register for ARMv8-A
Ramana Radhakrishnan [Tue, 4 Jul 2017 15:18:47 +0000 (16:18 +0100)] 
[Patch ARM] Support MVFR2 VFP Coprocessor register for ARMv8-A

This patch adds support mvfr2 control registers for armv8-a as
this was missed from the original port to armv8-a (documented
at G6.2.109 in (Issue B.a) of the ARM-ARM. This was discovered
by an internal user of the GNU toolchain.

I'd like to backport this to the binutils 2.28 and binutils 2.29
release branch if possible (with suitable testing and basically
checking removing the armv8-r parts).

Tristan - are you ok with the backports ?

Applied to trunk.

regards Ramana

2017-07-04  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

        * gas/config/tc-arm.c (arm_regs): Add MVFR2.
        (do_vmrs): Constraint for MVFR2 and armv8.
        (do_vmsr): Likewise.
        * gas/testsuite/gas/arm/armv8-a+fp.d: Update.
        * gas/testsuite/gas/arm/armv8-ar+fp.s: Likewise.
        * gas/testsuite/gas/arm/armv8-r+fp.d: Likewise.
        * gas/testsuite/gas/arm/vfp-bad.s: Likewise.
        * gas/testsuite/gas/arm/vfp-bad.l: Likewise.
        * opcodes/arm-dis.c: Support MVFR2 in disassembly
        with vmrs and vmsr.

7 years agoRegenerate configure.
Tristan Gingold [Tue, 4 Jul 2017 09:15:33 +0000 (11:15 +0200)] 
Regenerate configure.

bfd/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

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

binutils/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gas/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gprof/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

ld/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

opcodes/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

7 years agoAdd markers.
Tristan Gingold [Tue, 4 Jul 2017 09:06:02 +0000 (11:06 +0200)] 
Add markers.

binutils/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.29.

gas/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.29.

ld/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.29.

7 years ago[AArch64] Remove useless and incorrect assertion
Jiong Wang [Mon, 3 Jul 2017 16:15:26 +0000 (17:15 +0100)] 
[AArch64] Remove useless and incorrect assertion

The outer caller elf_link_output_extsym in elflink.c is a traverse function on
all external symbol, and it will only call *finish_dynamic_symbol if some
conditions is meet.  It is executed conditionally.

If the condition to trigger that assertion is satisified, it then won't satify
the outer check in finish_dynamic_symbol, so *finish_dynamic_symbol won't be
called that the assertion is expected to be dead code.

If elf_link_output_extsym is a traverse function that unconditionally called
on external symbols decided to be exported, then an assertion to make sure these
symbols are in sane status might make sense.

bfd/
        * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Remove the
        sanity check at the head of this function.

7 years ago[binutils patch] DWARF-5: Extend bfd/dwarf2.c parse_comp_unit()
Jan Kratochvil [Tue, 4 Jul 2017 08:09:27 +0000 (10:09 +0200)] 
[binutils patch] DWARF-5: Extend bfd/dwarf2.c parse_comp_unit()

bfd/
2017-07-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf2.c (struct dwarf2_debug): Add fields dwarf_line_str_buffer and
dwarf_line_str_size.
(struct attr_abbrev): Add field implicit_const.
(dwarf_debug_sections): Add .debug_line_str.
(enum dwarf_debug_section_enum): Add debug_line_str and debug_max.
(dwarf_debug_section_assert): Add static assertion.
(read_indirect_line_string): New.
(read_abbrevs): Support DW_FORM_implicit_const.
(is_str_attr): Support DW_FORM_line_strp.
(read_attribute_value): Support DW_FORM_line_strp and
DW_FORM_implicit_const.
(read_attribute): Support DW_FORM_implicit_const.
(line_info_add_include_dir, line_info_add_include_dir_stub):
(line_info_add_file_name, read_formatted_entries): New.
(decode_line_info, parse_comp_unit): Support DWARF 5.
(_bfd_dwarf2_cleanup_debug_info): Free dwarf_line_str_buffer.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Jul 2017 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agobfd: partial revert commit EC1ACAB (prevent all but undef weak symbols to become...
Egeyar Bagcioglu [Mon, 3 Jul 2017 18:06:35 +0000 (20:06 +0200)] 
bfd: partial revert commit EC1ACAB (prevent all but undef weak symbols to become dynamic in sparc).

bfd/ChangeLog:

2017-07-03  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

        * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Remove the
        abort statement that was put for symbols that are not dynamic.

7 years agoRegenerate pot files.
Tristan Gingold [Mon, 3 Jul 2017 15:02:01 +0000 (17:02 +0200)] 
Regenerate pot files.

7 years agostrings: remove section/file size check
Alan Modra [Mon, 3 Jul 2017 12:30:32 +0000 (22:00 +0930)] 
strings: remove section/file size check

This reverts most of 06803313754, 2005-07-05 Dmitry V. Levin change
adding a check that section size doesn't exceed file size.  As we've
seen recently with mmo tests, decoded section size can easily exceed
file size with formats that encode section data.

I've also changed "strings" to use bfd_malloc_and_get_section, so that
"strings" won't die on a malloc failure.  I think it's better to
continue on looking at other sections after failing to dump a section
with fuzzed size.

The testcases at https://bugzilla.altlinux.org/show_bug.cgi?id=5871
on a 32-bit host now produce
$ strings -d --target=a.out-i386 /tmp/bfdkiller.dat
strings: error: /tmp/bfdkiller.dat(.text) is too large (0xffffffff bytes)
strings: /tmp/bfdkiller.dat: Reading section .text failed: Memory exhausted
strings: /tmp/bfdkiller.dat: Reading section .data failed: File truncated
org.ec
$ strings -d --target=a.out-i386 /tmp/eclipse-state
strings: /tmp/eclipse-state: Reading section .text failed: File truncated
org.eclipse.osgi
System Bundle
[snip]

* strings.c (filename_and_size_t): Delete.
(strings_a_section): Don't check section size against file size.
Use bdf_malloc_and_get_section.  Report an error on failures.
Replace arg param with filename and got_a_section param.
(got_a_section): Move to..
(strings_object_file): ..an auto var here.  Iterate over sections
rather than calling bfd_map_over_sections.  Adjust strings_a_section
call.

7 years agoSupport %Lx, %Lu, %Ld in _bfd_error_handler format
Alan Modra [Mon, 3 Jul 2017 12:29:45 +0000 (21:59 +0930)] 
Support %Lx, %Lu, %Ld in _bfd_error_handler format

One way to print 64-bit bfd_vma or bfd_size_type values on 32-bit
hosts is to cast the value to long long and use the 'll' modifier in
printf format strings.  However, that's awkward because we also
support the Microsoft C library printf that uses 'I64' as a modifier
instead, and having variants of translated strings would not endear us
to the translation project.  So, rewrite the 'll' modifier in
_doprint for Microsoft.  Even with that capability it's not so nice
for 32-bit code to need casts to long long, so this patch makes 'L' a
modifier for bfd_vma rather than an alias for 'll'.

I've then used the new 'L' modifier to fix selected format strings.

* bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for
__MSVCRT__.  Support "L" modifier for bfd_vma.  Formatting.
* elf.c (setup_group): Use "Lx" to print sh_size.
(_bfd_elf_setup_sections): Remove unnecessary cast and print
unknown section type in hex.
(copy_special_section_fields): Style fix.
(bfd_section_from_shdr): Correct format for sh_link.  Use a
common error message for all the variants of unrecognized
section types.
(assign_file_positions_for_load_sections): Use "Lx" for lma
adjust error message.
(assign_file_positions_for_non_load_sections): Formatting.
(rewrite_elf_program_header): Formatting.  Use "Lx" for
bfd_vma values in error messages.
* elfcode.h (elf_slurp_reloc_table_from_section): Cast
ELF_R_SYM value to type expected by format.
* elflink.c (elf_link_read_relocs_from_section): Use "Lx"
in error messages.
(elf_link_add_object_symbols): Use "Lu" for symbol sizes.
(elf_link_input_bfd): Use "Lx" for r_info.
(bfd_elf_gc_record_vtinherit): Use "Lx" for offset.

7 years agoBFD long long cleanup
Alan Modra [Mon, 3 Jul 2017 12:29:30 +0000 (21:59 +0930)] 
BFD long long cleanup

long long isn't supposed to be used without a configure test, to
support ancient compilers.  Probably not terribly important nowadays.

* bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG.
* coff-rs6000.c (FMT20): Handle hosts with 64-bit long and
Microsoft C library variant of long long format specifier.
(PRINT20): Cast value to bfd_uint64_t not long long.
* coffcode.h (coff_print_aux): Use BFD_VMA_FMT.
* coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than
long long.  Don't cast to bfd_vma.
* elf32-score.c (score3_bfd_getl48): Likewise.
* vms-alpha.c (_bfd_vms_slurp_eisd): Likewise.

7 years agoMiscellaneous format string fixes
Alan Modra [Mon, 3 Jul 2017 12:26:29 +0000 (21:56 +0930)] 
Miscellaneous format string fixes

* elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to
print d_tag.
(bfd_elf_print_symbol): Don't cast symbol->flags.
(_bfd_elf_symbol_from_bfd_symbol): Likewise.
* elf32-ppc.c (ppc_elf_begin_write_processing): Correct
_bfd_error_handler argument order.
(ppc_elf_merge_private_bfd_data): Don't cast flags.

7 years agoMissing config for bfd.c:_doprnt
Alan Modra [Mon, 3 Jul 2017 12:25:57 +0000 (21:55 +0930)] 
Missing config for bfd.c:_doprnt

This function uses HAVE_LONG_LONG and HAVE_LONG_DOUBLE

* configure.ac: Invoke AC_CHECK_TYPES for long long.  Invoke
AC_TYPE_LONG_DOUBLE.
* configure: Regenerate.
* config.in: Regenerate.

7 years agoDisable symver test on hppa64-hpux
Alan Modra [Mon, 3 Jul 2017 12:25:21 +0000 (21:55 +0930)] 
Disable symver test on hppa64-hpux

The syntax for common symbols is different on that target.

* testsuite/gas/elf/symver.d: Don't run on hppa64-hpux.

7 years ago[GOLD] undef after using DW_IDX and friends
Alan Modra [Mon, 3 Jul 2017 12:16:59 +0000 (21:46 +0930)] 
[GOLD] undef after using DW_IDX and friends

* dwarf.h (DW_FIRST_IDX, DW_IDX, DW_IDX_DUP, DW_END_IDX): Undef
after using.

7 years agoRepair include/dwarf2.def breakage
Alan Modra [Mon, 3 Jul 2017 10:00:24 +0000 (19:30 +0930)] 
Repair include/dwarf2.def breakage

* dwarf.h (DW_FIRST_IDX, DW_IDX, DW_IDX_DUP, DW_END_IDX): Define.

7 years agobuffer.h: Fix spelling mistakes
Simon Marchi [Mon, 3 Jul 2017 11:59:00 +0000 (13:59 +0200)] 
buffer.h: Fix spelling mistakes

gdb/ChangeLog:

* buffer.h (buffer_finish): Fix spelling mistakes.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Jul 2017 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoDWARF-5: readelf: .debug_names
Jan Kratochvil [Sun, 2 Jul 2017 20:15:05 +0000 (22:15 +0200)] 
DWARF-5: readelf: .debug_names

Display DWARF-5 .debug_names (standardized .gdb_index).

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

* dwarf.c: Include assert.h.
(MAX, MIN, get_IDX_name, display_debug_names): New.
(debug_displays): Add .debug_names.
* dwarf.h: (enum dwarf_section_display_enum): Add debug_names.
* readelf.c (process_section_headers): Add ".debug_names".

7 years agoImport include/+libiberty/ r249883 from upstream GCC.
Jan Kratochvil [Sun, 2 Jul 2017 20:09:52 +0000 (22:09 +0200)] 
Import include/+libiberty/ r249883 from upstream GCC.

include/ChangeLog
2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset)
(DW_IDX_parent, DW_IDX_type_hash, DW_IDX_lo_user, DW_IDX_hi_user)
(DW_IDX_GNU_internal, DW_IDX_GNU_external): New.
* dwarf2.h (DW_IDX, DW_IDX_DUP, DW_FIRST_IDX, DW_END_IDX): New.
(enum dwarf_name_index_attribute): Remove.
(get_DW_IDX_name): New declaration.

libiberty/ChangeLog
2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarfnames.c (DW_FIRST_IDX, DW_END_IDX, DW_IDX, DW_IDX_DUP): New.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Jul 2017 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoUse bfd_malloc_and_get_section
Alan Modra [Sat, 1 Jul 2017 12:28:10 +0000 (21:58 +0930)] 
Use bfd_malloc_and_get_section

It's nicer than xmalloc followed by bfd_get_section_contents, since
xmalloc exits on failure and needs a check that its size_t arg doesn't
lose high bits when converted from bfd_size_type.

PR binutils/21665
* objdump.c (strtab): Make var a bfd_byte*.
(disassemble_section): Don't limit malloc size.  Instead, use
bfd_malloc_and_get_section.
(read_section_stabs): Use bfd_malloc_and_get_section.  Return
bfd_byte*.
(find_stabs_section): Remove now unnecessary cast.
* objcopy.c (copy_object): Use bfd_malloc_and_get_section.  Free
contents on error return.
* nlmconv.c (copy_sections): Use bfd_malloc_and_get_section.

7 years agoSetup .dir-locals.el to use C-style comments by default
Eli Zaretskii [Sat, 1 Jul 2017 15:45:57 +0000 (18:45 +0300)] 
Setup .dir-locals.el to use C-style comments by default

gdb/ChangeLog:
2017-07-01  Eli Zaretskii  <eliz@gnu.org>

* .dir-locals.el: Automatically switch to C-style comments in
versions of Emacs that support the feature.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Jul 2017 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoMIPS/GAS: Use a switch on relaxation type in microMIPS fixup creation
Maciej W. Rozycki [Fri, 30 Jun 2017 23:42:19 +0000 (00:42 +0100)] 
MIPS/GAS: Use a switch on relaxation type in microMIPS fixup creation

Use a switch on the relaxation type rather than a chain of conditionals
in microMIPS fixup creation, improving source code structure and aiding
the compiler with code generation.

gas/
* config/tc-mips.c (md_convert_frag): Use a switch on the
microMIPS relaxation type rather than a chain of conditionals.

7 years agoMIPS/GAS: Use frag symbol/offset directly in fixup creation
Maciej W. Rozycki [Fri, 30 Jun 2017 23:42:19 +0000 (00:42 +0100)] 
MIPS/GAS: Use frag symbol/offset directly in fixup creation

There is no need to use a helper expression in the creation of fixups
made from a frag's symbol and offset, because a simple `symbol+offset'
expression can be handled directly, with the use of a `fix_new' rather
than a `fix_new_exp' call.  Rewrite `md_convert_frag' using `fix_new'
then and remove all the unneeded helper expressions, simplifying code.

gas/
* config/tc-mips.c (md_convert_frag): Rewrite `fix_new_exp'
calls in terms of `fix_new'.

7 years agoMIPS/GAS: Use non-zero frag offset directly in PIC branch relaxation
Maciej W. Rozycki [Fri, 30 Jun 2017 23:42:19 +0000 (00:42 +0100)] 
MIPS/GAS: Use non-zero frag offset directly in PIC branch relaxation

Use frag symbols with a non-zero offset directly in `fix_new_exp' calls
made in PIC branch relaxation.  There is no need here to make a helper
symbol to hold the result of a `symbol+offset' calculation requested as
only branches to local symbols are relaxed and in this case the LO16
part of the PIC address load sequence will have the offset accounted for
in calculation against the local GOT entry retrieved as the GOT16 high
part.  Consequently actual code produed is identical whether a helper
symbol is used or the original `symbol+offset' expression used directly.
Verify that this is indeed the case with GAS and LD tests.

gas/
* config/tc-mips.c (md_convert_frag): Don't make a helper
expression symbol for `fix_new_exp' called with a non-zero
offset.
* testsuite/gas/mips/relax-offset.d: New test.
* testsuite/gas/mips/mips1@relax-offset.d: New test.
* testsuite/gas/mips/r3000@relax-offset.d: New test.
* testsuite/gas/mips/r3900@relax-offset.d: New test.
* testsuite/gas/mips/micromips@relax-offset.d: New test.
* testsuite/gas/mips/relax-offset.l: New stderr output.
* testsuite/gas/mips/relax-offset.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

ld/
* testsuite/ld-mips-elf/relax-offset.dd: New test.
* testsuite/ld-mips-elf/relax-offset.gd: New test.
* testsuite/ld-mips-elf/relax-offset-umips.dd: New test.
* testsuite/ld-mips-elf/relax-offset-umips.gd: New test.
* testsuite/ld-mips-elf/relax-offset.ld: New test linker script.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
(prune_warnings): New temporary procedure.

7 years agoAdd support for a __gcc_isr pseudo isntruction to the AVR assembler.
Georg-Johann Lay [Fri, 30 Jun 2017 15:37:39 +0000 (16:37 +0100)] 
Add support for a __gcc_isr pseudo isntruction to the AVR assembler.

    PR gas/21683
include * opcode/avr.h (AVR_INSN): Add one for __gcc_isr.

gas * doc/c-avr.texi (AVR Options) <-mgcc-isr>: Document it.
    (AVR Pseudo Instructions): New node.
    * config/tc-avr.h (md_pre_output_hook): Define to avr_pre_output_hook.
    (md_undefined_symbol): Define to avr_undefined_symbol.
    (avr_pre_output_hook, avr_undefined_symbol): New protos.
    * config/tc-avr.c (struc-symbol.h): Include it.
    (ISR_CHUNK_Done, ISR_CHUNK_Prologue, ISR_CHUNK_Epilogue): New enums.
    (avr_isr, avr_gccisr_opcode)
    (avr_no_sreg_hash, avr_no_sreg): New static variables.
    (avr_opt_s) <have_gccisr>: Add field.
    (avr_opt): Add initializer for have_gccisr.
    (enum options) <OPTION_HAVE_GCCISR>: Add enum.
    (md_longopts) <"mgcc-isr">: Add entry.
    (md_show_usage): Document -mgcc-isr.
    (md_parse_option) [OPTION_HAVE_GCCISR]: Handle it.
    (md_undefined_symbol): Remove.
    (avr_undefined_symbol, avr_pre_output_hook): New fuctions.
    (md_begin) <avr_no_sreg_hash, avr_gccisr_opcode>: Initialize them.
    (avr_operand) <pregno>: Add argument and set *pregno if function
    is called for a register constraint.
    [N]: Handle constraint.
    (avr_operands) <avr_operand>: Pass 5th parameter to calls.
    [avr_opt.have_gccisr]: Call avr_update_gccisr.  Call
    avr_gccisr_operands instead of avr_operands.
    (avr_update_gccisr, avr_emit_insn, avr_patch_gccisr_frag)
    (avr_gccisr_operands, avr_check_gccisr_done): New static functions.
    * testsuite/gas/avr/gccisr-01.d: New test.
    * testsuite/gas/avr/gccisr-01.s: New test.
    * testsuite/gas/avr/gccisr-02.d: New test.
    * testsuite/gas/avr/gccisr-02.s: New test.
    * testsuite/gas/avr/gccisr-03.d: New test.
    * testsuite/gas/avr/gccisr-03.s: New test.

7 years agoMIPS/GAS: Update `match_float_constant' and `match_operand' descriptions
Maciej W. Rozycki [Fri, 30 Jun 2017 14:39:26 +0000 (15:39 +0100)] 
MIPS/GAS: Update `match_float_constant' and `match_operand' descriptions

Complement commit a92713e60ef4 ("Preparse MIPS instructions into
tokens"), <https://sourceware.org/ml/binutils/2013-07/msg00143.html>,
and update `match_float_constant' and `match_operand' function
descriptions according to semantics changes.

gas/
* config/tc-mips.c (match_float_constant): Update description.
(match_operand): Likewise.

7 years agoMIPS/opcodes: Reorder LSA and DLSA instructions
Maciej W. Rozycki [Fri, 30 Jun 2017 14:27:18 +0000 (15:27 +0100)] 
MIPS/opcodes: Reorder LSA and DLSA instructions

Correct an issue introduced with commit 7361da2c952e ("Add support for
MIPS R6.") and move the LSA and DLSA instructions back to the MSA ASE
instruction block in the regular MIPS opcode table.  Adjust formatting
around the "MIPS r6" heading.

opcodes/
* mips-opc.c (mips_builtin_opcodes): Move "lsa" and "dlsa"
entries to the MSA ASE instruction block.

7 years agoPR cli/21688: Detect aliases when issuing python/compile/guile commands (and fix...
Sergio Durigan Junior [Fri, 30 Jun 2017 12:27:29 +0000 (08:27 -0400)] 
PR cli/21688: Detect aliases when issuing python/compile/guile commands (and fix last commit)

My last commit fixed a regression that happened when using
inline/multi-line commands for Python/Compile/Guile, but introduced
another regression: it is now not possible to use aliases for the
commands mentioned above.  The fix is to almost revert the change I've
made and go back to using the 'struct cmd_list_element *', but at the
same time make sure that we advance the 'cmd_name' variable past all
the whitespace characters after the command name.  If, after skipping
the whitespace, we encounter a '\0', it means that the command is not
inline.  Otherwise, it is.

This patch also expands the testcase in order to check for aliases and
for trailing whitespace after the command name.

gdb/ChangeLog:
2017-06-30  Sergio Durigan Junior  <sergiodj@redhat.com>
    Pedro Alves  <palves@redhat.com>

PR cli/21688
* cli/cli-script.c (command_name_equals_not_inline): Remove function.
(process_next_line): New variable 'inline_cmd'.
Adjust 'if' clauses for "python", "compile" and "guile" to use
'command_name_equals' and check for '!inline_cmd'.

gdb/testsuite/ChangeLog:
2017-06-30  Sergio Durigan Junior  <sergiodj@redhat.com>

PR cli/21688
* gdb.python/py-cmd.exp (test_python_inline_or_multiline): Add new
tests for alias commands and trailing whitespace.

7 years agoPR cli/21688: Fix multi-line/inline command differentiation
Sergio Durigan Junior [Thu, 29 Jun 2017 01:55:03 +0000 (21:55 -0400)] 
PR cli/21688: Fix multi-line/inline command differentiation

This bug is a regression caused by the following commit:

  604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4 is the first bad commit
  commit 604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4
  Author: Jerome Guitton <guitton@adacore.com>
  Date:   Tue Jan 10 15:15:53 2017 +0100

The problem happens because, on cli/cli-script.c:process_next_line,
GDB is not using the command line string to identify which command to
run, but it instead using the 'struct cmd_list_element *' that is
obtained by using the mentioned string.  The problem with that is that
the 'struct cmd_list_element *' doesn't have any information on
whether the command issued by the user is a multi-line or inline one.

A multi-line command is a command that will necessarily be composed of
more than 1 line.  For example:

  (gdb) if 1
  >python
   >print ('hello')
   >end
  >end

As can be seen in the example above, the 'python' command actually
"opens" a new command line (represented by the change in the
indentation) that will then be used to enter Python code.  OTOH, an
inline command is a command that is "self-contained" in a single line,
for example:

  (gdb) if 1
  >python print ('hello')
  >end

This Python command is a one-liner, and therefore there is no other
Python code that can be entered for this same block.  There is also no
change in the indentation.

So, the fix is somewhat simple: we have to revert the change and use
the full command line string passed to process_next_line in order to
identify whether we're dealing with a multi-line or an inline command.
This commit does just that.  As can be seen, this regression also
affects other languages, like guile or the compile framework.  To make
things clearer, I decided to create a new helper function responsible
for identifying a non-inline command.

Testcase is attached.

gdb/ChangeLog:
2017-06-30  Sergio Durigan Junior  <sergiodj@redhat.com>

PR cli/21688
* cli/cli-script.c (command_name_equals_not_inline): New function.
(process_next_line): Adjust 'if' clauses for "python", "compile"
and "guile" to use command_name_equals_not_inline.

gdb/testsuite/ChangeLog:
2017-06-30  Sergio Durigan Junior  <sergiodj@redhat.com>

PR cli/21688
* gdb.python/py-cmd.exp (test_python_inline_or_multiline): New
procedure.  Call it.

7 years agoFix failures in MMIX linker tests introduced by fix for PR 21665.
Nick Clifton [Fri, 30 Jun 2017 10:03:37 +0000 (11:03 +0100)] 
Fix failures in MMIX linker tests introduced by fix for PR 21665.

PR binutils/21665
* objdump.c (disassemble_section): Move check for an overlarge
section to just before the allocation of memory.  Do not check
section size against file size, but instead use an arbitrary 2Gb
limit.  Issue a warning message if the section is too big.

7 years agoMIPS: Add Imagination interAptiv MR2 MIPS32r3 processor support (ChangeLog)
Maciej W. Rozycki [Fri, 30 Jun 2017 06:21:56 +0000 (07:21 +0100)] 
MIPS: Add Imagination interAptiv MR2 MIPS32r3 processor support (ChangeLog)

Correct ChangeLog entry for commit 38bf472a1521 ("MIPS: Add Imagination
interAptiv MR2 MIPS32r3 processor support").

7 years agoMIPS: Add microMIPS XPA support
Maciej W. Rozycki [Fri, 30 Jun 2017 06:21:56 +0000 (07:21 +0100)] 
MIPS: Add microMIPS XPA support

Add support for the base and Virtualization ASE microMIPS instructions
as per the architecture specifications[1][2][3][4].

Most of this change by Andrew Bennett.

[1] "MIPS Architecture for Programmers Volume II-B: The microMIPS32
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00582,
    Revision 5.04, January 15, 2014, Section 5.5 "Recoded 32-Bit
    Instructions", p. 340

[2] "microMIPS32 Architecture for Programmers Volume IV-i:
    Virtualization Module of the microMIPS32 Architecture", MIPS
    Technologies, Inc., Document Number: MD00848, Revision 1.06,
    December 10, 2013, Section 6.1 "Overview", pp. 133, 136

[3] "MIPS Architecture for Programmers Volume II-B: The microMIPS64
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00594,
    Revision 5.04, January 15, 2014, Section 5.5 "Recoded 32-Bit
    Instructions", pp. 415, 444

[4] "microMIPS64 Architecture for Programmers Volume IV-i:
    Virtualization Module of the microMIPS64 Architecture", MIPS
    Technologies, Inc., Document Number: MD00849, Revision 1.06,
    December 10, 2013, Section 6.1 "Overview", pp. 134-135, 139-140

binutils/
* NEWS: Mention microMIPS XPA support.

opcodes/
* micromips-opc.c (XPA, XPAVZ): New macros.
(micromips_opcodes): Add "mfhc0", "mfhgc0", "mthc0" and
"mthgc0".

gas/
* config/tc-mips.c (mips_ases): Add microMIPS XPA support.
* testsuite/gas/mips/micromips@xpa.d: New test.
* testsuite/gas/mips/mips.exp: Run the new test.  Enable
`xpa-virt-err' test for `micromips'.

7 years agoMIPS: Add microMIPS R5 support
Maciej W. Rozycki [Fri, 30 Jun 2017 06:21:56 +0000 (07:21 +0100)] 
MIPS: Add microMIPS R5 support

Add base microMIPS Release 5 ISA support and the ERETNC instruction in
particular, as per the architecture specifications[1][2].

Most of this change by Andrew Bennett.

References:

[1] "MIPS Architecture for Programmers Volume II-B: The microMIPS32
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00582,
    Revision 5.04, January 15, 2014, Section 5.5 "Recoded 32-Bit
    Instructions", pp. 266-267

[2] "MIPS Architecture for Programmers Volume II-B: The microMIPS64
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00594,
    Revision 5.04, January 15, 2014, Section 5.5 "Recoded 32-Bit
    Instructions", pp. 326-327

binutils/
* NEWS: Mention microMIPS Release 5 ISA support.

opcodes/
* micromips-opc.c (I36): New macro.
(micromips_opcodes): Add "eretnc".

gas/
* testsuite/gas/mips/micromips@r5.d: New test.
* testsuite/gas/mips/mips.exp: Run the new test.

7 years agoMIPS: Fix XPA base and Virtualization ASE instruction handling
Maciej W. Rozycki [Fri, 30 Jun 2017 06:21:55 +0000 (07:21 +0100)] 
MIPS: Fix XPA base and Virtualization ASE instruction handling

Correct a commit 7d64c587c15f ("Add support for the MIPS eXtended
Physical Address (XPA) ASE.") bug, causing XPA base and Virtualization
ASE instructions to be wrongly always enabled with the selection of the
MIPS32r2 or higher ISA.

For example this source assembles successfully as shown below:

$ cat xpa.s
mfhc0 $2, $1
$ as -32 -mips32 -o xpa.o xpa.s
xpa.s: Assembler messages:
xpa.s:1: Error: opcode not supported on this processor: mips32 (mips32) `mfhc0 $2,$1'
$ as -32 -mips32r2 -o xpa.o xpa.s
$ objdump -d xpa.o

xpa.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0: 40420800  mfhc0 v0,c0_random
...
$

To address this issue remove the I33 (INSN_ISA32R2) marking from all XPA
instructions in the opcode table.  Additionally, for XPA Virtualization
ASE instructions implement an XPAVZ (ASE_XPA_VIRT) combination ASE flag
and use it in place of IVIRT|XPA (ASE_VIRT|ASE_XPA).

Now the same source is correctly rejected unless the `-mxpa' option is
also used:

$ as -32 -mips32r2 -o xpa.o xpa.s
xpa.s: Assembler messages:
xpa.s:1: Error: opcode not supported on this processor: mips32r2 (mips32r2) `mfhc0 $2,$1'
$ as -32 -mips32r2 -mxpa -o xpa.o xpa.s
$

Add test cases for XPA base and XPA Virtualization ASE instructions.

Parts of this change by Andrew Bennett.

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

opcodes/
* mips-dis.c (mips_calculate_combination_ases): Handle the
ASE_XPA_VIRT flag.
(parse_mips_ase_option): New function.
(parse_mips_dis_option): Factor out ASE option handling to the
new function.  Call `mips_calculate_combination_ases'.
* mips-opc.c (XPAVZ): New macro.
(mips_builtin_opcodes): Correct ISA and ASE flags for "mfhc0",
"mfhgc0", "mthc0" and "mthgc0".

gas/
* config/tc-mips.c (mips_set_ase): Handle the ASE_XPA_VIRT flag.
* testsuite/gas/mips/xpa.d: Remove `xpa' from `-M' in `objdump'
flags.  Add `-mvirt' to `as' flags.
* testsuite/gas/mips/xpa-err.d: New test.
* testsuite/gas/mips/xpa-virt-err.d: New test.
* testsuite/gas/mips/xpa-err.l: New stderr output.
* testsuite/gas/mips/xpa-virt-err.l: New stderr output.
* testsuite/gas/mips/xpa-err.s: New test source.
* testsuite/gas/mips/xpa-virt-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

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

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

7 years agoMIPS/opcodes: Correctly combine ASE flags for ASE_MIPS16E2_MT calculation
Maciej W. Rozycki [Thu, 29 Jun 2017 23:55:07 +0000 (00:55 +0100)] 
MIPS/opcodes: Correctly combine ASE flags for ASE_MIPS16E2_MT calculation

Correct a commit 25499ac7ee92 ("MIPS16e2: Add MIPS16e2 ASE support")
disassembler bug with the handling of the ASE_MIPS16E2_MT combination
ASE flag, where the calculation uses MIPS ABI Flags directly rather than
calculated internal ASE flags.  Consequently code does not correctly set
the ASE_MIPS16E2_MT flag when the MIPS16e2 ASE flag and the MT ASE flag
come from different sources, i.e. one from the BFD chosen and the other
one from MIPS ABI Flags.

Fix this by using internal ASE_MT and ASE_MIPS16E2 flags in a separate
subsequent step, factored out to a dedicated function for use with
future combination ASE flags.  Adjust the `mips16e2@mips16e2-mt-sub.d'
test case accordingly, where the MT flag comes from the BFD selected for
the disassembler and the MIPS16e2 flag comes from the ELF binary itself.

opcodes/
* mips-dis.c (mips_calculate_combination_ases): New function.
(mips_convert_abiflags_ases): Factor out ASE_MIPS16E2_MT
calculation to the new function.
(set_default_mips_dis_options): Call the new function.

gas/
* testsuite/gas/mips/mips16e2@mips16e2-mt-sub.d: Adjust for the
ASE_MIPS16E2_MT flag disassembler fix.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e2-mt-sub.d:
Likewise.

7 years agoMIPS/GAS: Clear the ASE_MIPS16E2_MT flag for recalculation
Maciej W. Rozycki [Thu, 29 Jun 2017 23:55:07 +0000 (00:55 +0100)] 
MIPS/GAS: Clear the ASE_MIPS16E2_MT flag for recalculation

Correct a commit 25499ac7ee92 ("MIPS16e2: Add MIPS16e2 ASE support") GAS
bug with the handling of the ASE_MIPS16E2_MT combination ASE flag, which
is not correctly calculated as `.set nomips16e2' and `.set nomt'
pseudo-ops are processed.  This leads to code like:

$ cat foo.s
.set nomt
evpe
.align 4, 0
$ cat bar.s
.set nomips16e2
dvpe
.align 4, 0
$

to successfully assemble where it should not:

$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o foo.o foo.s
$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o bar.o bar.s
$ objdump -m mips:16 -d foo.o

foo.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0: f027 6700  evpe
...

bar.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0: f026 6700  dvpe
...
$

This happens because ASE_MIPS16E2_MT once set in `mips_set_ase' is never
cleared.  Fix the problem by clearing it there before it is calculated
based on the ASE_MT and ASE_MIPS16E2 flags, making assembly fail as
expected:

$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o foo.o foo.s
foo.s: Assembler messages:
foo.s:2: Error: opcode not supported on this processor: mips32r3 (mips32r3) `evpe'
$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o bar.o bar.s
bar.s: Assembler messages:
bar.s:2: Error: opcode not supported on this processor: mips32r3 (mips32r3) `dvpe'
$

gas/
* config/tc-mips.c (mips_set_ase): Clear the ASE_MIPS16E2_MT
flag before recalculating.
* testsuite/gas/mips/mips16e2-mt-err.d: New test.
* testsuite/gas/mips/mips16e2-mt-err.l: New stderr output.
* testsuite/gas/mips/mips16e2-mt-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new test.

7 years agoRISC-V: Fix TLS copy relocs
Andrew Waterman [Wed, 28 Jun 2017 05:44:24 +0000 (22:44 -0700)] 
RISC-V: Fix TLS copy relocs

The dynrelro introduction wasn't implemented quite right for RISC-V,
as it didn't consider TLS copy relocs.

bfd/ChangeLog

2017-06-29  Andrew Waterman  <andrew@sifive.com>

        * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Fix TLS copy
        relocs.

7 years agoExpression completer should not match explicit location options
Pedro Alves [Thu, 29 Jun 2017 14:52:38 +0000 (15:52 +0100)] 
Expression completer should not match explicit location options

This commit fixes a mismatch between what "print" command completer
thinks the command understands, and what the command actually
understands.

The explicit location options are understood by commands that take
(linespecs and) explicit locations as argument.  I.e, breakpoint
commands, and "list".  For example:

 (gdb) b -source file.c -function my_func

So for those commands, it makes sense that the completer
completes:

 "b -sour[TAB]" -> "b -source "
 "b -functi[TAB]" -> "b -function "

etc.

However, completion for commands that take expressions (not
linespecs/locations) as arguments, such as the "print" command, also
completes the explicit location options, even though those switches
aren't really understood by these commands.  Instead, "-foo" is
understood as an expression applying unary minus on a symbol named
"foo" (think "print -1"):

 (gdb) p -func[TAB]
 (gdb) p -function [RET]
 No symbol "function" in current context.

The patch fixes this by having the expression_completer function
bypass the function that completes explicit locations.

New regression tests included.

gdb/ChangeLog:
2017-06-29  Pedro Alves  <palves@redhat.com>

* completer.c (expression_completer): Call
linespec_location_completer instead of location_completer.

gdb/testsuite/ChangeLog:
2017-06-29  Pedro Alves  <palves@redhat.com>

* gdb.base/printcmds.exp: Add tests.

7 years agoRemove old stale expression_completer hack
Pedro Alves [Thu, 29 Jun 2017 14:52:37 +0000 (15:52 +0100)] 
Remove old stale expression_completer hack

The code in question was introduced by:

 https://sourceware.com/ml/gdb-patches/2008-06/msg00143.html

"The fix is to make sure that the entire expression is passed to
expression_completer, then duplicate some logic there in the case
where location_completer is called."

The logic that was duplicated was much later on removed by the
original explicit locations patch:

 commit 87f0e7204722a986f79f245eee716f0870832d47
 Author:     Keith Seitz <keiths@redhat.com>
 AuthorDate: Tue Aug 11 17:09:36 2015 -0700
 Commit:     Keith Seitz <keiths@redhat.com>
 CommitDate: Tue Aug 11 17:09:36 2015 -0700

     Explicit locations: add UI features for CLI

 @@ -688,16 +880,6 @@ complete_line_internal (const char *text,
       rl_completer_word_break_characters =
 gdb_completer_file_name_break_characters;
     }
 -                 else if (c->completer == location_completer)
 -                   {
 -                     /* Commands which complete on locations want to
 -                        see the entire argument.  */
 -                     for (p = word;
 -                          p > tmp_command
 -                            && p[-1] != ' ' && p[-1] != '\t';
 -                          p--)
 -                       ;
 -                   }

However this case in expression_completer was left behind.

I couldn't come up with a test where this currently makes any
difference.

gdb/ChangeLog:
2017-06-29  Pedro Alves  <palves@redhat.com>

* completer.c (expression_completer): Remove code that recomputes
'text' from 'word'.

7 years ago[ARC] Use FOR_EACH_DISASSEMBLER_OPTION to iterate over options
Anton Kolesov [Mon, 19 Jun 2017 10:27:52 +0000 (13:27 +0300)] 
[ARC] Use FOR_EACH_DISASSEMBLER_OPTION to iterate over options

This patch updates arc-dis.c:parse_disassembler_options to use a macro
FOR_EACH_DISASSEMBLER_OPTION, which has been introduced in [1], instead of a
homegrown solution to split option string.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=65b48a81

opcodes/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <Anton.Kolesov@synopsys.com>

* arc-dis.c (parse_disassembler_options): Use
FOR_EACH_DISASSEMBLER_OPTION.

7 years ago[ARC] Fix handling of cpu=... disassembler option value
Anton Kolesov [Thu, 15 Jun 2017 12:58:32 +0000 (15:58 +0300)] 
[ARC] Fix handling of cpu=... disassembler option value

There is a bug in handling of cpu=... disassembler option in case there are
other options after it, for example, `cpu=EM,dsp'.  In this case `EM,dsp' is
treated as an option value, and strcasecmp reports is as non-equal to "EM".
This is fixed by using disassembler_options_cmp function, which compares string
treating `,' the same way as `\0'.

This function also solves a problem with option order in parse_option.
Previously, if several option had same prefix (e.g. fpud, fpuda), then the
longer one should have been compared first, otherwise when longer option is
passed it would be treated as a short one, because

  CONST_STRNEQ ("fpud", "fpuda")

would be true.  The order of options was correct for ARC, so there were no
bugs per se, but with disassembler_option_cmp there is no risk of such a bug
being introduced in the future.

opcodes/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <Anton.Kolesov@synopsys.com>

* arc-dis.c (parse_option): Use disassembler_options_cmp to compare
disassembler option strings.
(parse_cpu_option): Likewise.

binutils/ChangeLog

yyyy-mm-dd  Anton Kolesov  <Anton.Kolesov@synopsys.com>

* testsuite/binutils-all/arc/double_store.s: New file.
* testsuite/binutils-all/arc/objdump.exp: Tests for disassembler
options.
(do_objfile): New function.
(check_assembly): Likewise.

7 years agoUse target_desc fields expedite_regs and xmltarget ifndef IN_PROCESS_AGENT
Yao Qi [Thu, 29 Jun 2017 11:41:50 +0000 (12:41 +0100)] 
Use target_desc fields expedite_regs and xmltarget ifndef IN_PROCESS_AGENT

struct target_desc is used by both GDBserver and IPA, but fields
expedite_regs and xmltarget are only used in GDBserver, so this patch wraps
these two fields by ifndef IN_PROCESS_AGENT.  This patch also changes
regformats/regdat.sh to generate .c files in this way too.

gdb/gdbserver:

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

* tdesc.h (struct target_desc) [IN_PROCESS_AGENT] <expedite_regs>:
Remove.
[IN_PROCESS_AGENT] <xmltarget>: Likewise.

gdb:

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

* regformats/regdat.sh: Generate code with
"ifndef IN_PROCESS_AGENT".

7 years agobfd: prevent all but undef weak syms from becoming dynamic in sparc.
Egeyar Bagcioglu [Thu, 29 Jun 2017 11:28:27 +0000 (04:28 -0700)] 
bfd: prevent all but undef weak syms from becoming dynamic in sparc.

Prevent sparc backend making symbols dynamic unless they are undefined
weak. Use R_SPARC_RELATIVE for the symbols which are not dynamic in PIC.

This patch is tested on sparc64-unknown-linux-gnu, no regressions are
found.

bfd/ChangeLog:

2017-06-29  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

* elfxx-sparc.c (allocate_dynrelocs): Don't make a symbol dynamic
unless it is undefined weak.
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Set the flag
relative_reloc to direct non-dynamic symbols to R_SPARC_RELATIVE
relocation.
* elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): If symbol
        is not dynamic in PIC, abort.

7 years ago[AArch64] Only override the symbol dynamic decision on undefined weak symbol
Jiong Wang [Thu, 29 Jun 2017 10:47:43 +0000 (11:47 +0100)] 
[AArch64] Only override the symbol dynamic decision on undefined weak symbol

This fix is an adaption of the x86-64 PR ld/21402 fix to AArch64.

After the generic code deciding one symbol is not dynamic, AArch64 backend
only overrides the decision on undefined weak symbols.

bfd/
PR ld/21402
* elfnn-aarch64.c (elfNN_aarch64_allocate_dynrelocs): Only make
undefined weak symbols into dynamic.
(elfNN_aarch64_final_link_relocate): Generate runtime RELATIVE
relocation for non-dynamic symbols.
(elfNN_aarch64_finish_dynamic_symbol): Add sanity check.

7 years ago[AArch64] Remove duplicated code when handling some GOT relocations types
Jiong Wang [Thu, 29 Jun 2017 10:45:24 +0000 (11:45 +0100)] 
[AArch64] Remove duplicated code when handling some GOT relocations types

There are quite a few duplicated code supporting several GP based
relocation types.  They are:

  BFD_RELOC_AARCH64_LD64_GOTOFF_LO15
  BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC
  BFD_RELOC_AARCH64_MOVW_GOTOFF_G1

These relocation types are supposed to be used for large memory model PIC/pic
mode under which we will have an initialized GP register points to the base of
GOT table, then these relocations are supposed to put the distance between GOT
entry and GOT table base address into the related instructions.

So, the parameters required to calculate the relocation should be the same as
BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 etc, all of them are require the GOT entry
address and GOT table base address to perform the relocation.

This patch has removed those duplicated code when handling above listed
relocation types,  grouped them with others as relocation types that are
require GOT table base address during performing relocation, reused the
existed GOT handling code.

The relocation calculation for these types before and after this patch should be
identical.

bfd/
* elfnn-aarch64.c (aarch64_relocation_aginst_gp_p): New function.
(elfNN_aarch64_final_link_relocate): Delete duplicated code for
BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Optimize the
support for them.

7 years agoS390: Support guarded-storage core note sections
Andreas Arnez [Thu, 29 Jun 2017 08:30:09 +0000 (10:30 +0200)] 
S390: Support guarded-storage core note sections

Newer Linux kernel versions offer two new register sets in support of the
z/Architecture's guarded storage facility: NT_S390_GS_CB, the
"guarded-storage registers", and NT_S390_GS_BC, the "guarded-storage
broadcast control block".  This patch adds support for the respective core
notes sections to binutils.

bfd/ChangeLog:
* elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
(elfcore_write_s390_gs_bc): Likewise.
* elf.c (elfcore_grok_s390_gs_cb): New function.
(elfcore_grok_s390_gs_bc): New function.
(elfcore_grok_note): Call them.
(elfcore_write_s390_gs_cb): New function.
(elfcore_write_s390_gs_bc): New function.
(elfcore_write_register_note): Call them.

binutils/ChangeLog:
* readelf.c (get_note_type): Add NT_S390_GS_CB and NT_S390_GS_BC.

include/ChangeLog:
* elf/common.h (NT_S390_GS_CB): New macro.
(NT_S390_GS_BC): Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Jun 2017 00:01:02 +0000 (00:01 +0000)] 
Automatic date update in version.in

7 years agoDon't call bfd_get_file_size in _bfd_generic_get_section_contents
H.J. Lu [Wed, 28 Jun 2017 18:07:04 +0000 (11:07 -0700)] 
Don't call bfd_get_file_size in _bfd_generic_get_section_contents

Since it is impossible to read beyond the end of normal files, we only
need to check archive element size in _bfd_generic_get_section_contents

* libbfd.c (_bfd_generic_get_section_contents): Don't call
bfd_get_file_size.  Check archive element size.
(_bfd_generic_get_section_contents_in_window): Likewise.

7 years agoChange bfd_get_size/bfd_get_file_size to ufile_ptr
H.J. Lu [Wed, 28 Jun 2017 18:00:13 +0000 (11:00 -0700)] 
Change bfd_get_size/bfd_get_file_size to ufile_ptr

bfd_get_size and bfd_get_file_size should return the unsigned file
size.  Otherwise they return negative values for file >= 2GB with
32-bit ufile_ptr.

bfd/

* bfd-in2.h: Regenerated.
* bfdio.c (bfd_get_size): Change return type to ufile_ptr.
(bfd_get_file_size): Likewise.

binutils/

* objdump.c (dump_relocs_in_section): Cast to ufile_ptr when
comparing against bfd_get_file_size return.

7 years agogdb/command.h: Include common/scoped_restore.h
Pedro Alves [Wed, 28 Jun 2017 14:19:02 +0000 (15:19 +0100)] 
gdb/command.h: Include common/scoped_restore.h

command.h depends on scoped_restore:

  extern scoped_restore_tmpl<int> prevent_dont_repeat (void);

But doesn't include the corresponding header
("common/scoped_restore.h").  We haven't noticed a problem because
utils.h includes scoped_restore.h, and defs.h includes utils.h.

However, a patch that makes "symtab.h" include "completer.h", exposed
the issue:
 https://sourceware.org/ml/gdb-patches/2017-06/msg00023.html.

Without this fix that would break building all .o files like this:

 In file included from src/gdb/completer.h:21:0,
                  from src/gdb/symtab.h:28,
                  from src/gdb/language.h:26,
                  from src/gdb/frame.h:72,
                  from src/gdb/gdbarch.h:39,
                  from src/gdb/defs.h:636,
                  from src/gdb/top.c:20:
 src/gdb/command.h:434:8: error: â€˜scoped_restore_tmpl’ does not name a type
  extern scoped_restore_tmpl<int> prevent_dont_repeat (void);
         ^
 Makefile:1911: recipe for target 'top.o' failed

because defs.h includes gdbarch.h before it includes utils.h.

gdb/ChangeLog:
2017-06-28  Pedro Alves  <palves@redhat.com>

* command.h: Include "common/scoped_restore.h".

7 years agoUse obstack_grow_str
Yao Qi [Wed, 28 Jun 2017 13:48:55 +0000 (14:48 +0100)] 
Use obstack_grow_str

We already have macro obstack_grow_str, which is helpful to shorten the
code.

gdb:

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

* mi/mi-cmd-break.c (mi_argv_to_format): Use obstack_grow_str
instead of obstack_grow.

7 years agoAdd support for version 2 of the GNU Build Attribute note specification.
Nick Clifton [Wed, 28 Jun 2017 13:52:12 +0000 (14:52 +0100)] 
Add support for version 2 of the GNU Build Attribute note specification.

* objcopy.c (merge_gnu_build_notes): Add support for version 2 notes.
* readelf.c (print_gnu_build_attribute_name): Likewise.

7 years ago[AArch64] Add dot product support for AArch64 to binutils
Tamar Christina [Wed, 28 Jun 2017 10:09:01 +0000 (11:09 +0100)] 
[AArch64] Add dot product support for AArch64 to binutils

gas/
* config/tc-aarch64.c (aarch64_reg_parse_32_64): Accept 4B.
(aarch64_features): Added dotprod.
* doc/c-aarch64.texi: Added dotprod.
* testsuite/gas/aarch64/dotproduct.d: New.
* testsuite/gas/aarch64/dotproduct.s: New.

opcodes/
* aarch64-asm.c (aarch64_ins_reglane): Added 4B dotprod.
* aarch64-dis.c (aarch64_ext_reglane): Likewise.
* aarch64-tbl.h (QL_V3DOT, QL_V2DOT): New.
(aarch64_feature_dotprod, DOT_INSN): New.
(udot, sdot): New.
* aarch64-dis-2.c: Regenerated.

include/
* opcode/aarch64.h: (AARCH64_FEATURE_DOTPROD): New.
(aarch64_insn_class): Added dotprod.

7 years ago[ARM] Assembler and disassembler support Dot Product Extension
Jiong Wang [Wed, 28 Jun 2017 10:00:55 +0000 (11:00 +0100)] 
[ARM] Assembler and disassembler support Dot Product Extension

  This patch add assembler and disassembler support for new Dot Product
  Extension.

  The support can be enabled through the new "+dotprod" extension.

include/
* opcode/arm.h (FPU_NEON_EXT_DOTPROD): New macro.
(FPU_ARCH_DOTPROD_NEON_VFP_ARMV8): New macro.

gas/
* config/tc-arm.c (fpu_neon_ext_dotprod): New variable.
(neon_scalar_for_mul): Improve comments.
(do_neon_dotproduct): New function to encode Dot Product instructions.
(do_neon_dotproduct_s): Wrapper function for signed Dot Product
instructions.
(do_neon_dotproduct_u): Wrapper function for unsigned Dot Product
instructions.
(insns): New entries for vsdot and vudot.
(arm_extensions): New entry for "dotprod".
* doc/c-arm.texi: Document new "dotprod" extension.
* testsuite/gas/arm/dotprod.s: New test source.
* testsuite/gas/arm/dotprod-illegal.s: New test source.
* testsuite/gas/arm/dotprod.d: New test.
* testsuite/gas/arm/dotprod-thumb2.d: New test.
* testsuite/gas/arm/dotprod-illegal.d: New test.
* testsuite/gas/arm/dotprod-legacy-arch.d: New test.
* testsuite/gas/arm/dotprod-illegal.l: New error file.
* testsuite/gas/arm/dotprod-legacy-arch.l: New error file.

opcodes/
* arm-dis.c (coprocessor_opcodes): New entries for vsdot and vudot.

7 years agoFix PR 21337: segfault when re-reading symbols.
Doug Gilmore [Wed, 28 Jun 2017 01:54:22 +0000 (02:54 +0100)] 
Fix PR 21337: segfault when re-reading symbols.

Fix issue exposed by commit 3e29f34.

The basic issue is that section data referenced through an objfile
pointer can also be referenced via the program-space data pointer,
although via a separate mapping mechanism, which is set up by
update_section_map.  Thus once section data attached to an objfile
pointer is released, the section map associated with the program-space
data pointer must be marked dirty to ensure that update_section_map is
called to prevent stale data being referenced.  For the matter at hand
this marking is being done via a call to objfiles_changed.

Before commit 3e29f34 objfiles_changed could be called after all of
the objfile pointers were processed in reread_symbols since section
data references via the program-space data pointer would not occur in
the calls of read_symbols performed by reread_symbols.

With commit 3e29f34 MIPS target specific calls to find_pc_section were
added to the code for DWARF information processing, which is called
via read_symbols.  Thus in reread_symbols the call to objfiles_changed
needs to be called before calling read_symbols, otherwise stale
section data can be referenced.

Thanks to Luis Machado for providing text for the main comment
associated with the change.

gdb/
2017-06-28  Doug Gilmore  <Doug.Gilmore@imgtec.com>
    PR gdb/21337
    * symfile.c (reread_symbols): Call objfiles_changed just before
    read_symbols.

gdb/testsuite/
2017-06-28  Doug Gilmore  <Doug.Gilmore@imgtec.com>
    PR gdb/21337
    * gdb.base/reread-readsym.exp: New file.
    * gdb.base/reread-readsym.c: New file.

7 years agoMIPS: Add new Imagination interAptiv MR2 GAS and LD tests
Maciej W. Rozycki [Wed, 28 Jun 2017 01:07:36 +0000 (02:07 +0100)] 
MIPS: Add new Imagination interAptiv MR2 GAS and LD tests

Add GAS tests to verify Imagination interAptiv MR2 instruction assembly,
disassembly and ELF object file flags.

Add LD tests to verify Imagination interAptiv MR2 ELF object file
link-time compatibility and flag merging/propagation.  Use the framework
enhancement added with commit 7575e6a752ec ("MIPS/LD/testsuite:
mips-elf-flags: Add MIPS ABI Flags handling").

gas/
* testsuite/gas/mips/elf_mach_interaptiv-mr2.d: New test.
* testsuite/gas/mips/save-err.d: New test.
* testsuite/gas/mips/save-sub.d: New test.
* testsuite/gas/mips/interaptiv-mr2@save.d: New test.
* testsuite/gas/mips/mips1@save-sub.d: New test.
* testsuite/gas/mips/mips2@save-sub.d: New test.
* testsuite/gas/mips/mips3@save-sub.d: New test.
* testsuite/gas/mips/mips4@save-sub.d: New test.
* testsuite/gas/mips/mips5@save-sub.d: New test.
* testsuite/gas/mips/mips32@save-sub.d: New test.
* testsuite/gas/mips/mips64@save-sub.d: New test.
* testsuite/gas/mips/mips16@save-sub.d: New test.
* testsuite/gas/mips/mips16e@save-sub.d: New test.
* testsuite/gas/mips/r3000@save-sub.d: New test.
* testsuite/gas/mips/r3900@save-sub.d: New test.
* testsuite/gas/mips/r4000@save-sub.d: New test.
* testsuite/gas/mips/vr5400@save-sub.d: New test.
* testsuite/gas/mips/interaptiv-mr2@save-sub.d: New test.
* testsuite/gas/mips/sb1@save-sub.d: New test.
* testsuite/gas/mips/octeon2@save-sub.d: New test.
* testsuite/gas/mips/octeon3@save-sub.d: New test.
* testsuite/gas/mips/xlr@save-sub.d: New test.
* testsuite/gas/mips/r5900@save-sub.d: New test.
* testsuite/gas/mips/mips16e2-copy.d: New test.
* testsuite/gas/mips/mips16e2-copy-err.d: New test.
* testsuite/gas/mips/save.d: Remove `MIPS16e' from the `name'
option.  Adjust for trailing padding change.
* testsuite/gas/mips/mips16e2-copy-err.l: New stderr output.
* testsuite/gas/mips/save-sub.s: New test source.
* testsuite/gas/mips/mips16e2-copy.s: New test source.
* testsuite/gas/mips/mips16e2-copy-err.s: New test source.
* testsuite/gas/mips/save.s: Update description, change trailing
padding and remove trailing white space.
* testsuite/gas/mips/mips.exp: Expand `save' and `save-err'
tests across the regular MIPS interAptiv MR2 architecture.  Run
the new tests.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp: Add interAptiv MR2
tests.

7 years agoMIPS: Add Imagination interAptiv MR2 GAS test infrastructure
Maciej W. Rozycki [Wed, 28 Jun 2017 01:07:36 +0000 (02:07 +0100)] 
MIPS: Add Imagination interAptiv MR2 GAS test infrastructure

Define a new regular MIPS and MIPS16 interAptiv MR2 test architecture
and adjust existing tests now run against these architectures
accordingly.

This change causes new test failures:

FAIL: MIPS jal-svr4pic (interaptiv-mr2)
FAIL: MIPS jal-svr4pic noreorder (interaptiv-mr2)

with the `mips-sgi-irix5' and `mips-sgi-irix6' targets, which are
consistent with the remaining architecture results for these cases, that
do not take into account the lack of R_MIPS_JALR relocations produced by
GAS for these targets.  As a preexisting issue these failures are not
addressed with this change.

gas/
* testsuite/gas/mips/mips.exp (interaptiv-mr2): New architecture.
(mips16e2-interaptiv-mr2): Likewise.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro.d: New
test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro-t.d:
New test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro-e.d:
New test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-insn-t.d:
New test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-insn-e.d:
New test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-64.d: New
test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-sub.d: New
test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-sub.d: New
test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-64-sub.d:
New test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e2-mt-sub.d:
New test.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-asmacro.d:
New test.
* testsuite/gas/mips/interaptiv-mr2@mcu.d: New test.
* testsuite/gas/mips/interaptiv-mr2@isa-override-1.d: New test.
* testsuite/gas/mips/interaptiv-mr2@isa-override-2.d: New test.
* testsuite/gas/mips/attr-gnu-4-5.d: Ignore any number of ASE
flag lines present rather than just one.
* testsuite/gas/mips/attr-gnu-4-6.d: Likewise.
* testsuite/gas/mips/attr-gnu-4-7.d: Likewise.
* testsuite/gas/mips/attr-none-o32-fp64-nooddspreg.d: Likewise.
* testsuite/gas/mips/attr-none-o32-fp64.d: Likewise.
* testsuite/gas/mips/attr-none-o32-fpxx.d: Likewise.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro.l: New
stderr output.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro-t.l:
New stderr output.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-macro-e.l:
New stderr output.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-insn-t.l:
New stderr output.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-insn-e.l:
New stderr output.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16-sub.l: New
stderr output.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-sub.l: New
stderr output.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e-64-sub.l:
New stderr output.
* testsuite/gas/mips/interaptiv-mr2@isa-override-1.l: New stderr
output.
* testsuite/gas/mips/interaptiv-mr2@isa-override-2.l: New stderr
output.

7 years agoMIPS: Add Imagination interAptiv MR2 MIPS32r3 processor support
Maciej W. Rozycki [Wed, 28 Jun 2017 01:07:36 +0000 (02:07 +0100)] 
MIPS: Add Imagination interAptiv MR2 MIPS32r3 processor support

Add support for the Imagination interAptiv MR2 MIPS32r3 processor with
the MIPS16e2 ASE as per documentation, including in particular:

1. Support for implementation-specific interAptiv MR2 COPYW and UCOPYW
   MIPS16e2 instructions[1], for assembly and disassembly,

2. Support for implementation-specific interAptiv MR2 SAVE and RESTORE
   regular MIPS instructions[2], for assembly and disassembly,

3. ELF binary file annotation for the interAptiv MR2 MIPS architecture
   extension.

4. Support for interAptiv MR2 architecture selection for assembly, in
   the form of the `-march=interaptiv-mr2' command-line option and its
   corresponding `arch=interaptiv-mr2' setting for the `.set' and
   `.module' pseudo-ops.

5. Support for interAptiv MR2 architecture selection for disassembly,
   in the form of the `mips:interaptiv-mr2' target architecture, for
   use e.g. with the `-m' command-line option for `objdump'.

Parts of this change by Matthew Fortune and Andrew Bennett.

References:

[1] "MIPS32 interAptiv Multiprocessing System Software User's Manual",
    Imagination Technologies Ltd., Document Number: MD00904, Revision
    02.01, June 15, 2016, Section 24.3 "MIPS16e2 Implementation Specific
    Instructions", pp. 878-883

[2] same, Chapter 25 "Implementation-specific Instructions", pp. 911-917

include/
* elf/mips.h (E_MIPS_MACH_IAMR2): New macro.
(AFL_EXT_INTERAPTIV_MR2): Likewise.
* opcode/mips.h: Document new operand codes defined.
(INSN_INTERAPTIV_MR2): New macro.
(INSN_CHIP_MASK): Adjust accordingly.
(CPU_INTERAPTIV_MR2): New macro.
(cpu_is_member) <CPU_INTERAPTIV_MR2>: New case.
(MIPS16_ALL_ARGS): Rename to...
(MIPS_SVRS_ALL_ARGS): ... this.
(MIPS16_ALL_STATICS): Rename to...
(MIPS_SVRS_ALL_STATICS): ... this.

bfd/
* archures.c (bfd_mach_mips_interaptiv_mr2): New macro.
* cpu-mips.c (I_interaptiv_mr2): New enum value.
(arch_info_struct): Add "mips:interaptiv-mr2" entry.
* elfxx-mips.c (_bfd_elf_mips_mach) <E_MIPS_MACH_IAMR2>: New
case.
(mips_set_isa_flags) <bfd_mach_mips_interaptiv_mr2>: Likewise.
(bfd_mips_isa_ext) <bfd_mach_mips_interaptiv_mr2>: Likewise.
(print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
(mips_mach_extensions): Add `bfd_mach_mipsisa32r3' and
`bfd_mach_mips_interaptiv_mr2' entries.
* bfd-in2.h: Regenerate.

opcodes/
* mips-formats.h (INT_BIAS): New macro.
(INT_ADJ): Redefine in INT_BIAS terms.
* mips-dis.c (mips_arch_choices): Add "interaptiv-mr2" entry.
(mips_print_save_restore): New function.
(print_insn_arg) <OP_SAVE_RESTORE_LIST>: Update comment.
(validate_insn_args) <OP_SAVE_RESTORE_LIST>: Remove `abort'
call.
(print_insn_args): Handle OP_SAVE_RESTORE_LIST.
(print_mips16_insn_arg): Call `mips_print_save_restore' for
OP_SAVE_RESTORE_LIST handling, factored out from here.
* mips-opc.c (decode_mips_operand) <'-'> <'m'>: New case.
(RD_31, RD_SP, WR_SP, MOD_SP, IAMR2): New macros.
(mips_builtin_opcodes): Add "restore" and "save" entries.
* mips16-opc.c (decode_mips16_operand) <'n', 'o'>: New cases.
(IAMR2): New macro.
(mips16_opcodes): Add "copyw" and "ucopyw" entries.

binutils/
* readelf.c (get_machine_flags) <E_MIPS_MACH_IAMR2>: New case.
(print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
* NEWS: Mention Imagination interAptiv MR2 processor support.

gas/
* config/tc-mips.c (validate_mips_insn): Handle
OP_SAVE_RESTORE_LIST specially.
(mips_encode_save_restore, mips16_encode_save_restore): New
functions.
(match_save_restore_list_operand): Factor out SAVE/RESTORE
operand insertion into the instruction word or halfword to these
new functions.
(mips_cpu_info_table): Add "interaptiv-mr2" entry.

* doc/c-mips.texi (MIPS Options): Add `interaptiv-mr2' to the
`-march=' argument list.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Jun 2017 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agocompletion_list_add_name wrapper functions
Pedro Alves [Tue, 27 Jun 2017 15:32:57 +0000 (16:32 +0100)] 
completion_list_add_name wrapper functions

Replace macros with functions.

gdb/ChangeLog:
2017-06-27  Pedro Alves  <palves@redhat.com>

* symtab.c (COMPLETION_LIST_ADD_SYMBOL)
(MCOMPLETION_LIST_ADD_SYMBOL): Delete macros, replace with ...
(completion_list_add_symbol, completion_list_add_msymbol):
... these new functions.
(add_symtab_completions)
(default_make_symbol_completion_list_break_on_1): Adjust.

7 years agoobjfile_per_bfd_storage non-POD
Pedro Alves [Tue, 27 Jun 2017 15:22:08 +0000 (16:22 +0100)] 
objfile_per_bfd_storage non-POD

A following patch will want to add a std::vector to
objfile_per_bfd_storage.  That makes it non-trivially
constructible/destructible.  Since objfile_per_bfd_storage objects are
allocated on an obstack, we need to call their ctors/dtors manually.
This is what this patch does.  And then since we can now rely on
ctors/dtors being run, make objfile_per_bfd_storage::storage_obstack
be an auto_obstack.

gdb/ChangeLog:
2017-06-27  Pedro Alves  <palves@redhat.com>

* objfiles.c (get_objfile_bfd_data): Call bfd_alloc instead of
bfd_zalloc.  Call objfile_per_bfd_storage's ctor.
(free_objfile_per_bfd_storage): Call objfile_per_bfd_storage's
dtor.
* objfiles.h (objfile_per_bfd_storage): Add ctor.  Make
'storage_obstack' field an auto_obstack.  In-class initialize all
non-bitfield fields.  Make minsyms_read bool.
* symfile.c (read_symbols): Adjust.

7 years agoRemove MAX_REGISTER_SIZE from remote-sim.c
Alan Hayward [Tue, 27 Jun 2017 12:10:16 +0000 (13:10 +0100)] 
Remove MAX_REGISTER_SIZE from remote-sim.c

gdb/
* remote-sim.c (gdbsim_fetch_register): Use byte_vector.
(gdbsim_store_register): Likewise.

7 years agoRemove debugging accidentally left in tekhex.c.
Nick Clifton [Tue, 27 Jun 2017 11:11:22 +0000 (12:11 +0100)] 
Remove debugging accidentally left in tekhex.c.

* tekhex.c (pass_over): Revert accidental conversion of a local
array to a static array.

7 years agoEliminate make_cleanup_obstack_free, introduce auto_obstack
Pedro Alves [Tue, 27 Jun 2017 10:07:14 +0000 (11:07 +0100)] 
Eliminate make_cleanup_obstack_free, introduce auto_obstack

This commit eliminates make_cleanup_obstack_free, replacing it with a
new auto_obstack type that inherits obstack to add cdtors.

These changes in the parsers may not be obvious:

 -  obstack_init (&name_obstack);
 -  make_cleanup_obstack_free (&name_obstack);
 +  name_obstack.clear ();

Here, the 'name_obstack' variable is a global.  The change means that
the obstack's contents from a previous parse will stay around until
the next parsing starts.  I.e., memory won't be reclaimed until then.
I don't think that's a problem, these objects don't really grow much
at all.

The other option I tried was to add a separate type that is like
auto_obstack but manages an external obstack, just for those cases.  I
like the current approach better as that other approach adds more
boilerplate and yet another type to learn.

gdb/ChangeLog:
2017-06-27  Pedro Alves  <palves@redhat.com>

* c-exp.y (name_obstack): Now an auto_obstack.
(yylex): Use auto_obstack::clear.
(c_parse): Use auto_obstack::clear instead of reinitializing and
freeing the obstack.
* c-lang.c (evaluate_subexp_c): Use auto_obstack.
* d-exp.y (name_obstack): Now an auto_obstack.
(yylex): Use auto_obstack::clear.
(d_parse): Use auto_obstack::clear instead of reinitializing and
freeing the obstack.
* dwarf2loc.c (fetch_const_value_from_synthetic_pointer): Use
auto_obstack.
* dwarf2read.c (create_addrmap_from_index)
(dwarf2_build_psymtabs_hard)
(update_enumeration_type_from_children): Likewise.
* gdb_obstack.h (auto_obstack): New type.
* go-exp.y (name_obstack): Now an auto_obstack.
(build_packaged_name): Use auto_obstack::clear.
(go_parse): Use auto_obstack::clear instead of reinitializing and
freeing the obstack.
* linux-tdep.c (linux_make_mappings_corefile_notes): Use
auto_obstack.
* printcmd.c (printf_wide_c_string, ui_printf): Use auto_obstack.
* rust-exp.y (work_obstack): Now an auto_obstack.
(rust_parse, rust_lex_tests): Use auto_obstack::clear instead of
reinitializing and freeing the obstack.
* utils.c (do_obstack_free, make_cleanup_obstack_free): Delete.
(host_char_to_target): Use auto_obstack.
* utils.h (make_cleanup_obstack_free): Delete declaration.
* valprint.c (generic_emit_char, generic_printstr): Use
auto_obstack.

7 years agoFix PR 13402
Senthil Kumar Selvaraj [Tue, 27 Jun 2017 09:16:08 +0000 (14:46 +0530)] 
Fix PR 13402

Fix incorrect adjustment of diff relocs when relaxing, and thus the
resulting source line to address mismatch.

Fix two issues when adjusting diff relocs to account for
deleted bytes.

1. Don't adjust the difference if the end address is the shrinked
insn's address i.e. use < instead of <=. The relaxation code deletes
count bytes from or after shrinked_insn_address, so the difference
between start_address and end_address should remain unchanged in this
case.

2. Adjust the reloc addend if the difference is to be adjusted and
symval + reloc addend is past the shrinked insn address. This is
because for a typical sym1 - sym2 diff reloc, sym1 is .text +
irel->r_addend, and the addend should be reduced to account for the
shrinked insn.

For example, assume the reloc value is .text + 0x8 with .text = 0, the
diff value in the object file = 0x4, and shrinked_insn_address = 0x4
with count = 0x2. Then the existing code writes 0x2 into the object
file to account for the deleted bytes, as shrinked_insn_address lies
between 0x8 and 0x8 - 0x4 = 0x4, but leaves the addend as is. The next
time the reloc is looked at, the code sees if a shrinked_insn_address
lies between 0x8 and 0x8 - 0x2 = 0x6, instead of 0x6 and 0x4. If there
happens to be one, then the diff value in the object file ends up
getting reduced again.

bfd/

2017-06-27  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

PR ld/13402
* elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust
reloc addend if necessary. Adjust diff only if
shrinked_insn_address < end_address.

ld/

2017-06-27  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

PR ld/13402
* testsuite/ld-avr/pr13402.d: New test.
* testsuite/ld-avr/pr13402.s: New test.

7 years agodarwin: Do not add a dummy thread
Simon Marchi [Tue, 27 Jun 2017 08:55:36 +0000 (10:55 +0200)] 
darwin: Do not add a dummy thread

Starting a process on macOS/Darwin currently leads to this error:

/Users/simark/src/binutils-gdb/gdb/darwin-nat.c:383: internal-error: void darwin_check_new_threads(struct inferior *): Assertion `tp' failed.

with the corresponding partial backtrace (sorry, taken with lldb,
because well, gdb is broken :)):

    frame #9: 0x000000010004605a gdb`darwin_check_new_threads(inf=0x0000000100edf670) at darwin-nat.c:383
    frame #10: 0x0000000100045848 gdb`darwin_init_thread_list(inf=0x0000000100edf670) at darwin-nat.c:1710
    frame #11: 0x00000001000452f8 gdb`darwin_ptrace_him(pid=8375) at darwin-nat.c:1792
    frame #12: 0x0000000100041d95 gdb`fork_inferior(...) at fork-inferior.c:440
    frame #13: 0x0000000100043f82 gdb`darwin_create_inferior(...) at darwin-nat.c:1841
    frame #14: 0x000000010034ac32 gdb`run_command_1(args=0x0000000000000000, from_tty=1, tbreak_at_main=1) at infcmd.c:611

The issue was introduced by commit

  "Share fork_inferior et al with gdbserver"

because it changed the place where the dummy thread (pid, 0, 0) is added,
relative to the call to the init_trace_fun callback.  In this callback, darwin
checks for new threads in the program (there should be exactly one) in order to
update this dummy thread with the right tid.  Previously, things happened in
this order:

 - fork_inferior calls fork()
 - fork_inferior adds dummy thread
 - fork_inferior calls init_trace_fun callback, which updates the dummy
   thread info

Following the commit mentioned above, the new thread is added in the
darwin-nat code, after having called fork_inferior (in
darwin_create_inferior).  So gdb tries to do things in this order:

 - fork_inferior calls fork()
 - fork_inferior calls init_trace_fun callback, which tries to update
   the dummy thread info
 - darwin_create_inferior adds the dummy thread

The error happens while trying to update the dummy thread that has not
been added yet.

I don't think this dummy thread is necessary for darwin.  Previously, it
was fork_inferior that was adding this thread, for all targets, so
darwin had to deal with it.  Now that it's done by targets themselves,
we can just skip that on darwin.  darwin_check_new_threads called
indirectly by init_trace_fun/darwin_ptrace_him will simply notice the
new thread and add it with the right information.

My level of testing was: try to start a process and try to attach to a
process, and it seems to work somewhat like it did before.  I tried to
run the testsuite, but it leaves a huge amount of zombie processes that
launchd doesn't seem to reap, leading to exhaustion of system resources
(number of processes).

gdb/ChangeLog:

* darwin-nat.c (darwin_check_new_threads): Don't handle dummy
thread.
(darwin_init_thread_list): Don't update dummy thread.
(darwin_create_inferior, darwin_attach): Don't add a dummy thread.

7 years agoWarning fix
Alan Modra [Tue, 27 Jun 2017 05:13:49 +0000 (14:43 +0930)] 
Warning fix

PR binutils/21665
* libbfd.c (_bfd_generic_get_section_contents): Warning fix.
(_bfd_generic_get_section_contents_in_window): Likewise.

7 years agoMIPS/GAS/testsuite: Drop the `mips16e-' prefix from SAVE/RESTORE tests
Maciej W. Rozycki [Tue, 27 Jun 2017 03:23:54 +0000 (04:23 +0100)] 
MIPS/GAS/testsuite: Drop the `mips16e-' prefix from SAVE/RESTORE tests

In preparation to running these tests against regular MIPS instructions.

gas/
* testsuite/gas/mips/mips16e-save.d: Rename to...
* testsuite/gas/mips/save.d: ... this.
* testsuite/gas/mips/mips16e-save-err.d: Update the
`error-output' option and rename to...
* testsuite/gas/mips/save-err.d: ... this.
* testsuite/gas/mips/mips16e-save-err.l: Rename to...
* testsuite/gas/mips/save-err.l: ... this.
* testsuite/gas/mips/mips16e-save.s: Rename to...
* testsuite/gas/mips/save.s: ... this.
* testsuite/gas/mips/mips16e-save-err.s: Rename to...
* testsuite/gas/mips/save-err.s: ... this.
* testsuite/gas/mips/mips.exp: Rename `mips16e-save' and
`mips16e-save-err' invocations to `save' and `save-err'
respectively and reorder these tests away from MIPS16 tests.

7 years agoMIPS/GAS/testsuite: Run SAVE/RESTORE tests across all MIPS16e architectures
Maciej W. Rozycki [Tue, 27 Jun 2017 03:23:54 +0000 (04:23 +0100)] 
MIPS/GAS/testsuite: Run SAVE/RESTORE tests across all MIPS16e architectures

gas/
* testsuite/gas/mips/mips16e-save.d: Remove `-mmips:isa32
-mmips:16' from `objdump' flags and `-march=mips32 -mips16' from
`as' flags.
* testsuite/gas/mips/mips16e-save-err.d: Remove `-march=mips32'
from `as' flags.
* testsuite/gas/mips/mips16e-save.s: Remove the `.set mips16'
pseudo-op.
* testsuite/gas/mips/mips16e-save-err.s: Likewise.
* testsuite/gas/mips/mips.exp: Run SAVE/RESTORE tests across all
MIPS16e architectures.

7 years agoMIPS/GAS/testsuite: Convert `mips16e-save-err' list test to a dump test
Maciej W. Rozycki [Tue, 27 Jun 2017 03:23:54 +0000 (04:23 +0100)] 
MIPS/GAS/testsuite: Convert `mips16e-save-err' list test to a dump test

gas/
* testsuite/gas/mips/mips16e-save-err.d: New test.
* gas/testsuite/gas/mips/mips.exp: Fold `mips16e-save-err' list
test into the new test.

7 years agoMIPS/GAS/testsuite: Capitalize the name of the `mips16e-save' test
Maciej W. Rozycki [Tue, 27 Jun 2017 03:23:53 +0000 (04:23 +0100)] 
MIPS/GAS/testsuite: Capitalize the name of the `mips16e-save' test

For consistency with the subsequent changes in this area.

gas/
* testsuite/gas/mips/mips16e-save.d: Capitalize the `name'
option.

7 years agoMIPS/LD/testsuite: mips-elf-flags: Add MIPS ABI Flags handling
Maciej W. Rozycki [Tue, 27 Jun 2017 01:58:27 +0000 (02:58 +0100)] 
MIPS/LD/testsuite: mips-elf-flags: Add MIPS ABI Flags handling

Complement commit 351cdf24d223 ("[MIPS] Implement O32 FPXX, FP64 and
FP64A ABI extensions") and add optional MIPS ABI Flags handling to
`good_combination' in the `mips-elf-flags.exp' test script.  This lets
callers of this procedure request to examine MIPS ABI Flags in addition
to the `e_flags' member of the ELF file header so as to verify that
flags are merged correctly by LD.  The presence of further arguments
triggers this verification, in which case `readelf' is called with the
`-A' option additionally specified and the ISA member, the ISA Extension
member and the ASEs member will be examined as per the arguments.

Unlike with `readelf -h' output consider a failure to retrieve the
member requested a test case failure rather than an unresolved result.
This is because unlike with the `e_flags' member of the ELF file header
which is always there in any valid ELF file the MIPS ABI Flags structure
is optional in LD output and the absence of this structure when expected
is surely a bug in LD.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination):
Add an `args' final argument and examination code for `readelf
-A' output.  Update procedure description accordingly.

7 years agoMIPS/LD/testsuite: mips-elf-flags: Use `remote_exec' to call `readelf'
Maciej W. Rozycki [Tue, 27 Jun 2017 01:58:27 +0000 (02:58 +0100)] 
MIPS/LD/testsuite: mips-elf-flags: Use `remote_exec' to call `readelf'

For ELF file header flag verification done in `good_combination' in the
`mips-elf-flags.exp' test script the version of `readelf' built along
with the rest of binutils has to be used rather than any such executable
already present on the build system, so that flags recognized by the
tool match those supported by LD being tested.  Use `remote_exec' as
elsewhere in the LD test framework and also with GAS and LD used here,
getting and arranging for extra reporting of `readelf' calls included in
test logs on this occasion as well.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination):
Use `remote_exec' to call `readelf'.  Log the command issued.

7 years agoMIPS/LD/testsuite: mips-elf-flags: Use `-h' only with `readelf'
Maciej W. Rozycki [Tue, 27 Jun 2017 01:58:27 +0000 (02:58 +0100)] 
MIPS/LD/testsuite: mips-elf-flags: Use `-h' only with `readelf'

For the purpose of link-time object compatibility handling verification
code in the `good_combination' procedure from the `mips-elf-flags.exp'
test script only examines the `e_flags' member of the ELF file header
and ignores data from any ELF program or section headers present.  Use
`readelf -h' rather than `readelf --headers' then to obtain data for
examination, avoiding unnecessary processing to extract this extraneous
information.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination):
Use `readelf -h' rather than `readelf --headers'.

7 years agoRISC-V: Use pc-relative relocation for FDE initial location
Kuan-Lin Chen [Thu, 8 Jun 2017 18:54:14 +0000 (11:54 -0700)] 
RISC-V: Use pc-relative relocation for FDE initial location

The symbol address in .eh_frame may be adjusted in
_bfd_elf_discard_section_eh_frame, and the content of .eh_frame will be
adjusted in _bfd_elf_write_section_eh_frame. Therefore, we cannot insert
a relocation whose addend symbol is in .eh_frame. Othrewise, the value
may be adjusted twice.

bfd/ChangeLog
2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>

* elfnn-riscv.c (perform_relocation): Support the new
R_RISCV_32_PCREL relocation.
(riscv_elf_relocate_section): Likewise.
* elfxx-riscv.c (howto_table): Likewise.
(riscv_reloc_map): Likewise.
* bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
* libbfd.h: Regenerate.

gas/ChangeLog
2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>

* config/tc-riscv.c (md_apply_fix) [BFD_RELOC_32]: Convert to a
R_RISCV_32_PCREL relocation.

include/ChangeLog
2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>

* elf/riscv.h (R_RISCV_32_PCREL): New.

7 years agoMore fixes for bfd_get_section_contents change
Alan Modra [Tue, 27 Jun 2017 00:15:04 +0000 (09:45 +0930)] 
More fixes for bfd_get_section_contents change

PR binutils/21665
* libbfd.c (_bfd_generic_get_section_contents): Delete abort.
Use unsigned file pointer type, and remove cast.
* libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
Add "count", not "sz".

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 27 Jun 2017 00:01:02 +0000 (00:01 +0000)] 
Automatic date update in version.in

7 years agoFix GDB regressions caused by previous bfd_get_section_contents changes
Pedro Alves [Mon, 26 Jun 2017 23:21:25 +0000 (00:21 +0100)] 
Fix GDB regressions caused by previous bfd_get_section_contents changes

Ref: https://sourceware.org/ml/binutils/2017-06/msg00343.html

bfd/ChangeLog:
2017-06-26  Pedro Alves  <palves@redhat.com>

PR binutils/21665
* libbfd.c (_bfd_generic_get_section_contents): Add "count", not
"sz".

7 years agoAdd a missing line to _bfd_generic_get_section_contents_in_window
H.J. Lu [Mon, 26 Jun 2017 22:47:16 +0000 (15:47 -0700)] 
Add a missing line to _bfd_generic_get_section_contents_in_window

PR binutils/21665
* libbfd.c (_bfd_generic_get_section_contents_in_window): Add
a missing line.

7 years agoMIPS/BFD: Consistently mark the LSI CW4010 as a MIPS II processor
Maciej W. Rozycki [Mon, 26 Jun 2017 18:20:50 +0000 (19:20 +0100)] 
MIPS/BFD: Consistently mark the LSI CW4010 as a MIPS II processor

Make BFD agree with GAS and mark the LSI MiniRISC CW4010 processor core
(for an odd reason referred to as LSI R4010 across our code base) as a
MIPS II processor in BFD as well, fixing a bug that has been there since
forever and addressing linker warnings like:

$ as -m4010 empty.s -o 4010.o
$ ld -r 4010.o -o 4010-r.o
ld: 4010.o: warning: Inconsistent ISA between e_flags and .MIPS.abiflags
$

due to the ISA level being recorded as MIPS III in ELF file header's
`e_flags' vs MIPS II in the MIPS ABI Flags section:

$ readelf -Ah 4010.o
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          348 (bytes into file)
  Flags:                             0x20821000, 4010, o32, mips3
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         11
  Section header string table index: 10
Attribute Section: gnu
File Attributes
  Tag_GNU_MIPS_ABI_FP: Hard float (double precision)

MIPS ABI Flags Version: 0

ISA: MIPS2
GPR size: 32
CPR1 size: 32
CPR2 size: 0
FP ABI: Hard float (double precision)
ISA Extension: LSI R4010
ASEs:
None
FLAGS 1: 00000000
FLAGS 2: 00000000
$

Available documentation[1][2] clearly indicates the LSI CW4010 processor
is only backwards compatible with the MIPS R4000 processor as far as the
latter's 32-bit instructions are concerned and consequently can only be
considered a MIPS II ISA implementation (with vendor extensions).

This fixes an LD testsuite failure:

FAIL: MIPS incompatible objects:  "-march=r4010 -32"      "-march=r4650 -32"

triggered for the `mips-sgi-irix5' and `mips-sgi-irix6' targets.

References:

[1] Paul Cobb, Bob Caulk, Joe Cesana, "The MiniRISC CW4010: A
    Superscalar MIPS Processor ASIC Core", LSI Logic, July 1995,
    presented at Hot Chips VII, Stanford University, Stanford,
    California, August 1995

[2] "MiniRISC MR4010 Superscalar Microprocessor Reference Device", LSI
    Logic, November 1996, Doc. No. DB09-000028-00, Order No. C15017

bfd/
* cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
* elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
(mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
`bfd_mach_mips6000' rather than `bfd_mach_mips4000'.

ld/
* testsuite/ld-mips-elf/lsi-4010-isa.d: New test.
* ld/testsuite/ld-mips-elf/mips-elf.exp: Run the new test.

7 years agoCheck file size before getting section contents
H.J. Lu [Mon, 26 Jun 2017 16:24:49 +0000 (09:24 -0700)] 
Check file size before getting section contents

Don't check the section size in bfd_get_full_section_contents since
the size of a decompressed section may be larger than the file size.
Instead, check file size in _bfd_generic_get_section_contents.

PR binutils/21665
* compress.c (bfd_get_full_section_contents): Don't check the
file size here.
* libbfd.c (_bfd_generic_get_section_contents): Check for and
reject a section whoes size + offset is greater than the size
of the entire file.
(_bfd_generic_get_section_contents_in_window): Likewise.

7 years agoLD: Fix .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX
Maciej W. Rozycki [Mon, 26 Jun 2017 15:08:55 +0000 (16:08 +0100)] 
LD: Fix .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX

Correct .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX targets,
complementing commit dc74becf498f ("ld: Add tests for -Ur") and commit
da614360f520 ("ld: Add tests for .startof.SECNAME/.sizeof.SECNAME") with
subsequent updates, and in reference to commit cbd0eecf261c ("Always
define referenced __start_SECNAME/__stop_SECNAME") and commit
7dba9362c172 ("Rewrite __start and __stop symbol handling").

These targets set the STT_OBJECT type for non-function symbol
references, according to `elf_frob_symbol' code in gas/config/obj-elf.c:

  /* The Irix 5 and 6 assemblers set the type of any common symbol and
     any undefined non-function symbol to STT_OBJECT.  We try to be
     compatible, since newer Irix 5 and 6 linkers care.  However, we
     only set undefined symbols to be STT_OBJECT if we are on Irix,
     because that is the only time gcc will generate the necessary
     .global directives to mark functions.  */

  if (S_IS_COMMON (symp))
    symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;

  if (strstr (TARGET_OS, "irix") != NULL
      && ! S_IS_DEFINED (symp)
      && (symbol_get_bfdsym (symp)->flags & BSF_FUNCTION) == 0)
    symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;

and consequently entries in the symbol table listing from `readelf'
produced with these tests do not match the NOTYPE pattern expected,
causing test suite failures:

FAIL: ld-elf/sizeofa
FAIL: ld-elf/sizeofc
FAIL: ld-elf/startofa
FAIL: ld-elf/startofc

specifically with the `mips-sgi-irix5' and `mips-sgi-irix6' targets.

Given that it does not matter for the feature covered by these tests
whether the type of the symbols produced is STT_NOTYPE or STT_OBJECT
adjust the problematic cases to accept either type, removing the
failures observed.

ld/
* testsuite/ld-elf/sizeofa.d: Also accept the OBJECT type for
the symbols examined.
* testsuite/ld-elf/sizeofc.d: Likewise.
* testsuite/ld-elf/startofa.d: Likewise.
* testsuite/ld-elf/startofc.d: Likewise.

7 years agorecord-full: Remove unused function netorder16
Simon Marchi [Mon, 26 Jun 2017 13:08:36 +0000 (15:08 +0200)] 
record-full: Remove unused function netorder16

clang shows this warning:

  /home/emaisin/src/binutils-gdb/gdb/record-full.c:2344:1: error: unused function 'netorder16' [-Werror,-Wunused-function]
  netorder16 (uint16_t input)
  ^

Remove this function, which, AFAIK, has never been used.  Note that GCC
doesn't warn about this, because the function is marked as inline.
According to gcc's man page, it should ideed not warn:

  -Wunused-function
    Warn whenever a static function is declared but not defined or a non-inline static function is unused.  This warning is enabled by -Wall.

So it's probably not a GCC bug that it doesn't find this unused function, but a
different definition of "unused".

gdb/ChangeLog:

* record-full.c (netorder16): Remove.

7 years agovec: Silence -Wunused-function warnings on clang
Simon Marchi [Mon, 26 Jun 2017 13:08:35 +0000 (15:08 +0200)] 
vec: Silence -Wunused-function warnings on clang

clang has a too aggressive (or broken, depends on how you want to see
it) -Wunused-function warning, which is triggered by the functions
defined by DEF_VEC_* but not used in the current source file.  Normally,
it won't warn about unused static inline functions defined in header
files, because it's expected that a source file won't use all functions
defined in a header file it includes.  However, if the DEF_VEC_* macro
is used in a source file, it considers those functions as defined in the
source file, which leads it to think that we should remove those
functions.  It is therefore missing a check to see whether those
functions are resulting from macro expansion.  A bug already exists for
that:

  https://bugs.llvm.org//show_bug.cgi?id=22712

It's quite easy to silence this warning in a localized way, that is in
the DEF_VEC_* macros.

gdb/ChangeLog:

* common/diagnostics.h: Define macros for GCC.
(DIAGNOSTIC_IGNORE_UNUSED_FUNCTION): New macro.
* common/vec.h: Include diagnostics.h.
(DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION): New macro.
(DEF_VEC_I, DEF_VEC_P, DEF_VEC_O): Ignore -Wunused-function
warning.

7 years agoada-lex: Ignore warnings about register keyword
Simon Marchi [Mon, 26 Jun 2017 13:08:35 +0000 (15:08 +0200)] 
ada-lex: Ignore warnings about register keyword

Some older versions of flex (such as the one shipped with macOS) generate
code that use the register keyword, which clang warns about.  This patch
makes the compiler ignore those warnings for the portion of the code
generated by flex.

gdb/ChangeLog:

* common/diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER):
New macro.
* ada-lex.l: Ignore deprecated register warnings.

7 years agoFix address violation parsing a corrupt texhex format file.
Nick Clifton [Mon, 26 Jun 2017 14:46:34 +0000 (15:46 +0100)] 
Fix address violation parsing a corrupt texhex format file.

PR binutils/21670
* tekhex.c (getvalue): Check for the source pointer exceeding the
end pointer before the first byte is read.

7 years agoFix address violations when atempting to parse fuzzed binaries.
Nick Clifton [Mon, 26 Jun 2017 14:25:08 +0000 (15:25 +0100)] 
Fix address violations when atempting to parse fuzzed binaries.

PR binutils/21665
bfd * opncls.c (get_build_id): Check that the section is beig enough
to contain the whole note.
* compress.c (bfd_get_full_section_contents): Check for and reject
a section whoes size is greater than the size of the entire file.
* elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
contain a notes section.

binutils* objdump.c (disassemble_section): Skip any section that is bigger
than the entire file.

7 years agoProduce a consistent warning message when attempting to run a tool on a directory.
Nick Clifton [Mon, 26 Jun 2017 12:25:41 +0000 (13:25 +0100)] 
Produce a consistent warning message when attempting to run a tool on a directory.

PR binutils/21659
* bucomm.c (get_file_size): Explicitly warn if the file is a
directory.

7 years agoCheck unsupported .symver with common symbol
H.J. Lu [Mon, 26 Jun 2017 12:11:07 +0000 (05:11 -0700)] 
Check unsupported .symver with common symbol

The .symver directive on common symbol creates a new common symbol,
which shouldn't be allowed, similar to alias on common symbol:

$ cat y.S
.comm bar,8,8
 .set bar1,bar
$ as -o y.o y.S
y.S: Assembler messages:
y.S:2: Error: `bar1' can't be equated to common symbol 'bar'
$

PR gas/21661
* config/obj-elf.c (obj_elf_symver): Don't allow .symver with
common symbol.
(elf_frob_symbol): Likewise.
* testsuite/gas/elf/elf.exp: Run pr21661.
* testsuite/gas/elf/pr21661.d: New file.
* testsuite/gas/elf/pr21661.s: Likewise.

7 years agoAdd pgste marker changelog
Andreas Krebbel [Mon, 26 Jun 2017 09:07:17 +0000 (11:07 +0200)] 
Add pgste marker changelog

7 years agoS/390: Fix testsuite segfault added with recent pgste patch.
Andreas Krebbel [Mon, 26 Jun 2017 09:01:58 +0000 (11:01 +0200)] 
S/390: Fix testsuite segfault added with recent pgste patch.

The recent pgste patch caused several testcases to fail with a
segfault.  Fixed with this patch by adding NULL pointer checks.

regression-tested on s390x.

bfd/ChangeLog:

2017-06-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* elf64-s390.c (elf_s390_additional_program_headers): Add NULL
pointer checks.
(elf_s390_modify_segment_map): Likewise.
(bfd_elf_s390_set_options): Lisewise.

7 years agoFix compile time warning building gas for arm-wince target.
Nick Clifton [Mon, 26 Jun 2017 08:28:51 +0000 (09:28 +0100)] 
Fix compile time warning building gas for arm-wince target.

* config/tc-arm.c (fpu_any): Only define for ELF based targets.

7 years agoUpdate check conditions for illegal placed instructions.
claziss [Wed, 7 Jun 2017 13:57:56 +0000 (15:57 +0200)] 
Update check conditions for illegal placed instructions.

ARC cpus do not accept any jump or instructions with long immediate
into the delay slots.

gas/
2017-06-07  Claudiu Zissulescu  <claziss@synopsys.com>

* /config/tc-arc.c (is_br_jmp_insn_p): Update macro with known
instructions to be accounted as jumps.
(assemble_insn): Check for limms into the delay slots.  Emit an
error if so.
* testsuite/gas/arc/asm-errors-3.d: New file.
* testsuite/gas/arc/asm-errors-3.err: Likewise.
* testsuite/gas/arc/asm-errors-3.s: Likewise.

This page took 0.060714 seconds and 4 git commands to generate.