binutils-gdb.git
9 years agoAdjust gdb.multi tests for aarch64
Yao Qi [Tue, 7 Jul 2015 15:58:19 +0000 (16:58 +0100)]
Adjust gdb.multi tests for aarch64

Multi-arch related tests under gdb.multi are to compile programs with
the same compiler but different compiler options (-m64 vs -m32).  However,
different compilers are needed to compile both aarch64 program and
arm (aarch32) program.  This patch is to adjust these test cases to
compile programs in different modes with different compiler.

When we use gcc for arm-linux target, its file name can be different,
arm-linux-gnueabihf-gcc, arm-linux-gnueabi-gcc, or arm-none-linux-gnueabi-gcc,
so I add a variable ARM_CC_FOR_TARGET, so that user can set the name
of gcc for arm-linux target on aarch64, like:

 $ make check RUNTESTFLAGS='ARM_CC_FOR_TARGET=arm-linux-gnueabihf-gcc multi-arch.exp'

gdb/testsuite:

2015-07-07  Yao Qi  <yao.qi@linaro.org>

* gdb.multi/multi-arch-exec.exp: Set march1 and march2 to "" if target
is aarch64.  If target is aarch64, set compiler=${ARM_CC_FOR_TARGET}
if it exists.
* gdb.multi/multi-arch.exp: Likewise.

9 years agoSet architecture to arm in arm-*.xml files
Yao Qi [Tue, 7 Jul 2015 15:58:19 +0000 (16:58 +0100)]
Set architecture to arm in arm-*.xml files

This patch is to add the following line to various arm target description
xml files,

<architecture>arm</architecture>

in order to fix problems I've seen on aarch64 multi-arch debugging,

 detach^M
 Detaching from program: build-gdb/gdb/testsuite/gdb.base/attach, process 17145^M
 (gdb) PASS: gdb.base/attach.exp: attach1 detach file^M
 No executable file now.^M
 Architecture of file not recognized.^M
 (gdb) FAIL: gdb.base/attach.exp: attach1, purging symbols after detach

Without this patch, struct target_desc *tdesc_* are not initialised
properly, that is, fields arch and osabi in 'struct target_desc' are
not set properly.  This doesn't cause any problems on single arch
debugging, because arch-utils.c:gdbarch_info_fill will guess correctly.
However, in multi-arch debugging, gdbarch_info_fill gets the aarch64
arch, but the target description is for arm (because the current
inferior is 32-bit arm).

