external/binutils.git
8 years agoUpdate x86 CPU_XXX_FLAGS handling
H.J. Lu [Fri, 27 May 2016 17:05:39 +0000 (10:05 -0700)]
Update x86 CPU_XXX_FLAGS handling

Support defining CPU_XXX_FLAGS with other CPU_XXX_FLAGS.  Update
CPU_XXX_FLAGS to enable more bits like x87 and SYSCALL.  Don't enable
MMX when enabling SSE, AVX or AVX512.  Don't disable AVX nor AVX512 when
disabling SSE.  Don't disable AVX512 when disabling AVX.  Disable F16C,
FMA, FMA4 and XOP when disabling AVX.  Add 87, no287, no387, no687,
nosse2, nosse3, nossse3, nosse4.1, nosse4.2, nosse4 and noavx2 directives
to x86 assembler.

TODO: Add more .noXXX, like .noavx512f, directives to x86 assembler.

gas/

PR gas/20145
* config/tc-i386.c (cpu_arch): Add 687.
(cpu_noarch): Add no287, no387, no687, nosse2, nosse3, nossse3,
nosse4.1, nosse4.2, nosse4 and noavx2.
(parse_real_register): Check cpuregmmx instead of cpummx for MMX
register.  Check cpuregxmm instead of cpusse for XMM register.
Check cpuregymm instead of cpuavx for YMM register.  Check
cpuregzmm/cpuregmask instead of cpuavx512f for ZMMM/mask register.
* doc/c-i386.texi: Mention 687, no287, no387, no687, nosse2,
nosse3, nossse3, nosse4.1, nosse4.2, nosse4 and noavx2.
* testsuite/gas/i386/arch-10-prefetchw.d (as): Add mmx.
* testsuite/gas/i386/arch-10.d (as): Likewise.
* testsuite/gas/i386/arch-11.s: Add ".arch .mmx".
* testsuite/gas/i386/i386.exp: Pass mmx to assembler for
arch-10-3 and arch-10-4.  Run no87-3, nosse-4, nosse-5, noavx-3
and noavx-4.
* testsuite/gas/i386/no87-3.l: New file.
* testsuite/gas/i386/no87-3.s: Likewise.
* testsuite/gas/i386/noavx-3.l: Likewise.
* testsuite/gas/i386/noavx-3.s: Likewise.
* testsuite/gas/i386/noavx-4.d: Likewise.
* testsuite/gas/i386/noavx-4.s: Likewise.
* testsuite/gas/i386/nosse-4.l: Likewise.
* testsuite/gas/i386/nosse-4.s: Likewise.
* testsuite/gas/i386/nosse-5.d: Likewise.
* testsuite/gas/i386/nosse-5.s: Likewise.

opcodes/

PR gas/20145
* i386-gen.c (cpu_flag_init): Update CPU_XXX_FLAGS.  Remove
CpuMMX from CPU_SSE_FLAGS.  Remove AVX and AVX512 bits from
CPU_ANY_SSE_FLAGS.  Remove AVX512 bits from CPU_ANY_AVX_FLAGS.
Add CPU_XSAVE_FLAGS to CPU_XSAVEOPT_FLAGS, CPU_XSAVE_FLAGS and
CpuXSAVEC.  Add CPU_AVX_FLAGS to CpuF16C.  Remove CpuMMX from
CPU_AVX512F_FLAGS, CPU_AVX512CD_FLAGS, CPU_AVX512ER_FLAGS,
CPU_AVX512PF_FLAGS, CPU_AVX512DQ_FLAGS and CPU_AVX512BW_FLAGS.
Add CPU_SSE2_FLAGS to CPU_SHA_FLAGS.   Add CPU_ANY_287_FLAGS,
CPU_ANY_387_FLAGS, CPU_ANY_687_FLAGS, CPU_ANY_SSE2_FLAGS,
CPU_ANY_SSE3_FLAGS, CPU_ANY_SSSE3_FLAGS, CPU_ANY_SSE4_1_FLAGS,
CPU_ANY_SSE4_2_FLAGS and CPU_ANY_AVX2_FLAGS.  Enable CpuRegMMX
for MMX.  Enable CpuRegXMM for SSE, AVX and AVX512.  Enable
CpuRegYMM for AVX and AVX512VL,  Enable CpuRegZMM and
CpuRegMask for AVX512.
(cpu_flags): Add CpuRegMMX, CpuRegXMM, CpuRegYMM, CpuRegZMM
and CpuRegMask.
(set_bitfield_from_cpu_flag_init): New function.
(set_bitfield): Remove const on f.  Call
set_bitfield_from_cpu_flag_init to handle CPU_XXX_FLAGS.
* i386-opc.h (CpuRegMMX): New.
(CpuRegXMM): Likewise.
(CpuRegYMM): Likewise.
(CpuRegZMM): Likewise.
(CpuRegMask): Likewise.
(i386_cpu_flags): Add cpuregmmx, cpuregxmm, cpuregymm, cpuregzmm
and cpuregmask.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

8 years agoSkip attach-many-short-lived-threads.exp on known-broken DejaGnu versions
Pedro Alves [Fri, 27 May 2016 15:18:28 +0000 (16:18 +0100)]
Skip attach-many-short-lived-threads.exp on known-broken DejaGnu versions

If the testsuite is run with a DejaGnu version that predates the fix
from last year:

  [PATCH] DejaGnu kills the wrong process due to PID-reuse races
  http://lists.gnu.org/archive/html/dejagnu/2015-07/msg00005.html

... gdb.threads/attach-many-short-lived-threads.exp fails randomly,
often.  Other tests randomly fail due to that issue too, but this one
is _much_ more exposed.

DejaGnu 1.6 was released meanwhile, which includes that DejaGnu fix,
and also some distros backported the fix too.

So skip the test when run with older/broken DejaGnus.

gdb/testsuite/ChangeLog:
2016-05-27  Pedro Alves  <palves@redhat.com>

* gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu):
New procedure.
(top level): Call it, and bail out of DejaGnu is known to be bad.

8 years agoReplace CpuAMD64/CpuIntel64 with AMD64/Intel64
H.J. Lu [Fri, 27 May 2016 15:02:56 +0000 (08:02 -0700)]
Replace CpuAMD64/CpuIntel64 with AMD64/Intel64

AMD64 vs CpuIntel64 ISA should be handled similar as AT&T vs Intel
syntax.  Since cpu_flags isn't sorted by position, we need to check
the whole cpu_flags array for the maximum position when verifying
CpuMax.

gas/

PR gas/20154
* config/tc-i386.c (cpu_flags_match): Don't set cpuamd64 nor
cpuintel64.
(match_template): Check Intel64/AMD64 ISA.

opcodes/

PR gas/20154
* i386-gen.c (cpu_flags): Remove CpuAMD64 and CpuIntel64.
(opcode_modifiers): Add AMD64 and Intel64.
(main): Properly verify CpuMax.
* i386-opc.h (CpuAMD64): Removed.
(CpuIntel64): Likewise.
(CpuMax): Set to CpuNo64.
(i386_cpu_flags): Remove cpuamd64 and cpuintel64.
(AMD64): New.
(Intel64): Likewise.
(i386_opcode_modifier): Add amd64 and intel64.
(i386-opc.tbl): Replace CpuAMD64/CpuIntel64 with AMD64/Intel64
on call and jmp.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

8 years agoImprove documentation of general query packets
Eli Zaretskii [Fri, 27 May 2016 13:59:22 +0000 (16:59 +0300)]
Improve documentation of general query packets

gdb/doc/ChangeLog:

* gdb.texinfo (General Query Packets): Move the description of the
response before the long list of the specific 'read' and 'write'
requests.

8 years agoCorrect CpuMax in i386-opc.h
H.J. Lu [Fri, 27 May 2016 13:55:42 +0000 (06:55 -0700)]
Correct CpuMax in i386-opc.h

CpuMax should be CpuIntel64, not CpuNo64.  i386-gen.c is updated to
verify that CpuMax is correct.  X86 assembler is updated to properly
set cpuamd64 and cpuintel64.

gas/

PR gas/20154
* config/tc-i386.c (intel64): New.
(cpu_flags_match): Set cpuamd64 and cpuintel64.
(md_parse_option): Set intel64 instead of cpuamd64 and
cpuintel64.

opcodes/

PR gas/20154
* i386-gen.c (main): Fail if CpuMax is incorrect.
* i386-opc.h (CpuMax): Set to CpuIntel64.
* i386-tbl.h: Regenerated.

8 years agoFix typo introduced during the most recent synchronization update.
Nick Clifton [Fri, 27 May 2016 13:34:06 +0000 (14:34 +0100)]
Fix typo introduced during the most recent synchronization update.

8 years agoImprove the MSP430 disassembler's handling of memory read errors.
Nick Clifton [Fri, 27 May 2016 12:49:58 +0000 (13:49 +0100)]
Improve the MSP430 disassembler's handling of memory read errors.

PR target/20150
* msp430-dis.c (msp430dis_read_two_bytes): New function.
(msp430dis_opcode_unsigned): New function.
(msp430dis_opcode_signed): New function.
(msp430_singleoperand): Use the new opcode reading functions.
Only disassenmble bytes if they were successfully read.
(msp430_doubleoperand): Likewise.
(msp430_branchinstr): Likewise.
(msp430x_callx_instr): Likewise.
(print_insn_msp430): Check that it is safe to read bytes before
attempting disassembly.  Use the new opcode reading functions.

8 years agogdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT
Andrew Burgess [Tue, 24 May 2016 15:53:58 +0000 (16:53 +0100)]
gdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT

When evaluating an expression with EVAL_AVOID_SIDE_EFFECTS if the value
we return is forced to be of type not_lval then GDB will be unable to
take the address of the returned value.

Instead, we should properly initialise the LVAL of the returned value.

This commit builds on two previous commits 2520f728b710 (Forward
VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT) and
ac775bf4d35b (gdb: Forward VALUE_LVAL when avoiding side effects for
STRUCTOP_PTR), which in turn build on ac1ca910d74d (Fixes for PR
exp/15364).

This commit is currently untested due to my lack of access to an OpenCL
compiler, however, if follows the same pattern as the first two commits
mentioned above and so I believe that it is correct.

gdb/ChangeLog:

* opencl-lang.c (evaluate_subexp_opencl): If
EVAL_AVOID_SIDE_EFFECTS mode, forward the VALUE_LVAL attribute to
the returned value in the STRUCTOP_STRUCT case.

8 years agogdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_PTR
Andrew Burgess [Tue, 24 May 2016 15:17:52 +0000 (16:17 +0100)]
gdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_PTR

Assume that we have a C program like this:

  struct foo_type
  {
    int var;
  } foo;

  struct foo_type *foo_ptr = &foo;

  int
  main ()
  {
    return foo_ptr->var;
  }

Then GDB should be able to evaluate the following, however, it currently
does not:

  (gdb) start
  ...
  (gdb) whatis &(foo_ptr->var)
  Attempt to take address of value not located in memory.

The problem is that in EVAL_AVOID_SIDE_EFFECTS mode,
eval.c:evaluate_subexp_standard always returns a not_lval value as the
result for a STRUCTOP_PTR operation. As a consequence, the rest of
the code believes that one cannot take the address of the returned
value.

