]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
8 years agoMostly trivial enum fixes
Simon Marchi [Fri, 31 Jul 2015 17:19:53 +0000 (13:19 -0400)] 
Mostly trivial enum fixes

This is a patch I extracted from Pedro's C++ branch.  It contains the
most trivial enum fixes, where an integer type/value was used instead
of the appropriate enum type/value.  It fixes many C++ errors, since
in C++ you can't mix integers and enums implicitely.

Regardless of the C++ conversion, I think this is a good cleanup to make
use of the appropriate enum types.

Regression-tested on native x86_64.

gdb/ChangeLog:

* aarch64-linux-nat.c (aarch64_linux_can_use_hw_breakpoint): Use enum
type or value instead of integer.
(aarch64_linux_insert_watchpoint): Likewise.
(aarch64_linux_remove_watchpoint): Likewise.
* ada-lang.c (ada_op_print_tab): Likewise.
* amd64-linux-tdep.c (amd64_canonicalize_syscall): Likewise.
(amd64_linux_syscall_record_common): Likewise.
* arch-utils.c (target_byte_order_user): Likewise.
(default_byte_order): Likewise.
* arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Likewise.
(arm_linux_get_hwbp_type): Likewise.
(arm_linux_hw_watchpoint_initialize): Likewise.
(arm_linux_insert_watchpoint): Likewise.
* arm-linux-tdep.c (arm_canonicalize_syscall): Likewise.
(arm_linux_syscall_record): Likewise.
* breakpoint.c (update_watchpoint): Likewise.
(breakpoint_here_p): Likewise.
(bpstat_print): Likewise.
(enable_breakpoint_disp): Likewise.
* c-lang.c (c_op_print_tab): Likewise.
* cli/cli-decode.c (add_info_alias): Likewise.
* d-lang.c (d_op_print_tab): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* f-exp.y (dot_ops): Likewise.
(f77_keywords): Likewise.
* f-lang.c (f_op_print_tab): Likewise.
* go-lang.c (go_op_print_tab): Likewise.
* guile/scm-breakpoint.c (gdbscm_make_breakpoint): Likewise.
* guile/scm-cmd.c (gdbscm_make_command): Likewise.
* guile/scm-param.c (gdbscm_make_parameter): Likewise.
* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Likewise.
* guile/scm-string.c (struct scm_to_stringn_data): Likewise.
(struct scm_from_stringn_data): Likewise.
* i386-linux-tdep.c (i386_canonicalize_syscall): Likewise.
* ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise.
(ia64_linux_remove_watchpoint): Likewise.
(ia64_linux_can_use_hw_breakpoint): Likewise.
* infrun.c (print_stop_event): Likewise.
* jv-lang.c (java_op_print_tab): Likewise.
* linux-nat.c (linux_proc_xfer_partial): Likewise.
* linux-nat.h (struct lwp_info): Likewise.
* linux-thread-db.c (enable_thread_event): Likewise.
* m2-lang.c (m2_op_print_tab): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Likewise.
(mi_cmd_stack_list_variables): Likewise.
* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
* mi/mi-out.c (mi_table_begin): Likewise.
(mi_table_header): Likewise.
* mips-linux-nat.c (mips_linux_can_use_hw_breakpoint): Likewise.
(mips_linux_insert_watchpoint): Likewise.
(mips_linux_remove_watchpoint): Likewise.
* nat/mips-linux-watch.c (mips_linux_watch_type_to_irw): Likewise.
* nat/mips-linux-watch.h (struct mips_watchpoint): Likewise.
(mips_linux_watch_type_to_irw): Likewise.
* nto-procfs.c (procfs_can_use_hw_breakpoint): Likewise.
(procfs_insert_hw_watchpoint): Likewise.
(procfs_remove_hw_watchpoint): Likewise.
(procfs_hw_watchpoint): Likewise.
(procfs_can_use_hw_breakpoint): Likewise.
(procfs_remove_hw_watchpoint): Likewise.
(procfs_insert_hw_watchpoint): Likewise.
* p-lang.c (pascal_op_print_tab): Likewise.
* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Likewise.
* ppc-linux-tdep.c (ppu2spu_unwind_register): Likewise.
* ppc-sysv-tdep.c (get_decimal_float_return_value): Likewise.
* procfs.c (procfs_can_use_hw_breakpoint): Likewise.
(procfs_insert_watchpoint): Likewise.
(procfs_remove_watchpoint): Likewise.
* psymtab.c (recursively_search_psymtabs): Likewise.
* remote-m32r-sdi.c (m32r_can_use_hw_watchpoint): Likewise.
(m32r_insert_watchpoint): Likewise.
* remote-mips.c (mips_can_use_watchpoint): Likewise.
(mips_insert_watchpoint): Likewise.
(mips_remove_watchpoint): Likewise.
* remote.c (watchpoint_to_Z_packet): Likewise.
(remote_insert_watchpoint): Likewise.
(remote_remove_watchpoint): Likewise.
(remote_check_watch_resources): Likewise.
* s390-linux-nat.c (s390_insert_watchpoint): Likewise.
(s390_remove_watchpoint): Likewise.
(s390_can_use_hw_breakpoint): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* spu-linux-nat.c (spu_can_use_hw_breakpoint): Likewise.
* target.h (struct target_ops): Likewise.
* tilegx-tdep.c (tilegx_analyze_prologue): Likewise.
* ui-out.c (struct ui_out_hdr): Likewise.
(append_header_to_list): Likewise.
(get_next_header): Likewise.
(verify_field): Likewise.
(ui_out_begin): Likewise.
(ui_out_field_int): Likewise.
(ui_out_field_fmt_int): Likewise.
(ui_out_field_skip): Likewise.
(ui_out_field_string): Likewise.
(ui_out_field_fmt): Likewise.
* varobj.c (new_variable): Likewise.
* x86-nat.c (x86_insert_watchpoint): Likewise.
(x86_remove_watchpoint): Likewise.
(x86_can_use_hw_breakpoint): Likewise.
* xtensa-tdep.h (struct gdbarch_tdep): Likewise.
* inflow.c (enum gdb_has_a_terminal_flag_enum): Add name to
previously anonymous enumeration type..
* linux-record.h (enum gdb_syscall): Add gdb_sys_no_syscall
value.
* target-debug.h (target_debug_print_enum_target_hw_bp_type): New.
(target_debug_print_enum_bptype): New.
* target-delegates.c: Regenerate.

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

8 years agoReplace incorrect patch to gdb.cp/var-tag.exp.
Sandra Loosemore [Thu, 30 Jul 2015 21:20:01 +0000 (14:20 -0700)] 
Replace incorrect patch to gdb.cp/var-tag.exp.

2015-07-30  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.cp/var-tag.exp (do_global_tests): Revert broken commit
4bc4d42859e3b42c79c89295ef39944bdb3e6753 and apply the
correct patch.

8 years agoDon't allow non-stack memory writes in the prologue for nios2.
Sandra Loosemore [Thu, 30 Jul 2015 20:26:03 +0000 (13:26 -0700)] 
Don't allow non-stack memory writes in the prologue for nios2.

2015-07-30  Sandra Loosemore  <sandra@codesourcery.com>

gdb/
* nios2-tdep.c (nios2_analyze_prologue): Do what the comment
already says and disallow non-stack memory writes in the prologue.

8 years agoUpdate trap/break handling in nios2 prologue analyzer.
Sandra Loosemore [Thu, 30 Jul 2015 20:23:43 +0000 (13:23 -0700)] 
Update trap/break handling in nios2 prologue analyzer.

2015-07-30  Sandra Loosemore  <sandra@codesourcery.com>

gdb/
* nios2-tdep.c (nios2_analyze_prologue): Update comments to
reflect how current GCC emits stack overflow checks.  Match
both trap and break instructions for backward compatibility.
Disallow other trap and break instructions in the prologue.

8 years agoRestrict gdb.arch/ppc64-symtab-cordic.exp to ppc64 targets.
Sandra Loosemore [Thu, 30 Jul 2015 19:06:29 +0000 (12:06 -0700)] 
Restrict gdb.arch/ppc64-symtab-cordic.exp to ppc64 targets.

2015-07-30  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.arch/ppc64-symtab-cordic.exp: Restrict to ppc64 targets.

8 years agoReapply fix for gdb.cp/var-tag.exp C++ failures.
Sandra Loosemore [Thu, 30 Jul 2015 18:52:49 +0000 (11:52 -0700)] 
Reapply fix for gdb.cp/var-tag.exp C++ failures.

2015-07-30  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/

Reapply:
2014-05-21  Mark Wielaard  <mjw@redhat.com>

