Commit Graph

86923 Commits

Author SHA1 Message Date
Simon Marchi fa4ff31331 gdb.base/default.exp: Add missing $_as_string to "show convenience" test
When adding the $_as_string convenience function, I missed a new test
failure in default.exp.  The tests lists the convenience functions, so
$_as_string should be added to the expected list.

Fixes:

+FAIL: gdb.base/default.exp: show convenience ($_caller_is = <internal function _caller_is> not found)

gdb/testsuite/ChangeLog:

	* gdb.base/default.exp: Add $_as_string to the list of expected
	convenience functions.
2016-03-14 12:43:39 -04:00
GDB Administrator d834e6355e Automatic date update in version.in 2016-03-14 00:00:10 +00:00
H.J. Lu 3ab94f96a9 Add more tests for PR ld/19539
PR ld/19539
	* testsuite/ld-i386/i386.exp: Run pr19539.
	* testsuite/ld-i386/pr19539.d: New file.
	* testsuite/ld-i386/pr19539.s: Likewise.
	* testsuite/ld-i386/pr19539.t: Likewise.
	* testsuite/ld-x86-64/pr19539.s: Likewise.
	* testsuite/ld-x86-64/pr19539.t: Likewise.
	* testsuite/ld-x86-64/pr19539a.d: Likewise.
	* testsuite/ld-x86-64/pr19539b.d: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr19539a and pr19539b.
2016-03-13 08:57:10 -07:00
Marcin Kościelnicki 70104a9087 gdb/s390: Fill gen_return_address hook.
gdb/ChangeLog:

	* s390-linux-tdep.c (s390_gen_return_address): New function.
	(s390_gdbarch_init): Fill gen_return_address hook.
2016-03-13 10:52:26 +01:00
GDB Administrator 724cd463c6 Automatic date update in version.in 2016-03-13 00:00:14 +00:00
GDB Administrator 237a5ee12f Automatic date update in version.in 2016-03-12 00:00:20 +00:00
Andrew Burgess f2403c3934 gdb: New maint info line-table command.
Add a new command 'maint info line-table' to display the contents of
GDB's internal line table structure.  Useful when trying to understand
problems (within gdb) relating to line tables.

gdb/ChangeLog:

	* symmisc.c (maintenance_info_line_tables): New function.
	(maintenance_print_one_line_table): New function.
	(_initialize_symmisc): Register 'maint info line-table' command.
	* NEWS: Mention new command.

gdb/doc/ChangeLog:

	* gdb.texinfo (Symbols): Document new 'maint info line-table'
	command.

gdb/testsuite/ChangeLog:

	* gdb.base/maint.exp: New tests for 'maint info line-table'.
2016-03-11 22:48:21 +00:00
Marcin Kościelnicki c4b3e547d5 gdb/s390: Fill pseudo register agent expression hooks.
gdb/ChangeLog:

	* s390-linux-tdep.c (s390_ax_pseudo_register_collect): New function.
	(s390_ax_pseudo_register_push_stack): New function.
	(s390_gdbarch_init): Fill ax_pseudo_register_collect and
	ax_pseudo_register_push_stack hooks.
2016-03-11 11:02:49 +01:00
Dan Gissel 37b01f6a13 Fix some places where octet to byte conversions are needed.
PR 19713
	* elf.c (_bfd_elf_section_offset): Ensure that the returned offset
	uses bytes not octets.
	* elflink.c (resolve_section): Likewise.
	Add a bfd parameter.
	(eval_section): Pass the input_bfd to resolve_section.
	(bfd_elf_perform_complex_relocation): Convert byte offset to
	octets before read and writing values.
	(elf_link_input_bfd): Add byte to octet conversions.
	(elf_reloc_link_order): Likewise.
	(elf_fixup_link_order): Likewise.
	(bfd_elf_final_link): Likewise.
	* reloc.c (_bfd_final_link_relocate): Likewise.
	* syms.c (_bfd_stab_section_find_nearest_line): Likewise.
2016-03-11 09:17:28 +00:00
GDB Administrator aa667814c7 Automatic date update in version.in 2016-03-11 00:00:18 +00:00
Simon Marchi f2f3ccb9f8 Add $_as_string convenience function
This patch is a follow-up to "Add printf format specifier for printing
enumerator":

  https://sourceware.org/ml/gdb-patches/2016-02/msg00144.html