It is a surprise to me we didn't set architecture to "arm" before in *.xml
files, and I didn't find out why didn't do so.  AFAICS,
gdb/features/arm-with-iwmmxt.xml was added firstly (in patch
https://sourceware.org/ml/gdb-patches/2007-01/msg00593.html)
which had <architecture>iwmmxt</architecture>, however, afterwards,
architecture isn't set anymore in features/arm-*.xml files (in patches
https://sourceware.org/ml/gdb-patches/2009-07/msg00689.html and
https://sourceware.org/ml/gdb-patches/2010-08/msg00225.html).

gdb:

2015-07-07  Yao Qi  <yao.qi@linaro.org>

* features/arm-with-m-fpa-layout.xml: Set architecture to arm.
* features/arm-with-m-fpa-layout.c: Regenerated.
* features/arm-with-m-vfp-d16.xml: Likewise.
* features/arm-with-m-vfp-d16.c: Regenerated.
* features/arm-with-m.xml: Likewise.
* features/arm-with-m.c: Regenerated.
* features/arm-with-neon.xml: Likewise.
* features/arm-with-neon.c: Regenerated.
* features/arm-with-vfpv2.xml: Likewise.
* features/arm-with-vfpv2.c: Regenerated.
* features/arm-with-vfpv3.xml: Likewise.
* features/arm-with-vfpv3.c: Regenerated.

9 years agoNative debug arm program by aarch64 GDB
Yao Qi [Tue, 7 Jul 2015 15:58:19 +0000 (16:58 +0100)]
Native debug arm program by aarch64 GDB

This patch is to let aarch64 GDB debug 32-bit arm program natively.  In
each function for fetching and storing registers, GDB will check
gdbarch_bfd_arch_info (gdbarch)->bits_per_word, if it is 32, call
the corresponding aarch32 functions in aarch32-linux-nat.c, otherwise
fall back to aarch64 code to fetch and store registers.

aarch64_linux_read_description has to return the right target description,
but we don't have gdbarch available there, so GDB fetches auxv and gets
AT_PHENT, in order to determine whether the target is 32-bit or 64-bit.
I learned this trick from solib-svr4.c.

gdb:

2015-07-07  Yao Qi  <yao.qi@linaro.org>

* aarch32-linux-nat.h (VFP_REGS_SIZE): New macro, moved from
arm-linux-nat.c.
* aarch64-linux-nat.c: Include aarch32-linux-nat.h and
elf/external.h.
(fetch_gregs_from_thread): Call aarch32_gp_regcache_supply
if target is 32-bit.
(store_gregs_to_thread): Call aarch32_gp_regcache_collect
if target is 32-bit.
(fetch_fpregs_from_thread): Call aarch32_vfp_regcache_supply
if target is 32-bit.
(store_fpregs_to_thread): Call aarch32_vfp_regcache_collect
if target is 32-bit.
(tdesc_arm_with_vfpv3, tdesc_arm_with_neon): Declare.
(aarch64_linux_read_description): Return the right target
description.
* arm-linux-nat.c (VFP_REGS_SIZE): Moved to aarch32-linux-nat.h.
* config/aarch64/linux.mh (NATDEPFILES): Add aarch32-linux-nat.o.
* configure.tgt (aarch64*-*-linux*): Add arm-tdep.o and
arm-linux-tdep.o

9 years agoNew aarch32-linux-nat.c
Yao Qi [Tue, 7 Jul 2015 15:58:19 +0000 (16:58 +0100)]
New aarch32-linux-nat.c

This patch is to move all the code about transferring
regcache <-> byte buffer for arm (aarch32) to a separate file
aarch32-linux-nat.c.  Then, in the following patch, aarch64 code
can use it to do multi-arch debugging.  This is a refactory patch.

gdb:

2015-07-07  Yao Qi  <yao.qi@linaro.org>

* aarch32-linux-nat.c: New file.
* aarch32-linux-nat.h: New file.
* arm-linux-nat.c: Include aarch32-linux-nat.h.
(fetch_regs): Move code to aarch32-linux-nat.c.  Call
aarch32_gp_regcache_supply.
(store_regs): Move code to aarch32-linux-nat.c.  Call
aarch32_gp_regcache_collect.
(fetch_vfp_regs): Move code to aarch32-linux-nat.c.  Call
aarch32_vfp_regcache_supply.
(store_vfp_regs): Move code to aarch32-linux-nat.c.  Call
aarch32_vfp_regcache_collect.
* config/arm/linux.mh (NATDEPFILES): Add aarch32-linux-nat.o.

9 years agoRemove {fetch,store}_fpregister and {fetch,store}_register
Yao Qi [Tue, 7 Jul 2015 15:58:19 +0000 (16:58 +0100)]
Remove {fetch,store}_fpregister and {fetch,store}_register

This patch is to remove fetch_fpregister, fech_register,
store_fpregister and store_register, and use fetch_fpregs,
fetch_regs, store_regs, and store_fpregs instead.

gdb:

2015-07-07  Yao Qi  <yao.qi@linaro.org>

* arm-linux-nat.c (store_fpregister): Remove.
(store_register): Likewise.
(fetch_fpregister): Likewise.
(fetch_register): Likewise.
(arm_linux_store_inferior_registers): Call store_regs and
store_fpregs instead.
(arm_linux_fetch_inferior_registers): Call fetch_fpregs and
fetch_regs instead.

9 years agoFix test for Python 3
Simon Marchi [Tue, 7 Jul 2015 15:39:06 +0000 (11:39 -0400)]
Fix test for Python 3

gdb/testsuite/ChangeLog:

* gdb.python/py-lazy-string.exp: Add missing parentheses to
print.

9 years ago[arm] Fix regression by Do not skip prologue for asm (.S) files
Yao Qi [Tue, 7 Jul 2015 09:37:28 +0000 (10:37 +0100)]
[arm] Fix regression by Do not skip prologue for asm (.S) files

Patch "Do not skip prologue for asm (.S) files" [1] changes GDB's
behaviour on which test gdb.arch/thumb-singlestep.exp depends, so
it causes the fail below:

 (gdb) si^M
 37              blx     foo^M
 (gdb) FAIL: gdb.arch/thumb-singlestep.exp: step into foo

the test assumes the program will stop at the instruction after "push"
but it doesn't.  The fix to this fail is to do one more single step.

[1] https://sourceware.org/ml/gdb-patches/2015-06/msg00561.html

gdb/testsuite:

2015-07-07  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/thumb-singlestep.exp: Do one more single step.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 7 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAlign text section ends so that stub tables appears at expected addresses.
Doug Kwan [Mon, 6 Jul 2015 22:02:40 +0000 (15:02 -0700)]
Align text section ends so that stub tables appears at expected addresses.

9 years agogdb: Rewrite documentation for layout and focus commands.
Andrew Burgess [Mon, 6 Jul 2015 10:33:31 +0000 (11:33 +0100)]
gdb: Rewrite documentation for layout and focus commands.

Changes the documentation for the layout and focus commands.

Instead of documenting each layout (or focus) sub-command as a separate
command, document a single layout (and focus) command which takes a
parameter, then list the possible parameters in a table nested under
each command.

The documentation for the layout command has been extended little to
make it clearer which windows are shown in each layout.

gdb/ChangeLog:

* doc/gdb.texinfo (TUI): Restructure documentation on TUI layout
and focus commands.

9 years agoUpdate NEWS post GDB 7.10 branch creation.
Joel Brobecker [Mon, 6 Jul 2015 20:02:47 +0000 (13:02 -0700)]
Update NEWS post GDB 7.10 branch creation.

gdb/ChangeLog:

* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.

9 years agoBump version to 7.10.50.DATE-cvs.
Joel Brobecker [Mon, 6 Jul 2015 19:58:29 +0000 (12:58 -0700)]
Bump version to 7.10.50.DATE-cvs.

Now that the GDB 7.10 branch has been created, we can
bump the version number.

gdb/ChangeLog:

GDB 7.10 branch created (66c4b3e8a628a207bc6aafef6af0c4128195f56e):
* version.in: Bump version to 7.10.50.DATE-cvs.

9 years agoFix problems with finishing a dummy function call on simulators.
Luis Machado [Mon, 6 Jul 2015 19:09:21 +0000 (16:09 -0300)]
Fix problems with finishing a dummy function call on simulators.

This fixes regressions introduced with the original change to not
consider permanent breakpoints always inserted:

  6ae8866180bf90e9ec76c2dd34c07fd826d11a83 is the first bad commit
  commit 6ae8866180bf90e9ec76c2dd34c07fd826d11a83
  Author: Luis Machado <lgustavo@codesourcery.com>
  Date:   Wed Jun 17 16:50:57 2015 -0300

      Fix problems with finishing a dummy function call on simulators.

Some checks were mistakenly left out of the original patch, which
caused the following failures:

-PASS: gdb.base/shlib-call.exp: print mainshr1(1)
-PASS: gdb.base/shlib-call.exp: step into mainshr1
+FAIL: gdb.base/shlib-call.exp: print mainshr1(1)
+FAIL: gdb.base/shlib-call.exp: step into mainshr1

-PASS: gdb.cp/chained-calls.exp: q(p())
+FAIL: gdb.cp/chained-calls.exp: q(p())

-PASS: gdb.cp/chained-calls.exp: q(p() + r())
+FAIL: gdb.cp/chained-calls.exp: q(p() + r())

-PASS: gdb.cp/chained-calls.exp: g(f(g(f() + f())) + f())
+FAIL: gdb.cp/chained-calls.exp: g(f(g(f() + f())) + f())

-PASS: gdb.cp/chained-calls.exp: *c
-PASS: gdb.cp/chained-calls.exp: *c + *c
-PASS: gdb.cp/chained-calls.exp: q(*c + *c)
+FAIL: gdb.cp/chained-calls.exp: *c
+FAIL: gdb.cp/chained-calls.exp: *c + *c
+FAIL: gdb.cp/chained-calls.exp: q(*c + *c)

-PASS: gdb.cp/classes.exp: calling method for small class
+FAIL: gdb.cp/classes.exp: calling method for small class

The above is likely caused by GDB not removing the permanent
breakpoints from the target, leading to the inferior executing
the breakpoint instruction and tripping on a SIGSEGV.

gdb/ChangeLog:
2015-07-06  Luis Machado  <lgustavo@codesourcery.com>

* breakpoint.c (remove_breakpoint_1): Don't handle permanent
breakpoints in a special way.
(remove_breakpoint): Likewise.
(mark_breakpoints_out): Likewise.

9 years agoRemove the merge conflict introduced by
H.J. Lu [Mon, 6 Jul 2015 19:00:45 +0000 (12:00 -0700)]
Remove the merge conflict introduced by

commit 2f0c68f23bb3132cd5ac466ca8775c0d9e4960cd
Author: Catherine Moore <clm@codesourcery.com>
Date:   Thu May 28 14:50:36 2015 -0700

    Compact EH Support

9 years agogdb/doc: Fix incorrect use of @xref.
Andrew Burgess [Mon, 6 Jul 2015 10:37:24 +0000 (11:37 +0100)]
gdb/doc: Fix incorrect use of @xref.

All uses of @xref must be followed by either '.' or ','.  In commit
a4ea0946c an incorrect use of @xref was introduced.  This commit
adds a comma after the use of @xref.

gdb/ChangeLog:

* doc/gdb.texinfo (TUI): Add comma after @xref.

9 years agogdb/tui: Don't cast between window types.
Andrew Burgess [Mon, 6 Jul 2015 15:56:42 +0000 (16:56 +0100)]
gdb/tui: Don't cast between window types.

Instead of casting between structure types to get the 'tui_gen_win_info'
info from a 'tui_win_info' access the generic member variable.  This is
inline with what is done throughout the rest of the tui code.

gdb/ChangeLog:

* tui/tui-win.c (tui_set_focus): Use structure member 'generic'
instead of casting the structure type.

9 years agosearch_struct_field: remove OFFSET parameter
Simon Marchi [Mon, 6 Jul 2015 17:10:56 +0000 (13:10 -0400)]
search_struct_field: remove OFFSET parameter

I was trying to understand what the OFFSET parameter was for, and
realized it was set to 0 in every call to search_struct_field.  I
assume that it was used at some point, but some subsequent changes
made it useless.

gdb/ChangeLog:

* valops.c (search_struct_field): Remove OFFSET parameter.
(value_cast_structs): Adjust calls to search_struct_field.
(value_struct_elt): Same.
(find_overload_match): Same.

9 years agoCleanup value_fetch_lazy's comment and return value
Simon Marchi [Mon, 6 Jul 2015 17:04:11 +0000 (13:04 -0400)]
Cleanup value_fetch_lazy's comment and return value

The comment for value_fetch_lazy seems outdated. It says that it's only
called from the value_contents and value_contents_all (macros!), which
is not true.  Also, the return value seems useless now, despite what the
comment says.

gdb/ChangeLog:

* value.c (value_fetch_lazy): Update comment, change return
value to void.
* value.h (value_fetch_lazy): Change return value to void.

9 years agogdb: tui_win_name: Make parameter and result const.
Andrew Burgess [Mon, 6 Jul 2015 14:32:11 +0000 (15:32 +0100)]
gdb: tui_win_name: Make parameter and result const.

This commit makes the parameter and the result for 'tui_win_name'
constant.  There's one place in the code that is then updated as a
result of this change.

gdb/ChangeLog:

* tui/tui-data.c (tui_partial_win_by_name): Window name is const.
(tui_win_name): Make parameter and result const.
* tui/tui-data.h (tui_win_name): Make parameter and result const.

9 years agoDon't throw an error in "show mpx bound" implementation
Patrick Palka [Thu, 2 Jul 2015 15:55:01 +0000 (11:55 -0400)]
Don't throw an error in "show mpx bound" implementation

"show" functions should not throw an exception in part because it causes
the output of the commands "info set" and "show" to get truncated.

This fixes the following fails:

    FAIL: gdb.base/default.exp: info set
    FAIL: gdb.base/default.exp: show

gdb/ChangeLog:

* i386-tdep.c (i386_mpx_info_bounds): Don't call error, instead
use printf_unfiltered.
(set_mpx_cmd): Add missing trailing space to command string
literal.
(_initialize_i386_tdep): Give the "mpx" prefix command its
correct name.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 6 Jul 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix an opd->append index in elf64-ppc.c
Richard Sandiford [Sun, 5 Jul 2015 18:56:59 +0000 (19:56 +0100)]
Fix an opd->append index in elf64-ppc.c

bfd/
* elf64-ppc.c (toc_adjusting_stub_needed): Use the symbol value
plus addend rather than the original st_value when looking up
entries in opd->adjust.

ld/testsuite/
* ld-powerpc/tocopt6-inc.s, ld-powerpc/tocopt6a.s,
ld-powerpc/tocopt6b.s, ld-powerpc/tocopt6c.s,
ld-powerpc/tocopt6.d: New test.
* ld-powerpc/powerpc.exp (ppc64elftests): Add it.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Jul 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd experimental support for --gc-sections with COFF and PE based targets.
Kai Tietz [Fri, 3 Jul 2015 14:50:29 +0000 (15:50 +0100)]
Add experimental support for --gc-sections with COFF and PE based targets.

PR ld/11539
bfd * coffcode.h (coff_bfd_gc_sections): Define default
to bfd_coff_gc_sections function.
* cofflink.c (init_reloc_cookie): Copy and adjust coff
related code about gc-sections from elflink.c to here.
(fini_reloc_cookie): Likewise.
(init_reloc_cookie_rels): Likewise.
(fini_reloc_cookie_rels): Likewise.
(init_reloc_cookie_for_section): Likewise.
(fini_reloc_cookie_for_section): Likewise.
(_bfd_coff_gc_mark_hook): Likewise.
(_bfd_coff_gc_mark_rsec): Likewise.
(_bfd_coff_gc_mark_reloc): Likewise.
(_bfd_coff_gc_mark): Likewise.
(_bfd_coff_gc_mark_extra_sections): Likewise.
(coff_gc_sweep_symbol_info): Likewise.
(coff_gc_sweep_symbol): Likewise.
(gc_sweep_hook_fn): Likewise.
(coff_gc_sweep): Likewise.
(bfd_coff_gc_sections): Likewise.
(_bfd_coff_gc_keep): Likewise.
* libcoff.h (coff_reloc_cookie): New struct.
(bfd_coff_gc_sections): New prototype.
(coff_gc_mark_hook_fn): New type.

ld * scripttempl/pep.sc: Mark .idata*, .CRT*, .tls*,
.rsrc*, .init, .ctor*, .dtor*, .fini, .jcr,
.eh_frame, .pdata. .xdata, and .gcc_except_table sections
as KEEP.
* scripttempl/pe.sc: Likewise.

9 years agoCorrect ld Makefile dependendcy for or1k
Alan Modra [Fri, 3 Jul 2015 01:28:22 +0000 (10:58 +0930)]
Correct ld Makefile dependendcy for or1k

* Makefile.am (eelf32or1k.c, eelf32or1k_linux.c): Depend on ELF_DEPS.
* Makefile.in: Regenerate.

9 years agoRemove ppc860, ppc750cl, ppc7450 insns from common ppc.
Alan Modra [Fri, 3 Jul 2015 01:26:26 +0000 (10:56 +0930)]
Remove ppc860, ppc750cl, ppc7450 insns from common ppc.

Back in the day support for these processors was added, we probably
didn't want to waste PPC_OPCODE bits on minor variations.  I've had a
complaint that disassembly of mfspr/mtspr was wrong for power8.  This
patch fixes that problem.

Note that since -m860/-m850/-m821 are new gas options enabling the
mpc8xx specific mfspr/mtspr variants it is possible that this change
will break some mpc8xx assembly code.  ie. you might need to modify
makefiles to pass -m860 to gas.

include/opcode/
* ppc.h (PPC_OPCODE_750, PPC_OPCODE_7450, PPC_OPCODE_860): Define.
opcodes/
* ppc-opc.c (PPC750, PPC7450, PPC860): Define using PPC_OPCODE_*.
* ppc-dis.c (ppc_opts): Add 821, 850 and 860 entries.  Add
PPC_OPCODE_7450 to 7450 entry.  Add PPC_OPCODE_750 to 750cl entry.
gas/
* config/tc-ppc.c (md_show_usage): Add -m821, -m850, -m860.
* doc/c-ppc.texi (PowerPC-Opts): Likewise.
gas/testsuite/
* gas/ppc/titan.d: Correct mfmcsrr0 disassembly.

9 years agoAdd support for backtracing through Renesas RX exception frames.
Kevin Buettner [Thu, 2 Jul 2015 23:46:31 +0000 (16:46 -0700)]
Add support for backtracing through Renesas RX exception frames.

This change adds support for backtracing through Renesas RX exception
frames.

Determination about the type of frame is made by scanning the
remainder of the function for a return instruction and then looking at
which, if any, return instruction is found.  A normal RTS instruction
indicates that the frame is a normal frame.  An RTFI instruction
indicates that it's a fast interrupt, and an RTE instruction indicates
that the frame is a (normal) exception frame.  If no return instruction
is found within the scanned region - which can happen when the end of
the function cannot be found - it is assumed to be a normal frame.

I was able to test that normal prologue scanning still works by
disabling the dwarf2 sniffer.  I've tested this code for normal
interrupts.  The fast interrupt case has not been tested.

gdb/ChangeLog:

* rx-tdep.c (RX_USP_REGNUM, RX_BPC_REGNUM): New constants.
(enum rx_frame_type): New.
(struct rx_prologue): Add new field `frame_type'.
(rx_analyze_prologue): Add `frame_type' parameter. Cache this
parameter in the prologue struct.  Add code for recording
locations of PC and PSW for fast interrupt and exception frames.
(rx_skip_prologue): Adjust call to rx_analyze_prologue.
(rx_analyze_frame_prologue): Add `frame_type' parameter.
(rx_frame_type): New function.
(rx_frame_base): Fetch frame type and pass it to rx_analyze_prologue.
(rx_frame_this_id): Rename parameter `this_prologue_cache' to
`this_cache'.
(rx_frame_prev_register): Rename parameter `this_prologue_cache' to
`this_cache'.  Add cases for RX_FRAME_TYPE_EXCEPTION and
RX_FRAME_TYPE_FAST_INTERRUPT.
(normal_frame_p, exception_frame_p, rx_frame_sniffer_common)
(rx_frame_sniffer, rx_exception_sniffer): New functions.
(rx_frame_unwind): Use rx_frame_sniffer instead of
default_frame_sniffer.
(rx_frame_unwind): New unwinder.
(rx_gdbarch_init): Register new unwinder.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 3 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agorx: Create and use flags types for psw, bpsw, and fpsw registers.
Kevin Buettner [Thu, 2 Jul 2015 22:02:56 +0000 (15:02 -0700)]
rx: Create and use flags types for psw, bpsw, and fpsw registers.

This change adds two flags types for the (Renesas RX) psw, bpsw, and
fpsw registers.  As a result, symbolic flags are displayed for these
registers in the output of GDB's "info registers" command as well as
in output from other commands, such as "print".

gdb/ChangeLog:

* rx-tdep.c (RX_BPSW_REGNUM, RX_FPSW_REGNUM): New constants.
(struct gdbarch_tdep): Add fields rx_psw_type and rx_fpsw_type.
(rx_register_type): Add cases for RX_PSW_REGNUM, RX_BPSW_REGNUM,
and RX_FPSW_REGNUM.
(rx_gdbarch_init): Initialize PSW, BPSW, and FPSW flags types.

9 years agoFix GCC false warning
Jan Kratochvil [Thu, 2 Jul 2015 20:39:57 +0000 (22:39 +0200)]
Fix GCC false warning

At least on
gcc-4.4.7-11.el6.i686
./configure --enable-64-bit-bfd --enable-targets=all
GDB does not build due to:
cc1: warnings being treated as errors
s390-linux-tdep.c: In function ‘s390_handle_arg’:
s390-linux-tdep.c:2575: error: ‘val’ may be used uninitialized in this function

gdb/ChangeLog
2015-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix GCC false warning.
* s390-linux-tdep.c (s390_handle_arg): Initialize VAL.

9 years agoFix typo in aarch64_linux_insert_hw_breakpoint
Yao Qi [Thu, 2 Jul 2015 13:03:54 +0000 (14:03 +0100)]
Fix typo in aarch64_linux_insert_hw_breakpoint

It should be "insert_hw_breakpoint" rather than "insert_hw_watchpoint".

gdb:

2015-07-02  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Fix
typo in the debugging message.

9 years agoFix snafu with latest addition to the ARM sim.
Nick Clifton [Thu, 2 Jul 2015 15:19:09 +0000 (16:19 +0100)]
Fix snafu with latest addition to the ARM sim.

* Makefile.in (SIM_EXTRA_CFLAGS): Revert previous delta.
(SIM_EXTRA_LIBS): Add -lm.

9 years agobtrace: maintenance commands
Markus Metzger [Mon, 3 Feb 2014 13:35:28 +0000 (14:35 +0100)]
btrace: maintenance commands

Add maintenance commands that help debugging the btrace record target.
The following new commands are added:

maint info btrace
  Print information about branch tracing internals.

maint btrace packet-history
  Print the raw branch tracing data.

maint btrace clear-packet-history
  Discard the stored raw branch tracing data.

maint btrace clear
  Discard all branch tracing data.  It will be fetched and processed
  anew by the next "record" command.

maint set|show btrace pt skip-pad
  Set and show whether PAD packets are skipped when computing the
  packet history.

gdb/
* btrace.c: Include gdbcmd.h, cli/cli-utils.h, and ctype.h.
(maint_btrace_cmdlist, maint_btrace_set_cmdlist)
(maint_btrace_show_cmdlist, maint_btrace_pt_set_cmdlist)
(maint_btrace_pt_show_cmdlist, maint_btrace_pt_skip_pad)
(btrace_maint_clear): New.
(btrace_fetch, btrace_clear): Call btrace_maint_clear.
(pt_print_packet, btrace_maint_decode_pt)
(btrace_maint_update_pt_packets, btrace_maint_update_packets)
(btrace_maint_print_packets, get_uint, get_context_size, no_chunk)
(maint_btrace_packet_history_cmd)
(maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd)
(maint_btrace_cmd, maint_btrace_set_cmd, maint_btrace_show_cmd)
(maint_btrace_pt_set_cmd, maint_btrace_pt_show_cmd)
(maint_info_btrace_cmd, _initialize_btrace): New.
* btrace.h (btrace_pt_packet, btrace_pt_packet_s)
(btrace_maint_packet_history, btrace_maint_info): New.
(btrace_thread_info) <maint>: New.
* NEWS: Announce it.

doc/
* gdb.texinfo (Maintenance Commands): Document "maint btrace"
commands.

9 years agobtrace: store raw btrace data
Markus Metzger [Mon, 3 Feb 2014 10:40:50 +0000 (11:40 +0100)]
btrace: store raw btrace data

Store the raw branch trace data that has been read from the target.

This data can be used for maintenance commands as well as for generating
a core file for the "record save" command.

gdb/
* btrace.c (btrace_fetch): Append the new trace data.
(btrace_clear): Clear the stored trace data.
* btrace.h (btrace_thread_info) <data>: New.
* common/btrace-common.h (btrace_data_clear)
(btrace_data_append): New.
* common/btrace-common.c (btrace_data_clear)
(btrace_data_append): New.

9 years agobtrace, linux: use data_size and data_offset
Markus Metzger [Mon, 17 Nov 2014 10:18:05 +0000 (11:18 +0100)]
btrace, linux: use data_size and data_offset

In struct perf_event_mmap_page there are new fields data_size and data_offset
that give the location of the perf_event data buffer relative to the mmap
page.  Use them if they are present.

gdb/
* nat/linux-btrace.c (linux_enable_bts): Check for
PERF_ATTR_SIZE_VER5.
Check for data_offset and data_size fields.  Use them.

9 years agobtrace: support Intel(R) Processor Trace
Markus Metzger [Fri, 24 Jan 2014 12:45:47 +0000 (13:45 +0100)]
btrace: support Intel(R) Processor Trace

Adds a new command "record btrace pt" to configure the kernel to use
Intel(R) Processor Trace instead of Branch Trace Strore.

The "record btrace" command chooses the tracing format automatically.

Intel(R) Processor Trace support requires Linux 4.1 and libipt.

gdb/
* NEWS: Announce new commands "record btrace pt" and "record pt".
Announce new options "set|show record btrace pt buffer-size".
* btrace.c: Include "rsp-low.h".
Include "inttypes.h".
(btrace_add_pc): Add forward declaration.
(pt_reclassify_insn, ftrace_add_pt, btrace_pt_readmem_callback)
(pt_translate_cpu_vendor, btrace_finalize_ftrace_pt)
(btrace_compute_ftrace_pt): New.
(btrace_compute_ftrace): Support BTRACE_FORMAT_PT.
(check_xml_btrace_version): Update version check.
(parse_xml_raw, parse_xml_btrace_pt_config_cpu)
(parse_xml_btrace_pt_raw, parse_xml_btrace_pt)
(btrace_pt_config_cpu_attributes, btrace_pt_config_children)
(btrace_pt_children): New.
(btrace_children): Add support for "pt".
(parse_xml_btrace_conf_pt, btrace_conf_pt_attributes): New.
(btrace_conf_children): Add support for "pt".
* btrace.h: Include "intel-pt.h".
(btrace_pt_error): New.
* common/btrace-common.c (btrace_format_string, btrace_data_fini)
(btrace_data_empty): Support BTRACE_FORMAT_PT.
* common/btrace-common.h (btrace_format): Add BTRACE_FORMAT_PT.
(struct btrace_config_pt): New.
(struct btrace_config)<pt>: New.
(struct btrace_data_pt_config, struct btrace_data_pt): New.
(struct btrace_data)<pt>: New.
* features/btrace-conf.dtd (btrace-conf)<pt>: New.
(pt): New.
* features/btrace.dtd (btrace)<pt>: New.
(pt, pt-config, cpu): New.
* nat/linux-btrace.c (perf_event_read, perf_event_read_all)
(perf_event_pt_event_type, kernel_supports_pt)
(linux_supports_pt): New.
(linux_supports_btrace): Support BTRACE_FORMAT_PT.
(linux_enable_bts): Free tinfo on error.
(linux_enable_pt): New.
(linux_enable_btrace): Support BTRACE_FORMAT_PT.
(linux_disable_pt): New.
(linux_disable_btrace): Support BTRACE_FORMAT_PT.
(linux_fill_btrace_pt_config, linux_read_pt): New.
(linux_read_btrace): Support BTRACE_FORMAT_PT.
* nat/linux-btrace.h (struct btrace_tinfo_pt): New.
(struct btrace_target_info)<pt>: New.
* record-btrace.c (set_record_btrace_pt_cmdlist)
(show_record_btrace_pt_cmdlist): New.
(record_btrace_print_pt_conf): New.
(record_btrace_print_conf): Support BTRACE_FORMAT_PT.
(btrace_ui_out_decode_error): Support BTRACE_FORMAT_PT.
(cmd_record_btrace_pt_start): New.
(cmd_record_btrace_start): Support BTRACE_FORMAT_PT.
(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): New.
(_initialize_record_btrace): Add new commands.
* remote.c (PACKET_Qbtrace_pt, PACKET_Qbtrace_conf_pt_size): New.
(remote_protocol_features): Add "Qbtrace:pt".
Add "Qbtrace-conf:pt:size".
(remote_supports_btrace): Support BTRACE_FORMAT_PT.
(btrace_sync_conf): Support PACKET_Qbtrace_conf_pt_size.
(remote_enable_btrace): Support BTRACE_FORMAT_PT.
(_initialize_remote): Add new commands.

gdbserver/
* linux-low.c: Include "rsp-low.h"
(linux_low_encode_pt_config, linux_low_encode_raw): New.
(linux_low_read_btrace): Support BTRACE_FORMAT_PT.
(linux_low_btrace_conf): Support BTRACE_FORMAT_PT.
(handle_btrace_enable_pt): New.
(handle_btrace_general_set): Support "pt".
(handle_btrace_conf_general_set): Support "pt:size".

doc/
* gdb.texinfo (Process Record and Replay): Spell out that variables
and registers are not available during btrace replay.
Describe the new "record btrace pt" command.
Describe the new "set|show record btrace pt buffer-size" options.
(General Query Packets): Describe the new Qbtrace:pt and
Qbtrace-conf:pt:size packets.
Expand "bts" to "Branch Trace Store".
Update the branch trace DTD.

9 years agoconfigure: check for libipt
Markus Metzger [Tue, 12 Nov 2013 15:58:45 +0000 (16:58 +0100)]
configure: check for libipt

Check for libipt, an Intel(R) Processor Trace decoder library.  The sources
can be found on github at:

    https://github.com/01org/processor-trace

gdb/
* configure.ac: Check for libipt
* configure: Regenerate.
* config.in: Regenerate.
* Makefile.in (LIBIPT): New.
(CLIBS): Add $LIBIPT.
* NEWS: document new configure options

9 years agodebug compile: Replace confusing debug message
Jan Kratochvil [Thu, 2 Jul 2015 06:01:35 +0000 (08:01 +0200)]
debug compile: Replace confusing debug message

It was found that from

(gdb) set debug compile 1
(gdb) compile code 1
[...]
allocated 0x7f bytes at 0x7ffff7ff9000 prot 5
allocated 0x38 bytes at 0x7ffff7ff8000 prot 1
lookup undefined ELF symbol "_GLOBAL_OFFSET_TABLE_"
allocated 0x10 bytes at 0x7ffff7ff7000 for registers
(gdb) _

the message 'lookup undefined ELF symbol' looks as an error to people,
including to myself once.

Change it to:

allocated 0x7f bytes at 0x7ffff7ff9000 prot 5
allocated 0x38 bytes at 0x7ffff7ff8000 prot 1
ELF symbol "_GLOBAL_OFFSET_TABLE_" relocated to zero
allocated 0x10 bytes at 0x7ffff7ff7000 for registers
(gdb) _

gdb/ChangeLog
2015-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

* compile/compile-object-load.c (compile_object_load): Replace debug
message "lookup undefined ELF symbol" by 3 more specific messages.

9 years agoTabify my ChangeLog entry for 2015-06-29.
Kevin Buettner [Thu, 2 Jul 2015 00:46:23 +0000 (17:46 -0700)]
Tabify my ChangeLog entry for 2015-06-29.

9 years agorl78: Create a flags type for the psw register.
Kevin Buettner [Wed, 1 Jul 2015 23:18:35 +0000 (16:18 -0700)]
rl78: Create a flags type for the psw register.

For the Renesas rl78 architecture, associate a flags type with the PSW
register. This will cause symbolic flags to be printed when using
the "info registers" command.

gdb/ChangeLog:

* rl78-tdep.c (struct gdbarch_tdep): Add new field, rl78_psw_type.
(rl78_register_type): Add case for RL78_PSW_REGNUM.
(rl78_gdbarch_init): Initialize rl78_psw_type.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAssembler tests for Nios II R2
Sandra Loosemore [Wed, 1 Jul 2015 23:11:47 +0000 (16:11 -0700)]
Assembler tests for Nios II R2

2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
    Cesar Philippidis  <cesar@codesourcery.com>

gas/testsuite/
* gas/nios2/add-r2.d: New.
* gas/nios2/align_fill-r2.d: New.
* gas/nios2/align_text-r2.d: New.
* gas/nios2/aligned_text-r2.d: New.
* gas/nios2/and-r2.d: New.
* gas/nios2/andc.d: New.
* gas/nios2/andc.s: New.
* gas/nios2/bmx.d: New.
* gas/nios2/bmx.s: New.
* gas/nios2/branch-r2.d: New.
* gas/nios2/break-r2.d: New.
* gas/nios2/bret-r2.d: New.
* gas/nios2/cache-r2.d: New.
* gas/nios2/cache-r2.s: New.
* gas/nios2/call-r2.d: New.
* gas/nios2/call26-r2.d: New.
* gas/nios2/call26_noat-r2.d: New.
* gas/nios2/call_noat-r2.d: New.
* gas/nios2/cdx_add.d: New.
* gas/nios2/cdx_add.s: New.
* gas/nios2/cdx_and.d: New.
* gas/nios2/cdx_and.s: New.
* gas/nios2/cdx_break.d: New.
* gas/nios2/cdx_break.s: New.
* gas/nios2/cdx_callr.d: New.
* gas/nios2/cdx_callr.s: New.
* gas/nios2/cdx_jmpr.d: New.
* gas/nios2/cdx_jmpr.s: New.
* gas/nios2/cdx_ldbu.d: New.
* gas/nios2/cdx_ldbu.s: New.
* gas/nios2/cdx_ldhu.d: New.
* gas/nios2/cdx_ldhu.s: New.
* gas/nios2/cdx_ldw.d: New.
* gas/nios2/cdx_ldw.s: New.
* gas/nios2/cdx_ldwsp.d: New.
* gas/nios2/cdx_ldwsp.s: New.
* gas/nios2/cdx_mov.d: New.
* gas/nios2/cdx_mov.s: New.
* gas/nios2/cdx_neg.d: New.
* gas/nios2/cdx_neg.s: New.
* gas/nios2/cdx_not.d: New.
* gas/nios2/cdx_not.s: New.
* gas/nios2/cdx_or.d: New.
* gas/nios2/cdx_or.s: New.
* gas/nios2/cdx_pop.d: New.
* gas/nios2/cdx_pop.s: New.
* gas/nios2/cdx_push.d: New.
* gas/nios2/cdx_push.s: New.
* gas/nios2/cdx_relax.d: New.
* gas/nios2/cdx_relax.s: New.
* gas/nios2/cdx_ret.d: New.
* gas/nios2/cdx_ret.s: New.
* gas/nios2/cdx_sll.d: New.
* gas/nios2/cdx_sll.s: New.
* gas/nios2/cdx_spaddi.d: New.
* gas/nios2/cdx_spaddi.s: New.
* gas/nios2/cdx_spdeci.d: New.
* gas/nios2/cdx_spdeci.s: New.
* gas/nios2/cdx_srl.d: New.
* gas/nios2/cdx_srl.s: New.
* gas/nios2/cdx_stb.d: New.
* gas/nios2/cdx_stb.s: New.
* gas/nios2/cdx_sth.d: New.
* gas/nios2/cdx_sth.s: New.
* gas/nios2/cdx_stw.d: New.
* gas/nios2/cdx_stw.s: New.
* gas/nios2/cdx_stwsp.d: New.
* gas/nios2/cdx_stwsp.s: New.
* gas/nios2/cdx_sub.d: New.
* gas/nios2/cdx_sub.s: New.
* gas/nios2/cdx_trap.d: New.
* gas/nios2/cdx_trap.s: New.
* gas/nios2/cdx_xor.d: New.
* gas/nios2/cdx_xor.s: New.
* gas/nios2/cmp-r2.d: New.
* gas/nios2/comments-r2.d: New.
* gas/nios2/complex-r2.d: New.
* gas/nios2/ctl-r2.d: New.
* gas/nios2/custom-r2.d: New.
* gas/nios2/eni.d: New.
* gas/nios2/eni.s: New.
* gas/nios2/etbt-r2.d: New.
* gas/nios2/flushda-r2.d: New.
* gas/nios2/jmp-r2.d: New.
* gas/nios2/ldb-r2.d: New.
* gas/nios2/ldb-r2.s: New.
* gas/nios2/ldh-r2.d: New.
* gas/nios2/ldh-r2.s: New.
* gas/nios2/ldw-r2.d: New.
* gas/nios2/ldw-r2.s: New.
* gas/nios2/ldwm.d: New.
* gas/nios2/ldwm.s: New.
* gas/nios2/lineseparator-r2.d: New.
* gas/nios2/movia-r2.d: New.
* gas/nios2/mpx.d: New.
* gas/nios2/mpx.s: New.
* gas/nios2/mul-r2.d: New.
* gas/nios2/nop-r2.d: New.
* gas/nios2/nop-r2.s: New.
* gas/nios2/nor-r2.d: New.
* gas/nios2/or-r2.d: New.
* gas/nios2/rdprs-r2.d: New.
* gas/nios2/rdprs-r2.s: New.
* gas/nios2/registers-r2.d: New.
* gas/nios2/ret-r2.d: New.
* gas/nios2/rotate-r2.d: New.
* gas/nios2/stb-r2.d: New.
* gas/nios2/stb-r2.s: New.
* gas/nios2/sth-r2.d: New.
* gas/nios2/sth-r2.s: New.
* gas/nios2/stw-r2.d: New.
* gas/nios2/stw-r2.s: New.
* gas/nios2/stwm.d: New.
* gas/nios2/stwm.s: New.
* gas/nios2/sub-r2.d: New.
* gas/nios2/sync-r2.d: New.
* gas/nios2/trap-r2.d: New.
* gas/nios2/tret-r2.d: New.
* gas/nios2/wrpie.d: New.
* gas/nios2/wrpie.s: New.
* gas/nios2/wrprs-r2.d: New.
* gas/nios2/xor-r2.d: New.

9 years agoOpcodes and assembler support for Nios II R2
Sandra Loosemore [Wed, 1 Jul 2015 23:08:03 +0000 (16:08 -0700)]
Opcodes and assembler support for Nios II R2

2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
    Cesar Philippidis  <cesar@codesourcery.com>

gas/
* config/tc-nios2.c (nios2_min_align): New.
(nop): Replace with....
(nop_r1, nop_r2, nop_r2_cdx, nop32, nop16): New.
(nios2_align): Handle alignment on 2-byte boundaries when CDX
instructions may be present.
(s_nios2_align): Adjust reference to nop.
(CDXBRANCH, IS_CDXBRANCH): New.
(CDX_UBRANCH_SUBTYPE, CDX_CBRANCH_SUBTYPE): New.
(nios2_relax_subtype_size): Handle 2-byte CDX branches.
(nios2_relax_frag): Likewise.
(md_convert_frag): Handle R2 encodings.
(nios2_check_overflow): Check that low-order bits are zero
before applying rightshift from howto.
(nios2_check_overflow): Correct negative overflow calculation.
(nios2_diagnose_overflow): Handle signed_immed12_overflow.  Issue
generic overflow messages for miscellaneous instruction formats.
(md_apply_fix): Recognize new R2 relocations.  For pc_relative
relocations, store fixup in *valP.
(nios2_reglist_mask, nios2_reglist_dir): New.
(nios2_parse_reglist): New.
(nios2_parse_base_register): New.
(nios2_assemble_expression): Handle constant expressions designated
by BFD_RELOC_NONE.
(nios2_assemble_reg3): New.
(nios2_assemble_arg_c): Handle R2 instruction formats.
(nios2_assemble_arg_d): Likewise.
(nios2_assemble_arg_s): Likewise.
(nios2_assemble_arg_t): Likewise.
(nios2_assemble_arg_D): New.
(nios2_assemble_arg_S): New.
(nios2_assemble_arg_T): New.
(nios2_assemble_arg_i): Handle R2 instruction formats.
(nios2_assemble_arg_I): New.
(nios2_assemble_arg_u): Handle R2 instruction formats.
(nios2_assemble_arg_U): New.
(nios2_assemble_arg_V): New.
(nios2_assemble_arg_W): New.
(nios2_assemble_arg_X): New.
(nios2_assemble_arg_Y): New.
(nios2_assemble_arg_o): Handle R2 instruction formats.
(nios2_assemble_arg_O): New.
(nios2_assemble_arg_P): New.
(nios2_assemble_arg_j): Handle R2 instruction formats.
(nios2_assemble_arg_k): New.
(nios2_assemble_arg_l): Handle R2 instruction formats.
(nios2_assemble_arg_m): Likewise.
(nios2_assemble_arg_M): New.
(nios2_assemble_arg_N): New.
(nios2_assemble_arg_e): New.
(nios2_assemble_arg_f): New.
(nios2_assemble_arg_g): New.
(nios2_assemble_arg_h): New.
(nios2_assemble_arg_R): New.
(nios2_assemble_arg_B): New.
(nios2_assemble_args): Handle new argument letters.
(nios2_consume_arg): Likewise.
(nios2_translate_pseudo_insn): Avoid dereferencing null pointer
in error message.
(nios2_ps_insn_info_structs): Add nop.n.
(output_ubranch): Handle CDX branches.
(output_cbranch): Likewise.
(output_call): Handle R2 encodings.
(output_movia): Likewise.
(md_begin): Initialize nios2_min_align.
(md_assemble): Align to nios2_min_align.  Adjust nios2_min_align
if a 16-bit instruction is seen.
(nios2_cons_align): Use appropriate nop pattern.

include/opcode/
* nios2.h (enum iw_format_type): Add R2 formats.
(enum overflow_type): Add signed_immed12_overflow and
enumeration_overflow for R2.
(struct nios2_opcode): Document new argument letters for R2.
(REG_3BIT, REG_LDWM, REG_POP): Define.
(includes): Include nios2r2.h.
(nios2_r2_opcodes, nios2_num_r2_opcodes): Declare.
(nios2_r2_asi_n_mappings, nios2_num_r2_asi_n_mappings): Declare.
(nios2_r2_shi_n_mappings, nios2_num_r2_shi_n_mappings): Declare.
(nios2_r2_andi_n_mappings, nios2_num_r2_andi_n_mappings): Declare.
(nios2_r2_reg3_mappings, nios2_num_r2_reg3_mappings): Declare.
(nios2_r2_reg_range_mappings, nios2_num_r2_reg_range_mappings):
Declare.
* nios2r2.h: New file.

opcodes/
* nios2-dis.c (nios2_extract_opcode): New.
(nios2_disassembler_state): New.
(nios2_find_opcode_hash): Use mach parameter to select correct
disassembler state.
(nios2_print_insn_arg): Extend to support new R2 argument letters
and formats.
(print_insn_nios2): Check for 16-bit instruction at end of memory.
* nios2-opc.c (nios2_builtin_regs): Add R2 register attributes.
(NIOS2_NUM_OPCODES): Rename to...
(NIOS2_NUM_R1_OPCODES): This.
(nios2_r2_opcodes): New.
(NIOS2_NUM_R2_OPCODES): New.
(nios2_num_r2_opcodes): New.
(nios2_r2_asi_n_mappings, nios2_num_r2_asi_n_mappings): New.
(nios2_r2_shi_n_mappings, nios2_num_r2_shi_n_mappings): New.
(nios2_r2_andi_n_mappings, nios2_num_r2_andi_n_mappings): New.
(nios2_r2_reg3_mappings, nios2_num_r2_reg3_mappings): New.
(nios2_r2_reg_range_mappings, nios2_num_r2_reg_range_mappings): New.

9 years agoRelocations for Nios II R2
Sandra Loosemore [Wed, 1 Jul 2015 23:02:09 +0000 (16:02 -0700)]
Relocations for Nios II R2

2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
    Cesar Philippidis  <cesar@codesourcery.com>

bfd/
* bfd-in2.h: Regenerated.
* elf32-nios2.c (elf_nios2_howto_table_rel): Rename to...
(elf_nios2_r1_howto_table_rel): This.
(elf_nios2_r2_howto_table_rel): New.
(BFD_IS_R2): New.
(lookup_howto): Add ABFD parameter.  Adjust to look up in either
the R1 or R2 relocation table, as determined by ABFD.
(nios2_reloc_map): Add R2 relocations.
(nios2_elf32_bfd_reloc_type_lookup): Do lookup using lookup_howto.
Pass it the ABFD parameter.
(nios2_elf32_bfd_reloc_name_lookup): Use ABFD to decide whether to
return an R1 or R2 relocation.
(nios2_elf32_info_to_howto): Do lookup using lookup_howto.
Pass it the ABFD parameter.
(nios2_elf32_do_call26_relocate): Check for alignment on a 4-byte
boundary.
(nios2_elf32_relocate_section): Adjust call to lookup_howto.
* libbfd.h: Regenerated.
* reloc.c (BFD_RELOC_NIOS2_R2_S12): New.
(BFD_RELOC_NIOS2_R2_I10_1_PCREL): New.
(BFD_RELOC_NIOS2_R2_T1I7_1_PCREL): New.
(BFD_RELOC_NIOS2_R2_T1I7_2): New.
(BFD_RELOC_NIOS2_R2_T2I4): New.
(BFD_RELOC_NIOS2_R2_T2I4_1): New.
(BFD_RELOC_NIOS2_R2_T2I4_2): New.
(BFD_RELOC_NIOS2_R2_X1I7_2): New.
(BFD_RELOC_NIOS2_R2_X2L5): New.
(BFD_RELOC_NIOS2_R2_F1I5_2): New.
(BFD_RELOC_NIOS2_R2_L5I4X1): New.
(BFD_RELOC_NIOS2_R2_T1X1I6): New.
(BFD_RELOC_NIOS2_R2_T1X1I6_2): New.

include/elf/
* nios2.h (R_NIOS2_R2_S12): New.
(R_NIOS2_R2_I10_1_PCREL): New.
(R_NIOS2_R2_T1I7_1_PCREL): New.
(R_NIOS2_R2_T1I7_2): New.
(R_NIOS2_R2_T2I4): New.
(R_NIOS2_R2_T2I4_1): New.
(R_NIOS2_R2_T2I4_2): New.
(R_NIOS2_R2_X1I7_2): New.
(R_NIOS2_R2_X2L5): New.
(R_NIOS2_R2_F1I5_2): New.
(R_NIOS2_R2_L5I4X1): New.
(R_NIOS2_R2_T1X1I6): New.
(R_NIOS2_R2_T1X1I6_2): New.
(R_NIOS2_ILLEGAL): Renumber.

9 years agoAdd Nios II arch flags and compatibility tests
Sandra Loosemore [Wed, 1 Jul 2015 22:55:28 +0000 (15:55 -0700)]
Add Nios II arch flags and compatibility tests

2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
    Cesar Philippidis  <cesar@codesourcery.com>

bfd/
* archures.c (bfd_mach_nios2r1, bfd_mach_nios2r2): New.
* bfd-in2.h: Regenerated.
* cpu-nios2.c (nios2_compatible): New.
(N): Use nios2_compatible instead of bfd_default_compatible.
(NIOS2R1_NEXT, NIOS2R2_NEXT): Define.
(arch_info_struct): New.
(bfd_nios2_arch): Chain to NIOS2R1_NEXT.
* elf32-nios2.c (is_nios2_elf): New.
(nios2_elf32_merge_private_bfd_data): New.
(nios2_elf32_object_p): New.
(bfd_elf32_bfd_merge_private_bfd_data): Define.
(elf_backend_object_p): Define.

gas/
* config/tc-nios2.c: Adjust includes.
(OPTION_MARCH): Define.
(md_longopts): Add -march option.
(nios2_architecture): New.
(nios2_use_arch): New.
(md_parse_option): Handle OPTION_MARCH.
(md_show_usage): Document -march.
(md_begin): Set arch in BFD.
(nios2_elf_final_processing): New.
* config/tc-nios2.h (elf_tc_final_processing): Define.
(nios2_elf_final_processing): New.
* doc/c-nios2.texi (-march): Add documentation.

include/elf/
* nios2.h (EF_NIOS2_ARCH_R1, EF_NIOS2_ARCH_R2): Define.

ld/testsuite/
* ld-nios2/mixed1a.d: New.
* ld-nios2/mixed1a.s: New.
* ld-nios2/mixed1b.d: New.
* ld-nios2/mixed1b.s: New.
* ld-nios2/nios2.exp: Build the new compatibility tests.

9 years agoRefactor elf_x86_64_convert_mov_to_lea
H.J. Lu [Wed, 1 Jul 2015 16:32:47 +0000 (09:32 -0700)]
Refactor elf_x86_64_convert_mov_to_lea

* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Refactor.

9 years agoTUI: Make sure to update registers if frame information has changed
Patrick Palka [Wed, 1 Jul 2015 12:02:09 +0000 (08:02 -0400)]
TUI: Make sure to update registers if frame information has changed

When I replaced TUI's frame_changed hook to fix PR tui/13378 I assumed
that there's no reason to refresh register information following a call
to "up", "down" or "frame".  This assumption was made to fix the problem
of refreshing frame information twice following a sync-execution normal
stop (once in tui_normal_stop and then in tui_before_prompt) -- the
second refresh removing any highlights made by the first.

I was wrong about that -- GDB's snapshot of register information is
per-frame, and when the frame changes, registers do too (most
prominently the %rip and %rsp registers).  So e.g. GDB 7.8 would
highlight such register changes after invoking "up", "down" or "frame",
and current GDB does not.

To fix this regression, this patch adds another (sufficient) condition
for refreshing register information: in
tui_refresh_frame_and_register_information, always refresh register
information if frame information has changed.  This makes register
information get refreshed following a call to "up", "down" or "frame"
while still avoiding the "double refresh" issue following a normal stop.

This condition may seem to obsolete the existing registers_too_p
parameter, but it does not: following a normal stop, it is possible that
registers may have changed while frame information had not.  We could be
on the exact same PC with different register values.  The new condition
would not catch such a case, but the registers_too_p condition will.  So
both conditions seem necessary (and either one is sufficient).

gdb/ChangeLog:

* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
Update commentary.  Always refresh the registers when frame
information has changed.
* tui/tui-stack.c (tui_show_frame_info): Update commentary.
Change return type to int.  Return 1 if frame information has
changed, 1 otherwise.
(tui_before_prompt): Update commentary.
* tui/tui-stack.h (tui_show_frame_info): Change return type to
int.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRemove the unneeded escaping of '[' and ']' characters in test_class_help
Martin Galvan [Tue, 30 Jun 2015 21:20:47 +0000 (18:20 -0300)]
Remove the unneeded escaping of '[' and ']' characters in test_class_help

As these characters don't need to be escaped for strings
wrapped inside {} braces, we can remove the unneeded backslashes.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (test_class_help): Remove the unneeded escaping of
'[' and ']' characters.

9 years agoSync dlang demangling tests from upstream libiberty testsuite
Iain Buclaw [Tue, 30 Jun 2015 18:09:16 +0000 (20:09 +0200)]
Sync dlang demangling tests from upstream libiberty testsuite

gdb/testsuite/ChangeLog:

* gdb.dlang/demangle.exp: Sync tests from libiberty testsuite.

9 years agoReplace TUI's select_frame hook (PR tui/13378)
Patrick Palka [Tue, 30 Jun 2015 17:56:49 +0000 (13:56 -0400)]
Replace TUI's select_frame hook (PR tui/13378)

The select_frame hook is used by TUI to update TUI's frame and register
information following changes to the selected frame.  The problem with
this hook is that it gets called after every single frame change, even
if the frame change is only temporary or internal.  This is the primary
cause of flickering and slowdown when running the inferior under TUI
with conditional breakpoints set.  Internal GDB events are the source of
many calls to select_frame and these internal events are triggered
frequently, especially when a few conditional breakpoints are set.

This patch removes the select_frame hook altogether and instead makes
the frame and register information get updated in two key places (using
observers): after an inferior stops, and right before displaying a
prompt.  The latter hook covers the case when frame information must be
updated following a call to "up", "down" or "frame", and the former
covers the case when frame and register information must be updated
after a call to "continue", "step", etc. or after the inferior stops in
async execution mode.  Together these hooks should cover all the cases
when frame information ought to be refreshed (and when the relevant
windows ought to be subsequently updated).

The print_frame_info_listing hook is also effectively obsolete now, but
it still must be set while the TUI is active because its caller
print_frame_info will otherwise assume that the CLI is active, and will
print the frame informaion accordingly.  So this patch also sets the
print_frame_info_listing hook to a dummy callback, in lieu of outright
removing it yet.

Effectively, with this patch, frame/PC changes that do not immediately
precede an inferior-stop event or a prompt display event no longer cause
TUI's frame and register information to be updated.

And as a result of this change and of the previous change to
tui_show_frame_info, the TUI is much more disciplined about updating the
screen, and so the flicker as described in the PR is totally gone.

gdb/ChangeLog:

PR tui/13378
* frame.c (select_frame): Remove reference to
deprecated_selected_frame_level_changed_hook.
* frame.h (deprecated_selected_frame_level_changed_hook): Remove
declaration.
* stack.c (deprecated_selected_frame_level_changed_hook):
Likewise.
* tui/tui-hooks.c (tui_selected_frame_level_changed_hook):
Rename to ...
(tui_refresh_frame_and_register_information): ... this.  Bail
out if there is no stack.  Don't update register information
unless registers_too_p is true.
(tui_print_frame_info_listing_hook): Rename to ...
(tui_dummy_print_frame_info_listing_hook): ... this.
(tui_before_prompt): New function.
(tui_normal_stop): New function.
(tui_before_prompt_observer): New observer.
(tui_normal_stop_observer): New observer.
(tui_install_hooks): Set
deprecated_print_frame_info_listing_hook to
tui_dummy_print_frame_info_listing_hook.  Register
tui_before_prompt_observer to call tui_before_prompt and
tui_normal_stop_observer to call tui_normal_stop.  Remove
reference to deprecated_selected_frame_level_changed_hook.
(tui_remove_hooks): Detach and unset tui_before_prompt_observer
and tui_normal_stop_observer.  Remove reference to
deprecated_selected_frame_level_changed_hook.

9 years agoBe lazy about refreshing the windows in tui_show_frame_info (PR tui/13378)
Patrick Palka [Sat, 27 Jun 2015 00:38:30 +0000 (20:38 -0400)]
Be lazy about refreshing the windows in tui_show_frame_info (PR tui/13378)

tui_show_frame_info is responsible for updating the visible windows
following a change in frame information (that being the currently
selected frame, PC, line number, etc).  Currently it always redraws and
refreshes each window even if frame information has not changed.  This
behavior is inefficient and helps contribute to the occassional
flickering of the TUI as described in the mentioned PR.

This patch makes tui_show_frame_info refresh the windows only if frame
information has changed.  Determining whether frame information has
changed is done indirectly by determining whether the locator has
changed.  This approach is convenient and yet sensible because the
locator contains all the relevant info we need to check anyway: the
current PC, the line number, the name of the executable and the name of
the current function.  Probably only the PC is really necessary to
check, but it doesn't hurt to check every field.

Effectively, with this patch, consecutive calls to select_frame with the
same frame/PC no longer cause TUI's frame information to be updated
multiple times.

gdb/ChangeLog:

PR tui/13378
* tui/tui-stack.c (tui_set_locator_info): Change prototype to
return an int instead of void.  Return whether the locator
window has changed.
(tui_show_frame_info): If the locator info has not changed, then
bail out early to avoid refreshing the windows.

9 years agoCorrectly initialize the TUI locator window
Patrick Palka [Sat, 27 Jun 2015 00:17:56 +0000 (20:17 -0400)]
Correctly initialize the TUI locator window

The call to tui_alloc_content in tui_set_locator_info passes
locator->type as the type of the window whose content is being
allocated.  This may seem correct but it's actually not because when
this code path actually get executed locator->type has not yet been to
set LOCATOR_WIN so it defaults to 0 i.e. SRC_WIN.  Thus we allocate the
content of the locator window as if it was the source window.  This
oversight turns out not to be a big deal in practice but the patch that
follows depends on the locator's proc_name and full_name arrays to be
initialized to the empty string which is done by tui_alloc_content if
we pass to it LOCATOR_WIN.

This patch fixes this bug by explicitly passing LOCATOR_WIN to
tui_alloc_content.

gdb/ChangeLog:

* tui/tui-stack.c (tui_set_locator_info): Explicitly pass
LOCATOR_WIN to tui_alloc_content.

9 years agoSync libdecnumber with gcc
H.J. Lu [Tue, 30 Jun 2015 17:22:36 +0000 (10:22 -0700)]
Sync libdecnumber with gcc

* configure: Regenerated.

9 years agoSync dfp.m4 with gcc
H.J. Lu [Tue, 30 Jun 2015 17:20:19 +0000 (10:20 -0700)]
Sync dfp.m4 with gcc

* dfp.m4 (enable_decimal_float): Also set to yes for
i?86*-*-elfiamcu target.

9 years agoSync toplevel configure with gcc
H.J. Lu [Tue, 30 Jun 2015 17:15:57 +0000 (10:15 -0700)]
Sync toplevel configure with gcc

* configure.ac (ospace_frag): Enable for i?86*-*-elfiamcu
target.
* configure: Regenerate.

9 years agoThis fixes parsing a file containing ELF attributes with very large tag values.
Nick Clifton [Tue, 30 Jun 2015 16:12:47 +0000 (17:12 +0100)]
This fixes parsing a file containing ELF attributes with very large tag values.

PR binutils/18570
* elf-attrs.c (obj_attr_size): Use an unsigned int type for the tag.
(write_obj_attribute): Likewise.
(elf_new_obj_attr): Likewise.
(bfd_elf_get_obj_attr_int): Likewise.
(bfd_elf_add_obj_attr_int): Likewise.
(bfd_elf_add_obj_attr_string): Likewise.
(bfd_elf_add_obj_attr_int_string): Likewise.
(gnu_obj_attrs_arg_type): Likewise.
(_bfd_elf_obj_attrs_arg_type): Likewise.
(_bfd_elf_parse_attributes): Likewise.
(_bfd_elf_merge_unknown_attribute_list): Likewise.
* elf-bfd.h (struct obj_attribute_list): Likewise.
Update prototypes.

9 years agoAdd support for monitorx/mwaitx instructions
Amit Pawar [Tue, 30 Jun 2015 06:41:52 +0000 (12:11 +0530)]
Add support for monitorx/mwaitx instructions

gas/

* config/tc-i386.c (cpu_arch): Add .mwaitx.
(process_immext): Check operands for monitorx/mwaitx instructions.
* doc/c-i386.texi: Document mwaitx.

gas/testsuite/

* gas/i386/i386.exp: Add new mwaitx test cases.
* gas/i386/mwaitx.s: New.
* gas/i386/mwaitx-bdver4.d: New.
* gas/i386/x86-64-mwaitx.s: New.
* gas/i386/x86-64-mwaitx-bdver4.d: New.
* gas/i386/mwaitx-reg.s: New.
* gas/i386/mwaitx-reg.l: New.
* gas/i386/x86-64-mwaitx-reg.l: New.
* gas/i386/x86-64-mwaitx-reg.s: New.
* gas/i386/arch-13.s: Updated.
* gas/i386/arch-13.d: Updated.
* gas/i386/arch-13-znver1.d: Updated.
* gas/i386/x86-64-arch-3.s: Updated.
* gas/i386/x86-64-arch-3.d: Updated.
* gas/i386/x86-64-arch-3-znver1.d: Updated.

opcodes/

* i386-dis.c (OP_Mwaitx): New.
(rm_table): Add monitorx/mwaitx.
* i386-gen.c (cpu_flag_init): Add CpuMWAITX to CPU_BDVER4_FLAGS
and CPU_ZNVER1_FLAGS.  Add CPU_MWAITX_FLAGS.
(operand_type_init): Add CpuMWAITX.
* i386-opc.h (CpuMWAITX): New.
(i386_cpu_flags): Add cpumwaitx.
* i386-opc.tbl: Add monitorx and mwaitx.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

9 years agoAdd support for SADDR addressing to the RL78 port.
Nick Clifton [Tue, 30 Jun 2015 10:25:18 +0000 (11:25 +0100)]
Add support for SADDR addressing to the RL78 port.

gas * config/rl78-parse.y: Tag all saddr expressions throughout.
(SET_SA): New.
(expr_is_saddr): Allow symbolic expressions.
* config/tc-rl78.c (md_apply_fix): Handle SADDR.

bfd * elf32-rl78.c (rl78_elf_howto_table): Add RH_SADDR.
        (rl78_reloc_map): Add R_RL78_RH_SADDR.
* reloc.c: Add BFD_RELOC_RL78_SADDR.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.

9 years agoHandle media instructions in arm software single step.
Yao Qi [Tue, 30 Jun 2015 08:24:43 +0000 (09:24 +0100)]
Handle media instructions in arm software single step.

This patch fixes PR 18605 which is about incorrectly decoding media
instructions in software single step.

gdb:

2015-06-30  Yao Qi  <yao.qi@linaro.org>

PR tdep/18605
* arm-tdep.c (arm_get_next_pc_raw): Break for media
instructions.

9 years agoTurn on dwarf2 unwinding for Renesas RX architecture
Kevin Buettner [Mon, 29 Jun 2015 15:08:12 +0000 (08:08 -0700)]
Turn on dwarf2 unwinding for Renesas RX architecture

This change turns on dwarf2 unwinding in rx-tdep.c.  I found it
necessary to add rx_dwarf_reg_to_regnum in order to cause PC to be
mapped correctly.

gdb/ChangeLog:

* rx-tdep.c (RX_PSW_REGNUM): New enum constant.
(rx_dwarf_reg_to_regnum): New function.
(rx_gdbarch_init): Register rx_dwarf_reg_to_regnum.  Use dwarf2
unwinding.

9 years agoPatch for gold internal error while fixing erratum 843419.
Han Shen [Tue, 16 Jun 2015 22:00:58 +0000 (15:00 -0700)]
Patch for gold internal error while fixing erratum 843419.

The crash reason is that the insn to be moved to stub may be a
relocation spot, so instead of placing the origin insn (that is insn
before-relocation) to the stub, I have to place the relocated one.
Note the relocation involved is non-pc-relative, so it is safe to move
the relocated insn.

gold/ChangeLog:
2015-06-29  Han Shen  <shenhan@google.com>

    * AArch64.cc (Erratum_stub::Insn_utilities): New typedef.
    (Erratum_stub::update_erratum_insn): New method.
    (Stub_table::relocate_stubs): Modified to place relocated insn.
    (AArch64_relobj::fix_errata): Modified gold_assert.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoPR threads/18127 - threads spawned by infcall end up stuck in "running" state
Pedro Alves [Mon, 29 Jun 2015 15:07:57 +0000 (16:07 +0100)]
PR threads/18127 - threads spawned by infcall end up stuck in "running" state

Refs:
 https://sourceware.org/ml/gdb/2015-03/msg00024.html
 https://sourceware.org/ml/gdb/2015-06/msg00005.html

On GNU/Linux, if an infcall spawns a thread, that thread ends up with
stuck running state.  This happens because:

 - when linux-nat.c detects a new thread, it marks them as running,
   and does not report anything to the core.

 - we skip finish_thread_state when the thread that is running the
   infcall stops.

As result, that new thread ends up with stuck "running" state, even
though it really is stopped.

On Windows, _all_ threads end up stuck in running state, not just the
one that was spawned.  That happens because when a new thread is
detected, unlike linux-nat.c, windows-nat.c reports
TARGET_WAITKIND_SPURIOUS to infrun.  It's the fact that that event
does not cause a user-visible stop that triggers the problem.  When
the target is re-resumed, we call set_running with a wildcard ptid,
which marks all thread as running.  That set_running is not suppressed
because the (leader) thread being resumed does not have in_infcall
set.  Later, when the infcall finally finishes successfully, nothing
marks all threads back to stopped.

We can trigger the same problem on all targets by having a thread
other than the one that is running the infcall report a breakpoint hit
to infrun, and then have that breakpoint not cause a stop.  That's
what the included test does.

The fix is to stop GDB from suppressing the set_running calls while
doing an infcall, and then set the threads back to stopped when the
call finishes, iff they were originally stopped before the infcall
started.  (Note the MI *running/*stopped event suppression isn't
affected.)

Tested on x86_64 GNU/Linux.

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

PR threads/18127
* infcall.c (run_inferior_call): On infcall success, if the thread
was marked stopped before, reset it back to stopped.
* infrun.c (resume): Don't suppress the set_running calls when
doing an infcall.
(normal_stop): Only discard the finish_thread_state cleanup if the
infcall succeeded.

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

PR threads/18127
* gdb.threads/hand-call-new-thread.c: New file.
* gdb.threads/hand-call-new-thread.c: New file.

9 years agoFix email in ChangeLog entry.
Pierre Langlois [Mon, 29 Jun 2015 09:47:51 +0000 (10:47 +0100)]
Fix email in ChangeLog entry.

9 years ago[GDBServer][AArch64] Enable support for Z0 packets
Pierre Langlois [Mon, 29 Jun 2015 09:36:55 +0000 (10:36 +0100)]
[GDBServer][AArch64] Enable support for Z0 packets

This patch lets GDBServer handle software breakpoints instead of relying
on GDB.

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c (aarch64_supports_z_point_type): Enable for
Z_PACKET_SW_BP.

9 years ago[GDBServer][AArch64] Use the same break instruction as GDB
Pierre Langlois [Mon, 29 Jun 2015 09:34:42 +0000 (10:34 +0100)]
[GDBServer][AArch64] Use the same break instruction as GDB

GDB uses a "brk #0" instruction to perform a software breakpoint while
GDBServer uses an illegal instruction.  Both instructions should match.

When enabling support for the 'Z0' packet, we let GDBServer insert the
breakpoint instruction instead of GDB.  And in case of permanent
breakpoints for example, GDB will check if a breakpoint is inserted in the
inferior with `program_breakpoint_here_p (gdbarch, address)', and
compare the instruction read from the inferior with the breakpoint
instruction.

On AArch64, instructions are always little endian so we need to
represent it as an array of bytes, as done in aarch64-tdep.c.

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c: Remove comment about endianness.
(aarch64_breakpoint): Change type to gdb_byte[].  Set to "brk #0".
(aarch64_breakpoint_at): Change type of insn to gdb_byte[].  Use
memcmp.

9 years agoUpdate my email address
Pierre Langlois [Mon, 29 Jun 2015 09:23:48 +0000 (10:23 +0100)]
Update my email address

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Update my email address.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd support for ARM v6 instructions.
Nick Clifton [Sun, 28 Jun 2015 18:14:36 +0000 (19:14 +0100)]
Add support for ARM v6 instructions.

* Makefile.in (SIM_EXTRA_CFLAGS): Add -lm.
* armdefs.h (ARMdval, ARMfval): New types.
(ARM_VFP_reg): New union.
(struct ARMul_State): Add VFP_Reg and FPSCR fields.
(VFP_fval, VFP_uword, VFP_sword, VFP_dval, VFP_dword): Accessor
macros for the new VFP_Reg field.
* armemu.c (handle_v6_insn): Add code to handle MOVW, MOVT,
QADD16, QASX, QSAX, QSUB16, QADD8, QSUB8, UADD16, USUB16, UADD8,
USUB8, SEL, REV, REV16, RBIT, BFC, BFI, SBFX and UBFX
instructions.
(handle_VFP_move): New function.
(ARMul_Emulate16): Add checks for newly supported v6
instructions.  Add support for VMRS, VMOV and MRC instructions.
(Multiply64): Allow nRdHi == nRm and/or nRdLo == nRm when
operating in v6 mode.
* armemu.h (t_resolved): Define.
* armsupp.c: Include math.h.
(handle_VFP_xfer): New function.  Handles VMOV, VSTM, VSTR, VPUSH,
VSTM, VLDM and VPOP instructions.
(ARMul_LDC): Test for co-processor 10 or 11 and pass call to the
new handle_VFP_xfer function.
(ARMul_STC): Likewise.
(handle_VFP_op): New function.  Handles VMLA, VMLS, VNMLA, VNMLS,
VNMUL, VMUL, VADD, VSUB, VDIV, VMOV, VABS, VNEG, VSQRT, VCMP,
VCMPE and VCVT instructions.
(ARMul_CDP): Test for co-processor 10 or 11 and pass call to the
new handle_VFP_op function.
* thumbemu.c (tBIT, tBITS, ntBIT, ntBITS): New macros.
(test_cond): New function.  Tests a condition and returns non-zero
if the condition has been met.
(handle_IT_block): New function.
(in_IT_block): New function.
(IT_block_allow): New function.
(ThumbExpandImm): New function.
(handle_T2_insn): New function.  Handles T2 thumb instructions.
(handle_v6_thumb_insn): Add next_instr and pc parameters.
(ARMul_ThumbDecode): Add support for IT blocks.  Add support for
v6 instructions.
* wrapper.c (sim_create_inferior): Detect a thumb address and call
SETT appropriately.

9 years agoRemove COMPRESS_DEBUG_ZLIB
H.J. Lu [Sun, 28 Jun 2015 13:30:10 +0000 (06:30 -0700)]
Remove COMPRESS_DEBUG_ZLIB

COMPRESS_DEBUG_ZLIB isn't needed.  This patch removes COMPRESS_DEBUG_ZLIB
and replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB.

bfd/

* bfd-in.h (compressed_debug_section_type): Remove
COMPRESS_DEBUG_ZLIB.
* bfd-in2.h : Regenerated.
gas/

* as.c (parse_args): Replace COMPRESS_DEBUG_ZLIB with
COMPRESS_DEBUG_GNU_ZLIB.
* config/tc-i386.c (flag_compress_debug): Likewise.

ld/

* emultempl/elf32.em  (gld${EMULATION_NAME}_handle_option):
Replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 28 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoUpdate ia64 gas tests
H.J. Lu [Sat, 27 Jun 2015 23:43:43 +0000 (16:43 -0700)]
Update ia64 gas tests

* gas/ia64/psn.d: Updated.
* gas/ia64/xdata-ilp32.d: Likewise.

9 years agoUpdate xtensa linker tests
H.J. Lu [Sat, 27 Jun 2015 23:24:50 +0000 (16:24 -0700)]
Update xtensa linker tests

* ld-xtensa/tlsbin.rd: Updated.
* ld-xtensa/tlspic.rd: Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 27 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoPR 16253 revisited
Keith Seitz [Fri, 26 Jun 2015 17:27:45 +0000 (10:27 -0700)]
PR 16253 revisited

Last year a patch was submitted/approved/commited to eliminate
symbol_matches_domain which was causing this problem.  It was later reverted
because it introduced a (severe) performance regression.

Recap:

(gdb) list
1 enum e {A,B,C} e;
2 int main (void) { return 0; }
3
(gdb) p e
Attempt to use a type name as an expression

The parser attempts to find a symbol named "e" of VAR_DOMAIN.
This gets passed down through lookup_symbol and (eventually) into
block_lookup_symbol_primary, which iterates over the block's dictionary
of symbols:

  for (sym = dict_iter_name_first (block->dict, name, &dict_iter);
       sym != NULL;
       sym = dict_iter_name_next (name, &dict_iter))
    {
      if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
                                 SYMBOL_DOMAIN (sym), domain))
        return sym;
    }