* gdb.cp/var-tag.exp (do_global_tests): Handle underlying type.

8 years agoremote follow fork and spurious child stops in non-stop mode
Pedro Alves [Thu, 30 Jul 2015 17:41:44 +0000 (18:41 +0100)] 
remote follow fork and spurious child stops in non-stop mode

Running gdb.threads/fork-plus-threads.exp against gdbserver in
extended-remote mode, even though the test passes, we still see broken
behavior:

 (gdb) PASS: gdb.threads/fork-plus-threads.exp: set detach-on-fork off
 continue &
 Continuing.
 (gdb) PASS: gdb.threads/fork-plus-threads.exp: continue &
 [New Thread 28092.28092]

 [Thread 28092.28092] #2 stopped.
 [New Thread 28094.28094]
 [Inferior 2 (process 28092) exited normally]
 [New Thread 28094.28105]
 [New Thread 28094.28109]

...

[Thread 28174.28174] #18 stopped.
 [New Thread 28185.28185]
 [Inferior 10 (process 28174) exited normally]
 [New Thread 28185.28196]

 [Thread 28185.28185] #20 stopped.
 Cannot remove breakpoints because program is no longer writable.
 Further execution is probably impossible.
 [Inferior 11 (process 28185) exited normally]
 [Inferior 1 (process 28091) exited normally]
 PASS: gdb.threads/fork-plus-threads.exp: reached breakpoint
 info threads
 No threads.
 (gdb) PASS: gdb.threads/fork-plus-threads.exp: no threads left
 info inferiors
   Num  Description       Executable
 * 1    <null>            /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.threads/fork-plus-threads
 (gdb) PASS: gdb.threads/fork-plus-threads.exp: only inferior 1 left

All the "[Thread FOO] #NN stopped." above are bogus, as well as the
"Cannot remove breakpoints because program is no longer writable.",
which is a consequence.

The problem is that when we intercept a fork event, we should report
the event for the parent, only, and leave the child stopped, but not
report its stop event.  GDB later decides whether to follow the parent
or the child.  But because handle_extended_wait does not set the
child's last_status.kind to TARGET_WAITKIND_STOPPED, a
stop_all_threads/unstop_all_lwps sequence (e.g., from trying to access
memory) by mistake ends up queueing a SIGSTOP on the child, resuming
it, and then when that SIGSTOP is intercepted, because the LWP has
last_resume_kind set to resume_stop, gdbserver reports the stop to
GDB, as GDB_SIGNAL_0:

...
 >>>> entering unstop_all_lwps
 unstopping all lwps
 proceed_one_lwp: lwp 1600
    client wants LWP to remain 1600 stopped
 proceed_one_lwp: lwp 1828
 Client wants LWP 1828 to stop. Making sure it has a SIGSTOP pending
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 Sending sigstop to lwp 1828
 pc is 0x3615ebc7cc
 Resuming lwp 1828 (continue, signal 0, stop expected)
   continue from pc 0x3615ebc7cc
 unstop_all_lwps done
 sigchld_handler
 <<<< exiting unstop_all_lwps
 handling possible target event
 >>>> entering linux_wait_1
 linux_wait_1: [<all threads>]
 my_waitpid (-1, 0x40000001)
 my_waitpid (-1, 0x1): status(137f), 1828
 LWFE: waitpid(-1, ...) returned 1828, ERRNO-OK
 LLW: waitpid 1828 received Stopped (signal) (stopped)
 pc is 0x3615ebc7cc
 Expected stop.
 LLW: resume_stop SIGSTOP caught for LWP 1828.1828.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
 linux_wait_1 ret = LWP 1828.1828, 1, 0
 <<<< exiting linux_wait_1
 Writing resume reply for LWP 1828.1828:1
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Tested on x86_64 Fedora 20, extended-remote.

gdb/gdbserver/ChangeLog:
2015-07-30  Pedro Alves  <palves@redhat.com>

* linux-low.c (handle_extended_wait): Set the child's last
reported status to TARGET_WAITKIND_STOPPED.

8 years agoPR threads/18600: Inferiors left around after fork+thread spawn
Pedro Alves [Wed, 22 Jul 2015 17:01:46 +0000 (18:01 +0100)] 
PR threads/18600: Inferiors left around after fork+thread spawn

The new gdb.threads/fork-plus-threads.exp test exposes one more
problem.  When one types "info inferiors" after running the program,
one see's a couple inferior left still, while there should only be
inferior #1 left.  E.g.:

 (gdb) info inferiors
   Num  Description       Executable
   4    process 8393      /home/pedro/bugs/src/test
   2    process 8388      /home/pedro/bugs/src/test
 * 1    <null>            /home/pedro/bugs/src/test
 (gdb) info threads

Calling prune_inferiors() manually at this point (from a top gdb) does
not remove them, because they still have inf->pid != 0 (while they
shouldn't).  This suggests that we never mourned those inferiors.

Enabling logs (master + previous patch) we see:

 ...
 WL: waitpid Thread 0x7ffff7fc2740 (LWP 9513) received Trace/breakpoint trap (stopped)
 WL: Handling extended status 0x03057f
 LHEW: Got clone event from LWP 9513, new child is LWP 9579
 [New Thread 0x7ffff37b8700 (LWP 9579)]
 WL: waitpid Thread 0x7ffff7fc2740 (LWP 9508) received 0 (exited)
 WL: Thread 0x7ffff7fc2740 (LWP 9508) exited.
    ^^^^^^^^
 [Thread 0x7ffff7fc2740 (LWP 9508) exited]
 WL: waitpid Thread 0x7ffff7fc2740 (LWP 9499) received 0 (exited)
 WL: Thread 0x7ffff7fc2740 (LWP 9499) exited.
 [Thread 0x7ffff7fc2740 (LWP 9499) exited]
 RSRL: resuming stopped-resumed LWP Thread 0x7ffff37b8700 (LWP 9579) at 0x3615ef4ce1: step=0
 ...
 (gdb) info inferiors
   Num  Description       Executable
   5    process 9508      /home/pedro/bugs/src/test
^^^^
   4    process 9503      /home/pedro/bugs/src/test
   3    process 9500      /home/pedro/bugs/src/test
   2    process 9499      /home/pedro/bugs/src/test
 * 1    <null>            /home/pedro/bugs/src/test
 (gdb)
 ...

Note the "Thread 0x7ffff7fc2740 (LWP 9508) exited." line.
That's this in wait_lwp:

      /* Check if the thread has exited.  */
      if (WIFEXITED (status) || WIFSIGNALED (status))
{
  thread_dead = 1;
  if (debug_linux_nat)
    fprintf_unfiltered (gdb_stdlog, "WL: %s exited.\n",
target_pid_to_str (lp->ptid));
}
    }

That was the leader thread reporting an exit, meaning the whole
process is gone.  So the problem is that this code doesn't understand
that an WIFEXITED status of the leader LWP should be reported to
infrun as process exit.

gdb/ChangeLog:
2015-07-30  Pedro Alves  <palves@redhat.com>

PR threads/18600
* linux-nat.c (wait_lwp): Report to the core when thread group
leader exits.

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

PR threads/18600
* gdb.threads/fork-plus-threads.exp: Test that "info inferiors"
only shows inferior 1.

8 years agoPR threads/18600: Threads left stopped after fork+thread spawn
Pedro Alves [Thu, 30 Jul 2015 17:50:29 +0000 (18:50 +0100)] 
PR threads/18600: Threads left stopped after fork+thread spawn

When a program forks and another process start threads while gdb is
handling the fork event, newly created threads are left stuck stopped
by gdb, even though gdb presents them as "running", to the user.

This can be seen with the test added by this patch.  The test has the
inferior fork a certain number of times and waits for all children to
exit.  Each fork child spawns a number of threads that do nothing and
joins them immediately.  Normally, the program should run unimpeded
(from the point of view of the user) and exit very quickly.  Without
this fix, it doesn't because of some threads left stopped by gdb, so
inferior 1 never exits.

The program triggers when a new clone thread is found while inside the
linux_stop_and_wait_all_lwps call in linux-thread-db.c:

      linux_stop_and_wait_all_lwps ();

      ALL_LWPS (lp)
if (ptid_get_pid (lp->ptid) == pid)
  thread_from_lwp (lp->ptid);

      linux_unstop_all_lwps ();

Within linux_stop_and_wait_all_lwps, we reach
linux_handle_extended_wait with the "stopping" parameter set to 1, and
because of that we don't mark the new lwp as resumed.  As consequence,
the subsequent resume_stopped_resumed_lwps, called from
linux_unstop_all_lwps, never resumes the new LWP.

