external/binutils.git
9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 16 Aug 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd end_psymtab_common, have all debug info readers call it.
Doug Evans [Sat, 15 Aug 2015 23:46:20 +0000 (16:46 -0700)]
Add end_psymtab_common, have all debug info readers call it.

gdb/ChangeLog:

* dbxread.c (dbx_end_psymtab): Renamed from end_psymtab.  All callers
updated.  Call end_psymtab_common.
* dwarf2read.c (process_psymtab_comp_unit_reader): Call
end_psymtab_common.
(build_type_psymtabs_reader): Ditto.
* psympriv.h (sort_pst_symbols): Delete.
(end_psymtab_common): Declare.
* psymtab.c (sort_pst_symbols): Make static.
(end_psymtab_common): New function.
* xcoffread.c (xcoff_end_psymtab): Call end_psymtab_common.

9 years agoUse macros for some enum bit field sizes.
Doug Evans [Sat, 15 Aug 2015 23:25:53 +0000 (16:25 -0700)]
Use macros for some enum bit field sizes.

gdb/ChangeLog:

* defs.h (LANGUAGE_BITS): Define.
* psympriv.h (partial_symbol) <domain>: Use SYMBOL_DOMAIN_BITS.
(partial_symbol) <aclass>: Use SYMBOL_ACLASS_BITS.
* symtab.h (general_symbol_info> <language>: Usage LANGUAGE_BITS.
(minimal_symbol_type): Add nr_minsym_types.
(MINSYM_TYPE_BITS): Define.
(minimal_symbol) <type>: Use MINSYM_TYPE_BITS.
(domain_enum_tag): Add NR_DOMAINS.
(SYMBOL_DOMAIN_BITS): Change from 4 to 3.
(SYMBOL_ACLASS_BITS): Define from 6 to 5.

9 years agoobjfiles.h,psympriv.h,psymtab.c: Whitespace.
Doug Evans [Sat, 15 Aug 2015 22:51:00 +0000 (15:51 -0700)]
objfiles.h,psympriv.h,psymtab.c: Whitespace.

gdb/ChangeLog:

* objfiles.h: Whitespace cleanup.
* psympriv.h: Whitespace cleanup.
* psymtab.c: Whitespace/coding convention cleanup.

9 years agoFix invoking "[kill|detach] inferiors" on inferiors that are not running
Patrick Palka [Tue, 28 Jul 2015 19:00:58 +0000 (15:00 -0400)]
Fix invoking "[kill|detach] inferiors" on inferiors that are not running

Invoking either of the above commands on an inferior that's not running
triggers the following assert failure:

  .../binutils-gdb/gdb/thread.c:514: internal-error: any_thread_of_process: Assertion `pid != 0' failed.

The fix is straightforward.  This patch also adds a test to check the
basic functionality of these commands, along with testing this fix in
particular.  Tested on x86_64 Linux.

gdb/ChangeLog:

* inferior.c (detach_inferior_command): Don't call
any_thread_of_process when pid is 0.
(kill_inferior_command): Likewise.

gdb/testsuite/ChangeLog:

* gdb.base/kill-detach-inferiors-cmd.exp: New test file.
* gdb.base/kill-detach-inferiors-cmd.c: New test file.

9 years agoperftest/utils.py (select_file): Kill any existing inferior before selecting a new...
Doug Evans [Sat, 15 Aug 2015 06:29:04 +0000 (23:29 -0700)]
perftest/utils.py (select_file): Kill any existing inferior before selecting a new file.

gdb/testsuite/ChangeLog:

* gdb.perf/lib/perftest/utils.py (select_file): Kill any existing
inferior before selecting a new file.

9 years agoNew /s modifier for the disassemble command.
Doug Evans [Sat, 15 Aug 2015 04:45:54 +0000 (21:45 -0700)]
New /s modifier for the disassemble command.

The "source centric" /m option to the disassemble command is often
unhelpful, e.g., in the presence of optimized code.
This patch adds a /s modifier that is better.
For one, /m only prints instructions from the originating source file,
leaving out instructions from e.g., inlined functions from other files.

gdb/ChangeLog:

PR gdb/11833
* NEWS: Document new /s modifier for the disassemble command.
* cli/cli-cmds.c (disassemble_command): Add support for /s.
(_initialize_cli_cmds): Update online docs of disassemble command.
* disasm.c: #include "source.h".
(struct deprecated_dis_line_entry): Renamed from dis_line_entry.
All uses updated.
(dis_line_entry): New struct.
(hash_dis_line_entry, eq_dis_line_entry): New functions.
(allocate_dis_line_table): New functions.
(maybe_add_dis_line_entry, line_has_code_p): New functions.
(dump_insns): New arg end_pc.  All callers updated.
(do_mixed_source_and_assembly_deprecated): Renamed from
do_mixed_source_and_assembly.  All callers updated.
(do_mixed_source_and_assembly): New function.
(gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE).
* disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from
DISASSEMBLY_SOURCE.  All uses updated.
(DISASSEMBLY_SOURCE): New macro.
* mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5.

gdb/doc/ChangeLog:

* gdb.texinfo (Machine Code): Update docs for mixed source/assembly
disassembly.
(GDB/MI Data Manipulation): Update docs for new disassembly modes.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-disassemble.exp: Update.
* gdb.base/disasm-optim.S: New file.
* gdb.base/disasm-optim.c: New file.
* gdb.base/disasm-optim.h: New file.
* gdb.base/disasm-optim.exp: New file.

9 years agoRename `typename' in d-exp.y to avoid C++ reserved word
Keith Seitz [Sat, 15 Aug 2015 00:28:11 +0000 (17:28 -0700)]
Rename `typename' in d-exp.y to avoid C++ reserved word

A recent patch introduced a variable named `typename' into d-exp.y,
and one of the --enable-with-cxx build slaves consequently failed to compile
this.  This patch simply adds an underscore into the name to avoid the
reserved word.

gdb/ChangeLog

* d-exp.y (PrimaryExpression : TypeExp '.' IdentifierExp): Rename
`typename' to `type_name' to avoid C++ reserved word.

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

9 years agoRename location accessor macro parameters to silence ARI
Keith Seitz [Fri, 14 Aug 2015 22:00:04 +0000 (15:00 -0700)]
Rename location accessor macro parameters to silence ARI

The locations patch I recently committed contains macro definitions
such as:

This causes an ARI error to be emitted by the server ("Do not use PTR, ISO C
90 implies `void *'").  While this ARI error is bogus in this context,
it is just easiest to squash the error completely by renaming the macro
parameters.

gdb/ChangeLog

* location.c (EL_TYPE, EL_LINESPEC, EL_PROBE, EL_ADDRESS)
(EL_EXPLICIT, EL_STRING): Change macro parameter to "P" to
silence ARI errors.

9 years agoAdd missing ChangeLog entry for previous commit.
Keith Seitz [Fri, 14 Aug 2015 21:54:37 +0000 (14:54 -0700)]
Add missing ChangeLog entry for previous commit.

9 years agomi_make_breakpoint: add "evaluated-by" option
Keith Seitz [Fri, 14 Aug 2015 20:45:06 +0000 (13:45 -0700)]
mi_make_breakpoint: add "evaluated-by" option

For some time now, GDB has permitted target-side evaluation of
breakpoint conditions.  On targets that support this feature, GDB
may output an "evaluated-by" field into the breakpoint reply.

This patch adds handling for this option, and outputs a default
pattern to optionally recognize (and ignore) this pattern in the
reply.

gdb/testsuite/ChangeLog

* lib/mi-support.exp (mi_make_breakpoint): Add option/handling for
"evaluated-by".

9 years agoFix ARI warnings in d-exp.y
Iain Buclaw [Fri, 14 Aug 2015 19:25:17 +0000 (21:25 +0200)]
Fix ARI warnings in d-exp.y

This fixes four ARI warnings found in d-exp.y.

This is comprised of three uses of the && or || at the end of a line, and one
use of sprintf.

gdb/ChangeLog

* d-exp.y (PrimaryExpression : TypeExp '.' IdentifierExp): Use
xstrprintf instead of malloc and sprintf.
(PrimaryExpression : IdentifierExp): Avoid operator at end of line.
(lex_one_token): Likewise.

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

This tag allows debugging of MIPS position independent executables
and provides access to shared library information.

gdb/gdbserver/

* linux-low.c (get_r_debug): Handle DT_MIPS_RLD_MAP_REL.

gdb/

* solib-svr4.c (read_program_header): Add base_addr argument to
report the runtime address of the segment.
(find_program_interpreter): Update read_program_header call to pass
a NULL pointer for the new argument.
(scan_dyntag): Add ptr_addr argument to report the runtime address
of the tag payload.
(scan_dyntag_auxv): Likewise and use thew new base_addr argument of
read_program_header to get the base address of the dynamic segment.
(elf_locate_base): Update uses of scan_dyntag, scan_dyntag_auxv and
read_program_header.
(elf_locate_base): Scan for and handle DT_MIPS_RLD_MAP_REL.

9 years agoAdd myself to gdb MAINTAINERS
Matthew Fortune [Fri, 14 Aug 2015 12:07:23 +0000 (13:07 +0100)]
Add myself to gdb MAINTAINERS

gdb/
* MAINTAINERS (Write After Approval): Add Matthew Fortune.

9 years agoRevert "Fix encoding or OpenRisk1000 PC relative relocations."
Alan Modra [Wed, 12 Aug 2015 09:37:26 +0000 (19:07 +0930)]
Revert "Fix encoding or OpenRisk1000 PC relative relocations."

This reverts commit dbac553d28887561e3f154654ec8e70195d89943.

PR ld/18759
* elf32-or1k.c: Revert 2015-08-11 change.

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

9 years ago[D] Move classification of symbols from the grammar to the lexer.
Iain Buclaw [Thu, 13 Aug 2015 19:35:09 +0000 (21:35 +0200)]
[D] Move classification of symbols from the grammar to the lexer.

This makes it so that alternating '.' and identifier tokens are resolved to
symbols as early as possible, which should all the addition of D properties -
such as EXP.sizeof and EXP.typeof - without the shift/reduce conflicts that
would occur in the current parsing strategy.

gdb/ChangeLog

* d-exp.y (%union): Add voidval.
(%token): Add UNKNOWN_NAME as a token to represent an unclassified
name in the lexing stage.
(PostfixExpression): Move symbol completion handling in grammar here
from PrimaryExpression.
(PrimaryExpression): Move routines to handle resolving identifier
tokens in the grammar here from push_expression_name.
(IdentifierExp): Remove the handling of alternating '.' and identifier
tokens.
(TypeExp): Allow TypeExp to be wrapped in parenthesis in the grammar.
(BasicType): Remove C-style typename rules.
(d_type_from_name, d_module_from_name, push_variable)
(push_fieldnames, push_type_name, push_module_name)
(push_expression_name): Remove.
(lex_one_token): Rename from yylex.  Replace pstate with par_state.
(token_and_value): New type.
(token_fifo, popping, name_obstack): New globals.
(classify_name): New function.
(classify_inner_name): Likewise.
(yylex): Likewise.
(d_parse): Initialize token_fifo, popping and name_obstack.

9 years ago[D] Support looking up symbols in the current and imported modules.
Iain Buclaw [Thu, 13 Aug 2015 18:34:15 +0000 (20:34 +0200)]
[D] Support looking up symbols in the current and imported modules.

In D, there is the notion of modules, and importing from one to the other,
whether it is a basic, selective or renamed import declaration.

module A;
import X;
void foo() {
  import Y : bar;
}

If the compiler emits DW_TAG_imported_declaration at the appropriate locations,
then we can make use of what gdb stores in using_direct when performing
nonlocal symbol lookups.

gdb/ChangeLog

* Makefile.in (SFILES): Add d-namespace.c.
(COMMON_OBS): Add d-namespace.o.
* d-lang.c (d_language_defn): Use d_lookup_symbol_nonlocal as the
la_lookup_symbol_nonlocal callback function pointer.
* d-lang.h (d_lookup_symbol_nonlocal): New declaration.
(d_lookup_nested_symbol): New declaration.
* d-namespace.c: New file.

9 years agogdb.base/dso2dso.exp: Improve testcase documentation.
Joel Brobecker [Wed, 12 Aug 2015 20:40:54 +0000 (13:40 -0700)]
gdb.base/dso2dso.exp: Improve testcase documentation.

gdb/testsuite/ChangeLog:

        * gdb.base/dso2dso.exp: Improve the testcase's documentation.

9 years agoFix Python frame unwinder issue caught by Valgrind
Pedro Alves [Thu, 13 Aug 2015 17:56:42 +0000 (18:56 +0100)]
Fix Python frame unwinder issue caught by Valgrind

Valgrind shows:

 ==17026== Invalid write of size 8
 ==17026==    at 0x54AA80: pending_frame_invalidate (py-unwind.c:477)
 ==17026==    by 0x5AB934: do_my_cleanups (cleanups.c:155)
 ==17026==    by 0x5AB9AF: do_cleanups (cleanups.c:177)
 ==17026==    by 0x54B009: pyuw_sniffer (py-unwind.c:606)
 ==17026==    by 0x755DAC: frame_unwind_try_unwinder (frame-unwind.c:105)
 ==17026==    by 0x755EEE: frame_unwind_find_by_frame (frame-unwind.c:160)
 ==17026==    by 0x750FFA: compute_frame_id (frame.c:454)
 ==17026==    by 0x753BD6: get_prev_frame_if_no_cycle (frame.c:1781)
 ==17026==    by 0x754292: get_prev_frame_always_1 (frame.c:1955)
 ==17026==    by 0x7542DA: get_prev_frame_always (frame.c:1971)
 ==17026==    by 0x7547BE: get_prev_frame (frame.c:2213)
 ==17026==    by 0x7532BD: unwind_to_current_frame (frame.c:1450)
 ==17026==  Address 0xd27b570 is 16 bytes inside a block of size 32 free'd
 ==17026==    at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
 ==17026==    by 0x54B276: gdb_Py_DECREF (python-internal.h:185)
 ==17026==    by 0x54B298: py_decref (py-utils.c:34)
 ==17026==    by 0x5AB934: do_my_cleanups (cleanups.c:155)
 ==17026==    by 0x5AB9AF: do_cleanups (cleanups.c:177)
 ==17026==    by 0x54B009: pyuw_sniffer (py-unwind.c:606)
 ==17026==    by 0x755DAC: frame_unwind_try_unwinder (frame-unwind.c:105)
 ==17026==    by 0x755EEE: frame_unwind_find_by_frame (frame-unwind.c:160)
 ==17026==    by 0x750FFA: compute_frame_id (frame.c:454)
 ==17026==    by 0x753BD6: get_prev_frame_if_no_cycle (frame.c:1781)
 ==17026==    by 0x754292: get_prev_frame_always_1 (frame.c:1955)
 ==17026==    by 0x7542DA: get_prev_frame_always (frame.c:1971)
 ==17026==

Simply invalidate the object before releasing it.

gdb/ChangeLog:
2015-08-13  Pedro Alves  <palves@redhat.com>

* python/py-unwind.c (pyuw_sniffer): Install the invalidate
cleanup after the decref cleanup, not before.

9 years agoMass rename `explicit' -> `explicit_loc'.
Keith Seitz [Thu, 13 Aug 2015 16:48:12 +0000 (09:48 -0700)]
Mass rename `explicit' -> `explicit_loc'.

BuildBot reminded me that "explicit" is a reserved keyword in C++.
This patch simply renames all the (illegal) uses of "explicit". This should
fix the build errors with --enable-build-with-cxx bots.

gdb/ChangeLog

* break-catch-throw.c (re_set_exception_catchpoint) Rename
reserved C++ keyword "explicit" to "explicit_loc".
* breakpoint.c (create_overlay_event_breakpoint)
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint, update_static_tracepoint):
Rename reserved C++ keyword "explicit" to "explicit_loc".
* completer.c (collect_explicit_location_matches)
(explicit_location_completer): Rename reserved C++ keyword
"explicit" to "explicit_loc".
* linespec.c (struct linespec) <explicit>: Rename to "explicit_loc".
(canonicalize_linespec, create_sals_line_offset)
(convert_linespec_to_sals, convert_explicit_location_to_sals)
(event_location_to_sals, decode_objc): Rename reserved C++ keyword
"explicit" to "explicit_loc".
* location.c (struct event_location) <explicit>: Rename to
"explicit_loc".
(initialize_explicit_location, new_explicit_location)
(explicit_location_to_string_internal, explicit_location_to_linespec):
Rename reserved C++ keyword "explicit" to "explicit_loc".
* location.h (explicit_location_to_string)
(explicit_location_to_linespec, initialize_explicit_location)
(new_explicit_location): Rename reserved C++ keyword "explicit"
to "explicit_loc".
* mi/mi-cmd-break.c (mi_cmd_break_insert_1): Rename reserved C++
keyword "explicit" to "explicit_loc".

9 years agoIssue an error for read-only segment with dynamic IFUNC relocations
H.J. Lu [Thu, 13 Aug 2015 11:31:38 +0000 (04:31 -0700)]
Issue an error for read-only segment with dynamic IFUNC relocations

To load an ELF binary with DT_TEXTREL tag, the dynamic linker calls
__mprotect on the read-only segment with PROT_READ|PROT_WRITE before
applying dynamic relocation.  It leads to segfault when performing
IFUNC relocations since the read-only segment has no execute permission.
This patch changes x86 linker to issue an error for read-only segment
with dynamic IFUNC relocations.  Other backends with IFUNC support
may need a similar change.

bfd/

PR ld/18801
* elf32-i386.c (elf_i386_size_dynamic_sections): Issue an error
for read-only segment with dynamic IFUNC relocations.
* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.

ld/testsuite/

PR ld/18801
* ld-i386/i386.exp: Run pr18801.
* ld-x86-64/x86-64.exp: Likewise.
* ld-i386/pr18801.d: New file.
* ld-i386/pr18801.s: Likewise.
* ld-x86-64/pr18801.d: Likewise.
* ld-x86-64/pr18801.s: Likewise.

9 years agoFixes for unpredictable nops and 26-bit versions of teq,tst,cmn,cmp.
Andre Vieira [Thu, 13 Aug 2015 10:39:08 +0000 (11:39 +0100)]
Fixes for unpredictable nops and 26-bit versions of teq,tst,cmn,cmp.

opcodes * arm-dis.c (print_insn_arm): Disassembling for all targets V6
and higher with ARM instruction set will now mark the 26-bit
versions of teq,tst,cmn and cmp as UNPREDICTABLE.
(arm_opcodes): Fix for unpredictable nop being recognized as a teq.

test    * gas/arm/nops.d: New.
* gas/arm/nops.s: New.
* gas/arm/inst.d: Changed expectation file for 26-bit  teq,
tst, cmn and cmp.

9 years agoAdd ChangeLog for check_ifunc_attribute_available
H.J. Lu [Thu, 13 Aug 2015 09:48:55 +0000 (02:48 -0700)]
Add ChangeLog for check_ifunc_attribute_available

9 years agoAdd ChangeLog entries for the previous commit
Pierre-Marie de Rodat [Thu, 13 Aug 2015 07:54:09 +0000 (09:54 +0200)]
Add ChangeLog entries for the previous commit

9 years ago[Ada] Add support for subprogram renamings
Pierre-Marie de Rodat [Wed, 22 Jul 2015 13:30:57 +0000 (15:30 +0200)]
[Ada] Add support for subprogram renamings

Consider the following declaration:

    function Foo (I : Integer) return Integer renames Pack.Bar;

As Foo is not materialized as a routine whose name is derived from Foo,
GDB currently cannot use it:

    (gdb) print foo(0)
    No definition of "foo" in current context.

However, compilers can emit DW_TAG_imported_declaration in order to
materialize the fact that Foo is actually another name for Pack.Bar.
This commit enhances the DWARF reader to record global renamings (it
used to put global ones in a static block) and enhances the Ada engine
to leverage this information during symbol lookup.

gdb/ChangeLog:

* ada-lang.c: Include namespace.h
(aux_add_nonlocal_symbols): Fix a function name in comment.
(ada_add_block_renamings): New.
(add_nonlocal_symbols): Add global renamings handling.
(ada_lookup_symbol_list_worker): Move the symbol lookup part
to...
(ada_add_all_symbols): ... this new function.
(ada_add_block_symbols): Try to match the input name against the
"using directives list", perform a recursive symbol lookup on
the matched declarations.
* block.h (struct block): Move the_namespace to top-level as
namespace_info. Remove the language_specific field.
(BLOCK_NAMESPACE): Update access to the namespace_info field.
* buildsym.h (using_directives): Rename into...
(local_using_directives): ... this.
(global_using_directives): New.
(struct context_stack): Rename the using_directives field into
local_using_directives.
* buildsym.c (finish_block_internal): Deal with the proper
using directives repository (local or global).
(prepare_for_building): Reset local_using_directives. Assert
that there is no pending global using directive.
(reset_symtab_globals): Reset global_using_directives and
local_using_directives.
(end_symtab_get_static_block): Don't ignore symtabs that have
only using directives.
(push_context): Update references to local_using_directives.
(buildsym_init): Do not reset using_directives.
* cp-support.c: Include namespace.h.
* cp-support.h (struct using_direct): Move to namespace.h.
(cp_add_using_directives): Move to namespace.h.
* cp-namespace.c: Include namespace.h
(cp_add_using_directive): Move to namespace.c, rename it to
add_using_directive, add a "using_directives" argument and use
it as the pending using directives repository.  All callers
updated.
* dwarf2read.c (using_directives): New.
(read_import_statement): Call using_directives.
(read_func_scope): Update references to local_using_directives.
(read_lexical_block_scope): Likewise.
(read_namespace): Update the heading comment, call
using_directives.
* namespace.h: New file.
* namespace.c: New file.
* Makefile.in (SFILES): Add namespace.c.
(COMMON_OBS): Add namespace.o

gdb/testsuite/ChangeLog:

* gdb.ada/fun_renaming.exp: New testcase.
* gdb.ada/fun_renaming/fun_renaming.adb: New file.
* gdb.ada/fun_renaming/pack.adb: New file.
* gdb.ada/fun_renaming/pack.ads: New file.

Tested on x86_64-linux.  Support for this in GCC is in the pipeline: see
<https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02166.html>.

9 years agogas 0f handling
Alan Modra [Thu, 13 Aug 2015 06:27:15 +0000 (15:57 +0930)]
gas 0f handling

_start:
 .byte 0f-_start
0:

Fixes
..:2: Error: floating point number invalid
..:2: Error: junk at end of line, first unrecognized character is `_'

* expr.c (operand): Rewrite handling of operands starting with "0f".
If atof_generic only parses "-" or "+", treat as expression.

9 years agogas 0b vs 0b0 vs 00b
Alan Modra [Thu, 13 Aug 2015 06:25:31 +0000 (15:55 +0930)]
gas 0b vs 0b0 vs 00b

* expr.c (integer_constant): Return O_absent expression if eol.
(operand): For targets with both LOCAL_LABELS_FB and
NUMBERS_WITH_SUFFIX set, treat "0b" not followed by binary
digits as a local label reference.  Correct handling of 0b prefix.
If a suffix is not allowed, error on 0B.

9 years agoCorrect local label doc
Alan Modra [Thu, 13 Aug 2015 06:21:51 +0000 (15:51 +0930)]
Correct local label doc

* doc/as.texinfo (Local Labels): Allowed range of N in local
labels is non-negative integers, not positive integers.

9 years agogdb.base/dso2dso.exp sometimes broken
Keith Seitz [Thu, 13 Aug 2015 01:31:11 +0000 (18:31 -0700)]
gdb.base/dso2dso.exp sometimes broken

Keith reported that gdb.base/dso2dso.exp is broken, with the following
error:

| $ make check RUNTESTFLAGS=dso2dso.exp
| [snip]
| Running ../../../src/gdb/testsuite/gdb.base/dso2dso.exp ...
| ERROR: tcl error sourcing ../../../src/gdb/testsuite/gdb.base/dso2dso.exp.
| ERROR: couldn't open
| "../../../src/gdb/testsuite/gdb.base/../../../src/gdb/testsuite/gdb.base/dso2dso-dso1.c":
| no such file or directory
|     while executing
| "error "$message""
|     (procedure "gdb_get_line_number" line 14)
|     invoked from within
| "gdb_get_line_number "STOP HERE" $srcfile_libdso1"
|     (file "../../../src/gdb/testsuite/gdb.base/dso2dso.exp" line 60)
|     invoked from within
| "source ../../../src/gdb/testsuite/gdb.base/dso2dso.exp"
|     ("uplevel" body line 1)
|     invoked from within
| "uplevel #0 source ../../../src/gdb/testsuite/gdb.base/dso2dso.exp"
|     invoked from within
| "catch "uplevel #0 source $test_file_name""

This happens because gdb_get_line_number will prepend $srcdir/$subdir
if the given filename does not start with "/", and this happens when
GDB was configured using a relative path to the configure script.
When using an absolute path like I do, we avoid the pre-pending that
Keith is seeing.

gdb/testsuite/ChangeLog:

        Keith Seitz  <keiths@redhat.com>:
        * gdb.base/dso2dso.exp: Pass basename of source file in call
        to gdb_get_line_number.

Tested on x86_64-linux with both scenarios.

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

9 years agoSet EI_OSABI to ELFOSABI_GNU for local IFUNC symbols
H.J. Lu [Wed, 12 Aug 2015 20:31:29 +0000 (13:31 -0700)]
Set EI_OSABI to ELFOSABI_GNU for local IFUNC symbols

Since the backend elf_add_symbol_hook isn't called on local symbols,
the EI_OSABI field isn't to ELFOSABI_GNU where are local IFUNC symbols.
This patch changes the x86 backends to set has_gnu_symbols if there are
relocations against IFUNC symbols.  Other backends with IFUNC support
may need a similar change.

This patch also changes the type of has_gnu_symbols from bfd_boolean to
enum elf_gnu_symbols.

bfd/

PR ld/18815
* elf-bfd.h (elf_gnu_symbols): New enum.
(elf_obj_tdata): Use elf_gnu_symbols on has_gnu_symbols.
* elf-s390-common.c (elf_s390_add_symbol_hook): Set
has_gnu_symbols to elf_gnu_symbol_any.
* elf32-arm.c (elf32_arm_add_symbol_hook): Likewise.
* elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
* lfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise.
* elf32-i386.c (elf_i386_check_relocs): Update has_gnu_symbols
if there are relocations against IFUNC symbols.
(elf_i386_add_symbol_hook): Don't check STT_GNU_IFUNC here.
* elf64-x86-64. (elf_x86_64_check_relocs): Update has_gnu_symbols
if there are relocations against IFUNC symbols.
(elf_x86_64_add_symbol_hook): Don't check STT_GNU_IFUNC here.

ld/testsuite/

PR ld/18815
* ld-i386/i386.exp: Run pr18815.
* ld-x86-64/x86-64.exp: Likewise.
* ld-i386/pr18815.d: New file.
* ld-i386/pr18815.s: Likewise.
* ld-x86-64/pr18815.d: Likewise.
* ld-x86-64/pr18815.s: Likewise.

9 years ago[amd64] Invalid return address after displaced stepping
Joel Brobecker [Wed, 12 Aug 2015 16:33:19 +0000 (09:33 -0700)]
[amd64] Invalid return address after displaced stepping

Making all-stop run on top of non-stop caused a small regression
in behavior. This was observed on x86_64-linux. The attached testcase
is in C whereas the investigation was done with an Ada program,
but it's the same scenario, and using a C testcase allows wider testing.
Basically: I am debugging a single-threaded program, and currently
stopped inside a function provided by a shared-library, at a line
calling a subprogram provided by a second shared library, and trying
to "next" over that function call.

Before we changed the default all-stop behavior, we had:

    7             Impl_Initialize;  -- Stop here and try "next" over this line
    (gdb) n
    8             return 5;  <<-- OK

But now, "next" just stops much earlier:

    (gdb) n
    0x00007ffff7bd8560 in impl.initialize@plt () from /[...]/lib/libpck.so

What happens is that next stops at a call instruction, which calls
the function's PLT, and GDB fails to notice that the inferior stepped
into a subroutine, and so decides that we're done. We can see another
symptom of the same issue by looking at the backtrace at the point
GDB stopped:

    (gdb) bt
    #0  0x00007ffff7bd8560 in impl.initialize@plt ()
       from /[...]/lib/libpck.so
    #1  0x00000000f7bd86f9 in ?? ()
    #2  0x00007fffffffdf50 in ?? ()
    #3  0x0000000000401893 in a () at /[...]/a.adb:7
    Backtrace stopped: frame did not save the PC

With a functioning GDB, the backtrace looks like the following instead:

    #0  0x00007ffff7bd8560 in impl.initialize@plt ()
       from /[...]/lib/libpck.so
    #1  0x00007ffff7bd86f9 in sub () at /[...]/pck.adb:7
    #2  0x0000000000401893 in a () at /[...]/a.adb:7

Note how, for frame #1, the address looks quite similar, except
for the high-order bits not being set:

    #1  0x00007ffff7bd86f9 in sub () at /[...]/pck.adb:7   <<<--  OK
    #1  0x00000000f7bd86f9 in ?? ()                        <<<--  WRONG
              ^^^^
              ||||
              Wrong

Investigating this further led me to displaced stepping.
As we are "next"-ing from a location where a breakpoint is inserted,
we need to step out of it, and since we're on non-stop mode, we need
to do it using displaced stepping. And looking at
amd64-tdep.c:amd64_displaced_step_fixup, I found the code that handles
the return address:

    regcache_cooked_read_unsigned (regs, AMD64_RSP_REGNUM, &rsp);
    retaddr = read_memory_unsigned_integer (rsp, retaddr_len, byte_order);
    retaddr = (retaddr - insn_offset) & 0xffffffffUL;

The mask used to compute retaddr looks wrong to me, keeping only
4 bytes instead of 8, and explains why the high order bits of
the backtrace are unset. What happens is that, after the displaced
stepping has completed, GDB restores that return address at the location
where the program expects it.  But because the top half bits of
the address have been masked out, the return address is now invalid.
The incorrect behavior of the "next" command and the backtrace at
that location are the first symptoms of that.  Another symptom is
that this actually alters the behavior of the program, where a "cont"
from there soon leads to a SEGV when the inferior tries to jump back
to that incorrect return address:

    (gdb) c
    Continuing.

    Program received signal SIGSEGV, Segmentation fault.
    0x00000000f7bd86f9 in ?? ()
    ^^^^^^^^^^^^^^^^^^

This patch fixes the issue by using a mask that seems more appropriate
for this architecture.

gdb/ChangeLog:

        * amd64-tdep.c (amd64_displaced_step_fixup): Fix the mask used to
        compute RETADDR.

gdb/testsuite/ChangeLog:

        * gdb.base/dso2dso-dso2.c, gdb.base/dso2dso-dso2.h,
        gdb.base/dso2dso-dso1.c, gdb.base/dso2dso-dso1.h, gdb.base/dso2dso.c,
        gdb.base/dso2dso.exp: New files.

Tested on x86_64-linux, no regression.

9 years agoInitialize `location' in gdbpy_decode_line
Keith Seitz [Wed, 12 Aug 2015 18:31:24 +0000 (11:31 -0700)]
Initialize `location' in gdbpy_decode_line

BuildBot flagged an uninitialized variable coming from one of the patches
in my recently committed locations/explicit patchset.

The following patch fixes this.

gdb/ChangeLog

* python/python.c (gdbpy_decode_line): Initialize `location' to NULL
and only call decode_line_1 when it is non-NULL.

diff --git a/gdb/python/python.c b/gdb/python/python.c
index c28f98b..14da62c 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -730,7 +730,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
   PyObject *result = NULL;
   PyObject *return_result = NULL;
   PyObject *unparsed = NULL;
-  struct event_location *location;
+  struct event_location *location = NULL;

   if (! PyArg_ParseTuple (args, "|s", &arg))
     return NULL;
@@ -747,7 +747,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)

   TRY
     {
-      if (arg)
+      if (location != NULL)
  sals = decode_line_1 (location, 0, 0, 0);
       else
  {

9 years agoxtensa: add --auto-litpools option
Max Filippov [Wed, 29 Jul 2015 14:42:54 +0000 (17:42 +0300)]
xtensa: add --auto-litpools option

Auto-litpools is the automated version of text-section-literals: literal
pool candidate frags are planted every N frags and during relaxation
they are turned into actual literal pools where literals are moved to
become reachable for their first reference by L32R instruction.

2015-08-12  David Weatherford  <weath@cadence.com>
gas/
* config/tc-xtensa.c (struct litpool_frag, struct litpool_seg):
New structures.
(xtensa_maybe_create_literal_pool_frag): New function.
(litpool_seg_list, auto_litpools, auto_litpool_limit)
(litpool_buf, litpool_slotbuf): New static variables.
(option_auto_litpools, option_no_auto_litpools)
(option_auto_litpool_limit): New enum identifiers.
(md_longopts): Add entries for auto-litpools, no-auto-litpools
and auto-litpool-limit.
(md_parse_option): Handle option_auto_litpools,
option_no_auto_litpools and option_auto_litpool_limit.
(md_show_usage): Add help for --[no-]auto-litpools and
--auto-litpool-limit.
(xtensa_mark_literal_pool_location): Record a place for literal
pool with a call to xtensa_maybe_create_literal_pool_frag.
(get_literal_pool_location): Find highest priority literal pool
or convert candidate to literal pool when auto-litpools are used.
(xg_assemble_vliw_tokens): Create literal pool after jump
instruction.
(xtensa_check_frag_count): Create candidate literal pool every
auto_litpool_limit frags.
(xtensa_relax_frag): Add jump around literals to non-empty
literal pool.
(xtensa_move_literals): Estimate literal pool addresses and move
unreachable literals closer to their users, converting candidate
to literal pool if needed.
(xtensa_switch_to_non_abs_literal_fragment): Only emit error
about missing .literal_position in case auto-litpools are not
used.
* config/tc-xtensa.h (xtensa_relax_statesE): New relaxation
state: RELAX_LITERAL_POOL_CANDIDATE_BEGIN.
* doc/as.texinfo (Xtensa options):  Document --auto-litpools and
--no-auto-litpools options.
* doc/c-xtensa.texi (Xtensa options): Likewise.

2015-08-12  Max Filippov  <jcmvbkbc@gmail.com>
gas/testsuite/
* gas/xtensa/all.exp: Add auto-litpools to the list of xtensa
tests.
* gas/xtensa/auto-litpools.s: New file: auto-litpools test.
* gas/xtensa/auto-litpools.s: New file: auto-litpools test
result pattern.

9 years agoGuarantee save-and-restore of GDBFLAGS on gdb.base/checkpoint-ns.exp
Sergio Durigan Junior [Wed, 12 Aug 2015 16:32:16 +0000 (12:32 -0400)]
Guarantee save-and-restore of GDBFLAGS on gdb.base/checkpoint-ns.exp

Keith found out that several tests were failing when testing the
native-gdbserver board on Fedora (x86_64).  Strangely, these failures
had not been reported by our BuildBot.  Later, he found that the reason
for this was because the failures only happened when running the
testsuite without FORCE_PARALLEL (i.e., on serial mode; maybe it would
be worth having a builder testing things on serial...).  Then, he
decided to start bisecting the changes to see which one introduced the
failure (it was not trivial to know this only by looking at gdb.log).

After a lot of time, he found that Pedro's commit
e1316e60d4d1fe406efc6e7536b2bdb43733e9d2 was the culprit.  There was
nothing wrong in the code, but the new gdb.base/checkpoint-ns.exp
testcase did something that left the GDBFLAGS variable in an
inconsistent state.  This test works by modifying this variable to set
non-stop on, sourcing gdb.base/checkpoint.exp (which does the hard
work), and then restoring the old value on GDBFLAGS.  However, this was
not working because gdb.base/checkpoint.exp bails out if it is being
tested on gdbserver, and when it calls "continue" the control goes back
to the function calling the tests, and not to
gdb.base/checkpoint-ns.exp.

The fix is simple: just wrap the "source" call, and make
gdb.base/checkpoint-ns.exp aware of the "continue"/"return" calls made
by gdb.base/checkpoint.exp.

gdb/testsuite/ChangeLog:
2015-08-12  Sergio Durigan Junior  <sergiodj@redhat.com>
    Pedro Alves  <palves@redhat.com>
    Keith Seitz  <keiths@redhat.com>

* gdb.base/checkpoint-ns.exp: Use save_vars to save and restore
GDBFLAGS.

9 years ago[MIPS] Map 'move' to 'or'.
Simon Dardis [Wed, 12 Aug 2015 16:06:35 +0000 (17:06 +0100)]
[MIPS] Map 'move' to 'or'.

The MIPS assembly idiom 'move' now maps to the 'or' machine instruction. This
change affects microMIPS, MIPS32, MIPS64.

2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>

opcodes/

* micromips-opc.c (micromips_opcodes): Re-order table so that move
based on 'or' is first.
* mips-opc.c (mips_builtin_opcodes): Ditto.

bfd/

* elfxx-mips.c (STUB_MOVE): Change to use 'or' only.
(mips_o32_exec_plt0_entry, mips_n32_exec_plt0_entry,
mips_n64_exec_plt0_entry, micromips_insn32_o32_exec_plt0_entry):
Update to use 'or' instead of 'addu/daddu'.
(_bfd_mips_elf_finish_dynamic_symbol): Update usage of STUB_MOVE.
(move_insns_32): Reorder table.

gas/

* config/tc-mips.c (move_register): Change to use 'or' only.
(s_cpload, s_cpsetup, s_cprestore, s_cpreturn): Update to
use or for move.

gas/testsuite/

* gas/mips/elf-rel23.d: Update test.
* gas/mips/elf-rel23.d: Ditto.
* gas/mips/elf-rel23a.d: Ditto.
* gas/mips/elf-rel23b.d: Ditto.
* gas/mips/elf_e_flags1.d: Ditto.
* gas/mips/elf_e_flags2.d: Ditto.
* gas/mips/elf_e_flags3.d: Ditto.
* gas/mips/elf_e_flags4.d: Ditto.
* gas/mips/loc-swap-dis.d: Ditto.
* gas/mips/micromips-insn32.d: Ditto.
* gas/mips/micromips-noinsn32.d: Ditto.
* gas/mips/micromips-trap.d: Ditto.
* gas/mips/micromips.d: Ditto.
* gas/mips/mips-abi32-pic.d: Ditto.
* gas/mips/mips-abi32.d: Ditto.
* gas/mips/mips-gp32-fp32-pic.d: Ditto.
* gas/mips/mips-gp32-fp32.d: Ditto.
* gas/mips/mips-gp32-fp64-pic.d: Ditto.
* gas/mips/mips-gp32-fp64.d: Ditto.
* gas/mips/mips-gp64-fp32-pic.d: Ditto.
* gas/mips/mips-gp64-fp32.d: Ditto.
* gas/mips/mips-gp64-fp64-pic.d: Ditto.
* gas/mips/mips-gp64-fp64.d: Ditto.
* gas/mips/mipsr6@loc-swap-dis.d: Ditto.
* gas/mips/tls-o32.d: Ditto.
* gas/mips/uld2-eb.d: Ditto.
* gas/mips/uld2-el.d: Ditto.
* gas/mips/ulw2-eb-ilocks.d: Ditto.
* gas/mips/ulw2-eb.d: Ditto.
* gas/mips/ulw2-el-ilocks.d: Ditto.
* gas/mips/ulw2-el.d: Ditto.
* gas/mips/move.d: New test.
* gas/mips/move.s: Ditto.
* gas/mips/micromips32-move.d: Ditto.
* gas/mips/micromips32-move.s: Ditto.
* gas/mips/mips.exp: Run the new tests.

gold/

* mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
lazy_stub_normal_1, lazy_stub_normal_1_n64,
lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
of 'addu/daddu'.

ld/testsuite/

* ld-mips-elf/compressed-plt-1-n32-mips16.od: Update test.
* ld-mips-elf/compressed-plt-1-n32-umips.od: Ditto.
* ld-mips-elf/compressed-plt-1-o32-mips16-got.od: Ditto.
* ld-mips-elf/compressed-plt-1-o32-mips16-only.od: Ditto.
* ld-mips-elf/compressed-plt-1-o32-mips16-word.od: Ditto.
* ld-mips-elf/compressed-plt-1-o32-mips16.od: Ditto.
* ld-mips-elf/compressed-plt-1-o32-se.od: Ditto.
* ld-mips-elf/compressed-plt-1-o32-umips-got.od: Ditto.
* ld-mips-elf/compressed-plt-1-o32-umips-word.od: Ditto.
* ld-mips-elf/compressed-plt-1-o32-umips.od: Ditto.
* ld-mips-elf/jalx-2.dd: Ditto.
* ld-mips-elf/mips16-pic-3.dd: Ditto.
* ld-mips-elf/pic-and-nonpic-3a.dd: Ditto.
* ld-mips-elf/pic-and-nonpic-3b.dd: Ditto.
* ld-mips-elf/pic-and-nonpic-5b.dd: Ditto.
* ld-mips-elf/pic-and-nonpic-6-n32.dd: Ditto.
* ld-mips-elf/pic-and-nonpic-6-o32.dd: Ditto.
* ld-mips-elf/stub-dynsym-1-10000.d: Ditto.
* ld-mips-elf/stub-dynsym-1-2fe80.d: Ditto.
* ld-mips-elf/stub-dynsym-1-7fff.d: Ditto.
* ld-mips-elf/stub-dynsym-1-8000.d: Ditto.
* ld-mips-elf/stub-dynsym-1-fff0.d: Ditto.
* ld-mips-elf/tlsbin-o32.d: Ditto.
* ld-mips-elf/tlsdyn-o32-1.d: Ditto.
* ld-mips-elf/tlsdyn-o32-2.d: Ditto.
* ld-mips-elf/tlsdyn-o32-3.d: Ditto.
* ld-mips-elf/tlsdyn-o32.d: Ditto.
* ld-mips-elf/tlslib-o32.d: Ditto.

9 years agoUse save_vars to replace existing manipulation of globals in tests
Patrick Palka [Fri, 19 Jun 2015 01:47:55 +0000 (21:47 -0400)]
Use save_vars to replace existing manipulation of globals in tests

gdb/testsuite/ChangeLog:

* gdb.base/gdbhistsize-history.exp
(test_histsize_history_setting): Use save_vars.
* gdb.base/gdbinit-history.exp (test_gdbinit_history_setting):
Use save_vars.
(test_no_truncation_of_unlimited_history_file): Use save_vars.
* gdb.base/readline.exp: Use save_vars.

9 years agoRemove ChangeLog separator
Alan Modra [Wed, 12 Aug 2015 09:36:01 +0000 (19:06 +0930)]
Remove ChangeLog separator

9 years agoIntroduce save_vars, a testsuite proc for safely manipulating globals
Patrick Palka [Fri, 19 Jun 2015 01:33:26 +0000 (21:33 -0400)]
Introduce save_vars, a testsuite proc for safely manipulating globals

gdb/testsuite/ChangeLog:

* lib/gdb.exp (save_vars): New proc.

9 years ago[AArch64] Fix test failures on elf configuration
Jiong Wang [Wed, 12 Aug 2015 12:17:50 +0000 (13:17 +0100)]
[AArch64] Fix test failures on elf configuration

This patch fixed those failures on elf configuration by:

   * Improve the ILP32 target selector "aarch64_choose_ilp32_emul",
     makes it more robust. Target triples copied from configure.tgt

   * Updated emit-relocs-86/-overflow.d to use aarch64_choose_ilp32_emul
     which is following what have done with emit-relocs-28.

   * Those instruction encoding mismatch is because those encoding
     contains pc-relative address. As for elf, we may have different
     start address. relaxed encodind check, especially for
     aarch64-farcall-b/bl-plt, as the main purpose of those check are
     ELF text/data layout, we just want to make sure veneer to plt stub
     is generated.

2015-08-12  Jiong Wang  <jiong.wang@arm.com>

ld/testsuite/
  * ld-aarch64/aarch64-elf.exp (aarch64_choose_ilp32_emul): Support all
  four triple shapes: aarch64-*-linux*, aarch64-*-elf,
  aarch64_be-*-linux*, aarch64_be-*-elf.
  * ld-aarch64/emit-relocs-86.d: Use aarch64_choose_ilp32_emul.
  * ld-aarch64/emit-relocs-86-overflow.d: Likewise.
  * ld-aarch64/ld-aarch64/farcall-b-plt.d: Relax instrucion encoding
  check when they reflect address.
  * ld-aarch64/ld-aarch64/farcall-bl-plt.d: Likewise.

9 years agoSync ansidecl.h with GCC
H.J. Lu [Wed, 12 Aug 2015 12:02:21 +0000 (05:02 -0700)]
Sync ansidecl.h with GCC

Sync with GCC
2015-08-11  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

* ansidecl.h (GCC_FINAL): New macro.

9 years agoRemove trailing spaces in ld
H.J. Lu [Wed, 12 Aug 2015 11:46:43 +0000 (04:46 -0700)]
Remove trailing spaces in ld

9 years agoRemove trailing spaces in opcodes
H.J. Lu [Wed, 12 Aug 2015 11:45:07 +0000 (04:45 -0700)]
Remove trailing spaces in opcodes

9 years agoRemove trailing spaces in gprof
H.J. Lu [Wed, 12 Aug 2015 11:43:32 +0000 (04:43 -0700)]
Remove trailing spaces in gprof

9 years agoRemove trailing spaces in binutils
H.J. Lu [Wed, 12 Aug 2015 11:42:37 +0000 (04:42 -0700)]
Remove trailing spaces in binutils

9 years agoRemove trailing spaces in gas
H.J. Lu [Wed, 12 Aug 2015 11:40:42 +0000 (04:40 -0700)]
Remove trailing spaces in gas

9 years agoRemove trailing spaces in bfd
H.J. Lu [Wed, 12 Aug 2015 11:32:43 +0000 (04:32 -0700)]
Remove trailing spaces in bfd

9 years agoUpdate Swedish translation in gprof.
Nick Clifton [Wed, 12 Aug 2015 10:50:26 +0000 (11:50 +0100)]
Update Swedish translation in gprof.

* po/sv.po: Updated Swedish translation.

9 years ago[regression] Do not read from catchpoint/watchpoint locations' addresses when checkin...
Luis Machado [Wed, 12 Aug 2015 08:36:09 +0000 (05:36 -0300)]
[regression] Do not read from catchpoint/watchpoint locations' addresses when checking for a permanent breakpoint

While running bare-metal tests with GDB i noticed some failures in
gdb.base/break.exp, related to the use of the catch commands.

It turns out GDB tries to access memory address 0x0 whenever one tries
to insert a catchpoint, which should obviously not happen.

This was introduced with the changes for permanent breakpoints. In special,
bp_loc_is_permanent tries to check if there is a breakpoint inserted at
the same address as the current breakpoint's location's address. In the
case of catchpoints, this is 0x0.

(top-gdb) catch fork
Sending packet: $m0,1#fa...Packet received: E01
Catchpoint 4 (fork)

(top-gdb) catch vfork
Sending packet: $m0,1#fa...Packet received: E01
Catchpoint 5 (vfork)

It is not obvious to detect because this fails silently for Linux. For our
bare-metal testing, though, this fails with a clear error message from the
target about not being able to read such address.

The attached patch addresses this by bailing out of bp_loc_is_permanent (...)
if the location address is not meaningful. I also took the opportunity to
update the comment for breakpoint_address_is_meaningful, which mentioned
breakpoint addresses as opposed to their locations' addresses.

gdb/ChangeLog:

2015-08-11  Luis Machado  <lgustavo@codesourcery.com>

* breakpoint.c (bp_loc_is_permanent): Return 0 when breakpoint
location address is not meaningful.
(breakpoint_address_is_meaningful): Update comment.

9 years agoProperly skip IFUNC relocations in debug sections
H.J. Lu [Wed, 12 Aug 2015 02:04:38 +0000 (19:04 -0700)]
Properly skip IFUNC relocations in debug sections

Use "continue" instead of "break" to skip IFUNC relocations in debug
sections.

* elf32-i386.c (elf_i386_relocate_section): Properly skip IFUNC
relocations in debug sections.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

9 years ago[AArch64] Rename relocs-257-symbolic-func ld test to relocs-1027-symbolic-func.
Thomas Preud'homme [Wed, 12 Aug 2015 01:31:04 +0000 (09:31 +0800)]
[AArch64] Rename relocs-257-symbolic-func ld test to relocs-1027-symbolic-func.

2015-08-12  Thomas Preud'homme  <thomas.preudhomme@arm.com>

ld/testsuite/
    * ld-aarch64/aarch64-elf.exp: Rename relocs-257-symbolic-func to
    relocs-1027-symbolic-func.
    * ld-aarch64/relocs-257-symbolic-func.d: Rename to ...
    * ld-aarch64/relocs-1027-symbolic-func.d: ... this.
    * ld-aarch64/relocs-257-symbolic-func.s: Rename to ...
    * ld-aarch64/relocs-1027-symbolic-func.s: ... this.

9 years agoExplicit locations: documentation updates
Keith Seitz [Wed, 12 Aug 2015 00:09:36 +0000 (17:09 -0700)]
Explicit locations: documentation updates

This patch adds documentation for explicit locations to both the
User Manual and gdb's online help system.

gdb/ChangeLog:

* NEWS: Mention explicit locations.
* breakpoint.c [LOCATION_HELP_STRING]: New macro.
[BREAK_ARGS_HELP]: Use LOCATION_HELP_STRING.
(_initialize_breakpoint): Update documentation for
"clear", "break", "trace", "strace", "ftrace", and "dprintf".

gdb/doc/ChangeLog:

* gdb.texinfo (Thread-Specific Breakpoints, Printing Source Lines):
Use "location(s)"instead of "linespec(s)".
(Specifying a Location): Rewrite.
Add subsections describing linespec, address, and explicit locations.
Add node/menu for each subsection.
(Source and Machine Code, C Preprocessor Macros)
(Create and Delete Trace points)
(Extensions for Ada Tasks): Use "location(s)" instead of "linespec(s)".
(Continuing at a Different Address): Remove "linespec" examples.
Add reference to "Specify a Location"
(The -break-insert Command): Rewrite.  Add anchor.
Add reference to appropriate manual section discussing locations.
(The -dprintf-insert Command): Refer to -break-insert for
specification of 'location'.

gdb/testsuite/ChangeLog:

* gdb.base/help.exp: Update help_breakpoint_text.

9 years agoExplicit locations: MI support for explicit locations
Keith Seitz [Wed, 12 Aug 2015 00:09:36 +0000 (17:09 -0700)]
Explicit locations: MI support for explicit locations

This patch adds support for explicit locations to MI's -break-insert
command. The new options, documented in the User Manual, are
--source, --line, --function, and --label.

gdb/ChangeLog:

* mi/mi-cmd-break.c (mi_cmd_break_insert_1): Add support for
explicit locations, options "--source", "--function",
"--label", and "--line".

gdb/testsuite/ChangeLog:

* gdb.mi/mi-break.exp (test_explicit_breakpoints): New proc.
(at toplevel): Call test_explicit_breakpoints.
* gdb.mi/mi-dprintf.exp: Add tests for explicit dprintf
breakpoints.
* lib/mi-support.exp (mi_make_breakpoint): Add support for
breakpoint conditions, "-cond".

9 years agoExplicit locations: add UI features for CLI
Keith Seitz [Wed, 12 Aug 2015 00:09:36 +0000 (17:09 -0700)]
Explicit locations: add UI features for CLI

This patch exposes explicit locations to the CLI user.  This enables
users to "explicitly" specify attributes of the breakpoint location
to avoid any ambiguity that might otherwise exist with linespecs.

The general syntax of explicit locations is:
-source SOURCE_FILENAME -line {+-}LINE -function FUNCTION_NAME
-label LABEL_NAME

Option names may be abbreviated, e.g., "-s SOURCE_FILENAME -li 3" and users
may use the completer with either options or values.

gdb/ChangeLog:

* completer.c: Include location.h.
(enum match_type): New enum.
(location_completer): Rename to ...
(linespec_completer): ... this.
(collect_explicit_location_matches, backup_text_ptr)
(explicit_location_completer): New functions.
(location_completer): "New" function; handle linespec
and explicit location completions.
(complete_line_internal): Remove all location completer-specific
handling.
* linespec.c (linespec_lexer_lex_keyword, is_ada_operator)
(find_toplevel_char): Export.
(linespec_parse_line_offset): Export.
Issue error if STRING is not numerical.
(gdb_get_linespec_parser_quote_characters): New function.
* linespec.h (linespec_parse_line_offset): Declare.
(get_gdb_linespec_parser_quote_characters): Declare.
(is_ada_operator): Declare.
(find_toplevel_char): Declare.
(linespec_lexer_lex_keyword): Declare.
* location.c (explicit_to_event_location): New function.
(explicit_location_lex_one): New function.
(string_to_explicit_location): New function.
(string_to_event_location): Handle explicit locations.
* location.h (explicit_to_event_location): Declare.
(string_to_explicit_location): Declare.

gdb/testsuite/ChangeLog:

* gdb.linespec/3explicit.c: New file.
* gdb.linespec/cpexplicit.cc: New file.
* gdb.linespec/cpexplicit.exp: New file.
* gdb.linespec/explicit.c: New file.
* gdb.linespec/explicit.exp: New file.
* gdb.linespec/explicit2.c: New file.
* gdb.linespec/ls-errs.exp: Add explicit location tests.
* lib/gdb.exp (capture_command_output): Regexp-escape `command'
before using in the matching pattern.
Clarify that `prefix' is a regular expression.

9 years agoExplicit locations: introduce explicit locations
Keith Seitz [Wed, 12 Aug 2015 00:09:35 +0000 (17:09 -0700)]
Explicit locations: introduce explicit locations

This patch add support for explicit locations and switches many linespec
locations to this new location type.  This patch also converts all
linespec locations entered by the user to an explicit representation
internally (thus bypassing the linespec parser when resetting the
breakpoint).

This patch does not introduce any user-visible changes.

gdb/ChangeLog:

* break-catch-throw.c (re_set_exception_catchpoint): Convert
linespec into explicit location.
* breakpoint.c (create_overlay_breakpoint)
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint): Convert linespec into explicit
location.
(update_static_tracepoint): Convert linespec into explicit location.
* linespec.c (enum offset_relative_sign, struct line_offset): Move
location.h.
(struct linespec) <expression, expr_pc, source_filename>
<function_name, label_name, line_offset>: Replace with ...
<explicit>: ... this.
<is_linespec>: New member.
(PARSER_EXPLICIT): New accessor macro.
(undefined_label_error): New function.
(source_file_not_found_error): New function.
(linespec_parse_basic): The parser result is now an explicit location.
Use PARSER_EXPLICIT to access it.
Use undefined_label_error.
(canonicalize_linespec): Convert canonical linespec into explicit
location.
Move string representation of location to explicit_location_to_linespec
and use it and explicit_location_to_string to save string
representations of the canonical location.
(create_sals_line_offset, convert_linespec_to_sals): `ls' contains an
explicit location.  Update all references.
(convert_explicit_location_to_sals): New function.
(parse_linespec): Use PARSER_EXPLICIT to access the parser
result's explicit location.
(linespec_state_constructor): Initialize is_linespec.
Use PARSER_EXPLICIT.
(linespec_parser_delete): Use PARSER_EXPLICIT to access the parser's
result.
(event_location_to_sals): For linespec locations, set is_linespec.
Handle explicit locations.
(decode_objc): 'ls' contains an explicit location now. Update all
references.
(symtabs_from_filename): Use source_file_not_found_error.
* location.c (struct event_location.u) <explicit>: New member.
(initialize_explicit_location): New function.
(initialize_event_location): Initialize explicit locations.
(new_explicit_location, get_explicit_location)
(get_explicit_location_const): New functions.
(explicit_to_string_internal): New function; most of contents moved
from canonicalize_linespec.
(explicit_location_to_string): New function.
(explicit_location_to_linespec): New function.
(copy_event_location, delete_event_location)
(event_location_to_string_const, event_location_empty_p): Handle
explicit locations.
* location.h (enum offset_relative_sign, struct line_offset): Move
here from linespec.h.
(enum event_location_type): Add EXPLICIT_LOCATION.
(struct explicit_location): New structure.
(explicit_location_to_string): Declare.
(explicit_location_to_linespec): Declare.
(new_explicit_location, get_explicit_locationp
(get_explicit_location_const, initialize_explicit_location): Declare.

9 years agoExplicit locations: introduce probe locations
Keith Seitz [Wed, 12 Aug 2015 00:09:35 +0000 (17:09 -0700)]
Explicit locations: introduce probe locations

This patch adds support for probe locations and converts existing
probe linespec locations to the new location type.

gdb/ChangeLog:

* break-catch-throw.c (re_set_exception_catchpoint): Convert
linespec for stap probe to probe location.
* breakpoint.c (create_longjmp_master_breakpoint)
(create_exception_master_breakpoint): Likewise.
(break_command_1): Remove local variable `arg_cp'.
Check location type to set appropriate breakpoint ops methods.
(trace_command): Likewise.
* linespec.c (event_location_to_sals): Assert on probe locations.
* location.c (EL_PROBE): Add macro definition.
(new_probe_location, get_probe_location): New functions.
(copy_event_location, delete_event_location, event_location_to_string)
(string_to_event_location, event_location_empty_p): Handle probe
locations.
* location.h (enum event_location_type): Add PROBE_LOCATION.
(new_probe_location, get_probe_location): Declare.
* probe.c (parse_probes): Assert that LOCATION is a probe location.
Convert linespec into probe location.

9 years agoExplicit locations: introduce address locations
Keith Seitz [Wed, 12 Aug 2015 00:09:35 +0000 (17:09 -0700)]
Explicit locations: introduce address locations

This patch adds support for address locations, of the form "*ADDR".
[Support for address linespecs has been removed/replaced by this "new"
location type.] This patch also converts any existing address locations
from its previous linespec type.

gdb/ChangeLog:

* breakpoint.c (create_thread_event_breakpoint, init_breakpoint_sal):
Convert linespec to address location.
* linespec.c (canonicalize_linespec): Do not handle address
locations here.
(convert_address_location_to_sals): New function; contents moved
from ...
(convert_linespc_to_sals): ... here.
(parse_linespec): Remove address locations from linespec grammar.
Remove handling of address locations.
(linespec_lex_to_end): Remove handling of address linespecs.
(event_location_to_sals): Handle ADDRESS_LOCATION.
(linespec_expression_to_pc): Export.
* linespec.h (linespec_expression_to_pc): Add declaration.
* location.c (struct event_location.u) <address>: New member.
(new_address_location, get_address_location): New functions.
(copy_event_location, delete_event_location, event_location_to_string)
(string_to_event_location, event_location_empty_p): Handle address
locations.
* location.h (enum event_location_type): Add ADDRESS_LOCATION.
(new_address_location, get_address_location): Declare.
* python/py-finishbreakpoint.c (bpfinishpy_init): Convert linespec
to address location.
* spu-tdep.c (spu_catch_start): Likewise.

9 years agoExplicit locations: use new location API
Keith Seitz [Wed, 12 Aug 2015 00:09:35 +0000 (17:09 -0700)]
Explicit locations: use new location API

This patch converts the code base to use the new struct event_location
API being introduced. This patch preserves the current functionality and
adds no new features.

The "big picture" API usage introduced by this patch may be illustrated
with a simple exmaple. Where previously developers would write:

void
my_command (char *arg, int from_tty)
{
   create_breakpoint (..., arg, ...);
   ...
}

one now uses:

void
my_command (char *arg, int from_tty)
{
   struct event_locaiton *location;
   struct cleanup *back_to;

   location = string_to_event_locaiton (&arg, ...);
   back_to = make_cleanup_delete_event_location (location);
   create_breakpoint (..., location, ...);
   do_cleanups (back_to);
}

Linespec-decoding functions (now called location-decoding) such as
decode_line_full no longer skip argument pointers over processed input.
That functionality has been moved into string_to_event_location as
demonstrated above.

gdb/ChangeLog

* ax-gdb.c: Include location.h.
(agent_command_1) Use linespec location instead of address
string.
* break-catch-throw.c: Include location.h.
(re_set_exception_catchpoint): Use linespec locations instead
of address strings.
* breakpoint.c: Include location.h.
(create_overlay_event_breakpoint, create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint, update_breakpoints_after_exec):
Use linespec location instead of address string.
(print_breakpoint_location):  Use locations and
event_location_to_string.
Print extra_string for pending locations for non-MI streams.
(print_one_breakpoint_location): Use locations and
event_location_to_string.
(init_raw_breakpoint_without_location): Initialize b->location.
(create_thread_event_breakpoint): Use linespec location instead of
address string.
(init_breakpoint_sal): Likewise.
Only save extra_string if it is non-NULL and not the empty string.
Use event_location_to_string instead of `addr_string'.
Constify `p' and `endp'.
Use skip_spaces_const/skip_space_const instead of non-const versions.
Copy the location into the breakpoint.
If LOCATION is NULL, save the breakpoint address as a linespec location
instead of an address string.
(create_breakpoint_sal): Change `addr_string' parameter to a struct
event_location. All uses updated.
(create_breakpoints_sal): Likewise for local variable `addr_string'.
(parse_breakpoint_sals): Use locations instead of address strings.
Remove check for empty linespec with conditional.
Refactor.
(decode_static_tracepoint_spec): Make argument const and update
function.
(create_breakpoint): Change `arg' to a struct event_location and
rename.
Remove `copy_arg' and `addr_start'.
If EXTRA_STRING is empty, set it to NULL.
Don't populate `canonical' for pending breakpoints.
Pass `extra_string' to find_condition_and_thread.
Clear `extra_string' if `rest' was NULL.
Do not error with "garbage after location" if setting a dprintf
breakpoint.
Copy the location into the breakpoint instead of an address string.
(break_command_1): Use string_to_event_location and pass this to
create_breakpoint instead of an address string.
Check against `arg_cp' for a probe linespec.
(dprintf_command): Use string_to_event_location and pass this to
create_breakpoint instead of an address string.
Throw an exception if no format string was specified.
(print_recreate_ranged_breakpoint): Use event_location_to_string
instead of address strings.
(break_range_command, until_break_command)
(init_ada_exception_breakpoint): Use locations instead
of address strings.
(say_where): Print out extra_string for pending locations.
(base_breakpoint_dtor): Delete `location' and `location_range_end' of
the breakpoint.
(base_breakpoint_create_sals_from_location): Use struct event_location
instead of address string.
Remove `addr_start' and `copy_arg' parameters.
(base_breakpoint_decode_location): Use struct event_location instead of
address string.
(bkpt_re_set): Use locations instead of address strings.
Use event_location_empty_p to check for unset location.
(bkpt_print_recreate): Use event_location_to_string instead of
an address string.
Print out extra_string for pending locations.
(bkpt_create_sals_from_location, bkpt_decode_location)
  (bkpt_probe_create_sals_from_location): Use struct event_location
instead of address string.
(bkpt_probe_decode_location): Use struct event_location instead of
address string.
(tracepoint_print_recreate): Use event_location_to_string to
recreate the tracepoint.
(tracepoint_create_sals_from_location, tracepoint_decode_location)
(tracepoint_probe_create_sals_from_location)
(tracepoint_probe_decode_location): Use struct event_location
instead of address string.
(dprintf_print_recreate): Use event_location_to_string to recreate
the dprintf.
(dprintf_re_set): Remove check for valid/missing format string.
(strace_marker_create_sals_from_location)
(strace_marker_create_breakpoints_sal, strace_marker_decode_location)
(update_static_tracepoint): Use struct event_location instead of
address string.
(location_to_sals): Likewise.
Pass `extra_string' to find_condition_and_thread.
For newly resolved pending breakpoint locations, clear the location's
string representation.
Assert that the breakpoint's condition string is NULL when
condition_not_parsed.
(breakpoint_re_set_default, create_sals_from_location_default)
(decode_location_default, trace_command, ftrace_command)
(strace_command, create_tracepoint_from_upload): Use locations
instead of address strings.
* breakpoint.h (struct breakpoint_ops) <create_sals_from_location>:
Use struct event_location instead of address string.
Update all uses.
<decode_location>: Likewise.
(struct breakpoint) <addr_string>: Change to struct event_location
and rename `location'.
<addr_string_range_end>: Change to struct event_location and rename
`location_range_end'.
(create_breakpoint): Use struct event_location instead of address
string.
* cli/cli-cmds.c: Include location.h.
(edit_command, list_command): Use locations instead of address strings.
* elfread.c: Include location.h.
(elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string.
* guile/scm-breakpoint.c: Include location.h.
(bpscm_print_breakpoint_smob): Use event_location_to_string.
(gdbscm_register_breakpoint): Use locations instead of address
strings.
* linespec.c: Include location.h.
(struct ls_parser) <stream>: Change to const char *.
(PARSER_STREAM): Update.
(lionespec_lexer_lex_keyword): According to find_condition_and_thread,
keywords must be followed by whitespace.
(canonicalize_linespec): Save a linespec location into `canonical'.
Save a canonical linespec into `canonical'.
(parse_linespec): Change `argptr' to const char * and rename `arg'.
All uses updated.
Update function description.
(linespec_parser_new): Initialize `parser'.
Update initialization of  parsing stream.
(event_location_to_sals): New function.
(decode_line_full): Change `argptr' to a struct event_location and
rename it `location'.
Use locations instead of address strings.
Call event_location_to_sals instead of parse_linespec.
(decode_line_1): Likewise.
(decode_line_with_current_source, decode_line_with_last_displayed)
Use locations instead of address strings.
(decode_objc): Likewise.
Change `argptr' to const char * and rename `arg'.
(destroy_linespec_result): Delete the linespec result's location
instead of freeing the address string.
* linespec.h (struct linespec_result) <addr_string>: Change to
struct event_location and rename to ...
<location>: ... this.
(decode_line_1, decode_line_full): Change `argptr' to struct
event_location.  All callers updated.
* mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h.
(mi_cmd_break_insert_1): Use locations instead of address strings.
Throw an error if there was "garbage" at the end of the specified
linespec.
* probe.c: Include location.h.
(parse_probes): Change `argptr' to struct event_location.
Use event locations instead of address strings.
* probe.h (parse_probes): Change `argptr' to struct event_location.
* python/py-breakpoint.c: Include location.h.
(bppy_get_location): Constify local variable `str'.
Use event_location_to_string.
(bppy_init): Use locations instead of address strings.
* python/py-finishbreakpoint.c: Include location.h.
(bpfinishpy_init): Remove local variable `addr_str'.
Use locations instead of address strings.
* python/python.c: Include location.h.
(gdbpy_decode_line): Use locations instead of address strings.
* remote.c: Include location.h.
(remote_download_tracepoint): Use locations instead of address
strings.
* spu-tdep.c: Include location.h.
(spu_catch_start): Remove local variable `buf'.
Use locations instead of address strings.
* tracepoint.c: Include location.h.
(scope_info): Use locations instead of address strings.
(encode_source_string): Constify parameter `src'.
* tracepoint.h (encode_source_string): Likewise.

gdb/testsuite/ChangeLog

* gdb.base/dprintf-pending.exp: Update dprintf "without format"
test.
Add tests for missing ",FMT" and ",".

9 years agoExplicit locations: introduce new struct event_location-based API
Keith Seitz [Wed, 12 Aug 2015 00:09:35 +0000 (17:09 -0700)]
Explicit locations: introduce new struct event_location-based API

This patch introduces the new breakpoint/"linespec" API based on
a new struct event_location.  This API currently only supports
traditional linespecs, maintaining the status quo of the code base.
Future patches will add additional functionality for other location
types such as address locations.

gdb/ChangeLog:

* Makefile.in (SFILES): Add location.c.
(HFILES_NO_SRCDIR): Add location.h.
(COMMON_OBS): Add location.o.
* linespec.c (linespec_lex_to_end): New function.
* linespec.h (linespec_lex_to_end): Declare.
* location.c: New file.
* location.h: New file.

9 years agoExplicit locations: rename "address string"/"addr_string" to "location"
Keith Seitz [Wed, 12 Aug 2015 00:09:35 +0000 (17:09 -0700)]
Explicit locations: rename "address string"/"addr_string" to "location"

This patch renames all occurrances of "addr_string" and "address
string" in the breakpoint/linespec APIs.  This will emphasize the
change from address strings used in setting breakpoints (et al) to the
new locations-based API introduced in subsequent patches.

gdb/ChangeLog:

* breakpoint.h (struct breakpoint_ops) <create_sals_from_address>:
Renamed to create_sals_from_location.
<decode_linespec>: Renamed to decode_location.
Update all callers.
* breakpoint.c (create_sals_from_address_default): Renamed to ...
(create_sals_from_location_default): ... this.
(addr_string_to_sals): Renamed to ...
(location_to_sals): ... this.
(decode_linespec_default): Renamed to ...
(decode_location_default): ... this.
(base_breakpoint_create_sals_from_address): Renamed to ...
(base_breakpoint_create_sals_from_location): ... this.
(bkpt_create_sals_from_address): Renamed to ...
(bkpt_create_sals_from_location): ... this.
(bkpt_decode_linespec): Renamed to ...
(bkpt_decode_location): ... this.
(bkpt_probe_create_sals_from_address): Renamed to ...
(bkpt_probe_create_sals_from_location): ... this.
(tracepoint_create_sals_from_address): Renamed to ...
(tracepoint_create_sals_from_location): ... this.
(tracepoint_decode_linespec): Renamed to ...
(tracepoint_decode_location): ... this.
(tracepoint_probe_create_sals_from_address): Renamed to ...
(tracepoint_probe_create_sals_from_location): ... this.
(tracepoint_probe_decode_linespec): Renamed to ...
(tracepoint_probe_decode_location): ... this.
(strace_marker_create_sals_from_address): Renamed to ...
(strace_marker_create_sals_from_location): ... this.
(decode_linespec_default): Renamed to ...
(decode_location_default): ... this.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 12 Aug 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years ago[AArch64] Improve BFD overflow warning message for -fpic
Jiong Wang [Tue, 11 Aug 2015 21:12:41 +0000 (22:12 +0100)]
[AArch64] Improve BFD overflow warning message for -fpic

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Improve warning
  message for R_AARCH64_LD64_GOTPAGE_LO15/R_AARCH64_LD32_GOTPAGE_LO14.

9 years ago[AArch64] Commit missing testcases
Jiong Wang [Tue, 11 Aug 2015 21:12:08 +0000 (22:12 +0100)]
[AArch64] Commit missing testcases

9 years ago[AArch64]Speed up linking speed by skipping unncessary TLS reloc type check
Jiong Wang [Tue, 11 Aug 2015 21:05:39 +0000 (22:05 +0100)]
[AArch64]Speed up linking speed by skipping unncessary TLS reloc type check

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
   * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): New.
  (aarch64_can_relax_tls): Use the new IS_AARCH64_TLS_RELAX_RELOC.

9 years ago[AArch64] Long branch veneer support far symbol defined by --defsym
Jiong Wang [Tue, 11 Aug 2015 20:55:52 +0000 (21:55 +0100)]
[AArch64] Long branch veneer support far symbol defined by --defsym

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * bfd/elfnn-aarch64.c (aarch64_type_of_stub): New parameter "sym_sec".
  Loose the check for symbol from ABS section.
  (elfNN_aarch64_size_stubs): Pass sym_sec.

ld/testsuite/
  * ld-aarch64/farcall-b-defsym.s: New test.
  * ld-aarch64/farcall-bl-defsym.s: Likewise.
  * ld-aarch64/farcall-b-defsym.d: New expectation.
  * ld-aarch64/farcall-bl-defsym.d: Likewise.

9 years ago[AArch64] PR18668, repair long branch veneer for plt stub
Jiong Wang [Tue, 11 Aug 2015 20:44:31 +0000 (21:44 +0100)]
[AArch64] PR18668, repair long branch veneer for plt stub

2015-08-11  Jiong Wang  <jiong.wang@arm.com>
bfd/
   PR ld/18668
   * elfnn-aarch64.c (aarch64_type_of_stub): Update destination for
   calls go through plt stub.
   (elfNN_aarch64_final_link_relocate): Adjust code logic for CALL26,
   JUMP26 relocation to support inserting veneer for call to plt stub.

ld/testsuite/
   * ld-aarch64/farcall-b-gsym.s: New test.
   * ld-aarch64/farcall-b-plt.s: Likewise.
   * ld-aarch64/farcall-bl-plt.s: Likewise.
   * ld-aarch64/farcall-b-gsym.d: New expect file.
   * ld-aarch64/farcall-b-plt.d: Likewise.
   * ld-aarch64/farcall-bl-plt.d: Likewise.

9 years ago[AArch64][8/8] LD support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12
Jiong Wang [Tue, 11 Aug 2015 16:44:30 +0000 (17:44 +0100)]
[AArch64][8/8] LD support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
  BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.
  (aarch64_reloc_got_type): Likewise.
  (elfNN_aarch64_final_link_relocate): Likewise.
  (elfNN_aarch64_relocate_section): Likewise.
  * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
  (_bfd_aarch64_elf_resolve_relocation): Likewise.

ld/testsuite/
  * ld-aarch64/emit-relocs-529.s: New testcase.
  * ld-aarch64/emit-relocs-529-overflow.s: Likewise.
  * ld-aarch64/emit-relocs-86.s: Likewise.
  * ld-aarch64/emit-relocs-86-overflow.s: Likewise.
  * ld-aarch64/emit-relocs-529.d: New expectation file.
  * ld-aarch64/emit-relocs-529-overflow.d: Likewise.
  * ld-aarch64/emit-relocs-86.d: Likewise.
  * ld-aarch64/emit-relocs-86-overflow.d: Likewise.
  * ld-aarch64/aarch64-elf.exp: Run new testcases.

9 years ago[AArch64][7/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12
Jiong Wang [Tue, 11 Aug 2015 16:38:49 +0000 (17:38 +0100)]
[AArch64][7/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

include/elf/
  * aarch64.h (R_AARCH64_P32_TLSLD_ADD_DTPREL_LO12): Define.

bfd/
  * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12): New entry.
  * bfd-in2.h: Regenerate.
  * libbfd.h: Regenerate.
  * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
  BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.

gas/
  * config/tc-aarch64.c (reloc_table): New relocation modifiers
  "dtprel_lo12".
  (md_apply_fix): Support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.
  (aarch64_force_relocation): Likewise.

gas/testsuite/
  * gas/aarch64/reloc-dtprel_lo12-1.s: New testcase.
  * gas/aarch64/reloc-dtprel_lo12-ilp32-1.s: Likewise.
  * gas/aarch64/reloc-dtprel_lo12-1.d: New expectation file.
  * gas/aarch64/reloc-dtprel_lo12-ilp32-1.d: Likewise.

9 years ago[AArch64][6/8] LD support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC
Jiong Wang [Tue, 11 Aug 2015 16:20:17 +0000 (17:20 +0100)]
[AArch64][6/8] LD support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
  BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.
  (aarch64_reloc_got_type): Likewise.
  (elfNN_aarch64_final_link_relocate): Likewise.
  (elfNN_aarch64_relocate_section): Likewise.
  (elfNN_aarch64_gc_sweep_hook): Likewise.
  (elfNN_aarch64_check_relocs): Likewise.
  * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
  (_bfd_aarch64_elf_resolve_relocation): Likewise.

ld/testsuite/
  * ld-aarch64/tls-small-ld.s: Update testcase.

9 years ago[AArch64][5/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC
Jiong Wang [Tue, 11 Aug 2015 16:15:56 +0000 (17:15 +0100)]
[AArch64][5/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC): New entry.
  * bfd-in2.h: Regenerate.
  * libbfd.h: Regenerate.
  * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
  BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.

gas/
  * config/tc-aarch64.c (reloc_table): New relocation modifiers.
  (md_apply_fix): Support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.
  (aarch64_force_relocation): Likewise.

gas/testsuite/
  * gas/aarch64/reloc-tlsldm_lo12_nc-1.s: New testcase.
  * gas/aarch64/reloc-tlsldm_lo12_nc-ilp32-1.s: Likewise.
  * gas/aarch64/reloc-tlsldm_lo12_nc-1.d: New expectation file.
  * gas/aarch64/reloc-tlsldm_lo12_nc-ilp32-1.d: Likewise.

9 years ago[AArch64][4/8] Add R_AARCH64_P32_TLSLD_ADD_LO12_NC in elf header
Jiong Wang [Tue, 11 Aug 2015 16:07:30 +0000 (17:07 +0100)]
[AArch64][4/8] Add R_AARCH64_P32_TLSLD_ADD_LO12_NC in elf header

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

include/elf/
  * aarch64.h (R_AARCH64_P32_TLSLD_ADD_LO12_NC): Define.

9 years ago[AArch64][3/8] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21
Jiong Wang [Tue, 11 Aug 2015 16:05:34 +0000 (17:05 +0100)]
[AArch64][3/8] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
  BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21.
  (aarch64_reloc_got_type): Likewise.
  (elfNN_aarch64_final_link_relocate): Likewise.
  (elfNN_aarch64_relocate_section): Likewise.
  (elfNN_aarch64_gc_sweep_hook): Likewise.
  (elfNN_aarch64_check_relocs): Likewise.
  * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
  (_bfd_aarch64_elf_resolve_relocation): Likewise.

ld/testsuite/
  * ld-aarch64/tls-small-ld.s: New file.
  * ld-aarch64/tls-small-ld.d: Likewise.
  * ld-aarch64/aarch64-elf.exp: Run new test.

9 years ago[AArch64][2/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21
Jiong Wang [Tue, 11 Aug 2015 15:58:20 +0000 (16:58 +0100)]
[AArch64][2/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21): New entry.
  * bfd-in2.h: Regenerate.
  * libbfd.h: Regenerate.
  * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
  BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21.

gas/
  * config/tc-aarch64.c (reloc_table): New relocation modifiers.
  (md_apply_fix): Support BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21.
  (aarch64_force_relocation): Likewise.

gas/testsuite/
  * gas/aarch64/reloc-tlsldm-page-1.s: New testcase.
  * gas/aarch64/reloc-tlsldm-page-ilp32-1.s: Likewise.
  * gas/aarch64/reloc-tlsldm-page-1.d: New expectation file.
  * gas/aarch64/reloc-tlsldm-page-ilp32-1.d: Likewise.

9 years ago[AArch64][1/8] Add R_AARCH64_P32_TLSLD_ADR_PAGE21 in elf header
Jiong Wang [Tue, 11 Aug 2015 15:53:12 +0000 (16:53 +0100)]
[AArch64][1/8] Add R_AARCH64_P32_TLSLD_ADR_PAGE21 in elf header

2015-08-11  Jiong Wang  <jiong.wang@arm.com>

include/elf/
  * aarch64.h (R_AARCH64_P32_TLSLD_ADR_PAGE21): Define.

9 years agoSkip IFUNC relocations in debug sections
H.J. Lu [Tue, 11 Aug 2015 19:58:52 +0000 (12:58 -0700)]
Skip IFUNC relocations in debug sections

Skip IFUNC relocations in debug sections ignored by ld.so.

bfd/

PR ld/18808
* elf32-i386.c (elf_i386_relocate_section): Skip IFUNC
relocations in debug sections.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

ld/testsuite/

PR ld/18808
* ld-ifunc/ifunc.exp: Add a test for PR ld/18808.
* ld-ifunc/pr18808.out: New file.
* ld-ifunc/pr18808a.c: Likewise.
* ld-ifunc/pr18808b.c: Likewise.

9 years agoFix the disassembly of the AArch64 SIMD EXT instruction.
Nick Clifton [Tue, 11 Aug 2015 17:00:36 +0000 (18:00 +0100)]
Fix the disassembly of the AArch64 SIMD EXT instruction.

PR 18800
* aarch64-tbl.h (aarch64_opcode_table): Fix mask for SIMD EXT
instruction.

9 years agoFix encoding or OpenRisk1000 PC relative relocations.
Peter Zotov [Tue, 11 Aug 2015 16:12:21 +0000 (17:12 +0100)]
Fix encoding or OpenRisk1000 PC relative relocations.

PR ld/18759
* elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE.
(R_OR1K_16_PCREL): Likewise.
(R_OR1K_8_PCREL): Likewise.

9 years agoFix typo in coff-sh.c.
Nick Clifton [Tue, 11 Aug 2015 16:02:25 +0000 (17:02 +0100)]
Fix typo in coff-sh.c.

PR binutils/18747
* coff-sh.c (_bfd_sh_align_load_span): Fix typo when setting
opcode count.

9 years agoTweak binutils testsuite
Alan Modra [Tue, 11 Aug 2015 12:24:48 +0000 (21:54 +0930)]
Tweak binutils testsuite

Some targets provide aligned .bss sections, so explicitly align.
msp430 and rl78 emit "magic" symbols when assembling symbol.s, and
mips targets emit STT_OBJECT rather than STT_NOTYPE syms.

* binutils-all/strip-12.s: Align .bss section.
* binutils-all/strip-12.d: Adjust.
* binutils-all/symbols-1.d: Allow extraneous symbols.
* binutils-all/symbols-2.d: Likewise, and V for weakened syms.
* binutils-all/symbols-3.d: Likewise.
* binutils-all/symbols-4.d: Likewise.

9 years agoFix memory access problems discovered when running some binary tools on corrupt files.
Nick Clifton [Tue, 11 Aug 2015 10:57:09 +0000 (11:57 +0100)]
Fix memory access problems discovered when running some binary tools on corrupt files.

PR binutils/18758
* elf.c (_bfd_elf_setup_sections): Add checks for corrupt section
group information.
* peicode.h (pe_ILF_make_a_section): Ensure alignment of the
used_by_bfd pointer.
(pe_ILF_build_a_bfd): Ensure alignment of vars.data pointer.

9 years agoFix a typo in _bfd_elf_copy_private_bfd_data
H.J. Lu [Tue, 11 Aug 2015 10:50:17 +0000 (03:50 -0700)]
Fix a typo in _bfd_elf_copy_private_bfd_data

* elf.c (_bfd_elf_copy_private_bfd_data): Fix a typo.

9 years agoFix compile time warning messages about constant expressions where a value is being...
Nick Clifton [Tue, 11 Aug 2015 09:07:21 +0000 (10:07 +0100)]
Fix compile time warning messages about constant expressions where a value is being shifted into bit 31.

PR gas/18765
* config/tc-arm.c (move_or_literal_pool): Use U suffix to remove
compile time warnings about constant expressions being shifted
into bit 31.
(do_iwmmxt_wldstd): Likewise.
(do_iwmmxt_wrwrwr_or_imm5): Likewise.
(md_assemble): Likewise.

9 years agoConvert 'A && (!A || B)' to 'A || B' in various places.
Nick Clifton [Tue, 11 Aug 2015 08:49:18 +0000 (09:49 +0100)]
Convert 'A && (!A || B)' to 'A || B' in various places.

PR gas/18574
* config/tc-msp430.c (msp430_operands): Rewrite if statements to
remove redundant checks.
(md_apply_fix): Likewise.

9 years agoFix typo checking MMIX operands.
Nick Clifton [Tue, 11 Aug 2015 08:43:16 +0000 (09:43 +0100)]
Fix typo checking MMIX operands.

PR gas/18677
* config/tc-mmix.c (md_assemble): Fix typo checking operands with
a numeric constant value.

9 years agoFix typo checking number of operands.
Nick Clifton [Tue, 11 Aug 2015 08:40:02 +0000 (09:40 +0100)]
Fix typo checking number of operands.

PR gas/18678
* config/tc-tic4x.c (tic4x_insn_check): Fix typo.

9 years agoFix a typo where the same name was checked twice.
Nick Clifton [Tue, 11 Aug 2015 08:36:57 +0000 (09:36 +0100)]
Fix a typo where the same name was checked twice.

PR gas/18679
* config/xtensa-relax.c (same_operand_name): Fix typo.

9 years agoPR gdb/18669 libiberty demangle.test failure: strtod() on sparc-sun-solaris2.9
Iain Buclaw [Tue, 11 Aug 2015 06:51:05 +0000 (08:51 +0200)]
PR gdb/18669 libiberty demangle.test failure: strtod() on sparc-sun-solaris2.9

Test symbols did not demangle as per the d-demangle-expected tests because
strtod() on Solaris 9 does not accept hexadecimal numbers.

This has now been fixed up so that no attempt at formatting/converting the
demangled hexadecimal literals are done.

libiberty/ChangeLog:

2015-08-11  Iain Buclaw  <ibuclaw@gdcproject.org>

* d-demangle.c (dlang_parse_real): Remove call to strtod.
(strtod): Remove declaration.
* testsuite/d-demangle-expected: Update float and complex literal
tests to check correct hexadecimal demangling.

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

9 years agoremove trailing space in previous entry
Doug Evans [Mon, 10 Aug 2015 20:36:36 +0000 (13:36 -0700)]
remove trailing space in previous entry

9 years agoPR gdb/17960 Internal error: tracker != NULL when completing on file:function
Doug Evans [Mon, 10 Aug 2015 19:23:09 +0000 (12:23 -0700)]
PR gdb/17960 Internal error: tracker != NULL when completing on file:function

gdb/ChangeLog:

* symtab.c (make_file_symbol_completion_list_1): Renamed from
make_file_symbol_completion_list and made static.
(make_file_symbol_completion_list): New function.

gdb/testsuite/ChangeLog:

* gdb.base/completion.exp: Add location completer tests.

9 years agogdb/infrun.c: Various trivial ARI fixes.
Joel Brobecker [Mon, 10 Aug 2015 17:08:44 +0000 (10:08 -0700)]
gdb/infrun.c: Various trivial ARI fixes.

gdb/ChangeLog:

        * infrun.c (follow_fork, displaced_step_prepare, resume): Remove
        trailing new-line at end of warning message.
        (proceed): Add i18n marker to error messages.

9 years agoReplace hidden with versioned in elf_link_hash_entry
H.J. Lu [Mon, 10 Aug 2015 14:57:40 +0000 (07:57 -0700)]
Replace hidden with versioned in elf_link_hash_entry

This patch replaces the "hidden" field with the "versioned" field in
elf_link_hash_entry so that we can avoid calling strchr and strrchr if
the symbol is unversioned.

* elf-bfd.h (elf_symbol_version): New enum.
(elf_link_hash_entry): Replace hidden with versioned.
* elflink.c (_bfd_elf_merge_symbol): Don't look for symbol
version if the symbol is unversioned.  Initialize versioned.
(_bfd_elf_add_default_symbol): Don't look for symbol version
if the symbol is unversioned or hidden.  Initialize versioned.
(elf_collect_hash_codes): Don't look for symbol version if the
symbol is unversioned.
(elf_collect_gnu_hash_codes): Likewise.
(bfd_elf_gc_mark_dynamic_ref_symbol): Likewise.
(_bfd_elf_link_hash_copy_indirect): Check versioned instead of
hidden.
(elf_link_output_extsym): Likewise.

9 years agoAdd SIGRIE instruction for MIPS R6
Robert Suchanek [Mon, 10 Aug 2015 07:57:31 +0000 (08:57 +0100)]
Add SIGRIE instruction for MIPS R6

opcodes/

* mips-opc.c (mips_builtin_opcodes): Add "sigrie".

gas/testsuite/

* gas/mips/r6.s: Add tests for "sigrie".
* gas/mips/r6.d: Check for "sigrie".
* gas/mips/r6-n32.d: Likewise.
* gas/mips/r6-n64.d: Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 10 Aug 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

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

9 years agotc-arm.c: Append ULL to 0xFFFFFFFFFFFFF to avoid errors on 32-bit hosts.
Hans-Peter Nilsson [Sat, 8 Aug 2015 20:44:37 +0000 (22:44 +0200)]
tc-arm.c: Append ULL to 0xFFFFFFFFFFFFF to avoid errors on 32-bit hosts.

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

9 years agobinutils-all/strip-12.s: Use ".section .bss" instead of ".bss"
Hans-Peter Nilsson [Fri, 7 Aug 2015 23:04:50 +0000 (01:04 +0200)]
binutils-all/strip-12.s: Use ".section .bss" instead of ".bss"

which isn't supported by all ELF targets.