platform/upstream/binutils.git
8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 12 Sep 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

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

8 years agoUse target_sim_options for sim target.
Jon Beniston [Sat, 10 Sep 2016 20:18:56 +0000 (21:18 +0100)]
Use target_sim_options for sim target.

2016-09-10  Jon Beniston  <jon@beniston.com>

* lib/mi-support.exp (mi_gdb_target_load): Use target_sim_options
for sim target.

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

8 years agoPass HWCAP to ifunc resolver
Andreas Arnez [Fri, 9 Sep 2016 17:59:53 +0000 (19:59 +0200)]
Pass HWCAP to ifunc resolver

On various GNU Elf architectures, including AArch64, ARM, s390/s390x,
ppc32/64, and sparc32/64, the dynamic loader passes HWCAP as a parameter
to each ifunc resolver.  Currently there is an open glibc Bugzilla that
requests this to be generalized to all architectures:

  https://sourceware.org/bugzilla/show_bug.cgi?id=19766

And various ifunc resolvers already rely on receiving HWCAP.  Currently
GDB always calls an ifunc resolver without any arguments; thus the
resolver may receive garbage, and based on that, the resolver may decide
to return a function that is not suited for the given platform.

This patch always passes HWCAP to ifunc resolvers, even on systems where
the dynamic loader currently behaves otherwise.  The rationale is
that (1) the dynamic loader may get adjusted on those systems as well in
the future; (2) passing an unused argument should not cause a problem
with existing resolvers; and (3) the logic is much simpler without such
a distinction.

gdb/ChangeLog:

* elfread.c (auxv.h): New include.
(elf_gnu_ifunc_resolve_addr): Pass HWCAP to ifunc resolver.

gdb/testsuite/ChangeLog:

* gdb.base/gnu-ifunc-lib.c (resolver_hwcap): New external
variable declaration.
(gnu_ifunc): Add parameter hwcap.  Store it in resolver_hwcap.
* gdb.base/gnu-ifunc.c (resolver_hwcap): New global variable.
* gdb.base/gnu-ifunc.exp: Add test to verify that the resolver
received HWCAP as its argument.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 9 Sep 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoRemove some unneeded casts from remote.c
Tom Tromey [Thu, 8 Sep 2016 15:49:07 +0000 (09:49 -0600)]
Remove some unneeded casts from remote.c

I happened to notice a few unneeded casts in remote.c.  In some cases
these are no-ops, and in others these cast away const, but in a context
where this is not needed.

I'm checking this in under the obvious rule.
Tested by rebuilding on x86-64 Fedora 24.

2016-09-08  Tom Tromey  <tom@tromey.com>

* remote.c (remote_notif_stop_ack, remote_wait_as)
(show_remote_cmd): Remove unneeded casts.

8 years agoAllow PROCESSOR_IAMCU for Intel MCU
H.J. Lu [Thu, 8 Sep 2016 14:54:16 +0000 (07:54 -0700)]
Allow PROCESSOR_IAMCU for Intel MCU

* config/tc-i386.c (i386_target_format): Allow PROCESSOR_IAMCU
for Intel MCU.

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

8 years agoX86: Allow additional ISAs for IAMCU in assembler
H.J. Lu [Wed, 7 Sep 2016 16:16:25 +0000 (09:16 -0700)]
X86: Allow additional ISAs for IAMCU in assembler

Originally only Pentium integer instructions are allowed for IAMCU.
This patch removes such a restriction.  For example, 387 and SSE2
instructions can be enabled by passing "-march=iamcu+sse2+387" to
assembler.

gas/

* config/tc-i386.c (valid_iamcu_cpu_flags): Removed.
(set_cpu_arch): Updated.
(md_parse_option): Likewise.
* testsuite/gas/i386/i386.exp: Run iamcu-4 and iamcu-5.  Remove
iamcu-inval-2 and iamcu-inval-3.
* testsuite/gas/i386/iamcu-4.d: New file.
* testsuite/gas/i386/iamcu-4.s: Likewise.
* testsuite/gas/i386/iamcu-5.d: Likewise.
* testsuite/gas/i386/iamcu-5.s: Likewise.
* testsuite/gas/i386/iamcu-inval-2.l: Removed.
* testsuite/gas/i386/iamcu-inval-2.s: Likewise.
* testsuite/gas/i386/iamcu-inval-3.l: Likewise.
* testsuite/gas/i386/iamcu-inval-3.s: Likewise.

opcodes/

* i386-gen.c (cpu_flag_init): Remove CPU_IAMCU_COMPAT_FLAGS.
* i386-init.h: Regenerated.

8 years ago[arm] Automatically enable CRC instructions on supported ARMv8-A CPUs.
Richard Earnshaw [Wed, 7 Sep 2016 16:14:54 +0000 (17:14 +0100)]
[arm] Automatically enable CRC instructions on supported ARMv8-A CPUs.

2016-09-07  Richard Earnshaw  <rearnsha@arm.com>

* opcode/arm.h (ARM_ARCH_V8A_CRC): New architecture.

2016-09-07  Richard Earnshaw  <rearnsha@arm.com>

* config/tc-arm.c ((arm_cpus): Use ARM_ARCH_V8A_CRC for all
ARMv8-A CPUs except xgene1.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 7 Sep 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agonew-ui command: gdb internal errors if input is already pending
Pedro Alves [Tue, 6 Sep 2016 22:29:25 +0000 (23:29 +0100)]
new-ui command: gdb internal errors if input is already pending

I noticed that if input is already pending on the new-ui TTY, gdb
internal-errors.

E.g., create /dev/pts/2, and type anything there (even just <return>
is sufficient).

Now start GDB creating a new UI on that TTY, while at the same time,
running a synchronous execution command.  Something like:

$ gdb program -ex "new-ui console /dev/pts/2" -ex "start"

Back on /dev/pts/2, we get:

  (gdb) .../src/gdb/event-top.c:360: internal-error: double prompt
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.

While the main UI was waiting for "start" to finish, gdb kepts pumping
events, including the input fd of the extra console.  The problem is
that stdin_event_handler doesn't restore the current UI back to what
it was, assuming that it's only ever called from the top level event
loop.  However, in this case, it's being called from the nested event
loop from within maybe_wait_sync_command_done.

When finally the "start" command is done, we reach the code that
prints the prompt in the main UI, just before starting the main event
loop.  Since now the current UI is pointing at the extra console (by
mistake), we find ourselves printing a double prompt on the extra
console.  This is caught by the assertion that fails, as shown above.

Since other event handlers also don't restore the UI (e.g., signal
event handlers), I think it's better if whatever is pumping events to
take care to restore the UI, if it cares.  That's what this patch
does.  New test included.

gdb/ChangeLog:
2016-09-06  Pedro Alves  <palves@redhat.com>

* top.c (wait_sync_command_done): Don't assume current_ui doesn't
change across events.  Restore the current UI before returning.
(gdb_readline_wrapper): Restore the current UI before returning.

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

* gdb.base/new-ui-pending-input.c: New file.
* gdb.base/new-ui-pending-input.exp: New file.
* gdb.exp (clear_gdb_spawn_id): New procedure.
(with_spawn_id): Check whether gdb_spawn_id exists before
referencing it.  If gdb_spawn_id didn't exist on entry, clear it
on exit.

8 years agoIntroduce make_cleanup_restore_current_ui
Pedro Alves [Tue, 6 Sep 2016 22:17:14 +0000 (23:17 +0100)]
Introduce make_cleanup_restore_current_ui

Just a tidy, no functional changes.

gdb/ChangeLog:
2016-09-06  Pedro Alves  <palves@redhat.com>

* event-top.c (restore_ui_cleanup): Now static.
(make_cleanup_restore_current_ui): New function.
(switch_thru_all_uis_init): Use it.
* infcall.c (call_thread_fsm_should_stop): Use it.
* infrun.c (fetch_inferior_event): Use it.
* top.c (new_ui_command): Use it.
* top.h (restore_ui_cleanup): Delete declaration.
(make_cleanup_restore_current_ui): New declaration.

8 years agoResolve size relocation with copy relocation
H.J. Lu [Tue, 6 Sep 2016 20:34:30 +0000 (13:34 -0700)]
Resolve size relocation with copy relocation

We can resolve size relocation against symbol which needs copy relocation
when building executable.

bfd/

PR ld/20550
* elf64-x86-64.c (elf_x86_64_relocate_section): Resolve size
relocation with copy relocation when building executable.

ld/

PR ld/20550
* testsuite/ld-x86-64/pr20550a.s: New file.
* testsuite/ld-x86-64/pr20550b.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp (x86_64tests): Add tests for
PR ld/20550.

8 years agoDo not pass host compiler sanitization flags on to linker testsuite.
Nick Clifton [Tue, 6 Sep 2016 16:35:35 +0000 (17:35 +0100)]
Do not pass host compiler sanitization flags on to linker testsuite.

* Makefile.am (CFLAGS_FOR_TARGET): Define as a copy of CFLAGS but
without any sanitization options.
(CXXFLAGS_FOR_TARGET): Define as a copy of CXXFLAGS but without
any sanitization options.
(check-DEJAGNU): Pass CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET
as CFLAGS and CXXFLAGS respectively.

8 years agoSupport 128-bit IEEE floating-point types on Intel and Power
Ulrich Weigand [Tue, 6 Sep 2016 15:33:15 +0000 (17:33 +0200)]
Support 128-bit IEEE floating-point types on Intel and Power

Now that all the prerequisites are in place, this commit finally adds support
for handling the __float128 type on Intel and Power, by providing appropriate
platform-specific versions of the floatformat_for_type callback.