There's lots of cruft in linux_handle_extended_wait that no longer
makes sense.  On systems with CLONE events support, we don't rely on
libthread_db for thread listing anymore, so the code that preserves
stop_requested and the handling of last_resume_kind is all dead.

So the fix is to remove all that, and simply always mark the new LWP
as resumed, so that resume_stopped_resumed_lwps re-resumes it.

gdb/ChangeLog:
2015-07-30  Pedro Alves  <palves@redhat.com>
    Simon Marchi  <simon.marchi@ericsson.com>

PR threads/18600
* linux-nat.c (linux_handle_extended_wait): On CLONE event, always
mark the new thread as resumed.  Remove STOPPING parameter.
(wait_lwp): Adjust call to linux_handle_extended_wait.
(linux_nat_filter_event): Adjust call to
linux_handle_extended_wait.
(resume_stopped_resumed_lwps): Add debug output.

gdb/testsuite/ChangeLog:
2015-07-30  Simon Marchi  <simon.marchi@ericsson.com>
    Pedro Alves  <palves@redhat.com>

PR threads/18600
* gdb.threads/fork-plus-threads.c: New file.
* gdb.threads/fork-plus-threads.exp: New file.

8 years agoRemove isize output argument from fast_tracepoint_valid_at
Pierre Langlois [Thu, 30 Jul 2015 17:05:00 +0000 (18:05 +0100)] 
Remove isize output argument from fast_tracepoint_valid_at

This patch removes the isize output argument from the
fast_tracepoint_valid_at gdbarch hook.  It was used to return the size
of the instruction that needs to be replaced when installing a fast
tracepoint.  Instead of getting this value from the
fast_tracepoint_valid_at hook, we can call the gdb_insn_length function.

If we do not do this, then architectures which do not have a restriction
on where to install the fast tracepoint will send uninitialized memory
off to GDBserver.  See remote_download_tracepoint:

~~~
int isize;

if (gdbarch_fast_tracepoint_valid_at (target_gdbarch (),
      tpaddr, &isize, NULL))
  xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x",
     isize);
~~~

The default implementation of fast_tracepoint_valid_at will not set
isize resulting in uninitialized memory being sent.  Later on, GDBserver
could use this information to compute a jump offset.

gdb/ChangeLog:

* arch-utils.c (default_fast_tracepoint_valid_at): Remove unused
isize argument.
* arch-utils.h (default_fast_tracepoint_valid_at): Likewise.
* breakpoint.c (check_fast_tracepoint_sals): Adjust call to
gdbarch_fast_tracepoint_valid_at.
* gdbarch.sh (fast_tracepoint_valid_at): Remove isize argument.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
* i386-tdep.c (i386_fast_tracepoint_valid_at): Remove isize
argument.  Do not set it.
* remote.c (remote_download_tracepoint): Adjust call to
gdbarch_fast_tracepoint_valid_at.  Call gdb_insn_length to get
the instruction length.

8 years agoRemove global variable arm_hwcap
Yao Qi [Thu, 30 Jul 2015 14:07:39 +0000 (15:07 +0100)] 
Remove global variable arm_hwcap

After previous patch, we don't need global variable arm_hwcap.  This
patch is to remove it.

gdb/gdbserver:

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

* linux-arm-low.c (arm_hwcap): Remove it.
(arm_read_description): New local variable arm_hwcap.  Don't
set arm_hwcap to zero.

8 years agoUse regcache->tdesc instead of arm_hwcap
Yao Qi [Thu, 30 Jul 2015 14:07:39 +0000 (15:07 +0100)] 
Use regcache->tdesc instead of arm_hwcap

arm_hwcap is a global variable, and we should avoid using it as much
as we can.  Instead of checking arm_hwcap, we can check whether
regcache->tdesc is a certain kind of target description.  This is
what this patch does.

gdb/gdbserver:

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

* linux-arm-low.c (arm_fill_wmmxregset): Don't use arm_hwcap.
Use regcache->tdesc instead.
(arm_store_wmmxregset): Likewise.
(arm_fill_vfpregset): Likewise.
(arm_store_vfpregset): Likewise.

8 years agoDon't use arm_regmap and arm_num_regs in arm_fill_gregset and arm_store_gregset
Yao Qi [Thu, 30 Jul 2015 14:07:38 +0000 (15:07 +0100)] 
Don't use arm_regmap and arm_num_regs in arm_fill_gregset and arm_store_gregset

In order to align with arm-linux-nat.c counterparts, we don't use
arm_num_regs and arm_regmap in functions arm_fill_gregset and
arm_store_gregset.  Instead, we use register numbers.  With this
patch applied, arm_fill_gregset and arm_store_gregset don't need
arm_num_regs and arm_regmap, and they will be moved to a separate
file shared for both arm and aarch64 in the following patch.

gdb/gdbserver:

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

* linux-arm-low.c: Include arch/arm.h.
(arm_fill_gregset): Don't use arm_num_regs and arm_regmap.
(arm_store_gregset): Likewise.

8 years agoMove ARM register numbers enum to arch/arm.h
Yao Qi [Thu, 30 Jul 2015 14:07:38 +0000 (15:07 +0100)] 
Move ARM register numbers enum to arch/arm.h

This patch moves ARM register numbers enum to arch/arm.h, so that it
can used by GDBserver too.

This patch also creates a new directory gdb/arch in which arch-specific
or target-specific files are placed.

gdb:

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

* arm-tdep.h (enum gdb_regnum): Move it to ...
* arch/arm.h: ... here.  New file.
* Makefile.in (HFILES_NO_SRCDIR): Add arch/arm.h.

8 years ago[AArch64] Rename boolean arguments in decoding functions
Pierre Langlois [Thu, 30 Jul 2015 11:40:49 +0000 (12:40 +0100)] 
[AArch64] Rename boolean arguments in decoding functions

This patch cleans up the decoding functions using booleans when they can
decode two instructions.  The boolean argument is used to know which of
the two instructions was decoded.

The instructions affected are BR/BLR, B/BL, CBZ/CBNZ and TBZ/TBNZ.

These arguments would be named after a named bit in the instruction
encoding, this patch renames them to 'is_XXX'.  Furthermore, the
'unsigned' type would be used to describe a boolean while
aarch64_decode_cb would use 'int' (see the 'is64' argument).  This patch
makes all booleans be 'int' and decoded bitfields be 'unsigned'.

gdb/ChangeLog:

* aarch64-tdep.c (decode_b): Rename link argument to is_bl.
Change its type to int *.
(decode_br): Rename link argument to is_blr.  Change its type to
int *.
(decode_cb): Rename op argument to is_cbnz.  Change its type to
int *.
(decode_tb): Rename op argument to is_tbnz.  Change its type to
int *.  Set is_tbnz to either 1 or 0.
(aarch64_analyze_prologue): Change type of is_link to int.  Add
new variables is_cbnz and is_tbnz.  Adjust call to
aarch64_decode_cb and aarch64_decode_tb.

8 years agoProperly disassemble movnti in Intel mode
H.J. Lu [Thu, 30 Jul 2015 11:17:02 +0000 (04:17 -0700)] 
Properly disassemble movnti in Intel mode

gas/testsuite/

PR binutils/13571
* gas/i386/i386.exp: Run i386-intel and x86_64-intel.
* gas/i386/i386-intel.d: New file.
* gas/i386/x86_64-intel.d: Likewise.

opcodes/

PR binutils/13571
* i386-dis.c (MOD_0FC3): New.
(PREFIX_0FC3): Renamed to ...
(PREFIX_MOD_0_0FC3): This.
(dis386_twobyte): Replace PREFIX_0FC3 with MOD_0FC3.
(prefix_table): Replace Ma with Ev on movntiS.
(mod_table): Add MOD_0FC3.

8 years agoDon't change the default symbol for relocatable link
H.J. Lu [Thu, 30 Jul 2015 10:27:44 +0000 (03:27 -0700)] 
Don't change the default symbol for relocatable link

We should change the default symbol for the versioned symbol only when
not performing a relocatable link.

bfd/

PR ld/18735
* elflink.c (_bfd_elf_add_default_symbol): Add the default
symbol if not performing a relocatable link.
(elf_link_add_object_symbols): Adjust the default symbol if
not performing a relocatable link.

ld/testsuite/

PR ld/18735
* ld-elf/pr18735.d: New file.
* ld-elf/pr18735.s: Likewise.

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

8 years agoMIPS ptrace build fixes
Simon Marchi [Wed, 29 Jul 2015 21:15:46 +0000 (17:15 -0400)] 
MIPS ptrace build fixes

