external/binutils.git
7 years agoUse gdbpy_ref in python.c
Tom Tromey [Mon, 7 Nov 2016 04:49:34 +0000 (21:49 -0700)]
Use gdbpy_ref in python.c

This changes a couple of functions in python.c to use gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/python.c (gdbpy_progspaces, gdbpy_objfiles): Use
gdbpy_ref.

7 years agoUse gdbpy_ref in py-prettyprint.c
Tom Tromey [Mon, 7 Nov 2016 04:37:01 +0000 (21:37 -0700)]
Use gdbpy_ref in py-prettyprint.c

This changes several functions in py-prettyprint.c to use
gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-prettyprint.c (search_pp_list)
(find_pretty_printer_from_objfiles)
(find_pretty_printer_from_progspace)
(find_pretty_printer_from_gdb, find_pretty_printer)
(gdbpy_get_display_hint, gdbpy_get_varobj_pretty_printer): Use
gdbpy_ref.

7 years agoUse gdbpy_ref in call_doc_function
Tom Tromey [Mon, 7 Nov 2016 04:29:12 +0000 (21:29 -0700)]
Use gdbpy_ref in call_doc_function

This changes call_doc_function to use gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-param.c (call_doc_function): Use gdbpy_ref.

7 years agoUse gdbpy_ref in py-linetable.c
Tom Tromey [Mon, 7 Nov 2016 04:25:34 +0000 (21:25 -0700)]
Use gdbpy_ref in py-linetable.c

This changes some code in py-linetable.c to use gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-linetable.c (build_line_table_tuple_from_pcs)
(ltpy_get_all_source_lines): Use gdbpy_ref.

7 years agoUse gdbpy_ref in py-framefilter.c
Tom Tromey [Mon, 7 Nov 2016 04:25:31 +0000 (21:25 -0700)]
Use gdbpy_ref in py-framefilter.c

This changes some code in py-framefilter.c to use gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-framefilter.c (extract_sym, extract_value)
(get_py_iter_from_func, bootstrap_python_frame_filters): Use
gdbpy_ref.

7 years agoUse gdbpy_ref in gdbpy_breakpoints
Tom Tromey [Mon, 7 Nov 2016 04:25:22 +0000 (21:25 -0700)]
Use gdbpy_ref in gdbpy_breakpoints

This changes gdbpy_breakpoints to use gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-breakpoint.c (gdbpy_breakpoints): Use gdbpy_ref.

7 years agoUse gdbpy_ref in gdbpy_inferiors
Tom Tromey [Mon, 7 Nov 2016 04:23:31 +0000 (21:23 -0700)]
Use gdbpy_ref in gdbpy_inferiors

This changes gdbpy_inferiors to use gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-inferior.c (gdbpy_inferiors): Use gdbpy_ref.

7 years agoUse gdbpy_ref in py-function.c
Tom Tromey [Mon, 7 Nov 2016 04:21:14 +0000 (21:21 -0700)]
Use gdbpy_ref in py-function.c

This changes some code in py-function.c to use gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-function.c (convert_values_to_python, fnpy_init): Use
gdbpy_ref.

7 years agoUse gdbpy_ref in gdbpy_string_to_argv
Tom Tromey [Mon, 7 Nov 2016 04:10:18 +0000 (21:10 -0700)]
Use gdbpy_ref in gdbpy_string_to_argv

This chanes gdbpy_string_to_argv to use gdbpy_ref.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-cmd.c (gdbpy_string_to_argv): Use gdbpy_ref.

7 years agoUse gdbpy_ref in py-type.c
Tom Tromey [Mon, 7 Nov 2016 03:59:51 +0000 (20:59 -0700)]
Use gdbpy_ref in py-type.c

This changes py-type.c to use gdbpy_ref.
This results in simpler logic and the removal of "goto"s.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-type.c (convert_field, make_fielditem, typy_fields)
(typy_range): Use gdbpy_ref.

7 years agoChange event code to use gdbpy_ref
Tom Tromey [Mon, 7 Nov 2016 03:42:32 +0000 (20:42 -0700)]
Change event code to use gdbpy_ref

This changes the event code in the Python layer to use
gdbpy_ref, simplifying the logic in many places.

It also changes evpy_emit_event not to steal a reference to its
argument.  This is simpler to do now that gdbpy_ref is in use;
it's also a reasonable cleanup in its own right.  While doing this I
realized that evpy_emit_event should not be calling gdbpy_print_stack
(all the outermost callers do this if needed), so I removed this as
well.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-threadevent.c (create_thread_event_object): Use
gdbpy_ref.
* python/py-stopevent.c (create_stop_event_object): Simplify.
(emit_stop_event): Use gdbpy_ref.
* python/py-signalevent.c (create_signal_event_object): Use
gdbpy_ref.
* python/py-newobjfileevent.c (create_new_objfile_event_object)
(emit_new_objfile_event, create_clear_objfiles_event_object)
(emit_clear_objfiles_event): Use gdbpy_ref.
* python/py-infevents.c (create_inferior_call_event_object)
(create_register_changed_event_object)
(create_memory_changed_event_object, emit_inferior_call_event)
(emit_memory_changed_event, emit_register_changed_event): Use
gdbpy_ref.
* python/py-exitedevent.c (create_exited_event_object)
(emit_exited_event): Use gdbpy_ref.
* python/py-event.h (evpy_emit_event): Remove
CPYCHECKER_STEALS_REFERENCE_TO_ARG annotation.
* python/py-event.c (evpy_emit_event): Use gdbpy_ref.
* python/py-continueevent.c (emit_continue_event): Use
gdbpy_ref.
* python/py-breakpoint.c (gdbpy_breakpoint_created)
(gdbpy_breakpoint_deleted, gdbpy_breakpoint_modified): Use
gdbpy_ref.
* python/py-bpevent.c (create_breakpoint_event_object): Use
gdbpy_ref.

7 years agoIntroduce py-ref.h
Tom Tromey [Sat, 5 Nov 2016 19:43:23 +0000 (13:43 -0600)]
Introduce py-ref.h

This patch introduces class gdbpy_ref, which is a sort of smart
pointer that owns a single Python reference to a PyObject.  This class
acts a bit like unique_ptr, but also a bit like shared_ptr (in that
copies do what you might expect); I considered going solely with
unique_ptr but it seemed quite strange to have a unique_ptr that
actually manages a shared resource.

Subsequent patches use this new class to simplify logic in the Python
layer.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-ref.h: New file.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Jan 2017 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoi386/x32: Align .eh_frame section to 4 bytes
H.J. Lu [Tue, 10 Jan 2017 22:18:11 +0000 (14:18 -0800)]
i386/x32: Align .eh_frame section to 4 bytes

.eh_frame section covering PLT sections should be aligned to 4 bytes
for i386 and x32.

bfd/

* elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
to 4 bytes.
* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
.eh_frame section to 4 bytes for x32.
(elf_x86_64_check_relocs): Likewise.

ld/

* testsuite/ld-x86-64/pr20830b.d: Updated.

7 years agoX32: Place .plt.got section after .plt section
H.J. Lu [Tue, 10 Jan 2017 21:57:39 +0000 (13:57 -0800)]
X32: Place .plt.got section after .plt section

This patch places .plt.got section after .plt section for x32.

* emulparams/elf32_x86_64.sh (TINY_READONLY_SECTION): New.
* testsuite/ld-x86-64/pr20830.d: Renamed to ...
* testsuite/ld-x86-64/pr20830a.d: This.  Updated.
* testsuite/ld-x86-64/pr20830b.d: New file.
* testsuite/ld-x86-64/x86-64.exp: Rename pr20830 to pr20830a.
Run pr20830b.

7 years agoi386/x86-64: Add unwind info for .plt.got section
H.J. Lu [Tue, 10 Jan 2017 21:31:59 +0000 (13:31 -0800)]
i386/x86-64: Add unwind info for .plt.got section