This patch fixes STRUCTOP_PTR handling so that the VALUE_LVAL
attribute for the returned value is properly initialized.  After this
change, the above session becomes:

  (gdb) start
  ...
  (gdb) whatis &(foo_ptr->var)
  type = int *

This commit is largely the same as commit 2520f728b710 (Forward
VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT) but applied
to STRUCTOP_PTR rather than STRUCTOP_STRUCT.  Both of these commits are
building on top of commit ac1ca910d74d (Fixes for PR exp/15364).

gdb/ChangeLog:

* eval.c (evaluate_subexp_standard): If EVAL_AVOID_SIDE_EFFECTS
mode, forward the VALUE_LVAL attribute to the returned value in
the STRUCTOP_PTR case.

gdb/testsuite/ChangeLog:

* gdb.base/whatis.c: Extend the test case.
* gdb.base/whatis.exp: Add additional tests.

8 years agoDon't clear cpu64 nor cpuno64
H.J. Lu [Fri, 27 May 2016 11:56:05 +0000 (04:56 -0700)]
Don't clear cpu64 nor cpuno64

No need to clear cpu64 nor cpuno64 since they will be cleared by
cpu_flags_and.

* config/tc-i386.c (cpu_flags_match): Don't clear cpu64 nor
cpuno64.

8 years agoAdd support for new POWER ISA 3.0 instructions.
Peter Bergner [Fri, 27 May 2016 00:06:51 +0000 (19:06 -0500)]
Add support for new POWER ISA 3.0 instructions.

opcodes/

* ppc-opc.c (CY): New define.  Document it.
(powerpc_opcodes) <addex[.], lwzmx, vmsumudm>: New mnemonics.

gas/
* testsuite/gas/ppc/altivec3.d <vmsumudm>: Add test.
* testsuite/gas/ppc/altivec3.s: Likewise.
* testsuite/gas/ppc/power9.d <addex[.], lwzmx, vmsumudm>: Add tests.
* testsuite/gas/ppc/power9.s: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 27 May 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAppend ".p2align 4" to some x86 directive tests
H.J. Lu [Thu, 26 May 2016 14:55:38 +0000 (07:55 -0700)]
Append ".p2align 4" to some x86 directive tests

Append ".p2align 4" to some x86 directive tests for explicit paddings
for section alignment to avoid implicit section alignment in assembler
listings.

* testsuite/gas/i386/avx512vl-2.l: Append "#pass".
* testsuite/gas/i386/noavx-1.l: Likewise.
* testsuite/gas/i386/nommx-1.l: Likewise.
* testsuite/gas/i386/nosse-1.l: Likewise.
* testsuite/gas/i386/x86-64-avx512vl-2.l: Likewise.
* testsuite/gas/i386/avx512vl-2.s: Append ".p2align 4".
* testsuite/gas/i386/noavx-1.s: Likewise.
* testsuite/gas/i386/nommx-1.s: Likewise.
* testsuite/gas/i386/nosse-1.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vl-2.s: Likewise.

8 years agometag: make an array's type unsigned char[]
Trevor Saunders [Mon, 23 May 2016 11:42:14 +0000 (07:42 -0400)]
metag: make an array's type unsigned char[]

It contains values between 128 and 256 which fit in an unsigned char, but not a
signed char, so we should explicitly use unsigned char to not rely on how these
values are converted to signed char.

gas/ChangeLog:

2016-05-26  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-metag.c (metag_handle_align): Make the type of noop
unsigned char.

8 years agorx: make the type of a variable bfd_reloc_code_real_type
Trevor Saunders [Sun, 22 May 2016 02:24:24 +0000 (22:24 -0400)]
rx: make the type of a variable bfd_reloc_code_real_type

gas/ChangeLog:

2016-05-26  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-rx.c (md_convert_frag): Make the type of reloc_type
bfd_reloc_code_real_type.

8 years agoMIPS/BFD: Don't stop processing on `bfd_reloc_outofrange'
Maciej W. Rozycki [Thu, 26 May 2016 11:24:45 +0000 (12:24 +0100)]
MIPS/BFD: Don't stop processing on `bfd_reloc_outofrange'

Upon a `bfd_reloc_outofrange' error continue processing so that any
further issues are also reported, similarly to how `bfd_reloc_overflow'
is handled.  Adjust message formatting accordingly, using `%X' to abort
processing at conclusion.

Reduce the number of test cases by grouping relocations the handling of
which can now be verified together with a single source and dump.

bfd/
* elfxx-mips.c (_bfd_mips_elf_relocate_section)
<bfd_reloc_outofrange>: Use the `%X%H' rather than `%C' format
for message.  Continue processing rather than returning failure.

ld/
* testsuite/ld-mips-elf/unaligned-jalx-0.d: Fold
`unaligned-jalx-2' here.
* testsuite/ld-mips-elf/unaligned-jalx-mips16-0.d: Fold
`unaligned-jalx-mips16-2' here.
* testsuite/ld-mips-elf/unaligned-jalx-micromips-0.d: Fold
`unaligned-jalx-micromips-2' here.
* testsuite/ld-mips-elf/unaligned-jalx-0.s: Update accordingly.
* testsuite/ld-mips-elf/unaligned-jalx-1.d: Update error
message.
* testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-2.d: Remove test.
* testsuite/ld-mips-elf/unaligned-jalx-mips16-2.d: Remove test.
* testsuite/ld-mips-elf/unaligned-jalx-micromips-2.d: Remove
test.
* testsuite/ld-mips-elf/unaligned-jalx-2.s: Remove test source.
* testsuite/ld-mips-elf/unaligned-lwpc-0.d: Fold
`unaligned-lwpc-3' here.
* testsuite/ld-mips-elf/unaligned-lwpc-0.s: Update accordingly.
* testsuite/ld-mips-elf/unaligned-lwpc-1.d: Fold
`unaligned-lwpc-2' here.
* testsuite/ld-mips-elf/unaligned-lwpc-1.s: Update accordingly.
* testsuite/ld-mips-elf/unaligned-lwpc-2.d: Remove test.
* testsuite/ld-mips-elf/unaligned-lwpc-2.s: Remove test source.
* testsuite/ld-mips-elf/unaligned-lwpc-3.d: Remove test.
* testsuite/ld-mips-elf/unaligned-lwpc-3.s: Remove test source.
* testsuite/ld-mips-elf/unaligned-ldpc-0.d: Fold
`unaligned-ldpc-4' here.
* testsuite/ld-mips-elf/unaligned-ldpc-0.s: Update accordingly.
* testsuite/ld-mips-elf/unaligned-ldpc-1.d: Update error
message.  Fold `unaligned-ldpc-2' and `unaligned-ldpc-3' here.
* testsuite/ld-mips-elf/unaligned-ldpc-1.s: Update accordingly.
* testsuite/ld-mips-elf/unaligned-ldpc-2.d: Remove test.
* testsuite/ld-mips-elf/unaligned-ldpc-2.s: Remove test source.
* testsuite/ld-mips-elf/unaligned-ldpc-3.d: Remove test.
* testsuite/ld-mips-elf/unaligned-ldpc-3.s: Remove test source.
* testsuite/ld-mips-elf/unaligned-ldpc-4.d: Remove test.
* testsuite/ld-mips-elf/unaligned-ldpc-4.s: Remove test source.
* testsuite/ld-mips-elf/mips-elf.exp: Delete removed tests.

8 years agoProvide the __bssstart and __bsssize symbols needed by the MSP430's crt0.o code.
Nick Clifton [Thu, 26 May 2016 10:43:38 +0000 (11:43 +0100)]
Provide the __bssstart and __bsssize symbols needed by the MSP430's crt0.o code.

PR target/20134
* scripttempl/elf32msp430.sc (.bss): Provide __bssstart and
__bsssize.
* scripttempl/elf32msp430_3.sc (.bss): Likewise.

8 years agometag: add extern C to header
Trevor Saunders [Mon, 23 May 2016 11:54:24 +0000 (07:54 -0400)]
metag: add extern C to header

include/ChangeLog:

2016-05-26  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* opcode/metag.h: wrap declarations in extern "C".

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 26 May 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoRequire another match for AVX512VL
H.J. Lu [Wed, 25 May 2016 21:59:05 +0000 (14:59 -0700)]
Require another match for AVX512VL

The AVX512VL bit alone isn't sufficient to select a 128-bit or 256-bit
AVX512 instruction.  We must match another AVX512 bit.

PR gas/20140
* config/tc-i386.c (cpu_flags_match): Require another match
for AVX512VL.
* testsuite/gas/i386/i386.exp: Run avx512vl-1, avx512vl-2,
x86-64-avx512vl-1 and x86-64-avx512vl-2.
* testsuite/gas/i386/avx512vl-1.l: New file.
* testsuite/gas/i386/avx512vl-1.s: Likewise.
* testsuite/gas/i386/avx512vl-2.l: Likewise.
* testsuite/gas/i386/avx512vl-2.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vl-1.l: Likewise.
* testsuite/gas/i386/x86-64-avx512vl-1.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vl-2.l: Likewise.
* testsuite/gas/i386/x86-64-avx512vl-2.s: Likewise.

8 years agoMIPS/BFD: Report `bfd_reloc_outofrange' errors as such
Maciej W. Rozycki [Wed, 25 May 2016 19:59:37 +0000 (20:59 +0100)]
MIPS/BFD: Report `bfd_reloc_outofrange' errors as such

A `bfd_reloc_outofrange' condition from `mips_elf_calculate_relocation'
currently triggers the warning callback, which in the case of LD prints
messages like:

foo.o: In function `foo':
(.text+0x0): warning: JALX to a non-word-aligned address

or:

foo.o: In function `foo':
(.text+0x0): warning: PC-relative load from unaligned address

and nothing else, which suggests this is a benign condition and link has
otherwise successfully run to completion.  This is however not the case,
the link terminates right away with no further messages and no output
produced.

Use the general error or warning info callback then, preserving the
message format.  Also set a BFD error condition so that a failure is
unambiguously reported.  Complement the change with a set of suitable
test suite additions.