Since Pedro's ptrace cleanups, the MIPS buildbot compilation fails.
Code in MIPS native uses ptrace with 3 arguments, where ptrace requires
4.  When looking at the definition of ptrace in
/usr/include/sys/ptrace.h, it shows that it takes a variable number of
arguments.  The wrapper macro in nat/gdb_ptrace.h takes a fixed number
of arguments (4).  That would explain why it used to work and stopped.

I am pushing this as obvious, tell me if there is any problem.

I built-tested this with a MIPS toolchain (ct-ng), but I don't have any
setup to test it.  At least it should put back the buildbot builder in a
better shape.

gdb/ChangeLog:

* mips-linux-nat.c (write_watchpoint_regs): Add NULL as ptrace's 4th
parameter.
(mips_linux_new_thread): Likewise.
* nat/mips-linux-watch.c (mips_linux_read_watch_registers): Likewise.

gdb/gdbserver/ChangeLog:

* linux-mips-low.c (mips_linux_prepare_to_resume): Add NULL as
ptrace's 4th parameter.

8 years agobatch-preserve-term-settings.exp: use send_quit_command some more
Patrick Palka [Wed, 29 Jul 2015 16:44:21 +0000 (12:44 -0400)] 
batch-preserve-term-settings.exp: use send_quit_command some more

Just a slight cleanup.  Committed as obvious.

gdb/testsuite/ChangeLog:

* gdb.base/batch-preserve-term-settings.exp
(test_terminal_settings_preserved_after_cli_exit): Use
send_quit_command.

8 years agoUse noclone attribute only for GCC 4.5 or newer
H.J. Lu [Wed, 29 Jul 2015 18:20:04 +0000 (11:20 -0700)] 
Use noclone attribute only for GCC 4.5 or newer

noclone attribute was added to GCC 4.5.  We should check GCC version
before using it.

* ld-elf/pr18718.c (bar): Use noclone attribute only for GCC
4.5 or newer.

8 years agoMove run-time support check for size relocation
H.J. Lu [Wed, 29 Jul 2015 17:51:08 +0000 (10:51 -0700)] 
Move run-time support check for size relocation

We must check run-time support for size relocation first before running
the tests.

* ld-size/size.exp: Move run-time support check.

8 years agoTest that terminal settings are restored after quitting via SIGTERM
Patrick Palka [Wed, 29 Jul 2015 15:59:25 +0000 (11:59 -0400)] 
Test that terminal settings are restored after quitting via SIGTERM

Tested on x86_64 Debian Stretch, native, gdbserver and
extended-gdbserver.  Also tested that the various error paths, like if
$PPID is empty or if SIGTERM did not not kill GDB, function correctly.

gdb/testsuite/ChangeLog:

* gdb.base/batch-preserve-term-settings.exp (send_quit_command):
New proc.
(test_terminal_settings_preserved_after_sigterm): New test.

8 years agoDon't set link_info.executable for "ld -r"
H.J. Lu [Wed, 29 Jul 2015 16:11:15 +0000 (09:11 -0700)] 
Don't set link_info.executable for "ld -r"

This patch changes "ld -r" not to set link_info.executable.  It
removes !info->relocatable check for info->executable and adds it
for !info->executable in elflink.c.

bfd/

* elflink.c (elf_link_add_object_symbols): Remove
!info->relocatable check for info->executable.  Add
!info->relocatable check for !info->executable.
(elf_link_output_extsym): Remove
!info->relocatable check for info->executable.

ld/

* lexsup.c (parse_args): Don't set link_info.executable to
TRUE for link_info.relocatable.

8 years agoMake gdb.base/multi-forks.exp work with the native-extended-gdbserver board
Pedro Alves [Wed, 29 Jul 2015 15:24:53 +0000 (16:24 +0100)] 
Make gdb.base/multi-forks.exp work with the native-extended-gdbserver board

Now that we can expect inferior output with the gdbserver boards, this
is all it takes to have the test pass against extended-remote
gdbserver.

Don Breazeal originally wrong something like this:

 https://sourceware.org/ml/gdb-patches/2015-03/msg00506.html

which was what originally inspired the introduction of
$inferior_spawn_id.

gdb/testsuite/ChangeLog:
2015-07-29  Pedro Alves  <palves@redhat.com>
    Don Breazeal  <donb@codesourcery.com>

* gdb.base/multi-forks.exp (continue_to_exit_bp_loc): Expect
output from both inferior_spawn_id and gdb_spawn_id.

8 years agoUniquefy gdb.threads/attach-into-signal.exp
Sergio Durigan Junior [Wed, 29 Jul 2015 15:10:49 +0000 (11:10 -0400)] 
Uniquefy gdb.threads/attach-into-signal.exp

Hi,

While examining BuildBot's logs, I noticed:

  <https://sourceware.org/ml/gdb-testers/2015-q3/msg03767.html>

gdb.threads/attach-into-signal.exp has two nested loops and don't use
unique messages.  This commit fixes that.  Pushed under the obvious
rule.

gdb/testsuite/ChangeLog:
2015-07-29  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.threads/attach-into-signal.exp (corefunc): Use
with_test_prefix on nested loops, uniquefying the test messages.

8 years agoFix typo in gdb.python/py-objfile.exp
Sergio Durigan Junior [Wed, 29 Jul 2015 14:16:38 +0000 (10:16 -0400)] 
Fix typo in gdb.python/py-objfile.exp

My last commit d60a92216e5d599fed6b37c58c744debe38a0b24 introduced a
regression caused by a typo.  This fixes it.  Checked in as obvious.
Thanks to Pedro for reporting.

gdb/testsuite/ChangeLog:
2015-07-29  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.python/py-objfile.exp: Fix typo that snuck in from my last
commit.

8 years agoMake sure terminal settings are restored before exiting
Patrick Palka [Mon, 27 Jul 2015 15:54:07 +0000 (11:54 -0400)] 
Make sure terminal settings are restored before exiting

When exiting GDB -- whether it's via the "quit" command, via a SIGTERM,
or otherwise -- we should leave the terminal in the state we acquired
it.  To that end, we have to undo any modifications that may have been
made by the TUI (ncurses) or by the CLI (readline).

Tested on x86_64 Debian Stretch.

gdb/ChangeLog:

* top.c: Include "tui/tui.h".
(undo_terminal_modifications_before_exit): New static function.
(quit_force): Use it.

gdb/testsuite/ChangeLog:

* gdb.base/batch-preserve-term-settings.exp
(test_terminal_settings_preserved_after_cli_exit): New test.

8 years agoInitialize terminal_state to terminal_is_ours
Patrick Palka [Tue, 28 Jul 2015 17:58:17 +0000 (13:58 -0400)] 
Initialize terminal_state to terminal_is_ours

Right now this variable is initialized to 0 i.e. terminal_is_inferior
and does not get set to terminal_is_ours until target_terminal_init() is
called.  This function however only gets called when an inferior is
first created.  In the meantime, terminal_state would wrongly remain set
to terminal_is_inferior.

Tested on x86_64 Debian Stretch -- native, gdbserver and
extended-gdbserver.

gdb/ChangeLog:

* target.c (terminal_state): Initialize to terminal_is_ours.

8 years agoClean up batch-preserve-term-settings.exp
Patrick Palka [Tue, 28 Jul 2015 02:10:13 +0000 (22:10 -0400)] 
Clean up batch-preserve-term-settings.exp

See ChangeLog for details.  No functional change intended.

Tested on x86_64 Debian Stretch by verifying that the gdb.log output
remains unchanged for native, gdbserver and extended-gdbserver.

gdb/testsuite/ChangeLog:

* gdb.base/batch-preserve-term-settings.exp: Remove top-level
manipulation of saved_gdbflags.
(test_terminal_settings_preserved): Remove global declaration of
the unused variable pagination_prompt.  Remove manipulation of
saved_gdbflags.  Use a local variable EXTRA_GDBFLAGS instead of
GDBFLAGS.

8 years agoPR record/18691: Fix fails in solib-precsave.exp
Yao Qi [Wed, 29 Jul 2015 11:43:10 +0000 (12:43 +0100)] 
PR record/18691: Fix fails in solib-precsave.exp

We see the following regressions in testing on x86_64-linux,

 reverse-step^M
 Cannot access memory at address 0x2aaaaaed26c0^M
 (gdb) FAIL: gdb.reverse/solib-precsave.exp: reverse-step into solib function one

when GDB reverse step into a function, GDB wants to skip prologue so
it requests TARGET_OBJECT_CODE_MEMORY to read some code memory in
memory_xfer_partial_1.  However in dcache_read_memory_partial, the object
becomes TARGET_OBJECT_MEMORY

      return ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
                                   myaddr, NULL, memaddr, len,
                                   xfered_len);