The problem here is that we have a symbol named "e" in both STRUCT_DOMAIN
and VAR_DOMAIN, and for languages like C++, Java, and Ada, where a tag name
may be used as an implicit typedef of the type, symbol_matches_domain ignores
the difference between VAR_DOMAIN and STRUCT_DOMAIN.  As it happens, the
STRUCT_DOMAIN symbol is found first, considered a match, and that symbol is
returned to the parser, eliciting the (now dreaded) error message.

Since this bug exists specifically because we have both STRUCT and VAR_DOMAIN
symbols in a given block/CU, this patch rather simply/naively changes
block_lookup_symbol_primary so that it continues to search for an exact
domain match on the symbol if symbol_matches_domain returns a symbol
which does not exactly match the requested domain.

This "fixes" the immediate problem, but admittedly might uncover other,
related bugs.  [Paranoia?] However, it causes no regressions (functional
or performance) in the test suite.  A similar change has been made
to block_lookup_symbol for other cases in which this bug might appear.

The tests from the previous submission have been resurrected and updated.
However since we can still be given a matching symbol with a different domain
than requested, we cannot say that a symbol "was not found."  The error
messages today will still be the (dreaded) "Attempt to use a type name..."

ChangeLog

PR 16253
* block.c (block_lookup_symbol): For non-function blocks,
continue to search for a symbol with an exact domain match
Otherwise, return any previously found "best domain" symbol.
(block_lookup_symbol_primary): Likewise.