bfd/
* elfxx-mips.c (_bfd_mips_elf_relocate_section)
<bfd_reloc_outofrange>: Call `->einfo' rather than `->warning'.
Call `bfd_set_error'.

ld/
* testsuite/ld-mips-elf/unaligned-jalx-0.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-1.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-2.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-mips16-0.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-mips16-2.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-micromips-0.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-micromips-2.d: New test.
* testsuite/ld-mips-elf/unaligned-lwpc-0.d: New test.
* testsuite/ld-mips-elf/unaligned-lwpc-1.d: New test.
* testsuite/ld-mips-elf/unaligned-lwpc-2.d: New test.
* testsuite/ld-mips-elf/unaligned-lwpc-3.d: New test.
* testsuite/ld-mips-elf/unaligned-ldpc-0.d: New test.
* testsuite/ld-mips-elf/unaligned-ldpc-1.d: New test.
* testsuite/ld-mips-elf/unaligned-ldpc-2.d: New test.
* testsuite/ld-mips-elf/unaligned-ldpc-3.d: New test.
* testsuite/ld-mips-elf/unaligned-ldpc-4.d: New test.
* testsuite/ld-mips-elf/unaligned-jalx-0.s: New test source.
* testsuite/ld-mips-elf/unaligned-jalx-1.s: New test source.
* testsuite/ld-mips-elf/unaligned-jalx-2.s: New test source.
* testsuite/ld-mips-elf/unaligned-insn.s: New test source.
* testsuite/ld-mips-elf/unaligned-lwpc-0.s: New test source.
* testsuite/ld-mips-elf/unaligned-lwpc-1.s: New test source.
* testsuite/ld-mips-elf/unaligned-lwpc-2.s: New test source.
* testsuite/ld-mips-elf/unaligned-lwpc-3.s: New test source.
* testsuite/ld-mips-elf/unaligned-ldpc-0.s: New test source.
* testsuite/ld-mips-elf/unaligned-ldpc-1.s: New test source.
* testsuite/ld-mips-elf/unaligned-ldpc-2.s: New test source.
* testsuite/ld-mips-elf/unaligned-ldpc-3.s: New test source.
* testsuite/ld-mips-elf/unaligned-ldpc-4.s: New test source.
* testsuite/ld-mips-elf/unaligned-syms.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

8 years agoEnable VREX for all AVX512 directives
H.J. Lu [Wed, 25 May 2016 18:23:40 +0000 (11:23 -0700)]
Enable VREX for all AVX512 directives

Add all AVX512 bits to CPU_ANY_AVX_FLAGS.

* i386-gen.c (cpu_flag_init): Add CpuVREX to CPU_AVX512DQ_FLAGS,
CPU_AVX512BW_FLAGS, CPU_AVX512VL_FLAGS, CPU_AVX512IFMA_FLAGS
and CPU_AVX512VBMI_FLAGS.  Add CpuAVX512DQ, CpuAVX512BW,
CpuAVX512VL, CpuAVX512IFMA and CpuAVX512VBMI to
CPU_ANY_AVX_FLAGS.
* i386-init.h: Regenerated.

8 years agoEnable VREX for AVX512 directives
H.J. Lu [Wed, 25 May 2016 17:49:25 +0000 (10:49 -0700)]
Enable VREX for AVX512 directives

Enable VREX for AVX512 instructions with upper 16 vector registers.

gas/

PR gas/20141
* testsuite/gas/i386/i386.exp: Run x86-64-pr20141.
* testsuite/gas/i386/x86-64-pr20141.d: New file.
* testsuite/gas/i386/x86-64-pr20141.s: Likewise.

opcodes/

PR gas/20141
* i386-gen.c (cpu_flag_init): Add CpuVREX to CPU_AVX512F_FLAGS,
CPU_AVX512CD_FLAGS, CPU_AVX512ER_FLAGS and CPU_AVX512PF_FLAGS.
* i386-init.h: Regenerated.

8 years agoReimplement .no87/.nommx/.nosse/.noavx directives
H.J. Lu [Wed, 25 May 2016 17:25:50 +0000 (10:25 -0700)]
Reimplement .no87/.nommx/.nosse/.noavx directives

Move all .noXXX directives to cpu_noarch.

gas/

* config/tc-i386.c (arch_entry): Remove negated.
(noarch_entry): New struct.
(cpu_arch): Updated.  Remove .no87, .nommx, .nosse and .noavx.
(cpu_noarch): New.
(set_cpu_arch): Check cpu_noarch after cpu_arch.
(md_parse_option): Allow -march=+nosse.  Check cpu_noarch after
cpu_arch.
(output_message): New function.
(show_arch): Use it.  Handle cpu_noarch.
* testsuite/gas/i386/i386.exp: Run nommx-1, nommx-2, nommx-3,
nosse-1, nosse-2, nosse-3, noavx-1 and noavx-2.
* testsuite/gas/i386/noavx-1.l: New file.
* testsuite/gas/i386/noavx-1.s: Likewise.
* testsuite/gas/i386/noavx-2.s: Likewise.
* testsuite/gas/i386/noavx-2.l: Likewise.
* testsuite/gas/i386/nommx-1.s: Likewise.
* testsuite/gas/i386/nommx-1.l: Likewise.
* testsuite/gas/i386/nommx-2.s: Likewise.
* testsuite/gas/i386/nommx-2.l: Likewise.
* testsuite/gas/i386/nommx-3.s: Likewise.
* testsuite/gas/i386/nommx-3.l: Likewise.
* testsuite/gas/i386/nosse-1.s: Likewise.
* testsuite/gas/i386/nosse-1.l: Likewise.
* testsuite/gas/i386/nosse-2.s: Likewise.
* testsuite/gas/i386/nosse-2.l: Likewise.
* testsuite/gas/i386/nosse-3.s: Likewise.
* testsuite/gas/i386/nosse-3.l: Likewise.

opcodes/

* i386-gen.c (cpu_flag_init): Rename CPU_ANY87_FLAGS to
CPU_ANY_X87_FLAGS.  Add CPU_ANY_MMX_FLAGS.
* i386-init.h: Regenerated.

8 years agoEnable 64-bit archives in ar and ranlib
H.J. Lu [Wed, 25 May 2016 16:46:47 +0000 (09:46 -0700)]
Enable 64-bit archives in ar and ranlib

Since existing ld and gold support the 64-bit (MIPS) ELF archives, we
can use the 64-bit (MIPS) ELF archives as 64-bit archives.  Since the
plugin target is used to create archive in plugin-enabled ar, we need
a way to enable 64-bit archives in the plugin target.  This patch adds
--enable-64-bit-archive to bfd to force 64-bit archives in ar and
ranlib.  Since both 64-bit MIPS and s390 ELF targets currently use
64-bit archives, 64-bit archives are enabled by default for them.
64-bit archive is generated automatically if the archive is too big.

Tested on Linux/x86 and Linux/x86-64 with existing ld and gold.

bfd/

PR binutils/14625
* archive.c (bfd_slurp_armap): Replace
bfd_elf64_archive_slurp_armap with
_bfd_archive_64_bit_slurp_armap.
(bsd_write_armap): Call _bfd_archive_64_bit_write_armap if
BFD64 is defined and the archive is too big.
(coff_write_armap): Likewise.
* archive64.c (bfd_elf64_archive_slurp_armap): Renamed to ...
(_bfd_archive_64_bit_slurp_armap): This.
(bfd_elf64_archive_write_armap): Renamed to ...
(_bfd_archive_64_bit_write_armap): This.
* configure.ac: Add --enable-64-bit-archive.
(want_64_bit_archive): New.  Set to true by default for 64-bit
MIPS and s390 ELF targets.
(USE_64_BIT_ARCHIVE): New AC_DEFINE.
* config.in: Regenerated.
* configure: Likewise.
* elf64-mips.c (bfd_elf64_archive_functions): Removed.
(bfd_elf64_archive_slurp_armap): Likewise.
(bfd_elf64_archive_write_armap): Likewise.
(bfd_elf64_archive_slurp_extended_name_table): Likewise.
(bfd_elf64_archive_construct_extended_name_table): Likewise.
(bfd_elf64_archive_truncate_arname): Likewise.
(bfd_elf64_archive_read_ar_hdr): Likewise.
(bfd_elf64_archive_write_ar_hdr): Likewise.
(bfd_elf64_archive_openr_next_archived_file): Likewise.
(bfd_elf64_archive_get_elt_at_index): Likewise.
(bfd_elf64_archive_generic_stat_arch_elt): Likewise.
(bfd_elf64_archive_update_armap_timestamp): Likewise.
* elf64-s390.c (bfd_elf64_archive_functions): Removed.
(bfd_elf64_archive_slurp_armap): Likewise.
(bfd_elf64_archive_write_armap): Likewise.
(bfd_elf64_archive_slurp_extended_name_table): Likewise.
(bfd_elf64_archive_construct_extended_name_table): Likewise.
(bfd_elf64_archive_truncate_arname): Likewise.
(bfd_elf64_archive_read_ar_hdr): Likewise.
(bfd_elf64_archive_write_ar_hdr): Likewise.
(bfd_elf64_archive_openr_next_archived_file): Likewise.
(bfd_elf64_archive_get_elt_at_index): Likewise.
(bfd_elf64_archive_generic_stat_arch_elt): Likewise.
(bfd_elf64_archive_update_armap_timestamp): Likewise.
* elfxx-target.h (TARGET_BIG_SYM): Use _bfd_archive_64_bit on
BFD_JUMP_TABLE_ARCHIVE if USE_64_BIT_ARCHIVE is defined and
bfd_elfNN_archive_functions isn't defined.
(TARGET_LITTLE_SYM): Likewise.
* libbfd-in.h (_bfd_archive_64_bit_slurp_armap): New prototype.
(_bfd_archive_64_bit_write_armap): Likewise.
(_bfd_archive_64_bit_slurp_extended_name_table): New macro.
(_bfd_archive_64_bit_construct_extended_name_table): Likewise.
(_bfd_archive_64_bit_truncate_arname): Likewise.
(_bfd_archive_64_bit_read_ar_hdr): Likewise.
(_bfd_archive_64_bit_write_ar_hdr): Likewise.
(_bfd_archive_64_bit_openr_next_archived_file): Likewise.
(_bfd_archive_64_bit_get_elt_at_index): Likewise.
(_bfd_archive_64_bit_generic_stat_arch_elt): Likewise.
(_bfd_archive_64_bit_update_armap_timestamp): Likewise.
* libbfd.h: Regenerated.
* plugin.c (plugin_vec): Use _bfd_archive_64_bit on
BFD_JUMP_TABLE_ARCHIVE if USE_64_BIT_ARCHIVE is defined.

binutils/

PR binutils/14625
* NEWS: Mention --enable-64-bit-archive.

8 years agoSkip an archive element if not added by linker
H.J. Lu [Wed, 25 May 2016 15:40:52 +0000 (08:40 -0700)]
Skip an archive element if not added by linker

During archive rescan to resolve symbol references for files added by
LTO, linker add_archive_element callback is called to check if an
archive element should added.  After all IR symbols have been claimed,
linker won't claim new IR symbols and shouldn't add the LTO archive
element.  This patch updates linker add_archive_element callback to
return FALSE when seeing an LTO archive element during rescan and
changes ELF linker to skip such archive element.

bfd/

PR ld/20103
* cofflink.c (coff_link_check_archive_element): Return TRUE if
linker add_archive_element callback returns FALSE.
* ecoff.c (ecoff_link_check_archive_element): Likewise.
* elf64-ia64-vms.c (elf64_vms_link_add_archive_symbols): Skip
archive element if linker add_archive_element callback returns
FALSE.
* elflink.c (elf_link_add_archive_symbols): Likewise.
* pdp11.c (aout_link_check_ar_symbols): Likewise.
* vms-alpha.c (alpha_vms_link_add_archive_symbols): Likewise.
* xcofflink.c (xcoff_link_check_dynamic_ar_symbols): Likewise.
(xcoff_link_check_ar_symbols): Likewise.

ld/

PR ld/20103
* ldmain.c (add_archive_element): Don't claim new IR symbols
after all IR symbols have been claimed.
* plugin.c (plugin_call_claim_file): Remove no_more_claiming
check.
* testsuite/ld-plugin/lto.exp (pr20103): New proc.
Run PR ld/20103 tests.
* testsuite/ld-plugin/pr20103a.c: New file.
* testsuite/ld-plugin/pr20103b.c: Likewise.
* testsuite/ld-plugin/pr20103c.c: Likewise.

8 years agofix spelling of HAVE_LIBPYTHON2_4 in py-value.c
Tom Tromey [Wed, 25 May 2016 13:54:44 +0000 (07:54 -0600)]
fix spelling of HAVE_LIBPYTHON2_4 in py-value.c

Ulrich pointed out that an earlier patch had misspelled
HAVE_LIBPYTHON2_4, adding an extra "_".  This caused a build failure.
This patch fixes the bug.

2016-05-25  Tom Tromey  <tom@tromey.com>

* python/py-value.c (value_object_as_number): Use correct spelling
of HAVE_LIBPYTHON2_4.

8 years agoFix typo in changelog entry
Nick Clifton [Wed, 25 May 2016 12:12:14 +0000 (13:12 +0100)]
Fix typo in changelog entry

8 years agoOnly generate VMOV.I64 instructions for loading constant floating point values if...
Chua Zheng Leong [Wed, 25 May 2016 12:09:51 +0000 (13:09 +0100)]
Only generate VMOV.I64 instructions for loading constant floating point values if this instruction is supported by the currently selected fpu.

PR target/2006764
* config/tc-arm.c (move_or_literal_pool): Only generate a VMOV.I64
instruction if supported by the currently selected fpu variant.
* testsuite/gas/arm/vfpv3-ldr_immediate.s: Add test of this PR.
* testsuite/gas/arm/vfpv3-ldr_immediate.d: Update expected disassembly.

8 years agoFortran, typeprint: Forward level of details to be printed for pointers.
Bernhard Heckel [Wed, 25 May 2016 06:47:18 +0000 (08:47 +0200)]
Fortran, typeprint: Forward level of details to be printed for pointers.

Variable "show" was hardcoded to zero for pointer and reference types.
This implementation didn't allow a correct "whatis" print
for those types and results in same output for "ptype" and "whatis".

Before:
(gdb) whatis t3p
type = PTR TO -> ( Type t3
    integer(kind=4) :: t3_i
    Type t2 :: t2_n
End Type t3 )

After:
(gdb) whatis t3p
type = PTR TO -> ( Type t3 )

2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
* f-typeprint.c (f_type_print_base): Replace 0 by show.

gdb/testsuite/Changelog:
* gdb.fortran/type.f90: Add pointer variable.
* gdb.fortran/whatis_type.exp: Add whatis/ptype of pointers.

8 years agoFortran, testsuite: Fix duplicate testcase name.
Bernhard Heckel [Wed, 25 May 2016 06:47:18 +0000 (08:47 +0200)]
Fortran, testsuite: Fix duplicate testcase name.

2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:
* gdb.fortran/vla-type.exp: Fix testcase name.

8 years agoFortran, testsuite: Add testcases for nested structures.
Bernhard Heckel [Wed, 25 May 2016 06:47:18 +0000 (08:47 +0200)]
Fortran, testsuite: Add testcases for nested structures.

As as result of printing only the outer elements of nested structures,
some testcases have to be added to check for corner cases with VLA's.

2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:
* gdb.fortran/vla-type.exp: Access elements in nested structs.

8 years agoFortran, typeprint: Decrease level of details when printing elements of a structure.
Bernhard Heckel [Wed, 25 May 2016 06:47:17 +0000 (08:47 +0200)]
Fortran, typeprint: Decrease level of details when printing elements of a structure.

According to the typeprint's description, the level of details is
decreased by one for the typeprint of elements of a structure.

Before:
(gdb) ptype t3v
type = Type t3
    integer(kind=4) :: t3_i
    Type t2
        integer(kind=4) :: t2_i
        Type t1
            integer(kind=4) :: t1_i
            real(kind=4) :: t1_r
        End Type t1 :: t1_n
    End Type t2 :: t2_n
End Type t3

After:
(gdb) ptype t3v
type = Type t3
    integer(kind=4) :: t3_i
    Type t2 :: t2_n
End Type t3

2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
* f-typeprint.c (f_type_print_base): Decrease show by one.

gdb/testsuite/Changelog:
* gdb.fortran/type.f90: Add nested structures.
* gdb.fortran/whatis-type.exp: Whatis/ptype nested structures.
* gdb.fortran/derived-type.exp: Adapt expected output.
* gdb.fortran/vla-type.exp: Adapt expected output.

8 years agoFortran, typeprint: Take level of details into account when printing elements of...
Bernhard Heckel [Wed, 25 May 2016 06:47:17 +0000 (08:47 +0200)]
Fortran, typeprint: Take level of details into account when printing elements of a structure.

According to the typeprint's description, elements of a structure
should not be printed when show is < 1.
This variable is also used to distinguish the level of details
between "ptype" and "whatis" expressions.

Before:
(gdb) whatis t1v
type = Type t1
    integer(kind=4) :: t1_i
    real(kind=4) :: t1_r
End Type t1

After:
(gdb) whatis t1v
type = Type t1

2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
* f-typeprint.c (f_type_print_base): Don't print fields when show < 0.

gdb/testsuite/Changelog:
* gdb.fortran/whatis_type.exp: Adapt expected output.

8 years agoFortran, typeprint: Fix wrong indentation when ptype nested structures.
Bernhard Heckel [Wed, 25 May 2016 06:47:16 +0000 (08:47 +0200)]
Fortran, typeprint: Fix wrong indentation when ptype nested structures.

Level of indentation was not proper handled when printing
the elements type's name.

Before:
type = Type t1
integer(kind=4) :: var_1
integer(kind=4) :: var_2
End Type t1

After:
type = Type t1
    integer(kind=4) :: var_1
    integer(kind=4) :: var_2
End Type t1

2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
* f-typeprint.c (f_type_print_base): Take print level into account.

gdb/testsuite/Changelog:
* gdb.fortran/print_type.exp: Fix expected output.
* gdb.fortran/whatis_type.exp: Fix expected output.

8 years agoFortran, testsuite: Use multi_line in whatis_type testcase.
Bernhard Heckel [Wed, 25 May 2016 06:47:16 +0000 (08:47 +0200)]
Fortran, testsuite: Use multi_line in whatis_type testcase.

2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:
* gdb.fortran/whatis_type.exp: Use multi_line.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 25 May 2016 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMIPS/BFD: Unify `bfd_reloc_outofrange' error reporting code
Maciej W. Rozycki [Tue, 24 May 2016 19:45:30 +0000 (20:45 +0100)]
MIPS/BFD: Unify `bfd_reloc_outofrange' error reporting code

bfd/
* elfxx-mips.c (_bfd_mips_elf_relocate_section)
<bfd_reloc_outofrange>: Unify error reporting code.

8 years agoFix PR python/17386 - add __index__ method to gdb.Value
Tom Tromey [Sun, 14 Sep 2014 04:24:50 +0000 (22:24 -0600)]
Fix PR python/17386 - add __index__ method to gdb.Value

This patch fixes PR python/17386.

The bug is that gdb.Value does not implement the Python __index__
method.  This method is needed to convert a Python object to an index
and is used by various operations in Python, such as indexing an
array.

The fix is to implement the nb_index method for gdb.Value.

nb_index was added in Python 2.5.  I don't have a good way to test
Python 2.4, but I made an attempt to accomodate it.

I chose to use valpy_long in all cases because this simplifies porting
to Python 3, and because there didn't seem to be any harm.

Built and regtested on x86-64 Fedora 23.

2016-05-24  Tom Tromey  <tom@tromey.com>

PR python/17386:
* python/py-value.c (value_object_as_number): Add
nb_inplace_floor_divide, nb_inplace_true_divide, nb_index.

2016-05-24  Tom Tromey  <tom@tromey.com>

PR python/17386:
* gdb.python/py-value.exp (test_value_numeric_ops): Add tests that
use value as an index.

8 years agoadd nb_inplace_divide for python 2
Tom Tromey [Mon, 23 May 2016 16:58:51 +0000 (10:58 -0600)]
add nb_inplace_divide for python 2

Python 2's PyNumberMethods has nb_inplace_divide, but Python 3 does
not.  This patch adds it for Python 2.

This buglet didn't cause much fallout because the only non-NULL entry
in value_object_as_number after this is for valpy_divide; and the
missing slot caused it to slide up to nb_floor_divide (where
nb_true_divide was intended).

2016-05-24  Tom Tromey  <tom@tromey.com>

* python/py-value.c (value_object_as_number): Add
nb_inplace_divide for Python 2.

8 years agoFix PR python/17981
Tom Tromey [Thu, 19 May 2016 03:41:28 +0000 (21:41 -0600)]
Fix PR python/17981

PR python/17981 notes that gdb.breakpoints() returns None when there
are no breakpoints; whereas an empty list or tuple would be more in
keeping with Python and the documentation.

This patch fixes the bug by changing the no-breakpoint return to make
an empty tuple.

Built and regtested on x86-64 Fedora 23.

2016-05-23  Tom Tromey  <tom@tromey.com>

PR python/17981:
* python/py-breakpoint.c (gdbpy_breakpoints): Return a new tuple
when there are no breakpoints.

2016-05-23  Tom Tromey  <tom@tromey.com>

* python.texi (Basic Python): Document gdb.breakpoints return.

2016-05-23  Tom Tromey  <tom@tromey.com>

PR python/17981:
* gdb.python/py-breakpoint.exp (test_bkpt_basic): Add test for
no-breakpoint case.

8 years agoPR gdb/19194 - fix typo in the manual
Tom Tromey [Tue, 24 May 2016 15:41:39 +0000 (09:41 -0600)]
PR gdb/19194 - fix typo in the manual

PR gdb/19194 points out a typo in the documentation.  I'm checking
this in as obvious.

2016-05-24  Tom Tromey  <tom@tromey.com>

PR gdb/19194:
* gdb.texinfo (gdb man): Fix typo.

8 years agoFix PR gdb/19828: gdb -p <process from a container>: internal error
Pedro Alves [Tue, 24 May 2016 13:47:57 +0000 (14:47 +0100)]
Fix PR gdb/19828: gdb -p <process from a container>: internal error

When GDB attaches to a process, it looks at the /proc/PID/task/ dir
for all clone threads of that process, and attaches to each of them.

Usually, if there is more than one clone thread, it means the program
is multi threaded and linked with pthreads.  Thus when GDB soon after
attaching finds and loads a libthread_db matching the process, it'll
add a thread to the thread list for each of the initially found
lower-level LWPs.

If, however, GDB fails to find/load a matching libthread_db, nothing
is adding the LWPs to the thread list.  And because of that, "detach"
hits an internal error:

  (gdb) PASS: gdb.threads/clone-attach-detach.exp: fg attach 1: attach
  info threads
    Id   Target Id         Frame
  * 1    LWP 6891 "clone-attach-de" 0x00007f87e5fd0790 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:84
  (gdb) FAIL: gdb.threads/clone-attach-detach.exp: fg attach 1: info threads shows two LWPs
  detach
  .../src/gdb/thread.c:1010: internal-error: is_executing: Assertion `tp' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n)
  FAIL: gdb.threads/clone-attach-detach.exp: fg attach 1: detach (GDB internal error)