in reverse debugging, ops->to_xfer_partial is record_full_core_xfer_partial
and it will return TARGET_XFER_E_IO because it can't find any records.
The test fails.

At this moment, the delegate relationship is like

  dcache -> record-core -> core -> exec

and we want to GDB read memory across targets, which means if the
requested memory isn't found in record-core, GDB can read memory from
core, and exec even further if needed.  I find raw_memory_xfer_partial
is exactly what I want.

gdb:

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

PR record/18691
* dcache.c (dcache_read_memory_partial): Call
raw_memory_xfer_partial.
* target.c (raw_memory_xfer_partial): Make it non-static.
* target.h (raw_memory_xfer_partial): Declare.

8 years agoDon't set gdb,noinferiorio on gdbserver boards
Pedro Alves [Wed, 29 Jul 2015 10:09:46 +0000 (11:09 +0100)] 
Don't set gdb,noinferiorio on gdbserver boards

As all tests that check gdb,noinferiorio have been adjusted to expect
inferior output with "-i $inferior_spawn_id", we can remove this now,
and thus enable those tests against gdbserver.

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

* boards/gdbserver-base.exp: Don't set gdb,noinferiorio.

8 years agointerrupt.exp: Revert back to checking gdb,noinferiorio at the top
Pedro Alves [Wed, 29 Jul 2015 10:09:46 +0000 (11:09 +0100)] 
interrupt.exp: Revert back to checking gdb,noinferiorio at the top

The following patch will remove the gdb,noinferiorio setting from the
gdbserver boards, so this bit can be reverted.

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

* gdb.base/interrupt.exp: Revert back to checking gdb,noinferiorio
at the top.

8 years agoUnbuffer all tests that rely on stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:45 +0000 (11:09 +0100)] 
Unbuffer all tests that rely on stdio

This forces all tests that rely on stdio to be unbuffered, like
interrupt.exp was adjusted in 6f98576f.

To recap, in some scenarios, GDB or GDBserver can be spawned with
input _not_ connected to a tty, and then tests that rely on stdio fail
with timeouts, because the inferior's stdout and stderr streams end up
fully buffered.  Calling gdb_unbuffer_output forces output to be
unbuffered.

See https://sourceware.org/ml/gdb-patches/2015-02/msg00809.html and
https://sourceware.org/ml/gdb-patches/2015-02/msg00819.html.

Tested on x86_64 Fedora 20, native, and against a remote gdbserver
board file that connects to the target with ssh, with and without -t
(create pty).

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

* gdb.base/call-ar-st.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-rt-st.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-strs.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-strs.exp: Adjust to step over the
gdb_unbuffer_output call.
* gdb.base/catch-gdb-caused-signals.c: Include
"../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/dprintf.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/ending-run.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/run.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/shlib-call.exp: Adjust to step over the
gdb_unbuffer_output call.
* gdb.base/shmain.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/sizeof.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/varargs.c: Include "../lib/unbuffer_output.c".
(main): Rename to ...
(test): ... this.
(main): Reimplement.
* gdb.base/varargs.exp: Run to test instead of to main.
* gdb.mi/mi-dprintf.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.

8 years agoMake gdb.mi/mi-dprintf.exp use $inferior_spawn_id
Pedro Alves [Wed, 29 Jul 2015 10:09:45 +0000 (11:09 +0100)] 
Make gdb.mi/mi-dprintf.exp use $inferior_spawn_id

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

* gdb.mi/mi-dprintf.exp (mi_expect_dprintf): New procedure,
factore out from mi_continue_dprintf.  For call-style dprintfs,
expect dprintf output out of $inferior_spawn_id.
(mi_continue_dprintf): Use mi_expect_dprintf.
* gdb.mi/mi-dprintf.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.

8 years agoAdjust MI to $inferior_spawn_id
Pedro Alves [Wed, 29 Jul 2015 10:09:44 +0000 (11:09 +0100)] 
Adjust MI to $inferior_spawn_id

Rather than trying to determine where (which spawn id) the inferior
output comes out from, which depends on e.g., remote that supports
file i/o remote protocol extension, vs remote that sends inferior
output through a separate $inferior_spawn_id, vs native debugging,
which sends output through $gdb_spawn_id, vs native debugging with a
test that uses "separate-inferior-tty" (like mi-console.exp does),
always expect inferior output from both $inferior_spawn_id and
$gdb_spawn_id.

mi-console.exp itself already copes with different possible outputs in
a similar way:

 # Combine both outputs in a single pattern.
 set output "($semihosted_output|$native_output)"

Fixes:

 FAIL: gdb.mi/mi-console.exp: Testing console output inferior output (timeout)

when testing against local gdbserver with gdb,noinferiorio removed
from the board file.

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

* lib/mi-support.exp (mi_inferior_spawn_id): Delete.
(default_mi_gdb_start): Set inferior_spawn_id instead of
mi_inferior_spawn_id.  If $inferior_spawn_id is not set, set it to
gdb_spawn_id.
(mi_gdb_test): Always expect inferior output from both
$inferior_spawn_id and $gdb_spawn_id.

8 years agoMake gdb.gdb/selftest.exp use '-i $inferior_spawn_id'
Pedro Alves [Wed, 29 Jul 2015 10:09:44 +0000 (11:09 +0100)] 
Make gdb.gdb/selftest.exp use '-i $inferior_spawn_id'

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

* gdb.gdb/selftest.exp (test_with_self): Update comment.  Use
send_inferior and $inferior_spawn_id.

8 years agoMake gdb.gdb/complaints.exp use '-i $inferior_spawn_id' and gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:43 +0000 (11:09 +0100)] 
Make gdb.gdb/complaints.exp use '-i $inferior_spawn_id' and gdb_test_stdio

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

* gdb.gdb/complaints.exp (test_initial_complaints)
(test_serial_complaints, test_short_complaints): Use
gdb_test_stdio.
(test_empty_complaint): Handle $inferior_spawn_id !=
$gdb_spawn_id.

8 years agoMake gdb.base/varargs.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:43 +0000 (11:09 +0100)] 
Make gdb.base/varargs.exp use gdb_test_stdio

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

* gdb.base/varargs.exp: Use gdb_test_stdio.

8 years agoMake gdb.base/shlib-call.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:42 +0000 (11:09 +0100)] 
Make gdb.base/shlib-call.exp use gdb_test_stdio

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

* gdb.base/shlib-call.exp: Use gdb_test_stdio.

8 years agoMake gdb.base/ending-run.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:42 +0000 (11:09 +0100)] 
Make gdb.base/ending-run.exp use gdb_test_stdio

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

* gdb.base/ending-run.exp: Use gdb_test_stdio.

8 years agoMake gdb.base/call-rt-st.exp use $inferior_spawn_id
Pedro Alves [Wed, 29 Jul 2015 10:09:41 +0000 (11:09 +0100)] 
Make gdb.base/call-rt-st.exp use $inferior_spawn_id

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

* gdb.base/call-rt-st.exp (print_struct_call): Split "result"
parameter into two new parameters, "inf_result" and "gdb_result".
Expect inferior output and gdb output from $inferior_spawn_id and
$gdb_spawn_id, respectively.  Adjust all callers.

8 years agoMake gdb.base/call-ar-st.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:40 +0000 (11:09 +0100)] 
Make gdb.base/call-ar-st.exp use gdb_test_stdio

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

* gdb.base/call-ar-st.exp: Use gdb_test_stdio+multi_line instead
of gdb_test_sequence.

8 years agoMake gdb.base/a2-run.exp use $inferior_spawn_id and gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:40 +0000 (11:09 +0100)] 
Make gdb.base/a2-run.exp use $inferior_spawn_id and gdb_test_stdio

This one is a little more complicated than the other patches in this
series, because of the exit status wrapper handling, requiring a
little state machine.

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

* gdb.base/a2-run.exp (saw_usage, saw_exit_wrapper)
(saw_spurious_output): Expect inferior output from
$inferior_spawn_id.  Use gdb_test_stdio.

8 years agoMake gdb.base/dprintf.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:39 +0000 (11:09 +0100)] 
Make gdb.base/dprintf.exp use gdb_test_stdio

This one needed a larger revamp.  The issue is that the "info
breakpoints" test at the bottom of the file is broken on targets that
can do both server-side dprintf, and inferior I/O, because then
neither the breakpoint numbers match nor the "already hit N times"
output.

Address that by making the test restart gdb from scratch when
switching between dprintf styles.  Test groups are factored into
procedures, and we now use with_test_prefix.  While we're changing
test messages, lowercase a few test messages, and then while at it,
modernize a couple things here and there.

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