testsuite/ChangeLog

PR 16253
* gdb.cp/var-tag-2.cc: New file.
* gdb.cp/var-tag-3.cc: New file.
* gdb.cp/var-tag-4.cc: New file.
* gdb.cp/var-tag.cc: New file.
* gdb.cp/var-tag.exp: New file.

9 years agoAdd option to remove duplicate command history entries
Patrick Palka [Wed, 3 Jun 2015 02:49:15 +0000 (22:49 -0400)]
Add option to remove duplicate command history entries

This patch implements the new option "history remove-duplicates", which
controls the removal of duplicate history entries ("off" by default).

The motivation for this option is to be able to reduce the prevalence of
basic commands such as "up" and "down" in the history file.  These
common commands crowd out more unique commands in the history file (when
the history file has a fixed size), and they make navigation of the
history file via ^P, ^N and ^R more inconvenient.

The option takes an integer denoting the number of history entries to
look back at for a history entry that is a duplicate of the latest one.
"history remove-duplicates 1" is equivalent to bash's ignoredups option,
and "history remove-duplicates unlimited" is equivalent to bash's
erasedups option.

[ I decided to go with this integer approach instead of a tri-state enum
  because it's slightly more flexible and seemingly more intuitive than
  leave/erase/ignore.  ]

gdb/ChangeLog:

* NEWS: Mention the new option "history remove-duplicates".
* top.c (history_remove_duplicates): New static variable.
(show_history_remove_duplicates): New static function.
(gdb_add_history): Conditionally remove duplicate history
entries.
(init_main): Add "history remove-duplicates" option.

gdb/doc/ChangeLog:

* gdb.texinfo (Command History): Document the new option
"history remove-duplicates".

gdb/testsuite/ChangeLog:

* gdb.base/history-duplicates.exp: New test.

9 years agoAdd tab completion for TUI's "focus" command
Patrick Palka [Mon, 22 Jun 2015 02:54:10 +0000 (22:54 -0400)]
Add tab completion for TUI's "focus" command

The implementation is pretty straightforward, with the only caveat being
that the "src", "cmd", "next" and "prev" entries get delibrately added
to the completion list even when the TUI has not yet been initialized
(i.e. has never been enabled during the session), since invoking the
"focus" command with these arguments already works when the TUI has not
yet been initialized.

gdb/ChangeLog:

* tui/tui-win.c (focus_completer): New static function.
(_initialize_tui_win): Set the completion function of the
"focus" command to focus_completer.

gdb/testsuite/ChangeLog:

* gdb.base/completion.exp: Test the completion of the "focus"
command.

9 years agoDo not skip prologue for asm (.S) files
Jan Kratochvil [Fri, 26 Jun 2015 13:11:14 +0000 (15:11 +0200)]
Do not skip prologue for asm (.S) files