From here:

  ...
  #8  0x00000000007ba7cc in internal_error (file=0x98ea68 ".../src/gdb/thread.c", line=1010, fmt=0x98ea30 "%s: Assertion `%s' failed.")
      at .../src/gdb/common/errors.c:55
  #9  0x000000000064bb83 in is_executing (ptid=...) at .../src/gdb/thread.c:1010
  #10 0x00000000004c23bb in get_pending_status (lp=0x12c5cc0, status=0x7fffffffdc0c) at .../src/gdb/linux-nat.c:1235
  #11 0x00000000004c2738 in detach_callback (lp=0x12c5cc0, data=0x0) at .../src/gdb/linux-nat.c:1317
  #12 0x00000000004c1a2a in iterate_over_lwps (filter=..., callback=0x4c2599 <detach_callback>, data=0x0) at .../src/gdb/linux-nat.c:899
  #13 0x00000000004c295c in linux_nat_detach (ops=0xe7bd30, args=0x0, from_tty=1) at .../src/gdb/linux-nat.c:1358
  #14 0x000000000068284d in delegate_detach (self=0xe7bd30, arg1=0x0, arg2=1) at .../src/gdb/target-delegates.c:34
  #15 0x0000000000694141 in target_detach (args=0x0, from_tty=1) at .../src/gdb/target.c:2241
  #16 0x0000000000630582 in detach_command (args=0x0, from_tty=1) at .../src/gdb/infcmd.c:2975
  ...