* gdb.base/dprintf.exp: Use standard_testfile.  Change
prepare_for_testing call.
(srcfile): Don't set.
(restart): New procedure.
(test_dprintf): New procecure, use to continue over dprintfs.
(test_call, test_agent): New procedures, tests moved here.
Restart gdb and recreate dprintfs.  Adjust expected output.

8 years agoMake gdb.base/catch-gdb-caused-signals.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:39 +0000 (11:09 +0100)] 
Make gdb.base/catch-gdb-caused-signals.exp use gdb_test_stdio

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

* gdb.base/catch-gdb-caused-signals.exp: Use gdb_test_stdio.

8 years agoMake gdb.base/call-strs.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:38 +0000 (11:09 +0100)] 
Make gdb.base/call-strs.exp use gdb_test_stdio

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

* gdb.base/call-strs.exp: Use gdb_test_stdio instead of gdb_test.

8 years agoMake gdb.base/sizeof.exp use gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:38 +0000 (11:09 +0100)] 
Make gdb.base/sizeof.exp use gdb_test_stdio

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

* gdb.base/sizeof.exp (check_sizeof, check_valueof): Use
gdb_test_stdio.

8 years agoIntroduce gdb_test_stdio
Pedro Alves [Wed, 29 Jul 2015 10:09:37 +0000 (11:09 +0100)] 
Introduce gdb_test_stdio

This adds a new helper procedure to be used by tests that rely on
stdio.

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

* lib/gdb.exp (gdb_test_stdio): New procedure.

8 years agoDon't rely on inferior I/O in gdb.base/restore.exp
Pedro Alves [Wed, 29 Jul 2015 10:09:37 +0000 (11:09 +0100)] 
Don't rely on inferior I/O in gdb.base/restore.exp

There seems to be no point in relying on stdio here.  Simply use
gdb_continue_to_end instead.

(not removing the printf calls, as the .c file is half generated.)

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

* gdb.base/restore.exp (restore_tests): Use gdb_continue_to_end.

8 years agoDon't rely on inferior I/O in {call-signal-resume, unwindonsignal}.exp
Pedro Alves [Wed, 29 Jul 2015 10:09:36 +0000 (11:09 +0100)] 
Don't rely on inferior I/O in {call-signal-resume, unwindonsignal}.exp

These tests rely on inferior I/O, but that seems pointless and
unrelated here.  Simply remove the printf calls, and don't expect
them.

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

* gdb.base/call-signal-resume.exp: Remove check for
gdb,noinferiorio.  Don't expect "no signal".  Use gdb_test.
* gdb.base/unwindonsignal.exp: Likewise.
* gdb.base/call-signals.c (gen_signal): Remove printf call.
* gdb.base/unwindonsignal.c (gen_signal): Likewise.

8 years agoDon't rely on inferior I/O in gdb.base/siginfo-addr.exp
Pedro Alves [Wed, 29 Jul 2015 10:09:36 +0000 (11:09 +0100)] 
Don't rely on inferior I/O in gdb.base/siginfo-addr.exp

No point in relying on stdio in this test.  Simply run to a breakpoint
instead.

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

* gdb.base/siginfo-addr.c (pass): New function.
(handler): Call it iff si_addr is correct.
* gdb.base/siginfo-addr.exp: Remove gdb_skip_stdio_test check.
Set a breakpoint at "pass" and continue to it.

8 years agobfd/mmo.c (MMIX): Fix massive gcc LTO testsuite failures.
Hans-Peter Nilsson [Wed, 29 Jul 2015 03:39:27 +0000 (05:39 +0200)] 
bfd/mmo.c (MMIX): Fix massive gcc LTO testsuite failures.

* mmo.c (mmo_write_symbols_and_terminator): Skip symbol-type
assignment loop for bfd plugin objects.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 29 Jul 2015 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoUniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}
Sergio Durigan Junior [Tue, 28 Jul 2015 21:38:14 +0000 (17:38 -0400)] 
Uniquify test names from gdb.python/{py-objfile.exp,py-pp-registration.exp}

While running some regression tests, I noticed that the two Python
tests mentioned in the $SUBJECT contain non-unique names.  This is a
violation of our guidelines:

  <https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique>

And also makes things harder for BuildBot.  So I hacked both testcases
and made every test name unique.  I guess this could be considered an
obvious patch, but I decided to post it before pushing because others
may have different opinions about the names.

OK to apply?

gdb/testsuite/ChangeLog:
2015-07-28  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.python/py-objfile.exp: Make some tests have unique names.
* gdb.python/py-pp-registration.exp: Likewise.

8 years agoFix gdb.server/server-exec-info.exp with the extended-remote board
Pedro Alves [Tue, 28 Jul 2015 17:04:07 +0000 (18:04 +0100)] 
Fix gdb.server/server-exec-info.exp with the extended-remote board

This test fails with --target_board=native-extended-gdbserver because
it misses the usual "disconnect":

 (gdb) spawn ../gdbserver/gdbserver --once :2347 /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.server/server-exec-info
 Process /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.server/server-exec-info created; pid = 4736
 Listening on port 2347
 target extended-remote localhost:2347
 Already connected to a remote target.  Disconnect? (y or n) ^CsQuit
 (gdb) et sysroot remote:
 Undefined command: "et".  Try "help".
 (gdb) n
 The program is not being run.
 (gdb) FAIL: gdb.server/server-exec-info.exp: set sysroot remote: (got interactive prompt)
 info files
 (gdb) FAIL: gdb.server/server-exec-info.exp: info files

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

* gdb.server/server-exec-info.exp: Issue a "disconnect".

8 years agoConsider addressable memory unit size in various value functions
Simon Marchi [Tue, 28 Jul 2015 15:01:50 +0000 (11:01 -0400)] 
Consider addressable memory unit size in various value functions

This patch updates various value handling functions to make them
consider the addressable memory unit size of the current architecture.
This allows to correctly extract and print values on architectures whose
addressable memory unit is not 8 bits.

The patch doesn't cover all the code that would ideally need to be
adjusted, only the code paths that we happen to use, plus a few obvious
ones.  Specifically, those areas are not covered by this patch:

 - Management of unavailable bits
 - Bitfields
 - C++ stuff

Regression-tested on x86-64 Ubuntu 14.04.  I saw no related test result
change.

gdb/ChangeLog:

* c-valprint.c (c_val_print_array): Consider addressable memory
unit size.
(c_val_print_ptr): Likewise.
(c_val_print_int): Likewise.
* findvar.c (read_frame_register_value): Likewise.
* valarith.c (find_size_for_pointer_math): Likewise.
(value_ptrdiff): Likewise.
(value_subscripted_rvalue): Likewise.
* valops.c (read_value_memory): Likewise (and rename variables).
(value_assign): Likewise.
(value_repeat): Likewise.
(value_array): Likewise.
(value_slice): Likewise.
* valprint.c (generic_val_print_ptr): Likewise.
(generic_val_print_enum): Likewise.
(generic_val_print_bool): Likewise.
(generic_val_print_int): Likewise.
(generic_val_print_char): Likewise.
(generic_val_print_float): Likewise.
(generic_val_print_decfloat): Likewise.
(generic_val_print_complex): Likewise.
(val_print_scalar_formatted): Likewise.
(val_print_array_elements): Likewise.
* value.c (set_value_parent): Likewise.
(value_contents_copy_raw): Likewise.
(set_internalvar_component): Likewise.
(value_primitive_field): Likewise.
(value_fetch_lazy): Likewise.
* value.h (read_value_memory): Update comment.

8 years agoIntroduce get_value_arch
Simon Marchi [Tue, 28 Jul 2015 15:01:50 +0000 (11:01 -0400)] 
Introduce get_value_arch

Similar to get_type_arch, used to get the gdbarch associated to a
struct value.

gdb/ChangeLog:

* value.c (get_value_arch): New function.
* value.h (get_value_arch): New declaration.

8 years agoUpdate comments in struct value for non-8-bits architectures
Simon Marchi [Tue, 28 Jul 2015 15:01:49 +0000 (11:01 -0400)] 
Update comments in struct value for non-8-bits architectures

gdb/ChangeLog:

* value.c (struct value): Update comments.

8 years agoUpdate comment for struct type's length field, introduce type_length_units
Simon Marchi [Tue, 28 Jul 2015 15:01:49 +0000 (11:01 -0400)] 
Update comment for struct type's length field, introduce type_length_units

This patch tries to clean up a bit the blur around the length field in
struct type, regarding its use with architectures with non-8-bits
addressable memory.  It clarifies that the field is expressed in host
bytes, which is what is the closest to the current reality.

It also introduces a new function to get the length of the type in
target addressable memory units.

gdb/ChangeLog:

* gdbtypes.c (type_length_units): New function.
* gdbtypes.h (type_length_units): New declaration.
(struct type) <length>: Update comment.