Since at this point we do not yet have any indication in the debug info to
distinguish different floating-point formats of the same length, we simply
use the type name as hint.  Types named "__float128" get the IEEE format.
In addition to handling "__float128" itself, we also recognize "_Float128"
and (on Power) "_Float64x", as well as the complex versions of those.
(As pointed out by Joseph Myers, starting with GCC 7, __float128 is just
a typedef for _Float128 -- but it's good to handle this anyway.)

A new test case does some simple verification that the format is decoded
correctly, using both __float128 and "long double" to make sure using both
in the same file still works.  Another new test verifies handling of the
_FloatN and _FloatNx types supported by GCC 7, as well as the complex
versions of those types.

Note that this still only supports basic format decoding and encoding.
We do not yet support the GNU extension 'g' suffix for __float128 constants.
In addition, since all *arithmetic* on floating-point values is still
performed in native host "long double" arithmetic, if that format is not
able to encode all target __float128 values, we may get incorrect results.
(To fix this would require implementing fully synthetic target floating-
point arithmetic along the lines of GCC's real.c, presumably using MPFR.)

gdb/ChangeLog:

* i386-tdep.c (i386_floatformat_for_type): New function.
(i386_gdbarch_init): Install it.
* ppc-linux-tdep.c (ppc_floatformat_for_type): New function.
(ppc_linux_init_abi): Install it.

gdb/testsuite/ChangeLog:

* gdb.base/float128.c: New file.
* gdb.base/float128.exp: Likewise.
* gdb.base/floatn.c: Likewise.
* gdb.base/floatn.exp: Likewise.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoAdd gdbarch callback to provide formats for debug info float types
Ulrich Weigand [Tue, 6 Sep 2016 15:31:53 +0000 (17:31 +0200)]
Add gdbarch callback to provide formats for debug info float types

At this point, all TYPE_CODE_FLT types carry their floating-point format,
except for those creating from reading DWARF or stabs debug info.  Those
will be addressed by this commit.

The main issue here is that we actually have to determine which floating-
point format to use.  Currently, we only have the type length as input
to this decision.  In the future, we may hopefully get --at least in
DWARF-- additional information to help disambiguate multiple different
formats of the same length.  For now, we can still look at the type name
as a hint.

This decision logic is encapsulated in a gdbarch callback to allow
platform-specific overrides.  The default implementation use the same
logic (compare type length against the various gdbarch_..._bit sizes)
that is currently implemented in floatformat_from_length.

With this commit, all platforms still use the default logic, so there
should be no actual change in behavior.  A follow-on commit will add
support for __float128 on Intel and Power.

Once dwarf2read.c and stabsread.c make use of the new callback to
determine floating-point formats, we're now sure every TYPE_CODE_FLT
type will always carry its format.  The commit therefore adds asserts
to verify_floatformat to ensure new code will continue to always
provide formats, and removes the code in floatformat_from_type that
used to handle types with a NULL TYPE_FLOATFORMAT.

gdb/ChangeLog:

* gdbarch.sh (floatformat_for_type): New gdbarch callback.
* gdbarch.h, gdbarch.c: Re-generate.
* arch-utils.h (default_floatformat_for_type): New prototype.
* arch-utils.c (default_floatformat_for_type): New function.

* doublest.c (floatformat_from_length): Remove.
(floatformat_from_type): Assume TYPE_FLOATFORMAT is non-NULL.
* gdbtypes.c (verify_floatformat): Require non-NULL format.

* dwarf2read.c (dwarf2_init_float_type): New function.
(read_base_type): Use it.
* stabsread.c (dbx_init_float_type): New function.
(read_sun_floating_type): Use it.
(read_range_type): Likewise.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoAdd missing format for built-in floating-point types
Ulrich Weigand [Tue, 6 Sep 2016 15:31:03 +0000 (17:31 +0200)]
Add missing format for built-in floating-point types

Many callers of init_float_type and arch_float_type still pass a NULL
floatformat.  This commit changes those callers where the floatformat
that is supposed to be use is obvious.  There are two categories where
this is the case:

- A number of built-in types are intended to match the platform ABI
  floating-point types (i.e. types that use gdbarch_float_bit etc.).
  Those places should use the platform ABI floating-point formats
  defined via gdbarch_float_format etc.

- A number of language built-in types should simply use IEEE floating-
  point formats, since the language actually defines that this is the
  format that must be used to implement floating-point types for this
  language.  (This affects Java, Go, and Rust.)  The same applies for
  to the predefined "RS/6000" stabs floating-point built-in types.

gdb/ChangeLog:

* ada-lang.c (ada_language_arch_info): Use gdbarch-provided
platform ABI floating-point formats for built-in types.
* d-lang.c (build_d_types): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* mdebugread.c (basic_type): Likewise.

* go-lang.c (build_go_types): Use IEEE floating-point formats
for language built-in types as mandanted by the language.
* jv-lang.c (build_java_types): Likewise.
* rust-lang.c (rust_language_arch_info): Likewise.
* stabsread.c (rs6000_builtin_type): Likewise.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoRemove TYPE_NOSIGN "char" hack
Ulrich Weigand [Tue, 6 Sep 2016 15:30:13 +0000 (17:30 +0200)]
Remove TYPE_NOSIGN "char" hack

init_type (and arch_integer_type) currently use a special hack to set the
TYPE_NOSIGN flag if the type name is exactly "char".  This commit moves the
hack up to the callers of those routines.

The special case currently can hit only for types created from dwarf2read,
but read_base_type actually implements the "char" check itself, so it is
redundant to do it in init_type as well.  (Note that stabsread.c and the
other type readers always pass NULL as name to init_type, so the special
case can never hit for those.)

A few other cases create pre-definded types with a hard-coded name of "char";
the commit simply moves setting the TYPE_NOSIGN flag to those places.

No functional change intended.

gdb/ChangeLog:

* gdbtypes.c (init_type): Remove "char" special case.
(arch_integer_type): Likewise.
(gdbtypes_post_init): Set TYPE_NOSIGN for "char" type.
(objfile_type): Likewise.
* mdebugread.c (basic_type): Likewise.
* stabsread.c (rs6000_builtin_type): Likewise.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoRemove obsolete TYPE_FLAG_... values
Ulrich Weigand [Tue, 6 Sep 2016 15:29:15 +0000 (17:29 +0200)]
Remove obsolete TYPE_FLAG_... values

Now that init_type no longer takes a FLAGS argument, there is no user of
the TYPE_FLAGS_... enum values left.  This commit removes them (and all
references to them in comments as well).

This is mostly a no-op, except for a change to the Python type printer,
which attempted to use them before.  (As best as I can tell, this wasn't
really needed anyway, since it was only used to pretty-print type
*instance* flags, which only use the instance flags.)

gdb/ChangeLog:

* gdbtypes.h (enum type_flag_value): Remove.
Remove references to TYPE_FLAG_... in comments throughout.
* gdbtypes.c (recursive_dump_type): Do not print TYPE_FLAG_...
flags, print the corresponding TYPE_... access macro names.
Remove references to TYPE_FLAG_... in comments throughout.
* infcall.c: Remove references to TYPE_FLAG_... in comments.
* valprint.c: Likewise.
* gdb-gdb.py (class TypeFlag): No longer consider TYPE_FLAG_...
values, only TYPE_INSTANCE_FLAG_... values.
(class TypeFlagsPrinter): Likewise.

gdb/testsuite/ChangeLog:

* gdb.cp/hang.exp: Remove reference to TYPE_FLAG_STUB in comment.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoUnify init_type and arch_type interface and helpers
Ulrich Weigand [Tue, 6 Sep 2016 15:27:55 +0000 (17:27 +0200)]
Unify init_type and arch_type interface and helpers

This adds a number of helper routines for creating objfile-owned types;
these correspond 1:1 to the already existing helper routines for creating
gdbarch-owned types, and are intended to be used instead of init_type.
A shared fragment of init_float_type and arch_float_type is extracted into
a separate subroutine verify_subroutine.

The commit also brings the interface of init_type in line with the one for
arch_type.  In particular, this means removing the FLAGS argument; callers
now set the required flags directly.  (Since most callers use the new
helper routines, very few callers actually need to set any additional
flags directly any more.)

Note that this means all the TYPE_FLAGS_... defined are no longer needed
anywhere; they will be removed by a follow-on commit.

All users of init_type are changed to use on of the new helpers where
possible.  No functional change intended.

gdb/ChangeLog:

* gdbtypes.h (init_type): Remove FLAGS argument.  Move OBJFILE
argument to first position.
(init_integer_type): New prototype.
(init_character_type): Likewise.
(init_boolean_type): Likewise.
(init_float_type): Likewise.
(init_decfloat_type): Likewise.
(init_complex_type): Likewise.
(init_pointer_type): Likewise.
* gdbtypes.c (verify_floatflormat): New function.
(init_type): Remove FLAGS argument and processing.  Move OBJFILE
argument to first position.
(init_integer_type): New function.
(init_character_type): Likewise.
(init_boolean_type): Likewise.
(init_float_type): Likewise.
(init_decfloat_type): Likewise.
(init_complex_type): Likewise.
(init_pointer_type): Likewise.
(arch_float_type): Use verify_floatflormat.
(objfile_type): Use init_..._type helpers instead of calling
init_type directly.
* dwarf2read.c (fixup_go_packaging): Update to changed init_type
prototype.
(read_namespace_type): Likewise.
(read_module_type): Likewise.
(read_typedef): Likewise.
(read_unspecified_type): Likewise.
(build_error_marker_type): Likewise.
(read_base_type): Use init_..._type helpers.
* mdebugread.c (basic_type): Use init_..._type helpers.
(parse_type): Update to changed init_type prototype.
(cross_ref): Likewise.
* stabsread.c (rs6000_builtin_type): Use init_..._type helpers.
(read_sun_builtin_type): Likewise.
(read_sun_floating_type): Likewise.
(read_range_type): Likewise.  Also update to changed init_type
prototype.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoAdd some missing arch_..._type helpers
Ulrich Weigand [Tue, 6 Sep 2016 15:26:32 +0000 (17:26 +0200)]
Add some missing arch_..._type helpers

gdbtypes provides a number of helper routines that can be called instead of
using arch_type directly to create a type of a particular kind.  This patch
adds two additional such routines that have been missing so far, to allow
creation of TYPE_CODE_DECFLOAT and TYPE_CODE_POINTER types.

The patch also changes a number of places to use the new helper routines
instead of calling arch_type directly.  No functional change intended.

gdb/ChangeLog:

* gdbtypes.h (arch_decfloat_type): New prototype.
(arch_pointer_type): Likewise.
* gdbtypes.c (arch_decfloat_type): New function.
(arch_pointer_type): Likewise.
(gdbtypes_post_init): Use arch_decfloat_type.
* avr-tdep.c (avr_gdbarch_init): Use arch_pointer_type.
* ft32-tdep.c (ft32_gdbarch_init): Likewise.
* m32c-tdep.c (make_types): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoFix TYPE_SPECIFIC_FIELD for types created via arch_type
Ulrich Weigand [Tue, 6 Sep 2016 15:25:31 +0000 (17:25 +0200)]
Fix TYPE_SPECIFIC_FIELD for types created via arch_type

A type's TYPE_SPECIFIC_FIELD is supposed to be initialized as appropriate
for the type code.  This does happen if the type is created via init_type,
but not if it created via arch_type.

Fixed by extracting the initialization logic into a new set_type_code
routine, which is then called from both places.

gdb/ChangeLog:

* gdbtypes.c (set_type_code): New function.
(init_type, arch_type): Use it.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoFix typo in ada_language_arch_info
Ulrich Weigand [Tue, 6 Sep 2016 15:22:51 +0000 (17:22 +0200)]
Fix typo in ada_language_arch_info

This fixes a bug introduced by a wrong replacement here:
https://sourceware.org/ml/gdb-patches/2007-06/msg00196.html

The Ada "long_long_float" type is supposed to correspond to the
platform ABI long double type, not double.

gdb/ChangeLog:

* ada-lang.c (ada_language_arch_info): Use gdbarch_long_double_bit
instead of gdbarch_double_bit for "long_long_float".

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
8 years agoFix a problem in readelf where memcpy could be called with a NULL second argument.
Nick Clifton [Tue, 6 Sep 2016 14:42:12 +0000 (15:42 +0100)]
Fix a problem in readelf where memcpy could be called with a NULL second argument.

* readelf.c (request_dump_bynumber): Only call memcpy if
dump_sects is not NULL.

8 years agoFix PR ld/20545 - relaxation bugs in avr backend
Senthil Kumar Selvaraj [Tue, 6 Sep 2016 06:58:37 +0000 (12:28 +0530)]
Fix PR ld/20545 - relaxation bugs in avr backend

Prior to the patch, addends for relocs were being adjusted even if
they went beyond an alignment boundary. This is wrong - to
preserve alignment constraints, the relaxation logic adds as many padding
bytes at the alignment boundary as was deleted, so addends beyond the
boundary should not be adjusted. avr-prop-7.s reproduces this
scenario.

Also, prior to this patch, the relaxation logic assumed that the addr
parameter pointed to the middle of the instruction to be deleted, and
that addr - count would therefore be the shrinked instruction's
address. This is true when actually shrinking instructions.

The alignment constraints handling logic also invokes the same logic
though, with addr as the starting offset of padding bytes and
with count as the number of bytes to be deleted. Calculating the
shrinked insn's address as addr - count is obviously wrong in this
case - that offset would point to count bytes before the last
non-padded byte. avr-prop-8.s reproduces this scenario.

To fix scenario 1, the patch adds an additional check to ensure reloc addends
aren't adjusted if they cross a shrink boundary. The shrink boundary
is either the section size or an alignment boundary. Addends pointing
at an alignment boundary don't need to be adjusted, as padding would
occur and keep the boundary the same. Addends pointing at section size
need to be adjusted though, as no padding occurs and the section size
itself would get decremented. The patch records whether padding
occured (did_pad) and uses that to detect and handle this condition.

To fix scenario 2, the patch adds an additional parameter
(delete_shrinks_insn) to elf32_avr_relax_delete_bytes to distinguish
instruction bytes deletion from padding bytes deletion. It then uses that to
correctly set shrinked_insn_address.

bfd/ChangeLog:

2016-09-02  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

PR ld/20545
* elf32-avr.c (elf32_avr_relax_delete_bytes): Add parameter
delete_shrinks_insn. Modify computation of shrinked_insn_address.
Compute shrink_boundary and adjust addend only if
addend_within_shrink_boundary.
(elf32_avr_relax_section): Modify calls to
elf32_avr_relax_delete_bytes to pass extra parameter.

ld/ChangeLog:

2016-09-02  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

PR ld/20545
* testsuite/ld-avr/avr-prop-7.d: New test.
* testsuite/ld-avr/avr-prop-7.s: New test.
* testsuite/ld-avr/avr-prop-8.d: New test.
* testsuite/ld-avr/avr-prop-8.s: New test.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 6 Sep 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agogdb/: Require a C++ compiler
Pedro Alves [Mon, 5 Sep 2016 18:10:44 +0000 (19:10 +0100)]
gdb/: Require a C++ compiler

This removes all support for building gdb & gdbserver with a C
compiler from gdb & gdbserver's build machinery.

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

* NEWS: Mention that a C++ compiler is now required.
* Makefile.in (COMPILER, COMPILER_CFLAGS): Remove.
(COMPILE.pre, CC_LD): Use CXX directly.
(INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly.
* acinclude.m4: Don't include build-with-cxx.m4.
* build-with-cxx.m4: Delete file.
* configure.ac: Remove GDB_AC_BUILD_WITH_CXX call.
* warning.m4: Assume $enable_build_with_cxx is yes.
* configure: Regenerate.

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

* Makefile.in (COMPILER, COMPILER_CFLAGS): Remove.
(COMPILE.pre, CC_LD): Use CXX directly.
(INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly.
* acinclude.m4: Don't include build-with-cxx.m4.
* configure.ac: Remove GDB_AC_BUILD_WITH_CXX call.
* configure: Regenerate.

8 years agoFix PR19927: Avoid unwinder recursion if sniffer uses calls parse_and_eval
Pedro Alves [Mon, 5 Sep 2016 17:41:38 +0000 (18:41 +0100)]
Fix PR19927: Avoid unwinder recursion if sniffer uses calls parse_and_eval

This fixes the problem exercised by Kevin's test at:

 https://sourceware.org/ml/gdb-patches/2016-08/msg00216.html

This was originally exposed by the OpenJDK Python-based unwinder.

If an unwinder attempts to call parse_and_eval from within its
sniffing method, GDB's unwinding machinery enters infinite recursion.
However, parse_and_eval is a pretty reasonable thing to call, because
Python/Scheme-based unwinders will often need to read globals out of
inferior memory.  The recursion happens because:

- get_current_frame() is called soon after the target stops.

- current_frame is NULL, and so we unwind it from the sentinel frame
  (which is special and has level == -1).

- We reach get_prev_frame_if_no_cycle, which does cycle detection
  based on frame id, and thus tries to compute the frame id of the new
  frame.

- Frame id computation requires an unwinder, so we go through all
  unwinder sniffers trying to see if one accepts the new frame (the
  current frame).

- the unwinder's sniffer calls parse_and_eval().

- parse_and_eval depends on the selected frame/block, and if not set
  yet, the selected frame is set to the current frame.

- get_current_frame () is called again.  current_frame is still NULL,
  so ...

- recurse forever.

In Kevin's test at:

 https://sourceware.org/ml/gdb-patches/2016-08/msg00216.html

gdb doesn't recurse forever simply because the Python unwinder
contains code to detect and stop the recursion itself.  However, GDB
goes downhill from here, e.g., by showing the sentinel frame as
current frame (note the -1):

    Breakpoint 1, ccc (arg=<unavailable>) at py-recurse-unwind.c:23
    23      }
    (gdb) bt
    #-1 ccc (arg=<unavailable>) at py-recurse-unwind.c:23
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)

That "-1" frame level comes from this:

      if (catch_exceptions (current_uiout, unwind_to_current_frame,
    sentinel_frame, RETURN_MASK_ERROR) != 0)
{
  /* Oops! Fake a current frame?  Is this useful?  It has a PC
             of zero, for instance.  */
  current_frame = sentinel_frame;
}

which is bogus.  It's never correct to set the current frame to the
sentinel frame.  The only reason this has survived so long is that
getting here normally indicates something wrong has already happened
before and we fix that.  And this case is no exception -- it doesn't
really matter how precisely we managed to get to that bogus code (it
has to do with the the stash), because anything after recursion
happens is going to be invalid.

So the fix is to avoid the recursion in the first place.

Observations:

 #1 - The recursion happens because we try to do cycle detection from
      within get_prev_frame_if_no_cycle.  That requires computing the
      frame id of the frame being unwound, and that itself requires
      calling into the unwinders.

 #2 - But, the first time we're unwinding from the sentinel frame,
      when we reach get_prev_frame_if_no_cycle, there's no frame chain
      at all yet:

      - current_frame is NULL.
      - the frame stash is empty.

Thus, there's really no need to do cycle detection the first time we
reach get_prev_frame_if_no_cycle, when building the current frame.

So we can break the recursion by making get_current_frame call a
simplified version of get_prev_frame_if_no_cycle that results in
setting the current_frame global _before_ computing the current
frame's id.

But, we can go a little bit further.  As there's really no reason
anymore to compute the current frame's frame id immediately, we can
defer computing it to when some caller of get_current_frame might need
it.  This was actually how the frame id was computed for all frames
before the stash-based cycle detection was added.  So in a way, this
patch reintroduces the lazy frame id computation, but unlike before,
only for the case of the current frame, which turns out to be special.

This lazyness, however, requires adjusting
gdb.python/py-unwind-maint.exp, because that assumes unwinders are
immediately called as side effect of some commands.  I didn't see a
need to preserve the behavior expected by that test (all it would take
is call get_frame_id inside get_current_frame), so I adjusted the
test.

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

PR backtrace/19927
* frame.c (get_frame_id): Compute the frame id if not computed
yet.
(unwind_to_current_frame): Delete.
(get_current_frame): Use get_prev_frame_always_1 to get the
current frame and assert that that always succeeds.
(get_prev_frame_if_no_cycle): Skip cycle detection if returning
the current frame.

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

PR backtrace/19927
* gdb.python/py-unwind-maint.exp: Adjust tests to not expect that
unwinders are immediately called as side effect of "source" or
"disable unwinder" commands.
* gdb.python/py-recurse-unwind.exp: Remove setup_kfail calls.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 5 Sep 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, 4 Sep 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoRemoved redundant line remote-utils.c
Akash Trehan [Fri, 2 Sep 2016 08:18:59 +0000 (13:48 +0530)]
Removed redundant line remote-utils.c

2016-09-02  Akash Trehan  <akash.trehan123@gmail.com>

gdb/gdbserver/ChangeLog:
    PR gdb/19495
    * remote-utils.c (relocate_instruction): Remove redundant strcpy()
    call writing data to own_buf.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 3 Sep 2016 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoHandle ARM-specific --target1-abs, --target1-rel and --target2 options
Doug Kwan [Fri, 2 Sep 2016 22:51:59 +0000 (15:51 -0700)]
Handle ARM-specific --target1-abs, --target1-rel and --target2 options

8 years agoHandle DW_OP_form_tls_address
Tom Tromey [Mon, 22 Aug 2016 22:56:52 +0000 (16:56 -0600)]
Handle DW_OP_form_tls_address

Currently gdb supports DW_OP_GNU_push_tls_address, but not
DW_OP_form_tls_address.  I think it would be better if the toolchain
as a whole moved to using the standard opcode, and the prerequisite to
this is getting gdb to recognize it.

GCC can sometimes emit DW_OP_form_tls_address for emultls targets.  As
far as I know, nobody has ever tried this with gdb (since it wouldn't
work at all).

I don't think there's a major drawback to using a single opcode for
all targets, because computing the location of a thread-local is
already target specific.

This is PR gdb/11616.

I don't know how to write a test case for this; though it's worth
noting that there aren't explicit tests for DW_OP_GNU_push_tls_address
either -- and if I change GCC, these paths will be tested to the same
extent they are now.

2016-09-02  Tom Tromey  <tom@tromey.com>

PR gdb/11616:
* dwarf2read.c (decode_locdesc): Handle DW_OP_form_tls_address.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Handle
DW_OP_form_tls_address.
(locexpr_describe_location_piece): Likewise.
* dwarf2expr.h (struct dwarf_expr_context_funcs): Update comment.
* dwarf2expr.c (execute_stack_op): Handle DW_OP_form_tls_address.
(ctx_no_get_tls_address): Mention DW_OP_form_tls_address.
* compile/compile-loc2c.c (struct insn_info): Update comment.
(compute_stack_depth_worker): Handle DW_OP_form_tls_address.

8 years agoLimit pr20513c/pr20513d to Linux and GNU targets
H.J. Lu [Fri, 2 Sep 2016 14:58:24 +0000 (07:58 -0700)]
Limit pr20513c/pr20513d to Linux and GNU targets

* testsuite/ld-elf/pr20513c.d: Limit to *-*-linux* and *-*-gnu*
targets.
* testsuite/ld-elf/pr20513d.d: Likewise.

8 years ago[GDBserver] Replace "reinsert_breakpoint" with "single_step_breakpoint"
Yao Qi [Fri, 2 Sep 2016 14:49:57 +0000 (15:49 +0100)]
[GDBserver] Replace "reinsert_breakpoint" with "single_step_breakpoint"

reinsert_breakpoint is used for software single step, so it is more
clear to rename it to single_step_breakpoint.  This was pointed out in
the review https://sourceware.org/ml/gdb-patches/2016-05/msg00429.html
I don't rename "other_breakpoint" in this patch.

gdb/gdbserver:

2016-09-02  Yao Qi  <yao.qi@linaro.org>

* linux-low.c: Replace "reinsert_breakpoints" with
"single_step_breakpoints".  Replace "reinsert breakpoints"
with "single-step breakpoints".
* mem-break.c: Likewise.
* mem-break.h: Likewise.

8 years agoSkip floating point tests in return-nodebug.exp if gdb_skip_float_test is true
Yao Qi [Fri, 2 Sep 2016 14:26:54 +0000 (15:26 +0100)]
Skip floating point tests in return-nodebug.exp if gdb_skip_float_test is true

return-nodebug.exp does the test for various types, but we shouldn't
test with floating point type if gdb_skip_float_test returns true.

gdb/testsuite:

2016-09-02  Yao Qi  <yao.qi@linaro.org>

* gdb.base/return-nodebug.exp: Skip the test if skip_float_test
is true and $type is "float" or "double".

8 years agoDetect broken ptrace in gdb_skip_float_test
Yao Qi [Fri, 2 Sep 2016 08:22:13 +0000 (09:22 +0100)]
Detect broken ptrace in gdb_skip_float_test

We recently found a ARM kernel ptrace bug
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-May/431962.html
Details can be found in the comment in gdb_skip_float_test.  We can
skip floating point tests if the kernel bug is detected.

This patch adds more code in gdb_skip_float_test to detect the broken
ptrace on arm-linux.  Such detection should be done at the beginning
of the test, because it starts a fresh GDB, so change the test cases
to invoke gdb_skip_float_test at the beginning of test, and use its
return value afterwards.

Since gdb_skip_float_test becomes a gdb_caching_proc, so it can't
have an argument, this patch also removes argument "msg", which isn't
useful.

gdb/testsuite:

2016-09-02  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/arm-neon.exp: Skip it if gdb_skip_float_test returns
true.
* gdb.base/call-ar-st.exp: Invoke gdb_skip_float_test.
* gdb.base/call-rt-st.exp: Likewise.
* gdb.base/call-sc.exp: Invoke gdb_skip_float_test and use its
return value instead of gdb,skip_float_test.
* gdb.base/callfuncs.exp: Invoke gdb_skip_float_test.
(do_function_calls): Use its return value instead of
gdb,skip_float_test.
* gdb.base/finish.exp: Likewise.
* gdb.base/funcargs.exp: Likewise.
* gdb.base/return.exp: Likewise.
* gdb.base/return2.exp: Likewise.
* gdb.base/varargs.exp: Likewise.
* lib/gdb.exp (gdb_skip_float_test): Change it to
gdb_caching_proc.  Detect the broken ptrace on arm-linux.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 2 Sep 2016 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd tests for PR ld/20513
H.J. Lu [Thu, 1 Sep 2016 19:01:00 +0000 (12:01 -0700)]
Add tests for PR ld/20513

PR ld/20513
* testsuite/ld-elf/pr20513a.d: New file.
* testsuite/ld-elf/pr20513a.s: Likewise.
* testsuite/ld-elf/pr20513b.d: Likewise.
* testsuite/ld-elf/pr20513b.s: Likewise.
* testsuite/ld-elf/pr20513c.d: Likewise.
* testsuite/ld-elf/pr20513d.d: Likewise.
* testsuite/ld-elf/pr20513e.d: Likewise.
* testsuite/ld-elf/pr20513f.d: Likewise.

8 years agoShare target_wait prototype between GDB and gdbserver
Sergio Durigan Junior [Mon, 29 Aug 2016 03:39:45 +0000 (23:39 -0400)]
Share target_wait prototype between GDB and gdbserver

This commit moves the target_wait prototype from the GDB-specific
target.h header to the common target/target.h header.  Then, it
creates a compatible implementation of target_wait on gdbserver using
the_target->wait, and adjusts the (only) caller (mywait function).

Pretty straightforward, no regressions introduced.

gdb/gdbserver/ChangeLog:
2016-09-01  Sergio Durigan Junior  <sergiodj@redhat.com>

* target.c (mywait): Call target_wait instead of
the_target->wait.
(target_wait): New function.

gdb/ChangeLog:
2016-09-01  Sergio Durigan Junior  <sergiodj@redhat.com>

* target.c (target_wait): Mention that the function's prototype
can be found at target/target.h.
* target.h (target_wait): Move prototype from here...
* target/target.h (target_wait): ... to here.

8 years agoUse target_continue{,_no_signal} instead of target_resume
Sergio Durigan Junior [Thu, 25 Aug 2016 20:26:24 +0000 (16:26 -0400)]
Use target_continue{,_no_signal} instead of target_resume

This commit implements a new function, target_continue, on top of the
target_resume function.  Then, it replaces all calls to target_resume
by calls to target_continue or to the already existing
target_continue_no_signal.

This is one of the (many) necessary steps needed to consolidate the
target interface between GDB and gdbserver.  In particular, I am
interested in the impact this change will have on the unification of
the fork_inferior function (which I have been working on).

Tested on the BuildBot, no regressions introduced.

gdb/gdbserver/ChangeLog:
2016-09-31  Sergio Durigan Junior  <sergiodj@redhat.com>

* server.c (start_inferior): New variable 'ptid'.  Replace calls
to the_target->resume by target_continue{,_no_signal}, depending
on the case.
* target.c (target_stop_and_wait): Call target_continue_no_signal
instead of the_target->resume.
(target_continue): New function.

gdb/ChangeLog:
2016-09-31  Sergio Durigan Junior  <sergiodj@redhat.com>

* fork-child.c (startup_inferior): Replace calls to target_resume
by target_continue{,_no_signal}, depending on the case.
* linux-nat.c (cleanup_target_stop): Call
target_continue_no_signal instead of target_resume.
* procfs.c (procfs_wait): Likewise.
* target.c (target_continue): New function.
* target/target.h (target_continue): New prototype.

8 years ago2016-09-01 Thomas Preud'homme <thomas.preudhomme@arm.com>
Thomas Preud'homme [Thu, 1 Sep 2016 08:35:57 +0000 (09:35 +0100)]
2016-09-01  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (cmse_entry_fct_p): Store instruction encoding in an
array of bytes and use bfd_get_16 to interpret its encoding according
to endianness of target.

8 years agoDon't treat .opd section specially when ELFv2
Alan Modra [Thu, 1 Sep 2016 05:26:52 +0000 (14:56 +0930)]
Don't treat .opd section specially when ELFv2

Fixes a gdb segfault if a section named .opd is found in ELFv2 binaries.

* elf64-ppc.c (synthetic_opd): New static var.
(compare_symbols): Don't treat symbols in .opd specially for ELFv2.
(ppc64_elf_get_synthetic_symtab): Likewise.  Comment.

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

8 years agoFix lwp_suspend/unsuspend imbalance in linux_wait_1
Antoine Tremblay [Wed, 31 Aug 2016 17:46:22 +0000 (13:46 -0400)]
Fix lwp_suspend/unsuspend imbalance in linux_wait_1

This patch fixes imbalanced lwp_suspend/unsuspend calls caused by the
premature choosing of another event for fairness.

select_event_lwp would switch the event before a call to
unsuspend_all_lwps, thus it would be called with the wrong event.

This caused an assertion failure: unsuspend LWP xx, suspended=-1 when
testing  gdb.threads/non-stop-fair-events.exp with ARM range stepping in
GDBServer.

This patch moves the switch of event after the unsuspend/unstop calls.

No regressions, tested on ubuntu 14.04 ARMv7 and x86.
With gdbserver-native.

gdb/gdbserver/ChangeLog:

* linux-low.c (linux_wait_1): Move event switch after unsuspend_lwps.

8 years agoFix a typo in comment
Yao Qi [Wed, 31 Aug 2016 13:28:27 +0000 (14:28 +0100)]
Fix a typo in comment

This patch replaces "keep things single" with "keep things simple".

gdb:

2016-08-31  Yao Qi  <yao.qi@linaro.org>

* record-full.c (record_full_insert_breakpoint): Fix typo.

8 years agoIgnore symbols defined in SHF_EXCLUDE sections
Alan Modra [Fri, 26 Aug 2016 12:31:15 +0000 (22:01 +0930)]
Ignore symbols defined in SHF_EXCLUDE sections

PR 20513
* ldlang.c (section_already_linked): Deal with SHF_EXCLUDE sections.

8 years ago[GOLD] Further tidy to powerpc can_add_to_stub_group
Alan Modra [Wed, 31 Aug 2016 07:36:32 +0000 (17:06 +0930)]
[GOLD] Further tidy to powerpc can_add_to_stub_group

This patch adds a little more debug output, and replaces two variables
with one, tracking current max group size by group_size_ rather than
by has14_.

* powerpc.cc (class Stub_control): Delete stub14_group_size_
and has14_.  Add group_size_.
(Stub_control::can_add_to_stub_group): Adjust to suit.  Print
debug info when switching to adding sections before stubs.

8 years agoPowerPC64, correct grouping of stubs for ld.bfd
Alan Modra [Tue, 30 Aug 2016 11:32:58 +0000 (21:02 +0930)]
PowerPC64, correct grouping of stubs for ld.bfd

Like 57f6d32d, this patch ensures that sections containing external
conditional branches limit the group size.

* elf64-ppc.c (group_sections): Delete stub14_group_size.  Instead,
track max group size with a new "group_size" var that is reduced
by a factor of 1024 from the 24-bit branch size whenever a 14-bit
branch is seen.

8 years agoAdjust VLE testsuite
Alan Modra [Wed, 31 Aug 2016 04:32:36 +0000 (14:02 +0930)]
Adjust VLE testsuite

To suit f7d69005.

* testsuite/ld-powerpc/vle-multiseg-1.d: Adjust to suit segment change.
* testsuite/ld-powerpc/vle-multiseg-2.d: Likewise.
* testsuite/ld-powerpc/vle-multiseg-3.d: Likewise.
* testsuite/ld-powerpc/vle-multiseg-6.d: Likewise.
* testsuite/ld-powerpc/vle-reloc-2.d: Likewise.

8 years agoPowerPC VLE sh_flags and p_flags
Alan Modra [Wed, 31 Aug 2016 03:48:34 +0000 (13:18 +0930)]
PowerPC VLE sh_flags and p_flags

ELF section sh_flags SHF_PPC_VLE was being set based on arch/mach,
which meant all code sections in an object file has the flag or all
lacked it.  We can do better than that.  Only those code sections
where VLE is enabled ought to have the flag, allowing an object file
to contain both VLE and non-VLE code.

Also, ELF header p_flags PF_PPC_VLE wasn't being set, and segments
were being split unnecessarily.

bfd/
* elf32-ppc.c (ppc_elf_section_processing): Delete.
(elf_backend_section_processing): Don't define.
(ppc_elf_modify_segment_map): Set p_flags and mark valid.  Don't
split on non-exec sections differing in SHF_PPC_VLE.  When
splitting segments, mark size invalid.
gas/
* config/tc-ppc.c (md_assemble): Set sh_flags for VLE.  Test
ppc_cpu rather than calling ppc_mach to determine VLE mode.
(ppc_frag_check, ppc_handle_align): Likewise use ppc_cpu.

8 years ago[GOLD] Add debug output for powerpc section grouping
Alan Modra [Wed, 31 Aug 2016 03:04:36 +0000 (12:34 +0930)]
[GOLD] Add debug output for powerpc section grouping

* debug.h (DEBUG_TARGET): New.
(DEBUG_ALL): Add DEBUG_TARGET.
(gold_debug): Delete FORMAT param.
* powerpc.cc (Stub_control::can_add_to_stub_group): Print debug ourput.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 31 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFixed issue with NULL pointer access on header var.
Cupertino Miranda [Fri, 26 Aug 2016 20:15:23 +0000 (22:15 +0200)]
Fixed issue with NULL pointer access on header var.

Variable "header" in function is set conditionally, but was accessed without
verifying if pointer was NULL.

opcodes/ChangeLog:

    Cupertino Miranda  <cmiranda@synopsys.com>
* opcodes/arc-dis.c (print_insn_arc): Changed.

8 years agoFix order of inferiors in "thread apply all"
Andreas Arnez [Tue, 30 Aug 2016 15:03:55 +0000 (17:03 +0200)]
Fix order of inferiors in "thread apply all"

This inserts missing parentheses in the calculation of the comparison
result between two different inferior numbers.  The problem was found by
Philipp Rudo.

gdb/ChangeLog:

* thread.c (tp_array_compar): Insert missing parentheses.

gdb/testsuite/ChangeLog:

* gdb.multi/tids.exp: Test "thread apply all".

8 years agoMade tests to XFAIL for arc*-*-elf*.
Cupertino Miranda [Mon, 29 Aug 2016 08:38:40 +0000 (10:38 +0200)]
Made tests to XFAIL for arc*-*-elf*.

ld/ChangeLog:
    Cupertino Miranda  <cmiranda@synopsys.com>

* testsuite/ld-arc/tls_gs-01.d: Set to XFAIL on arc*-*-elf*.
* testsuite/ld-arc/tls_ie-01.d: Likewise.

8 years agoPartially revert previous delta - move limit testing code to first scan over symbol...
Nick Clifton [Tue, 30 Aug 2016 12:51:43 +0000 (13:51 +0100)]
Partially revert previous delta - move limit testing code to first scan over symbol file.

PR gprof/20499
* corefile.c (num_of_syms_in): Return an unsigned int.
Fail if the count exceeds the maximum possible allocatable size.
(core_create_syms_from): Exit early if num_of_syms_in returns a
failure code.

8 years agoFix more potential seg-faults in gprof.
Nick Clifton [Tue, 30 Aug 2016 12:38:54 +0000 (13:38 +0100)]
Fix more potential seg-faults in gprof.

PR gprof/20499
* corefile.c (num_of_syms_in): Return an unsigned int.
(core_create_syms_from): Catch a possible integer overflow
computing the argument to xmalloc.  Also allow for the possibility
that an integer overflow in num_of_syms_in means that less space
has been allocated than expected.

8 years agoppc apuinfo for spe parsed incorrectly
Alan Modra [Tue, 30 Aug 2016 11:27:32 +0000 (20:57 +0930)]
ppc apuinfo for spe parsed incorrectly

apuinfo saying SPE resulted in mach = bfd_mach_ppc_vle due to a
missing break.

PR 20531
* elf32-ppc.c (_bfd_elf_ppc_set_arch): Add missing "break".

8 years ago[GOLD] correct grouping of stubs
Alan Modra [Tue, 30 Aug 2016 02:28:05 +0000 (11:58 +0930)]
[GOLD] correct grouping of stubs

This patch rewrites the rather obscure can_add_to_stub_group, fixing
a problem with the handling of sections containing conditional
external branches.  When a section group contains any such section,
the group size needs to be limited to a much smaller size than groups
with only non-conditional external branches.

PR 20523
* powerpc.cc (class Stub_control): Add has14_.  Comment owner_.
(Stub_control::can_add_to_stub_group): Correct grouping of
sections containing 14-bit external branches.  When returning
false, set state_ to reflect the fact that we have one section
for the next group.  Rewrite most of function for clarity.
Add and expand comments.
(Target_powerpc::do_relax): Print stub group size retry in hex.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoRun PR ld/19784 tests only if ifunc attribute works
H.J. Lu [Mon, 29 Aug 2016 16:09:14 +0000 (09:09 -0700)]
Run PR ld/19784 tests only if ifunc attribute works

* testsuite/ld-x86-64/x86-64.exp: Run PR ld/19784 tests only
if ifunc attribute works.

8 years agoCheck the external compression header size
H.J. Lu [Mon, 29 Aug 2016 15:49:20 +0000 (08:49 -0700)]
Check the external compression header size

Since the internal compression header size can be bigger than the
external compression header size, we should check the external
compression header size.

* readelf.c (load_specific_debug_section): Check the external
compression header size.

8 years agoi386: Issue an error on non-PIC call to IFUNC in PIC object
H.J. Lu [Mon, 29 Aug 2016 15:12:59 +0000 (08:12 -0700)]
i386: Issue an error on non-PIC call to IFUNC in PIC object

On i386, IFUNC function must be called via PLT.  Since PLT in PIC
object uses EBX register, R_386_PLT32 relocation must be used to
call IFUNC function even when IFUNC function is defined locally.
Linker should issue an error when R_386_PC32 relocation is used
to call IFUNC function.

Since PR ld/19784 tests doesn't use PLT relocation to local IFUNC
function, they are moved to the x86-64 test directory.

bfd/

PR ld/14961
PR ld/20515
* elf32-i386.c (elf_i386_check_relocs): Issue an error when
R_386_PC32 relocation is used to call IFUNC function in PIC
object.

ld/

PR ld/14961
PR ld/20515
* testsuite/ld-i386/i386.exp: Run pr20515.
* testsuite/ld-i386/pr20515.d: New file.
* testsuite/ld-i386/pr20515.s: Likewise.
* testsuite/ld-ifunc/ifunc-14a.s: Use R_386_PLT32 to call IFUNC
function.
* testsuite/ld-ifunc/ifunc-14c.s: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386.s: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386.s: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Move PR ld/19784 tests to ...
* testsuite/ld-x86-64/x86-64.exp: Here.
* testsuite/ld-ifunc/pr19784a.c: Moved to ...
* testsuite/ld-x86-64/pr19784a.c: Here.
* testsuite/ld-ifunc/pr19784b.c: Moved to ...
* testsuite/ld-x86-64/pr19784b.c: Here.
* testsuite/ld-ifunc/pr19784c.c: Moved to ...
* testsuite/ld-x86-64/pr19784c.c: Here.

8 years agogdb.base/default.exp regression
Jan Kratochvil [Mon, 29 Aug 2016 13:20:04 +0000 (15:20 +0200)]
gdb.base/default.exp regression

tty^M
(gdb) FAIL: gdb.base/default.exp: tty

gdb/testsuite/ChangeLog
2016-08-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.base/default.exp (tty): Remove.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Aug 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPR gold/20529 - relaxing loop never ends.
Han Shen [Fri, 26 Aug 2016 22:50:15 +0000 (15:50 -0700)]
PR gold/20529 - relaxing loop never ends.

gold/ChangeLog

2016-08-26  Han Shen  <shenhan@google.com>

* powerpc.cc (Stub_table::min_size_threshold_): New member to
limit size.
(Stub_table::set_min_size_threshold): New member function.
(Stub_table::set_address_and_size): Add code to only allow size
increase.
(Target_powerpc::do_relax): Add code to record last size.

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

8 years agoLack of SHF_GROUP sections result in ld segfault
Alan Modra [Sat, 27 Aug 2016 00:13:42 +0000 (09:43 +0930)]
Lack of SHF_GROUP sections result in ld segfault

PR 20520
* elf.c (_bfd_elf_setup_sections): Check that SHT_GROUP sections
have corresponding SHF_GROUP sections.
(bfd_elf_set_group_contents): Comment.

8 years agoFix commit 980aa3e6
Alan Modra [Fri, 26 Aug 2016 23:29:29 +0000 (08:59 +0930)]
Fix commit 980aa3e6

Commit 980aa3e6 was supposed to cure dyn_reloc counting problems, but
did the opposite.  For PIC we count two types of dyn_reloc, those on
pc-relative relocs, and the total.  If a sym needs pc-relative dyn
relocs then all the relocs are dynamic.  If not, then only those that
are must_be_dyn_reloc are dynamic.

PR 20519
* elf64-ppc.c (pc_dynrelocs): New function.
(ppc64_elf_relocate_section): Use it and must_be_dyn_reloc to
handle pic dynamic relocs.

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

8 years agoopcodes, gas: fix mnemonic of sparc camellia_fl
Jose E. Marchesi [Fri, 26 Aug 2016 14:31:31 +0000 (07:31 -0700)]
opcodes, gas: fix mnemonic of sparc camellia_fl

This patch fixes a typo in the mnemonic of the camellia_fl
instruction, which was implemented before as camellia_fi.

gas/ChangeLog:

2016-08-26  Jose E. Marchesi  <jose.marchesi@oracle.com>

* testsuite/gas/sparc/crypto.d: Rename invalid opcode camellia_fi
to camellia_fl.
* testsuite/gas/sparc/crypto.s: Likewise.

opcodes/ChangeLog:

2016-08-26  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc-opc.c (sparc_opcodes): Fix typo in opcode, camellia_fi ->
camellia_fl.

8 years agoReduce parameter list in bfd_elf32_arm_target_relocs
Thomas Preud'homme [Fri, 26 Aug 2016 13:00:39 +0000 (14:00 +0100)]
Reduce parameter list in bfd_elf32_arm_target_relocs

2016-08-26  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* bfd-in.h (struct elf32_arm_params): Define.
(bfd_elf32_arm_set_target_relocs): Rename into ...
(bfd_elf32_arm_set_target_params): This.  Use a struct
elf32_arm_params to pass all parameters but the bfd and bfd_link_info.
* bfd-in2.h: Regenerate.
* elf32-arm.c (bfd_elf32_arm_set_target_relocs): Rename into ...
(bfd_elf32_arm_set_target_params): This.  Pass all values via a struct
elf32_arm_params rather than as individual parameters.

ld/
* emultempl/armelf.em (params): New static variable.
(thumb_entry_symbol, byteswap_code, target1_is_rel, target2_type,
fix_v4bx, use_blx, vfp11_denorm_fix, stm32l4xx_fix, fix_cortex_a8,
no_enum_size_warning, no_wchar_size_warning, pic_veneer,
merge_exidx_entries, fix_arm1176, cmse_implib): move as part of the
above new structure.
(arm_elf_before_allocation): Access static variable from the params
structure.
(gld${EMULATION_NAME}_finish): Likewise.
(arm_elf_create_output_section_statements): Likewise and pass the
address of that structure to bfd_elf32_arm_set_target_relocs instead
of the static variables.
(PARSE_AND_LIST_ARGS_CASES): Access static variable from the params
structure.

8 years ago2016-08-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
Thomas Preud'homme [Fri, 26 Aug 2016 11:01:47 +0000 (12:01 +0100)]
2016-08-26  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (elf32_arm_get_stub_entry): Assert that we don't access
passed the end of htab->stub_group array.
(elf32_arm_create_or_find_stub_sec): Likewise.
(elf32_arm_create_stub): Likewise.

8 years agoAdd missing ARMv8-M special registers
Thomas Preud'homme [Fri, 26 Aug 2016 10:53:30 +0000 (11:53 +0100)]
Add missing ARMv8-M special registers

2016-08-26  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
* config/tc-arm.c (v7m_psrs): Add MSPLIM, PSPLIM, MSPLIM_NS,
PSPLIM_NS, PRIMASK_NS, BASEPRI_NS, FAULTMASK_NS, CONTROL_NS, SP_NS and
their lowecase counterpart special registers.  Write register
identifier in hex.
* testsuite/gas/arm/archv8m-cmse-msr.s: Reorganize tests per
operation, special register and then case.  Use different register for
each operation.  Add tests for new special registers.
* testsuite/gas/arm/archv8m-cmse-msr-base.d: Adapt expected result
accordingly.
* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.

opcodes/
* arm-dis.c (psr_name): Use hex as case labels.  Add detection for
MSPLIM, PSPLIM, MSPLIM_NS, PSPLIM_NS, PRIMASK_NS, BASEPRI_NS,
FAULTMASK_NS, CONTROL_NS and SP_NS special registers.

8 years agoDynamic TLS GOT entries would not be relocated.
Cupertino Miranda [Thu, 21 Jul 2016 13:32:35 +0000 (15:32 +0200)]
Dynamic TLS GOT entries would not be relocated.

Forgot to set should_relocate to TRUE in case of GOT and TLS relocations of
undefined symbols for shared libraries.
In dynamic libraries if symbol is not known the instruction relocation would
not be resolved to point to the respective .got entry.
A test was created to detect similar future mistakes.

bfd/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (elf_arc_relocate_section): Changed. Set should_relocate
to TRUE for GOT and TLS relocs.

ld/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

* ld/testsuite/ld-arc/tls_gd-01.s: Added a testcase for this patch.
* ld/testsuite/ld-arc/tls_gd-01.d: Likewise.

8 years agoFixed -init, -fini linker options.
Cupertino Miranda [Tue, 19 Jul 2016 12:33:34 +0000 (14:33 +0200)]
Fixed -init, -fini linker options.

ARC was overloading this options by forcing DT_INIT AND DT_FINI
to always point to _init and _fini, respectively.

bfd/ChangeLog:

Cupertino Miranda  <cmiranda@synospsys.com>

* elf32-arc.c (elf_arc_finish_dynamic_sections): Changed.

8 years agoSeveral fixes related to ARC PIE support.
Cupertino Miranda [Wed, 13 Jul 2016 16:04:20 +0000 (18:04 +0200)]
Several fixes related to ARC PIE support.

Fixed conditions related to dynamic relocs relative offset patching.
Added arc_link_hash_table to be able to always generate and track
.rela.bss section.

bfd/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

* elf-bfd.h: Added ARC_ELF_DATA to enum elf_target_id.
* elf32-arc.c (struct elf_arc_link_hash_entry): Added.
(struct elf_arc_link_hash_table): Likewise.
(elf_arc_link_hash_newfunc): Likewise.
(elf_arc_link_hash_table_free): Likewise.
(arc_elf_link_hash_table_create): Likewise.
(elf_arc_relocate_section): Fixed conditions related to dynamic
(elf_arc_check_relocs): Likewise.
(arc_elf_create_dynamic_sections): Added
(elf_arc_adjust_dynamic_symbol): Changed access to .rela.bss to be done
through the hash table.

8 years agoContent for TLS_IE_GOT not written to .got.
Cupertino Miranda [Tue, 12 Jul 2016 14:31:40 +0000 (16:31 +0200)]
Content for TLS_IE_GOT not written to .got.

When no dynamic relocation was generated the .got content would not be
updated for the TLS_IE_GOT relocation addresses.

bfd/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

* arc-got.h (relocate_fix_got_relocs_for_got_info): Fixed addresses in
debug comments. Fixed address in .got related to TLS_IE_GOT dynamic
relocation.

ld/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>

* testsuite/ld-arc/tls_ie-01.s: Added to verify associated fix.
* testsuite/ld-arc/tls_ie-01.d: Likewise

8 years agoFixes to legacy ARC relocations.
Cupertino Miranda [Tue, 7 Jun 2016 08:24:37 +0000 (10:24 +0200)]
Fixes to legacy ARC relocations.

Added support for ARC_SDA_12 reloc.
Fixed ARC_N32_ME.
Added ME (middle-endian) to ARC_SDA_12 reloc.

bfd/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>
* reloc.c: Fixed type in ARC_SECTOFF relocations. Added ARC_SDA_12
relocation.
* bfd-in2.h: Regenerated from the previous changes.
* libbfd.h: Regenerated from the previous changes.

include/ChangeLog:

Cupertino Miranda  <cmiranda@synopsys.com>
* elf/arc-reloc.def: Fixed relocation formula for N*, SDA, SDA_12,
SDA_16_LD*, S13_PCREL, N32_ME, SECTOFF_* relocations.
* opcode/arc-func.h (replace_disp12s): Added. Used for SDA_12 relocation.

8 years agoAdd support for stable secure gateway veneers addresses
Thomas Preud'homme [Fri, 26 Aug 2016 09:59:26 +0000 (10:59 +0100)]
Add support for stable secure gateway veneers addresses

2016-08-26  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Add a new parameter for
the input import library bfd.
* bfd-in2.h: Regenerate.
* elf32-arm.c (struct elf32_arm_link_hash_table): New in_implib_bfd
and new_cmse_stub_offset fields.
(stub_hash_newfunc): Initialize stub_offset and stub_template_size to
-1.
(elf32_arm_add_stub): Likewise for stub_offset.
(arm_new_stubs_start_offset_ptr): New function.
(arm_build_one_stub): Only allocate a stub_offset if it is -1.  Allow
empty SG veneers to have zero relocations.
(arm_size_one_stub): Only initialize stub size and template
information for non empty veneers.  Do not update veneer section size
if veneer already has an offset.
(elf32_arm_create_stub): Return the stub entry pointer or NULL instead
of a boolean indicating success or failure.
(cmse_scan): Change stub_changed parameter into an integer pointer
parameter cmse_stub_created to count the number of stub created and
adapt to change of return value in elf32_arm_create_stub.
(cmse_entry_fct_p): New function.
(arm_list_new_cmse_stub): Likewise.
(set_cmse_veneer_addr_from_implib): Likewise.
(elf32_arm_size_stubs): Define cmse_stub_created, pass its address to
cmse_scan instead of that of cmse_stub_changed to compute the number
of stub created and use it to initialize stub_changed.  Call
set_cmse_veneer_addr_from_implib after all cmse_scan.  Adapt to change
of return value in elf32_arm_create_stub.  Use
arm_stub_section_start_offset () if not NULL to initialize size of
secure gateway veneers section.  Initialize stub_offset of Cortex-A8
erratum fix to -1.  Use ret to hold return value.
(elf32_arm_build_stubs): Use arm_stub_section_start_offset () if not
NULL to initialize size of secure gateway veneers section.  Adapt
comment to stress the importance of zeroing veneer section content.
(bfd_elf32_arm_set_target_relocs): Add new in_implib_bfd parameter to
initialize eponymous field in struct elf32_arm_link_hash_table.

ld/
* emultempl/armelf.em (in_implib_filename): Declare and initialize new
variable.
(arm_elf_create_output_section_statements): Open import input library
file for writing and pass resulting in_implib_bfd to
bfd_elf32_arm_set_target_relocs.
(PARSE_AND_LIST_PROLOGUE): Define OPTION_IN_IMPLIB option.
(PARSE_AND_LIST_LONGOPTS): Define --in-implib option.
(PARSE_AND_LIST_OPTIONS): Add help message for --in-implib option.
(PARSE_AND_LIST_ARGS_CASES): Handle new OPTION_IN_IMPLIB case.
* ld.texinfo (--cmse-implib): Update to mention --in-implib.
(--in-implib): Document new option.
* NEWS: Likewise.
* testsuite/ld-arm/arm-elf.exp
(Secure gateway import library generation): add --defsym VER=1 to gas
CLI.
(Secure gateway import library generation: errors): Likewise.
(Input secure gateway import library): New test.
(Input secure gateway import library: no output import library):
Likewise.
(Input secure gateway import library: not an SG input import library):
Likewise.
(Input secure gateway import library: earlier stub section base):
Likewise.
(Input secure gateway import library: later stub section base):
Likewise.
(Input secure gateway import library: veneer comeback): Likewise.
(Input secure gateway import library: entry function change):
Likewise.
* testsuite/ld-arm/cmse-implib.s: Add input import library testing.
* testsuite/ld-arm/cmse-implib.rd: Update accordingly.
* testsuite/ld-arm/cmse-new-implib.out: New file.
* testsuite/ld-arm/cmse-new-implib.rd: Likewise.
* testsuite/ld-arm/cmse-new-implib-no-output.out: Likewise.
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out: Likewise.
* testsuite/ld-arm/cmse-new-earlier-later-implib.out: Likewise.
* testsuite/ld-arm/cmse-new-comeback-implib.rd: Likewise.
* testsuite/ld-arm/cmse-new-wrong-implib.out: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoS390: Add support for core dump NOTE sections
Andreas Arnez [Thu, 25 Aug 2016 17:13:57 +0000 (19:13 +0200)]
S390: Add support for core dump NOTE sections

This enhances the 32-bit and 64-bit s390 ELF backends with support for
reading and writing the core dump note sections NT_PRSTATUS and
NT_PRPSINFO.  Byte swapping is done as appropriate, such that core files
can now be processed correctly on non-s390 platforms.

bfd/ChangeLog:

* elf32-s390.c (stdarg.h): New include.
(elf_s390_grok_psinfo): New function.
(elf_s390_write_core_note): New function.
(elf_backend_grok_psinfo): Declare backend hook.
(elf_backend_write_core_note): Likewise.
* elf64-s390.c (stdarg.h): New include.
(elf_s390_grok_prstatus): New function.
(elf_s390_grok_psinfo): New function.
(elf_s390_write_core_note): New function.
(elf_backend_grok_prstatus): Declare backend hook.
(elf_backend_grok_psinfo): Likewise.
(elf_backend_write_core_note): Likewise.

8 years agoS390: Indentation fixes in elf32/64-s390.c
Andreas Arnez [Thu, 25 Aug 2016 17:13:57 +0000 (19:13 +0200)]
S390: Indentation fixes in elf32/64-s390.c

Some indentation fixes in elf32-s390.c and elf64-s390.c.  Whitespace
changes only.

bfd/ChangeLog:

* elf32-s390.c (allocate_dynrelocs): Fix indentation.
(elf_s390_finish_ifunc_symbol): Likewise.
(elf_s390_finish_dynamic_symbol): Likewise.
(elf_s390_finish_dynamic_sections): Likewise.
(elf_s390_grok_prstatus): Likewise.
* elf64-s390.c (elf_s390_hash_table): Fix indentation.
(elf_s390_finish_dynamic_symbol): Likewise.

8 years agoxtensa: Avoid designated inits, for C++ compliance
Andreas Arnez [Thu, 25 Aug 2016 17:13:57 +0000 (19:13 +0200)]
xtensa: Avoid designated inits, for C++ compliance

C++ does not officially support designators in initializer lists.  Thus
some compilers may issue errors when encountering them.  Modern versions
of GCC seem to allow them by default, as a GCC extension, even though
the GCC documentation explicitly states otherwise: "[...] This extension
is not implemented in GNU C++."  But some older GCC versions (like
4.4.7) did indeed emit an error instead, like this:

  .../gdb/xtensa-config.c:219: error: expected primary-expression before
       ‘.’ token

This patch removes the only such instance I've seen when building with
'--enable-targets=all'.

gdb/ChangeLog:

* xtensa-tdep.h (XTENSA_GDBARCH_TDEP_INSTANTIATE): Replace
designated initializer list by plain initializer list, for C++
compliance.

8 years agopowerpc ld configure
Alan Modra [Thu, 25 Aug 2016 06:41:40 +0000 (16:11 +0930)]
powerpc ld configure

This fixes a few problems in the powerpc ld configury.
1) Using powerpc*le-* to test for powerpcle and powerpc64le would
   incorrectly match a target triple like powerpc-apple-elf.
