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.
GDB Administrator [Thu, 25 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
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.
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.
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.
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.
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>
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>
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.
GDB Administrator [Wed, 24 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Bharathi Seshadri [Tue, 23 Aug 2016 21:50:48 +0000 (14:50 -0700)]
Add --be8 option to gold.
gold/
* options.h (General_options): Add --be8 option.
* arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
(Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
(Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
(Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
(Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
Simon Marchi [Tue, 23 Aug 2016 17:49:56 +0000 (13:49 -0400)]
Fix typo in comment
gdb/ChangeLog:
* stack.c (parse_frame_specification): Fix typo in comment.
Pedro Alves [Tue, 23 Aug 2016 15:03:28 +0000 (16:03 +0100)]
Fix PR20494 - User input stops being echoed in CLI
This patch fixes a problem that problem triggers if you start an
inferior, e.g., with the "start" command, in a UI created with the
new-ui command, and then run a foreground execution command in the
main UI. Once the program stops for the latter command, typing in the
main UI no longer echoes back to the user.
The problem revolves around this:
- gdb_has_a_terminal computes its result lazily, on first call.
that is what saves gdb's initial main UI terminal state (the UI
associated with stdin):
our_terminal_info.ttystate = serial_get_tty_state (stdin_serial);
This is the state that target_terminal_ours() restores.
- In this scenario, the gdb_has_a_terminal function happens to be
first ever called from within the target_terminal_init call in
startup_inferior:
(top-gdb) bt
#0 gdb_has_a_terminal () at src/gdb/inflow.c:157
#1 0x000000000079db22 in child_terminal_init_with_pgrp () at src/gdb/inflow.c:217
[...]
#4 0x000000000065bacb in target_terminal_init () at src/gdb/target.c:456
#5 0x00000000004676d2 in startup_inferior () at src/gdb/fork-child.c:531
[...]
#7 0x000000000046b168 in linux_nat_create_inferior () at src/gdb/linux-nat.c:1112
[...]
#9 0x00000000005f20c9 in start_command (args=0x0, from_tty=1) at src/gdb/infcmd.c:657
If the command to start the inferior is issued on the main UI, then
readline will have deprepped the terminal when we reach the above, and
the problem doesn't appear.
If however the command is issued on a non-main UI, then when we reach
that gdb_has_a_terminal call, the main UI's terminal state is still
set to whatever readline has sets it to in rl_prep_terminal, which
happens to have echo disabled. Later, when the following synchronous
execution command finishes, we'll call target_terminal_ours to restore
gdb's the main UI's terminal settings, and that restores the terminal
state with echo disabled...
Conceptually, the fix is to move the gdb_has_a_terminal call earlier,
to someplace during GDB initialization, before readline/ncurses have
had a chance to change terminal settings. Turns out that
"set_initial_gdb_ttystate" is exactly such a place.
I say conceptually, because the fix actually inlines the
gdb_has_a_terminal part that saves the terminal state in
set_initial_gdb_ttystate and then simplifies gdb_has_a_terminal, since
there's no point in making gdb_has_a_terminal do lazy computation.
gdb/ChangeLog:
2016-08-23 Pedro Alves <palves@redhat.com>
PR gdb/20494
* inflow.c (our_terminal_info, initial_gdb_ttystate): Update
comments.
(enum gdb_has_a_terminal_flag_enum, gdb_has_a_terminal_flag):
Delete.
(set_initial_gdb_ttystate): Record our_terminal_info here too,
instead of ...
(gdb_has_a_terminal): ... here. Reimplement in terms of
initial_gdb_ttystate. Make static.
* terminal.h (gdb_has_a_terminal): Delete declaration.
(set_initial_gdb_ttystate): Add comment.
* top.c (show_interactive_mode): Use input_interactive_p instead
of gdb_has_a_terminal.
gdb/testsuite/ChangeLog:
2016-08-23 Pedro Alves <palves@redhat.com>
PR gdb/20494
* gdb.base/new-ui-echo.c: New file.
* gdb.base/new-ui-echo.exp: New file.
Nick Clifton [Tue, 23 Aug 2016 14:41:01 +0000 (15:41 +0100)]
Better fix for PR 20499, including preventing strlen from being called on an uninitialised name field.
PR gprof/20499
* corefile.c (BUFSIZE): Define.
(STR_BUFSIZE): Define.
(read_function_mappings): Use BUFSIZE and STR)BUFSIZE.
(num_of_syms_in): Move buf, address and name arrays out of
function and declare as static BUFSIZE arrays.
Use STR_BUFSIZE when scanning for name and address.
(core_create_syms_from): Revert previous delta. Instead
short circuit the parsing of a symbol if all three fields
could not be found.
Yao Qi [Tue, 23 Aug 2016 13:24:03 +0000 (14:24 +0100)]
gdbserver_spawn "" rather than gdbserver_spawn ${binfile}
Hi,
I happen to see gdbserver is spawned like this in gdb.log,
spawn /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2346 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.s
erver/connect-stopped-target/connect-stopped-target /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/connect-stopped-target/connect-stopped-t
arget
spawn /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.s
erver/connect-stopped-target/connect-stopped-target /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/connect-stopped-target/connect-stopped-t
arget
as we can see, there are two instances of connect-stopped-target or
connect-stopped-target in the command line spawning gdbserver, but
none of these gets parameters from command line. In these two
tests, gdbserver is spawned via "gdbserver_spawn ${binfile}". However,
the argument of gdbserver_spawn is the argument passed the child
inferior, not the program itself.
# Start a gdbserver process running SERVER_EXEC, and connect GDB
# to it. CHILD_ARGS are passed to the inferior.
#
# Returns the target protocol and socket to connect to.
proc gdbserver_spawn { child_args } {
set target_exec [gdbserver_download_current_prog]
GDBserver gets the program via last_loaded_file, which is set by
gdb_file_cmd. In each test, we don't need to pass ${binfile}.
gdb/testsuite:
2016-08-23 Yao Qi <yao.qi@linaro.org>
* gdb.server/connect-stopped-target.exp (do_test): Pass "" to
gdbserver_spawn.
* gdb.server/connect-without-multi-process.exp (do_test):
Likewise.
Yao Qi [Tue, 23 Aug 2016 13:15:50 +0000 (14:15 +0100)]
Fix signals-state-child.exp in remote testing
Remote testing isn't considered in signals-state-child.exp, so the it
fails like
shell diff -s /scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/testsuite/outputs/gdb.base/signals-state-child/standalone.txt /scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/testsuite/outputs/gdb.base/signals-state-child/gdb.txt^M
diff: /scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/testsuite/outputs/gdb.base/signals-state-child/standalone.txt: No such file or directory^M
(gdb) FAIL: gdb.base/signals-state-child.exp: signals states are identical
This patch is to fix it.
gdb/testsuite:
2016-08-23 Yao Qi <yao.qi@linaro.org>
* gdb.base/signals-state-child.exp: Set variables gdb_txt and
standalone_txt. Delete gdb_txt and standalone_txt on host
and target. Spawn the binary on target. Copy files from
target to host.
Nick Clifton [Tue, 23 Aug 2016 08:45:11 +0000 (09:45 +0100)]
Fix seg-fault in ARM linker when trying to parse a binary file.
* elf32-arm.c (elf32_arm_count_additional_relocs): Return zero if
there is no arm data associated with the section.
Richard Sandiford [Tue, 23 Aug 2016 08:03:19 +0000 (09:03 +0100)]
[AArch64] Add V8_2_INSN macro
For consistency with the previous two patches, this one
adds a macro for the two ARMv8.2 table entries. Both table
entries need a non-null aarch64_op field.
I haven't added macros for the RAS and STAT_PROFILE entries
since there's only one of each. The series isn't getting
rid of braced entries altogether, so I've only looked at
replacing things that occur more than once.
opcodes/
* aarch64-tbl.h (V8_2_INSN): New macro.
(aarch64_opcode_table): Use it.
Richard Sandiford [Tue, 23 Aug 2016 08:02:38 +0000 (09:02 +0100)]
[AArch64] Make more use of CORE/FP/SIMD_INSN
After the previous patch, this one makes all CORE, FP
and SIMD table entries with null "verify" fields use
the associated macros.
opcodes/
* aarch64-tbl.h (aarch64_opcode_table): Make more use of
CORE_INSN, __FP_INSN and SIMD_INSN.
Richard Sandiford [Tue, 23 Aug 2016 08:01:54 +0000 (09:01 +0100)]
[AArch64] Add OP parameter to aarch64-tbl.h macros
Nick recently wrapped most of aarch64-tbl.h entries in macros
like CORE_INSN. These new macros assumed that the aarch64_op
"op" field of aarch64_opcode is 0 and that the new "verifier"
field is NULL.
However, there are a lot of CORE, SIMD and FP insns whose table
entries need a nonzero aarch64_op field, so these entries
continued to use a braced list instead of a macro. This makes
the table entries less consistent and means that there are still
quite a few braced entries that need to be updated when making
further changes to the aarch64_opcode structure.
I think the number of entries that need a nonzero aarch64_op
field is high enough to justify having an explicit aarch64_op
entry for all CORE, SIMD and FP entries. This patch adds
one and updates all existing uses of the macros. A following
patch makes more use of the macros.
I've followed existing practice by using 0 instead of OP_NIL
for empty aarch64_op fields. Empty fields are still the norm
and you need to know what the fields are when reading the table
anyway, so it was hard to justify an additional patch to replace
all 0 op fields with OP_NIL.
opcodes/
* aarch64-tbl.h (CORE_INSN, __FP_INSN, SIMD_INSN): Add OP parameter.
(aarch64_opcode_table): Update uses accordingly.
Alan Modra [Tue, 23 Aug 2016 02:52:25 +0000 (12:22 +0930)]
Fix duplicate FAILs from ld testsuite
* testsuite/lib/ld-lib.exp (run_cc_link_tests): Don't fail tests
twice.
Alan Modra [Tue, 23 Aug 2016 02:50:59 +0000 (12:20 +0930)]
R_OR1K_GOTOFF_* relocations
PR 20475
* elf32-or1k.c (or1k_elf_relocate_section): Offset from
_GLOBAL_OFFSET_TABLE_, not start of .got section.
GDB Administrator [Tue, 23 Aug 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Mon, 22 Aug 2016 19:05:09 +0000 (20:05 +0100)]
Fix PR gdb/20505 - Make vDSO detection work with core files
Loading a core dump that was either generated on a system running
pristine glibc master, or on a Fedora/RHEL system with LD_DEBUG=unused
set in the environment, solib-svr4.c:svr4_current_sos fails to filter
out the vDSO, resulting in:
(gdb) core-file corefile.core^M
[New LWP 2362]^M
warning: Could not load shared library symbols for linux-vdso.so.1.^M
Do you need "set solib-search-path" or "set sysroot"?^M
Core was generated by `build-gdb/gdb/testsuite/outputs/gdb.base/corefile/'.^M
...
The problem is that gdbarch_vsyscall_range does not support core
inferiors at all.
When live debugging, we're finding the vDSO's start address with
auxv/AT_SYSINFO_EHDR, and then we find the vDSO's size by look for the
corresponding mapping, by parsing /proc/PID/maps. When debugging a
core dump, we can also determine the starting address from
auxv/AT_SYSINFO_EHDR. However, we obviously can't read the core
mappings out of the host's /proc. But we can instead look for a
corresponding load segment in the core's bfd.
gdb/ChangeLog:
2016-08-22 Pedro Alves <palves@redhat.com>
PR gdb/20505
* linux-tdep.c (linux_vsyscall_range_raw): For core inferiors,
find the vDSO's start address with AT_SYSINFO_EHDR too, and
determine the vDSO's size by finding the PT_LOAD segment that
matches AT_SYSINFO_EHDR.
gdb/testsuite/ChangeLog:
2016-08-22 Pedro Alves <palves@redhat.com>
PR gdb/20505
* gdb.base/vdso-warning.exp: Test core dumps too. Use
with_test_prefix. Factor out bits to ...
(test_no_vdso): ... this new procedure.
Nick Clifton [Mon, 22 Aug 2016 13:23:19 +0000 (14:23 +0100)]
Free the string buffer used by the chew program to hold each file it parses.
* doc/chew.c (main): Free the string buffer used to files as they
are parsed.
Nick Clifton [Mon, 22 Aug 2016 13:16:26 +0000 (14:16 +0100)]
Prevent a seg-fault in gprof when parsing a corrupt core file.
PR gprof/20499
* corefile.c (core_create_syms_from): Avoid walking off the end of
the symbol table.
Alan Modra [Mon, 22 Aug 2016 01:12:26 +0000 (10:42 +0930)]
Error on unsupported PowerPC ifuncs
The pr19784 tests fail on ppc32 due to a gcc bug. The failure should
be noticed when building both libpr19784a.so and libpr19784b.so,
rather than ld building a buggy libpr19784a.so that fails at run time.
This patch fixes that by moving the @local ifunc check out of
check_relocs, where a call destination may not yet be known to be
ifunc. The patch also adds a related error for -mbss-plt code.
* elf32-ppc.c (ppc_elf_check_relocs): Move error for @local ifunc..
(ppc_elf_relocate_section): ..to here. Comment. Error on
detecting -mbss-plt -fPIC local ifuncs too.
(ppc_elf_size_dynamic_sections): Comment on unnecessary glink
branch table entries.
GDB Administrator [Mon, 22 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 21 Aug 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 20 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Carl E. Love [Fri, 19 Aug 2016 18:06:38 +0000 (11:06 -0700)]
Fix missing files for ld when test suite not compiled in the source directory
This patch fixes an issues with six test suite expect files that do not
run correctly when the test suite is not built in the source directory. The
issue is these tests are not using the current "standard_testfile" call
but rather using the older set command to initialize the "testfile",
"srcfile" and "binprefix" variables or are missing the set for the
"binprefix" variable.
-----------------------------------------------
gdb/testsuite/ChangeLog
2016-08-19 Carl Love <cel@us.ibm.com>
* gdb.arch/altivec-regs.exp: Use standard_testfile instead of
maintaining separate logic for constructing the output path.
* gdb.arch/powerpc-d128-regs.exp: Likewise.
* gdb.arch/ppc-dfp.exp: Likewise.
* gdb.arch/ppc-fp.exp: Likewise.
* gdb.arch/vsx-regs.exp: Likewise.
* gdb.arch/altivec-abi.exp: Likewise, plus added local variable
binprefix for generating the additional binary files.
Yao Qi [Fri, 19 Aug 2016 13:49:31 +0000 (14:49 +0100)]
[AArch64] Match instruction "STP with base register" in prologue
Nowadays, we only match pre-indexed STP in prologue. Due to the change
in gcc, https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01933.html, it
may generate "STP with base register" in prologue, which GDB doesn't
handle. That is to say, previously GCC generates prologue like this,
sub sp, sp, #490
stp x29, x30, [sp, #-96]!
mov x29, sp
with the gcc patch above, GCC generates prologue like like this,
sub sp, sp, #4f0
stp x29, x30, [sp]
mov x29, sp
This patch is to teach GDB to recognize this instruction in prologue
analysis.
gdb:
2016-08-19 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_analyze_prologue): Handle register
based STP instruction.
Yao Qi [Thu, 11 Aug 2016 16:04:11 +0000 (17:04 +0100)]
null-terminate string in linespec_location_completer
If I build gdb with -fsanitize=address and run tests, I get error,
malformed linespec error: unexpected colon^M
(gdb) PASS: gdb.linespec/ls-errs.exp: lang=C: break :
break :=================================================================^M
==3266==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000051451 at pc 0x2b5797a972a8 bp 0x7fffd8e0f3c0 sp 0x7fffd8e0f398^M
READ of size 2 at 0x602000051451 thread T0
#0 0x2b5797a972a7 in __interceptor_strlen (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x322a7)^M
#1 0x7bd004 in compare_filenames_for_search(char const*, char const*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:316^M
#2 0x7bd310 in iterate_over_some_symtabs(char const*, char const*, int (*)(symtab*, void*), void*, compunit_symtab*, compunit_symtab*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:411^M
#3 0x7bd775 in iterate_over_symtabs(char const*, int (*)(symtab*, void*), void*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:481^M
#4 0x7bda15 in lookup_symtab(char const*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:527^M
#5 0x7d5e2a in make_file_symbol_completion_list_1 /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:5635^M
#6 0x7d61e1 in make_file_symbol_completion_list(char const*, char const*, char const*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:5684^M
#7 0x88dc06 in linespec_location_completer /home/yao/SourceCode/gnu/gdb/git/gdb/completer.c:288
....
0x602000051451 is located 0 bytes to the right of 1-byte region [0x602000051450,0x602000051451)^M
mallocated by thread T0 here:
#0 0x2b5797ab97ef in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x547ef)^M
#1 0xbbfb8d in xmalloc /home/yao/SourceCode/gnu/gdb/git/gdb/common/common-utils.c:43^M
#2 0x88dabd in linespec_location_completer /home/yao/SourceCode/gnu/gdb/git/gdb/completer.c:273^M
#3 0x88e5ef in location_completer(cmd_list_element*, char const*, char const*) /home/yao/SourceCode/gnu/gdb/git/gdb/completer.c:531^M
#4 0x8902e7 in complete_line_internal /home/yao/SourceCode/gnu/gdb/git/gdb/completer.c:964^
The code in question is here
file_to_match = (char *) xmalloc (colon - text + 1);
strncpy (file_to_match, text, colon - text + 1);
it is likely that file_to_match is not null-terminated. The patch is
to strncpy 'colon - text' bytes and explicitly set '\0'.
gdb:
2016-08-19 Yao Qi <yao.qi@linaro.org>
* completer.c (linespec_location_completer): Make file_to_match
null-terminated.
Tamar Christina [Fri, 19 Aug 2016 11:57:20 +0000 (12:57 +0100)]
ARM: Issue a warning when the MRRC and MRRC2 instructions are used with the same destination registers.
* config/tc-arm.c (do_co_reg2c): Added constraint.
* testsuite/gas/arm/dest-unpredictable.s: New.
* testsuite/gas/arm/dest-unpredictable.l: New.
* testsuite/gas/arm/dest-unpredictable.d: New.
Pedro Alves [Fri, 19 Aug 2016 11:07:46 +0000 (12:07 +0100)]
x32: Fix gdb.trace/mi-trace-frame-collected.exp
gdb.trace/mi-trace-frame-collected.exp has a couple failures on x32:
FAIL: gdb.trace/mi-trace-frame-collected.exp: live: -trace-frame-collected (register)
FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile: -trace-frame-collected (register)
gdb.log:
-trace-frame-collected
^done,explicit-variables=[{name="gdb_char_test",value="0 '\\000'"}],computed-expressions=[],registers=[{number="16",value="0x4004dc"},{number="204",value="0x4004dc"}],tvars
=[],memory=[{address="0x00601060",length="1"}]
(gdb)
FAIL: gdb.trace/mi-trace-frame-collected.exp: live: -trace-frame-collected (register)
[...]
-trace-frame-collected
^done,explicit-variables=[{name="gdb_char_test",value="0 '\\000'"}],computed-expressions=[],registers=[{number="16",value="0x4004dc"},{number="204",value="0x4004dc"}],tvars
=[],memory=[{address="0x00601060",length="1"}]
(gdb)
FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile: -trace-frame-collected (register)
This test only collects the PC, and thus expects to only see one
register in the output of -trace-frame-collected. However, while on
the 64-bit ABI gdb only exposes 64-bit $pc/$rip (register 16 above),
on x32, GDB exposes 32-bit $eip as well, as a pseudo-register
(register 204 above). Thus, collecting $pc/$rip automatically always
collects $eip as well.
gdb/testsuite/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* gdb.trace/mi-trace-frame-collected.exp
(test_trace_frame_collected): On x32, expect two registers.
Pedro Alves [Fri, 19 Aug 2016 11:07:46 +0000 (12:07 +0100)]
x32: gdb: Fix 'call' insn relocation with qRelocInsn
Running the fast tracepoints tests against x32 gdbserver exposes a
latent bug. E.g.,:
(gdb)
continue
Continuing.
Reading /media/sf_host-pedro/gdb/mygit/build-ubuntu-x32/gdb/testsuite/outputs/gdb.trace/change-loc/change-loc-2.sl from remote target...
Thread 1 "change-loc" received signal SIGSEGV, Segmentation fault.
func4 () at /home/pedro/gdb/src/gdb/testsuite/gdb.trace/change-loc.h:24
24 }
(gdb) FAIL: gdb.trace/change-loc.exp: 1 ftrace: continue to marker 2
The test sets a fast tracepoint on a shared library. On x32, shared
libraries end up loaded somewhere in the upper 2GB of the 4GB address
space x32 has access to. When gdbserver needs to copy an instruction
to execute it in the jump pad, it asks gdb to relocate/adjust it, with
the qRelocInsn packet. gdb converts "call" instructions into a "push
$<2GB-4GB addr> + jmp" sequence, however, the "pushq" instruction sign
extends its operand, so later when the called function returns, it
returns to an incorrectly sign-extended address. E.g.,
0xfffffffffabc0000 instead of 0xfabc0000, resulting in the
segmentation fault.
Fix this by converting calls at such addresses to "sub + mov + jmp"
sequences instead.
gdb/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* amd64-tdep.c (amd64_relocate_instruction) <callq>: Handle return
addresses over 0x7fffffff.
Pedro Alves [Fri, 19 Aug 2016 11:07:45 +0000 (12:07 +0100)]
x32: gdbserver's agent bytecode JIT: fix "call" emission
Running fast tracepoint tests on x32 exposes a latent bug in the agent
bytecode jitting. There's a code path that forgets to emit the call
opcode... Whoops. Fixes a bunch of gdb.trace/trace-condition.exp
FAILs, like:
(gdb)
continue
Continuing.
Thread 1 "trace-condition" received signal SIGSEGV, Segmentation fault.
0x7ffec016 in ?? ()
(gdb) FAIL: gdb.trace/trace-condition.exp: ftrace: $rip == *set_point: advance through tracing
gdb/gdbserver/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* linux-x86-low.c (amd64_emit_call): Emit missing call opcode.
Pedro Alves [Fri, 19 Aug 2016 11:07:45 +0000 (12:07 +0100)]
x32: Avoid unsigned long when installing fast tracepoint jump pads
We're casting through unsigned long to write a 64-bit immediate
operand of movabs (the comment said movl, but that was incorrect).
The problem is that unsigned long is 32-bit on x32, so we were writing
fewer bytes than necessary.
Fix this by using an 8 byte memcpy like in other similar places in the
function.
gdb/gdbserver/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* linux-x86-low.c (amd64_install_fast_tracepoint_jump_pad): Fix
comment. Use memcpy instead of casting through unsigned long.
Pedro Alves [Fri, 19 Aug 2016 11:07:45 +0000 (12:07 +0100)]
x32 Fast tracepoints: Customize jump pad address
MAP_32BIT is ignored on x32, meaning the jump pad can end up somewhere
between 2GB and 4GB, too far away from the executable for 5-byte
relative jumps (JMP rel32). So on x32, try explicitly placing the
jump pad near the middle of the available address space.
gdb/gdbserver/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* linux-amd64-ipa.c (alloc_jump_pad_buffer) [__ILP32__]: Try
allocating around 0x80000000.
Pedro Alves [Fri, 19 Aug 2016 11:07:44 +0000 (12:07 +0100)]
x32 Fast tracepoints: IPA target descriptions
Building GDB for x32 fails building the IPA, with:
.../src/gdb/gdbserver/linux-amd64-ipa.c: In function ‘const target_desc* get_ipa_tdesc(int)’:
.../src/gdb/gdbserver/linux-amd64-ipa.c:182:14: error: ‘tdesc_amd64_avx_linux’ was not declared in this scope
return tdesc_amd64_avx_linux;
^
.../src/gdb/gdbserver/linux-amd64-ipa.c:184:14: error: ‘tdesc_amd64_mpx_linux’ was not declared in this scope
return tdesc_amd64_mpx_linux;
^
.../src/gdb/gdbserver/linux-amd64-ipa.c:186:14: error: ‘tdesc_amd64_avx_mpx_linux’ was not declared in this scope
return tdesc_amd64_avx_mpx_linux;
^
[...]
The problem is that the IPA is trying to use the 64-bit descriptions,
when it should be using the x32 ones.
gdb/gdbserver/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
PR gdb/20415
* Makefile.in (x32-linux-ipa.o, x32-avx-linux-ipa.o)
(x32-avx512-linux-ipa.o): New rules.
* configure.ac (x86_64-*-linux*): New x32 check.
* configure.srv (ipa_x32_linux_regobj): New.
(x86_64-*-linux*): Use $ipa_x32_linux_regobj if building for x32.
* linux-amd64-ipa.c (get_ipa_tdesc) [__ILP32__]: Return x32
descriptions.
(initialize_low_tracepoint) [__ILP32__]: Initialize x32
descriptions.
* configure: Regenerate.
Nick Clifton [Fri, 19 Aug 2016 08:27:52 +0000 (09:27 +0100)]
Enable relro by default for AArch64, ARM and SCORE.
ld * emultempl/aarch64elf.em (before_parse): Initialise the relro
field in the link_info structure.
* emultempl/armelf.em (before_parse): Likewise.
* emultempl/linux.em (before_parse): Likewise.
* emultempl/scoreelf.em (before_parse): Likewise.
Nick Clifton [Fri, 19 Aug 2016 08:16:30 +0000 (09:16 +0100)]
Place .shstrtab section after .symtab and .strtab, thus restoring monotonically increasing section offsets.
bfd
* elf.c (assign_section_numbers): Assign number for the .shstrtab
section after the symbol table and string table sections.
binutils
* testsuite/binutils-all/readelf.s: Adjust expected ordering of
sections.
* testsuite/binutils-all/readelf.s-64: Likewise.
gas
* testsuite/gas/i386/ilp32/x86-64-unwind.d: Adjust expected ordering
of sections.
* testsuite/gas/i386/x86-64-unwind.d: Likewise.
* testsuite/gas/ia64/alias-ilp32.d: Likewise.
* testsuite/gas/ia64/alias.d: Likewise.
* testsuite/gas/ia64/group-1.d: Likewise.
* testsuite/gas/ia64/group-2.d: Likewise.
* testsuite/gas/ia64/secname-ilp32.d: Likewise.
* testsuite/gas/ia64/secname.d: Likewise.
* testsuite/gas/ia64/unwind-ilp32.d: Likewise.
* testsuite/gas/ia64/unwind.d: Likewise.
* testsuite/gas/ia64/xdata-ilp32.d: Likewise.
* testsuite/gas/ia64/xdata.d: Likewise.
* testsuite/gas/mmix/bspec-1.d: Likewise.
* testsuite/gas/mmix/bspec-2.d: Likewise.
* testsuite/gas/mmix/byte-1.d: Likewise.
* testsuite/gas/mmix/loc-1.d: Likewise.
* testsuite/gas/mmix/loc-2.d: Likewise.
* testsuite/gas/mmix/loc-3.d: Likewise.
* testsuite/gas/mmix/loc-4.d: Likewise.
* testsuite/gas/mmix/loc-5.d: Likewise.
* testsuite/gas/tic6x/scomm-directive-4.d: Likewise.
ld
* testsuite/ld-alpha/tlsbin.rd: Adjust expected ordering of sections.
* testsuite/ld-alpha/tlsbinr.rd: Likewise.
* testsuite/ld-alpha/tlspic.rd: Likewise.
* testsuite/ld-cris/libdso-2.d: Likewise.
* testsuite/ld-i386/nogot1.d: Likewise.
* testsuite/ld-i386/pr12718.d: Likewise.
* testsuite/ld-i386/pr12921.d: Likewise.
* testsuite/ld-i386/tlsbin-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbin.rd: Likewise.
* testsuite/ld-i386/tlsbin2-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbin2.rd: Likewise.
* testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbindesc.rd: Likewise.
* testsuite/ld-i386/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsdesc.rd: Likewise.
* testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsgdesc.rd: Likewise.
* testsuite/ld-i386/tlsnopic-nacl.rd: Likewise.
* testsuite/ld-i386/tlsnopic.rd: Likewise.
* testsuite/ld-i386/tlspic-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic.rd: Likewise.
* testsuite/ld-i386/tlspic2-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic2.rd: Likewise.
* testsuite/ld-ia64/tlsbin.rd: Likewise.
* testsuite/ld-ia64/tlspic.rd: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-10.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-50.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-60.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-70.d: Likewise.
* testsuite/ld-mmix/bspec1.d: Likewise.
* testsuite/ld-mmix/bspec2.d: Likewise.
* testsuite/ld-mmix/local1.d: Likewise.
* testsuite/ld-mmix/local3.d: Likewise.
* testsuite/ld-mmix/local5.d: Likewise.
* testsuite/ld-mmix/local7.d: Likewise.
* testsuite/ld-mmix/undef-3.d: Likewise.
* testsuite/ld-powerpc/tlsexe.r: Likewise.
* testsuite/ld-powerpc/tlsexe32.r: Likewise.
* testsuite/ld-powerpc/tlsexetoc.r: Likewise.
* testsuite/ld-powerpc/tlsso.r: Likewise.
* testsuite/ld-powerpc/tlsso32.r: Likewise.
* testsuite/ld-powerpc/tlstocso.r: Likewise.
* testsuite/ld-s390/tlsbin.rd: Likewise.
* testsuite/ld-s390/tlsbin_64.rd: Likewise.
* testsuite/ld-s390/tlspic.rd: Likewise.
* testsuite/ld-s390/tlspic_64.rd: Likewise.
* testsuite/ld-sh/sh64/crange1.rd: Likewise.
* testsuite/ld-sh/sh64/crange2.rd: Likewise.
* testsuite/ld-sh/sh64/crange3-cmpct.rd: Likewise.
* testsuite/ld-sh/sh64/crange3-media.rd: Likewise.
* testsuite/ld-sh/sh64/crange3.rd: Likewise.
* testsuite/ld-sh/sh64/crangerel1.rd: Likewise.
* testsuite/ld-sh/sh64/crangerel2.rd: Likewise.
* testsuite/ld-sh/tlsbin-2.d: Likewise.
* testsuite/ld-sh/tlspic-2.d: Likewise.
* testsuite/ld-sparc/gotop32.rd: Likewise.
* testsuite/ld-sparc/gotop64.rd: Likewise.
* testsuite/ld-sparc/tlssunbin32.rd: Likewise.
* testsuite/ld-sparc/tlssunbin64.rd: Likewise.
* testsuite/ld-sparc/tlssunnopic32.rd: Likewise.
* testsuite/ld-sparc/tlssunnopic64.rd: Likewise.
* testsuite/ld-sparc/tlssunpic32.rd: Likewise.
* testsuite/ld-sparc/tlssunpic64.rd: Likewise.
* testsuite/ld-tic6x/common.d: Likewise.
* testsuite/ld-tic6x/shlib-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
* testsuite/ld-x86-64/ilp32-4.d: Likewise.
* testsuite/ld-x86-64/nogot1.d: Likewise.
* testsuite/ld-x86-64/pr12718.d: Likewise.
* testsuite/ld-x86-64/pr12921.d: Likewise.
* testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise.
* testsuite/ld-x86-64/split-by-file.rd: Likewise.
* testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin.rd: Likewise.
* testsuite/ld-x86-64/tlsbin2-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin2.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc.rd: Likewise.
* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic.rd: Likewise.
* testsuite/ld-x86-64/tlspic2-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic2.rd: Likewise.
* testsuite/ld-xtensa/tlsbin.rd: Likewise.
* testsuite/ld-xtensa/tlspic.rd: Likewise.
Alan Modra [Fri, 19 Aug 2016 01:36:53 +0000 (11:06 +0930)]
PowerPC64, Don't copy weak symbol dyn_relocs to weakdef.
At the cost of an extra field in the symbol table hash entries, this
simplification to the relocate_section dynamic reloc test should help
maintainability.
* elf64-ppc.c (struct ppc_link_hash_entry): Add weakref.
(ppc64_elf_copy_indirect_symbol): Set weakref. Don't merge
dyn_relocs for weakdefs.
(alias_readonly_dynrelocs): New function.
(ppc64_elf_adjust_dynamic_symbol): Use alias_readonly_dynrelocs.
(ppc64_elf_relocate_section): Simplify condition under which
dyn_relocs are emitted.
Alan Modra [Fri, 19 Aug 2016 01:36:41 +0000 (11:06 +0930)]
PR 20472, PowerPC64 ifunc confusion
This patch fixes quite a lot of confusion in allocate_dynrelocs over
ifuncs. Function descriptors make ELFv1 quite different to ELFv2.
PR 20472
* elf64-ppc.c (ppc64_elf_before_check_relocs): Tweak abiversion test.
(readonly_dynrelocs): Comment fix.
(global_entry_stub): New function.
(ppc64_elf_adjust_dynamic_symbol): Tweak abiversion test. Match
ELFv2 code deciding on dynamic relocs vs. global entry stubs to
that in size_global_entry_stubs, handling ifunc too. Delete dead
weak sym code.
(allocate_dynrelocs): Ensure dyn_relocs field is cleared when no
dyn_relocs are needed. Correct handling of ifunc dyn_relocs.
Tidy ELIMINATE_COPY_RELOCS code, only setting dynindx for
undefweak syms. Expand and correct comments.
(size_global_entry_stubs): Ensure symbol is defined.
(ppc64_elf_relocate_section): Match condition under which
dyn_relocs are emitted to that in allocate_dynrelocs.
GDB Administrator [Fri, 19 Aug 2016 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in
Carl E. Love [Thu, 18 Aug 2016 21:36:36 +0000 (14:36 -0700)]
Add ChangeLog updates to my previous two commits
gdb/ChangeLog:
* MAINTAINERS (Write After Approval): Add "Carl Love".
gdb/testsuite/ChangeLog:
* gdb.arch/powerpc-power.s: Add new Power9 instruction tests
and sync up the test with tests in gas/testsuite/gas/ppc.
* gdb.arch/powerpc-power.exp: Likewise.
Carl Love [Thu, 19 May 2016 17:02:41 +0000 (13:02 -0400)]
Fix for powerpc-power.exp gdb regression test for Power 9
The GDB testsuite reports 5 test failures on Power 7 instructions.
Additionally the ppc test is missing the new Power 9 instructions as
well as a large number of older instructions. Additionally, some
instruction names have changed or been deleted. This patch
fixes the test failures and completely updates the test to make it
consistent with the supported Power 9 instructions listed in:
gas/testsuite/gas/ppc/power7.d
gas/testsuite/gas/ppc/power8.d
gas/testsuite/gas/ppc/power9.d
gas/testsuite/gas/ppc/altivec.d
gas/testsuite/gas/ppc/altivec2.d
gas/testsuite/gas/ppc/altivec3.d
gas/testsuite/gas/ppc/vsx.d
gas/testsuite/gas/ppc/vsx2.d
gas/testsuite/gas/ppc/vsx3.d
-----------------------------------------------------
gdb/testsuite/ChangeLog
2016-08-18 Carl Love <cel@us.ibm.com>
* gdb.arch/powerpc-power.s: Add new Power9 instruction tests
and sync up the test with tests in gas/testsuite/gas/ppc.
* gdb.arch/powerpc-power.exp: Likewise.
Carl E. Love [Thu, 18 Aug 2016 19:47:55 +0000 (12:47 -0700)]
Add myself as write-after-approval GDB maintainer.
gdb/ChangeLog:
* MAINTAINERS (Write After Approval): Add "Carl Love".
Edjunior Barbosa Machado [Thu, 18 Aug 2016 13:45:12 +0000 (10:45 -0300)]
ppc: Fix record of HTM instructions
The patch fixes the record support of Hardware Transactional Memory
instructions on Power. It also solves a large number of unexpected failures
from gdb.reverse testcases sigall-precsave.exp and sigall-reverse.exp that
occur on distros which glibc uses HTM instructions.
gdb/ChangeLog
2016-08-18 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* rs6000-tdep.c (ppc_process_record_op31): Handle HTM instructions.
Alan Modra [Thu, 18 Aug 2016 10:54:47 +0000 (20:24 +0930)]
Fix thinko in new weak undefined function test
* testsuite/ld-undefined/weak-undef.exp: Use unsupported not
unresolved.
GDB Administrator [Thu, 18 Aug 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 17 Aug 2016 20:02:27 +0000 (16:02 -0400)]
Fix remove-inferior error message
This error message should not contain the word symbol:
(gdb) remove-inferiors 1
Warning: Can not remove current symbol inferior 1.
gdb/ChangeLog:
* inferior.c (remove_inferior_command): Fix error message.
gdb/testsuite/ChangeLog:
* gdb.multi/remove-inferiors.exp (test_remove_inferiors): Fix
expected error message.
Simon Marchi [Wed, 17 Aug 2016 19:53:29 +0000 (15:53 -0400)]
Add remove-inferiors test
I noticed that the remove-inferiors command was not tested, and as I am
doing some changes related to the user selection, I want to make sure I
don't break it. For example, I want to make sure it's not possible to
remove the current inferior.
gdb/testsuite/ChangeLog:
* gdb.multi/remove-inferiors.exp: New file.
* gdb.multi/remove-inferiors.c: New file.
Cary Coutant [Wed, 17 Aug 2016 17:53:31 +0000 (10:53 -0700)]
Fix extraneous complaints about missing expected TLS relocation (i386).
Build the test objects with the in-tree assembler. Also fix some cascading
error messages caused by not resetting the skip_call_tls_get_addr_ flag
after printing the error.
gold/
* i386.cc (Target_i386): Reset skip_call_tls_get_addr_ after printing
error message.
* testsuite/Makefile.am (pr20216a): Add missing dependencies.
(pr20308a): Add -Bgcctestdir/ to compile rules.
* testsuite/Makefile.in: Regenerate.
Simon Marchi [Wed, 17 Aug 2016 14:26:37 +0000 (10:26 -0400)]
Remove stale comment
This comment seems outdated, since exiting an inferior does not remove
it.
gdb/ChangeLog:
* inferior.c (exit_inferior_1): Remove comment.
GDB Administrator [Wed, 17 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Mon, 15 Aug 2016 14:39:59 +0000 (07:39 -0700)]
sim: m68hc11: use standard STATIC_INLINE helper
Rather than redefine inline locally, use the common STATIC_INLINE.
GDB Administrator [Tue, 16 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Fri, 22 Jan 2016 03:17:59 +0000 (22:17 -0500)]
sim: unify symbol table handling
The common sim tracing code already handles loading and tracking of
symbols from the target program so that it can show symbol info in
trace/disassembly calls. Once we touch up the trace code and add a
few API callbacks, ports don't need to do loading and searching of
symbol tables themselves anymore.
Matthew Wahab [Mon, 15 Aug 2016 12:09:04 +0000 (13:09 +0100)]
[GDB] Fix builds broken by proc-service changes.
GLIBC BZ#20311 introduced a change to install proc_service.h so that gdb
didn't have to use the version it embeds in gdb_proc_service.h. The
embedded version is guarded by HAVE_PROC_SERVICE_H and
gdb_proc_service.h has a number other of includes and definitions, all
of which are uncondional except for an include for gregset.h. This is
only included if HAVE_PROC_SERIVCE_H is not defined.
This causes a build failure when cross compiling gdb with the latest
glibc because type definitions in gregset are used independently of
HAVE_PROC_SERIVCE_H. In particular, they are used in gdb_proc_service.h
when PRFPREGSET_T_BROKEN is set.
The error messages on the failure are
----
binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does
not name a type; did you mean ‘elf_fpregset_t’?
typedef gdb_fpregset_t gdb_prfpregset_t;
^~~~~~~~~~~~~~
elf_fpregset_t
binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does
not name a type; did you mean ‘elf_fpregset_t’?
typedef gdb_fpregset_t gdb_prfpregset_t;
^~~~~~~~~~~~~~
elf_fpregset_t
binutils-gdb/gdb/proc-service.c:218:15: error: ‘gdb_prfpregset_t’ does
not name a type; did you mean ‘gdb_fpregset_t’?
const gdb_prfpregset_t *fpregset)
^~~~~~~~~~~~~~~~
gdb_fpregset_t
----
This patch moves the include for gregset.h to before the code guarded by
HAVE_PROC_SERIVCE_H, so that it is always included. This is enough to
fix the build.
2016-08-15 Matthew Wahab <matthew.wahab@arm.com>
PR gdb/20457
* gdb_proc_service.h: Add an include of gregset.h
[!HAVE_PROC_SERVICE_H]: Remove the include of gregset.h.
Yao Qi [Mon, 15 Aug 2016 11:28:56 +0000 (12:28 +0100)]
Fix heap-buffer-overflow in explicit_location_lex_one
I build GDB with -fsanitize=address, and see the error in tests,
(gdb) PASS: gdb.linespec/ls-errs.exp: lang=C++: break 3 foo
break -line 3 foo^M
=================================================================^M
==4401==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000047487 at pc 0x819d8e bp 0x7fff4e4e6bb0 sp 0x7fff4e4e6ba8^M
READ of size 1 at 0x603000047487 thread T0^[[1m^[[0m^M
#0 0x819d8d in explicit_location_lex_one /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:502^M
#1 0x81a185 in string_to_explicit_location(char const**, language_defn const*, int) /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:556^M
#2 0x81ac10 in string_to_event_location(char**, language_defn const*) /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:687^
the code in question is:
> /* Special case: C++ operator,. */
> if (language->la_language == language_cplus
> && strncmp (*inp, "operator", 8) <--- [1]
> && (*inp)[9] == ',')
> (*inp) += 9;
> ++(*inp);
The error is caused by the access to (*inp)[9] if 9 is out of its bounds.
However [1] looks odd to me, because if strncmp returns true (non-zero),
the following check "(*inp)[9] == ','" makes no sense any more. I
suspect it was a typo in the code we meant to "strncmp () == 0". Another
problem in the code above is that if *inp is "operator,", we first
increment *inp by 9, and then increment it by one again, which is wrong
to me. We should only increment *inp by 8 to skip "operator", and go
back to the loop header to decide where we stop.
gdb:
2016-08-15 Yao Qi <yao.qi@linaro.org>
* location.c (explicit_location_lex_one): Compare the return
value of strncmp with zero. Don't check (*inp)[9]. Increment
*inp by 8.
GDB Administrator [Mon, 15 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 13 Aug 2016 15:44:24 +0000 (08:44 -0700)]
sim: m68hc11: standardize sim_cpu naming
We use "sim_cpu *cpu" in the sim code base, not "struct _sim_cpu" or
the name "proc", so clean up this sim to follow along.
Mike Frysinger [Sat, 13 Aug 2016 08:41:57 +0000 (01:41 -0700)]
sim: m68hc11: fix up various prototype related warnings
A few funcs are only used locally, so mark them static to avoid warnings
due to -Wmissing-prototypes.
Some funcs cast the return value wrong, so drop them (and let void * just
work by default).
Update some prototypes to be new style.
Mike Frysinger [Fri, 12 Aug 2016 14:11:26 +0000 (22:11 +0800)]
sim: cgen: constify mode_names
GDB Administrator [Sun, 14 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Fri, 22 Jan 2016 02:04:18 +0000 (21:04 -0500)]
sim: cgen: drop unused argv/envp definitions
The common argv/envp are used now by all ports, so drop this old
cgen fragment.
Mike Frysinger [Mon, 8 Aug 2016 05:06:49 +0000 (13:06 +0800)]
sim: bfin: split out common mach/model defines into arch.h [PR sim/20438]
The current machs.h mixes common enums with Blackfin-specific defines.
This causes us troubles with header inclusion order such that we can't
drop the old SIM_CPU typedef (which is duplicated in common code). By
splitting the two up, we can unwind this dependency chain, and drop the
old typedef. It also fixes building with older gcc versions.
GDB Administrator [Sat, 13 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Fri, 12 Aug 2016 19:36:20 +0000 (20:36 +0100)]
Warn if the sh_info field of a symbol table does not index the first non-local symbol in the section.
* readelf.c (process_symbol_table): Generate a warning if a local
symbol is found at and offste greater than or equal to the sh_info
field of it's section header.
Roland McGrath [Fri, 12 Aug 2016 16:55:25 +0000 (09:55 -0700)]
PR gold/20462: Fix bogus layout on ARM with linker script using PHDRS clause
gold/
PR gold/20462
* script-sections.cc (Script_sections::release_segments):
Reset this->segments_created_.
Roland McGrath [Fri, 12 Aug 2016 16:50:49 +0000 (09:50 -0700)]
[gold] Implement HIDDEN syntax in linker scripts
gold/
* yyscript.y (HIDDEN): New %token.
(assignment): Handle HIDDEN(string = expr) syntax.
* script.cc (script_keyword_parsecodes): Add HIDDEN.
Alan Modra [Fri, 12 Aug 2016 14:33:43 +0000 (00:03 +0930)]
Correct .dynsym sh_info
bfd/
* elf-bfd.h (struct elf_link_hash_table): Add local_dynsymcount.
* elflink.c (_bfd_elf_link_renumber_dynsyms): Set local_dynsymcount.
(bfd_elf_final_link): Set .dynsym sh_info from local_dynsymcount.
ld/
* testsuite/ld-tic6x/shlib-1.rd: Correct expected .dynsym sh_info.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
Nick Clifton [Fri, 12 Aug 2016 10:35:32 +0000 (11:35 +0100)]
Undo the previous change to the aarch64 sim - exporting aarch64_step() - and instead make aarch64_run correctly process sim events.
* simulator.c (aarch64_step): Revert pervious delta.
(aarch64_run): Call sim_events_tick after each
instruction is simulated, and if necessary call
sim_events_process.
* simulator.h: Revert previous delta.
Yao Qi [Fri, 12 Aug 2016 10:02:04 +0000 (11:02 +0100)]
Fix warning in gdb.base/signals-state-child.c
I see the following warning when running signals-state-child.exp.
gdb/testsuite/gdb.base/signals-state-child.c:77:4: warning: too many arguments for format [-Wformat-extra-args]
fprintf (out, "sigaction={sa_handler=", i);
^
this patch is to remove the argument from fprintf.
gdb/testsuite:
2016-08-12 Yao Qi <yao.qi@linaro.org>
* gdb.base/signals-state-child.c (main): Remove "i" from fprintf's
argument list.
Alan Modra [Fri, 12 Aug 2016 04:37:40 +0000 (14:07 +0930)]
Add undefined weak function tests
* testsuite/ld-undefined/weak-fundef.s: New.
* testsuite/ld-undefined/weak-undef.t: Don't specify filename.
* testsuite/ld-undefined/weak-undef.exp: Run new tests. Rearrange
much of old code. Use is_elf_format to select targets.
GDB Administrator [Fri, 12 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Thu, 11 Aug 2016 14:12:05 +0000 (23:42 +0930)]
Fix ERROR: target-cc does not exist
PR ld/20436
* testsuite/lib/ld-lib.exp (at_least_gcc_version): Don't ignore
remote_exec status.
(check_gcc_plugin_enabled): Likewise.
Nick Clifton [Thu, 11 Aug 2016 14:04:40 +0000 (15:04 +0100)]
Export the single step function from the AArch64 simulator.
* interp.c (sim_create_inferior): Allow for being called with a
NULL abfd parameter. If a bfd is provided, initialise the sim
with that start address.
* simulator.c (HALT_NYI): Just print out the numeric value of the
instruction when not tracing.
(aarch64_step): Change from static to global.
* simulator.h: Add a prototype for aarch64_step().
Pedro Alves [Thu, 11 Aug 2016 11:01:22 +0000 (12:01 +0100)]
Fix fallout from gdb/20413's fix (x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER)
Fixes, on NIOS GNU/Linux:
In file included from
/scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../nat/linux-ptrace.c:26:0:
/scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../gregset.h:27:23:
error: unknown type name 'gregset_t'
#define GDB_GREGSET_T gregset_t
^
Fix this by including sys/procfs.h directly. We shouldn't really be
including a gdb-only header in a gdb/nat/ file, anyway. Whoops.
gdb/ChangeLog:
2016-08-11 Pedro Alves <palves@redhat.com>
PR gdb/20413
* nat/linux-ptrace.c: Include <sys/procfs.h> instead of
"gregset.h".
Nick Clifton [Thu, 11 Aug 2016 09:22:41 +0000 (10:22 +0100)]
Avoid testsuite errors about missing compilers.
PR ld/20436
* testsuite/lib/ld-lib.exp (check_gcc_plugin_enabled): When not
testing remotely, check to see if target compiler is installed
before trying to run it.
Richard Sandiford [Thu, 11 Aug 2016 08:14:45 +0000 (09:14 +0100)]
[AArch64] Reject -0.0 as an 8-bit FP immediate
parse_aarch64_imm_float was accepting -0.0 even though that's not
a valid immediate for any instruction. The FPIMM0 caller rejected
it, but the FPIMM one would silently treat it as -2.0.
This patch rejects -0.0 and adds testcases to illegal.[sd].
Before the patch, the final error emitted for illegal.s was:
Error: cannot do 16-byte relocation
which was matched by:
[^:]*:569: Error: .*
The error was reported against the last line of the file rather than
the instruction that required the reloc. Adding more instructions
meant that the line number also changed.
Reporting against the wrong line isn't good from a QoI perspective
but isn't what I'm trying to fix here. Until it's fixed, I thought
it would be better to adjust the match to be against an end-of-file
comment rather than against whatever the last instruction happens to be.
gas/
* config/tc-aarch64.c (parse_aarch64_imm_float): Reject -0.0.
* testsuite/gas/aarch64/illegal.s, testsuite/gas/aarch64/illegal.l:
Add tests for -0.0. Add an end-of-file comment.
Alan Modra [Thu, 11 Aug 2016 03:00:52 +0000 (12:30 +0930)]
PowerPC64 ELFv1 undefined weak functions
Undefined weak functions, like __gmon_start__, were not being made
dynamic or emitting plt call code. While the behaviour of undefined
weak symbols is not defined in the ELF standard, the intention on
powerpc64 was to make it possible to link without a definition of such
symbols and at run time behave the same as if a definition was found
at link time in a shared library.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Don't exit with
non_got_ref true in any case where we could have generated dynbss
copies but decide not to do so.
GDB Administrator [Thu, 11 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 10 Aug 2016 23:52:06 +0000 (00:52 +0100)]
PR ld/15428: MIPS/LD/testsuite: Un-KFAIL `__ehdr_start' test 2
Complement commit
b75d42bce560 ("Fix mips segfault on GOT access of
absolute symbol") and unmark the `__ehdr_start' test 2 as known to fail
for the n32 and n64 ABIs, as with the change referred in place the
causing issue has been properly addressed and consequently the tests do
not fail anymore and neither are supposed to.
ld/
PR ld/15428
* testsuite/ld-mips-elf/mips-elf.exp: Un-KFAIL `__ehdr_start'
test 2.
Pedro Alves [Wed, 10 Aug 2016 22:03:29 +0000 (23:03 +0100)]
Fix PR gdb/19187 (process record over a fork causes internal error)
Right after a fork is detected, we detach breakpoints from the child
(detach_breakpoints), which calls into target_remove_breakpoint with
inferior_ptid pointing at the child process, but leaves the breakpoint
marked inserted (in the parent).
The problem is that record-full.c always deletes all knowledge of the
breakpoint. Then when we later really delete the breakpoint from the
parent, we fail the assertion, since the breakpoint is unexpectedly
not found in the record-full.c breakpoint table.
The fix is simply to not forget about the breakpoint if we're
detaching it from a fork child.
gdb/ChangeLog:
2016-08-10 Pedro Alves <palves@redhat.com>
PR gdb/19187
* record-full.c (record_full_remove_breakpoint): Don't remove the
breakpoint from the record_full_breakpoints VEC if we're detaching
the breakpoint from a fork child.
gdb/testsuite/ChangeLog:
2016-08-10 Pedro Alves <palves@redhat.com>
PR gdb/19187
* gdb.reverse/waitpid-reverse.exp: Add comment and remove
setup_kfails.
Pedro Alves [Wed, 10 Aug 2016 22:03:29 +0000 (23:03 +0100)]
Plumb enum remove_bp_reason all the way to target_remove_breakpoint
So the target knows whether we're detaching breakpoints.
Nothing uses the parameter in this patch yet.
gdb/ChangeLog:
2016-08-10 Pedro Alves <palves@redhat.com>
PR gdb/19187
* break-catch-sig.c (signal_catchpoint_remove_location): Adjust
interface.
* break-catch-syscall.c (remove_catch_syscall):
* breakpoint.c (enum remove_bp_reason): Moved to breakpoint.h.
(remove_breakpoint_1): Pass 'reason' down.
(remove_catch_fork, remove_catch_vfork, remove_catch_solib)
(remove_catch_exec, remove_watchpoint, remove_masked_watchpoint)
(base_breakpoint_remove_location, bkpt_remove_location)
(bkpt_probe_remove_location, bkpt_probe_remove_location): Adjust
interface.
* breakpoint.h (enum remove_bp_reason): Moved here from
breakpoint.c.
(struct breakpoint_ops) <remove_location>: Add 'reason' parameter.
* corelow.c (core_remove_breakpoint): New function.
(init_core_ops): Install it as to_remove_breakpoint method.
* exec.c (exec_remove_breakpoint): New function.
(init_exec_ops): Install it as to_remove_breakpoint method.
* mem-break.c (memory_remove_breakpoint): Adjust interface.
* record-btrace.c (record_btrace_remove_breakpoint): Adjust
interface.
* record-full.c (record_full_remove_breakpoint)
(record_full_core_remove_breakpoint): Adjust interface.
* remote.c (remote_remove_breakpoint): Adjust interface.
* target-debug.h (target_debug_print_enum_remove_bp_reason): New
macro.
* target-delegates.c: Regenerate.
* target.c (target_remove_breakpoint): Add 'reason' parameter.
* target.h (struct target_ops) <to_remove_breakpoint>: Add
'reason' parameter.
(target_remove_breakpoint, memory_remove_breakpoint): Add 'reason'
parameter.
Pedro Alves [Wed, 10 Aug 2016 22:03:29 +0000 (23:03 +0100)]
Introduce 'enum remove_bp_reason'
Makes the code more obvious.
gdb/ChangeLog:
2016-08-10 Pedro Alves <palves@redhat.com>
PR gdb/19187
* breakpoint.c (insertion_state_t): Delete.
(enum remove_bp_reason): New.
(detach_breakpoints, remove_breakpoint_1, remove_breakpoint):
Adjust to use enum remove_bp_reason instead of insertion_state_t.
Pedro Alves [Wed, 10 Aug 2016 22:03:28 +0000 (23:03 +0100)]
Simplify remove_breakpoint interface
All callers pass mark_uninserted, so there's no need for the 'is'
parameter.
gdb/ChangeLog:
2016-08-10 Pedro Alves <palves@redhat.com>
PR gdb/19187
* breakpoint.c (remove_breakpoint): Remove 'is' parameter and
always pass mark_uninserted to remove_breakpoint_1.
(insert_breakpoint_locations, remove_breakpoints)
(remove_breakpoints_pid, update_global_location_list): Update
callers.
Maciej W. Rozycki [Wed, 10 Aug 2016 21:10:30 +0000 (22:10 +0100)]
MIPS/LD/testsuite: Verify microMIPS LA25 stub generation
Repeat `PIC and non-PIC test 1' checks for microMIPS LA25 stubs,
covering code generation and stub symbol annotation.
ld/
* testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd: New
test.
* testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd: New
test.
* testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd: New test.
* testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd: New test.
* testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s: New test
source.
* testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s: New test
source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Maciej W. Rozycki [Wed, 10 Aug 2016 19:44:03 +0000 (20:44 +0100)]
MIPS/BFD: Actually produce short microMIPS LA25 stubs
For the case where a function which requires an LA25 stub is at the
beginning of a section we use a short sequence comprised of a LUI/ADDIU
instruction pair only and prepended to the associated function rather
than using a trailing jump to reach the function. This works by
checking for the offset into section of the function symbol being 0.
This is however never the case for microMIPS function symbols, which
have the ISA bit set. Consequently the short LA25 sequence is never
produced for microMIPS functions, like with the following example:
$ cat la25a.s
.abicalls
.global f1
.ent f1
f1:
.set noreorder
.cpload $25
.set reorder
.option pic0
jal f2
.option pic2
jr $31
.end f1
.global f2
.ent f2
f2:
jr $31
.end f2
$ cat la25b.s
.abicalls
.option pic0
.global __start
.ent __start
__start:
jal f1
jal f2
.end __start
$ as -mmicromips -32 -EB -o la25a.o la25a.s
$ as -mmicromips -32 -EB -o la25b.o la25b.s
$ ld -melf32btsmip -o la25 la25a.o la25b.o
$ objdump -d la25
la25: file format elf32-tradbigmips
Disassembly of section .text:
004000d0 <.pic.f2>:
4000d0: 41b9 0040 lui t9,0x40
4000d4: d420 0083 j 400106 <f2>
4000d8: 3339 0107 addiu t9,t9,263
4000dc: 0000 0000 nop
004000e0 <.pic.f1>:
4000e0: 41b9 0040 lui t9,0x40
4000e4: d420 0078 j 4000f0 <f1>
4000e8: 3339 00f1 addiu t9,t9,241
4000ec: 0000 0000 nop
004000f0 <f1>:
4000f0: 41bc 0002 lui gp,0x2
4000f4: 339c 801f addiu gp,gp,-32737
4000f8: 033c e150 addu gp,gp,t9
4000fc: f420 0083 jal 400106 <f2>
400100: 0000 0000 nop
400104: 45bf jrc ra
00400106 <f2>:
400106: 45bf jrc ra
...
00400110 <__start>:
400110: f420 0070 jal 4000e0 <.pic.f1>
400114: 0000 0000 nop
400118: f420 0068 jal 4000d0 <.pic.f2>
40011c: 0000 0000 nop
$
where `.pic.f1' could omit the trailing jump and the filler NOP and just
fall through to `f1'.
Correct the problem by masking out the ISA bit from microMIPS functions,
which fixes the earlier example:
$ objdump -d la25
la25: file format elf32-tradbigmips
Disassembly of section .text:
004000d0 <.pic.f2>:
4000d0: 41b9 0040 lui t9,0x40
4000d4: d420 0083 j 400106 <f2>
4000d8: 3339 0107 addiu t9,t9,263
...
004000e8 <.pic.f1>:
4000e8: 41b9 0040 lui t9,0x40
4000ec: 3339 00f1 addiu t9,t9,241
004000f0 <f1>:
4000f0: 41bc 0002 lui gp,0x2
4000f4: 339c 801f addiu gp,gp,-32737
4000f8: 033c e150 addu gp,gp,t9
4000fc: f420 0083 jal 400106 <f2>
400100: 0000 0000 nop
400104: 45bf jrc ra
00400106 <f2>:
400106: 45bf jrc ra
...
00400110 <__start>:
400110: f420 0074 jal 4000e8 <.pic.f1>
400114: 0000 0000 nop
400118: f420 0068 jal 4000d0 <.pic.f2>
40011c: 0000 0000 nop
$
There is no need to do anything for MIPS16 functions, because if any
LA25 stub has been generated for such a function, then it is only
required for an associated call thunk only, which is regular MIPS code
and the address of which, with the ISA bit clear, is returned by
`mips_elf_get_la25_target'.
This problem has been there since the beginning of microMIPS support:
commit
df58fc944dbc6d5efd8d3826241b64b6af22f447
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date: Sun Jul 24 14:20:15 2011 +0000
<https://sourceware.org/ml/binutils/2011-07/msg00198.html>, ("MIPS:
microMIPS ASE support").
bfd/
* elfxx-mips.c (mips_elf_add_la25_stub): Clear the ISA bit of
the stub address retrieved if associated with a microMIPS
function.
Maciej W. Rozycki [Wed, 10 Aug 2016 19:03:02 +0000 (20:03 +0100)]
MIPS/BFD: Add microMIPS annotation to LA25 stub symbols
Fix a problem with missing microMIPS symbol annotation with microMIPS
LA25 stub symbols. The consequence of the issue is these symbols appear
in the symbol table as regular MIPS symbols with the ISA bit set, as
shown with the example below:
$ cat la25a.s
.abicalls
.global f1
.ent f1
f1:
.set noreorder
.cpload $25
.set reorder
.option pic0
jal f2
.option pic2
jr $31
.end f1
.global f2
.ent f2
f2:
jr $31
.end f2
$ cat la25b.s
.abicalls
.option pic0
.global __start
.ent __start
__start:
jal f1
jal f2
.end __start
$ as -mmicromips -32 -EB -o la25a.o la25a.s
$ as -mmicromips -32 -EB -o la25b.o la25b.s
$ ld -melf32btsmip -o la25 la25a.o la25b.o
$ readelf -s la25
Symbol table '.symtab' contains 18 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
00400098 0 SECTION LOCAL DEFAULT 1
2:
004000b0 0 SECTION LOCAL DEFAULT 2
3:
004000d0 0 SECTION LOCAL DEFAULT 3
4:
00000000 0 SECTION LOCAL DEFAULT 4
5:
00000000 0 SECTION LOCAL DEFAULT 5
6:
00418110 0 NOTYPE LOCAL DEFAULT 3 _gp
7:
004000e1 16 FUNC LOCAL DEFAULT 3 .pic.f1
8:
004000d1 16 FUNC LOCAL DEFAULT 3 .pic.f2
9:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _fdata
10:
00400110 16 FUNC GLOBAL DEFAULT [MICROMIPS] 3 __start
11:
00400106 2 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f2
12:
004000d0 0 NOTYPE GLOBAL DEFAULT 3 _ftext
13:
00410120 0 NOTYPE GLOBAL DEFAULT 3 __bss_start
14:
004000f0 22 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f1
15:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _edata
16:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _end
17:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _fbss
$
where microMIPS annotation is missing for `.pic.f1' and `.pic.f2' even
though these stubs are associated with microMIPS functions `f1' and `f2'
respectively.
Add the missing annotation then, by copying it from the function symbol
an LA25 stub is associated with, correcting the example above:
$ readelf -s la25
Symbol table '.symtab' contains 18 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
00400098 0 SECTION LOCAL DEFAULT 1
2:
004000b0 0 SECTION LOCAL DEFAULT 2
3:
004000d0 0 SECTION LOCAL DEFAULT 3
4:
00000000 0 SECTION LOCAL DEFAULT 4
5:
00000000 0 SECTION LOCAL DEFAULT 5
6:
00418110 0 NOTYPE LOCAL DEFAULT 3 _gp
7:
004000e0 16 FUNC LOCAL DEFAULT [MICROMIPS] 3 .pic.f1
8:
004000d0 16 FUNC LOCAL DEFAULT [MICROMIPS] 3 .pic.f2
9:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _fdata
10:
00400110 16 FUNC GLOBAL DEFAULT [MICROMIPS] 3 __start
11:
00400106 2 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f2
12:
004000d0 0 NOTYPE GLOBAL DEFAULT 3 _ftext
13:
00410120 0 NOTYPE GLOBAL DEFAULT 3 __bss_start
14:
004000f0 22 FUNC GLOBAL DEFAULT [MICROMIPS] 3 f1
15:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _edata
16:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _end
17:
00410120 0 NOTYPE GLOBAL DEFAULT 3 _fbss
$
This problem has been there since the beginning of microMIPS support:
commit
df58fc944dbc6d5efd8d3826241b64b6af22f447
Author: Richard Sandiford <rdsandiford@googlemail.com>
Date: Sun Jul 24 14:20:15 2011 +0000
<https://sourceware.org/ml/binutils/2011-07/msg00198.html>, ("MIPS:
microMIPS ASE support").
bfd/
* elfxx-mips.c (mips_elf_create_stub_symbol): For a microMIPS
stub also add STO_MICROMIPS annotation.
Maciej W. Rozycki [Wed, 10 Aug 2016 11:43:18 +0000 (12:43 +0100)]
MIPS/BFD: Set the ISA bit in microMIPS LA25 stub references
Fix a linker regression introduced with commit
9d862524f6ae ("MIPS:
Verify the ISA mode and alignment of branch and jump targets") causing a
build failure in microMIPS glibc where the `zdump' tool fails to link:
.../timezone/zdump.o: In function `yeartot':
.../timezone/zdump.c:758:(.text+0x62): Jump to a non-instruction-aligned address
.../timezone/zdump.c:758:(.text+0x76): Jump to a non-instruction-aligned address
.../timezone/zdump.c:768:(.text+0x112): Jump to a non-instruction-aligned address
.../timezone/zdump.c:774:(.text+0x1b8): Jump to a non-instruction-aligned address
.../timezone/zdump.c:774:(.text+0x1cc): Jump to a non-instruction-aligned address
collect2: error: ld returned 1 exit status
make[2]: *** [.../timezone/zdump] Error 1
The cause of the failure is the stricter check introduced with the said
change for jump and branch targets tripping on the address of microMIPS
LA25 stubs. Despite being microMIPS code these stubs do not have the
ISA bit set throughout the relocation calculation process, because they
have their address set to the memory offset into the stub section they
are placed in.
The `mips_elf_la25_stub' structure does not carry ISA mode information,
but there is no need to extend it, because the ISA mode can be inferred
from the original symbol, which will have STO_MICROMIPS annotation, so
use that instead to set the ISA bit appropriately. Also only LA25 stubs
associated with microMIPS symbols need to have the ISA bit set, because
other LA25 stubs are made with regular MIPS code, even if associated
with a MIPS16 symbol (in which case they are needed by a call thunk only
rather than the MIPS16 function proper).
bfd/
* elfxx-mips.c (mips_elf_calculate_relocation): Set the ISA bit
in microMIPS LA25 stub references.
Руслан Ижбулатов [Wed, 10 Aug 2016 18:22:45 +0000 (19:22 +0100)]
Support setting thread names (MS-Windows)
This is done by catching an exception number 0x406d1388 (it has no
documented name, though MSDN dubs it "MS_VC_EXCEPTION" in one code
example), which is thrown by the program. The exception record
contains an ID of a thread and a name to give it.
This requires rolling back some changes in handle_exception(), which
now again returns more than two distinct values. The new
HANDLE_EXCEPTION_IGNORED value means that gdb should just continue,
without returning the thread ID up the stack (which would result in
further handling of the exception, which is not what we want).
gdb/ChangeLog:
2016-08-10 Руслан Ижбулатов <lrn1986@gmail.com>
Pedro Alves <palves@redhat.com>
* windows-nat.c (MS_VC_EXCEPTION): New define.
(handle_exception_result): New enum.
(windows_delete_thread): Free the thread's name.
(handle_exception): Handle MS_VC_EXCEPTION.
(get_windows_debug_event): Handle HANDLE_EXCEPTION_IGNORED.
(windows_thread_name): New function.
(windows_target): Install it as to_thread_name method.
* NEWS: Mention the thread naming support on MS-Windows.
Cary Coutant [Wed, 10 Aug 2016 17:57:42 +0000 (10:57 -0700)]
Fix extraneous complaints about missing expected TLS relocation.
With some versions of gas, the call to tls_get_addr uses a GOTPCREL
relocation instead of a GOTPCRELX relocation. We should allow for that
when skip_call_tls_get_addr_ is true. We should also build the test
objects with the in-tree assembler.
This patch also fixes some cascading error messages caused by not
resetting the skip_call_tls_get_addr_ flag after printing the error.
gold/
PR gold/20216
* x86_64.cc (Target_x86_64::Relocate::relocate): Add check for
R_X86_64_GOTPCREL. Reset skip_call_tls_get_addr_ after printing
error message.
* testsuite/Makefile.am (pr20216_gd.o): Add -Bgcctestdir/.
(pr20216_ld.o): Likewise.
* testsuite/Makefile.in: Regenerate.
James Clarke [Wed, 10 Aug 2016 16:58:01 +0000 (09:58 -0700)]
Fix potential crashes when Target::make_symbol() returns NULL.
2016-08-10 James Clarke <jrtc27@jrtc27.com>
gold/
PR gold/20443
* symtab.cc (Symbol_table::add_from_relobj): Handle NULL symbols,
which will be present for STT_SPARC_REGISTER.
(Symbol_table::add_from_pluginobj): Likewise.
(Symbol_table::add_from_dynobj): Likewise.
(Symbol_table::add_from_incrobj): Removed dead code.
James Clarke [Wed, 10 Aug 2016 16:47:45 +0000 (09:47 -0700)]
Fix improper handling of R_SPARC_GOTDATA_OP_LOX10 relocation.
The fall-through in Target_sparc::Relocate::relocate for
R_SPARC_GOTDATA_OP_LOX10 is currently R_SPARC_GOT13, but should
clearly be R_SPARC_GOT10. GCC has been seen to emit a sethi/xor
rather than a sethi/or sequence to load a 32-bit immediate, but
if R_SPARC_GOT13 is used then bits 10-12 get zeroed out as both
the sethi and xor immediates contain them.
gold/
PR gold/20442
* sparc.cc (Target_sparc::Relocate::relocate): R_SPARC_GOTDATA_OP_LOX10
should fall back on R_SPARC_GOT10, not R_SPARC_GOT13.
James Clarke [Wed, 10 Aug 2016 16:42:39 +0000 (09:42 -0700)]
Add support for R_SPARC_32 relocation.
gold/
PR gold/20441
* sparc.cc (Target_sparc::Scan::check_non_pic): Allow R_SPARC_32 on
sparc64.
Pedro Alves [Wed, 10 Aug 2016 15:06:57 +0000 (16:06 +0100)]
Quiet ARI gettext checks
The ARI complains about this new file:
common/signals-state-save-restore.c:46: warning: gettext: All messages should be marked up with _.
common/signals-state-save-restore.c:59: warning: gettext: All messages should be marked up with _.
common/signals-state-save-restore.c:87: warning: gettext: All messages should be marked up with _.
common/signals-state-save-restore.c:92: warning: gettext: All messages should be marked up with _.
Since these are untranslatable strings, use () instead of _().
gdb/ChangeLog:
2016-08-10 Pedro Alves <palves@redhat.com>
* common/signals-state-save-restore.c
(save_original_signals_state, restore_original_signals_state):
Wrap perror_with_name arguments with '()'.
GDB Administrator [Wed, 10 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in