8 years agoAdd cores for M5100 series
Robert Suchanek [Tue, 28 Jul 2015 10:26:39 +0000 (11:26 +0100)] 
Add cores for M5100 series

gas/

* config/tc-mips.c (mips_cpu_info_table): Add m5100 and m5101 entries.
* doc/c-mips.texi: Document m5100 and m5101 for -march=.

8 years agoAdd -march=interaptiv
Robert Suchanek [Tue, 28 Jul 2015 10:26:31 +0000 (11:26 +0100)] 
Add -march=interaptiv

gas/

* config/tc-mips.c (mips_cpu_info_table): Add interaptiv entry.
* doc/c-mips.text: Document -march=interaptiv.

8 years agoFallout from "Reorder more powerpc64 sections for -z relro"
Alan Modra [Tue, 28 Jul 2015 01:33:57 +0000 (11:03 +0930)] 
Fallout from "Reorder more powerpc64 sections for -z relro"

Commit 23283c1b changed the layout of some bss style sections on
powerpc64, but neglected to add a page gap before the third PT_LOAD
segment created by this reording.  Without a page gap we get two
PT_LOAD headers that overlap by one page in memory.  That shouldn't be
allowed because the dynamic loader will load garbage from the first
page of the last segment over the last page of the previous segment.

bfd/
* elf.c (_bfd_elf_map_sections_to_segments): Do not make a new
segment for loaded sections after nonloaded sections if the
sections are on the same page.
ld/testsuite/
* ld-powerpc/elfv2so.d: Update

8 years agoCheck for asprintf and vasprintf during configure stage.
Iain Buclaw [Tue, 28 Jul 2015 07:57:32 +0000 (09:57 +0200)] 
Check for asprintf and vasprintf during configure stage.

This should fix some build errors seen on AIX, MinGW, and possibly other
non-GNU systems too due to missing asprintf().

bfd/

* configure.in: Add asprintf and vasprintf to AC_CHECK_DECLS.
* config.in, configure: Regenerate.

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

8 years agoSet NOPIE_CFLAGS and NOPIE_LDFLAGS
H.J. Lu [Mon, 27 Jul 2015 23:16:17 +0000 (16:16 -0700)] 
Set NOPIE_CFLAGS and NOPIE_LDFLAGS

GCC 6 can be configured to generate PIE by default.  But some linker
size tests expect non-PIE.  This patch defines NOPIE_CFLAGS to
"-fno-PIE" and NOPIE_LDFLAGS to "-no-pie" if target compiler supports
them.  Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS to linker size tests if
needed.

* config/default.exp (NOPIE_CFLAGS): New.
(NOPIE_LDFLAGS): Likewise.
* ld-size/size.exp (run_cc_link_tests): Add $NOPIE_CFLAGS and
$NOPIE_LDFLAGS if needed.
(run_ld_link_exec_tests): Add $NOPIE_CFLAGS if needed.

8 years agogdb.mi/mi-pending.c: Return NULL instead of nothing in thread function
Simon Marchi [Mon, 27 Jul 2015 19:49:24 +0000 (15:49 -0400)] 
gdb.mi/mi-pending.c: Return NULL instead of nothing in thread function

Using gcc 5.2 (maybe other versions as well), building mi-pending.c gives
these warnings:

./gdb.mi/mi-pending.c: In function ‘thread_func’:
./gdb.mi/mi-pending.c:34:5: warning: ‘return’ with no value, in function returning non-void
     return;
     ^
./gdb.mi/mi-pending.c:38:5: warning: ‘return’ with no value, in function returning non-void
     return;
     ^
gdb_compile_pthreads assumes that the build was successful only if there
is no output. These warnings therefore make gdb_compile_pthreads think
that the build failed, and the test doesn't run.

The easy fix is to replace the "return" with "return NULL".  I am
pushing this as obvious.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-pending.c (thread_func): Replace return with return
NULL.

8 years agoRemove xfail in gdb.mi/mi-watch.exp
Simon Marchi [Mon, 27 Jul 2015 19:02:10 +0000 (15:02 -0400)] 
Remove xfail in gdb.mi/mi-watch.exp

I noticed there was an unexpected pass in mi-watch.exp when running on
x86_64.  Doing a bit of archeology shows that the xfail was added by
4a543da.  This particular test failed on the MIPS architecture, which
the original contributor was working with.  Here is the thread:

https://www.sourceware.org/ml/gdb-patches/2007-09/msg00151.html

Looking at the latest buildbot results for MIPS, it seems that it's also
an unexpected pass on that architecture.  Therefore, I see no reason to
leave the xfail in place.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-watch.exp (test_watchpoint_triggering): Remove xfail.

8 years agoFactor out complex printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:26 +0000 (14:11 -0400)] 
Factor out complex printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out complex
printing code to ...
(generic_val_print_complex): ... this new function.

8 years agoFactor out decfloat printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:25 +0000 (14:11 -0400)] 
Factor out decfloat printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out decfloat
printing code to ...
(generic_val_print_decfloat): ... this new function.

8 years agoFactor out float printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:24 +0000 (14:11 -0400)] 
Factor out float printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out float
printing code to ...
(generic_val_print_float): ... this new function.

8 years agoFactor out char printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:24 +0000 (14:11 -0400)] 
Factor out char printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out char
printing code to ...
(generic_val_print_char): ... this new function.

8 years agoFactor out int printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:23 +0000 (14:11 -0400)] 
Factor out int printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out integer
printing code to ...
(generic_val_print_int): ... this new function.

8 years agoFactor out bool printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:23 +0000 (14:11 -0400)] 
Factor out bool printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out bool
printing code to ...
(generic_val_print_bool): ... this new function.

8 years agoFactor out function/method printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:22 +0000 (14:11 -0400)] 
Factor out function/method printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out function/method
printing code to ...
(generic_val_print_func): ... this new function.

8 years agoFactor out flags printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:22 +0000 (14:11 -0400)] 
Factor out flags printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out flags
printing code to ...
(generic_val_print_flags): ... this new function.

8 years agoFactor out enum printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:21 +0000 (14:11 -0400)] 
Factor out enum printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out enum
printing code to ...
(generic_val_print_enum): ... this new function.

8 years agoFactor out reference printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:21 +0000 (14:11 -0400)] 
Factor out reference printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out reference
printing code to ...
(generic_val_print_ref): ... this new function.

8 years agoFactor out memberptr printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:20 +0000 (14:11 -0400)] 
Factor out memberptr printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out memberptr
printing code to ...
(generic_val_print_memberptr): ... this new function.

8 years agoFactor out pointer printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:19 +0000 (14:11 -0400)] 
Factor out pointer printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out pointer
printing code to ...
(generic_val_print_ptr): ... this new function.

8 years agoFactor out array printing code from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:19 +0000 (14:11 -0400)] 
Factor out array printing code from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out array
printing code to ...
(generic_val_print_array): ... this new function.

8 years agoFactor out print_unpacked_pointer from generic_val_print
Simon Marchi [Mon, 27 Jul 2015 18:11:18 +0000 (14:11 -0400)] 
Factor out print_unpacked_pointer from generic_val_print

gdb/ChangeLog:

* valprint.c (generic_val_print): Factor out
print_unpacked_pointer code to ...
(print_unpacked_pointer): ... this new function.

8 years agoCheck address of versined symbol
H.J. Lu [Mon, 27 Jul 2015 17:04:31 +0000 (10:04 -0700)] 
Check address of versined symbol

Since GCC 5 folds symbol address comparison, assuming each symbol has a
different address, &foo == &bar is always false for GCC 5.  This patch
adds check_ptr_eq if 2 addresses are the same and uses it to check the
address of versined symbol.

PR ld/18718
* ld-elf/check-ptr-eq.c: New file.
* ld-elf/pr18718.c (main): Call check_ptr_eq.
* ld-elf/shared.exp: Add check-ptr-eq.c to PR ld/18718 tests.

8 years agoHave SIGTERM promptly quit GDB even when the dummy target is active
Patrick Palka [Fri, 24 Jul 2015 17:58:47 +0000 (13:58 -0400)] 
Have SIGTERM promptly quit GDB even when the dummy target is active

GDB currently does not promptly quit after receiving a SIGTERM while no
proper target is active.  This is because in handle_sigterm we currently
look at target_can_async_p to determine whether to asynchronously quit
GDB using an async signal handler or to asynchronously quit using the
quit flag.  However, target_can_async_p is always false under the dummy
target, so under this target we always use the quit flag and not the
async signal handler to signal that GDB should quit.  So GDB won't quit
until a code path that checks the quit flag is executed.