GDB tries to skip prologue for .S files according to .debug_line but it then
places the breakpoint to a location where it is never hit.

This is because #defines in .S files cause prologue skipping which is
completely inappropriate, for s390x:

glibc/sysdeps/unix/syscall-template.S
78:/* This is a "normal" system call stub: if there is an error,
79:   it returns -1 and sets errno.  */
80:
81:T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
82:     ret

00000000000f4210 T __select
 Line Number Statements:
  Extended opcode 2: set Address to 0xf41c8
  Advance Line by 80 to 81
  Copy
  Advance PC by 102 to 0xf422e
  Special opcode 6: advance Address by 0 to 0xf422e and Line by 1 to 82
  Special opcode 34: advance Address by 2 to 0xf4230 and Line by 1 to 83
  Advance PC by 38 to 0xf4256
  Extended opcode 1: End of Sequence
  Compilation Unit @ offset 0x28b3e0:
 <0><28b3eb>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <28b3ec>   DW_AT_stmt_list   : 0x7b439
    <28b3f0>   DW_AT_low_pc  : 0xf41c8
    <28b3f8>   DW_AT_high_pc     : 0xf4256
    <28b400>   DW_AT_name        : ../sysdeps/unix/syscall-template.S
    <28b423>   DW_AT_comp_dir    : /usr/src/debug////////glibc-2.17-c758a686/misc
    <28b452>   DW_AT_producer    : GNU AS 2.23.52.0.1
    <28b465>   DW_AT_language    : 32769        (MIPS assembler)