Tested on x86-64 Fedora 23.  Also confirmed the test passes against
gdbserver with "maint set target-non-stop".

gdb/ChangeLog:
2016-05-24  Pedro Alves  <palves@redhat.com>

PR gdb/19828
* linux-nat.c (attach_proc_task_lwp_callback): Mark the lwp
resumed, and add the thread to GDB's thread list.

testsuite/ChangeLog:
2016-05-24  Pedro Alves  <palves@redhat.com>

PR gdb/19828
* gdb.threads/clone-attach-detach.c: New file.
* gdb.threads/clone-attach-detach.exp: New file.

8 years agoMake gdb/linux-nat.c consider a waitstatus pending on the infrun side
Pedro Alves [Tue, 24 May 2016 13:47:57 +0000 (14:47 +0100)]
Make gdb/linux-nat.c consider a waitstatus pending on the infrun side

Working on the fix for gdb/19828, I saw
gdb.threads/attach-many-short-lived-threads.exp fail once in an
unusual way.  Unfortunately I didn't keep debug logs, but it's an
issue similar to what's been fixed in remote.c a while ago --
linux-nat.c was not fetching the pending status from the right place.

gdb/ChangeLog:
2016-05-24  Pedro Alves  <palves@redhat.com>

PR gdb/19828
* linux-nat.c (get_pending_status): If the thread reported the
event to the core and it's pending, use the pending status signal
number.

8 years ago[Linux] Optimize PID -> struct lwp_info lookup
Pedro Alves [Tue, 24 May 2016 13:47:57 +0000 (14:47 +0100)]
[Linux] Optimize PID -> struct lwp_info lookup

Hacking the gdb.threads/attach-many-short-lived-threads.exp test to
spawn thousands of threads instead of dozens, and running gdb under
perf, I saw that GDB was spending most of the time in find_lwp_pid:

   - captured_main
      - 93.61% catch_command_errors
         - 87.41% attach_command
            - 87.40% linux_nat_attach
               - 87.40% linux_proc_attach_tgid_threads
                  - 82.38% attach_proc_task_lwp_callback
                     - 81.01% find_lwp_pid
                          5.30% ptid_get_lwp
                        + 0.10% ptid_lwp_p
                     + 0.64% add_thread
                     + 0.26% set_running
                     + 0.24% set_executing
                       0.12% ptid_get_lwp
                     + 0.01% ptrace
                     + 0.01% add_lwp

attach_proc_task_lwp_callback is called once for each LWP that we
attach to, found by listing the /proc/PID/task/ directory.  In turn,
attach_proc_task_lwp_callback calls find_lwp_pid to check whether the
LWP we're about to try to attach to is already known.  Since
find_lwp_pid does a linear walk over the whole LWP list, this becomes
quadratic.  We do the /proc/PID/task/ listing until we get two
iterations in a row where we found no new threads.  So the second and
following times we walk the /proc/PID/task/ dir, we're going to take
an even worse find_lwp_pid hit.

Fix this by adding a hash table keyed by LWP PID, for fast lookup.

The linked list embedded in the LWP structure itself is kept, and made
a double-linked list, so that removals from that list are O(1).  An
earlier version of this patch got rid of this list altogether, but
that revealed hidden dependencies / assumptions on how the list is
sorted.  For example, killing a process and then waiting for all the
LWPs status using iterate_over_lwps only works as is because the
leader LWP is always last in the list.  So I thought it better to take
an incremental approach and make this patch concern itself _only_ with
the PID lookup optimization.

gdb/ChangeLog:
2016-05-24  Pedro Alves  <palves@redhat.com>

PR gdb/19828
* linux-nat.c (lwp_lwpid_htab): New htab.
(lwp_info_hash, lwp_lwpid_htab_eq, lwp_lwpid_htab_create)
(lwp_lwpid_htab_add_lwp): New functions.
(lwp_list): Tweak comment.
(lwp_list_add, lwp_list_remove, lwp_lwpid_htab_remove_pid): New
functions.
(purge_lwp_list): Rewrite, using htab_traverse_noresize.
(add_initial_lwp): Add lwp to htab too.  Use lwp_list_add.
(delete_lwp): Use lwp_list_remove.  Remove htab too.
(find_lwp_pid): Search in htab.
(_initialize_linux_nat): Call lwp_lwpid_htab_create.
* linux-nat.h (struct lwp_info) <prev>: New field.

8 years ago[Linux] Avoid refetching core-of-thread if thread hasn't run
Pedro Alves [Tue, 24 May 2016 13:47:57 +0000 (14:47 +0100)]
[Linux] Avoid refetching core-of-thread if thread hasn't run

Hacking the gdb.threads/attach-many-short-lived-threads.exp test to
spawn thousands of threads instead of dozens, I saw GDB having trouble
keeping up with threads being spawned too fast, when it tried to stop
them all.  This was because while gdb is doing that, it updates the
thread list to make sure no new thread has sneaked in that might need
to be paused.  It does this a few times until it sees no-new-threads
twice in a row.  The thread listing update itself is not that
expensive, however, in the Linux backend, updating the threads list
calls linux_common_core_of_thread for each LWP to record on which core
each LWP was last seen running, which opens/reads/closes a /proc file
for each LWP which becomes expensive when you need to do it for
thousands of LWPs.

perf shows gdb in linux_common_core_of_thread 44% of the time, in the
stop_all_threads -> update_thread_list path in this use case.

This patch simply makes linux_common_core_of_thread avoid updating the
core the thread is bound to if the thread hasn't run since the last
time we updated that info.  This makes linux_common_core_of_thread
disappear into the noise in the perf report.

gdb/ChangeLog:
2016-05-24  Pedro Alves  <palves@redhat.com>

PR gdb/19828
* linux-nat.c (linux_resume_one_lwp_throw): Clear the LWP's core
field.
(linux_nat_update_thread_list): Don't fetch the core if already
known.

8 years ago[Linux] Read vDSO range from /proc/PID/task/PID/maps instead of /proc/PID/maps
Pedro Alves [Tue, 24 May 2016 13:47:56 +0000 (14:47 +0100)]
[Linux] Read vDSO range from /proc/PID/task/PID/maps instead of /proc/PID/maps

... as it's _much_ faster.

Hacking the gdb.threads/attach-many-short-lived-threads.exp test to
spawn thousands of threads instead of dozens to stress and debug
timeout problems with gdb.threads/attach-many-short-lived-threads.exp,
I saw that GDB would spend several seconds just reading the
/proc/PID/smaps file, to determine the vDSO mapping range.  GDB opens
and reads the whole file just once, and caches the result, but even
that is too slow.  For example, with almost 8000 threads:

 $ ls /proc/3518/task/ | wc -l
 7906

reading the /proc/PID/smaps file grepping for "vdso" takes over 15
seconds :

 $ time cat /proc/3518/smaps | grep vdso
 7ffdbafee000-7ffdbaff0000 r-xp 00000000 00:00 0                          [vdso]

 real    0m15.371s
 user    0m0.008s
 sys     0m15.017s

Looking around the web for hints, I found a nice description of the
issue here:

 http://backtrace.io/blog/blog/2014/11/12/large-thread-counts-and-slow-process-maps/

The problem is that /proc/PID/smaps wants to show the mappings as
being thread stack, and that has the kernel iterating over all threads
in the thread group, for each mapping.

The fix is to use the "map" file under /proc/PID/task/PID/ instead of
the /proc/PID/ one, as the former doesn't mark thread stacks for all
threads.

That alone drops the timing to the millisecond range on my machine:

 $ time cat /proc/3518/task/3518/smaps | grep vdso
 7ffdbafee000-7ffdbaff0000 r-xp 00000000 00:00 0                          [vdso]

 real    0m0.150s
 user    0m0.009s
 sys     0m0.084s

And since we only need the vdso mapping's address range, we can use
"maps" file instead of "smaps", and it's even cheaper:

/proc/PID/task/PID/maps :

 $ time cat /proc/3518/task/3518/maps | grep vdso
 7ffdbafee000-7ffdbaff0000 r-xp 00000000 00:00 0                          [vdso]

 real    0m0.027s
 user    0m0.000s
 sys     0m0.017s

gdb/ChangeLog:
2016-05-24  Pedro Alves  <palves@redhat.com>

PR gdb/19828
* linux-tdep.c (find_mapping_size): Delete.
(linux_vsyscall_range_raw): Rewrite reading from
/proc/PID/task/PID/maps directly instead of using
gdbarch_find_memory_regions.

8 years agoLinux native thread create/exit events support
Pedro Alves [Tue, 24 May 2016 13:47:56 +0000 (14:47 +0100)]
Linux native thread create/exit events support

A following patch (fix for gdb/19828) makes linux-nat.c add threads to
GDB's thread list earlier in the "attach" sequence, and that causes a
surprising regression on
gdb.threads/attach-many-short-lived-threads.exp on my machine.  The
extra "thread x exited" handling and traffic slows down that test
enough that GDB core has trouble keeping up with new threads that are
spawned while trying to stop existing ones.

I saw the exact same issue with remote/gdbserver a while ago and fixed
it in 65706a29bac5 (Remote thread create/exit events) so part of the
fix here is the exact same -- add support for thread created events to
gdb/linux-nat.c.  infrun.c:stop_all_threads enables those events when
it tries to stop threads, which ensures that new threads never get a
chance to themselves start new threads, thus fixing the race.

gdb/
2016-05-24  Pedro Alves  <palves@redhat.com>

PR gdb/19828
* linux-nat.c (report_thread_events): New global.
(linux_handle_extended_wait): Report
TARGET_WAITKIND_THREAD_CREATED if thread event reporting is
enabled.
(wait_lwp, linux_nat_filter_event): Report all thread exits if
thread event reporting is enabled.  Remove comment.
(filter_exit_event): New function.
(linux_nat_wait_1): Use it.
(linux_nat_thread_events): New function.
(linux_nat_add_target): Install it as target_thread_events method.