2) In the same vein, *64* could match 64 in the user supplied MANUF-OS
   part of the target triple.
3) tooldir vars were missing, and some target aliases would result in
   ridiculous values for those tdir_* vars given.
4) Since 2016-04-25, BE support was added automatically when asking
   for an LE target.  If that is a good idea, then so is adding LE
   support when asking for BE.

* configure.tgt (powerpc*-*-linux* et al): Rewrite, adding LE
support for BE.  First output all target endian configury
values, then opposite endian.  Handle more tooldirs.  Fix
bogus matches with strings in MANUF-OS part of target triple.

8 years agoRemove _S version of ARM MSR/MRS special registers
Thomas Preud'homme [Thu, 25 Aug 2016 08:44:09 +0000 (09:44 +0100)]
Remove _S version of ARM MSR/MRS special registers

2016-08-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* config/tc-arm.c (v7m_psrs): Remove msp_s, MSP_S, psp_s and PSP_S
special registers.
* testsuite/gas/arm/archv8m-cmse-msr.s: Remove test for above special
registers.
* testsuite/gas/arm/archv8m-cmse-msr-base.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.

8 years agoSync proc_service definition with GLIBC
Adhemerval Zanella [Thu, 25 Aug 2016 07:42:03 +0000 (08:42 +0100)]
Sync proc_service definition with GLIBC