To fix this issue, this patch makes the SIGTERM handler no longer
inspect target_can_async_p, and instead makes the handler
unconditionally set the quit flag _and_ mark the corresponding async
signal handler, so that if the target is async (or if it's the dummy
target) then we will likely quit through the async signal handler, and
if it's not async then we will likely quit through the quit flag.  This
redundant approach is similar to how we handle SIGINT.

gdb/ChangeLog:

* event-top.c (handle_sigterm): Don't inspect
target_can_async_p.  Always set the quit flag and always mark
the async signal handler.

gdb/testsuite/ChangeLog:

* gdb.base/gdb-sigterm-2.exp: New test.

8 years ago[gdbserver] Don't set srv_linux_usrregs for aarch64*-*-linux*
Yao Qi [Mon, 27 Jul 2015 15:15:48 +0000 (16:15 +0100)] 
[gdbserver] Don't set srv_linux_usrregs for aarch64*-*-linux*

We don't use PTRACE_PEEKUSR/PTRACE_POKEUSR on aarch64-linux, so don't
need to set srv_linux_usrregs.  This patch removes that line.

gdb/gdbserver:

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

* configure.srv (case aarch64*-*-linux*): Don't set
srv_linux_usrregs.

8 years agoFix ChangeLog entry
Yao Qi [Mon, 27 Jul 2015 15:12:31 +0000 (16:12 +0100)] 
Fix ChangeLog entry

8 years agoRemove REMOTE_EXAMPLES from gdb/Makefile.in
Yao Qi [Thu, 23 Jul 2015 15:26:14 +0000 (16:26 +0100)] 
Remove REMOTE_EXAMPLES from gdb/Makefile.in

I happen to see REMOTE_EXAMPLES isn't used anywhere, so this patch
removes it.

REMOTE_EXAMPLES was added in the following commit in 1991,

commit 86bbb439c8fa01fd55d6cbce102483a471ffd0c4
Author: John Gilmore <gnu@cygnus>
Date:   Fri May 3 19:57:13 1991 +0000

    There should be a Makefile in the cvs main directory, configured
    for "./config.gdb none", so that things like "make tags" and "make tar"
    will work.

and it was used like:

TARFILES = ${TAGFILES_MAINDIR} ${OTHERS} ${REMOTE_EXAMPLES}

However TARFILES was removed by the change latter in 1994,

Tue Aug 16 15:24:03 1994  Jim Kingdon  (kingdon@lioth.cygnus.com)

* symtab.c (decode_line_1): If funfirstline and we get a
non-LOC_BLOCK symbol (e.g. variable or type), then error().

* Makefile.in (TARFILES, NONSRC, SFILES_STAND, SFILES_KGDB):
Remove; unused.

Since then, REMOTE_EXAMPLES is not used any more.

gdb:

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

* Makefile.in (REMOTE_EXAMPLES): Remove it.

8 years agoRegenerate configure files
H.J. Lu [Mon, 27 Jul 2015 14:56:32 +0000 (07:56 -0700)] 
Regenerate configure files

bfd/

* configure: Regenerated.

binutils/

* configure: Regenerated.

gas/

* configure: Regenerated.

gold/

* configure: Regenerated.

gprof/

* configure: Regenerated.

ld/

* configure: Regenerated.

opcodes/

* configure: Regenerated.

8 years agoSync toplevel files with GCC
H.J. Lu [Mon, 27 Jul 2015 14:49:05 +0000 (07:49 -0700)] 
Sync toplevel files with GCC

Sync with GCC
2015-07-24  Michael Darling  <darlingm@gmail.com>

PR other/66259
* config-ml.in: Reflects renaming of configure.in to configure.ac
* configure: Likewise
* configure.ac: Likewise

8 years agoSync config with GCC
H.J. Lu [Mon, 27 Jul 2015 14:43:26 +0000 (07:43 -0700)] 
Sync config with GCC

Sync with GCC
2015-07-24  Micahel Darling  <darlingm@gmail.com>

PR other/66259
* gettext.m4: Reflects renaming of configure.in to configure.ac
* po.m4: Likewise
* stdint.m4: Likewise
* tcl.m4: Likewise

8 years agoFix the address size computation for the MSP430 port.
Nick Clifton [Mon, 27 Jul 2015 14:15:28 +0000 (15:15 +0100)] 
Fix the address size computation for the MSP430 port.

* elf32-msp430.c (uses_large_model): New function.
(msp430_elf_eh_frame_address_size): New function.
(elf_backend_eh_frame_address_size): Define.

8 years agoAppend $PLT_CFLAGS to CC/CXX for S-records tests
H.J. Lu [Mon, 27 Jul 2015 12:18:20 +0000 (05:18 -0700)] 
Append $PLT_CFLAGS to CC/CXX for S-records tests

S-records tests don't work with -fno-plt.  This path appends $PLT_CFLAGS
to CC and CXX for S-records tests.

* ld-srec/srec.exp (CC): Save and restore.  Append $PLT_CFLAGS.
(CXX): Likewise.

8 years agoPass $PLT_CFLAGS to ld_compile
H.J. Lu [Mon, 27 Jul 2015 12:17:26 +0000 (05:17 -0700)] 
Pass $PLT_CFLAGS to ld_compile

Some linker shard library tests without PIC expect PLT.  This patch
passes $PLT_CFLAGS to ld_compile.

* ld-shared/shared.exp: Pass $PLT_CFLAGS to ld_compile.

8 years agoAppend $PLT_CFLAGS to CC for NOCROSSREFS tests
H.J. Lu [Mon, 27 Jul 2015 12:16:38 +0000 (05:16 -0700)] 
Append $PLT_CFLAGS to CC for NOCROSSREFS tests

NOCROSSREFS tests don't work with -fno-plt.  This path appends
$PLT_CFLAGS to CC for NOCROSSREFS tests.

* ld-scripts/crossref.exp (CC): Save and restore.  Append
$PLT_CFLAGS.

8 years agoAdd $PLT_CFLAGS to -fPIC for run_cc_link_tests
H.J. Lu [Mon, 27 Jul 2015 12:15:48 +0000 (05:15 -0700)] 
Add $PLT_CFLAGS to -fPIC for run_cc_link_tests

Some x86 linker tests expect PLT.  This patch adds $PLT_CFLAGS to -fPIC
for run_cc_link_tests.

* ld-i386/i386.exp (run_cc_link_tests): Add $PLT_CFLAGS to
-fPIC if needed.
* ld-x86-64/mpx.exp (run_cc_link_tests): Likewise.
* ld-x86-64/x86-64.exp (run_cc_link_tests): Likewise.

8 years agoPass $PLT_CFLAGS to ld_compile
H.J. Lu [Mon, 27 Jul 2015 12:15:01 +0000 (05:15 -0700)] 
Pass $PLT_CFLAGS to ld_compile

Some linker visibility tests without PIC expect PLT.  This patch passes
$PLT_CFLAGS to ld_compile.

* ld-elfvsb/elfvsb.exp (visibility_run): Pass $PLT_CFLAGS to
ld_compile.

8 years agoPass $PLT_CFLAGS to build_binary
H.J. Lu [Mon, 27 Jul 2015 12:13:55 +0000 (05:13 -0700)] 
Pass $PLT_CFLAGS to build_binary

Some linker symbol version tests without PIC expect PLT.  This patch
adds $PLT_CFLAGS to CFLAGS.

* ld-elfvers/vers.exp (build_vers_lib_no_pic): Pass $PLT_CFLAGS
to build_binary.

8 years agoSet PLT_CFLAGS to "-fplt" if supported
H.J. Lu [Mon, 27 Jul 2015 10:42:39 +0000 (03:42 -0700)] 
Set PLT_CFLAGS to "-fplt" if supported

GCC 6 supports -fno-plt.  But some linker tests expect PLT.  This patch
defines PLT_CFLAGS to "-fplt" if target compiler supports it.

* config/default.exp (PLT_CFLAGS): New.

8 years ago[AArch64] Fix extern protected data handling
Szabolcs Nagy [Mon, 27 Jul 2015 10:48:48 +0000 (11:48 +0100)] 
[AArch64] Fix extern protected data handling

Emit *GLOB_DAT instead of *RELATIVE relocs for protected data
in shared objects.

This is needed for the fix of glibc bug 17711:
https://sourceware.org/bugzilla/show_bug.cgi?id=17711

bfd:
PR ld/18705
* elfnn-aarch64.c (elf_backend_extern_protected_data): Define.

ld/testsuite:
PR ld/18705
* ld-aarch64/protected-data.d: New.
* ld-aarch64/protected-data.s: New.
* ld-aarch64/aarch64-elf.exp: Add new test.