Instead of having a solution specific to the printf command, Pedro
suggested adding a general purpose function $_as_string() that would
cover this use case and more.

So, in order to print the textual label of an enum, one can use:

  (gdb) printf "Visiting node of type %s\n", $_as_string(node)
  Visiting node of type NODE_INTEGER

gdb/ChangeLog:

	* data-directory/Makefile.in (PYTHON_FILE_LIST): Install
	gdb/function/as_string.py.
	* python/lib/gdb/function/as_string.py: New file.
	* NEWS: Mention the new $_as_string function.

gdb/testsuite/ChangeLog:

	* gdb.python/py-as-string.exp: New file.
	* gdb.python/py-as-string.c: New file.

gdb/doc/ChangeLog:

	* gdb.texinfo (Convenience Functions): Document $_as_string.
2016-03-10 17:12:30 -05:00
Mickael Guene a9f02af88d PR gas/19744: Thumb-1 pcrop relocations don't work on Thumb-2 targets
gas/
	* config/tc-arm.c (do_arit): Protect against bad relocations usage.
	(do_mov): Likewise.
	(do_t_add_sub): Allow pcrop relocations for Thumb-2 targets.
	(do_t_mov_cmp): Likewise.
	(do_t_add_sub): Protect against bad relocations usage.
	(do_t_mov_cmp): Likewise.

	gas/testsuite/
	* gas/arm/adds-thumb1-reloc-local-armv7-m.s: New.
	* gas/arm/adds-thumb1-reloc-local-armv7-m.d: New.
	* gas/arm/movs-thumb1-reloc-local-armv7-m.s: New.
	* gas/arm/movs-thumb1-reloc-local-armv7-m.d: New.

	ld/
	* testsuite/ld-arm/arm-elf.exp: New tests.
	* testsuite/ld-arm/thumb1-adds-armv7-m.s: New.
	* testsuite/ld-arm/thumb1-movs-armv7-m.s: New.
2016-03-10 17:06:35 +01:00
Nick Clifton 3ed4ff97cb Mark the i370 target as obsolete.
* config.bfd: Mark the i370 target as obsolete.
2016-03-10 15:29:42 +00:00
Nick Clifton 878a68773b Remove bogus LONG(0) from MSP430 built in linker script.
ld	* scripttempl/elf32msp430.sc (.rodata): Remove spurious LONG(0).
2016-03-10 10:37:19 +00:00
GDB Administrator a2d97d75bd Automatic date update in version.in 2016-03-10 00:00:18 +00:00
Pedro Alves 00dbd492e4 More "Program" -> "Thread NN received signal" testsuite adjustment
These tests should have been adjusted by f303dbd60d (Fix PR
threads/19422 - show which thread caused stop), but clearly I had
missed grepping for potential-fail cases.

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

	* gdb.threads/attach-into-signal.exp: Adjust to "Program received
	signal" -> "Thread NN received signal" output change.
	* gdb.threads/ia64-sigill.exp: Likewise.
	* gdb.threads/linux-dp.exp: Likewise.
	* gdb.threads/manythreads.exp: Likewise.
	* gdb.threads/pending-step.exp: Likewise.
	* gdb.threads/print-threads.exp: Likewise.
	* gdb.threads/sigstep-threads.exp: Likewise.
	* gdb.threads/staticthreads.exp: Likewise.
	* gdb.threads/tls.exp: Likewise.
2016-03-09 20:24:14 +00:00
Jose E. Marchesi 2343b78a77 gdb: fix doc string of target_can_use_hardware_watchpoint.
gdb/ChangeLog

