]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
5 years agoRegenerate files and add changelog entries for 2.31.1 release binutils-2_31_1
Nick Clifton [Wed, 18 Jul 2018 07:54:05 +0000 (08:54 +0100)] 
Regenerate files and add changelog entries for 2.31.1 release

5 years agoFix typo in src-release.sh script. Update French translation for gold and Spanish...
Nick Clifton [Wed, 18 Jul 2018 07:35:24 +0000 (08:35 +0100)] 
Fix typo in src-release.sh script.  Update French translation for gold and Spanish translation for ld.

gold * po/fr.po: Updated French translation.
ld * po/es.po: Updated Spanish translation.
. * (DEVO_SUPPORT): Fix typo in previous delta.
(do_proto_toplev): Add --quiet option to configure command line.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 18 Jul 2018 00:01:46 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 17 Jul 2018 00:02:04 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoImport patch from mainline to fix gold's handling of already versioned symbols.
Nick Clifton [Mon, 16 Jul 2018 13:29:26 +0000 (14:29 +0100)] 
Import patch from mainline to fix gold's handling of already versioned symbols.

gold PR gold/23409
* symtab.cc (Symbol_table::define_special_symbol): Add check for
version name on existing symbol.
* testsuite/Makefile.am (ver_test_pr23409): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/ver_test_pr23409.sh: New test script.
* testsuite/ver_test_pr23409_1.script: New version script.
* testsuite/ver_test_pr23409_2.script: New version script.

5 years agoAdd the new top level files test-driver and ar-lib to the src-release script.
Nick Clifton [Mon, 16 Jul 2018 13:11:57 +0000 (14:11 +0100)] 
Add the new top level files test-driver and ar-lib to the src-release script.

* src-release.sh (DEVO_SUPPORT): Add test-driver and ar-lib.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 16 Jul 2018 00:01:59 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 15 Jul 2018 00:02:24 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoReset branch back to development mode
Nick Clifton [Sat, 14 Jul 2018 18:39:32 +0000 (19:39 +0100)] 
Reset branch back to development mode

5 years ago2.31 Release point binutils-2_31
Nick Clifton [Sat, 14 Jul 2018 18:05:56 +0000 (19:05 +0100)] 
2.31 Release point

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

5 years agoAllow bit-patterns in the immediate field of ARM neon mov instructions.
Nick Clifton [Fri, 13 Jul 2018 10:44:49 +0000 (11:44 +0100)] 
Allow bit-patterns in the immediate field of ARM neon mov instructions.

* config/tc-arm.c (do_neon_mov): When converting an integer
immediate into a floating point value, check that the conversion
is valid.  Also warn if the immediate is valid as both a floating
point value and a bit pattern.
* testsuite/gas/arm/vfp-mov-enc.s: Add instructions that use
floating point bit patterns.
* testsuite/gas/arm/vfp-mov-enc.d: Add regexps for the disassembly
of the new insns.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Jul 2018 00:02:29 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoHide dynamic symbols in discarded sections
Alan Modra [Tue, 3 Jul 2018 02:48:10 +0000 (12:18 +0930)] 
Hide dynamic symbols in discarded sections

This is a followup to git commit 97196564c7 "Strip global symbol
defined in discarded section".  If a symbol defined in a discarded
section was dynamic, that patch left .dynsym with holes (ie. all zero
entries).  For example, the following from libstdc++.so:

Symbol table '.dynsym' contains 6090 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000000a74e0     0 SECTION LOCAL  DEFAULT   10
     2: 0000000000264180     0 SECTION LOCAL  DEFAULT   17
     3: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_addUserCommitAction
     4: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_memcpyRtWn
     5: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
readelf: Warning: local symbol 5 found at index >= .dynsym's sh_info value of 3
     6: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
readelf: Warning: local symbol 6 found at index >= .dynsym's sh_info value of 3
[snip]

This patch removes the symbols from .dynsym too.

PR 17550
* elflink.c (_bfd_elf_fix_symbol_flags): Hide dynamic symbols
in discarded sections.

(cherry picked from commit af0bfb9c4283ce80fe37ad6360d12cae8ec38696)

5 years agoThis patch adds support for the SSBB and PSSBB speculation barrier instructions to...
Nick Clifton [Thu, 12 Jul 2018 14:50:35 +0000 (15:50 +0100)] 
This patch adds support for the SSBB and PSSBB speculation barrier instructions to the AArch64 assembler and disassembler.

For more details see: https://static.docs.arm.com/ddi0596/a/DDI_0596_ARM_a64_instruction_set_architecture.pdf

opcodes * aarch64-tbl.h (aarch64_opcode_table): Add entry for
ssbb and pssbb and update dsb flags to F_HAS_ALIAS.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.

gas * testsuite/gas/aarch64/system.s: Add test for ssbb
and pssbb.
* testsuite/gas/aarch64/system.d: Update accordingly
and remove explicit addresses.

5 years agoResolve merge conflicts.
Nick Clifton [Thu, 12 Jul 2018 10:27:30 +0000 (11:27 +0100)] 
Resolve merge conflicts.

5 years agoAdd support for the ARM speculation barrier instructions SSBB and PSSBB.
Sudakshina Das [Thu, 12 Jul 2018 10:25:12 +0000 (11:25 +0100)] 
Add support for the ARM speculation barrier instructions SSBB and PSSBB.

opcodes * arm-dis.c (arm_opcodes): Add ssbb and pssbb and move
     csdb together with them.
     (thumb32_opcodes): Likewise.

gas  * config/tc-arm.c (insns): Add new ssbb and pssbb instructions.
     * testsuite/gas/arm/csdb.s: Add new tests for ssbb and pssbb.
     * testsuite/gas/arm/csdb.d: Likewise
     * testsuite/gas/arm/thumb2_it_bad.s: Likewise.
     * testsuite/gas/arm/thumb2_it_bad.l: Likewise.
     * testsuite/gas/arm/barrier.d: Update with ssbb.
     * testsuite/gas/arm/barrier-thumb.d: Likewise.

5 years agoAdd remainder of Em16 restrictions for AArch64 gas.
Tamar Christina [Thu, 12 Jul 2018 09:28:46 +0000 (10:28 +0100)] 
Add remainder of Em16 restrictions for AArch64 gas.

This adds the missing Em16 constraints the rest of the instructions requiring them
and also adds a testcase to test all the instructions so these are checked from
now on.

The Em16 operand constrains the valid registers to the lower 16 registers when used
with a half precision qualifier.

The list has been cross checked (by hand) through the Arm ARM version Ca.

opcodes/

PR binutils/23192
* aarch64-tbl.h (sqdmlal, sqdmlal2, smlsl, smlsl2, sqdmlsl, sqdmlsl2,
mul, smull, smull2, sqdmull, sqdmull2, sqdmulh, sqrdmulh, mla, umlal,
umlal2, mls, umlsl, umlsl2, umull, umull2, sqdmlal, sqdmlsl, sqdmull,
sqdmulh, sqrdmulh): Use Em16.

gas/

PR binutils/23192
* testsuite/gas/aarch64/illegal-by-element.s: New.
* testsuite/gas/aarch64/illegal-by-element.d: New.
* testsuite/gas/aarch64/illegal-by-element.l: New.

(cherry picked from commit 45a28947f3fe5693560e9a1d6373807a9e82c04a)
Signed-off-by: Tamar Christina <tamar.christina@arm.com>
5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 12 Jul 2018 00:01:43 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoxtensa: don't emit dynamic relocation for weak undefined symbol
Max Filippov [Mon, 2 Jul 2018 18:12:44 +0000 (11:12 -0700)] 
xtensa: don't emit dynamic relocation for weak undefined symbol

Resolved reference to a weak undefined symbol in PIE must not have
a dynamic relative relocation against itself, otherwise the value of a
reference will be changed from 0 to the base of executable, breaking
code like the following:

  void weak_function (void);
  if (weak_function)
    weak_function ();

This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc
testsuite.

bfd/
2018-07-11  Max Filippov  <jcmvbkbc@gmail.com>

* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
space for dynamic relocation for undefined weak symbol.
(elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
relocation for undefined weak symbols.
(shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
section for relocations against undefined weak symbols.

(cherry picked from commit c451bb34ae8bd2d0669bd563366883cfbcf0de9b)

5 years agoDuplicate code update.
Nick Clifton [Wed, 11 Jul 2018 15:46:47 +0000 (16:46 +0100)] 
Duplicate code update.

5 years agoReimport a patch to fix building gold on Cygwin64 systms: m.arena has size_t on Cygwi...
Franz Sirl [Wed, 11 Jul 2018 15:44:22 +0000 (16:44 +0100)] 
Reimport a patch to fix building gold on Cygwin64 systms: m.arena has size_t on Cygwin64 and thus errors out due to -Werror=format.

gold * main.cc: Print m.arena as long long.

5 years agoFix printing the size of GOLD's memory areana on Cygwin based systems.
Franz Sirl [Wed, 24 Jan 2018 13:39:11 +0000 (13:39 +0000)] 
Fix printing the size of GOLD's memory areana on Cygwin based systems.

I just stumbled over this with 2.29.1 while building a cross-toolchain, on Cygwin64, but it's still the same for 2.30. m.arena has size_t on Cygwin64 and thus errors out due to -Werror=format.

gold
* main.cc: Print m.arena as long long.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Jul 2018 00:02:00 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoBFD/ELF: Correct a `remove' global shadowing error for pre-4.8 GCC
Maciej W. Rozycki [Tue, 10 Jul 2018 23:42:43 +0000 (00:42 +0100)] 
BFD/ELF: Correct a `remove' global shadowing error for pre-4.8 GCC

Remove `-Wshadow' compilation errors:

cc1: warnings being treated as errors
.../bfd/elflink.c: In function 'bfd_elf_final_link':
.../bfd/elflink.c:11722: error: declaration of 'remove' shadows a global declaration
/usr/include/stdio.h:154: error: shadowed declaration is here

which for versions of GCC before 4.8 prevent support for ELF targets
from being built.  See also GCC PR c/53066.

bfd/
* elflink.c (bfd_elf_final_link): Rename `remove' local variable
to `remove_section'.

(cherry picked from commit 5270eddc6ed6b5d8e4e2817491bb44b784fa6f81)

5 years agoFix test for availability of emplace_back.
Cary Coutant [Mon, 9 Jul 2018 23:12:27 +0000 (16:12 -0700)] 
Fix test for availability of emplace_back.

Testing for the GCC version 5 or later isn't right, since C++ 11 support
wasn't enabled by default until later.  This patch tests the C++ standard
support directly instead of inferring it from the GCC version.

gold/
* incremental.cc (Sized_incremental_binary::setup_readers): Use
emplace_back for C++ 11 or later.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Jul 2018 00:02:08 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agobfd: Use changequote for "i[3-7]86-*-linux-*"
H.J. Lu [Mon, 9 Jul 2018 13:51:17 +0000 (06:51 -0700)] 
bfd: Use changequote for "i[3-7]86-*-linux-*"

Use changequote to match "i[3-7]86-*-linux-*", instead of
"i3-786-*-linux-*".

PR ld/23388
* configure.ac: Use changequote for "i[3-7]86-*-linux-*".
* configure: Regenerated.

(cherry picked from commit 872899f1efeda1e93ed569d322c6b2ee85ce885c)

5 years agox86: Remove x86 ISA properties with empty bits
H.J. Lu [Thu, 5 Jul 2018 16:24:07 +0000 (09:24 -0700)] 
x86: Remove x86 ISA properties with empty bits

There is no need to generate x86 ISA properties with empty bits in
linker output.

bfd/

PR ld/23372
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove x86
ISA properties with empty bits.

ld/

PR ld/23372
* testsuite/ld-i386/i386.exp: Run pr23372a and pr23372b.
* testsuite/ld-i386/pr23372a.d: New file.
* testsuite/ld-i386/pr23372a.s: Likewise.
* testsuite/ld-i386/pr23372b.d: Likewise.
* testsuite/ld-i386/pr23372b.s: Likewise.
* testsuite/ld-i386/pr23372c.s: Likewise.
* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372a.d: Likewise.
* testsuite/ld-x86-64/pr23372a.s: Likewise.
* testsuite/ld-x86-64/pr23372b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372b.d: Likewise.
* testsuite/ld-x86-64/pr23372b.s: Likewise.
* testsuite/ld-x86-64/pr23372c.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr23372a, pr23372a-x32,
pr23372b and pr23372b-x32.

(cherry picked from commit 56ad703d56ffe5dc55d5e719a6ec41fd6cf9bfbe)

5 years agoFix diagnostic errors
Alan Modra [Fri, 6 Jul 2018 05:37:08 +0000 (15:07 +0930)] 
Fix diagnostic errors

Fixes a number of build errors like the following
.../elf32-arm.c: In function 'elf32_arm_nabi_write_core_note':
.../elf32-arm.c:2177: error: #pragma GCC diagnostic not allowed inside functions
.../elf32-arm.c:2186: error: #pragma GCC diagnostic not allowed inside functions
See the comment in diagnostics.h.

include/
* diagnostics.h: Comment on macro usage.
bfd/
* elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally.
* elf32-ppc.c (ppc_elf_write_core_note): Likewise.
* elf32-s390.c (elf_s390_write_core_note): Likewise.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
* elf64-s390.c (elf_s390_write_core_note): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.

(cherry picked from commit fe75810f8e0cc33384f22d0479506711d4014c60)

5 years ago[GOLD] PowerPC .gnu.attributes support
Alan Modra [Thu, 5 Jul 2018 15:38:16 +0000 (01:08 +0930)] 
[GOLD] PowerPC .gnu.attributes support

elfcpp/
* powerpc.h (Tag_GNU_Power_ABI_FP): Define.
(Tag_GNU_Power_ABI_Vector, Tag_GNU_Power_ABI_Struct_Return): Define.
gold/
* powerpc.cc: Include attributes.h.
(Powerpc_relobj::attributes_section_data_): New variable, with
accessor and associated constructor and destructor support.
(Powerpc_dynobj::attributes_section_data_): Likewise.
(Powerpc_relobj::do_read_symbols): Stash SHT_GNU_ATTRIBUTES section
contents in attributes_section_data_.
(Powerpc_dynobj::do_read_symbols): Likewise.
(Target_powerpc): Add attributes_section_data_, last_fp_, last_ld_,
last_vec_, and last_struct_ vars.
(Target_powerpc::merge_object_attributes): New function.
(Target_powerpc::do_finalize_sections): Iterate over input objects
merging attributes.  Create output attributes section.

(cherry picked from commit 724436fccb68156ff53b7b03cb7f41547a65c30c)

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Jul 2018 00:02:17 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Jul 2018 00:02:57 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Jul 2018 00:01:59 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoRISC-V: Add riscv-*-* configure support, and minor cleanup.
Jim Wilson [Fri, 6 Jul 2018 00:49:11 +0000 (17:49 -0700)] 
RISC-V: Add riscv-*-* configure support, and minor cleanup.

bfd/
* config.bfd (riscv32*-*-*): Renamed from riscv32-*-*.
(riscv64*-*-*): Likewise.
(riscv-*-*): Add as an alias for riscv32*-*-*.

ld/
* configure.tgt (riscv-*-*): Add as an alias for riscv32*-*-*.

(cherry picked from commit bb11866d6a635fadb9285d18e2fb819d2de2c28c)

5 years agoFix SBO bit in disassembly mask for ldrah on AArch64.
Tamar Christina [Fri, 6 Jul 2018 15:18:19 +0000 (16:18 +0100)] 
Fix SBO bit in disassembly mask for ldrah on AArch64.

The disassembly mask for ldarh incorrectly didn't mask out bit 20 which
is part of the SBO part of the instruction and shouldn't be considered input.

This fixes the wrong bit fixing the disassembly of instructions to
ldarh and makes the behavior consistent.

opcodes/

PR binutils/23242
* aarch64-tbl.h (ldarh): Fix disassembly mask.

(cherry picked from commit f311ba7ed84d66ae2cd77bd969747d7ab959d866)
Signed-off-by: Tamar Christina <tamar.christina@arm.com>
5 years agoFix the read/write flag for these registers on AArch64
Tamar Christina [Fri, 6 Jul 2018 15:15:41 +0000 (16:15 +0100)] 
Fix the read/write flag for these registers on AArch64

The previous constraints were based on information already in opcodes and it
seems that a few of them were wrong.  I have now hand verified the ones changed
by the previous patch and corrected where needed.

This prevents a warning to be issued when one shouldn't be.

opcodes/

PR binutils/23369
* aarch64-opc.c (aarch64_sys_regs): Make read/write csselr_el1,
vsesr_el2, osdtrrx_el1, osdtrtx_el1, pmsidr_el1.

gas/testsuite/

PR binutils/23369
* gas/aarch64/msr.d (csselr_el1,
vsesr_el2, osdtrrx_el1, osdtrtx_el1, pmsidr_el1): New.
* gas/aarch64/msr.s: Likewise.

(cherry picked from commit cba05feb51cb97f75f9a7814b081ce45245ac7b2)
Signed-off-by: Tamar Christina <tamar.christina@arm.com>
5 years agoFix bug generating relocations for notes created by the assembler.
Nick Clifton [Fri, 6 Jul 2018 10:48:15 +0000 (11:48 +0100)] 
Fix bug generating relocations for notes created by the assembler.

* write.c (maybe_generate_build_notes): Bias reloc offsets by the
number of notes already generated.

5 years agoUpdate config.sub
Sebastian Huber [Fri, 6 Jul 2018 06:23:40 +0000 (08:23 +0200)] 
Update config.sub

* config.sub: Sync with upstream version 2018-07-03.

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

5 years agoError for mismatched powerpc ABI tags
Alan Modra [Wed, 4 Jul 2018 01:11:31 +0000 (10:41 +0930)] 
Error for mismatched powerpc ABI tags

And report the two input files that are incompatible rather than
reporting that an input file is incompatible with the output.

bfd/
* elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Update prototype.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Return error
on mismatch.  Remove "warning: " from messages.  Track last bfd
used to set tags.
(ppc_elf_merge_obj_attributes): Likewise.  Handle status from
_bfd_elf_ppc_merge_fp_attributes.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Handle status
from _bfd_elf_ppc_merge_fp_attributes.
ld/
* testsuite/ld-powerpc/attr-gnu-4-12.d: Update expected output.
* testsuite/ld-powerpc/attr-gnu-4-13.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-21.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-31.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-32.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-12-21.d: Likewise.

(cherry picked from commit 4a91d0ba307eb24eb87ad27f4ea8fcde823c3e61)

5 years agoCorrect removal of .gnu.attributes
Alan Modra [Tue, 3 Jul 2018 08:27:36 +0000 (17:57 +0930)] 
Correct removal of .gnu.attributes

Setting SEC_EXCLUDE for empty .gnu.attributes is too late in the link
process for the linker to remove the section.  That must be done in
bfd_elf_final_link, as we do for removed group sections.

* elflink.c (bfd_elf_final_link): Remove zero size .gnu.attributes
sections.

(cherry picked from commit b8a6ced79668ec8af3180e50b76f7517ebbab0d9)

5 years agoGNU attribute output on errors
Alan Modra [Tue, 3 Jul 2018 05:20:38 +0000 (14:50 +0930)] 
GNU attribute output on errors

.gnu.attributes entries from linker input files are merged to the
output file, the output having the union of compatible input
attributes.  Incompatible attributes generally cause a linker error
and no output.  However in some cases only a warning is emitted, and
one of the incompatible input attributes is passed on to the output.

PowerPC tends to emit warnings rather than errors, and the output
takes the first input attribute.  For example, if we have two input
files with Tag_GNU_Power_ABI_FP, the first with a value signifying
"double-precision hard float, IBM long double", the second with a
value signifying "double-precision hard float, IEEE long double",
we'll get a warning about incompatible long double types and the
output will say "double-precision hard float, IBM long double".
The output attribute of course isn't correct.  It would be correct to
specify "IBM and IEEE long double", but we don't have a way to
represent that currently.  While it would be possible to extend the
encoding, there isn't much gain in doing so.  A shared library
providing support for both long double types should link against
objects using either long double type without warning or error.  That
is what you'd get if such a shared library had no Tag_GNU_Power_ABI_FP
attribute.

So this patch provides a way for the backend to omit .gnu.attributes
tags from the output.

* elf-bfd.h (ATTR_TYPE_FLAG_ERROR, ATTR_TYPE_HAS_ERROR): Define.
* elf-attrs.c (is_default_attr): Handle ATTR_TYPE_HAS_ERROR.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Use
ATTR_TYPE_FLAG_INT_VAL.  Set ATTR_TYPE_HAS_ERROR on finding
incompatible attribute.
(ppc_elf_merge_obj_attributes): Likewise.  Return
_bfd_elf_merge_object_attributes result.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Return
_bfd_elf_merge_object_attributes result.

(cherry picked from commit 8d2c8c3d17926826864f4b739362f66af547428f)

5 years agoUpdate config.guess and config.sub
Sebastian Huber [Fri, 29 Jun 2018 11:06:40 +0000 (13:06 +0200)] 
Update config.guess and config.sub

* config.guess: Sync with upstream version 2018-06-26.
* config.sub: Sync with upstream version 2018-07-02.

5 years agold: Set non_ir_ref_regular for --undefined SYMBOL
H.J. Lu [Thu, 5 Jul 2018 11:33:11 +0000 (04:33 -0700)] 
ld: Set non_ir_ref_regular for --undefined SYMBOL

Set non_ir_ref_regular to TRUE for symbols forced into the output file
so that they won't be removed by garbage collection with LTO.

PR ld/23309
* ldlang.c (insert_undefined): Set non_ir_ref_regular to TRUE.
* plugin.c (is_visible_from_outside): Don't scan entry_symbol.
* testsuite/ld-plugin/pr23309.c: New file.
* testsuite/ld-plugin/pr23309.d: Likewise.

(cherry picked from commit 94d401b8b88a76b1372ce44e805516756a4f737b)

5 years agoUpdate Russian, Bulgarian and Brazilian Portuguese translations for various component...
Nick Clifton [Thu, 5 Jul 2018 11:22:14 +0000 (12:22 +0100)] 
Update Russian, Bulgarian and Brazilian Portuguese translations for various components of the binutils.

bfd,gas * po/ru.po: Updated Russian translation.

ld * po/bg.po: Updated Bulgarian translation.
* po/pt_BR.po: Updated Brazilian Portuguese translation.

binutils* po/bg.po: Updated Bulgarian translation.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 5 Jul 2018 00:02:48 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agold: Properly display default for -z separate-code
H.J. Lu [Wed, 4 Jul 2018 13:22:40 +0000 (06:22 -0700)] 
ld: Properly display default for -z separate-code

Check DEFAULT_LD_Z_SEPARATE_CODE to display default for -z separate-code.

PR ld/23358
* lexsup.c (elf_shlib_list_options): Properly display default
for -z separate-code.

(cherry picked from commit b14b7ff14ffe911ec562004304841cf7d2775a19)

5 years agoAlso install diagnostics.h
H.J. Lu [Wed, 4 Jul 2018 13:18:22 +0000 (06:18 -0700)] 
Also install diagnostics.h

Since bfd.h is an installed header, also install diagnostics.h.

* Makefile.am (bfdinclude_HEADERS): Add $(INCDIR)/diagnostics.h.
* Makefile.in: Regenerated.

(cherry picked from commit db40acb0bed088872837f916029d8800c33f9f94)

5 years agox86-64: Clear the R_X86_64_converted_reloc_bit bit
H.J. Lu [Mon, 2 Jul 2018 20:08:09 +0000 (13:08 -0700)] 
x86-64: Clear the R_X86_64_converted_reloc_bit bit

We need to clear the R_X86_64_converted_reloc_bit bit after setting it
to avoid leaking it out by --emit-relocs.

bfd/

PR ld/23324
* elf64-x86-64.c (elf_x86_64_relocate_section): Clear the
R_X86_64_converted_reloc_bit bit.

ld/

PR ld/23324
* testsuite/ld-x86-64/pr23324.s: New file.
* testsuite/ld-x86-64/pr23324a.d: Likewise.
* testsuite/ld-x86-64/pr23324b.d: Likewise.

(cherry picked from commit b638b5d57fafc84a8dc0ff91d7579a3c24aad90c)

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 4 Jul 2018 00:02:46 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 Jul 2018 00:02:48 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 Jul 2018 00:02:40 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 1 Jul 2018 00:02:47 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 30 Jun 2018 00:02:05 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years ago[Patch AArch64] Warn on unpredictable stlxrb , stlxrh and stlxr cases.
Ramana Radhakrishnan [Fri, 29 Jun 2018 12:06:05 +0000 (13:06 +0100)] 
[Patch AArch64] Warn on unpredictable stlxrb , stlxrh and stlxr cases.

A recent case in golang highlighted that gas wasn't warning on these
unpredictable cases in the architecture. Fixed thusly.

I need to audit gcc to make sure we have early clobbers on the
patterns but that's a separate patch.

Tested aarch64-none-elf and gas

Ok ?

Ramana

2018-06-29 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>

        * config/tc-aarch64.c (warn_unpredictable_ldst): Add
        unpredictable cases for ldxp, stlxrb, stlxrh, stlxr.  *
        testsuite/gas/aarch64/diagnostic.s: New tests.  *
        testsuite/gas/aarch64/diagnostic.l: Adjust.

5 years agoFix AArch64 encodings for by element instructions.
Tamar Christina [Fri, 29 Jun 2018 11:12:27 +0000 (12:12 +0100)] 
Fix AArch64 encodings for by element instructions.

Some instructions in Armv8-a place a limitation on FP16 registers that can be
used as the register from which to select an element from.

e.g. fmla restricts Rm to 4 bits when using an FP16 register.  This restriction
does not apply for all instructions, e.g. fcmla does not have this restriction
as it gets an extra bit from the M field.

Unfortunately, this restriction to S_H was added for all _Em operands before,
meaning for a large number of instructions you couldn't use the full register
file.

This fixes the issue by introducing a new operand _Em16 which applies this
restriction only when paired with S_H and leaves the _Em and the other
qualifiers for _Em16 unbounded (i.e. using the full 5 bit range).

Also the patch updates all instructions that should be affected by this.

opcodes/

PR binutils/23192
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.
* aarch64-dis.c (aarch64_ext_reglane): Add AARCH64_OPND_Em16 constraint.
* aarch64-opc.c (operand_general_constraint_met_p,
aarch64_print_operand): Likewise.
* aarch64-tbl.h (aarch64_opcode_table): Change Em to Em16 for smlal,
smlal2, fmla, fmls, fmul, fmulx, sqrdmlah, sqrdlsh, fmlal, fmlsl,
fmlal2, fmlsl2.
(AARCH64_OPERANDS): Add Em2.

gas/

PR binutils/23192
* config/tc-aarch64.c (process_omitted_operand, parse_operands): Add
AARCH64_OPND_Em16
* testsuite/gas/aarch64/advsimd-armv8_3.s: Expand tests to cover upper
16 registers.
* testsuite/gas/aarch64/advsimd-armv8_3.d: Likewise.
* testsuite/gas/aarch64/advsimd-compnum.s: Likewise.
* testsuite/gas/aarch64/advsimd-compnum.d: Likewise.
* testsuite/gas/aarch64/sve.d: Likewise.

include/

PR binutils/23192
*opcode/aarch64.h (aarch64_opnd): Add AARCH64_OPND_Em16.

(cherry picked from commit 369c9167d47e69aad2e260cc1db17f8c894c138b)
Signed-off-by: Tamar Christina <tamar.christina@arm.com>
5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 29 Jun 2018 00:02:16 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 28 Jun 2018 00:02:28 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agogas object file locations
Alan Modra [Wed, 27 Jun 2018 03:17:13 +0000 (12:47 +0930)] 
gas object file locations

With the update to newer autotools, some gas object files are now
built in config/, breaking xtensa-elf and ia64-vms.  This patch fixes
the dependencies.

* configure.ac: Specify extra_objects with leading "config/"
for xtensa-relax.o and te-vms.o.  Use case statements to unique
extra_objects.  Formatting.
* configure: Regenerate.

(cherry picked from commit e11078da44268a4813ed81a27853143af86c3e24)

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 27 Jun 2018 00:02:44 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoPR23169 bogus test
Alan Modra [Tue, 26 Jun 2018 05:00:16 +0000 (14:30 +0930)] 
PR23169 bogus test

The testcase isn't valid.  If it happens to run on your target, you're
lucky.

PR 23169
* testsuite/ld-ifunc/ifunc.exp: Don't run pr23169 tests on
powerpc.  Comment.

5 years agoFix parens in ld bootstrap.exp
Alan Modra [Tue, 26 Jun 2018 04:59:28 +0000 (14:29 +0930)] 
Fix parens in ld bootstrap.exp

Seen with tcl 8.5.13:
ERROR: tcl error sourcing .../ld/testsuite/ld-bootstrap/bootstrap.exp.
ERROR: expected boolean value but got " [istarget ia64-*-elf*] || [istarget ia64-*-linux*"
    while executing
"if { "$flags" == "--static" && { [istarget ia64-*-elf*] || [istarget ia64-*-linux*] }
 || [istarget mips*-*-linux*] } {
# On ia64 and mips, tmpdir/l..."

* testsuite/ld-bootstrap/bootstrap.exp: Use parentheses rather
than curly braces in logical expression.

5 years agoRevert "Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITS"
Alan Modra [Thu, 21 Jun 2018 13:49:41 +0000 (23:19 +0930)] 
Revert "Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITS"

This reverts commit 57c0d77c2ce5e583dab322e05f8291bcbad0ccd3.

5 years agoUpdated translations.
Nick Clifton [Tue, 26 Jun 2018 12:55:59 +0000 (13:55 +0100)] 
Updated translations.

opcodes * po/uk.po: Updated Ukranian translation.
* po/de.po: Updated German translation.
* po/pt_BR.po: Updated Brazilian Portuguese translation.

ld * po/uk.po: Updated Ukranian translation.
gold * po/uk.po: Updated Ukranian translation.
gas * po/uk.po: Updated Ukranian translation.
bfd * po/uk.po: Updated Ukranian translation.

binutils* po/sv.po: Updated Swedish translation.
* po/uk.po: Updated Ukranian translation.

5 years agoFix spelling mistakes.
Nick Clifton [Tue, 26 Jun 2018 11:32:32 +0000 (12:32 +0100)] 
Fix spelling mistakes.

opcodes * nfp-dis.c: Fix spelling mistake.

ld * emultempl/aarch64elf.em: Fix spelling mistake.
* emultempl/avrelf.em: Likewise.
* emultempl/elf32.em: Likewise.

binutils* doc/binutils.texi: Fix spelling mistakes.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 26 Jun 2018 00:02:27 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoFix a compile time warning building the AArch64 BFD backend.
Nick Clifton [Mon, 25 Jun 2018 11:51:10 +0000 (12:51 +0100)] 
Fix a compile time warning building the AArch64 BFD backend.

* elfnn-aarch64.c (_bfd_aarch64_erratum_835769_stub_name): Check
for malloc returning NULL.
(_bfd_aarch64_erratum_843419_fixup): Check for
_bfd_aarch64_erratum_835769_stub_name returning NULL.

5 years agoReset version to 2.30.90. Update configure files. Regenerate pot files.
Nick Clifton [Sun, 24 Jun 2018 18:49:22 +0000 (19:49 +0100)] 
Reset version to 2.30.90.  Update configure files.  Regenerate pot files.

5 years agoAdd 2.30 branch notes to ChangeLogs and NEWS files.
Nick Clifton [Sun, 24 Jun 2018 17:36:15 +0000 (18:36 +0100)] 
Add 2.30 branch notes to ChangeLogs and NEWS files.

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 24 Jun 2018 00:01:17 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoBump version number and summarize new features in 1.16.
Cary Coutant [Sat, 23 Jun 2018 07:46:13 +0000 (00:46 -0700)] 
Bump version number and summarize new features in 1.16.

gold/
* version.cc (version_string): Bump to 1.16.
* NEWS: Add new features in 1.16.

5 years agoFix "may be used uninitialized" warning.
Cary Coutant [Sat, 23 Jun 2018 07:26:07 +0000 (00:26 -0700)] 
Fix "may be used uninitialized" warning.

gold/
PR gold/22914
* x86_64.cc (Target_x86_64::record_gnu_property): Initialize val.

5 years agoAdd x86-64 support for Indirect Branch Tracking (IBT).
Cary Coutant [Sat, 23 Jun 2018 00:28:05 +0000 (17:28 -0700)] 
Add x86-64 support for Indirect Branch Tracking (IBT).

gold/
PR gold/22915
* x86_64.cc (Output_data_plt_x86_64_ibt): New class.
(Target_x86_64::do_make_data_plt): (All instantiations) Check for
IBT feature bit and create IBT PLTs.

5 years agoUpdate support for .note.gnu.property sections.
Cary Coutant [Sat, 23 Jun 2018 06:36:50 +0000 (23:36 -0700)] 
Update support for .note.gnu.property sections.

The original patch did not give the target enough hooks to discover that
an input object file does not have a particular property. For the
GNU_PROPERTY_X86_FEATURE_1_AND property, for example, where a missing
property should be assumed to be all zeroes, and ANDed with other
object modules, this is essential. We now store the target-specific
properties locally in the Target structure as native uint32_t fields,
then AND the per-object feature bits with the program's feature bits
when we're finished processing each input object file. The target-specific
properties are then added back to the output note section during
finalization.

gold/
PR gold/22914
* layout.cc (read_sized_value): Fix spelling of section name.
(Layout::layout_gnu_property): Call Sized_target::record_gnu_property
for target-specific properties;
don't store them with target-independent properties yet.
(Layout::merge_gnu_properties): New method.
(Layout::add_gnu_property): New method.
(Layout::create_gnu_properties_note): Call target to finalize
target-specific properties. Fix spelling of output section name.
* layout.h (Layout::merge_gnu_properties): New method.
(Layout::add_gnu_property): New method.
* object.cc (Sized_relobj_file::do_layout): Call
Layout::merge_gnu_properties.
* target.h (Target::merge_gnu_property): Remove.
(Target::finalize_gnu_properties): New method.
(Target::do_merge_gnu_property): Move to Sized_target and rename.
(Target::do_finalize_gnu_properties): New virtual method.
(Sized_target::record_gnu_property): Moved and renamed from
Target::do_merge_gnu_property.
(Sized_target::merge_gnu_properties): New virtual method.
* x86_64.cc (Target_x86_64::isa_1_used_, isa_1_needed_)
(feature_1_, object_feature_1_, seen_first_object_): New data members.
(Target_x86_64::do_merge_gnu_property): Rename to ...
(Target_x86_64::record_gnu_property): ... this.  Save target-specific
properties in Target class object.
(Target_x86_64::merge_gnu_properties): New method.
(add_property): New static inline function.
(Target_x86_64::do_finalize_gnu_properties): New method.
* testsuite/Makefile.am (gnu_property_test): Remove C source file;
link directly without compiler driver.
* testsuite/Makefile.in: Regenerate.
* testsuite/gnu_property_a.S: Add _start.

5 years agoSilence GCC 9 error about deprecated implicit copy constructor.
Cary Coutant [Sat, 23 Jun 2018 01:19:51 +0000 (18:19 -0700)] 
Silence GCC 9 error about deprecated implicit copy constructor.

Replacing push_back() with emplace_back() eliminates the calls to the
copy constructor, but I still had to provide explicit copy constructors
because of the call to vector::reserve(), which tries to instantiate them
even though they'll never actually be called when reserve() is called
on an empty vector.

gold/
* incremental.cc (Sized_incremental_binary::setup_readers): Use
emplace_back for GCC 5 and later.
* incremental.h (Incremental_binary::Input_reader): Provide copy
constructor.
(Sized_incremental_binary::Sized_input_reader): Likewise.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 23 Jun 2018 00:00:50 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoFix "info registers" regexes in gdb.base/jit-reader.exp
Simon Marchi [Fri, 22 Jun 2018 17:40:47 +0000 (13:40 -0400)] 
Fix "info registers" regexes in gdb.base/jit-reader.exp

Commit

  e813d34 ("Align natural-format register values to the same column")

changed the output of "info registers" (tabs to spaces), but didn't
update gdb.base/jit-reader.exp.  Update the regexes to expect spaces
instead.

gdb/testsuite/ChangeLog:

* gdb.base/jit-reader.exp (jit_reader_test): Expect spaces in
"info registers" output.

5 years agoAdd support for .note.gnu.property sections.
Cary Coutant [Fri, 22 Jun 2018 16:27:39 +0000 (09:27 -0700)] 
Add support for .note.gnu.property sections.

elfcpp/
PR gold/22914
* elfcpp.h (NT_GNU_PROPERTY_TYPE_0): New note type.
(GNU_PROPERTY_*): New Gnu property types.
* x86_64.h (GNU_PROPERTY_X86_FEATURE_1_IBT)
(GNU_PROPERTY_X86_FEATURE_1_SHSTK): New x86 feature bits.

gold/
PR gold/22914
* layout.cc (Layout::Layout): Initialize gnu_properties_.
(read_sized_value, write_sized_value): New functions.
(Layout::layout_gnu_property): New method.
(Layout::create_notes): Call create_gnu_properties_note.
(Layout::create_gnu_properties_note): New method.
* layout.h (Layout::layout_gnu_property): New method.
(Layout::create_gnu_properties_note): New method.
(Layout::Gnu_property, Layout::Gnu_properties): New types.
(Layout::gnu_properties_): New data member.
* object.cc (Sized_relobj_file::layout_gnu_property_section): New
method.
(Sized_relobj_file::do_layout): Handle .note.gnu.property sections.
* object.h (Sized_relobj_file::layout_gnu_property_section): New
method.
* target.h (Target::merge_gnu_property): New method.
(Target::do_merge_gnu_property): New virtual method.
* x86_64.cc (Target_x86_64::do_merge_gnu_property): New method.
* testsuite/Makefile.am (gnu_property_test): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/gnu_property_a.S: New source file.
* testsuite/gnu_property_b.S: New source file.
* testsuite/gnu_property_c.S: New source file.
* testsuite/gnu_property_main.c: New source file.
* testsuite/gnu_property_test.sh: New test script.

5 years agoUse partial register read/writes in transfer_regset
Alan Hayward [Wed, 20 Jun 2018 17:19:05 +0000 (18:19 +0100)] 
Use partial register read/writes in transfer_regset

This avoids assert failures when the register is bigger than the
slot size. This happens on Aarch64 when truncating Z registers
into an fpsimd structure. This can be triggered by running
gdb command "generate-core-file".

Also, when the register is smaller then the slot size, then
zero pad when writing to the slot, and truncate when writing
to the regcache. This happens on Aarch64 with the CPSR register.

Continue to ensure registers are invalidated when both buffers
are null.

gdb/
* regcache.c (readable_regcache::read_part): Fix asserts.
(reg_buffer::raw_collect_part): New function.
(regcache::write_part): Fix asserts.
(reg_buffer::raw_supply_part): New function.
(regcache::transfer_regset_register): New helper function.
(regcache::transfer_regset): Call new functions.
(regcache_supply_regset): Use gdb_byte*.
(regcache::supply_regset): Likewise.
(regcache_collect_regset): Likewise.
(regcache::collect_regset): Likewise.
* regcache.h (reg_buffer::raw_collect_part): New declaration.
(reg_buffer::raw_supply_part): Likewise.
(regcache::transfer_regset_register): Likewise.
(regcache::transfer_regset): Use gdb_byte*.

5 years agoCorrect negs aliasing on AArch64.
Tamar Christina [Fri, 22 Jun 2018 11:27:53 +0000 (12:27 +0100)] 
Correct negs aliasing on AArch64.

This patch fixes a disassembly issue with the aliases to subs with a shifted
register.  The subs instruction with the zero register as destination is
supposed to alias to cmp and when the first input register is the zero register
the subs is supposed to be aliased to negs.

This means that a subs with destination and first input registers the zero
register is supposed to be a cmp.

This is done by raising the priority of the cmp alias.

opcodes/

* aarch64-tbl.h (aarch64_opcode_table): Fix alias flag for negs
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Likewise.

gas/

* testsuite/gas/aarch64/addsub.s: Add negs to zero reg test.
* testsuite/gas/aarch64/addsub.d: Likewise.

5 years agoFix up HAS_SVE_STATE macro
Alan Hayward [Fri, 22 Jun 2018 09:26:51 +0000 (10:26 +0100)] 
Fix up HAS_SVE_STATE macro

Prevents build break on aarch64 Suse.

2018-06-22  Alan Hayward  <alan.hayward@arm.com>

gdb/
* nat/aarch64-sve-linux-ptrace.h (HAS_SVE_STATE): Use &.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 22 Jun 2018 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoMIPS/opcodes: Fix a typo in `-M ginv' option description
Maciej W. Rozycki [Thu, 21 Jun 2018 21:45:47 +0000 (22:45 +0100)] 
MIPS/opcodes: Fix a typo in `-M ginv' option description

opcodes/
* mips-dis.c (print_mips_disassembler_options): Fix a typo in
`-M ginv' option description.

5 years agoFix treatment of symbol versions with unused as-needed libraries.
Cary Coutant [Thu, 21 Jun 2018 20:51:16 +0000 (13:51 -0700)] 
Fix treatment of symbol versions with unused as-needed libraries.

When we have a weak reference to a symbol defined in an
as-needed library, and that library ends up not-needed, gold
simply clears the version information in the symbol table, even
if the symbol could have been resolved by a needed library later
in the link order. This results in a loss of version information,
which can cause the program to bind to the wrong version at run
time.

This patch lets a dynamic definition override an earlier one if
the earlier one is from a not-needed library, so that we can
retain the version information from the binding to the needed
library. In order to do that, the tracking of needed/not-needed
had to be moved up to symbol resolution time, instead of during
Symbol_table::set_dynsym_indexes().

In cases where we still end up discarding version information,
I've added a warning.

For the original problem report and discussion, see:

https://stackoverflow.com/questions/50751421/undefined-behavior-in-shared-lib-using-libpthread-but-not-having-it-in-elf-as-d

gold/
* resolve.cc (Symbol_table::resolve): Rename tobinding to
orig_tobinding.  Call set_is_needed() for objects that resolve
non-weak references.
(Symbol_table::should_override): Allow a dynamic definition to
override an earlier one in a not-needed library.
* symtab.cc (Symbol_table::set_dynsym_indexes): Remove separate
processing for as-needed symbols.  Add warning when discarding
version informatin.
* testsuite/Makefile.am (weak_as_needed): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/weak_as_needed.sh: New test script.
* testsuite/weak_as_needed_a.c: New source file.
* testsuite/weak_as_needed_b.c: New source file.
* testsuite/weak_as_needed_b.script: New version script.
* testsuite/weak_as_needed_c.c: New source file.
* testsuite/weak_as_needed_c.script: New version script.

5 years agoMIPS/BFD: Correct formatting of compact EH backend methods
Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:57 +0000 (21:40 +0100)] 
MIPS/BFD: Correct formatting of compact EH backend methods

Correct the formatting of `_bfd_mips_elf_compact_eh_encoding' and
`_bfd_mips_elf_cant_unwind_opcode' definitions which extend beyond 79
columns.

bfd/
* elfxx-mips.c (_bfd_mips_elf_compact_eh_encoding)
(_bfd_mips_elf_cant_unwind_opcode): Correct formatting.

5 years agoMIPS/BFD: Keep EI_ABIVERSION setting together
Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:56 +0000 (21:40 +0100)] 
MIPS/BFD: Keep EI_ABIVERSION setting together