GLIBC BZ#20311 [1] proc_service.h install patch also remove 'const'
attributes from ps_get_thread_area and comment #15 discuss why to remove
the const attribute (basically since it a callback with the struct
ps_prochandle owned by the client it should be able to modify it if
it the case).

On default build this is not the issue and current g++ does not trigger
any issue with this mismatch declaration.  However, on some bootstrap
build configuration where gdbserver is build with gcc instead this
triggers:

error: conflicting types for 'ps_get_thread_area'

This patch fixes it by syncing the declaration with GLIBC.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=20311

gdb/ChangeLog:

2016-08-25  Adhemerval Zanella  <adhemerval.zanella@linaro.org>

* aarch64-linux-nat.c (ps_get_thread_area): Remove const from
struct ps_prochandle.
* amd64-linux-nat.c (ps_get_thread_area): Likewise.
* arm-linux-nat.c (ps_get_thread_area): Likewise.
* gdb_proc_service.h (ps_get_thread_area): Likewise.
* i386-linux-nat.c (ps_get_thread_area): Likewise.
* m68klinux-nat.c (ps_get_thread_area): Likewise.
* mips-linux-nat.c (ps_get_thread_area): Likewise.
* nat/aarch64-linux.c (aarch64_ps_get_thread_area): Likewise.
* nat/aarch64-linux.h (aarch64_ps_get_thread_area): Likewise.
* xtensa-linux-nat.c (ps_get_thread_area): Likewise.