2016-03-09  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* target.h: Fix doc string of target_can_use_hardware_watchpoint.
2016-03-09 11:17:54 -08:00
Pedro Alves b69d38afde Command line input handling TLC
I didn't manage to usefully split this further into smaller
independent pieces, so:

 - Use "struct buffer" more.

 - Split out the responsibility of composing a complete command line
   from multiple input lines split with backslash

    (
    E.g.:

       (gdb) print \
       1 + \
       2
       $1 = 3
       (gdb)
    )

   to a separate function.  Note we don't need the separate
   readline_input_state and more_to_come globals at all.  They were
   just obfuscating the logic.

 - Factor out the tricky mostly duplicated code in
   command_line_handler and command_line_input.

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

	* event-top.c (more_to_come): Delete.
	(struct readline_input_state): Delete.
	(readline_input_state): Delete.
	(get_command_line_buffer): New function.
	(command_handler): Update comments.  Don't handle NULL commands
	here.  Do not execute commented lines.
	(command_line_append_input_line): New function.
	(handle_line_of_input): New function, partly based on
	command_line_handler and command_line_input.
	(command_line_handler): Rewrite.
	* event-top.h (command_handler): New declaration.
	(command_loop): Defer command execution to command_handler.
	(command_line_input): Update comments.  Simplify, using struct
	buffer and handle_line_of_input.
	* top.h (struct buffer): New forward declaration.
	(handle_line_of_input): New declaration.
2016-03-09 18:25:00 +00:00
Pedro Alves 2669cade3d Simplify saved_command_line handling
There doesn't seem to be much point in trying to reuse this buffer.
Prefer simplicity instead.