8 years agoMIPS/GAS: Treat local jump relocs the same no matter if REL or RELA
Maciej W. Rozycki [Tue, 24 May 2016 12:54:31 +0000 (13:54 +0100)]
MIPS/GAS: Treat local jump relocs the same no matter if REL or RELA

Do not convert jump relocs against local MIPS16 or microMIPS symbols to
refer to a section symbol instead even on RELA targets, as it makes it
impossible for the linker to make a JAL to JALX conversion based on ISA
symbol annotation, breaking regular and compressed MIPS interlinking.

gas/
* config/tc-mips.c (mips_fix_adjustable): Also return 0 for
jump relocations against MIPS16 or microMIPS symbols on RELA
targets.
* testsuite/gas/mips/jalx-local.d: New test.
* testsuite/gas/mips/jalx-local-n32.d: New test.
* testsuite/gas/mips/jalx-local-n64.d: New test.
* testsuite/gas/mips/jalx-local.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

ld/
* testsuite/ld-mips-elf/jalx-local.d: New test.
* testsuite/ld-mips-elf/jalx-local-n32.d: New test.
* testsuite/ld-mips-elf/jalx-local-n64.d: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

8 years agoMIPS/GAS: Cut TLS reloc dead code path in `md_apply_fix'
Maciej W. Rozycki [Tue, 24 May 2016 13:05:19 +0000 (14:05 +0100)]
MIPS/GAS: Cut TLS reloc dead code path in `md_apply_fix'