When there are both PLT and GOT references to the same function symbol,
linker combines GOTPLT and GOT slots into a single GOT slot and create
an entry in .plt.got section for PLT access via the GOT slot.  This
patch adds unwind info for .plt.got section.

bfd/

PR ld/20830
* elf32-i386.c (elf_i386_eh_frame_plt_got): New.
(PLT_GOT_FDE_LENGTH): Likewise.
(elf_i386_plt_layout): Add eh_frame_plt_got and
eh_frame_plt_got_size.
(elf_i386_plt): Updated.
(elf_i386_link_hash_table): Add plt_got_eh_frame.
(elf_i386_check_relocs): Create .eh_frame section for .plt.got.
(elf_i386_size_dynamic_sections): Allocate and initialize
.eh_frame section for .plt.got.
(elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
.plt.got.
(elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
eh_frame_plt_got_size.
* elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
(PLT_GOT_FDE_LENGTH): Likewise.
(elf_x86_64_backend_data): Add eh_frame_plt_got and
eh_frame_plt_got_size.
(elf_x86_64_arch_bed): Updated.
(elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
eh_frame_plt_got_size.
(elf_x86_64_nacl_arch_bed): Likewise.
(elf_x86_64_link_hash_table): Add plt_got_eh_frame.
(elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
(elf_x86_64_size_dynamic_sections): Allocate and initialize
.eh_frame section for .plt.got.
(elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
for .plt.got.

ld/

PR ld/20830
* testsuite/ld-i386/i386.exp: Run pr20830.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr20830.d: New file.
* testsuite/ld-i386/pr20830.s: Likewise.
* testsuite/ld-x86-64/pr20830.d: Likewise.
* testsuite/ld-x86-64/pr20830.s: Likewise.

7 years ago[GOLD] PowerPC64 TOC indirect to TOC relative code editing
Alan Modra [Tue, 10 Jan 2017 21:11:53 +0000 (07:41 +1030)]
[GOLD] PowerPC64 TOC indirect to TOC relative code editing

Doesn't yet trim off the unused TOC entries.

* powerpc.cc (class Powerpc_copy_relocs): New.
(Powerpc_copy_relocs::emit): New function.
(Powerpc_relobj::relatoc_, toc_, no_toc_opt_): New variables.
(Powerpc_relobj::toc_shndx, set_no_toc_opt, no_toc_opt): New inlines.
(Powerpc_relobj::do_relocate_sections): New function.
(Powerpc_relobj::make_toc_relative): Likewise.
(Powerpc_relobj::do_find_special_sections): Stash away .rela.toc
and .toc too.
(ok_lo_toc_insn): Move earlier, and handle more insns.
(Target_powerpc::Scan::local): If optimizing toc accesses, set
no_toc_opt for entries we can't edit.  Check insn validity.
Emit "toc optimization is not supported" warning, downgraded
from error.
(Target_powerpc::Scan::global): Likewise.
(Target_powerpc::Relocate::relocate): Edit TOC indirect code
to TOC relative.  Don't emit "toc optimization is not supported"
error here.

7 years agoDon't use elf_i386_eh_frame_plt directly
H.J. Lu [Tue, 10 Jan 2017 19:30:25 +0000 (11:30 -0800)]
Don't use elf_i386_eh_frame_plt directly

Use eh_frame_plt_size and eh_frame_plt from elf_i386_plt_layout for
.eh_frame covering the .plt section.

* elf32-i386.c (elf_i386_size_dynamic_sections): Set
plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.

7 years agoi386: Pass -Wl,-R,tmpdir/-Wl --as-needed to $CC
H.J. Lu [Tue, 10 Jan 2017 18:54:39 +0000 (10:54 -0800)]
i386: Pass -Wl,-R,tmpdir/-Wl --as-needed to $CC

Since linker tests were changed to use $CC, instead of $LD, we need
to pass -Wl,-R,tmpdir and -Wl,--as-needed to $CC.

* testsuite/ld-i386/i386.exp: Pass -Wl,-R,tmpdir to GCC driver.
* testsuite/ld-i386/tls.exp: Likewise.

7 years agoChange return type of ui_out redirect to void
Simon Marchi [Tue, 10 Jan 2017 16:30:47 +0000 (11:30 -0500)]
Change return type of ui_out redirect to void

All implementations of redirect/do_redirect in the ui_out subsystem
always return 0 (success).  We can therefore clean it up and make them
return void.

gdb/ChangeLog:

* cli-out.c (cli_ui_out::do_redirect): Change return type to
void.
* cli-out.h (cli_ui_out::do_redirect): Likewise.
* mi/mi-out.c (mi_ui_out::do_redirect): Likewise.
* mi/mi-out.h (mi_ui_out::do_redirect): Likewise.
* ui-out.c (ui_out::redirect): Likewise.
* ui-out.h (ui_out::redirect, ui_out::do_redirect): Likewise.
* cli/cli-logging.c (set_logging_redirect): Update call site of
ui_out::redirect.
(handle_redirections): Likewise.
* scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
* top.c (execute_command_to_string): Likewise.
* utils.c (do_ui_out_redirect_pop): Likewise.

7 years agoRefactor Sized_relobj_file::do_relocate_sections.
Cary Coutant [Tue, 10 Jan 2017 15:46:30 +0000 (07:46 -0800)]
Refactor Sized_relobj_file::do_relocate_sections.

gold/
* aarch64.cc (AArch64_relobj::do_relocate_sections): Call
Sized_relobj_file::relocate_section_range().
* arm.cc (Arm_relobj::do_relocate_sections): Likewise.
* object.h (Sized_relobj_file::relocate_section_range): New method.
* reloc.cc (Sized_relobj_file::do_relocate_sections): Move
implementation...
(Sized_relobj_file::relocate_section_range): ...to new method.

7 years agoUpdate help of the "frame" command
Simon Marchi [Tue, 10 Jan 2017 15:16:26 +0000 (10:16 -0500)]
Update help of the "frame" command

The help message of the "frame" command states that nothing is printed
if the command is executed from the command file or user-defined
command.  My testing leads me to think that this is not true (at least
today).

  (gdb) bt
  #0  bar (n=17) at test.c:9
  #1  0x00000000004006e0 in foo (v=17) at test.c:13
  #2  0x00000000004006f0 in main () at test.c:21
  (gdb) frame
  #0  bar (n=17) at test.c:9
  9     baz(n);
  (gdb) define foo
  Type commands for definition of "foo".
  End with a line saying just "end".
  >frame 1
  >end
  (gdb) foo
  #1  0x00000000004006e0 in foo (v=17) at test.c:13
  13     bar(v);

This patch simply removes that bit from the help message.  I didn't find
anything corresponding to this in the documentation that needs to be
fixed.

The behavior change corresponding to this documentation change was done
in commit b00771232fab861fb31e42dfd5f6643ba1b43cc9.

gdb/ChangeLog:

* stack.c (_initialize_stack): Update "frame" command help message.

7 years agoFix sleb128-8 regressions.
Tristan Gingold [Tue, 10 Jan 2017 13:43:01 +0000 (14:43 +0100)]
Fix sleb128-8 regressions.

gas/
* testsuite/gas/all/sleb128-8.d: Adjust test.
* testsuite/gas/all/gas.exp (test_cond): Likewise.

7 years agoFix compile time warning about pointer comparison.
Nick Clifton [Tue, 10 Jan 2017 11:45:12 +0000 (11:45 +0000)]
Fix compile time warning about pointer comparison.

PR 21034
* stabs.c (parse_stab_members): Fix thinko checking for g++
version 1 stabs information.

7 years agoUpdated Swedish translations for GAS and LD
Nick Clifton [Tue, 10 Jan 2017 11:28:36 +0000 (11:28 +0000)]
Updated Swedish translations for GAS and LD

7 years ago[ARC] Add new linker emulation for nps
Graham Markall [Thu, 8 Dec 2016 16:58:23 +0000 (16:58 +0000)]
[ARC] Add new linker emulation for nps

The arc700 nps variant uses some specific named sections to
facilitate its CMEM based instructions, which operate on memory
regions fixed at specific addresses.

This commit adds the arclinux_nps emulation, which is based on the
arclinux emulation. The new emulation uses the OTHER_SECTIONS
variable in the emulation parameters script to provide symbols
mapping to various locations in the CMEM space on nps.

The accompanying test ensures that all symbols are provided at the
correct address in the linker script.

ld/ChangeLog:

  * Makefile.am: Add earclinux_nps.c target and add to
  ALL_EMULATION_SOURCES.
  * Makefile.in: Likewise, regenerated.
  * configure.tgt: Add arclinux_nps as an extra emulation for
  arc*-*-elf* and arc*-*-linux*.
  * emulparams/arc-nps.sh: New file.
  * emulparams/arclinux_nps.sh: New file.
  * testsuite/ld-arc/arclinux-nps.d,
  * testsuite/ld-arc/arclinux-nps.s: New test.

7 years agoThis patch ensure same output for sleb128 with large number.
Tristan Gingold [Mon, 9 Jan 2017 14:50:32 +0000 (15:50 +0100)]
This patch ensure same output for sleb128 with large number.

gas/
* read.c (emit_leb128_expr): Extended unsigned big number for
sleb128.
* testsuite/gas/all/gas.exp (test_cond): Add sleb128-8 test.
* testsuite/gas/all/sleb128.d: New test.
* testsuite/gas/all/sleb128.s: New test source.

7 years ago[GOLD] Fix tests for powerpc64
Alan Modra [Mon, 9 Jan 2017 23:58:20 +0000 (10:28 +1030)]
[GOLD] Fix tests for powerpc64

PowerPC64 defines .TOC. rather than _GLOBAL_OFFSET_TABLE_, and
what's more, doesn't define it at all unless referenced.  For ELFv1
ABI the symbol isn't normally referenced, so modify the test to accept
.TOC. as a variant of _GLOBAL_OFFSET_TABLE_ and 0 or 1 occurrences.

copy_test_relro as written doesn't need copy relocs on PowerPC64.
PowerPC64 is always PIC.  So, modify copy_test_relro to test that the
existing vars are in fact read-only directly by deliberately causing a
sigsegv, and add another couple of vars that do cause copy relocs even
when PIC.

* testsuite/ver_test_8.sh: Accept .TOC. in lieu of
_GLOBAL_OFFSET_TABLE_.  Allow zero count.
* testsuite/copy_test_relro_1.cc (c, q): New vars.
* testsuite/copy_test_relro.cc: Rewrite to test read-only
status of variables directly.  Reference new vars in
read-only data.

7 years ago[GOLD] Add --secure-plt option for ppc32
Alan Modra [Mon, 9 Jan 2017 23:54:09 +0000 (10:24 +1030)]
[GOLD] Add --secure-plt option for ppc32

Added just to accept, and ignore.  gcc since 2015-10-21, when
configured with --enable-secureplt passes this option to the linker.
As powerpc gold cannot link --bss-plt code successfully, gold needs to
accept the option or the gcc specs file needs to be changed.

The patch also make gold detect --bss-plt code and error out rather
than producing a binary that crashes.

* options.h: Add --secure-plt option.
* powerpc.cc (Target_powerpc::Scan::local): Detect and error
on -fPIC -mbss-plt code.
(Target_powerpc::Scan::global): Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Jan 2017 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix problems with the implementation of the uzp1 and uzp2 instructions.
Jim Wilson [Mon, 9 Jan 2017 23:44:57 +0000 (15:44 -0800)]
Fix problems with the implementation of the uzp1 and uzp2 instructions.

sim/aarch64/
* simulator.c (do_vec_UZP): Rewrite.
sim/testsuite/sim/aarch64/
* uzp.s: New.

7 years agoFix inferior memory reading in GDBServer for arm/aarch32
Antoine Tremblay [Mon, 9 Jan 2017 17:39:07 +0000 (12:39 -0500)]
Fix inferior memory reading in GDBServer for arm/aarch32

Before this patch, some functions would read the inferior memory with
(*the_target)->read_memory, which returns the raw memory, rather than the
shadowed memory.

This is wrong since these functions do not expect to read a breakpoint
instruction and can lead to invalid behavior.

Use of raw memory in get_next_pcs_read_memory_unsigned_integer for example
could lead to get_next_pc returning an invalid pc.

Here's how this would happen:

In non-stop:

the user issues:

thread 1
step&
thread 2
step&
thread 3
step&

In a similar way as non-stop-fair-events.exp (threads are looping).

GDBServer:

 linux_resume is called
 GDBServer has pending events,
 threads are not resumed and single-step breakpoint for thread 1 not installed.

 linux_wait_1 is called with a pending event on thread 2 at pc A
 GDBServer handles the event and calls proceed_all_lwps
 This calls proceed_one_lwp and installs single-step breakpoints on all
 the threads that need one.

 Now since thread 1 needs to install a single-step breakpoint and is at pc B
 (different than thread 2), a step-over is not initiated and get_next_pc
 is called to figure out the next instruction from pc B.

 However it may just be that thread 3 as a single step breakpoint at pc
 B. And thus get_next_pc fails.

This situation is tested with non-stop-fair-events.exp.

In other words, single-step breakpoints are installed in proceed_one_lwp
for each thread.  GDBserver proceeds two threads for resume_step, as
requested by GDB, and the thread proceeded later may see the single-step
breakpoints installed for the thread proceeded just now.

Tested on gdbserver-native/-m{thumb,arm} no regressions.

gdb/gdbserver/ChangeLog:

* linux-aarch32-low.c (arm_breakpoint_kind_from_pc): Use
target_read_memory.
* linux-arm-low.c (get_next_pcs_read_memory_unsigned_integer): Likewise.
(get_next_pcs_syscall_next_pc): Likewise.

7 years agoRISC-V/GAS: Support more relocs against constant addresses
Andrew Waterman [Thu, 22 Dec 2016 02:05:28 +0000 (18:05 -0800)]
RISC-V/GAS: Support more relocs against constant addresses

Previously, some pseudoinstructions like "call" only accepted
symbolic addresses and rejected constant addresses with an
esoteric internal error.  This patch enables them by deferring
application of constant relocations to md_apply_fix, rather than
eagerly applying them during instruction assembly.

gas/ChangeLog

2017-01-09  Andrew Waterman <andrew@sifive.com>

* config/tc-riscv.c (append_insn): Don't eagerly apply relocations
against constants.
(md_apply_fix): Mark relocations against constants as "done."

7 years agoRISC-V/GAS: Improve handling of invalid relocs
Andrew Waterman [Wed, 21 Dec 2016 20:47:13 +0000 (12:47 -0800)]
RISC-V/GAS: Improve handling of invalid relocs

TLS relocs against constants previously segfaulted, and illegal
symbol subtractions were silently ignored.

The previous behavior was to segfault.

gas/ChangeLog

2017-01-09  Andrew Waterman <andrew@sifive.com>

* config/tc-riscv.c (md_apply_fix): Report TLS relocations against
constants.  Report disallowed symbol subtractions.

7 years agoRemove some custom sections from RISC-V's default linker scripts
Palmer Dabbelt [Fri, 30 Dec 2016 01:29:53 +0000 (17:29 -0800)]
Remove some custom sections from RISC-V's default linker scripts

This was added so compressed loads could have smaller offsets for
accessing the data section, but the result was that writable sections
ended up in INITIAL_READONLY_SECTIONS.  This is a bad idea.  The fix is
to just remove this micro-optimization.

Thanks to Alan Morda for finding the problem!

ld/ChangeLog

2017-01-09  Palmer Dabbelt <palmer@dabbelt.com>
            Kito Cheng <kito.cheng@gmail.com>

        * emulparams/elf32lriscv-defs.sh (INITIAL_READONLY_SECTIONS):
        Removed.
        (SDATA_START_SYMBOLS): Likewise.

7 years agoSpeed up objdump when displaying disassembly mixed with line number and source code...
Nick Clifton [Mon, 9 Jan 2017 16:49:48 +0000 (16:49 +0000)]
Speed up objdump when displaying disassembly mixed with line number and source code information.

bfd * dwarf2.c (lookup_address_in_function_table): Return early if
there are no functions in the given comp unit, or if the high
address of the last function in the comp unit is less than the
desired address.

binutils * objdump.c (display_file): Add new parameter 'last_file'.  If
last_file is true, do not call bfd_close at the end of the
function.
(main): Set the value of the last_file parameter when calling
display_file.

7 years agoAdd Swedish translation for GAS.
Nick Clifton [Mon, 9 Jan 2017 10:11:50 +0000 (10:11 +0000)]
Add Swedish translation for GAS.

* po/sv.po: New Swedish translation.
* configure.ac (ALL_LINGUAS): Add sv.
* configure: Regenerate.

7 years agoImprove objdump's behaviour when it encounters a corrupt binary with an excessively...
Nick Clifton [Mon, 9 Jan 2017 09:27:46 +0000 (09:27 +0000)]
Improve objdump's behaviour when it encounters a corrupt binary with an excessively large symbol table.

PR binutils/21013
* coffgen.c (_bfd_coff_get_external_symbols): Generate an error
message if there are too many symbols to load.

7 years agoRISC-V/GAS: Correct branch relaxation for weak symbols.
Andrew Waterman [Mon, 9 Jan 2017 09:22:33 +0000 (09:22 +0000)]
RISC-V/GAS: Correct branch relaxation for weak symbols.

* config/tc-riscv.c (relaxed_branch_length): Use the long
sequence when the target is a weak symbol.

7 years ago[GOLD] Set sh_info of .rela.plt for powerpc
Alan Modra [Mon, 9 Jan 2017 00:16:23 +0000 (10:46 +1030)]
[GOLD] Set sh_info of .rela.plt for powerpc

* powerpc.cc (Target_powerpc::make_plt_section): Point sh_info of
".rela.plt" at ".plt".

7 years ago.rela.dyn comment fix and add missing ChangeLog entry
Alan Modra [Mon, 9 Jan 2017 01:38:00 +0000 (12:08 +1030)]
.rela.dyn comment fix and add missing ChangeLog entry

ChangeLog entry missed from commit dd90581873.

* readelf.c (process_section_headers): Correct .rel.dyn/.rela.dyn
comment.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Jan 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years ago[D] Fix crash when debug expression enabled.
Iain Buclaw [Sun, 8 Jan 2017 10:17:54 +0000 (11:17 +0100)]
[D] Fix crash when debug expression enabled.

While casting works as expected with expression debugging turned off,
this seems to be an indication that the D language parser function is
doing something wrong in the building of the expression.

Without changing the grammar, using UNOP_CAST_TYPE is the right thing to
do here, as the TypeExp handler has already wrapped the type around a
pair of OP_TYPE opcodes.

gdb/ChangeLog:

* d-exp.y (CastExpression): Emit UNOP_CAST_TYPE.

gdb/testsuite/ChangeLog:

* gdb.dlang/debug-expr.exp: New file.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Jan 2017 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoS/390: Issue error for overflowing relocs.
Andreas Krebbel [Thu, 5 Jan 2017 18:53:14 +0000 (19:53 +0100)]
S/390: Issue error for overflowing relocs.

Building PIE executable from non-PIC code results in broken binaries.
With this patch the problem is detected at link-time.

bfd/ChangeLog:

2017-01-07  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* elf64-s390.c (elf_s390_relocate_section): Issue error for
non-PLT relocs of shared libary symbol in exectuable.

7 years ago[GOLD] powerpc.cc tidies
Alan Modra [Fri, 6 Jan 2017 05:17:33 +0000 (15:47 +1030)]
[GOLD] powerpc.cc tidies

Plus some paranoia in symval_for_branch.  We shouldn't get there with
dynamic symbols, but if we ever did the static_cast to Powerpc_relobj
would be wrong.

* powerpc.cc: Use shorter equivalent elfcpp typedef for
Reltype and reloc_size throughout.
(Target_powerpc::symval_for_branch): Exclude dynamic symbols.
(Target_powerpc::Scan::local): Use local var r_sym.
(Target_powerpc::Scan::global: Likewise.
(Target_powerpc::Relocate::relocate): Delete shadowing r_sym.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Jan 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoInclude gdb_proc_service.h in x86-linux-nat.h
Yao Qi [Fri, 6 Jan 2017 14:33:01 +0000 (14:33 +0000)]
Include gdb_proc_service.h in x86-linux-nat.h

$ make check-headers CHECK_HEADERS="x86-linux-nat.h"
...
../../binutils-gdb/gdb/x86-linux-nat.h:29:8: error: 'ps_err_e' does not name a type
 extern ps_err_e x86_linux_get_thread_area (pid_t pid, void *addr,
        ^

gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* x86-linux-nat.h: Include gdb_proc_service.h.

7 years agoInclude serial.h in ser-base.h.
Yao Qi [Fri, 6 Jan 2017 14:33:01 +0000 (14:33 +0000)]
Include serial.h in ser-base.h.

$ make check-headers CHECK_HEADERS="ser-base.h"
...
../../binutils-gdb/gdb/ser-base.h:33:8: error: 'serial_ttystate' does not name a type
 extern serial_ttystate ser_base_get_tty_state (struct serial *scb);
        ^

gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* ser-base.h: Include serial.h.

7 years agoInclude ppc-tdep.h in ppc-linux-tdep.h
Yao Qi [Fri, 6 Jan 2017 14:33:01 +0000 (14:33 +0000)]
Include ppc-tdep.h in ppc-linux-tdep.h

$ make check-headers CHECK_HEADERS="ppc-linux-tdep.h"
...
../../binutils-gdb/gdb/ppc-linux-tdep.h:34:24: error: 'PPC_NUM_REGS' was not declared in this scope
   PPC_ORIG_R3_REGNUM = PPC_NUM_REGS,
                        ^

gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* ppc-linux-tdep.h: Include ppc-tdep.h.

7 years agoInclude signal.h in nat/amd64-linux-siginfo.h
Yao Qi [Fri, 6 Jan 2017 14:33:01 +0000 (14:33 +0000)]
Include signal.h in nat/amd64-linux-siginfo.h

$ make check-headers CHECK_HEADERS="nat/amd64-linux-siginfo.h"
....
../../binutils-gdb/gdb/nat/amd64-linux-siginfo.h:52:39: error: 'siginfo_t' was not declared in this scope
 int amd64_linux_siginfo_fixup_common (siginfo_t *native, gdb_byte *inf,
                                       ^
gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* nat/amd64-linux-siginfo.h: Include signal.h.

7 years agoInclude break-common.h in nat/aarch64-linux-hw-point.h
Yao Qi [Fri, 6 Jan 2017 14:33:01 +0000 (14:33 +0000)]
Include break-common.h in nat/aarch64-linux-hw-point.h

$ make check-headers CHECK_HEADERS="nat/aarch64-linux-hw-point.h"
...
../../binutils-gdb/gdb/nat/aarch64-linux-hw-point.h:169:37: error: use of enum 'target_hw_bp_type' without previous declaration
 int aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr,
                                     ^
gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* nat/aarch64-linux-hw-point.h: Include break-common.h.

7 years agoInclude mi-cmds.h in mi-parse.h
Yao Qi [Fri, 6 Jan 2017 14:33:00 +0000 (14:33 +0000)]
Include mi-cmds.h in mi-parse.h

$ make check-headers CHECK_HEADERS="mi/mi-parse.h"
...
../../binutils-gdb/gdb/mi/mi-parse.h:77:6: error: use of enum 'print_values' without previous declaration
 enum print_values mi_parse_print_values (const char *name);
      ^

gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* mi/mi-parse.h: Include mi-cmds.h.

7 years agoInclude target.h in inf-loop.h
Yao Qi [Fri, 6 Jan 2017 14:26:45 +0000 (14:26 +0000)]
Include target.h in inf-loop.h

$ make check-headers CHECK_HEADERS="target.h inf-loop.h"
...
../../binutils-gdb/gdb/inf-loop.h:23:42: error: use of enum 'inferior_event_type' without previous declaration
 extern void inferior_event_handler (enum inferior_event_type event_type,
                                          ^
gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* inf-loop.c: Don't include "target.h".
* inf-loop.h: Include it here.

7 years agoInclude doublest.h and expression.h in dfp.h
Yao Qi [Fri, 6 Jan 2017 14:26:45 +0000 (14:26 +0000)]
Include doublest.h and expression.h in dfp.h

$ make check-headers CHECK_HEADERS="dfp.h"
...
../../binutils-gdb/gdb/dfp.h:39:8: error: 'DOUBLEST' does not name a type
 extern DOUBLEST decimal_to_doublest (const gdb_byte *from, int len,
        ^
../../binutils-gdb/gdb/dfp.h:41:33: error: use of enum 'exp_opcode' without previous declaration
 extern void decimal_binop (enum exp_opcode,
                                 ^
gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* dfp.h: Include "dboulest.h" and "expression.h".

7 years agoInclude ax.h in ax-gdb.h
Yao Qi [Fri, 6 Jan 2017 14:26:45 +0000 (14:26 +0000)]
Include ax.h in ax-gdb.h

$ make check-headers CHECK_HEADERS="ax-gdb.h"
...

../../binutils-gdb/gdb/ax-gdb.h:104:8: error: 'agent_expr_up' does not name a type
 extern agent_expr_up gen_trace_for_expr (CORE_ADDR, struct expression *,
        ^

gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* ax-gdb.h: Include "ax.h"

7 years agoUpdate gdb_ptrace.h in HFILES_NO_SRCDIR
Yao Qi [Fri, 6 Jan 2017 14:03:02 +0000 (14:03 +0000)]
Update gdb_ptrace.h in HFILES_NO_SRCDIR

Commit e379037 (Move gdb_ptrace.h to nat/), so we should update
file name in HFILES_NO_SRCDIR too.  Otherwise, 'make tags' complains,

$ make tags
make: *** No rule to make target `gdb_ptrace.h', needed by `TAGS'.  Stop.

gdb:

2017-01-06  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (HFILES_NO_SRCDIR): Replace gdb_ptrace.h
with nat/gdb_ptrace.h.

7 years agoRetire Paul Brook as an ARM maintainer.
Nick Clifton [Fri, 6 Jan 2017 12:24:54 +0000 (12:24 +0000)]
Retire Paul Brook as an ARM maintainer.

* MAINTAINERS: Move Paul Brook to the Past Maintainers section.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 6 Jan 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix ARI warning
Yao Qi [Thu, 5 Jan 2017 14:44:20 +0000 (14:44 +0000)]
Fix ARI warning

This patch splits the expression before the && operator instead of
after it.

gdb:

2017-01-05  Yao Qi  <yao.qi@linaro.org>

* mips-fbsd-tdep.c (mips_fbsd_sigframe_init): Move && to
new line.
(mips64_fbsd_sigframe_init): Likewise.

7 years agoPrevent an abort in the FRV disassembler if the target bfd name is unknown.
Nick Clifton [Thu, 5 Jan 2017 09:11:47 +0000 (09:11 +0000)]
Prevent an abort in the FRV disassembler if the target bfd name is unknown.

PR 20946
* frv-desc.c (lookup_mach_via_bfd_name): Return NULL if the name
could not be matched.
(frv_cgen_cpu_open): Allow for lookup_mach_via_bfd_name returning
NULL.

7 years agoFive fixes, for fcsel, fcvtz, fminnm, mls, and non-widening mul.
Jim Wilson [Thu, 5 Jan 2017 00:05:27 +0000 (16:05 -0800)]
Five fixes, for fcsel, fcvtz, fminnm, mls, and non-widening mul.

sim/aarch64/
* cpustate.c: Include math.h.
(aarch64_set_FP_float): Use signbit to check for signed zero.
(aarch64_set_FP_double): Likewise.
* simulator.c (do_vec_MOV_immediate, case 0x8): Add missing break.
(do_vec_mul): In all DO_VEC_WIDENING_MUL calls, make second and fourth
args same size as third arg.
(fmaxnm): Use isnan instead of fpclassify.
(fminnm, dmaxnm, dminnm): Likewise.
(do_vec_MLS): Reverse order of subtraction operands.
(dexSimpleFPCondSelect): Call aarch64_get_FP_double or
aarch64_get_FP_float to get source register contents.
(UINT_MIN, ULONG_MIN, FLOAT_UINT_MAX, FLOAT_UINT_MIN,
DOUBLE_UINT_MAX, DOUBLE_UINT_MIN, FLOAT_ULONG_MAX, FLOAT_ULONG_MIN,
DOUBLE_ULONG_MAX, DOUBLE_ULONG_MIN): New.
(do_fcvtzu): Use ULONG instead of LONG, and UINT instead of INT in
raise_exception calls.

sim/testsuite/sim/aarch64/
* fcsel.s: New.
* fcvtz.s: New.
* fminnm.s: New.
* mls.s: New.
* mul.s: New.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 5 Jan 2017 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoUse correct OSABI constant for FreeBSD/mips binaries.
John Baldwin [Wed, 4 Jan 2017 20:15:22 +0000 (12:15 -0800)]
Use correct OSABI constant for FreeBSD/mips binaries.

gdb/ChangeLog:

* mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Use
GDB_OSABI_FREEBSD instead of GDB_OSABI_FREEBSD_ELF.

7 years agoAdd native target for FreeBSD/mips.
John Baldwin [Wed, 4 Jan 2017 17:41:58 +0000 (09:41 -0800)]
Add native target for FreeBSD/mips.

This supports the o32 and n64 ABIs.

gdb/ChangeLog:

* Makefile.in (ALLDEPFILES): Add mips-fbsd-nat.c.
* NEWS: Mention new FreeBSD/mips native configuration.
* config/mips/fbsd.mh: New file.
* configure.host: Add mips*-*-freebsd*.
* mips-fbsd-nat.c: New file.

7 years agoAdd FreeBSD/mips architecture.
John Baldwin [Wed, 4 Jan 2017 17:41:58 +0000 (09:41 -0800)]
Add FreeBSD/mips architecture.

This has been tested for the n64 and o32 ABIs.  Signal frame unwinders for
both ABIs are provided.  FreeBSD/mips requires custom linkmap offsets since
it contains an additional l_off member in 'struct link_map' that other
FreeBSD platforms do not have.  Support for collecting and supplying
general purpose and floating point register sets are provided.  Common
routines for working with native format register sets are exported for
use by the native target.

gdb/ChangeLog:

* Makefile.in (ALL_TARGET_OBS): Add mips-fbsd-tdep.o.
(ALLDEPFILES): Add mips-fbsd-tdep.c.
* NEWS: Mention new FreeBSD/mips target.
* configure.tgt: Add mips*-*-freebsd*.
* mips-fbsd-tdep.c: New file.
* mips-fbsd-tdep.h: New file.

gdb/doc/ChangeLog:

* gdb.texinfo (Contributors): Add SRI International and University
of Cambridge for FreeBSD/mips.

7 years agoUse noyywrap option in lex files.
Dilan Palauzov [Wed, 4 Jan 2017 16:05:22 +0000 (16:05 +0000)]
Use noyywrap option in lex files.

ld PR 20958
* ldlex.l (option): Add noyywrap
(yywrap): Delete.
* ldlex.h (yywrap): Delete prototype.

binutils
PR 20958
* syslex.l (option): Add noyywrap
(yywrap): Delete.

7 years ago[DWARF] Sync GCC dwarf.def change on AArch64
Jiong Wang [Wed, 4 Jan 2017 14:27:52 +0000 (14:27 +0000)]
[DWARF] Sync GCC dwarf.def change on AArch64

include/
* dwarf2.def: Sync with mainline gcc sources.

7 years agoupdate-copyright.py for binutils
Alan Modra [Wed, 4 Jan 2017 13:19:58 +0000 (23:49 +1030)]
update-copyright.py for binutils

This is a modified form of gcc's contrib/update-copyright.py.

* update-copyright.py: New file.
* add-log.el: Update copyright year range.
* texi2pod.pl: Likewise.

7 years agoSync libiberty from gcc
Alan Modra [Wed, 4 Jan 2017 13:17:07 +0000 (23:47 +1030)]
Sync libiberty from gcc

Picks up copyright year update and other recent fixes.

7 years agopicflag.m4 high bit set in comment
Alan Modra [Sun, 18 Dec 2016 06:36:40 +0000 (17:06 +1030)]
picflag.m4 high bit set in comment

* picflag.m4: Import from gcc.

7 years ago[AArch64] Add separate feature flag for weaker release consistent load insns
Szabolcs Nagy [Wed, 4 Jan 2017 12:27:10 +0000 (12:27 +0000)]
[AArch64] Add separate feature flag for weaker release consistent load insns

The weaker release consistency support of ARMv8.3-A is allowed as an optional
extension for ARMv8.2-A, so separate command line option and feature flag is
added: -march=armv8.2-a+rcpc turns LDAPR, LDAPRB, LDAPRH instructions on.

opcodes/
* aarch64-tbl.h (RCPC, RCPC_INSN): Define.
(aarch64_opcode_table): Use RCPC_INSN.

include/
* opcode/aarch64.h (AARCH64_FEATURE_RCPC): Define.
(AARCH64_ARCH_V8_3): Update.

gas/
* config/tc-aarch64.c (aarch64_features): Add rcpc.
* doc/c-aarch64.texi (AArch64 Extensions): Document rcpc.
* testsuite/gas/aarch64/ldst-exclusive-armv8_3.d: Rename to ...
* testsuite/gas/aarch64/ldst-rcpc.d: This.
* testsuite/gas/aarch64/ldst-exclusive-armv8_3.s: Rename to ...
* testsuite/gas/aarch64/ldst-rcpc.s: This.
* testsuite/gas/aarch64/ldst-rcpc-armv8_2.d: New test.

7 years agoWhen configuring GAS treat as sparcv9 target the same way as a sparc64 target.
Norm Jacobs [Wed, 4 Jan 2017 11:49:00 +0000 (11:49 +0000)]
When configuring GAS treat as sparcv9 target the same way as a sparc64 target.

PR gas/20992
* configure.tgt: Treat sparcv9 as sparc64.

7 years agoFix an internal error on writing pieced value
Yao Qi [Wed, 4 Jan 2017 09:32:46 +0000 (09:32 +0000)]
Fix an internal error on writing pieced value

In ee40d8d (Move computed value's frame id to piece_closure), I only
updated read_pieced_value to use frame_id from piece_closure, but
forgot to update write_pieced_value, so it causes the following
internal error on arm-linux,

set variable l = 4^M
gdb/git/gdb/value.c:1579: internal-error: frame_id* deprecated_value_next_frame_id_hack(value*): Assertion `value->lval == lval_register' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.base/store.exp: var longest l; setting l to 4 (GDB internal error)

This patch fixes the internal error.

gdb:

2017-01-04  Yao Qi  <yao.qi@linaro.org>

* dwarf2loc.c (write_pieced_value): Don't use VALUE_FRAME_ID (to),
use c->frame_id when the piece location is DWARF_VALUE_REGISTER.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 4 Jan 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoCheck for shared lib support before running ld tests with -shared
Alan Modra [Tue, 3 Jan 2017 22:55:54 +0000 (09:25 +1030)]
Check for shared lib support before running ld tests with -shared

Another fix now that we run these tests non-native.

* testsuite/ld-elf/audit.exp: Check for shared lib support.
* testsuite/ld-elf/compress.exp: Likewise.
* testsuite/ld-elf/dwarf.exp: Likewise.
* testsuite/ld-elf/shared.exp: Likewise.
* testsuite/ld-elf/wrap.exp: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
* testsuite/ld-plugin/lto.exp: Check $CXX exists.

7 years agobfd: alpha: Fix crash caused by double free with --no-keep-memory
James Clarke [Tue, 3 Jan 2017 16:15:15 +0000 (16:15 +0000)]
bfd: alpha: Fix crash caused by double free with --no-keep-memory

Without this, ld has been seen to crash in libc when freeing tsec_free:

*** Error in `/usr/bin/ld': double free or corruption (!prev): 0x0000000120ceb6a0 ***

_bfd_elf_link_read_relocs will always return the cached value if
present, even if keep_memory is false, therefore setting tsec_free to
NULL only when keep_memory is true is not sufficient.

* elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
if relocs are cached.

7 years agoAdd support for the Q extension to the RISCV ISA.
Kito Cheng [Tue, 3 Jan 2017 17:42:01 +0000 (17:42 +0000)]
Add support for the Q extension to the RISCV ISA.

gas    * config/tc-riscv.c (riscv_set_arch): Whitelist the "q" ISA
        extension.
        (riscv_after_parse_args): Set FLOAT_ABI_QUAD when the Q ISA is
        enabled and no other ABI is specified.

include * opcode/riscv-opc.h: Add support for the "q" ISA extension.

opcodes * riscv-opc.c (riscv-opcodes): Add support for the "q" ISA
        extension.
        * riscv-opcodes/all-opcodes: Likewise.

7 years agoFix generation of GOT table when only GOT-relative relocs are used.
Rich Felker [Tue, 3 Jan 2017 16:18:41 +0000 (16:18 +0000)]
Fix generation of GOT table when only GOT-relative relocs are used.

PR ld/21017
* elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
for R_MICROBLAZE_GOTOFF_64.

7 years agoAdd fall through comment.
Dilyan Palauzov [Tue, 3 Jan 2017 16:02:36 +0000 (16:02 +0000)]
Add fall through comment.

* riscv-dis.c (print_insn_args): Add fall through comment.

7 years agoAdd new Serbian translation for the opcodes library.
Nick Clifton [Tue, 3 Jan 2017 15:51:11 +0000 (15:51 +0000)]
Add new Serbian translation for the opcodes library.

* po/sr.po: New Serbian translation.
* configure.ac (ALL_LINGUAS): Add sr.
* configure: Regenerate.

7 years agoFix compile time warning about using a possibly uninitialised variable.
Nick Clifton [Tue, 3 Jan 2017 15:26:27 +0000 (15:26 +0000)]
Fix compile time warning about using a possibly uninitialised variable.

7 years agoSync dwarf headers with master versions in gcc repository.
Nick Clifton [Tue, 3 Jan 2017 15:17:48 +0000 (15:17 +0000)]
Sync dwarf headers with master versions in gcc repository.

* dwarf2.def: Sync with mainline gcc sources
* dwarf2.h: Likewise.

2016-12-21  Jakub Jelinek  <jakub@redhat.com>

* dwarf2.def (DW_FORM_ref_sup): Renamed to ...
(DW_FORM_ref_sup4): ... this.  New form.
(DW_FORM_ref_sup8): New form.

2016-10-17  Jakub Jelinek  <jakub@redhat.com>

* dwarf2.h (enum dwarf_calling_convention): Add new DWARF5
calling convention codes.
(enum dwarf_line_number_content_type): New.
(enum dwarf_location_list_entry_type): Add DWARF5 DW_LLE_*
codes.
(enum dwarf_source_language): Add new DWARF5 DW_LANG_* codes.
(enum dwarf_macro_record_type): Add DWARF5 DW_MACRO_* codes.
(enum dwarf_name_index_attribute): New.
(enum dwarf_range_list_entry): New.
(enum dwarf_unit_type): New.
* dwarf2.def: Add new DWARF5 DW_TAG_*, DW_FORM_*, DW_AT_*,
DW_OP_* and DW_ATE_* entries.

2016-08-15  Jakub Jelinek  <jakub@redhat.com>

* dwarf2.def (DW_AT_string_length_bit_size,
DW_AT_string_length_byte_size): New attributes.

2016-08-12  Alexandre Oliva <aoliva@redhat.com>

PR debug/63240
* dwarf2.def (DW_AT_deleted, DW_AT_defaulted): New.
* dwarf2.h (enum dwarf_defaulted_attribute): New.

7 years agoCheck ld_compile return status
Alan Modra [Tue, 3 Jan 2017 12:30:30 +0000 (23:00 +1030)]
Check ld_compile return status

* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Do not
allow test to continue after compilation errors.
(run_cc_link_tests): Likewise.

7 years agoFix PRU GAS for 32-bit hosts
Dimitar Dimitrov [Mon, 2 Jan 2017 16:20:21 +0000 (18:20 +0200)]
Fix PRU GAS for 32-bit hosts

The PRU GAS port I originally submitted does not build on 32bit hosts.
This patch fixes it by aligning md_number_to_chars's definition with
the global declaration in tc.h.

Here is the original bug report I got:
  https://github.com/rcn-ee/repos/pull/23#issuecomment-269915175

* config/tc-pru.c (md_number_to_chars): Fix parameter to be
valueT, as declared in tc.h.
(md_apply_fix): Fix to work on 32-bit hosts.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
7 years agoFix PRU LD for --enable-targets=all config option
Dimitar Dimitrov [Mon, 2 Jan 2017 16:20:20 +0000 (18:20 +0200)]
Fix PRU LD for --enable-targets=all config option

I noticed that PRU LD is broken when BFD is configured
with --enable-targets=all.  This patch fixes it, and takes the
opportunity to clean the epruelf.c dependencies.

* Makefile.am (ALL_EMULATION_SOURCES): Add epruelf.c.
(epruelf.c): Remove unneeded dependencies.
* Makefile.in: Regenerate

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
7 years agoAdd -rpath-link to various tests
Alan Modra [Tue, 3 Jan 2017 01:57:19 +0000 (12:27 +1030)]
Add -rpath-link to various tests

Needed for cross-builds without --sysroot, where USE_LIBPATH isn't
set.  See elf32.em after_open.  Perhap ld ought to look at -rpath in
this case?

* testsuite/ld-elf/shared.exp: Add -rpath-link and -no-as-needed
to various tests.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-elfvers/vers.exp (vers19): Fix -rpath-link option.

7 years agoDon't run C tests in ld testsuite unless we have a C compiler
Alan Modra [Mon, 2 Jan 2017 23:08:53 +0000 (09:38 +1030)]
Don't run C tests in ld testsuite unless we have a C compiler

Removing the [isnative] check requires that we test for a C compiler.

* testsuite/ld-elf/elf.exp: Check that $CC exists before C tests.
* testsuite/ld-pie/pie.exp: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 Jan 2017 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoRegen opcodes cgen files
Alan Modra [Mon, 2 Jan 2017 13:27:58 +0000 (23:57 +1030)]
Regen opcodes cgen files

* epiphany-desc.h: Regenerate.
* epiphany-opc.h: Regenerate.
* fr30-desc.h: Regenerate.
* fr30-opc.h: Regenerate.
* frv-desc.h: Regenerate.
* frv-opc.h: Regenerate.
* ip2k-desc.h: Regenerate.
* ip2k-opc.h: Regenerate.
* iq2000-desc.h: Regenerate.
* iq2000-opc.h: Regenerate.
* lm32-desc.h: Regenerate.
* lm32-opc.h: Regenerate.
* m32c-desc.h: Regenerate.
* m32c-opc.h: Regenerate.
* m32r-desc.h: Regenerate.
* m32r-opc.h: Regenerate.
* mep-desc.h: Regenerate.
* mep-opc.h: Regenerate.
* mt-desc.h: Regenerate.
* mt-opc.h: Regenerate.
* or1k-desc.h: Regenerate.
* or1k-opc.h: Regenerate.
* xc16x-desc.h: Regenerate.
* xc16x-opc.h: Regenerate.
* xstormy16-desc.h: Regenerate.
* xstormy16-opc.h: Regenerate.

7 years agoRun more ld tests when not native
Alan Modra [Mon, 2 Jan 2017 12:15:37 +0000 (22:45 +1030)]
Run more ld tests when not native

Many of the ld tests are not run for cross builds, in some cases
because the test needs to run a newly linked executable, and in others
simply because it was easier to write the test for native only.  Even
when a test needs to run, it's good to compile and link to exercise
the linker.  So that's what this patch does.  I've also rid us of
the old ld_link procedure with all the HOSTING_CRT0 etc. setup.  It's
much simpler to just link with $CC.

This does mean that a cross build with cross-compiler installed but
no cross C-library will give lots of failures.  If that turns out to
be too annoying, I guess we can write a tcl procedure to detect it and
not run all the extra tests.

* Makefile.am (bootstrap): Delete rule.
(ld-partial, ld1, ld1-full, ld2, ld3): Likewise.
(HOSTING_CRT0, HOSTING_SCRT0): Don't define.
(HOSTING_LIBS, HOSTING_SLIBS, HOSTING_EMU): Likewise.
* configure.ac (HOSTING_CRT0, HOSTING_SCRT0): Don't define.
(HOSTING_LIBS, HOSTING_SLIBS): Likewise.
* configure.host (HOSTING_CRT0, HOSTING_LIBS): Don't define.
* Makefile.in: Regenerate.
* configure: Regenerate.
* testsuite/config/default.exp (get_link_files): Delete.
(HOSTING_CRT0, HOSTING_SCRT0, HOSTING_LIBS, HOSTING_SLIBS): Don't
define.
(ld_simple_link): Delete.
* testsuite/lib/ld-lib.exp (default_ld_link): Delete
(default_ld_simple_link): Rename to default_ld_link.
(ld_simple_link_defsyms): Rename to ld_link_defsyms.
(run_ld_link_tests): Use ld_link, not ld_simple_link.
(run_cc_link_tests): Likewise.
(run_ld_link_exec_tests): Use $CC or $CXX to link, not $ld.
Don't run exe when not native, and return unsupported.
* testsuite/ld-bootstrap/bootstrap.exp: Create gccld1 etc. dirs.
Link ld1 etc. using $CC.
* testsuite/ld-cdtest/cdtest.exp: Link cdtest using $CC.
* testsuite/ld-checks/checks.exp: Use ld_link, not ld_simple_link.
* testsuite/ld-cygwin/exe-export.exp: Likewise.
* testsuite/ld-elf/binutils.exp: Likewise.
* testsuite/ld-elf/eh-group.exp: Likewise.
* testsuite/ld-elf/exclude.exp: Likewise.
* testsuite/ld-elf/frame.exp: Likewise.
* testsuite/ld-elf/sec-to-seg.exp: Likewise.
* testsuite/ld-elf/tls_common.exp: Likewise.
* testsuite/ld-elfcomm/elfcomm.exp: Likewise.
* testsuite/ld-fastcall/fastcall.exp: Likewise.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-ifunc/binutils.exp: Likewise.
* testsuite/ld-mep/mep.exp: Likewise.
* testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise.
* testsuite/ld-mn10300/mn10300.exp: Likewise.
* testsuite/ld-nios2/nios2.exp: Likewise.
* testsuite/ld-pe/pe-compile.exp: Likewise.
* testsuite/ld-pe/pe-run.exp: Likewise.
* testsuite/ld-pe/pe-run2.exp: Likewise.
* testsuite/ld-plugin/plugin.exp: Likewise.
* testsuite/ld-scripts/align.exp: Likewise.
* testsuite/ld-scripts/alignof.exp: Likewise.
* testsuite/ld-scripts/assert.exp: Likewise.
* testsuite/ld-scripts/defined.exp: Likewise.
* testsuite/ld-scripts/extern.exp: Likewise.
* testsuite/ld-scripts/log2.exp: Likewise.
* testsuite/ld-scripts/map-address.exp: Likewise.
* testsuite/ld-scripts/phdrs.exp: Likewise.
* testsuite/ld-scripts/phdrs2.exp: Likewise.
* testsuite/ld-scripts/script.exp: Likewise.
* testsuite/ld-scripts/section-flags.exp: Likewise.
* testsuite/ld-scripts/sizeof.exp: Likewise.
* testsuite/ld-scripts/sysroot-prefix.exp: Likewise.
* testsuite/ld-scripts/weak.exp: Likewise.
* testsuite/ld-selective/selective.exp: Likewise.
* testsuite/ld-sh/sh.exp: Likewise.
* testsuite/ld-sh/sh64/relax.exp: Likewise.
* testsuite/ld-sh/sh64/relfail.exp: Likewise.
* testsuite/ld-srec/srec.exp: Likewise.
* testsuite/ld-tic6x/tic6x.exp: Likewise.
* testsuite/ld-undefined/weak-undef.exp: Likewise.
* testsuite/ld-versados/versados.exp: Likewise.
* testsuite/ld-x86-64/dwarfreloc.exp: Likewise.
* testsuite/ld-xtensa/coalesce.exp: Likewise.
* testsuite/ld-xtensa/diff_overflow.exp: Likewise.
* testsuite/ld-xtensa/lcall.exp: Likewise.
* testsuite/ld-elf/audit.exp: Run non-native too.
* testsuite/ld-elf/compress.exp: Likewise.  Replace ld options with
gcc -Wl, options.
* testsuite/ld-elf/dwarf.exp: Run non-native too.  Use ld_link,
not ld_simple_link.  Add -Wl,--no-as-needed to some tests.
* testsuite/ld-elf/elf.exp: Run non-native too.  Formatting.
* testsuite/ld-elf/indirect.exp: Run non-native too.  Add
-Wl,--no-as-needed to most tests.
* testsuite/ld-elf/shared.exp: Run non-native too.  Use braces
to simplify quoting.  Set run_tests using [list] rather than
brace assignment to expand $extralibs.  Add -Wl,--no-as-needed
to many test.  Prefix ld options with -Wl,.
(mix_pic_and_non_pic): Don't run exe if not native.
* testsuite/ld-elf/wrap.exp: Run non-native too.  Add
-Wl,--no-as-needed and prefix ld options with -Wl,.
* testsuite/ld-elfvers/vers.exp: Run non-native too.  Use ld_link,
not ld_simple_link.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
(visibility_test): Don't run exe if not native.
* testsuite/ld-elfweak/elfweak.exp: Run non-native too.  Use ld_link,
not ld_simple_link.
(build_exec): Don't run exe if not native.
* testsuite/ld-ifunc/ifunc.exp: Run non-native too.  Use ld_link,
not ld_simple_link.  Link using $CC.  Add -Wl,--no-as-needed
to some tests and prefix ld options with -Wl,.  Expect GNU
for hppa-linux even when no ifuncs.  Delete cleanup.
* testsuite/ld-pie/pie.exp: Run non-native too.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-shared/shared.exp: Likewise.  Use ld_link,
not ld_simple_link.
(shared_test): Don't run exe if not native.
* testsuite/ld-size/size.exp: Run non-native too.  Add
-Wl,--no-as-needed to some tests.  Prefix ld options with -Wl,.
* testsuite/ld-unique/unique.exp: Run non-native too.  Use ld_link,
not ld_simple_link.  Link using $CC.  Add -Wl,--no-as-needed
to some tests and prefix ld options with -Wl,.  Expect GNU
for hppa-linux even when no unique syms.  Delete cleanup.
* testsuite/ld-x86-64/tls.exp: Add -Wl,--no-as-needed to some
tests and prefix ld options with -Wl,.
* testsuite/ld-x86-64/x86-64.exp: Use ld_link, not ld_simple_link.
Add -Wl,--no-as-needed to some tests.  Prefix ld options with -Wl,.

7 years agoSupport -z relro on metag
Alan Modra [Mon, 2 Jan 2017 12:13:15 +0000 (22:43 +1030)]
Support -z relro on metag

* emulparams/elf32metag.sh (COMMONPAGESIZE): Define.

7 years agoSupport -z relro on hppa
Alan Modra [Mon, 2 Jan 2017 12:03:47 +0000 (22:33 +1030)]
Support -z relro on hppa

PR ld/21000
* emulparams/hppalinux.sh (DATA_ADDR, SHLIB_DATA_ADDR): Don't define.
(DATA_SEGMENT_ALIGN, DATA_SEGMENT_END, DATA_SEGMENT_RELRO_END): Define.
* scripttempl/elf.sc: Don't define the above if DATA_SEGMENT_ALIGN
is already defined.

7 years agoDon't make symbols dynamic other than undef weak
Alan Modra [Mon, 2 Jan 2017 12:01:27 +0000 (22:31 +1030)]
Don't make symbols dynamic other than undef weak

Fixes: tmpdir/pr14525: symbol lookup error: tmpdir/pr14525: undefined
symbol: __executable_start
FAIL: PIE PR ld/14525

* elf32-hppa.c (ensure_undef_weak_dynamic): New function.
(allocate_plt_static, allocate_dynrelocs): Use it.

7 years agoSet SHF_INFO_LINK for .PARISC.unwind
Alan Modra [Mon, 2 Jan 2017 11:58:29 +0000 (22:28 +1030)]
Set SHF_INFO_LINK for .PARISC.unwind

This flag should be set for any section header using sh_info to
point to another section.

Fixes a readelf warning about an unexpected value in info field,
resulting in FAIL: Build warn libbar.so

* elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
.PARISC.unwind section.

7 years agoPR20989, sparc GOT sequence optimisation
Alan Modra [Mon, 2 Jan 2017 11:36:28 +0000 (22:06 +1030)]
PR20989, sparc GOT sequence optimisation

PR ld/20989
* elfxx-sparc.c (gdop_relative_offset_ok): New function.
(_bfd_sparc_elf_relocate_section): Use it to validate GOT
indirect to GOT pointer relative code edit.

7 years agoUpdate year range in copyright notice of all files.
Alan Modra [Mon, 2 Jan 2017 03:36:43 +0000 (14:06 +1030)]
Update year range in copyright notice of all files.

7 years agoChangeLog rotation
Alan Modra [Mon, 2 Jan 2017 03:25:05 +0000 (13:55 +1030)]
ChangeLog rotation

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 Jan 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoupdate copyright year range in GDB files
Joel Brobecker [Sun, 1 Jan 2017 06:50:51 +0000 (10:50 +0400)]
update copyright year range in GDB files

This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.