gdb/gdbserver/ChangeLog:

2016-08-25  Adhemerval Zanella  <adhemerval.zanella@linaro.org>

PR server/20491
* gdb_proc_service.h (ps_get_thread_area): Remove const from struct
ps_prochandle.
* linux-aarch64-low.c (ps_get_thread_area): Likewise.
* linux-arm-low.c (ps_get_thread_area): Likewise.
* linux-crisv32-low.c (ps_get_thread_area): Likewise.
* linux-m68k-low.c (ps_get_thread_area): Likewise.
* linux-mips-low.c (ps_get_thread_area): Likewise.
* linux-nios2-low.c (ps_get_thread_area): Likewise.
* linux-tic6x-low.c (ps_get_thread_area): Likewise.
* linux-x86-low.c (ps_get_thread_area): Likewise.
* linux-xtensa-low.c (ps_get_thread_area): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoX86: Add ptwrite instruction
H.J. Lu [Wed, 24 Aug 2016 22:27:11 +0000 (15:27 -0700)]
X86: Add ptwrite instruction

Implement ptwrite instruction defined in Intel64 and IA-32 Architectures
Software Developer’s Manual, June 2016.

gas/

* config/tc-i386.c (cpu_arch): Add .ptwrite.
* doc/c-i386.texi: Document ptwrite and .ptwrite.
* testsuite/gas/i386/i386.exp: Run ptwrite, ptwrite-intel,
x86-64-ptwrite and x86-64-ptwrite-intel.
* testsuite/gas/i386/ptwrite-intel.d: New file.
* testsuite/gas/i386/ptwrite.d: Likewise.
* testsuite/gas/i386/ptwrite.s: Likewise.
* testsuite/gas/i386/x86-64-ptwrite-intel.d: Likewise.
* testsuite/gas/i386/x86-64-ptwrite.d: Likewise.
* testsuite/gas/i386/x86-64-ptwrite.s: Likewise.