(In case you're wondering whether this fixes an off-by-one: linelength
is misnamed; it's really a size including terminating null char.)

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

	* event-top.c (command_line_handler): Use xfree + xstrdup instead
	of xrealloc + strcpy.
	* main.c (captured_main): Use xstrdup instead of xmalloc plus
	manual clear.
	* top.c (saved_command_line): Rewrite comment.
	(saved_command_line_size): Delete.
	(command_line_input): Use xfree + xstrdup instead of xrealloc +
	strcpy.
	* top.h (saved_command_line_size): Delete declaration.
2016-03-09 18:25:00 +00:00
Pedro Alves 187212b3c1 Use struct buffer in gdb_readline_no_editing_callback
gdb/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

	* event-top.c: Include buffer.h.
	(gdb_readline_no_editing_callback): Use struct buffer instead
	of xrealloc.
2016-03-09 18:25:00 +00:00
Pedro Alves 7a3bde34bc Use struct buffer in gdb_readline_no_editing
gdb/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

	* common/buffer.h (buffer_grow_char): New function.
	* top.c: Include buffer.h.
	(gdb_readline_no_editing): Rename 'prompt_arg' parameter to
	'prompt'.  Use struct buffer instead of xrealloc.
2016-03-09 18:25:00 +00:00
Pedro Alves c5c136ea94 gdb_readline -> gdb_readline_no_editing
Name this such that it's clearer that this is not a wrapper for the
real readline, but instead a replacement that provides no command line
editing features.

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

	* defs.h (gdb_readline): Delete declaration.
	* top.c (gdb_readline): Rename to ...
	(gdb_readline_no_editing): ... this, and make static.
2016-03-09 18:24:59 +00:00
Pedro Alves 720d2e96b4 Update prompt_for_continue comments
These comments are out of date -- we no longer call gdb_readline.  And
I think that mentioning the event loop is more useful here than
whatever GO32 issue had with gdb_readline, which may even no longer be
an issue.

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

	* utils.c (prompt_for_continue): Update comments.
2016-03-09 18:24:59 +00:00
Pedro Alves 608ff013aa Eliminate async_annotation_suffix
The comments and existence of this global are a bit of misleading
obfuscation, since this is only ever used to print the prompt
annotation, and never changes.  Just hardcode "prompt" where
necessary, as done for most other annotations.

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

	* event-top.c (async_annotation_suffix): Delete.
	(top_level_prompt, command_line_handler): Don't use
	'async_annotation_suffix' and simplify.
	* event-top.h (async_annotation_suffix): Delete declaration.
	(init_main): Remove reference to 'async_annotation_suffix'.
2016-03-09 18:24:59 +00:00
Pedro Alves c70061cf94 gdb_readline2 -> gdb_readline_no_editing_callback
The "2" in "gdb_readline2" doesn't really convey much.  Rename for
clarity.

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

	* event-top.c (gdb_readline2): Rename to ...
	(gdb_readline_no_editing_callback): ... this.
	(change_line_handler, stdin_event_handler)
	(gdb_setup_readline): Adjust.
	* event-top.h (gdb_readline2): Rename to ...
	(gdb_readline_no_editing_callback): ... this, and move closer to
	other readline-related declarations.
	* mi/mi-interp.c (mi_interpreter_resume): Adjust.
2016-03-09 18:24:59 +00:00
Pedro Alves 8a24383254 Garbage collect window_hook
I checked, and Insight doesn't set this.

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

	* top.c (window_hook): Delete.
	(command_loop): Remove references to window_hook.
2016-03-09 18:24:59 +00:00
Pedro Alves c32e87066a Test issuing a command split in multiple lines with continuation chars
I happened to break this locally and the testsuite didn't notice it.
Add some tests.

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

	* gdb.base/command-line-input.exp: New file.
2016-03-09 18:24:58 +00:00
Marcin Kościelnicki b04fd3bec9 gdb: Add tracepoint support for powerpc.
gdb/gdbserver/ChangeLog:

	* linux-ppc-low.c (ppc_supports_tracepoints): New function.
	(struct linux_target_ops): Wire in the above.

gdb/testsuite/ChangeLog:

	* gdb.trace/ftrace.exp: Set arg0exp for ppc.
	* gdb.trace/mi-trace-unavailable.exp: Set pcnum for ppc.
	* gdb.trace/pending.exp: Accept leading dot before function name.
	* gdb.trace/trace-common.h: Add fast tracepoint dummy insn for ppc.
	* lib/trace-support.exp: Set registers for ppc.
2016-03-09 18:47:46 +01:00
Marcin Kościelnicki 98fa59e9b0 gdb.trace/entry-values.exp: Fixes for powerpc64.
On powerpc64, "disassemble foo" doesn't work properly on object files
(it can't process the relocations in .opd section) - instead, let's
link it into an executable and load that.

Also, backtrace displays .main, not main.  Accept both.

gdb/testsuite/ChangeLog:

	* gdb.trace/entry-values.exp: Link ${binfile}1.o to ${binfile}1 and
	use it for disassembly; accept .main in addition to main in backtrace.
2016-03-09 18:47:11 +01:00
Marcin Kościelnicki f77198c878 gdb.trace/tfind.exp: Force call via global entry point on ppc64le.
tfind.exp sets a breakpoint on *gdb_recursion_test, which is the global
entry point on ppc64le, and won't be hit, since the call uses
the local entry.  Fix by calling the function via a pointer in a global
variable, forcing use of the global entry.

This patch is a slightly modified hunk extracted from
https://sourceware.org/ml/gdb-patches/2015-07/msg00353.html

gdb/testsuite/ChangeLog:

2016-03-09  Wei-cheng Wang  <cole945@gmail.com>
	    Marcin Kościelnicki  <koriakin@0x04.net>

	* gdb.trace/actions.c (gdb_recursion_test_fp): New typedef.
	(gdb_recursion_test_ptr): New global variable.
	(gdb_recursion_test): Call gdb_recursion_test_ptr instead of
	gdb_recursion_test.
	(gdb_c_test): Ditto.
2016-03-09 18:46:12 +01:00
Marcin Kościelnicki ba84e0da35 gdb.trace/change-loc.exp: Don't depend on tracepoint ordering.
powerpc (32-bit) loads shared libraries below the main executable, so
the PENDING location is the first one, which the current regex doesn't
match.  Split it into two tests instead, one looking for the pending
tracepoint location, and the other for two installed locations.

gdb/testsuite/ChangeLog:

	* gdb.trace/change-loc.exp: Don't depend on tracepoint location
	ordering.
2016-03-09 18:45:19 +01:00
Marcin Kościelnicki 4366d36e46 gdb.trace: Use manually-defined start labels in unavailable-dwarf-piece.exp
On powerpc64, foo/bar point to a function descriptor, not to function code.
Since there are no global labels pointing at the actual function code,
let's make our own.

Regression-tested on x86_64.

gdb/testsuite/ChangeLog:

	* gdb.trace/unavailable-dwarf-piece.c (foo): Add foo_start_lbl label.
	(bar): Add bar_start_lbl label.
	* gdb.trace/unavailable-dwarf-piece.exp: Use foo/bar_start_lbl instead
	of foo/bar for emitting DWARF and tracing.
2016-03-09 18:44:57 +01:00
Marcin Kościelnicki cc2c4da881 gdb/rs6000: Read backchain as unsigned.
Previously, backchain was read as a signed quantity, resulting in
addresses like 0xfffffffffffeded0 instead of 0xfffeded0 returned by
unwinder on 32-bit powerpc.  While normally such addresses are masked
off, this causes problems for tracepoints, since 0xfffffffffffeded0
is considered unavailable.

Fixes a test failure in gdb.trace/entry-values.exp.

gdb/ChangeLog:

	* corefile.c (safe_read_memory_unsigned_integer): New function.
	* gdbcore.h (safe_read_memory_unsigned_integer): New prototype.
	* rs6000-tdep.c (rs6000_frame_cache): Read backchain as unsigned.
2016-03-09 18:43:54 +01:00
Marcin Kościelnicki a67914defb gdb: Add gen_return_address for powerpc.
gdb/ChangeLog:

	* rs6000-tdep.c: Add "ax.h" and "ax-gdb.h" includes.
	(rs6000_gen_return_address): New function.
	(rs6000_gdbarch_init): Wire in the above.
2016-03-09 18:43:02 +01:00
Marcin Kościelnicki 2a2fa07bd1 gdb: Add ax_pseudo_register_collect for powerpc.
gdb/ChangeLog:

	* rs6000-tdep.c (rs6000_ax_pseudo_register_collect): New function.
	(rs6000_gdbarch_init): Wire in the above.
2016-03-09 18:41:53 +01:00
H.J. Lu fd91f0024c Workaround a C++ bug in GCC 4.2 in gold test
G++ in GCC 4.2 silently ignores

---
__attribute__ ((section(".rodata.v1_a2")))
const short rodata_item1 = 101;
---

which leads to plugin_layout_with_alignment test failure with

Expected 12 sections, found 8 sections

since 4 .rodata sections are missing.  As a workaround, this patch
changes plugin_layout_with_alignment test from C++ to C.

	* testsuite/plugin_layout_with_alignment.cc: Renamed to ..
	* testsuite/plugin_layout_with_alignment.c: This.
	* testsuite/Makefile.am (plugin_layout_with_alignment.o): Updated.
	(plugin_layout_with_alignment): Likewise.
	* testsuite/Makefile.in: Regenerated.
2016-03-09 08:32:46 -08:00
Andreas Arnez bc0e3f49c8 S390: Recognize special jumps in prologue parser
Functions compiled with the gcc option `-mhotpatch' may start with a
branch-never BRCL instruction as a 6-byte NOP.  And functions compiled
with `-mstack-size' contain a BRC instruction in their prologue that is
actually a conditional trap.  Both of these special jumps cause the
prologue parser to stop and yield bad unwinding results.

This change makes the prologue analyzer recognize such special jumps and
ignore them.

gdb/ChangeLog:

	* s390-linux-tdep.c (s390_analyze_prologue): Ignore BRC and BRCL
	instructions that do nothing or are conditional traps.
2016-03-09 17:12:29 +01:00
Andreas Arnez 6d53bec88f S390: Add use of unavailable-stack frame ID
When determining the frame ID of an inline frame, GDB currently asserts
that a valid ID of the underlying real frame is found, and that it does
not match outer_frame_id.  From inline_frame_this_id():

  /* For now, require we don't match outer_frame_id either (see
     comment above).  */
  gdb_assert (!frame_id_eq (*this_id, outer_frame_id));

However, this assertion may fail when the real frame's unwinder can not
determine the frame ID.  This happened on an s390x target with a binary
that lacked call frame information and also confused the prologue
analyzer, because then s390_frame_this_id() left the frame ID at its
default.

To fix this, this change enhances s390_frame_this_id such that an
unavailable-stack frame ID is built if no frame base can be determined
but the function address is available.

gdb/ChangeLog:

	* s390-linux-tdep.c (s390_prologue_frame_unwind_cache): Store
	frame func's PC in info->func before any other failure can occur.
	(s390_frame_this_id): Use frame_id_build_unavailable_stack if
	info->func has been filled out.
2016-03-09 17:12:29 +01:00
Pedro Alves f7990f1690 Avoid spaces in osabi names
It's not possible today to select some of the osabis by name.
Specifically, those that have spaces in their names and then the first
word is ambiguous...

For example:
 (gdb) set osabi <TAB>
 [...]
 FreeBSD ELF
 FreeBSD a.out
 [...]
 (gdb) set osabi FreeBSD ELF
 Ambiguous item "FreeBSD ELF".

In reality, because "set osabi" is an enum command, that was
equivalent to trying "set osabi FreeBSD", which is then obviously
ambiguous, because of "FreeBSD ELF" and "FreeBSD a.out".

Also, even if the first word is not ambiguous, we actually ignore
whatever comes after the first word:

 (gdb) set osabi GNU/Linux
 (gdb) show osabi
 The current OS ABI is "GNU/Linux".
 The default OS ABI is "GNU/Linux".
 (gdb) set osabi Windows SomeNonsense
                         ^^^^^^^^^^^^
 (gdb) show osabi
 The current OS ABI is "Windows CE".
 The default OS ABI is "GNU/Linux".
 (gdb)

Fix this by avoiding spaces in osabi names.

We could instead make "set osabi" have a custom set hook, or
alternatively make the enum set hook (in cli-setshow.c) handle values
with spaces, but OTOH, I have a feeling that could cause trouble.
E.g., in cases where we might want to write more than one enum value
in the same line.  We could support quoting as workaround, but, not
sure we want that.  "No spaces" seems like a simpler rule.

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

	* osabi.c (gdb_osabi_names): Avoid spaces in osabi names.
2016-03-09 15:52:43 +00:00
Pedro Alves 087ccc6a4f [FR-V] Handle FR300
Even though "set architecture" presents fr300 as option:

 (gdb) set architecture fr<TAB>
 fr300  fr400  fr450  fr500  fr550  frv

Actually selecting fr300 doesn't work:

 (gdb) set architecture fr300
 Architecture `fr300' not recognized.
 The target architecture is set automatically (currently i386)
 (gdb)

This just looks like an obvious oversight.  Looking around gcc and
binutils sources, FR300 is basically a FR500 specialized for DSP and
low power.

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

	* frv-tdep.c (frv_gdbarch_init): Handle bfd_mach_fr300.
2016-03-09 15:46:31 +00:00
Pedro Alves 4b05e0a74b Fix v850 bfd arch info printable names
Currently, it's not possible to manually set some of the v850 archs in
gdb:

 (gdb) set architecture v850<TAB>
 v850 (using old gcc ABI)
 v850-rh850
 v850e
 v850e (using old gcc ABI)
 v850e1
 [...]
 (gdb) set architecture v850 (using old gcc ABI)
 Ambiguous item "v850 (using old gcc ABI)".

The problem is that "set architecture" is a GDB "enum command", and
GDB only considers an enum value to be the string up until the first
space.  So writing "v850 (using old gcc ABI)" is the same as writing
"v850", and then that's not an unambiguous arch printable name prefix.

v850 is actually the only arch that has spaces in its printable name.
One can conveniently see that with e.g.:

 (gdb) set max-completions unlimited
 (gdb) complete set architecture
 ...

Rather than hack GDB into accepting this somehow, make v850 arch
printable names more like the printable names of the other archs, and
put the abi variant in the "machine" part, after a ':'.

We now get:

 (gdb) set architecture v850<TAB>
 v850:old-gcc-abi
 v850:rh850
 v850e
 v850e1
 v850e1:old-gcc-abi
 v850e2
 v850e2:old-gcc-abi
 [...]

And now "set architecture v850:old-gcc-abi" works as expected.

I ran the binutils/gas/ld testsuites, and found no regressions.  I
don't have a cross compiler handy, but I ran the gdb tests anyway,
which covers at least some snoke testing.

I think that the OUTPUT_ARCH in ld/scripttempl/v850.sc may have got
broken with the previous 2012 change, since I hacked v850_rh850.sc to
output "v850" and ld failed to grok it.  I think it only works if the
old GCC ABI is the configured v850 default ABI.  That's now fixed by
changing to use explicit v850:old-gcc-abi.

Also, this actually "fixes" an existing GDB test, which isn't likewise
expecting spaces in arch names, when GDB is configured for
--target=v850:

  (gdb) FAIL: gdb.xml/tdesc-arch.exp: read valid architectures

bfd/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

	* cpu-v850.c (N): Append ":old-gcc-abi" instead of " (using old
	gcc ABI)" to printable name.
	* cpu-v850_rh850.c (bfd_v850_rh850_arch): Use "v850:rh850" instead
	of "v850-rh850" as printable name.

ld/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

	* scripttempl/v850.sc: Use "v850:old-gcc-abi" as OUTPUT_ARCH.
	* scripttempl/v850_rh850.sc: Use "v850:rh850" as OUTPUT_ARCH.
2016-03-09 15:43:13 +00:00
Leon Winter 26c62da040 For COFF and COFF/PE targets, skip relocations against absolute symbols.
PR ld/19623
	* cofflink.c (_bfd_coff_generic_relocate_section): Do not apply
	relocations against absolute symbols.
2016-03-09 15:26:45 +00:00
Trevor Saunders aa8a08637e fixup -Wshadow warnings on gcc-4.7
gcc 4.7 complains about variables that shadow function names, which now happens
in tc-arm.c because there is a global function do_align (), and local variables
do_align.  The simplest fix for this seems to be to rename those variables to
do_alignment.

gas/ChangeLog:

2016-03-09  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-arm.c (neon_alignment_bit): Rename do_align to
	do_alignment.
	(do_neon_ld_st_lane): Likewise.
	(do_neon_ld_dup): Likewise.
2016-03-09 09:29:17 -05:00
Alan Modra 03ee85837e Allow zero length archive elements
PR binutils/19775
	* coff-alpha.c (alpha_ecoff_openr_next_archived_file): Allow zero
	length elements in the archive.
2016-03-09 16:54:24 +10:30
H.J. Lu 9c1d7a0876 Don't create dynamic sections when relocatable
Since dynamic sections aren't applicable to relocatable file, don't
create dynamic sections for -E/--dynamic-list when relocatable.

bfd/

	PR ld/19789
	* elflink.c (elf_link_add_object_symbols): Create dynamic sections
	for -E/--dynamic-list only when not relocatable.

ld/

	PR ld/19789
	* testsuite/ld-elf/pr19789.d: New file.
	* testsuite/ld-elf/pr19789.s: Likewise.
2016-03-08 20:45:52 -08:00
Cary Coutant 7ff6eb49a2 Remove checks for constructors that might have been eliminated by GCC.
GCC 6 does not generate constructors for two of gold's test cases.
This patch simply removes the checks for them.

gold/
	PR 19751
	* testsuite/Makefile.am (retain_symbols_file_test): Remove check
	for constructor.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/dynamic_list.sh: Likewise.
	* testsuite/retain_symbols_file_test.sh: Likewise.
2016-03-08 20:36:31 -08:00
Cary Coutant 202736beb1 Add unused attribute where necessary to quiet GCC 6 warnings.
gold/
	PR 19751
	* arm.cc (Reloc_stub::Key::name): Add unused attribute.
	* dirsearch.cc (Dir_caches::~Dir_caches): Likewise.
2016-03-08 20:34:18 -08:00
Cary Coutant 0863441e8a Fix Makefile so make clean removes overlooked files.
gold/
	* testsuite/Makefile.am: Add to MOSTLYCLEANFILES.
	* testsuite/Makefile.in: Regenerate.
2016-03-08 19:52:28 -08:00
Pedro Alves 114d7832b0 [CRIS] Don't internal error if forced big endian
This fixes:

  $ ./gdb -q -ex "set endian big" -ex "set architecture cris"
  The target is assumed to be big endian
  .../src/gdb/cris-tdep.c:4051: internal-error: cris_gdbarch_init: big endian byte order in info
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n)

The "set cris-version" command can likewise cause internal errors.

The gdbarch init routine should be returning 0 to reject the
architecture instead of internal erroring on user input.

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

	* cris-tdep.c (cris_gdbarch_init): Return 0 if the info's byte
	order is BFD_ENDIAN_BIG or if the cris version is unsupported.
2016-03-09 03:14:07 +00:00
Pedro Alves d7a87b5e43 Fix floating conversion buffer overrun when host/target format matches
Running the testsuite with a gdb configured with --enable-libmcheck
reveals a problem:

  (gdb) ptype 3 * 2.0
  type = <12-byte float>
  memory clobbered past end of allocated block
  ERROR: Process no longer exists
  UNRESOLVED: gdb.ada/ptype_arith_binop.exp: ptype 3 * 2.0

  (gdb) PASS: gdb.dlang/expression.exp: ptype 0x1.FFFFFFFFFFFFFp1023
  ptype 0x1p-52L
  type = real
  memory clobbered past end of allocated block
  ERROR: Process no longer exists
  UNRESOLVED: gdb.dlang/expression.exp: ptype 0x1p-52L

Even though this shows up with Ada and D, it's easy to reproduce in C
too.  We just need to print a long double, when the current arch is
32-bit, which is the default when gdb starts up:

 $ ./gdb -q -ex "ptype 1.0L"
 type = long double
 memory clobbered past end of allocated block
 Aborted (core dumped)

Valgrind shows:

 ==22159== Invalid write of size 8
 ==22159==    at 0x8464A9: floatformat_from_doublest (doublest.c:756)
 ==22159==    by 0x846822: store_typed_floating (doublest.c:867)
 ==22159==    by 0x6A7959: value_from_double (value.c:3662)
 ==22159==    by 0x6A9F2D: evaluate_subexp_standard (eval.c:745)
 ==22159==    by 0x7F31AF: evaluate_subexp_c (c-lang.c:716)
 ==22159==    by 0x6A8986: evaluate_subexp (eval.c:79)
 ==22159==    by 0x6A8BA3: evaluate_type (eval.c:174)
 ==22159==    by 0x817CCF: whatis_exp (typeprint.c:456)
 ==22159==    by 0x817EAA: ptype_command (typeprint.c:508)
 ==22159==    by 0x5F267B: do_cfunc (cli-decode.c:105)
 ==22159==    by 0x5F5618: cmd_func (cli-decode.c:1885)
 ==22159==    by 0x83622A: execute_command (top.c:475)
 ==22159==  Address 0x8c6cb28 is 8 bytes inside a block of size 12 alloc'd
 ==22159==    at 0x4C2AA98: calloc (vg_replace_malloc.c:711)
 ==22159==    by 0x87384A: xcalloc (common-utils.c:83)
 ==22159==    by 0x873889: xzalloc (common-utils.c:93)
 ==22159==    by 0x6A34CB: allocate_value_contents (value.c:1036)
 ==22159==    by 0x6A3501: allocate_value (value.c:1047)
 ==22159==    by 0x6A790A: value_from_double (value.c:3656)
 ==22159==    by 0x6A9F2D: evaluate_subexp_standard (eval.c:745)
 ==22159==    by 0x7F31AF: evaluate_subexp_c (c-lang.c:716)
 ==22159==    by 0x6A8986: evaluate_subexp (eval.c:79)
 ==22159==    by 0x6A8BA3: evaluate_type (eval.c:174)
 ==22159==    by 0x817CCF: whatis_exp (typeprint.c:456)
 ==22159==    by 0x817EAA: ptype_command (typeprint.c:508)
 ==22159==
 type = long double
 (gdb)

Even if the target and host floating-point formats match, the length
of the types might still be different.  On x86, long double is the
80-bit extended precision type on both 32-bit and 64-bit ABIs, but by
default it is stored as 12 bytes on 32-bit, and 16 bytes on 64-bit,
for alignment reasons.  Several places in doublest.c already consider
this, but floatformat_to_doublest and floatformat_from_doublest miss
it.  E.g., convert_typed_floating and store_typed_floating,

Tested on x86-64 Fedora 23 with --enable-libmcheck, where it fixes the
crashed above.

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

	* doublest.c: Extend comments.
	(floatformat_to_doublest, floatformat_from_doublest): Copy the
	floatformat's total size, not the host type's size.
2016-03-09 03:01:06 +00:00