With code refactoring made in commit b886a2ab0d52 and the addition of
`calculate_reloc' and a separate test for TLS relocs against constants
made there the preexisting fall-through from the TLS reloc switch case
has effectively become a dead execution path.  This is because the call
to `calculate_reloc' present there is only made if `fixP->fx_done' is
true, which can only be the case if `fixP->fx_addsy' is NULL, which in
turn has already triggered the TLS reloc test and made execution break
out of the switch statement.

Remove the fall-through then and reshape code accordingly.

gas/
* config/tc-mips.c (md_apply_fix)
<BFD_RELOC_MIPS16_TLS_TPREL_LO16>: Remove fall-through, adjust
code accordingly.

8 years agoxtensa: make map_suffix_reloc_to_operator return operatorT
Trevor Saunders [Mon, 23 May 2016 04:39:47 +0000 (00:39 -0400)]
xtensa: make map_suffix_reloc_to_operator return operatorT

It always returns an element of the enum operatorT, so it should be clearer to
make that the return type.

gas/ChangeLog:

2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-xtensa.c (struct suffix_reloc_map): Change type of field
operator to operatorT.
(map_suffix_reloc_to_operator): Change return type to operatorT.

8 years agod30v: make var type operatorT
Trevor Saunders [Sun, 22 May 2016 07:39:00 +0000 (03:39 -0400)]
d30v: make var type operatorT

gas/ChangeLog:

2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-d30v.c (find_format): Change type of X_op to operatorT.

8 years agommix: constify handler_charp
Trevor Saunders [Sun, 22 May 2016 04:32:22 +0000 (00:32 -0400)]
mmix: constify handler_charp

gas/ChangeLog:

2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-mmix.c (mmix_parse_predefined_name): Change type of
handler_charp to const char *.

8 years agoft32: fixup TARGET_FORMAT
Trevor Saunders [Sat, 21 May 2016 08:21:32 +0000 (04:21 -0400)]
ft32: fixup TARGET_FORMAT

Nothing ever assigns to ft32_target_format, so its always null, which means the
bfd target arch is the default one.  It looks like ft32 only has one target
format, so we can just define TARGET_FORMAT to be that literal string.

gas/ChangeLog:

2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-ft32.h (DEFAULT_TARGET_FORMAT): Remove.
(ft32_target_format): Likewise.
(TARGET_FORMAT): Adjust.

8 years agoia64: use XOBNEW and XOBNEWVEC
Trevor Saunders [Fri, 20 May 2016 10:33:35 +0000 (06:33 -0400)]
ia64: use XOBNEW and XOBNEWVEC

gas/ChangeLog:

2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-ia64.c (dot_rot): simplify allocations from obstacks.
(ia64_frob_label): Likewise.

8 years agochange some variable's type to op_err
Trevor Saunders [Fri, 13 May 2016 08:05:59 +0000 (04:05 -0400)]
change some variable's type to op_err

They only hold values from the op_err enum, so it should be clearer to give
them the enum type.

gas/ChangeLog:

2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-cr16.c (check_range): Make type of retval op_err.
* config/tc-crx.c: Likewise.

8 years agoFix syntax error in annota-input-while-running.exp
Francis Ricci [Tue, 24 May 2016 11:07:00 +0000 (12:07 +0100)]
Fix syntax error in annota-input-while-running.exp

This patch fixes a syntax error which caused a failure in
annota-input-while-running.exp to crash the test suite runner.

2016-05-24  Francis Ricci  <francisjricci@gmail.com>

* gdb.base/annota-input-while-running.exp: Fix syntax error.

8 years agoAdd myself as a write-after-approval GDB maintainer
Yan-Ting Lin [Tue, 24 May 2016 08:41:13 +0000 (16:41 +0800)]
Add myself as a write-after-approval GDB maintainer

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add "Yan-Ting Lin".

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 24 May 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoEnable R_AARCH64_NONE for 64-bit code.
Jim Wilson [Mon, 23 May 2016 23:38:21 +0000 (16:38 -0700)]
Enable R_AARCH64_NONE for 64-bit code.

* elfnn-aarch64.c: Unconditionally enable R_AARCH64_NULL and
R_AARCH64_NONE.  Use HOWTO64 for R_AARCH64_NULL.
* relocs.c: Add BFD_RELOC_AARCH64_NULL.
* bfd-in2.h: Regenerate.
* libbfd.h: Likewise.

8 years agoSkip unwritable frames in command "finish"
Yao Qi [Mon, 23 May 2016 16:32:56 +0000 (17:32 +0100)]
Skip unwritable frames in command "finish"

Nowadays, GDB can't insert breakpoint on the return address of the
exception handler on ARM M-profile, because the address is a magic
one 0xfffffff9,

 (gdb) bt
 #0  CT32B1_IRQHandler () at ../src/timer.c:67
 #1  <signal handler called>
 #2  main () at ../src/timer.c:127

(gdb) info frame
Stack level 0, frame at 0x200ffa8:
 pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9
 called by frame at 0x200ffc8
 source language c.
 Arglist at 0x200ffa0, args:
 Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8
 Saved registers:
  r7 at 0x200ffa0, lr at 0x200ffa4

(gdb) x/x 0xfffffff9
0xfffffff9:     Cannot access memory at address 0xfffffff9

(gdb) finish
Run till exit from #0  CT32B1_IRQHandler () at ../src/timer.c:67
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)

Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

Command aborted.

even some debug probe can't set hardware breakpoint on the magic
address too,

(gdb) hbreak *0xfffffff9
Hardware assisted breakpoint 2 at 0xfffffff9
(gdb) c
Continuing.
Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?)

Warning:
Cannot insert hardware breakpoint 2.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

Command aborted.

The problem described above is quite similar to PR 8841, in which GDB
can't set breakpoint on signal trampoline, which is mapped to a read-only
page by kernel.  The rationale of this patch is to skip "unwritable"
frames when looking for caller frames in command "finish", and a new
gdbarch method code_of_frame_writable is added.  This patch fixes
the problem on ARM cortex-m target, but it can be used to fix
PR 8841 too.

gdb:

2016-05-10  Yao Qi  <yao.qi@arm.com>

* arch-utils.c (default_code_of_frame_writable): New function.
* arch-utils.h (default_code_of_frame_writable): Declare.
* arm-tdep.c (arm_code_of_frame_writable): New function.
(arm_gdbarch_init): Install gdbarch method
code_of_frame_writable if the target is M-profile.
* frame.c (skip_unwritable_frames): New function.
* frame.h (skip_unwritable_frames): Declare.
* gdbarch.sh (code_of_frame_writable): New.
* gdbarch.c, gdbarch.h: Re-generated.
* infcmd.c (finish_command): Call skip_unwritable_frames.

8 years agoFix PR python/19438, PR python/18393 - initialize dictionaries
Tom Tromey [Thu, 19 May 2016 03:19:17 +0000 (21:19 -0600)]
Fix PR python/19438, PR python/18393 - initialize dictionaries

This fixes PR python/19438 and PR python/18393.  Both bugs are about
invoking dir() on some Python object implemented by gdb, and getting a
crash.

The crash happens because the dictionary field of these objects was
not initialized.  Apparently what happens is that this field can be
lazily initialized by Python when assigning to an attribute; and it
can also be handled ok when using dir() but without __dict__ defined;
but gdb defines __dict__ because this isn't supplied automatically by
Python.

The docs on this seem rather sparse, but this patch works ok.

An alternative might be to lazily create the dictionary in
gdb_py_generic_dict, but I went with this approach because it seemed
more straightforward.

Built and regtested on x86-64 Fedora 23.

2016-05-23  Tom Tromey  <tom@tromey.com>

PR python/19438, PR python/18393:
* python/py-objfile.c (objfpy_initialize): Initialize self->dict.
* python/py-progspace.c (pspy_initialize): Initialize self->dict.

2016-05-23  Tom Tromey  <tom@tromey.com>

PR python/19438, PR python/18393:
* gdb.python/py-progspace.exp: Add "dir" test.
* gdb.python/py-objfile.exp: Add "dir" test.

8 years ago[ARC] Update instruction type and delay slot info.
Claudiu Zissulescu [Thu, 19 May 2016 10:19:32 +0000 (12:19 +0200)]
[ARC] Update instruction type and delay slot info.

This patch corrects the instructioninformation passed into the
disassebler_info structure.

include/
2016-05-23  Claudiu Zissulescu  <claziss@synopsys.com>

* opcode/arc.h (insn_subclass_t): Add COND.
(flag_class_t): Add F_CLASS_EXTEND.

opcodes/
2016-05-23  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-dis.c (print_flags): Set branch_delay_insns, and insn_type
information.
(print_insn_arc): Set insn_type information.
* arc-opc.c (C_CC): Add F_CLASS_COND.
* arc-tbl.h (bbit0, bbit1): Update subclass to COND.
(beq_s, bge_s, bgt_s, bhi_s, bhs_s): Likewise.
(ble_s, blo_s, bls_s, blt_s, bne_s): Likewise.
(breq, breq_s, brge, brhs, brlo, brlt): Likewise.
(brne, brne_s, jeq_s, jne_s): Likewise.

8 years ago[ARC] Add XY registers, update neg instruction.
Claudiu Zissulescu [Thu, 19 May 2016 10:33:17 +0000 (12:33 +0200)]
[ARC] Add XY registers, update neg instruction.

gas/
2016-05-23  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (md_begin): Add XY registers.
(cpu_types): Code density is default off for ARC EM.

opcodes/
2016-05-23  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-tbl.h (neg): New instruction variant.

8 years ago[ARC] Rename "class" named attributes.
Claudiu Zissulescu [Mon, 23 May 2016 15:25:46 +0000 (17:25 +0200)]
[ARC] Rename "class" named attributes.

gas/
2016-05-23  Cupertino Miranda  <cmiranda@synopsys.com>

* config/tc-arc.c (attributes_t): Renamed attribute class to
attr_class.
(find_opcode_match, assemble_insn, tokenize_extinsn): Changed.

opcode/
2016-05-23  Cupertino Miranda  <cmiranda@synopsys.com>

* arc-dis.c (find_format, find_format, get_auxreg)
(print_insn_arc): Changed.
* arc-ext.h (INSERT_XOP): Likewise.

include/
2016-05-23  Cupertino Miranda  <cmiranda@synopsys.com>

* opcode/arc.h (struct arc_opcode): Renamed attribute class to
insn_class.
(struct arc_flag_class): Renamed attribute class to flag_class.

8 years agoUse standard_testfile in gdb.arch/thumb-prologue.exp and gdb.arch/thumb2-it.exp
Yao Qi [Mon, 23 May 2016 14:45:12 +0000 (15:45 +0100)]
Use standard_testfile in gdb.arch/thumb-prologue.exp and gdb.arch/thumb2-it.exp

This patch fixes the errors below:

Running /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.arch/thumb-prologue.exp ...
gdb compile failed, arm-linux-gnueabihf/bin/ld: cannot open output file /scratch/yao/gdb/build-git/arm-linux-gnueabihf/gdb/testsuite/gdb.arch/thumb-prologue: No such file or directory
collect2: error: ld returned 1 exit status
Running /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.arch/thumb2-it.exp ...
gdb compile failed, arm-linux-gnueabihf/bin/ld: cannot open output file /scratch/yao/gdb/build-git/arm-linux-gnueabihf/gdb/testsuite/gdb.arch/thumb2-it: No such file or directory

gdb/testsuite:

2016-05-23  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/thumb-prologue.exp: Use standard_testfile.
* gdb.arch/thumb2-it.exp: Likewise.

8 years agooops - omitted from previous delta
Nick Clifton [Mon, 23 May 2016 12:56:46 +0000 (13:56 +0100)]
oops - omitted from previous delta

8 years agoAdd support for configuring for the ARM Phoenix target.
Kuba Sejdak [Mon, 23 May 2016 12:53:07 +0000 (13:53 +0100)]
Add support for configuring for the ARM Phoenix target.

bfd * config.bfd: Add entry for arm-phoenix.

gas * configuse.tgt: Add entry for arm-phoenix.

ld * Makefile.am: Add earmelf_phoenix.c.
* Makefile.in: Regenerate.
* configure.tgt: Add entry for arm-phoenix.
* emulparams/armelf_phoenix.sh: New file.

8 years agoRemove unused libthread_db td_thr_validate reference
Gary Benson [Mon, 23 May 2016 12:26:47 +0000 (13:26 +0100)]
Remove unused libthread_db td_thr_validate reference

Native GDB looks up the function td_thr_validate from libthread_db.so
on Linux, but the value is never used.  This commit removes this dead
code.

gdb/ChangeLog:

* nat/gdb_thread_db.h (td_thr_validate_ftype): Remove typedef.
* linux-thread-db.c (struct thread_db_info) <td_thr_validate_p>:
Remove field.
(try_thread_db_load_1): Remove td_thr_validate initialization.

8 years agoSync config.guess and config.sub with FSF GCC mainline versions
Nick Clifton [Mon, 23 May 2016 10:42:17 +0000 (11:42 +0100)]
Sync config.guess and config.sub with FSF GCC mainline versions

8 years agoSupport for dedicated ARM stub section with padding
Thomas Preud'homme [Mon, 23 May 2016 08:41:36 +0000 (09:41 +0100)]
Support for dedicated ARM stub section with padding

2016-05-23  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (arm_dedicated_stub_section_padding): New function.
(elf32_arm_size_stubs): Declare stub_type in a more outer scope and
account for padding for stub section requiring one.
(elf32_arm_build_stubs): Add comment to stress the importance of
zeroing veneer section content.

8 years agoSupport for dedicated output section for some ARM veneer types
Thomas Preud'homme [Mon, 23 May 2016 08:38:32 +0000 (09:38 +0100)]
Support for dedicated output section for some ARM veneer types

2016-05-23  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* bfd-in.h (bfd_elf32_arm_keep_private_stub_output_sections): Declare
bfd hook.
* bfd-in2.h: Regenerate.
* elf32-arm.c (arm_dedicated_stub_output_section_required): New
function.
(arm_dedicated_stub_output_section_required_alignment): Likewise.
(arm_dedicated_stub_output_section_name): Likewise.
(arm_dedicated_stub_input_section_ptr): Likewise.
(elf32_arm_create_or_find_stub_sec): Add stub type parameter and
function description comment. Add support for dedicated output stub
section to given stub types.
(elf32_arm_add_stub): Add a stub type parameter and pass it down to
elf32_arm_create_or_find_stub_sec.
(elf32_arm_create_stub): Pass stub type down to elf32_arm_add_stub.
(elf32_arm_size_stubs): Pass stub type when calling
elf32_arm_create_or_find_stub_sec for Cortex-A8 erratum veneers.
(bfd_elf32_arm_keep_private_stub_output_sections): New function.

ld/
* emultempl/armelf.em (arm_elf_before_allocation): Call
bfd_elf32_arm_keep_private_stub_output_sections before generic
before_allocation function.

8 years agoSearch for libutil-freebsd as alternative to libutil
Jon Boden [Mon, 23 May 2016 07:46:33 +0000 (08:46 +0100)]
Search for libutil-freebsd as alternative to libutil

GDB needs kinfo_getvmmap() on GNU/kFreeBSD systems same as on
pure FreeBSD.  However on these systems the FreeBSD version of libutil
is renamed to libutil-freebsd.

2016-05-23  Jon Boden  <jon@ubuntubsd.org>

* configure.ac: Search for libutil-freebsd as alternative to libutil.
* configure: Re-generated.

8 years agotic54x: use concat more
Trevor Saunders [Thu, 19 May 2016 02:48:34 +0000 (22:48 -0400)]
tic54x: use concat more

gas/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-tic54x.c (tic54x_sect): simplify string creation.

8 years agospu: make some constants unsigned
Trevor Saunders [Thu, 19 May 2016 02:39:18 +0000 (22:39 -0400)]
spu: make some constants unsigned

The field in spu_opcode is unsigned, and for some values of opcode we can end
up shifting into the high bit.  So avoid possibly creating a negative number
and then assigning it to a unsigned field by shifting an unsigned constant.

gas/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-spu.c (APUOP): Use OPCODE as an unsigned constant.

8 years agotic54x: rename typedef of struct symbol_
Trevor Saunders [Thu, 19 May 2016 03:48:48 +0000 (23:48 -0400)]
tic54x: rename typedef of struct symbol_

generic gas code has a struct symbol, and tic54x typedefs a struct to symbol.
This seems at least rather confusing, and it seems like target specific headers
shouldn't  put such generic names in the global namespace preventing other
generic code from using them.

opcodes/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* tic54x-dis.c (sprint_mmr): Adjust.
* tic54x-opc.c: Likewise.

gas/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-tic54x.c (tic54x_mmregs): Adjust.
(md_begin): Likewise.
(encode_condition): Likewise.
(encode_cc3): Likewise.
(encode_cc2): Likewise.
(encode_operand): Likewise.
(tic54x_undefined_symbol): Likewise.

include/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* opcode/tic54x.h (struct symbol_): typedef to tic54x_symbol instead of
plain symbol.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 23 May 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 22 May 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 21 May 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoDon't check R_386_GOT32 when setting need_convert_load
H.J. Lu [Fri, 20 May 2016 16:36:48 +0000 (09:36 -0700)]
Don't check R_386_GOT32 when setting need_convert_load

Since we no longer convert R_386_GOT32, don't check R_386_GOT32 when
setting need_convert_load.

* elf32-i386.c (elf_i386_check_relocs): Don't check R_386_GOT32
when setting need_convert_load.

8 years agoMIPS: Add support for P6600
Matthew Fortune [Fri, 20 May 2016 14:20:42 +0000 (15:20 +0100)]
MIPS: Add support for P6600

gas/
* config/tc-mips.c (mips_cpu_info_table): Update comment. Add
p6600 entry.
* doc/c-mips.texi: Document p6600 -march option.

8 years agoPreserve addend for R_386_GOT32 and R_X86_64_GOT32
H.J. Lu [Fri, 20 May 2016 13:01:28 +0000 (06:01 -0700)]
Preserve addend for R_386_GOT32 and R_X86_64_GOT32

We should preserve addend for R_386_GOT32 and R_X86_64_GOT32 as in
"movl $foo@GOT + 4, %eax" and "movq $foo@GOT + 4, %rax".

PR gas/19600
* config/tc-i386.c (md_apply_fix): Preserve addend for
BFD_RELOC_386_GOT32 and BFD_RELOC_X86_64_GOT32.
* testsuite/gas/i386/addend.d: New file.
* testsuite/gas/i386/addend.s: Likewise.
* testsuite/gas/i386/x86-64-addend.d: Likewise.
* testsuite/gas/i386/x86-64-addend.s: Likewise.
* testsuite/gas/i386/i386.exp: Run addend and x86-64-addend.
* testsuite/gas/i386/reloc32.d: Updated.

8 years agoMIPS: Fix the encoding of immediates with microMIPS JALX
Maciej W. Rozycki [Fri, 20 May 2016 12:32:19 +0000 (13:32 +0100)]
MIPS: Fix the encoding of immediates with microMIPS JALX

The microMIPS JALX instruction shares the R_MICROMIPS_26_S1 relocation
with microMIPS J/JAL/JALS instructions, however unlike the latters its
encoded immediate argument is unusually shifted left by 2 rather than 1
in calculating the value used for the operation requested.

We already handle this exception in `mips_elf_calculate_relocation' in
LD, in a scenario where JALX is produced as a result of relaxing JAL for
the purpose of making a cross-mode jump.  We also get it right in the
disassembler in `decode_micromips_operand'.

What we don't correctly do however is processing microMIPS JALX produced
by GAS from an assembly source, where a non-zero constant argument or a
symbol reference with a non-zero in-place addend has been used.  In this
case the same calculation is made as for microMIPS J/JAL/JALS, causing
the wrong encoding to be produced by GAS on making an object file, and
then again by LD in the final link.  The latter in particular causes the
calculation, where the addend fits in the relocatable field, to produce
different final addresses for the same source code depending on whether
REL or RELA relocations are used.

Correct these issues by special-casing microMIPS JALX in the places that
have been previously missed.

bfd/
* elfxx-mips.c (mips_elf_read_rel_addend): Adjust the addend for
microMIPS JALX.

gas/
* config/tc-mips.c (append_insn): Correct the encoding of a
constant argument for microMIPS JALX.
(tc_gen_reloc): Correct the encoding of an in-place addend for
microMIPS JALX.
* testsuite/gas/mips/jalx-addend.d: New test.
* testsuite/gas/mips/jalx-addend-n32.d: New test.
* testsuite/gas/mips/jalx-addend-n64.d: New test.
* testsuite/gas/mips/jalx-imm.d: New test.
* testsuite/gas/mips/jalx-imm-n32.d: New test.
* testsuite/gas/mips/jalx-imm-n64.d: New test.
* testsuite/gas/mips/jalx-addend.s: New test source.
* testsuite/gas/mips/jalx-imm.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

ld/
* testsuite/ld-mips-elf/jalx-addend.d: New test.
* testsuite/ld-mips-elf/jalx-addend-n32.d: New test.
* testsuite/ld-mips-elf/jalx-addend-n64.d: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

8 years agoMIPS/GAS: Correct tab-after-space formatting mistakes
Maciej W. Rozycki [Fri, 20 May 2016 11:41:50 +0000 (12:41 +0100)]
MIPS/GAS: Correct tab-after-space formatting mistakes

* config/tc-mips.c: Correct tab-after-space formatting mistakes
throughout.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 20 May 2016 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoDon't allow COPY relocations for protected symbols.
Cary Coutant [Thu, 19 May 2016 21:58:18 +0000 (14:58 -0700)]
Don't allow COPY relocations for protected symbols.

gold/
PR gold/19823
* copy-relocs.cc (Copy_relocs::make_copy_reloc): Add object
parameter; check for protected symbol.
* copy-relocs.h (Copy_relocs::make_copy_reloc): Add object parameter.
* mips.cc (Mips_copy_relocs): Adjust call to make_copy_reloc.
* symtab.cc (Symbol::init_fields): Initialize is_protected_.
(Symbol_table::add_from_dynobj): Mark protected symbols.
* symtab.h (Symbol::is_protected): New method.
(Symbol::set_is_protected): New method.
(Symbol::is_protected_): New data member.

* testsuite/Makefile.am (copy_test_protected): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/copy_test.cc (main): Add legal reference to protected
symbol.
* testsuite/copy_test_v1.cc (main): Likewise.
* testsuite/copy_test_2.cc (ip): Add protected symbol.
* testsuite/copy_test_protected.cc: New test source file.
* testsuite/copy_test_protected.sh: New test script.

8 years agoFix non-deterministic behavior when generating MIPS GOT.
Vladimir Radosavljevic [Thu, 19 May 2016 21:57:14 +0000 (14:57 -0700)]
Fix non-deterministic behavior when generating MIPS GOT.

* mips.cc (Mips_got_entry::Mips_got_entry): Remove object argument
for global got symbols, and set addend to 0.
(Mips_got_entry::hash): Change hash algorithm.
(Mips_got_entry::equals): Refactor.
(Mips_got_entry::object): Return input object for local got symbols
from union d.
(Mips_got_entry::addend): Change return of the relocation addend.
(Mips_got_entry::addend_): Move from union d.
(Mips_got_entry::object_): Move into union d.
(class Mips_symbol_hash): New class.
(Mips_got_info::Global_got_entry_set): New type.
(Mips_got_info::global_got_symbols): Change return type to
Global_got_entry_set.
(Mips_got_info::global_got_symbols_): Change type to
Global_got_entry_set.
(Mips_symbol::hash): New method.
(Mips_output_data_la25_stub::symbols_): Change type to std::vector.
(Mips_output_data_mips_stubs::Mips_stubs_entry_set): New type.
(Mips_output_data_mips_stubs::symbols_): Change type to
Mips_stubs_entry_set.
(Mips_got_info::record_global_got_symbol): Don't pass object
argument when creating global got symbol.
(Mips_got_info::record_got_entry): Remove find before inserting
got entries.
(Mips_got_info::add_reloc_only_entries): Change type of iterator
to Global_got_entry_set.
(Mips_got_info::count_got_symbols): Likewise.
(Mips_output_data_la25_stub::create_la25_stub): Use push_back
for adding entries to symbols_.
(Mips_output_data_la25_stub::do_write): Change type of iterator
to std::vector.
(Mips_output_data_mips_stubs::set_lazy_stub_offsets): Change type
of iterator to Mips_stubs_entry_set.
(Mips_output_data_mips_stubs::set_needs_dynsym_value): Likewise.
(Mips_output_data_mips_stubs::do_write): Likewise.

8 years agoDon't convert R_386_GOT32 relocation
H.J. Lu [Thu, 19 May 2016 19:56:55 +0000 (12:56 -0700)]
Don't convert R_386_GOT32 relocation

Don't convert R_386_GOT32 since we can't tell if it is applied
to "mov $foo@GOT, %reg" which isn't a load via GOT.

bfd/

PR ld/20117
* elf32-i386.c (elf_i386_convert_load_reloc): Don't check
R_386_GOT32X.
(elf_i386_convert_load): Don't convert R_386_GOT32.

ld/

PR ld/20117
* testsuite/ld-i386/i386.exp: Run pr20117.
* testsuite/ld-i386/pr19609-1i.d: Updated.
* testsuite/ld-i386/pr20117.d: New file.
* testsuite/ld-i386/pr20117.s: Likewise.

8 years agoSet sh_entsize for .init_array and similar.
Alan Modra [Thu, 19 May 2016 15:03:42 +0000 (00:33 +0930)]
Set sh_entsize for .init_array and similar.

PR gas/20118
* elf.c (elf_fake_sections): Set sh_entsize for SHT_INIT_ARRAY,
SHT_FINI_ARRAY, and SHT_PREINIT_ARRAY.

8 years agoFix invalid implicit conversions from void *
Andreas Schwab [Thu, 19 May 2016 12:43:56 +0000 (14:43 +0200)]
Fix invalid implicit conversions from void *

* ia64-libunwind-tdep.c (libunwind_descr): Add cast from void *.
(libunwind_frame_set_descr): Likewise.
(libunwind_frame_cache): Likewise.
(libunwind_frame_dealloc_cache): Likewise.
(libunwind_frame_sniffer): Likewise.
(libunwind_search_unwind_table): Likewise.
(libunwind_sigtramp_frame_sniffer): Likewise.
(libunwind_get_reg_special): Likewise.
(libunwind_load): Likewise.
* ia64-linux-nat.c (ia64_linux_fetch_register): Likewise.
(ia64_linux_store_register): Likewise.
(ia64_linux_xfer_partial): Likewise.
* ia64-tdep.c (ia64_access_reg): Likewise.
(ia64_access_fpreg): Likewise.
(ia64_access_rse_reg): Likewise.
(ia64_access_rse_fpreg): Likewise.

8 years ago[ARC] Fixed-linker-related-testsuite-for-ARC
Claudiu Zissulescu [Thu, 19 May 2016 12:51:53 +0000 (14:51 +0200)]
[ARC] Fixed-linker-related-testsuite-for-ARC

ld/
2016-05-19  Cupertino Miranda  <cmiranda@synopsys.com>

* testsuite/ld-elf/compressed1d.d: Removed from notarget.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/eh-frame-hdr.d: Removed from xfail.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-srec/srec.exp: Likewise.
* testsuite/lib/ld-lib.exp (check_gc_sections_available): Mark ARC
as supporting gc.
(check_shared_lib_support): Mark ARC as supporting.

8 years ago[ARC] Emulation and default script template changes.
Claudiu Zissulescu [Thu, 19 May 2016 12:44:01 +0000 (14:44 +0200)]
[ARC] Emulation and default script template changes.

2016-05-19  Cupertino Miranda  <cmiranda@synopsys.com>

* emulparams/arcelf.sh: Changed.
* emulparams/arclinux.sh: Likewise.
* scripttempl/arclinux.sc: Moved to a more standard implementation
similar to elf.sc.

8 years ago[ARC] BFD fixes.
Claudiu Zissulescu [Thu, 19 May 2016 12:39:36 +0000 (14:39 +0200)]
[ARC] BFD fixes.

2016-05-19  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (arc_elf_final_write_processing): Changed.
(debug_arc_reloc): Likewise.
(elf_arc_relocate_section): Likewise.
(elf_arc_check_relocs): Likewise.
(elf_arc_adjust_dynamic_symbol): Likewise.
(elf_arc_add_symbol_hook): Likewise.

8 years agoLD/testsuite: Fix `ft32-*-*' position in `check_shared_lib_support'
Maciej W. Rozycki [Thu, 19 May 2016 10:19:04 +0000 (11:19 +0100)]
LD/testsuite: Fix `ft32-*-*' position in `check_shared_lib_support'