opcodes/

* i386-dis.c (PREFIX_MOD_0_0FAE_REG_4): New.
(PREFIX_MOD_3_0FAE_REG_4): Likewise.
(prefix_table): Add PREFIX_MOD_0_0FAE_REG_4 and
PREFIX_MOD_3_0FAE_REG_4.
(mod_table): Use PREFIX_MOD_0_0FAE_REG_4 and
PREFIX_MOD_3_0FAE_REG_4.
* i386-gen.c (cpu_flag_init): Add CPU_PTWRITE_FLAGS.
(cpu_flags): Add CpuPTWRITE.
* i386-opc.h (CpuPTWRITE): New.
(i386_cpu_flags): Add cpuptwrite.
* i386-opc.tbl: Add ptwrite instruction.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

8 years agoTest case to detect recursive unwinding in Python-based unwinders.
Kevin Buettner [Mon, 22 Aug 2016 17:14:05 +0000 (10:14 -0700)]
Test case to detect recursive unwinding in Python-based unwinders.

This test case verifies that GDB will not attempt to invoke a python
unwinder recursively.

At the moment, the behavior exhibited by GDB looks like this:

    (gdb) source py-recurse-unwind.py
    Python script imported
    (gdb) b ccc
    Breakpoint 1 at 0x4004bd: file py-recurse-unwind.c, line 23.
    (gdb) run
    Starting program: py-recurse-unwind
    TestUnwinder: Recursion detected - returning early.
    TestUnwinder: Recursion detected - returning early.
    TestUnwinder: Recursion detected - returning early.
    TestUnwinder: Recursion detected - returning early.

    Breakpoint 1, ccc (arg=<unavailable>) at py-recurse-unwind.c:23
    23      }
    (gdb) bt
    #-1 ccc (arg=<unavailable>) at py-recurse-unwind.c:23
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)