Shuffle code in `_bfd_mips_post_process_headers' so that the setting of
the EI_ABIVERSION ELF file header field is complete before calling
`_bfd_elf_post_process_headers'.  This used to be the case, but was
changed with commit 351cdf24d223 ("[MIPS] Implement O32 FPXX, FP64 and
FP64A ABI extensions") for no reason.

bfd/
* elfxx-mips.c (_bfd_mips_post_process_headers): Keep
EI_ABIVERSION setting together.

5 years agoMIPS/BFD: Use enumeration constants for EI_ABIVERSION
Maciej W. Rozycki [Thu, 21 Jun 2018 20:40:56 +0000 (21:40 +0100)] 
MIPS/BFD: Use enumeration constants for EI_ABIVERSION

Define enumeration constants based on generated `libc-abis.h' from GNU
libc, adding a MIPS_ prefix as these are port-specific.  Use them to
replace magic numbers stored in the EI_ABIVERSION field of the ELF file
header.

bfd/
* elfxx-mips.c (MIPS_LIBC_ABI_DEFAULT, MIPS_LIBC_ABI_MIPS_PLT)
(MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64)
(MIPS_LIBC_ABI_MAX): New enumeration constants.
(_bfd_mips_post_process_headers): Use them in place of magic
numbers.

5 years agoRISC-V: Fix 3 PIE related ld testsuite failures.
Jim Wilson [Thu, 21 Jun 2018 18:45:43 +0000 (11:45 -0700)] 
RISC-V: Fix 3 PIE related ld testsuite failures.

bfd/
* elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment.
Use SYMBOL_REFERENCES_LOCAL.  Add asserts for h->got.offset.

5 years agoUse thread_info and inferior pointers more throughout
Pedro Alves [Thu, 21 Jun 2018 16:09:31 +0000 (17:09 +0100)] 
Use thread_info and inferior pointers more throughout

This is more preparation bits for multi-target support.

In a multi-target scenario, we need to address the case of different
processes/threads running on different targets that happen to have the
same PID/PTID.  E.g., we can have both process 123 in target 1, and
process 123 in target 2, while they're in reality different processes
running on different machines.  Or maybe we've loaded multiple
instances of the same core file.  Etc.

To address this, in my WIP multi-target branch, threads and processes
are uniquely identified by the (process_stratum target_ops *, ptid_t)
and (process_stratum target_ops *, pid) tuples respectively.  I.e.,
each process_stratum instance has its own thread/process number space.

As you can imagine, that requires passing around target_ops * pointers
in a number of functions where we're currently passing only a ptid_t
or an int.  E.g., when we look up a thread_info object by ptid_t in
find_thread_ptid, the ptid_t alone isn't sufficient.

In many cases though, we already have the thread_info or inferior
pointer handy, but we "lose" it somewhere along the call stack, only
to look it up again by ptid_t/pid.  Since thread_info or inferior
objects know their parent target, if we pass around thread_info or
inferior pointers when possible, we avoid having to add extra
target_ops parameters to many functions, and also, we eliminate a
number of by ptid_t/int lookups.

So that's what this patch does.  In a bit more detail:

- Changes a number of functions and methods to take a thread_info or
  inferior pointer instead of a ptid_t or int parameter.

- Changes a number of structure fields from ptid_t/int to inferior or
  thread_info pointers.

- Uses the inferior_thread() function whenever possible instead of
  inferior_ptid.

- Uses thread_info pointers directly when possible instead of the
  is_running/is_stopped etc. routines that require a lookup.

- A number of functions are eliminated along the way, such as:

  int valid_gdb_inferior_id (int num);
  int pid_to_gdb_inferior_id (int pid);
  int gdb_inferior_id_to_pid (int num);
  int in_inferior_list (int pid);

- A few structures and places hold a thread_info pointer across
  inferior execution, so now they take a strong reference to the
  (refcounted) thread_info object to avoid the thread_info pointer
  getting stale.  This is done in enable_thread_stack_temporaries and
  in the infcall.c code.

- Related, there's a spot in infcall.c where using a RAII object to
  handle the refcount would be handy, so a gdb::ref_ptr specialization
  for thread_info is added (thread_info_ref, in gdbthread.h), along
  with a gdb_ref_ptr policy that works for all refcounted_object types
  (in common/refcounted-object.h).

gdb/ChangeLog:
2018-06-21  Pedro Alves  <palves@redhat.com>

* ada-lang.h (ada_get_task_number): Take a thread_info pointer
instead of a ptid_t.  All callers adjusted.
* ada-tasks.c (ada_get_task_number): Likewise.  All callers
adjusted.
(print_ada_task_info, display_current_task_id, task_command_1):
Adjust.
* breakpoint.c (watchpoint_in_thread_scope): Adjust to use
inferior_thread.
(breakpoint_kind): Adjust.
(remove_breakpoints_pid): Rename to ...
(remove_breakpoints_inf): ... this.  Adjust to take an inferior
pointer.  All callers adjusted.
(bpstat_clear_actions): Use inferior_thread.
(get_bpstat_thread): New.
(bpstat_do_actions): Use it.
(bpstat_check_breakpoint_conditions, bpstat_stop_status): Adjust
to take a thread_info pointer.  All callers adjusted.
(set_longjmp_breakpoint_for_call_dummy, set_momentary_breakpoint)
(breakpoint_re_set_thread): Use inferior_thread.
* breakpoint.h (struct inferior): Forward declare.
(bpstat_stop_status): Update.
(remove_breakpoints_pid): Delete.
(remove_breakpoints_inf): New.
* bsd-uthread.c (bsd_uthread_target::wait)
(bsd_uthread_target::update_thread_list): Use find_thread_ptid.
* btrace.c (btrace_add_pc, btrace_enable, btrace_fetch)
(maint_btrace_packet_history_cmd)
(maint_btrace_clear_packet_history_cmd): Adjust.
(maint_btrace_clear_cmd, maint_info_btrace_cmd): Adjust to use
inferior_thread.
* cli/cli-interp.c: Include "inferior.h".
* common/refcounted-object.h (struct
refcounted_object_ref_policy): New.
* compile/compile-object-load.c: Include gdbthread.h.
(store_regs): Use inferior_thread.
* corelow.c (core_target::close): Use current_inferior.
(core_target_open): Adjust to use first_thread_of_inferior and use
the current inferior.
* ctf.c (ctf_target::close): Adjust to use current_inferior.
* dummy-frame.c (dummy_frame_id) <ptid>: Delete, replaced by ...
<thread>: ... this new field.  All references adjusted.
(dummy_frame_pop, dummy_frame_discard, register_dummy_frame_dtor):
Take a thread_info pointer instead of a ptid_t.
* dummy-frame.h (dummy_frame_push, dummy_frame_pop)
(dummy_frame_discard, register_dummy_frame_dtor): Take a
thread_info pointer instead of a ptid_t.
* elfread.c: Include "inferior.h".
(elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop):
Use inferior_thread.
* eval.c (evaluate_subexp): Likewise.
* frame.c (frame_pop, has_stack_frames, find_frame_sal): Use
inferior_thread.
* gdb_proc_service.h (struct thread_info): Forward declare.
(struct ps_prochandle) <ptid>: Delete, replaced by ...
<thread>: ... this new field.  All references adjusted.
* gdbarch.h, gdbarch.c: Regenerate.
* gdbarch.sh (get_syscall_number): Replace 'ptid' parameter with a
'thread' parameter.  All implementations and callers adjusted.
* gdbthread.h (thread_info) <set_running>: New method.
(delete_thread, delete_thread_silent): Take a thread_info pointer
instead of a ptid.
(global_thread_id_to_ptid, ptid_to_global_thread_id): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function.  All callers
adjusted.
(any_live_thread_of_process): Delete, replaced by ...
(any_live_thread_of_inferior): ... this new function.  All callers
adjusted.
(switch_to_thread, switch_to_no_thread): Declare.
(is_executing): Delete.
(enable_thread_stack_temporaries): Update comment.
<enable_thread_stack_temporaries>: Take a thread_info pointer
instead of a ptid_t.  Incref the thread.
<~enable_thread_stack_temporaries>: Decref the thread.
<m_ptid>: Delete
<m_thr>: New.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(get_last_thread_stack_temporary)
(value_in_thread_stack_temporaries, can_access_registers_thread):
Take a thread_info pointer instead of a ptid_t.  All callers
adjusted.
* infcall.c (get_call_return_value): Use inferior_thread.
(run_inferior_call): Work with thread pointers instead of ptid_t.
(call_function_by_hand_dummy): Work with thread pointers instead
of ptid_t.  Use thread_info_ref.
* infcmd.c (proceed_thread_callback): Access thread's state
directly.
(ensure_valid_thread, ensure_not_running): Use inferior_thread,
access thread's state directly.
(continue_command): Use inferior_thread.
(info_program_command): Use find_thread_ptid and access thread
state directly.
(proceed_after_attach_callback): Use thread state directly.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t.  All callers adjusted.
(exit_inferior): Take an inferior pointer instead of a pid.  All
callers adjusted.
(exit_inferior_silent): New.
(detach_inferior): Delete.
(valid_gdb_inferior_id, pid_to_gdb_inferior_id)
(gdb_inferior_id_to_pid, in_inferior_list): Delete.
(detach_inferior_command, kill_inferior_command): Use
find_inferior_id instead of valid_gdb_inferior_id and
gdb_inferior_id_to_pid.
(inferior_command): Use inferior and thread pointers.
* inferior.h (struct thread_info): Forward declare.
(notice_new_inferior): Take a thread_info pointer instead of a
ptid_t.  All callers adjusted.
(detach_inferior): Delete declaration.
(exit_inferior, exit_inferior_silent): Take an inferior pointer
instead of a pid.  All callers adjusted.
(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
(valid_gdb_inferior_id): Delete.
* infrun.c (follow_fork_inferior, proceed_after_vfork_done)
(handle_vfork_child_exec_or_exit, follow_exec): Adjust.
(struct displaced_step_inferior_state) <pid>: Delete, replaced by
...
<inf>: ... this new field.
<step_ptid>: Delete, replaced by ...
<step_thread>: ... this new field.
(get_displaced_stepping_state): Take an inferior pointer instead
of a pid.  All callers adjusted.
(displaced_step_in_progress_any_inferior): Adjust.
(displaced_step_in_progress_thread): Take a thread pointer instead
of a ptid_t.  All callers adjusted.
(displaced_step_in_progress, add_displaced_stepping_state): Take
an inferior pointer instead of a pid.  All callers adjusted.
(get_displaced_step_closure_by_addr): Adjust.
(remove_displaced_stepping_state): Take an inferior pointer
instead of a pid.  All callers adjusted.
(displaced_step_prepare_throw, displaced_step_prepare)
(displaced_step_fixup): Take a thread pointer instead of a ptid_t.
All callers adjusted.
(start_step_over): Adjust.
(infrun_thread_ptid_changed): Remove bit updating ptids in the
displaced step queue.
(do_target_resume): Adjust.
(fetch_inferior_event): Use inferior_thread.
(context_switch, get_inferior_stop_soon): Take an
execution_control_state pointer instead of a ptid_t.  All callers
adjusted.
(switch_to_thread_cleanup): Delete.
(stop_all_threads): Use scoped_restore_current_thread.
* inline-frame.c: Include "gdbthread.h".
(inline_state) <inline_state>: Take a thread pointer instead of a
ptid_t.  All callers adjusted.
<ptid>: Delete, replaced by ...
<thread>: ... this new field.
(find_inline_frame_state): Take a thread pointer instead of a
ptid_t.  All callers adjusted.
(skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Take a thread
pointer instead of a ptid_t.  All callers adjusted.
* inline-frame.h (skip_inline_frames, step_into_inline_frame)
(inline_skipped_frames, inline_skipped_symbol): Likewise.
* linux-fork.c (delete_checkpoint_command): Adjust to use thread
pointers directly.
* linux-nat.c (get_detach_signal): Likewise.
* linux-thread-db.c (thread_from_lwp): New 'stopped' parameter.
(thread_db_notice_clone): Adjust.
(thread_db_find_new_threads_silently)
(thread_db_find_new_threads_2, thread_db_find_new_threads_1): Take
a thread pointer instead of a ptid_t.  All callers adjusted.
* mi/mi-cmd-var.c: Include "inferior.h".
(mi_cmd_var_update_iter): Update to use thread pointers.
* mi/mi-interp.c (mi_new_thread): Update to use the thread's
inferior directly.
(mi_output_running_pid, mi_inferior_count): Delete, bits factored
out to ...
(mi_output_running): ... this new function.
(mi_on_resume_1): Adjust to use it.
(mi_user_selected_context_changed): Adjust to use inferior_thread.
* mi/mi-main.c (proceed_thread): Adjust to use thread pointers
directly.
(interrupt_thread_callback): : Adjust to use thread and inferior
pointers.
* proc-service.c: Include "gdbthread.h".
(ps_pglobal_lookup): Adjust to use the thread's inferior directly.
* progspace-and-thread.c: Include "inferior.h".
* progspace.c: Include "inferior.h".
* python/py-exitedevent.c (create_exited_event_object): Adjust to
hold a reference to an inferior_object.
* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust to use
inferior_thread.
* python/py-inferior.c (struct inferior_object): Give the type a
tag name instead of a typedef.
(python_on_normal_stop): No need to check if the current thread is
listed.
(inferior_to_inferior_object): Change return type to
inferior_object.  All callers adjusted.
(find_thread_object): Delete, bits factored out to ...
(thread_to_thread_object): ... this new function.
* python/py-infthread.c (create_thread_object): Use
inferior_to_inferior_object.
(thpy_is_stopped): Use thread pointer directly.
(gdbpy_selected_thread): Use inferior_thread.
* python/py-record-btrace.c (btpy_list_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field.  All users adjusted.
(btpy_insn_or_gap_new): Drop const.
(btpy_list_new): Take a thread pointer instead of a ptid_t.  All
callers adjusted.
* python/py-record.c: Include "gdbthread.h".
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t.  All callers adjusted.
(gdbpy_current_recording): Use inferior_thread.
* python/py-record.h (recpy_record_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field.  All users adjusted.
(recpy_element_object) <ptid>: Delete
field, replaced with ...
<thread>: ... this new field.  All users adjusted.
(recpy_insn_new, recpy_func_new): Take a thread pointer instead of
a ptid_t.  All callers adjusted.
* python/py-threadevent.c: Include "gdbthread.h".
(get_event_thread): Use thread_to_thread_object.
* python/python-internal.h (struct inferior_object): Forward
declare.
(find_thread_object, find_inferior_object): Delete declarations.
(thread_to_thread_object, inferior_to_inferior_object): New
declarations.
* record-btrace.c: Include "inferior.h".
(require_btrace_thread): Use inferior_thread.
(record_btrace_frame_sniffer)
(record_btrace_tailcall_frame_sniffer): Use inferior_thread.
(get_thread_current_frame): Use scoped_restore_current_thread and
switch_to_thread.
(get_thread_current_frame): Use thread pointer directly.
(record_btrace_replay_at_breakpoint): Use thread's inferior
pointer directly.
* record-full.c: Include "inferior.h".
* regcache.c: Include "gdbthread.h".
(get_thread_arch_regcache): Use the inferior's address space
directly.
(get_thread_regcache, registers_changed_thread): New.
* regcache.h (get_thread_regcache(thread_info *thread)): New
overload.
(registers_changed_thread): New.
(remote_target) <remote_detach_1>: Swap order of parameters.
(remote_add_thread): <remote_add_thread>: Return the new thread.
(get_remote_thread_info(ptid_t)): New overload.
(remote_target::remote_notice_new_inferior): Use thread pointers
directly.
(remote_target::process_initial_stop_replies): Use
thread_info::set_running.
(remote_target::remote_detach_1, remote_target::detach)
(extended_remote_target::detach): Adjust.
* stack.c (frame_show_address): Use inferior_thread.
* target-debug.h (target_debug_print_thread_info_pp): New.
* target-delegates.c: Regenerate.
* target.c (default_thread_address_space): Delete.
(memory_xfer_partial_1): Use current_inferior.
(target_detach): Use current_inferior.
(target_thread_address_space): Delete.
(generic_mourn_inferior): Use current_inferior.
* target.h (struct target_ops) <thread_address_space>: Delete.
(target_thread_address_space): Delete.
* thread.c (init_thread_list): Use ALL_THREADS_SAFE.  Use thread
pointers directly.
(delete_thread_1, delete_thread, delete_thread_silent): Take a
thread pointer instead of a ptid_t.  Adjust all callers.
(ptid_to_global_thread_id, global_thread_id_to_ptid): Delete.
(first_thread_of_process): Delete, replaced by ...
(first_thread_of_inferior): ... this new function.  All callers
adjusted.
(any_thread_of_process): Rename to ...
(any_thread_of_inferior): ... this, and take an inferior pointer.
(any_live_thread_of_process): Rename to ...
(any_live_thread_of_inferior): ... this, and take an inferior
pointer.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(value_in_thread_stack_temporaries)
(get_last_thread_stack_temporary): Take a thread pointer instead
of a ptid_t.  Adjust all callers.
(thread_info::set_running): New.
(validate_registers_access): Use inferior_thread.
(can_access_registers_ptid): Rename to ...
(can_access_registers_thread): ... this, and take a thread
pointer.
(print_thread_info_1): Adjust to compare thread pointers instead
of ptids.
(switch_to_no_thread, switch_to_thread): Make extern.
(scoped_restore_current_thread::~scoped_restore_current_thread):
Use m_thread pointer directly.
(scoped_restore_current_thread::scoped_restore_current_thread):
Use inferior_thread.
(thread_command): Use thread pointer directly.
(thread_num_make_value_helper): Use inferior_thread.
* top.c (execute_command): Use inferior_thread.
* tui/tui-interp.c: Include "inferior.h".
* varobj.c (varobj_create): Use inferior_thread.
(value_of_root_1): Use find_thread_global_id instead of
global_thread_id_to_ptid.

5 years agoAvoid memcpys in regcache read_part/write_part for full registers.
Alan Hayward [Wed, 20 Jun 2018 08:31:37 +0000 (09:31 +0100)] 
Avoid memcpys in regcache read_part/write_part for full registers.

Additionally, tidy up the functions: Remove asserts, use gdb_byte,
update comments.

gdb/
* regcache.c (readable_regcache::read_part): Avoid memcpy when
possible.
(regcache::write_part): Likewise.
(readable_regcache::cooked_read_part): Update comment.
(readable_regcache::cooked_write_part): Likewise.
* regcache.h: (readable_regcache::read_part): Likewise.
(regcache::write_part): Likewise.

5 years agoRegen doc/Makefile.in
Alan Modra [Wed, 20 Jun 2018 04:46:52 +0000 (14:16 +0930)] 
Regen doc/Makefile.in

Also make the automake strictness "foreign".  My regeneration of the
three doc/Makefile.in files already had --foreign in the automake
invocation, so this just makes it explicit.

bfd/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
binutils/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
gas/
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
* doc/Makefile.in: Regenerate.
zlib/
* Makefile.in: Regenerate.

5 years agoEnable hardware watchpoints on attach for aarch64
Richard Bunt [Thu, 21 Jun 2018 13:09:34 +0000 (14:09 +0100)] 
Enable hardware watchpoints on attach for aarch64

This commit fixes a bug whereby hardware watchpoints are not used on
aarch64 when attaching to a target. The fix adds an aarch64 specialization
of post_attach which records the number of available hardware debug registers
using aarch64_linux_get_debug_reg_capacity. This implementation mirrors that
of aarch64_linux_child_post_startup_inferior which successfully enables the
use of hardware watchpoints when launching the target under the debugger.

gdb/ChangeLog:

* aarch64-linux-nat.c (post_attach): New.
(aarch64_linux_nat_target::post_attach): Override post_attach to
record the number of hardware debug registers.

gdb/testsuite/ChangeLog:

* gdb.base/watchpoint-hw-attach.c: New test.
* gdb.base/watchpoint-hw-attach.exp: New file.

5 years agoUse offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITS
Alan Hayward [Thu, 21 Jun 2018 08:37:58 +0000 (09:37 +0100)] 
Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITS

For sections that are not SHT_NOBITS, use sh_offset and p_offset instead of
sh_addr and p_vaddr when calculating if a section fits in a segment. Both
methods are valid when using the GNU linker.

include/
* elf/internal.h (ELF_SECTION_IN_SEGMENT): Don’t check addresses
for non SHT_NOBITS.

5 years agoFix a memory leak in py-param.c
Tom Tromey [Wed, 20 Jun 2018 21:35:04 +0000 (15:35 -0600)] 
Fix a memory leak in py-param.c

Mark Wielaard pointed out this memory leak to me:

    ==17633== 775 bytes in 1 blocks are definitely lost in loss record 13,346 of 13,967
    ==17633==    at 0x4C2DB6B: malloc (vg_replace_malloc.c:299)
    ==17633==    by 0x6652B7: xmalloc (common-utils.c:45)
    ==17633==    by 0xC4C889: xstrdup (xstrdup.c:34)
    ==17633==    by 0x5A71FD: unicode_to_encoded_string(_object*, char const*) (py-utils.c:81)
    ==17633==    by 0x5A73EB: python_string_to_host_string(_object*) (py-utils.c:158)
    ==17633==    by 0x59CC6C: get_doc_string(_object*, _object*) (py-param.c:334)
    ==17633==    by 0x59D2AA: parmpy_init(_object*, _object*, _object*) (py-param.c:728)

The bug here is that parmpy_init is written as though
add_setshow_generic takes ownership of its doc-string arguments.
However, it does not.  This patch fixes the bug in a straightforward
way and also applies some missing constification to make the problem
more apparent.

Tested on x86-64 Fedora 26.

gdb/ChangeLog
2018-06-20  Tom Tromey  <tom@tromey.com>

* python/py-param.c (add_setshow_generic): Make parameters const.
(parmpy_init): Update.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 21 Jun 2018 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoRename regcache_cooked_read_ftype and make a function_view
Simon Marchi [Wed, 20 Jun 2018 16:49:03 +0000 (12:49 -0400)] 
Rename regcache_cooked_read_ftype and make a function_view

regcache_cooked_read_ftype can be converted to a function_view, which
allows us to use lambda functions and therefore avoid having to pass an
opaque pointer parameter.

Adjusting the fallouts showed that the "const regcache &" passed to the
readonly_detached_regcache constructor is cast to non-const in
do_cooked_read.  I changed the constructor parameter to be non-const.

Finally, I renamed the typedef from regcache_cooked_read_ftype to
register_read_ftype, since there is nothing that forces us to use it
only for regcaches nor cooked registers.

gdb/ChangeLog:

* regcache.h (regcache_cooked_read_ftype): Rename to...
(register_read_ftype): ...this, change type to function_view.
(class reg_buffer) <save>: Remove src parameter.
(readonly_detached_regcache) <readonly_detached_regcache>: Make
parameter non-const in first overload.  Remove src parameter in
second overload.
* regcache.c (do_cooked_read): Remove.
(readonly_detached_regcache::readonly_detached_regcache): Make
parameter non-const, adjust call to other constructor.
(reg_buffer::save): Remove src parameter.
* frame.c (do_frame_register_read): Remove.
(frame_save_as_regcache): Use lambda function.
* ppc-linux-tdep.c (ppu2spu_unwind_register): Change type of src
parameter to ppu2spu_data *.
(ppu2spu_sniffer): Use lambda function.

5 years agotestsuite: Fix cc-with-tweaks.sh being executed in the wrong shell
Simon Marchi [Wed, 20 Jun 2018 16:46:28 +0000 (12:46 -0400)] 
testsuite: Fix cc-with-tweaks.sh being executed in the wrong shell

The cc-with-tweaks.sh script needs to be executed with bash.  When
trying to run this:

  make check RUNTESTFLAGS="--target_board=dwarf4-gdb-index" TESTS="gdb.base/return.exp"

I get:

  gdb compile failed, /home/emaisin/src/binutils-gdb/gdb/contrib/cc-with-tweaks.sh: 174: /home/emaisin/src/binutils-gdb/gdb/contrib/cc-with-tweaks.sh: Bad substitution

The reason is that the board files execute cc-with-tweaks.sh using
/bin/sh, which points to dash on my machine.  Remove the /bin/sh part
and let the shebang choose the right interpreter.

gdb/testsuite/ChangeLog:

* boards/cc-with-tweaks.exp: Don't call cc-with-tweaks.sh
through /bin/sh.
* boards/dwarf4-gdb-index.exp: Likewise.
* boards/fission-dwp.exp: Likewise.

5 years agoRemove struct keyword in range-based for-loop
Simon Marchi [Wed, 20 Jun 2018 16:40:54 +0000 (12:40 -0400)] 
Remove struct keyword in range-based for-loop

Fix this with gcc 6.3.0, and make the loop variable const while at it:

/home/simark/src/binutils-gdb/gdb/record-full.c: In member function 'virtual int record_full_target::insert_breakpoint(gdbarch*, bp_target_info*)':
/home/simark/src/binutils-gdb/gdb/record-full.c:1789:8: error: types may not be defined in a for-range-declaration [-Werror]
   for (struct record_full_breakpoint &bp : record_full_breakpoints)

gdb/ChangeLog:

* record-full.c (record_full_target::insert_breakpoint): Remove
"struct" keyword, add const.

5 years agoFix potential illegal memroy access when using a build-id note with a negative size.
Nick Clifton [Wed, 20 Jun 2018 15:30:05 +0000 (16:30 +0100)] 
Fix potential illegal memroy access when using a build-id note with a negative size.

PR 23316
* opncls.c (get_build_id): Check for a negative or excessive data
size in the build-id note.