without debuginfo or with debuginfo and the fix - correct address:
(gdb) b select
Breakpoint 1 at 0xf4210

It is also where .dynsym+.symtab point to:
00000000000f4210 T __select
00000000000f4210 W select

with debuginfo, without the fix:
(gdb) b select
Breakpoint 1 at 0xf41c8: file ../sysdeps/unix/syscall-template.S, line 81.

One part is to behave for asm files similar way like for 'locations_valid':
  /* Symtab has been compiled with both optimizations and debug info so that
     GDB may stop skipping prologues as variables locations are valid already
     at function entry points.  */
  unsigned int locations_valid : 1;

The other part is to extend the 'locations_valid'-like functionality more.

Both minsym_found and find_function_start_sal need to be patched, otherwise
their addresses do not match and GDB regresses on ppc64:

gdb/ChangeLog
2015-06-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

* linespec.c (minsym_found): Reset sal.PC for COMPUNIT_LOCATIONS_VALID
and language_asm..
* symtab.c (find_function_start_sal): Likewise.

gdb/testsuite/ChangeLog
2015-06-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/amd64-prologue-skip.S: New file.
* gdb.arch/amd64-prologue-skip.exp: New file.

9 years agoCompile-in IAMCU linker scripts
H.J. Lu [Fri, 26 Jun 2015 12:39:45 +0000 (05:39 -0700)]
Compile-in IAMCU linker scripts

* emulparams/elf_iamcu.sh (COMPILE_IN): New.

9 years agoAdd support for DT_MIPS_RLD_MAP_REL.
Matthew Fortune [Thu, 11 Jun 2015 09:16:19 +0000 (10:16 +0100)]
Add support for DT_MIPS_RLD_MAP_REL.

This tag makes it possible to access the debug map when debugging position
independent executables.

bfd/

* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Use executable
instead of !shared to indicate an application vs shared library.
(_bfd_mips_elf_size_dynamic_sections): Likewise.
(_bfd_mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP_REL.
(_bfd_mips_elf_get_target_dtag): Likewise.

binutils/

* readelf.c (get_mips_dynamic_type): Handle DT_MIPS_RLD_MAP_REL.

include/

* elf/mips.h (DT_MIPS_RLD_MAP_REL): New macro.

ld/testsuite/

* ld-mips-elf/pic-and-nonpic-3b.ad: Adjust for extra dynamic tag.
* ld-mips-elf/pic-and-nonpic-4b.ad: Likewise.
* ld-mips-elf/pic-and-nonpic-5b.ad: Likewise.
* ld-mips-elf/pic-and-nonpic-6-n32.ad: Likewise.
* ld-mips-elf/pic-and-nonpic-6-n64.ad: Likewise.
* ld-mips-elf/pic-and-nonpic-6-o32.ad: Likewise.
* ld-mips-elf/tlsdyn-o32-1.d: Likewise.
* ld-mips-elf/tlsdyn-o32-1.got: Likewise.
* ld-mips-elf/tlsdyn-o32-2.d: Likewise.
* ld-mips-elf/tlsdyn-o32-2.got: Likewise.
* ld-mips-elf/tlsdyn-o32-3.d: Likewise.
* ld-mips-elf/tlsdyn-o32-3.got: Likewise.
* ld-mips-elf/tlsdyn-o32.d: Likewise.
* ld-mips-elf/tlsdyn-o32.got: Likewise.
* ld-mips-elf/pie-n32.d: New file.
* ld-mips-elf/pie-n64.d: Likewise.
* ld-mips-elf/pie-o32.d: Likewise.
* ld-mips-elf/pie.s: Likewise.
* ld-mips-elf/mips-elf.exp: Add new tests.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix REL handling for MSP430
DJ Delorie [Thu, 25 Jun 2015 21:20:15 +0000 (17:20 -0400)]
Fix REL handling for MSP430

* elf32-msp430.c (msp430_final_link_relocate): Fix comments.  Fix
REL loads to match RELA stores.

9 years agoDon't set sh_size for .shstrtab twice
H.J. Lu [Thu, 25 Jun 2015 19:12:43 +0000 (12:12 -0700)]
Don't set sh_size for .shstrtab twice

_bfd_elf_assign_file_positions_for_non_load will set the sh_size
field for .shstrtab section.  There is need to initialize it in
_bfd_elf_compute_section_file_positions.

* elf.c (_bfd_elf_compute_section_file_positions): Don't
initialize sh_size for .shstrtab here.

9 years agopy-prettyprint.exp: Add is_address_zero_readable check
Simon Marchi [Thu, 25 Jun 2015 17:33:14 +0000 (13:33 -0400)]
py-prettyprint.exp: Add is_address_zero_readable check

gdb/testsuite/ChangeLog:

* gdb.python/py-prettyprint.exp (run_lang_tests): Add
is_address_zero_readable check.

9 years agoRun ld-elf/strtab only on linux/gnu targets
H.J. Lu [Thu, 25 Jun 2015 17:14:13 +0000 (10:14 -0700)]
Run ld-elf/strtab only on linux/gnu targets

Since not all ELF targets support -shared, we limit ld-elf/strtab to
linux and gnu targets.

* ld-elf/strtab.d: Only run on *-*-linux* and *-*-gnu* targets.

9 years agoUpdate .strtab section sizes in mmix tests
H.J. Lu [Thu, 25 Jun 2015 17:05:10 +0000 (10:05 -0700)]
Update .strtab section sizes in mmix tests

Since commit ef10c3ace00674e8c3599c3bf95f06c87d68898b may reduce .strtab
section size, we need to adjust expected .strtab section sizes in mmix
tests.

gas/testsuite/

* gas/mmix/loc-3.d: Updated.
* gas/mmix/loc-5.d: Likewise.

ld/testsuite/

* ld-mmix/bspec1.d: Updated.
* ld-mmix/bspec2.d: Likewise.
* ld-mmix/undef-3.d: Likewise.

9 years agoUse strtab with GC and suffix merging for .strtab
H.J. Lu [Thu, 25 Jun 2015 15:16:00 +0000 (08:16 -0700)]
Use strtab with GC and suffix merging for .strtab

This patch uses ELF strtab with GC and suffix merging support to create
ELF .strtab section.  There is some small memory overhead to use ELF
strtab:

==14928== HEAP SUMMARY:
==14928==     in use at exit: 3,276,318 bytes in 679 blocks
==14928==   total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated

vs.

==14936== HEAP SUMMARY:
==14936==     in use at exit: 3,276,318 bytes in 679 blocks
==14936==   total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated

when running:

./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o

The results are

  [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1

vs

  [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1

It reduces the .strtab size by 350 bytes, about 2%

Saving on libc.so from glibc is much more since libc.so has many alias
symbols with the same suffix.  For x32 glibc,

 [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1

vs

 [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1

It reduces the .strtab size by 17547 bytes, about 16%.

bfd/

PR gas/18451
* elf-bfd.h (elf_sym_strtab): New.
(elf_link_hash_table): Add strtabcount, strtabsize and
strtab.
(_bfd_elf_stringtab_init): Removed.
* elf.c (_bfd_elf_stringtab_init): Removed.
(_bfd_elf_compute_section_file_positions): Replace
bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/
_bfd_stringtab_size with
elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/
_bfd_elf_strtab_size.  Use _bfd_elf_strtab_add,
_bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get
st_name.
(swap_out_syms): Likewise.
* elflink.c (elf_final_link_info): Replace bfd_strtab_hash
with elf_strtab_hash.  Remove symbuf, symbuf_count,
symbuf_size and shndxbuf_size.
(elf_link_flush_output_syms): Removed.
(elf_link_output_sym): Renamed to ...
(elf_link_output_symstrtab): This.  Replace _bfd_stringtab_add
with _bfd_elf_strtab_add.  Don't flush symbols to the file nor
swap out symbols.
(elf_link_swap_symbols_out): New.
(elf_link_output_extsym): Replace elf_link_output_sym with
elf_link_output_symstrtab.
(elf_link_input_bfd): Likewise.
(elf_final_link_free): Replace _bfd_stringtab_free with
_bfd_elf_strtab_free.  Remove symbuf.
(bfd_elf_final_link): Replace _bfd_elf_stringtab_init with
_bfd_elf_strtab_init.  Don't set symbuf, symbuf_count,
symbuf_size nor shndxbuf_size.  Initialize strtabsize and
strtab.  Initialize symshndxbuf to -1 when number of sections
>= 64K.  Replace elf_link_output_sym/elf_link_output_sym with
elf_link_output_symstrtab/elf_link_output_symstrtab. Don't
call elf_link_flush_output_syms.  Call _bfd_elf_strtab_finalize
and elf_link_swap_symbols_out.  Replace _bfd_stringtab_size
and _bfd_stringtab_emit with _bfd_elf_strtab_size and
_bfd_elf_strtab_emit.

gas/testsuite/

PR gas/18451
* gas/elf/elf.exp: Run strtab.
* gas/elf/strtab.d: New file.
* gas/elf/strtab.s: Likewise.

ld/testsuite/

PR gas/18451
* ld-elf/strtab.d: New file.
* ld-elf/strtab.s: Likewise.

9 years agoCorrectly notice empty sysroots in solib_find_1
Gary Benson [Thu, 25 Jun 2015 08:54:12 +0000 (09:54 +0100)]
Correctly notice empty sysroots in solib_find_1

Some parts of solib_find_1 should only operate if the sysroot
is nonempty after processing, but the logic that checked this
happened before trailing slashes were stripped so empty but
non-NULL sysroots were possible.  This commit moves the logic
so it correctly notices all empty sysroots.

gdb/ChangeLog:

* solib.c (solib_find_1): Set local variable sysroot to NULL if
it is the empty string after trailing slashes have been stripped.

9 years agoRemove gdb_sysroot NULL checks
Gary Benson [Wed, 24 Jun 2015 15:06:49 +0000 (16:06 +0100)]
Remove gdb_sysroot NULL checks

Since fed040c6a50399617d8265cbddc7fd21b3f134ef gdb_sysroot is
never NULL.  This commit removes all gdb_sysroot NULL checks.

gdb/ChangeLog:

* exec.c (exec_file_locate_attach): Remove gdb_sysroot NULL check.
* infrun.c (follow_exec): Likewise.
* remote.c (remote_filesystem_is_local): Likewise.
* solib.c (solib_find_1): Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Jun 2015 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRemove the extra @section .cfi_lsda
H.J. Lu [Wed, 24 Jun 2015 22:27:44 +0000 (15:27 -0700)]
Remove the extra @section .cfi_lsda

Commit 2f0c68f23bb3132cd5ac466ca8775c0d9e4960cd added an extra @section
.cfi_lsda:

 @subsection @code{.cfi_lsda @var{encoding} [, @var{exp}]}
+@section @code{.cfi_lsda @var{encoding} [, @var{exp}]}
 @code{.cfi_lsda} defines LSDA and its encoding.

It shouldn't be there.

* doc/as.texinfo (.cfi_lsda): Remove the extra @section.

9 years agoSilence older GCC warning
H.J. Lu [Wed, 24 Jun 2015 21:12:15 +0000 (14:12 -0700)]
Silence older GCC warning

* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older
GCC warning.

9 years agoFix lrealpath memory leak in build_id_to_debug_bfd
Keith Seitz [Thu, 4 Jun 2015 17:13:50 +0000 (10:13 -0700)]
Fix lrealpath memory leak in build_id_to_debug_bfd

Valgrind reports memory leaking from build_id_to_debug_bfd:
==7261== 88 bytes in 2 blocks are definitely lost in loss record 31,319 of 35,132
==7261==    at 0x4A06BCF: malloc (vg_replace_malloc.c:296)
==7261==    by 0x32CA88A9B9: strdup (strdup.c:42)
==7261==    by 0xFE62AB: lrealpath (lrealpath.c:88)
==7261==    by 0x7F7AD6: build_id_to_debug_bfd (build-id.c:116)
==7261==    by 0x7F7BB5: find_separate_debug_file_by_buildid (build-id.c:149)
==7261==    by 0x6D9382: elf_symfile_read (elfread.c:1348)
==7261==    by 0x777F02: read_symbols (symfile.c:875)
==7261==    by 0x778505: syms_from_objfile_1 (symfile.c:1078)
==7261==    by 0x778548: syms_from_objfile (symfile.c:1094)
==7261==    by 0x778746: symbol_file_add_with_addrs (symfile.c:1191)
==7261==    by 0x77893B: symbol_file_add_from_bfd (symfile.c:1280)
==7261==    by 0x8E51E3: solib_read_symbols (solib.c:706)
==7261==    by 0x8E58AF: solib_add (solib.c:1029)

This occurs because commit 1be5090b in bfd, addressing PR 11983, started
taking a copy of the input filename instead of directly caching it.  It
appears that this code was never updated to reflect that API change.

This simple patch creates a cleanup to free the return value for lrealpath.

gdb/ChangeLog

* build-id.c (build_id_to_debug_bfd): Add cleanup to free
return value from lrealpath.

9 years agoKeep .plt section and DT_PLTGOT for prelink
H.J. Lu [Wed, 24 Jun 2015 20:37:05 +0000 (13:37 -0700)]
Keep .plt section and DT_PLTGOT for prelink

Since the .plt section and DT_PLTGOT are used by prelink to undo
prelinking for dynamic relocations, we must keep them even if there is
no PLT relocation.  This patch reverted commit a3747075a.

bfd/

* elf32-i386.c (elf_i386_allocate_dynrelocs): Always allocate
space for the first .plt entry.
(elf_i386_size_dynamic_sections): Always add DT_PLTGOT for .plt
section.  Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if
there are PLT relocations.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Always
allocate space for the first .plt entry.
(elf_x86_64_size_dynamic_sections): Always add DT_PLTGOT for
.plt section.  Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if
there are PLT relocations.

ld/testsuite/

* ld-i386/i386.exp: Run pltgot-2 for Linux targets.
* ld-x86-64/x86-64.exp: Likewise.
* ld-i386/pltgot-1.d: Updated.
* ld-x86-64/pltgot-1.d: Likewise.
* ld-i386/pltgot-2.d: New file.
* ld-x86-64/pltgot-2.d: Likewise.

9 years agoSync libiberty from GCC, replaying updates to configure scripts
Iain Buclaw [Wed, 24 Jun 2015 19:43:02 +0000 (21:43 +0200)]
Sync libiberty from GCC, replaying updates to configure scripts

9 years agoDon't convert R_X86_64_GOTPCREL if it will overflow
H.J. Lu [Wed, 24 Jun 2015 17:13:55 +0000 (10:13 -0700)]
Don't convert R_X86_64_GOTPCREL if it will overflow

When converting "mov foo@GOTPCREL(%rip), %reg" to "lea foo(%rip), %reg"
with R_X86_64_PC32 relocation, it may overflow if the target section
is more than 2GB away.  This patch estimates distance between mov
instruction and the target section.  We convert R_X86_64_GOTPCREL to
R_X86_64_PC32 only if their distance is less than 2GB.

PR ld/18591
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Don't convert
R_X86_64_GOTPCREL to R_X86_64_PC32 if it will cause relocation
overflow.

9 years agosim: trace: drop unused trace_one_insn
Mike Frysinger [Wed, 24 Jun 2015 15:09:07 +0000 (22:09 +0700)]
sim: trace: drop unused trace_one_insn

Everyone has migrated to the split functions (trace_prefix + trace_generic)
a while ago, so we can drop this one now.

9 years agosim: trace: rename debug_printf fully
Mike Frysinger [Wed, 24 Jun 2015 14:59:26 +0000 (21:59 +0700)]
sim: trace: rename debug_printf fully

Rather than redirect using a define, just rename the symbol fully.