[I've shortened pathnames for easier reading.]

The desired / expected behavior looks like this:

    (gdb) source py-recurse-unwind.py
    Python script imported
    (gdb) b ccc
    Breakpoint 1 at 0x4004bd: file py-recurse-unwind.c, line 23.
    (gdb) run
    Starting program: py-recurse-unwind

    Breakpoint 1, ccc (arg=789) at py-recurse-unwind.c:23
    23      }
    (gdb) bt
    #0  ccc (arg=789) at py-recurse-unwind.c:23
    #1  0x00000000004004d5 in bbb (arg=456) at py-recurse-unwind.c:28
    #2  0x00000000004004ed in aaa (arg=123) at py-recurse-unwind.c:34
    #3  0x00000000004004fe in main () at py-recurse-unwind.c:40

Note that GDB's problems go well beyond the fact that it invokes the
unwinder recursively.  In the process it messes up some internal state
(the frame stash) leading to display of (only) the sentinel frame in
the backtrace.

gdb/testsuite/ChangeLog:

* gdb.python/py-recurse-unwind.c: New file.
* gdb.python/py-recurse-unwind.py: New file.
* gdb.python/py-recurse-unwind.exp: New file.

8 years agoAllow resetting an empty inferior-tty
Simon Marchi [Wed, 24 Aug 2016 17:10:08 +0000 (13:10 -0400)]
Allow resetting an empty inferior-tty