ld/
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Reorder
`ft32-*-*' behind `frv-*-*'.

8 years agoRemove unsupported `am34-*-linux*' target triplet
Maciej W. Rozycki [Wed, 18 May 2016 03:19:02 +0000 (04:19 +0100)]
Remove unsupported `am34-*-linux*' target triplet

The `am34-*-linux*' target cannot be configured for, `am34' is not a CPU
name recognized by `config.sub'.  It has never been, required code has
not been contributed to GNU config, neither before nor since the
addition of the target triplet to our configury with commit bfff16424942
("Add MN10300 linker relaxation support for symbol differences") back in
2007.  Also there is no difference in actual tool configuration between
the `am34-*-linux*' and `am33_2.0-*-linux*' targets, except from a
different executable prefix and tooldir name.

Given the above remove the target triplet from our configuration.

bfd/
* config.bfd: Remove `am34-*-linux*' support.

ld/
* configure.tgt: Remove `am34-*-linux*' support.

8 years agoCorrect "Fix powerpc subis range"
Alan Modra [Thu, 19 May 2016 07:24:54 +0000 (16:54 +0930)]
Correct "Fix powerpc subis range"

* ppc-opc.c (NSISIGNOPT): Use insert_nsi and extract_nsi.

8 years agoFix powerpc subis range
Alan Modra [Wed, 18 May 2016 14:40:35 +0000 (00:10 +0930)]
Fix powerpc subis range

* ppc-opc.c: Formatting.
(NSISIGNOPT): Define.
(powerpc_opcodes <subis>): Use NSISIGNOPT.

8 years agoHack crossref tests for powerpc64
Alan Modra [Wed, 18 May 2016 14:40:13 +0000 (00:10 +0930)]
Hack crossref tests for powerpc64

A different set of hacks to make the crossref tests pass on powerpc64
and powerpc64le.

* testsuite/ld-scripts/crossref.exp: Remove -mcall-aixdesc hack.
* testsuite/ld-scripts/cross2.t: Tweak .opd and .toc placement.
* testsuite/ld-scripts/cross3.t: Likewise.
* testsuite/ld-scripts/cross4.t: Likewise.
* testsuite/ld-scripts/cross5.t: Likewise.
* testsuite/ld-scripts/cross6.t: Likewise.
* testsuite/ld-scripts/cross7.t: Likewise.

8 years agold-elf/shared.exp mix_pic_and_non_pic
Alan Modra [Wed, 18 May 2016 14:39:03 +0000 (00:09 +0930)]
ld-elf/shared.exp mix_pic_and_non_pic

Tweaks to make it easier to re-run these testcases by hand.

* testsuite/ld-elf/shared.exp (mix_pic_and_non_pic): Pass in
exe name rather than constructing testname.  Fix typo in
sub-test name.  Log copying.  Use -rpath rather than -R.

8 years agoAllocate ppc64 got and dynrelocs before plt
Alan Modra [Wed, 18 May 2016 14:29:04 +0000 (23:59 +0930)]
Allocate ppc64 got and dynrelocs before plt

The idea being to make undefined weak syms dynamic, before deciding
whether a sym needs a plt entry.  Fixes pr19719 ld testcase.

* elf64-ppc.c (allocate_dynrelocs): Allocate got and other dynamic
relocs before plt relocs.