This patch allows the user to set the inferior-tty to "empty", in order
to come back to the default behaviour of using the same tty as gdb is
using.

This is already supported in MI (and tested in gdb.mi/mi-basics.exp).

I added a new test, set-inferior-tty.exp, where I test only the setting
and unsetting of the parameter.  It would be nice to actually test that
the inferior output properly goes to the separate tty, but that will be
for another day.

gdb/ChangeLog:

* infcmd.c (set_inferior_io_terminal): Set inferior terminal to
NULL if terminal_name is an empty string.
(_initialize_infcmd): Make the argument of "set inferior-tty"
optional, mention it in the help doc.

gdb/doc/ChangeLog:

* gdb.texinfo (Input/Output): Mention possibility to unset
inferior-tty.

gdb/testsuite/ChangeLog:

* gdb.base/set-inferior-tty.exp: New file.
* gdb.base/set-inferior-tty.c: New file.

8 years agoFix for gdb.base/pc-fp.exp.
Carl E. Love [Wed, 24 Aug 2016 15:08:58 +0000 (08:08 -0700)]
Fix for gdb.base/pc-fp.exp.

It is my understanding that GDB used to require each architecture to
define a Frame Pointer (fp).  However, this functionality was deprecated
some time ago so the call to setup the fp_reg was changed to deprecated
(set_gdbarch_deprecated_fp_regnum).  It should have been removed from the
Power code.

That said, the code "set_gdbarch_deprecated_fp_regnum
(gdbarch, PPC_R0_REGNUM + 1);" sets up register r1 as the frame pointer.
Register r1 is no longer used to hold the frame pointer on Power.  By
removing the fp definition for Power in GDB, it causes GDB to fall back
to the call get_frame_base_address (frame) which returns the correct value
depending on the specific senario but most of the time is the DWARF
canonical frame address.

gdb/ChangeLog

2016-08-24  Carl Love  <cel@us.ibm.com>

* rs6000-tdep.c (rs6000_gdbarch_init): Remove call
        set_gdbarch_deprecated_fp_regnum() from initialization function.

8 years ago[ARC] C++ compatibility for arc-dis.h
Anton Kolesov [Tue, 31 May 2016 15:40:09 +0000 (18:40 +0300)]
[ARC] C++ compatibility for arc-dis.h

opcodes/
2016-08-24  Anton Kolesov  <Anton.Kolesov@synopsys.com>

* arc-dis.h: Wrap around in extern "C".

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
8 years ago[ARC] Parse NOTE section in core dump files
Anton Kolesov [Thu, 12 Sep 2013 11:56:45 +0000 (15:56 +0400)]
[ARC] Parse NOTE section in core dump files

This patch adds function elf32_arc_grok_parse to parse NOTE section of core
dump files. GDB requires this to work properly with core dumps.

bfd/
2016-08-24  Anton Kolesov  <Anton.Kolesov@synopsys.com>

* elf32-arc.c (elf32_arc_grok_prstatus): New function.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
8 years ago[gold] Implement -z stack-size option
Roland McGrath [Tue, 23 Aug 2016 23:43:33 +0000 (16:43 -0700)]
[gold] Implement -z stack-size option

gold/
* options.h (General_options): Grok -z stack-size.
* output.h (Output_segment::set_size): New method.
* layout.cc (Layout::create_executable_stack_info): Renamed to ...
(Layout::create_stack_segment): ... this.  Always create the
segment if -z stack-size was used.
(Layout::set_segment_offsets): Don't call ->set_offset on the
PT_GNU_STACK segment.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 24 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in