binutils-gdb.git
8 years agoFix bugs in the simulation of the AArch64's ADDP, FADDP, LD1, CCMP and CCMP instructions.
Nick Clifton [Thu, 3 Mar 2016 15:14:35 +0000 (15:14 +0000)]
Fix bugs in the simulation of the AArch64's ADDP, FADDP, LD1, CCMP and CCMP instructions.

* simulator.c (set_flags_for_sub32): Correct type of signbit.
(CondCompare): Swap interpretation of bit 30.
(DO_ADDP): Delete macro.
(do_vec_ADDP): Copy source registers before starting to update
destination register.
(do_vec_FADDP): Likewise.
(do_vec_load_store): Fix computation of sizeof_operation.
(rbit64): Fix type of constant.
(aarch64_step): When displaying insn value, display all 32 bits.

8 years agoUpdate comments to start_step_over
Yao Qi [Thu, 3 Mar 2016 09:28:19 +0000 (09:28 +0000)]
Update comments to start_step_over

I happen to see that comments to start_step_over isn't in sync with
code, so this patch is to update the comments.

gdb/gdbserver:

2016-03-03  Yao Qi  <yao.qi@linaro.org>

* linux-low.c: Update comments to start_step_over.

8 years agoNew test about step over clone syscall
Yao Qi [Thu, 3 Mar 2016 09:17:45 +0000 (09:17 +0000)]
New test about step over clone syscall

This patch adds a new test for stepping over clone syscall.

2016-03-03  Yao Qi  <yao.qi@linaro.org>

* gdb.base/step-over-syscall.exp (step_over_syscall): Kfail.
Invoke step_over_syscall "clone" and break_cond_on_syscall
"clone".
* gdb.base/step-over-clone.c: New file.

8 years agoReformat gdb.base/step-over-syscall.exp
Yao Qi [Thu, 3 Mar 2016 09:17:45 +0000 (09:17 +0000)]
Reformat gdb.base/step-over-syscall.exp

gdb/testsuite:

2016-03-03  Yao Qi  <yao.qi@linaro.org>

* gdb.base/step-over-syscall.exp (disp_step_cross_syscall): Fix
code format.

8 years agoRename disp-step-syscall.exp to step-over-syscall.exp
Yao Qi [Thu, 3 Mar 2016 09:17:45 +0000 (09:17 +0000)]
Rename disp-step-syscall.exp to step-over-syscall.exp

disp-step-syscall.exp is extended for stepping over syscall instruction
in different cases, with or without displaced stepping, and stepping
over by GDBserver.

This patch rename disp-step-syscall.exp to step-over-syscall.exp to
reflect this.

gdb/testsuite:

2016-03-03  Yao Qi  <yao.qi@linaro.org>

* gdb.base/disp-step-fork.c: Rename to ...
* gdb.base/step-over-fork.c: ... it.  New file.
* gdb.base/disp-step-vfork.c: Rename to ...
* gdb.base/step-over-vfork.c: ... it.  New file.
* gdb.base/disp-step-syscall.exp: Rename to ...
* gdb.base/step-over-syscall.exp: ... it.  New file.
(disp_step_cross_syscall): Rename to ...
(step_over_syscall): ... it.

8 years agoStep over fork/vfork syscall insn in gdbserver
Yao Qi [Thu, 3 Mar 2016 09:17:44 +0000 (09:17 +0000)]
Step over fork/vfork syscall insn in gdbserver

We can also extend disp-step-syscall.exp to test GDBserver step over
breakpoint on syscall instruction.  That is, we set a breakpoint
with a false condition on syscall instruction, so that GDBserver will
step over it.

This test triggers a GDBserver internal error, which can be fixed by
this series.

(gdb) PASS: gdb.base/disp-step-syscall.exp: fork: break cond on target: break on syscall insns
continue^M
Continuing.^M
Remote connection closed^M
(gdb) FAIL: gdb.base/disp-step-syscall.exp: fork: break cond on target: continue to fork again

In GDBserver, there is an internal error,

/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:1922: A problem internal to GDBserver has been detected.
unsuspend LWP 25554, suspended=-1

the simplified reproducer is like,

$ ./gdb ./testsuite/outputs/gdb.base/disp-step-syscall/disp-step-fork
(gdb) b main
(gdb) c
(gdb) disassemble fork // in order to find the address of insn 'syscall'
....
   0x00007ffff7ad6023 <+179>: syscall
(gdb) b *0x00007ffff7ad6023 if main == 0
(gdb) c

gdb/testsuite:

2016-03-03  Yao Qi  <yao.qi@linaro.org>

* gdb.base/disp-step-syscall.exp (break_cond_on_syscall): New.
If target supports condition evaluation on target, invoke
break_cond_on_syscall for fork and vfork.

8 years agoStep over syscalll insn with disp-step on and off
Yao Qi [Thu, 3 Mar 2016 09:17:44 +0000 (09:17 +0000)]
Step over syscalll insn with disp-step on and off

disp-step-syscall.exp was added to test displaced stepping over syscall
instructions, in which we set breakpoint on syscall instruction, and
step over it.  In fact, we can extend the test to non-displaced-stepping
case.  This patch wraps the test with displaced stepping on and off.
Note that the indentation and format isn't adjusted here to make this
patch easy to read.  The following patch will fix the format separately.

gdb/testsuite:

2016-03-03  Yao Qi  <yao.qi@linaro.org>

* gdb.base/disp-step-syscall.exp: Don't invoke
support_displaced_stepping.
(disp_step_cross_syscall): Test with displaced stepping off and
on if supported.

8 years agoRefactor gdb.base/disp-step-syscall.exp for general step over test
Yao Qi [Thu, 3 Mar 2016 09:17:44 +0000 (09:17 +0000)]
Refactor gdb.base/disp-step-syscall.exp for general step over test

This patch moves some code out of disp_step_cross_syscall to a new proc
check_pc_after_cross_syscall and setup.  Procedure setup is to start a
fresh GDB and compute the syscall instruction address.

gdb/testsuite:

2016-03-03  Yao Qi  <yao.qi@linaro.org>

* gdb.base/disp-step-syscall.exp (check_pc_after_cross_syscall): New
proc.
(setup): New proc.
(disp_step_cross_syscall): Move code to check_pc_after_cross_syscall
and setup.

8 years ago[GDBserver] Leave child suspended when step over parent
Yao Qi [Thu, 3 Mar 2016 09:17:44 +0000 (09:17 +0000)]
[GDBserver] Leave child suspended when step over parent

I see the following GDBserver internal error in two cases,

 gdb/gdbserver/linux-low.c:1922: A problem internal to GDBserver has been detected.
 unsuspend LWP 17200, suspended=-1

 1. step over a breakpoint on fork/vfork syscall instruction,
 2. step over a breakpoint on clone syscall instruction and child
    threads hits a breakpoint,

the stack backtrace is

 #0  internal_error (file=file@entry=0x44c4c0 "gdb/gdbserver/linux-low.c", line=line@entry=1922,
    fmt=fmt@entry=0x44c7d0 "unsuspend LWP %ld, suspended=%d\n") at gdb/gdbserver/../common/errors.c:51
 #1  0x0000000000424014 in lwp_suspended_decr (lwp=<optimised out>, lwp=<optimised out>) at gdb/gdbserver/linux-low.c:1922
 #2  0x000000000042403a in unsuspend_one_lwp (entry=<optimised out>, except=0x66e8c0) at gdb/gdbserver/linux-low.c:2885
 #3  0x0000000000405f45 in find_inferior (list=<optimised out>, func=func@entry=0x424020 <unsuspend_one_lwp>, arg=arg@entry=0x66e8c0)
    at gdb/gdbserver/inferiors.c:243
 #4  0x00000000004297de in unsuspend_all_lwps (except=0x66e8c0) at gdb/gdbserver/linux-low.c:2895
 #5  linux_wait_1 (ptid=..., ourstatus=ourstatus@entry=0x665ec0 <last_status>, target_options=target_options@entry=0)
    at gdb/gdbserver/linux-low.c:3632
 #6  0x000000000042a764 in linux_wait (ptid=..., ourstatus=0x665ec0 <last_status>, target_options=0)
    at gdb/gdbserver/linux-low.c:3770
 #7  0x0000000000411163 in mywait (ptid=..., ourstatus=ourstatus@entry=0x665ec0 <last_status>, options=options@entry=0, connected_wait=connected_wait@entry=1)
    at gdb/gdbserver/target.c:214
 #8  0x000000000040b1f2 in resume (actions=0x66f800, num_actions=1) at gdb/gdbserver/server.c:2757
 #9  0x000000000040f660 in handle_v_cont (own_buf=0x66a630 "vCont;c:p45e9.-1") at gdb/gdbserver/server.c:2719

when GDBserver steps over a thread, other threads have been suspended,
the "stepping" thread may create new thread, but GDBserver doesn't set
it suspend count to 1.  When GDBserver unsuspend threads, the child's
suspend count goes to -1, and the assert is triggered.  In fact, GDBserver
has already taken care of suspend count of new thread when GDBserver is
suspending all threads except the one GDBserver wants to step over by
https://sourceware.org/ml/gdb-patches/2015-07/msg00946.html

+   /* If we're suspending all threads, leave this one suspended
+      too.  */
+   if (stopping_threads == STOPPING_AND_SUSPENDING_THREADS)
+     {
+       if (debug_threads)
+ debug_printf ("HEW: leaving child suspended\n");
+       child_lwp->suspended = 1;
+     }

but that is not enough, because new thread is still can be spawned in
the thread which is being stepped over.  This patch extends the
condition that GDBserver set child's suspend count to one if it is
suspending threads or stepping over the thread.

gdb/gdbserver:

2016-03-03  Yao Qi  <yao.qi@linaro.org>

PR server/19736
* linux-low.c (handle_extended_wait): Set child suspended
if event_lwp->bp_reinsert isn't zero.

8 years agoSkip ld-elf/pr19162.d for hppa-*-*
H.J. Lu [Thu, 3 Mar 2016 03:07:01 +0000 (19:07 -0800)]
Skip ld-elf/pr19162.d for hppa-*-*

ld-elf/pr19162.d fails for hppa-*-* since Dave Anglin's fix for PR 12376
makes the data segment always start on a page boundary.

* testsuite/ld-elf/pr19162.d: Skip hppa-*-*.

8 years agoCorrect fr30 comment
Alan Modra [Thu, 3 Mar 2016 01:49:36 +0000 (12:19 +1030)]
Correct fr30 comment

* fr30.cpu (f.m4): Replace bogus comment with a better guess
at what is really going on.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 3 Mar 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoXfail mix_pic_and_non_pic on arm and aarch64
H.J. Lu [Wed, 2 Mar 2016 19:35:03 +0000 (11:35 -0800)]
Xfail mix_pic_and_non_pic on arm and aarch64

* testsuite/ld-elf/shared.exp (mix_pic_and_non_pic): Add xfails.
Xfail mix_pic_and_non_pic on "arm*-*-*" "aarch64*-*-*".

8 years agoCall enqueue_pending_signal in linux_resume_one_lwp_throw
Yao Qi [Wed, 2 Mar 2016 17:27:58 +0000 (17:27 +0000)]
Call enqueue_pending_signal in linux_resume_one_lwp_throw

Replace the code which is exactly what enqueue_pending_signal does.

gdb/gdbserver:

2016-03-02  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_resume_one_lwp_throw): Replace code with
enqueue_pending_signal.

8 years ago[OBV] gdbserver: Only write ipa_tdesc_idx if agent is actually loaded.
Marcin Kościelnicki [Wed, 2 Mar 2016 16:18:29 +0000 (17:18 +0100)]
[OBV] gdbserver: Only write ipa_tdesc_idx if agent is actually loaded.

Fixes rather embarassing gdb.trace regressions.

gdb/gdbserver/ChangeLog:

* tracepoint.c (cmd_qtstart): Only set ipa_tdesc_idx if agent
is actually loaded.

8 years agotestsuite: Remove unnecessary code in fortran vla-history test.
Bernhard Heckel [Wed, 2 Mar 2016 15:38:53 +0000 (16:38 +0100)]
testsuite: Remove unnecessary code in fortran vla-history test.

testsuite: Remove unnecessary code in fortran vla-history test.

2016-03-02  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:

     * gdb.fortran/vla-history.exp: Remove breakpoint.

8 years agotestsuite: Fix timeout issues during print of vla-arrays.
bernhard.heckel [Wed, 2 Mar 2016 15:34:57 +0000 (16:34 +0100)]
testsuite: Fix timeout issues during print of vla-arrays.

Printing and resolving of dynamic array's causes sporadic timeout issues on loaded systems.

2016-03-02  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:

     * gdb.fortran/vla-history.exp: Lookup array elements and printing exceeds timeout.

8 years agotestsuite: Fix run to main issue introduced by GCC 5.x.
bernhard.heckel [Wed, 2 Mar 2016 15:31:00 +0000 (16:31 +0100)]
testsuite: Fix run to main issue introduced by GCC 5.x.

Adding a dummy assignment as a new breakpoint anchor because
breakpoint on return statement doesn't work for GCC 5.x.

2016-03-02  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:

     * gdb.cp/vla-cxx.cc: Insert dummy assignment as anchor for an breakpoint.

8 years agotestsuite: Nullify pointers before first usage.
Bernhard Heckel [Wed, 2 Mar 2016 15:36:37 +0000 (16:36 +0100)]
testsuite: Nullify pointers before first usage.

Nullify pointers to avoid an undefined association status.

2016-03-02  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:

     * gdb.mi/vla.f90: Nullify pointer after declaration.

8 years agoAdd new maintainer to Write After Approval.
Bernhard Heckel [Wed, 2 Mar 2016 14:40:27 +0000 (15:40 +0100)]
Add new maintainer to Write After Approval.

Add new maintainer to Write After Approval.

2016-03-02  Bernhard Heckel  <bernhard.heckel@intel.com>

    * MAINTAINERS (Write After Approval): Add Bernhard Heckel.

8 years agoFix detection of gfortran compilers.
Bernhard Heckel [Wed, 2 Mar 2016 14:30:05 +0000 (15:30 +0100)]
Fix detection of gfortran compilers.

Newer gfortran compilers changed naming convention in DW_AT_producer tag.
For example "GNU Fortran 4.6.3" vs "GNU Fortran2008 5.3.0"

2016-03-02  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:

     * dwarf2read.c (new_symbol_full): Fix detection of gfortran compilers.

8 years agoRegenerate or1k opcodes file
Alan Modra [Wed, 2 Mar 2016 13:50:27 +0000 (00:20 +1030)]
Regenerate or1k opcodes file

CGEN patch now committed upstream to use hex numbers for large enums.

* or1k-desc.h: Regenerate.

8 years agoAdjust testsuite/gas/i386/x86_64-intel.d for COFF
H.J. Lu [Wed, 2 Mar 2016 13:15:32 +0000 (05:15 -0800)]
Adjust testsuite/gas/i386/x86_64-intel.d for COFF

* testsuite/gas/i386/x86_64-intel.d: Adjusted for COFF.

8 years agoSpeedup mmo and pe orphan placement for relocatable link
H.J. Lu [Wed, 2 Mar 2016 13:05:42 +0000 (05:05 -0800)]
Speedup mmo and pe orphan placement for relocatable link

Since there is no need to place output sections in specific order for
relocatable link, we can skip merging flags of other input sections.

PR ld/19739
* emultempl/mmo.em (mmo_place_orphan): Don't merge flags of other
input sections for relocatable link.
* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
* emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.

8 years agoRegenerate rl78 opcodes file
Alan Modra [Wed, 2 Mar 2016 02:11:01 +0000 (12:41 +1030)]
Regenerate rl78 opcodes file

For newer comments.

* rl78-decode.c: Regenerate.

8 years agoRegenerate bfd files.
Alan Modra [Tue, 1 Mar 2016 22:32:30 +0000 (09:02 +1030)]
Regenerate bfd files.

* Makefile.in: Regenerate.
* po/SRC-POTFILES.in: Regenerate.

8 years agoFix shift left warning at source
Alan Modra [Tue, 1 Mar 2016 22:28:07 +0000 (08:58 +1030)]
Fix shift left warning at source

cpu/
* fr30.cpu (f-m4): Replace -1 << 4 with -16.
opcodes/
* fr30-ibld.c: Regenerate.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 2 Mar 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoUpdate PR ld/12365 test for GCC 6
H.J. Lu [Tue, 1 Mar 2016 20:39:49 +0000 (12:39 -0800)]
Update PR ld/12365 test for GCC 6

PR ld/12365 test is to verify that linker catches the reference to
undefined symbol error caused by a GCC bug.  Since the GCC bug has
been fixed in GCC 6, update the test to verify that there is no
reference to undefined symbol in executable

* testsuite/ld-plugin/lto.exp: Update PR ld/12365 test for GCC 6.

8 years agoFix gdb.trace/ftrace-lock.c compilation
Pedro Alves [Tue, 1 Mar 2016 17:42:47 +0000 (17:42 +0000)]
Fix gdb.trace/ftrace-lock.c compilation

Fixes, on F23:

 .../src/gdb/testsuite/gdb.trace/ftrace-lock.c: In function 'gdb_agent_gdb_collect':
 .../src/gdb/testsuite/gdb.trace/ftrace-lock.c:50:3: warning: implicit declaration of function 'sleep' [-Wimplicit-function-declaration]
    sleep (1);
    ^

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

* gdb.trace/ftrace-lock.c: Include <unistd.h>.

8 years agoFix gdb.threads/watchpoint-fork*.c compilation
Pedro Alves [Tue, 1 Mar 2016 17:25:56 +0000 (17:25 +0000)]
Fix gdb.threads/watchpoint-fork*.c compilation

This testcase currently fails to compile on Fedora 23:

 .../src/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c: In function 'start':
 .../src/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c:70:11: warning: implicit declaration of function 'pthread_yield' [-Wimplicit-function-declaration]
i = pthread_yield ();
    ^
 .../src/gdb/testsuite/gdb.threads/watchpoint-fork-child.c: In function 'forkoff':
 .../src/gdb/testsuite/gdb.threads/watchpoint-fork-child.c:114:8: warning: implicit declaration of function 'pthread_yield' [-Wimplicit-function-declaratio
 n]
     i = pthread_yield ();
 ^
 /tmp/ccUkNIsI.o: In function `start':
 .../src/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c:70: undefined reference to `pthread_yield'
 (...)
 collect2: error: ld returned 1 exit status

 UNSUPPORTED: gdb.threads/watchpoint-fork.exp: child: multithreaded: Couldn't compile watchpoint-fork-child.c: unrecognized error
 UNTESTED: gdb.threads/watchpoint-fork.exp: child: multithreaded: watchpoint-fork.exp
 testcase .../src/gdb/testsuite/gdb.threads/watchpoint-fork.exp completed i

The glibc manual says, on _GNU_SOURCE:

 "You should define these macros by using ‘#define’ preprocessor
 directives at the top of your source code files. These directives must
 come before any #include of a system header file."

I instead put it in the header all the .c files of the testcase must
include anyway.

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

* gdb.threads/watchpoint-fork-child.c: Include "watchpoint-fork.h"
before anything else.
* gdb.threads/watchpoint-fork-mt.c: Likewise.  Don't define
_GNU_SOURCE here.
* gdb.threads/watchpoint-fork-st.c: Include "watchpoint-fork.h"
before anything else.
* gdb.threads/watchpoint-fork.h: Define _GNU_SOURCE.

8 years agoFix gdb.base/catch-fork-kill.c compilation
Pedro Alves [Tue, 1 Mar 2016 17:11:57 +0000 (17:11 +0000)]
Fix gdb.base/catch-fork-kill.c compilation

Fixes:

 Running .../src/gdb/testsuite/gdb.base/catch-fork-kill.exp ...
 gdb compile failed, .../src/gdb/testsuite/gdb.base/catch-fork-kill.c: In function 'main':
 .../src/gdb/testsuite/gdb.base/catch-fork-kill.c:81:4: warning: implicit declaration of function 'wait' [-Wimplicit-function-declaration]
     wait (NULL);
     ^

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

* gdb.base/catch-fork-kill.c: Include <sys/wait.h>.

8 years agoSkip ld-elf/pr19162.d for arc target
H.J. Lu [Tue, 1 Mar 2016 16:10:55 +0000 (08:10 -0800)]
Skip ld-elf/pr19162.d for arc target

* testsuite/ld-elf/pr19162.d: Skip arc target.

8 years agoFix output path for arm-disp-step.exp
Yao Qi [Tue, 1 Mar 2016 15:15:58 +0000 (15:15 +0000)]
Fix output path for arm-disp-step.exp

This patch fixes the following error,

ERROR: (/scratch/yao/gdb/build-git/arm-linux-gnueabihf/gdb/testsuite/outputs/gdb.arch/arm-disp-step/arm-disp-step) No such file or directory
FAIL: gdb.arch/arm-disp-step.exp: Can't run to main

gdb/testsuite:

2016-03-01  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/arm-disp-step.exp: Use standard_testfile and
prepare_for_testing.

8 years agoCompile gdb.arch/arm-neon.c with "quiet"
Yao Qi [Tue, 1 Mar 2016 15:07:34 +0000 (15:07 +0000)]
Compile gdb.arch/arm-neon.c with "quiet"

When we compile gdb.arch/arm-neon.c with options that don't enable NEON,
there are many error/warnings emitted into gdb.sum, which is annoying.
This patch fixes it by passing quiet to prepare_for_testing.

gdb/testsuite:

2016-03-01  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/arm-neon.exp: Pass quiet to prepare_for_testing.

8 years agoSpeedup ELF orphan placement for relocatable link
H.J. Lu [Mon, 29 Feb 2016 19:04:22 +0000 (11:04 -0800)]
Speedup ELF orphan placement for relocatable link

Since there is no need to place output sections in specific order for
relocatable link, we can skip merging flags of other input sections.

PR ld/19739
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't
merge flags of other input sections for relocatable link.

8 years agoS390: Fix output path for s390-tdbregs test case
Andreas Arnez [Tue, 1 Mar 2016 11:43:55 +0000 (12:43 +0100)]
S390: Fix output path for s390-tdbregs test case

Since test artifacts are always organized in a directory hierarchy, the
s390-tdbregs test case is not executed correctly any more.  This is
because it uses an obsolete way of constructing the executable's path.

This change invokes prepare_for_testing instead.

gdb/testsuite/ChangeLog:

* gdb.arch/s390-tdbregs.exp: Use prepare_for_testing instead of
manually constructing the output path.

8 years agoS390: Fix internal error with stackless inferior
Andreas Arnez [Tue, 1 Mar 2016 11:43:55 +0000 (12:43 +0100)]
S390: Fix internal error with stackless inferior

This fixes a GDB internal error that may occur when the inferior has no
valid stack pointer in r15.

gdb/testsuite/ChangeLog:

* gdb.arch/s390-stackless.S: New.
* gdb.arch/s390-stackless.exp: New.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_backchain_frame_unwind_cache): Avoid
exception when attempting to access the inferior's backchain.

8 years agoFix typo in print_insn_rl78_common function.
Nick Clifton [Tue, 1 Mar 2016 10:52:24 +0000 (10:52 +0000)]
Fix typo in print_insn_rl78_common function.

PR target/19747
* rl78-dis.c (print_insn_rl78_common): Fix typo.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 1 Mar 2016 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd a testcase for PR ld/19162
H.J. Lu [Mon, 29 Feb 2016 18:37:59 +0000 (10:37 -0800)]
Add a testcase for PR ld/19162

PR ld/19162
* testsuite/ld-elf/pr19162.d: New file.
* testsuite/ld-elf/pr19162a.s: Likwise.
* testsuite/ld-elf/pr19162b.s: Likwise.

8 years agoaarch64-linux process record: more syscalls
Yao Qi [Fri, 19 Feb 2016 15:54:03 +0000 (15:54 +0000)]
aarch64-linux process record: more syscalls

The last patch supports several syscalls in linux-record.c, so now
GDB aarch64-linux backend can return these canonicalized syscall numbers
per aarch64 syscall number.

This patch fixes the following fails,

Process record and replay target doesn't support syscall number 59^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0x00000020000eab28 in pipe () from /lib/aarch64-linux-gnu/libc.so.6^M
(gdb) FAIL: gdb.reverse/pipe-reverse.exp: continue to breakpoint: marker2

Process record and replay target doesn't support syscall number 59^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0x00000020000eab28 in pipe () from /lib/aarch64-linux-gnu/libc.so.6^M
(gdb) FAIL: gdb.reverse/readv-reverse.exp: continue to breakpoint: marker2

gdb:

2016-02-29  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-tdep.c (aarch64_canonicalize_syscall): Support
eventfd2, eventfd2, dup3, inotify_init1, fallocate and pipe2.
Return gdb_sys_epoll_create1 instead of gdb_sys_epoll_create
for aarch64_sys_epoll_create1.

8 years agoSupport more syscalls in linux-record: pipe2 epoll_create1 eventfd2 fallocate dup3...
Yao Qi [Fri, 19 Feb 2016 15:51:03 +0000 (15:51 +0000)]
Support more syscalls in linux-record: pipe2 epoll_create1 eventfd2 fallocate dup3 and inotify_init1

This patch adds more syscalls in linux-record.

gdb:

2016-02-29  Yao Qi  <yao.qi@linaro.org>

* linux-record.h (enum gdb_syscall) <gdb_sys_fallocate>: New.
<gdb_sys_eventfd2, gdb_sys_epoll_create1, gdb_sys_dup3>: New.
<gdb_sys_pipe2, gdb_sys_inotify_init1>: New.
* linux-record.c (record_linux_system_call): Handle them.

8 years ago[ARC] Local symbols relocation cleanup
Claudiu Zissulescu [Mon, 29 Feb 2016 15:51:11 +0000 (16:51 +0100)]
[ARC] Local symbols relocation cleanup

bfd/
2016-02-29  Cupertino Miranda  <cmiranda@synopsys.com>

* elf32-arc.c (elf_arc_relocate_section): Added rules to fix the
relocation addend when sections get merged.

gas/
2016-02-29  Cupertino Miranda  <cmiranda@synopsys.com>
    Claudiu Zissulescu  <Claudiu.Zissulescu@synopsys.com>

        * config/tc-arc.c (arc_extra_reloc): Change size to 0.
        (tc_arc_fix_adjustable): Changed default return value to 1.
        * testsuite/gas/arc/j.d: Updated expected symbol
        * testsuite/gas/arc/jl.d: Likewise
        * testsuite/gas/arc/relax-avoid1.d: Likewise
        * testsuite/gas/arc/st.d: Likewise

ld/
2016-02-29 Cupertino Miranda  <cmiranda@synopsys.com>

* testsuite/ld-elf/merge.d: Removed xfail for ARC.
* testsuite/ld-elf/merge2.d: Likewise.
* testsuite/ld-elf/merge3.d: Likewise.

8 years ago[ARC] General fixes.
Claudiu Zissulescu [Mon, 29 Feb 2016 15:07:48 +0000 (16:07 +0100)]
[ARC] General fixes.

bfd/
2016-02-29  Cupertino Miranda <Cupertino.Miranda@synopsys.com>

* elf32-arc.c (arc_elf_final_write_processing): Add condition to
the flag change.
        (elf_arc_relocate_section): Fixes and conditions to support PIE.
Assert for code sections dynamic relocs.

gas/
2016-02-29  Claudiu Zissulescu  <Claudiu.Zissulescu@synopsys.com>

* config/tc-arc.c: Enable code density instructions for ARC EM.

ld/
2016-02-29  Cupertino Miranda  <Cupertino.Miranda@synopsys.com>

* scripttempl/arclinux.sc: Force .tdata and .tbss to always be
generated.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Feb 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoDon't recursively look for a symbol in all imports of imported modules.
Iain Buclaw [Sun, 28 Feb 2016 09:25:55 +0000 (10:25 +0100)]
Don't recursively look for a symbol in all imports of imported modules.

Given two or more modules that import each other's scope, the current symbol
lookup routines would go round in circles looking through each import from
each module, possibly checking the same module twice or more until all possible
paths are marked as "searched".

Given enough modules, this causes an exponential slowdown in time taken to find
symbols that do exist, and infinite recursion when they don't.

gdb/ChangeLog:
* d-namespace.c (d_lookup_symbol_imports): Avoid recursive lookups from
cyclic imports.

gdb/testsuite/ChangeLog:
* gdb.dlang/circular.c: New file.
* gdb.dlang/circular.exp: New file.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 28 Feb 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 27 Feb 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix CXX invalid cast from void *.
Keith Seitz [Fri, 26 Feb 2016 20:22:24 +0000 (12:22 -0800)]
Fix CXX invalid cast from void *.

This is an obvious patch to fix the following build error seen with
--enable-build-with-cxx:

../../src/gdb/rs6000-tdep.c: In function ‘rs6000_frame_cache* rs6000_frame_cache(frame_info*, void**)’:
../../src/gdb/rs6000-tdep.c:3242:15: error: invalid conversion from ‘void*’ to ‘rs6000_frame_cache*’ [-fpermissive]
       return (*this_cache);
              ~^~~~~~~~~~~~

gdb/ChangeLog

* rs6000-tdep.c (rs6000_frame_cache): Explicitly cast return result
to avoid invalid conversion from void *.

8 years agoAdd aarch64-*-rtems* target
Joel Sherrill [Thu, 25 Feb 2016 16:05:51 +0000 (10:05 -0600)]
Add aarch64-*-rtems* target

8 years agoAdd x86_64-*-rtems* target
Joel Sherrill [Sat, 4 Apr 2015 00:08:27 +0000 (19:08 -0500)]
Add x86_64-*-rtems* target

ld/configure.tgt: Also add stanza for x86_64-*-elf.

8 years ago[BFD][AARCH64]Fix MOVW_SABS_G(0,1,2) relocation overflow check.
Renlin Li [Fri, 26 Feb 2016 17:52:34 +0000 (17:52 +0000)]
[BFD][AARCH64]Fix MOVW_SABS_G(0,1,2) relocation overflow check.

For these three relocations, 17 bit signed value should be used, instead of
16 bit. The bitsize field is changed from 16 to 17, this field in aarch64
backend is used for overflow check only.

bfd/

2016-02-26  Renlin Li  <renlin.li@arm.com>

    * elfnn-aarch64.c (elfNN_aarch64_howto_table): Fix signed overflow
    check for MOVW_SABS_G0, MOVW_SABS_G1, MOVW_SABS_G2.

ld/

2016-02-26  Renlin Li  <renlin.li@arm.com>

    * testsuite/ld-aarch64/aarch64-elf.exp: Run new testcases.
    * testsuite/ld-aarch64/emit-relocs-270.d: Update to use new boundary.
    * testsuite/ld-aarch64/emit-relocs-271.d: Likewise.
    * testsuite/ld-aarch64/emit-relocs-272.d: Likewise.
    * testsuite/ld-aarch64/emit-relocs-270-overflow.d: New.
    * testsuite/ld-aarch64/emit-relocs-270-overflow.s: New.
    * testsuite/ld-aarch64/emit-relocs-271-overflow.d: New.
    * testsuite/ld-aarch64/emit-relocs-271-overflow.s: New.
    * testsuite/ld-aarch64/emit-relocs-272-overflow.d: New.
    * testsuite/ld-aarch64/emit-relocs-272-overflow.s: New.

8 years agoOptimize x86 GOT32X/GOTPCRELX relocations
H.J. Lu [Fri, 26 Feb 2016 17:38:08 +0000 (09:38 -0800)]
Optimize x86 GOT32X/GOTPCRELX relocations

R_386_GOT32X, R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX relocations
retrieve the symbol address via its GOT slot.  If the symbol address is
known at the link-time, we can use it directly by changing instruction
encoding.  Indirect branch can only be converted to PC relative direct
branch.  MOV can be changed to LEA or encoded differently with signed
address.  The subset of binary operations can be encoded only with
signed address.

If undefined weak symbol is resolved to zero link-time, we can use it
as address.  Zero addresss can't used with PC relative direct branch
when PIC is true since the current PC is unknown.  In 64-bit, 32-bit
relocation for PC relatiave direct branch to zero may also overflow.

If this optimization causes relocation overflow, --no-relax can be used
to work around it.

bfd/

PR ld/19609
* elf32-i386.c (elf_i386_convert_load): Convert to R_386_32 for
load with locally bound symbols if PIC is false or there is no
base register.  Optimize branch to 0 if PIC is false.
(elf_i386_relocate_section): Don't generate dynamic relocations
against undefined weak symbols if PIC is false.
* elf64-x86-64.c (elf_x86_64_convert_load): Disable optimization
if we can't estimate relocation overflow with --no-relax.
Convert to R_X86_64_32S/R_X86_64_32 for load with locally bound
symbols if PIC is false.  Optimize branch to 0 if PIC is false.
(elf_x86_64_relocate_section): Don't generate dynamic relocations
against undefined weak symbols if PIC is false.

ld/

PR ld/19609
* testsuite/ld-i386/got1.dd: Updated.
* testsuite/ld-i386/lea1c.d: Likewise.
* testsuite/ld-i386/load1-nacl.d: Likewise.
* testsuite/ld-i386/load1.d: Likewise.
* testsuite/ld-i386/load4b.d: Likewise.
* testsuite/ld-i386/load5b.d: Likewise.
* testsuite/ld-i386/mov1b.d: Likewise.
* testsuite/ld-x86-64/mov1b.d: Likewise.
* testsuite/ld-x86-64/mov1d.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-x86-64/gotpcrel1.dd: Likewise.
* testsuite/ld-x86-64/lea1a.d: Likewise.
* testsuite/ld-x86-64/lea1b.d: Likewise.
* testsuite/ld-x86-64/lea1c.d: Likewise.
* testsuite/ld-x86-64/lea1d.d: Likewise.
* testsuite/ld-x86-64/lea1e.d: Likewise.
* testsuite/ld-x86-64/lea1f.d: Likewise.
* testsuite/ld-x86-64/mov1b.d: Likewise.
* testsuite/ld-x86-64/mov1d.d: Likewise.
* testsuite/ld-x86-64/pr13082-3b.d: Likewise.
* testsuite/ld-x86-64/pr13082-4b.d: Likewise.
* testsuite/ld-x86-64/lea1.s: Add tests for 32-bit registers.
* testsuite/ld-i386/pr19609-1.s: New file.
* testsuite/ld-i386/pr19609-1a.d: Likewise.
* testsuite/ld-i386/pr19609-1b.d: Likewise.
* testsuite/ld-i386/pr19609-1c.d: Likewise.
* testsuite/ld-i386/pr19609-1d.d: Likewise.
* testsuite/ld-i386/pr19609-1e.d: Likewise.
* testsuite/ld-i386/pr19609-1f.d: Likewise.
* testsuite/ld-i386/pr19609-1g.d: Likewise.
* testsuite/ld-i386/pr19609-1h.d: Likewise.
* testsuite/ld-i386/pr19609-1i.d: Likewise.
* testsuite/ld-i386/pr19609-2.s: Likewise.
* testsuite/ld-i386/pr19609-2a.d: Likewise.
* testsuite/ld-i386/pr19609-2b.d: Likewise.
* testsuite/ld-i386/pr19609-2c.d: Likewise.
* testsuite/ld-i386/undefweak.s: Likewise.
* testsuite/ld-i386/undefweaka.d: Likewise.
* testsuite/ld-i386/undefweakb.d: Likewise.
* testsuite/ld-x86-64/pr13082-3c.d: Likewise.
* testsuite/ld-x86-64/pr13082-3d.d: Likewise.
* testsuite/ld-x86-64/pr19609-1.s: Likewise.
* testsuite/ld-x86-64/pr19609-1a.d: Likewise.
* testsuite/ld-x86-64/pr19609-1b.d: Likewise.
* testsuite/ld-x86-64/pr19609-1c.d: Likewise.
* testsuite/ld-x86-64/pr19609-1d.d: Likewise.
* testsuite/ld-x86-64/pr19609-1e.d: Likewise.
* testsuite/ld-x86-64/pr19609-1f.d: Likewise.
* testsuite/ld-x86-64/pr19609-1g.d: Likewise.
* testsuite/ld-x86-64/pr19609-1h.d: Likewise.
* testsuite/ld-x86-64/pr19609-1i.d: Likewise.
* testsuite/ld-x86-64/pr19609-1j.d: Likewise.
* testsuite/ld-x86-64/pr19609-1k.d: Likewise.
* testsuite/ld-x86-64/pr19609-1l.d: Likewise.
* testsuite/ld-x86-64/pr19609-1m.d: Likewise.
* testsuite/ld-x86-64/pr19609-2.s: Likewise.
* testsuite/ld-x86-64/pr19609-2a.d: Likewise.
* testsuite/ld-x86-64/pr19609-2b.d: Likewise.
* testsuite/ld-x86-64/pr19609-2c.d: Likewise.
* testsuite/ld-x86-64/pr19609-2d.d: Likewise.
* testsuite/ld-x86-64/pr19609-3.s: Likewise.
* testsuite/ld-x86-64/pr19609-3a.d: Likewise.
* testsuite/ld-x86-64/pr19609-3b.d: Likewise.
* testsuite/ld-x86-64/pr19609-4.s: Likewise.
* testsuite/ld-x86-64/pr19609-4a.d: Likewise.
* testsuite/ld-x86-64/pr19609-4b.d: Likewise.
* testsuite/ld-x86-64/pr19609-4c.d: Likewise.
* testsuite/ld-x86-64/pr19609-4d.d: Likewise.
* testsuite/ld-x86-64/pr19609-4e.d: Likewise.
* testsuite/ld-x86-64/pr19609-5.s: Likewise.
* testsuite/ld-x86-64/pr19609-5a.d: Likewise.
* testsuite/ld-x86-64/pr19609-5b.d: Likewise.
* testsuite/ld-x86-64/pr19609-5c.d: Likewise.
* testsuite/ld-x86-64/pr19609-5d.d: Likewise.
* testsuite/ld-x86-64/pr19609-5e.d: Likewise.
* testsuite/ld-x86-64/pr19609-6.s: Likewise.
* testsuite/ld-x86-64/pr19609-6a.d: Likewise.
* testsuite/ld-x86-64/pr19609-6b.d: Likewise.
* testsuite/ld-x86-64/pr19609-6c.d: Likewise.
* testsuite/ld-x86-64/pr19609-6d.d: Likewise.
* testsuite/ld-x86-64/pr19609-7.s: Likewise.
* testsuite/ld-x86-64/pr19609-7a.d: Likewise.
* testsuite/ld-x86-64/pr19609-7b.d: Likewise.
* testsuite/ld-x86-64/pr19609-7c.d: Likewise.
* testsuite/ld-x86-64/pr19609-7d.d: Likewise.
* testsuite/ld-i386/i386.exp: Run undefweak tests and tests for
PR ld/19609.
* testsuite/ld-x86-64/x86-64.exp: Run pr13082-3c, pr13082-3d
and tests for PR ld/19609.

8 years agoDiscard FDEs for zero-length address ranges.
Cary Coutant [Fri, 26 Feb 2016 15:50:15 +0000 (07:50 -0800)]
Discard FDEs for zero-length address ranges.

2016-02-26  Egor Kochetov  <egor.kochetov@intel.com>
    Cary Coutant  <ccoutant@gmail.com>

gold/
PR gold/19735
* ehframe.h (Cie::fde_encoding): New method.
* ehframe.cc (Eh_frame::read_fde): Discard FDEs for zero-length
address ranges.

8 years agoFix various bugs in arm_record_exreg_ld_st_insn
Yao Qi [Fri, 26 Feb 2016 15:00:36 +0000 (15:00 +0000)]
Fix various bugs in arm_record_exreg_ld_st_insn

This patch fixes various bugs in arm_record_exreg_ld_st_insn, and use
gdb.reverse/insn-reverse.c to test more arm instructions.

 - Set flag SINGLE_REG correctly.  In the arch reference manual,
   SING_REG is true when the bit 8 of instruction is zero.
 - Record the right D registers for instructions changing S registers.
 - Fix the order of length and address in record_buf_mem array.
 - Shift the offset by 2 instead of by 24.

This patch also fixes one internal error,

(gdb) PASS: gdb.reverse/finish-precsave.exp: BP at end of main
continue^M
Continuing.^M
../../binutils-gdb/gdb/utils.c:1072: internal-error: virtual memory exhausted.^M
A problem internal to GDB has been detected,FAIL: gdb.reverse/finish-precsave.exp: run to end of main (GDB internal error)

gdb:

2016-02-26  Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c (arm_record_exreg_ld_st_insn): Set 'single_reg'
per bit 8.  Check bit 20 instead of bit 4 for VMOV
instruction.  Record D registers for instructions changing
S registers.  Change of the order of length and address
in record_buf_mem array.

gdb/testsuite:

2016-02-26  Yao Qi  <yao.qi@linaro.org>

* gdb.reverse/insn-reverse.c [__arm__] (ext_reg_load): New.
[__arm__] (ext_reg_mov, ext_reg_push_pop): New.
(testcases): Update.

8 years agoRecord right reg num of thumb special data instructions
Yao Qi [Fri, 26 Feb 2016 15:00:36 +0000 (15:00 +0000)]
Record right reg num of thumb special data instructions

When GDB decodes these thumb special data instructions, such as 'mov sp, r7'
the Rd is got incorrectly.  According to the arch reference manual, the Rd
is DN:Rdn, in which DN is bit 7 and Rdn is bits 0 to 2.  This patch fixes it.

gdb:

2016-02-26  Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c (thumb_record_ld_st_reg_offset): Fix the register
number of Rd.

8 years agoRename gdb.reverse/aarch64.{exp,c} to gdb.reverse/insn-reverse.{exp,c}
Yao Qi [Fri, 26 Feb 2016 15:00:36 +0000 (15:00 +0000)]
Rename gdb.reverse/aarch64.{exp,c} to gdb.reverse/insn-reverse.{exp,c}

gdb/testsuite:

2016-02-26  Yao Qi  <yao.qi@linaro.org>

* gdb.reverse/aarch64.c: Rename to ...
* gdb.reverse/insn-reverse.c: ... it.
* gdb.reverse/aarch64.exp: Rename to ...
* gdb.reverse/insn-reverse.exp: ... it.

8 years agoGeneralize gdb.reverse/aarch64.exp
Yao Qi [Fri, 26 Feb 2016 15:00:36 +0000 (15:00 +0000)]
Generalize gdb.reverse/aarch64.exp

I said we can generialize gdb.reverse/aarch64.exp for other
architectures https://sourceware.org/ml/gdb-patches/2015-05/msg00482.html
and here is the patch to change aarch64.exp so that it can be used to
test for other architectures as well.

gdb/testsuite:

2016-02-26  Yao Qi  <yao.qi@linaro.org>

* gdb.reverse/aarch64.c: [__aarch64__] Include arm_neon.h.
(testcase_ftype): New.
(testcases): New array.
(n_testcases): New.
(main): Call each element in testcases.
* gdb.reverse/aarch64.exp: Remove is_aarch64_target check.
(read_testcase): New.
Do the tests in a loop.

8 years agoAdd ChangeLog entries for PR ld/19645
H.J. Lu [Fri, 26 Feb 2016 14:44:03 +0000 (06:44 -0800)]
Add ChangeLog entries for PR ld/19645

8 years agoProperly implement STT_COMMON
H.J. Lu [Mon, 22 Feb 2016 17:18:52 +0000 (09:18 -0800)]
Properly implement STT_COMMON

The BFD configure option, --enable-elf-stt-common, can't be to used to
verify STT_COMMON implementation with the normal binutils build.  Instead,
this patch removes it from BFD.  It adds --elf-stt-common=[no|yes] to ELF
assembler/objcopy and adds -z common/-z nocommon to ld.

A configure option, --enable-elf-stt-common, is added to gas to specify
whether ELF assembler should generate common symbols with the STT_COMMON
type by default.

Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF
common symbols.

bfd/

PR ld/19645
* bfd.c (bfd): Change flags to 20 bits.
(BFD_CONVERT_ELF_COMMON): New.
(BFD_USE_ELF_STT_COMMON): Likewise.
(BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and
BFD_USE_ELF_STT_COMMON.
(BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
* configure.ac: Remove --enable-elf-stt-common.
* elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for
common symbol depending on BFD_CONVERT_ELF_COMMON and
BFD_USE_ELF_STT_COMMON.
* elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for
STT_COMMON.
* elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check
STT_COMMON.
(elf_link_convert_common_type): New function.
(elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for
common symbol depending on BFD_CONVERT_ELF_COMMON and
BFD_USE_ELF_STT_COMMON.  Set sym.st_info after sym.st_shndx.
* elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON
and BFD_USE_ELF_STT_COMMON to object_flags.
(TARGET_LITTLE_SYM): Likewise.
* syms.c (BSF_KEEP_G): Renamed to ...
(BSF_ELF_COMMON): This.
* bfd-in2.h: Regenerated.
* config.in: Likewise.
* configure: Likewise.

binutils/

PR ld/19645
* NEWS: Mention --elf-stt-common= for objcopy.
* doc/binutils.texi: Document --elf-stt-common= for objcopy.
* objcopy.c (do_elf_stt_common): New.
(command_line_switch): Add OPTION_ELF_STT_COMMON.
(copy_options): Add --elf-stt-common=.
(copy_usage): Add --elf-stt-common=.
(copy_object): Also check do_elf_stt_common for ELF targets.
(copy_file): Handle do_elf_stt_common.
(copy_main): Handle OPTION_ELF_STT_COMMON.
* readelf.c (apply_relocations): Support STT_COMMON.
* testsuite/binutils-all/common-1.s: New file.
* testsuite/binutils-all/common-1a.d: Likewise.
* testsuite/binutils-all/common-1b.d: Likewise.
* testsuite/binutils-all/common-1c.d: Likewise.
* testsuite/binutils-all/common-1d.d: Likewise.
* testsuite/binutils-all/common-1e.d: Likewise.
* testsuite/binutils-all/common-1f.d: Likewise.
* testsuite/binutils-all/common-2.s: Likewise.
* testsuite/binutils-all/common-2a.d: Likewise.
* testsuite/binutils-all/common-2b.d: Likewise.
* testsuite/binutils-all/common-2c.d: Likewise.
* testsuite/binutils-all/common-2d.d: Likewise.
* testsuite/binutils-all/common-2e.d: Likewise.
* testsuite/binutils-all/common-2f.d: Likewise.
* testsuite/binutils-all/objcopy.exp
(objcopy_test_elf_common_symbols): New proc.
Run objcopy_test_elf_common_symbols for ELF targets

gas/

PR ld/19645
* NEWS: Mention --enable-elf-stt-common and --elf-stt-common=
for ELF assemblers.
* as.c (flag_use_elf_stt_common): New.
(show_usage): Add --elf-stt-common=.
(option_values): Add OPTION_ELF_STT_COMMON.
(std_longopts): Add --elf-stt-common=.
(parse_args): Handle --elf-stt-common=.
* as.h (flag_use_elf_stt_common): New.
* config.in: Regenerated.
* configure: Likewise.
* configure.ac: Add --enable-elf-stt-common and define
DEFAULT_GENERATE_ELF_STT_COMMON.
* gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON
and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set.
* doc/as.texinfo: Document --elf-stt-common=.
* testsuite/gas/elf/common3.s: New file.
* testsuite/gas/elf/common3a.d: Likewise.
* testsuite/gas/elf/common3b.d: Likewise.
* testsuite/gas/elf/common4.s: Likewise.
* testsuite/gas/elf/common4a.d: Likewise.
* testsuite/gas/elf/common4b.d: Likewise.
* testsuite/gas/i386/dw2-compress-3b.d: Likewise.
* testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
* testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a
and common4b.
* testsuite/gas/i386/dw2-compress-3.d: Renamed to ...
* testsuite/gas/i386/dw2-compress-3a.d: This.  Pass
--elf-stt-common=no to as.
* testsuite/gas/i386/dw2-compressed-3.d: Renamed to ...
* testsuite/gas/i386/dw2-compressed-3a.d: This.  Pass
--elf-stt-common=no to as.
* testsuite/gas/i386/i386.exp: Run dw2-compress-3a,
dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead
of dw2-compress-3 and dw2-compressed-3.

include/

PR ld/19645
* bfdlink.h (bfd_link_elf_stt_common): New enum.
(bfd_link_info): Add elf_stt_common.

ld/

PR ld/19645
* NEWS: Mention -z common/-z nocommon for ELF targets.
* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle
-z common and -z nocommon.
* ld.texinfo: Document -z common/-z nocommon.
* lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon.
* testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and
--elf-stt-common=yes with assembler.
* testsuite/ld-elfcomm/common-1.s: New file.
* testsuite/ld-elfcomm/common-1a.d: Likewise.
* testsuite/ld-elfcomm/common-1b.d: Likewise.
* testsuite/ld-elfcomm/common-1c.d: Likewise.
* testsuite/ld-elfcomm/common-1d.d: Likewise.
* testsuite/ld-elfcomm/common-1e.d: Likewise.
* testsuite/ld-elfcomm/common-1f.d: Likewise.
* testsuite/ld-elfcomm/common-2.s: Likewise.
* testsuite/ld-elfcomm/common-2a.d: Likewise.
* testsuite/ld-elfcomm/common-2b.d: Likewise.
* testsuite/ld-elfcomm/common-2c.d: Likewise.
* testsuite/ld-elfcomm/common-2d.d: Likewise.
* testsuite/ld-elfcomm/common-2e.d: Likewise.
* testsuite/ld-elfcomm/common-2f.d: Likewise.
* testsuite/ld-elfcomm/common-3a.rd: Likewise.
* testsuite/ld-elfcomm/common-3b.rd: Likewise.
* testsuite/ld-i386/pr19645.d: Likewise.
* testsuite/ld-i386/pr19645.s: Likewise.
* testsuite/ld-x86-64/largecomm-1.s: Likewise.
* testsuite/ld-x86-64/largecomm-1a.d: Likewise.
* testsuite/ld-x86-64/largecomm-1b.d: Likewise.
* testsuite/ld-x86-64/largecomm-1c.d: Likewise.
* testsuite/ld-x86-64/largecomm-1d.d: Likewise.
* testsuite/ld-x86-64/largecomm-1e.d: Likewise.
* testsuite/ld-x86-64/largecomm-1f.d: Likewise.
* testsuite/ld-x86-64/pr19645.d: Likewise.
* testsuite/ld-x86-64/pr19645.s: Likewise.
* testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes
with assembler.
(assembler_generates_commons): Removed.
Run -z common/-z nocommon tests.  Run *.d tests.
* testsuite/ld-i386/i386.exp: Run pr19645.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with
assembler.  Test STT_COMMON with readelf.

8 years ago[x86] Resolve non-PIC undefweak symbols in executable
H.J. Lu [Fri, 26 Feb 2016 12:16:15 +0000 (04:16 -0800)]
[x86] Resolve non-PIC undefweak symbols in executable

For i386 and x86-64, non-PIC references to undefined weak symbols are
resolved without dynamic relocation when creating executable.  Resolved
undefined weak symbols are removed from the dynamic symbol table in
executable.  One exception is on i386, we need resolved undefined weak
symbols in the dynamic symbol table in PIE if input relocatable files
contain branchs without PLT so that we can branch to 0 with dynamic
relocation in text section.

This makes behaviors of dynamic executable and position independent
executable predictable with mixed PIC and non-PIC references to undefined
weak symbols.  If all references to undefined weak symbols are PIC,
dynamic relocations against undefined weak symbols will be generated
in executable unless -z nodynamic-undefined-weak is passed to linker.

bfd/

PR ld/19636
PR ld/19704
PR ld/19719
* elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
(elf_i386_link_hash_entry): Add has_got_reloc and
has_non_got_reloc.
(elf_i386_link_hash_table): Add interp.
(elf_i386_link_hash_newfunc): Initialize has_got_reloc and
has_non_got_reloc.
(elf_i386_copy_indirect_symbol): Copy has_got_reloc and
has_non_got_reloc.
(elf_i386_check_relocs): Set has_got_reloc and has_non_got_reloc.
(elf_i386_fixup_symbol): New function.
(elf_i386_pie_finish_undefweak_symbol): Likewise.
(elf_i386_allocate_dynrelocs): Don't allocate space for dynamic
relocations and discard relocations against resolved undefined
weak symbols in executable.  Don't make resolved undefined weak
symbols in executable dynamic.  Keep dynamic non-GOT/non-PLT
relocation against undefined weak symbols in PIE.
(elf_i386_size_dynamic_sections): Set interp to .interp section.
(elf_i386_relocate_section): Don't generate dynamic relocations
against resolved undefined weak symbols in PIE, except for
R_386_PC32.
(elf_i386_finish_dynamic_symbol): Keep PLT/GOT entries without
dynamic PLT/GOT relocations for resolved undefined weak symbols.
Don't generate dynamic relocation against resolved undefined weak
symbol in executable.
(elf_i386_finish_dynamic_sections): Call
elf_i386_pie_finish_undefweak_symbol on all symbols in PIE.
(elf_backend_fixup_symbol): New.
* elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
(elf_x86_64_link_hash_entry): Add has_got_reloc and
has_non_got_reloc.
(elf_x86_64_link_hash_table): Add interp.
(elf_x86_64_link_hash_newfunc): Initialize has_got_reloc and
has_non_got_reloc.
(elf_x86_64_copy_indirect_symbol): Copy has_got_reloc and
has_non_got_reloc.
(elf_x86_64_check_relocs): Set has_got_reloc and
has_non_got_reloc.
(elf_x86_64_fixup_symbol): New function.
(elf_x86_64_pie_finish_undefweak_symbol): Likewise.
(elf_x86_64_allocate_dynrelocs): Don't allocate space for dynamic
relocations and discard relocations against resolved undefined
weak symbols in executable.  Don't make resolved undefined weak
symbols in executable dynamic.
(elf_x86_64_size_dynamic_sections): Set interp to .interp section.
(elf_x86_64_relocate_section): Check relocation overflow for
dynamic relocations against unresolved weak undefined symbols.
Don't generate dynamic relocations against resolved weak
undefined symbols in PIE.
(elf_x86_64_finish_dynamic_symbol): Keep PLT/GOT entries without
dynamic PLT/GOT relocations for resolved undefined weak symbols.
Don't generate dynamic relocation against resolved undefined weak
symbol in executable.
(elf_x86_64_finish_dynamic_sections): Call
elf_x86_64_pie_finish_undefweak_symbol on all symbols in PIE.
(elf_backend_fixup_symbol): New.

include/

PR ld/19636
PR ld/19704
PR ld/19719
* bfdlink.h (bfd_link_info): Add dynamic_undefined_weak.

ld/

PR ld/19636
PR ld/19704
PR ld/19719
* Makefile.am (ELF_X86_DEPS): Add dynamic_undefined_weak.sh.
* Makefile.in: Regenerated.
* NEWS: Mention -z nodynamic-undefined-weak.
* ld.texinfo: Document -z nodynamic-undefined-weak.
* ldmain.c (main): Initialize dynamic_undefined_weak to -1.
* emulparams/dynamic_undefined_weak.sh: New file.
* emulparams/elf32_x86_64.sh: Source dynamic_undefined_weak.sh.
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_i386_be.sh: Likewise.
* emulparams/elf_i386_chaos.sh: Likewise.
* emulparams/elf_i386_ldso.sh: Likewise.
* emulparams/elf_i386_vxworks.sh: Likewise.
* emulparams/elf_iamcu.sh: Likewise.
* emulparams/elf_k1om.sh: Likewise.
* emulparams/elf_l1om.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/extern_protected_data.sh (PARSE_AND_LIST_OPTIONS):
Append.
(PARSE_AND_LIST_ARGS_CASE_Z): Likewise.
* testsuite/ld-elf/pr19719a.c: New file.
* testsuite/ld-elf/pr19719b.c: Likewise.
* testsuite/ld-elf/pr19719c.c: Likewise.
* testsuite/ld-elf/pr19719d.c: Likewise.
* testsuite/ld-i386/pr19636-1.s: Likewise.
* testsuite/ld-i386/pr19636-1a.d: Likewise.
* testsuite/ld-i386/pr19636-1b.d: Likewise.
* testsuite/ld-i386/pr19636-1c.d: Likewise.
* testsuite/ld-i386/pr19636-1d-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-1d.d: Likewise.
* testsuite/ld-i386/pr19636-1e.d: Likewise.
* testsuite/ld-i386/pr19636-1f.d: Likewise.
* testsuite/ld-i386/pr19636-1g.d: Likewise.
* testsuite/ld-i386/pr19636-1h.d: Likewise.
* testsuite/ld-i386/pr19636-1i.d: Likewise.
* testsuite/ld-i386/pr19636-2.s: Likewise.
* testsuite/ld-i386/pr19636-2a.d: Likewise.
* testsuite/ld-i386/pr19636-2b.d: Likewise.
* testsuite/ld-i386/pr19636-2c-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2c.d: Likewise.
* testsuite/ld-i386/pr19636-2d-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2d.d: Likewise.
* testsuite/ld-i386/pr19636-2e-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2e.d: Likewise.
* testsuite/ld-i386/pr19636-3.s: Likewise.
* testsuite/ld-i386/pr19636-3a.d: Likewise.
* testsuite/ld-i386/pr19636-3b.d: Likewise.
* testsuite/ld-i386/pr19636-3c.d: Likewise.
* testsuite/ld-i386/pr19636-3d.d: Likewise.
* testsuite/ld-i386/pr19636-3e.d: Likewise.
* testsuite/ld-i386/pr19636-3f.d: Likewise.
* testsuite/ld-i386/pr19636-3g.d: Likewise.
* testsuite/ld-i386/pr19636-4.s: Likewise.
* testsuite/ld-i386/pr19636-4a.d: Likewise.
* testsuite/ld-i386/pr19636-4b.d: Likewise.
* testsuite/ld-i386/pr19636-4c.d: Likewise.
* testsuite/ld-i386/pr19636-4d.d: Likewise.
* testsuite/ld-i386/pr19704.out: Likewise.
* testsuite/ld-i386/pr19704a.c: Likewise.
* testsuite/ld-i386/pr19704b.c: Likewise.
* testsuite/ld-x86-64/pr19636-1.s: Likewise.
* testsuite/ld-x86-64/pr19636-1a.d: Likewise.
* testsuite/ld-x86-64/pr19636-1b.d: Likewise.
* testsuite/ld-x86-64/pr19636-1c.d: Likewise.
* testsuite/ld-x86-64/pr19636-1d.d: Likewise.
* testsuite/ld-x86-64/pr19636-1e.d: Likewise.
* testsuite/ld-x86-64/pr19636-1f.d: Likewise.
* testsuite/ld-x86-64/pr19636-1g.d: Likewise.
* testsuite/ld-x86-64/pr19636-2.s: Likewise.
* testsuite/ld-x86-64/pr19636-2a.d: Likewise.
* testsuite/ld-x86-64/pr19636-2b.d: Likewise.
* testsuite/ld-x86-64/pr19636-2c.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d-nacl.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2e.d: Likewise.
* testsuite/ld-x86-64/pr19636-2f.d: Likewise.
* testsuite/ld-x86-64/pr19636-2g.d: Likewise.
* testsuite/ld-x86-64/pr19636-2h.d: Likewise.
* testsuite/ld-x86-64/pr19636-2i.d: Likewise.
* testsuite/ld-x86-64/pr19636-3.s: Likewise.
* testsuite/ld-x86-64/pr19636-3a.d: Likewise.
* testsuite/ld-x86-64/pr19636-3b.d: Likewise.
* testsuite/ld-x86-64/pr19636-3c.d: Likewise.
* testsuite/ld-x86-64/pr19636-3d.d: Likewise.
* testsuite/ld-x86-64/pr19704.out: Likewise.
* testsuite/ld-x86-64/pr19704a.c: Likewise.
* testsuite/ld-x86-64/pr19704b.c: Likewise.
* testsuite/ld-elf/shared.exp (mix_pic_and_non_pic): New.
Run mix_pic_and_non_pic.
* testsuite/ld-i386/i386.exp (undefined_weak): New.
Run undefined_weak and PR ld/19636 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-x86-64/pr13082-3b.d: Updated.
* testsuite/ld-x86-64/pr13082-4b.d: Likewise.

8 years agoFix powerpc64 -r --save-restore-funcs
Alan Modra [Fri, 26 Feb 2016 12:30:33 +0000 (23:00 +1030)]
Fix powerpc64 -r --save-restore-funcs

* elf64-ppc.c (create_linkage_sections): Create sfpr when
save_restore_funcs, rest of sections when not relocatable.
(ppc64_elf_init_stub_bfd): Always call create_linkage_sections.
(sfpr_define): Define all symbols on emitted code.
(ppc64_elf_func_desc_adjust): Adjust for sfpr now being created
when relocatable.  Move sfpr_define loop earlier.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Feb 2016 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agogdbserver/s390: Enable high GPRs, VX, TDB with 31-bit gdbserver.
Marcin Kościelnicki [Fri, 12 Feb 2016 13:39:29 +0000 (14:39 +0100)]
gdbserver/s390: Enable high GPRs, VX, TDB with 31-bit gdbserver.

Currently, 31-bit gdbserver doesn't support collecting/supplying high
GPRs, VX registers, and TDB data.  This is not much of a problem now,
since machines that have them usually have a 64-bit gdbserver that can
be used to debug 31-bit targets just fine.  However, with fast
tracepoints, it's not possible to use a 64-bit gdbserver with a 31-bit
IPA (and thus a 31-bit target), so 31-bit gdbserver has to be used
for 31-bit targets.  Thus, this patch is needed to allow collecting
high GPRs and VX registers on 31-bit targets via fast tracepoints.

gdb/gdbserver/ChangeLog:

* linux-s390-low.c (s390_num_regs_3264): Define on 31-bit too.
(s390_regmap_3264) [!__s390x__]: New global.
(s390_collect_ptrace_register): Skip map entries containing -1.
(s390_supply_ptrace_register): Ditto.
(s390_fill_gprs_high): New function.
(s390_store_gprs_high): New function.
(s390_regsets): Add NT_S390_HIGH_GPRS.
(s390_get_hwcap): Enable on 31-bit.
(have_hwcap_s390_high_gprs): Enable on 31-bit.
(s390_arch_setup): Enable detection of high GPRs, TDB, VX on 31-bit.
Detect NT_S390_HIGH_GPRS.
(s390_usrregs_info_3264): Enable on 31-bit.
(s390_regs_info): Enable regs_info_3264 on 31-bit.
(initialize_low_arch): Initialize s390_regsets_info_3264 on 31-bit.

8 years agoavoid compiler warnings in remote-m32r-sdi.c
Doug Evans [Thu, 25 Feb 2016 17:30:22 +0000 (09:30 -0800)]
avoid compiler warnings in remote-m32r-sdi.c

gdb/ChangeLog:

* remote-m32r-sdi.c (recv_char_data): Initialize val to avoid
compiler warning.
(recv_long_data): Ditto.

8 years agoRemove gdb.base/branches.c
Yao Qi [Thu, 25 Feb 2016 17:00:36 +0000 (17:00 +0000)]
Remove gdb.base/branches.c

This patch removes gdb.base/branches.c which was added by the following
commit, but it is not used at all.

commit ea8122af1432abdeb256b2c669eb3d0cf8cb97bf
Author: John Metzler <jmetzler@cygnus>
Date:   Thu Apr 16 17:56:11 1998 +0000

    Thu Apr 16 10:52:34 1998  John Metzler  <jmetzler@cygnus.com>

        * gdb.base/branches.c: Code with lots of loops and
        subroutines. Used to test gdbs ability to single step through PC
        changes, especially to test mips-tdep.c:mips_next_pc

gdb/testsuite:

2016-02-25  Yao Qi  <yao.qi@linaro.org>

* gdb.base/branches.c: Remove.

8 years ago[PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
Marcin Kościelnicki [Sun, 21 Feb 2016 20:44:48 +0000 (21:44 +0100)]
[PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.

If gdbserver and IPA are using different tdesc, they will disagree
about 'R' trace packet size.  This results in mangled traces.

To make sure they pick the same tdesc, gdbserver pokes the tdesc
(specified as an index in a target-specific list) into a global
variable in IPA.  In theory, IPA could find out the tdesc on its
own, but that may be complex (in particular, I don't know how to
tell whether we have LAST_BREAK on s390 without messing with ptrace),
and we'd have to duplicate the logic.

Tested on i386 and x86_64.  On i386, it fixes two FAILs in ftrace.exp.
On x86_64, these failures have been KFAILed - one of them works now,
but the other now fails due to an unrelated reason (ugh).

gdb/gdbserver/ChangeLog:

PR gdb/13808
* Makefile.in: Add i386-*-linux-ipa.o and amd64-*-linux-ipa.o.
* configure.srv: Ditto.
* linux-aarch64-ipa.c (get_ipa_tdesc): New function.
(initialize_low_tracepoint): Remove ipa_tdesc assignment.
* linux-amd64-ipa.c: Add "linux-x86-tdesc.h" include.
(init_registers_amd64_linux): Remove prototype.
(tdesc_amd64_linux): Remove declaration.
(get_ipa_tdesc): New function.
(initialize_low_tracepoint): Remove ipa_tdesc assignment,
initialize remaining tdescs.
* linux-i386-ipa.c: Add "linux-x86-tdesc.h" include.
(init_registers_i386_linux): Remove prototype.
(tdesc_i386_linux): Remove declaration.
(get_ipa_tdesc): New function.
(initialize_low_tracepoint): Remove ipa_tdesc assignment,
initialize remaining tdescs.
* linux-low.c (linux_get_ipa_tdesc_idx): New function.
(linux_target_ops): wire in linux_get_ipa_tdesc_idx.
* linux-low.h (struct linux_target_ops): Add get_ipa_tdesc_idx.
* linux-x86-low.c: Move tdesc declarations to linux-x86-tdesc.h.
(x86_get_ipa_tdesc_idx): New function.
(the_low_target): Wire in x86_get_ipa_tdesc_idx.
* linux-x86-tdesc.h: New file.
* target.h (struct target_ops): Add get_ipa_tdesc_idx.
(target_get_ipa_tdesc_idx): New macro.
* tracepoint.c (ipa_tdesc_idx): New macro.
(struct ipa_sym_addresses): Add addr_ipa_tdesc_idx.
(symbol_list): Add ipa_tdesc_idx.
(cmd_qtstart): Write ipa_tdesc_idx in the target.
(ipa_tdesc): Remove.
(ipa_tdesc_idx): New variable.
(get_context_regcache): Use get_ipa_tdesc.
(gdb_collect): Ditto.
(gdb_probe): Ditto.
* tracepoint.h (get_ipa_tdesc): New prototype.
(ipa_tdesc): Remove.

gdb/testsuite/ChangeLog:

PR gdb/13808
* gdb.trace/ftrace.exp (test_fast_tracepoints): Remove kfail.

8 years agoConvert more variables to a constant form.
Trevor Saunders [Thu, 25 Feb 2016 16:55:21 +0000 (16:55 +0000)]
Convert more variables to a constant form.

* as.c (select_emulation_mode): Add const qualifiers.
* as.h: Likewise.
* config/bfin-defs.h: Likewise.
* config/bfin-parse.y: Likewise.
* config/rx-parse.y: Likewise.
* config/tc-aarch64.c (struct aarch64_option_table): Likewise.
(struct aarch64_cpu_option_table): Likewise.
(struct aarch64_arch_option_table): Likewise.
(struct aarch64_option_cpu_value_table): Likewise.
(struct aarch64_long_option_table): Likewise.
(struct aarch64_option_abi_value_table): Likewise.
* config/tc-arm.c (struct reloc_entry): Likewise.
(tc_gen_reloc): Likewise.
(struct arm_option_table): Likewise.
(struct arm_legacy_option_table): Likewise.
(struct arm_cpu_option_table): Likewise.
(struct arm_arch_option_table): Likewise.
(struct arm_option_extension_value_table): Likewise.
(struct arm_option_fpu_value_table): Likewise.
(struct arm_option_value_table): Likewise.
(struct arm_long_option_table): Likewise.
* config/tc-avr.c (struct avr_opcodes_s): Likewise.
(struct mcu_type_s): Likewise.
(struct exp_mod_s): Likewise.
(avr_operand): Likewise.
(avr_operands): Likewise.
* config/tc-d10v.c (md_begin): Likewise.
* config/tc-dlx.c: Likewise.
* config/tc-fr30.c (fr30_is_colon_insn): Likewise.
* config/tc-ft32.c (parse_condition): Likewise.
* config/tc-h8300.c (do_a_fix_imm): Likewise.
* config/tc-hppa.c (pa_ip): Likewise.
(hppa_regname_to_dw2regnum): Likewise.
* config/tc-i370.c (i370_elf_suffix): Likewise.
* config/tc-i960.c (struct tabentry): Likewise.
* config/tc-m32r.c: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-m68k.h: Likewise.
* config/tc-mcore.c (parse_psrmod): Likewise.
* config/tc-metag.c (struct metag_core_option): Likewise.
(struct metag_long_option): Likewise.
* config/tc-microblaze.c: Likewise.
* config/tc-mips.c (macro): Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-msp430.c (struct rcodes_s): Likewise.
(struct hcodes_s): Likewise.
(md_parse_option): Likewise.
* config/tc-ns32k.c (struct ns32k_option): Likewise.
(optlist): Likewise.
* config/tc-ppc.c (ppc_elf_suffix): Likewise.
(tc_ppc_regname_to_dw2regnum): Likewise.
* config/tc-ppc.h: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c (struct cpu_type): Likewise.
* config/tc-sh.c (sh_regname_to_dw2regnum): Likewise.
* config/tc-sparc.c (struct priv_reg_entry): Likewise.
(sparc_ip): Likewise.
* config/tc-spu.c (insn_fmt_string): Likewise.
* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
* config/tc-v850.c: Likewise.
* config/tc-visium.c (struct visium_arch_option_table): Likewise.
(struct visium_long_option_table): Likewise.
* config/tc-xgate.c: Likewise.
* config/tc-z8k.c: Likewise.
* read.c (add_include_dir): Likewise.
* read.h: Likewise.

8 years agoInitialize variables in i386_linux_handle_segmentation_fault
Simon Marchi [Thu, 25 Feb 2016 16:03:22 +0000 (11:03 -0500)]
Initialize variables in i386_linux_handle_segmentation_fault

We see this error when building with gcc 4.3.

../../gdb/i386-linux-tdep.c: In function ‘i386_linux_handle_segmentation_fault’:
../../gdb/i386-linux-tdep.c:399: error: ‘access’ may be used uninitialized in this function
../../gdb/i386-linux-tdep.c:399: error: ‘upper_bound’ may be used uninitialized in this function
../../gdb/i386-linux-tdep.c:399: error: ‘lower_bound’ may be used uninitialized in this function

It's a false positive, since the variables will always get initialized
in the TRY clause, and the CATCH returns.

gdb/ChangeLog:

* i386-linux-tdep.c (i386_linux_handle_segmentation_fault):
Initialize variables.

8 years agogdb.trace: Remove unnecessary target check from ftrace.exp.
Marcin Kościelnicki [Fri, 19 Feb 2016 19:33:34 +0000 (20:33 +0100)]
gdb.trace: Remove unnecessary target check from ftrace.exp.

The check used hardcoded targets and wasn't doing anything useful anyway,
since unsupported architectures blow up on link due to missing the IPA
library before they ever get to that check.

gdb/testsuite/ChangeLog:

* gdb.trace/ftrace.exp: Remove unnecessary target check.

8 years agogdb.trace: Surround $call_insn with \y in entry-values.exp
Marcin Kościelnicki [Fri, 19 Feb 2016 19:29:23 +0000 (20:29 +0100)]
gdb.trace: Surround $call_insn with \y in entry-values.exp

The PPC64 tracepoint patch added \y at the end of the call_insn pattern -
without that, it embarassed itself and matched the 'bl' in "Dump of
assem*bl*er code for function" as the powerpc call opcode.  Since that
sounds like a generally good idea, I've added \y before and after
call_insn for every target.  As a result, I had to change x86_64's mnemonic
to 'callq'.

gdb/testsuite/ChangeLog:

* gdb.trace/entry-values.exp: Surround $call_insn with '\y',
change x86_64 call_insn to 'callq'.

8 years agoMap registers to remote numbers when encoding an ax_reg or ax_reg_mask operation
Antoine Tremblay [Wed, 24 Feb 2016 20:00:17 +0000 (15:00 -0500)]
Map registers to remote numbers when encoding an ax_reg or ax_reg_mask operation

When encoding the agent expression operation ax_reg or ax_reg_mask, the
register number used is internal to GDB. However GDBServer expects a tdesc
based number.

This usually does not cause a problem since at the moment, for raw
registers GDBServer R trace action ignores the register mask and just
collects all registers.

It can be a problem, however with pseudo registers on some platforms if the
tdesc number doesn't match the GDB internal register number.

This is the case with ARM, the upcoming ARM tracepoint support, fails
these test cases without this patch:

gdb.trace/collection.exp: collect register locals collectively:*

GDBSever would exit with: unhandled register size
Since the register number is not mapped.

This patch fixes these issues by calling gdbarch_remote_register_number
before encoding the register number in the ax_reg or ax_reg_mask operation.

Tested on x86 native-gdbserver no regressions observed.

gdb/ChangeLog:

* ax-general.c (ax_reg): Call gdbarch_remote_register_number.
(ax_reg_mask): Likewise.

8 years agoAdd elf_x86_64_need_pic
H.J. Lu [Thu, 25 Feb 2016 00:31:29 +0000 (16:31 -0800)]
Add elf_x86_64_need_pic

Add elf_x86_64_need_pic and replace x86_64_elf_howto_table[r_type].name
with howto->name.

* elf64-x86-64.c (elf_x86_64_need_pic): New function.
(elf_x86_64_relocate_section): Use it.  Replace
x86_64_elf_howto_table[r_type] with howto.

8 years agogas: Update tests for big-endian arc targets
Andrew Burgess [Tue, 23 Feb 2016 00:05:27 +0000 (00:05 +0000)]
gas: Update tests for big-endian arc targets

Some gas tests are excluded for arc targets using the pattern arc-*-*,
however this only covers little endian arc targets.  This commit extends
the patter to cover big endian arc targets, the pattern is now arc*-*-*.

gas/ChangeLog:

* testsuite/gas/all/gas.exp: Change target pattern to cover
arceb-*.
* testsuite/gas/all/redef3.d: Likewise.
* testsuite/gas/elf/elf.exp: Likewise.

8 years agoRemove unused field from ld_config_type structure.
Nick Clifton [Thu, 25 Feb 2016 10:33:29 +0000 (10:33 +0000)]
Remove unused field from ld_config_type structure.

* ld.h (struct ld_config_type): Remove specified_data_size field.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Feb 2016 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoUpdate symbol version for symbol from linker script
H.J. Lu [Wed, 24 Feb 2016 23:13:35 +0000 (15:13 -0800)]
Update symbol version for symbol from linker script

We need to update symbol version for symbols from linker script.

bfd/

PR ld/19698
* elflink.c (bfd_elf_record_link_assignment): Set versioned if
symbol version is unknown.

ld/

PR ld/19698
* testsuite/ld-elf/pr19698.d: New file.
* testsuite/ld-elf/pr19698.s: Likewise.
* testsuite/ld-elf/pr19698.t: Likewise.

8 years agoHandle MIPS Linux SIGTRAP siginfo.si_code values
Pedro Alves [Wed, 24 Feb 2016 22:52:06 +0000 (22:52 +0000)]
Handle MIPS Linux SIGTRAP siginfo.si_code values

This unbreaks pending/delayed breakpoints handling, as well as
hardware watchpoints, on MIPS.

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

The MIPS kernel reports SI_KERNEL for all kernel generated traps,
instead of TRAP_BRKPT / TRAP_HWBKPT, but GDB isn't aware of this.

Basically, this commit:

- Folds watchpoints logic into check_stopped_by_breakpoint, and
  renames it to save_stop_reason.

- Adds GDB_ARCH_IS_TRAP_HWBKPT.

- Makes MIPS set both GDB_ARCH_IS_TRAP_BRPT and
  GDB_ARCH_IS_TRAP_HWBKPT to SI_KERNEL.  In save_stop_reason, we
  handle the case of the same si_code returning true for both
  TRAP_BRPT and TRAP_HWBKPT by looking at what the debug registers
  say.

Tested on x86-64 Fedora 20, native and gdbserver.

gdb/ChangeLog:
2016-02-24  Pedro Alves  <palves@redhat.com>

* linux-nat.c (save_sigtrap) Delete.
(stop_wait_callback): Call save_stop_reason instead of
save_sigtrap.
(check_stopped_by_breakpoint): Rename to ...
(save_stop_reason): ... this.  Bits of save_sigtrap folded here.
Use GDB_ARCH_IS_TRAP_HWBKPT and handle ambiguous
GDB_ARCH_IS_TRAP_BRKPT / GDB_ARCH_IS_TRAP_HWBKPT.  Factor out
common code between the USE_SIGTRAP_SIGINFO and
!USE_SIGTRAP_SIGINFO blocks.
(linux_nat_filter_event): Call save_stop_reason instead of
save_sigtrap.
* nat/linux-ptrace.h: Check for both SI_KERNEL and TRAP_BRKPT
si_code for MIPS.
* nat/linux-ptrace.h: Fix "TRAP_HWBPT" typo in x86 table.  Add
comments on MIPS behavior.
(GDB_ARCH_IS_TRAP_HWBKPT): Define for all archs.

gdb/gdbserver/ChangeLog:
2016-02-24  Pedro Alves  <palves@redhat.com>

* linux-low.c (check_stopped_by_breakpoint): Rename to ...
(save_stop_reason): ... this.  Use GDB_ARCH_IS_TRAP_HWBKPT and
handle ambiguous GDB_ARCH_IS_TRAP_BRKPT / GDB_ARCH_IS_TRAP_HWBKPT.
Factor out common code between the USE_SIGTRAP_SIGINFO and
!USE_SIGTRAP_SIGINFO blocks.
(linux_low_filter_event): Call save_stop_reason instead of
check_stopped_by_breakpoint and check_stopped_by_watchpoint.
Update comments.
(linux_wait_1): Update comments.

8 years ago[OBV] gdb/rs6000: Fix maybe-uninitialized warning.
Marcin Kościelnicki [Wed, 24 Feb 2016 21:00:59 +0000 (22:00 +0100)]
[OBV] gdb/rs6000: Fix maybe-uninitialized warning.

Introduced by 657f9cde9d531c9929bef9e02a8064101d568f50.

gdb/ChangeLog:

* rs6000-tdep.c (rs6000_frame_cache): Initialize frame and pc to 0
to avoid spurious warnings.

8 years agoMove tfile-avx.exp to tracefile-pseudo-reg.exp
Antoine Tremblay [Wed, 24 Feb 2016 19:23:47 +0000 (14:23 -0500)]
Move tfile-avx.exp to tracefile-pseudo-reg.exp

As it is planned to add more architectures to this test, rename to a more
generic name.

gdb/testsuite/ChangeLog:

* gdb.trace/tfile-avx.c: Move to...
* gdb.trace/tracefile-pseudo-reg.c: Here.
* gdb.trace/tfile-avx.exp: Move to...
* gdb.trace/tracefile-pseudo-reg.exp: Here.

8 years agoMove new skip features to proper section (post 7.11).
Doug Evans [Wed, 24 Feb 2016 18:19:50 +0000 (10:19 -0800)]
Move new skip features to proper section (post 7.11).

8 years ago[GAS][ARM][3/3]Add armv8.2 fp16 scalar instruction support. Based on SE_H instruction...
Renlin Li [Wed, 24 Feb 2016 17:59:35 +0000 (17:59 +0000)]
[GAS][ARM][3/3]Add armv8.2 fp16 scalar instruction support. Based on SE_H instruction shape.

gas/

2016-02-24  Renlin Li  <renlin.li@arm.com>

* config/tc-arm.c (BAD_FP16): New error message macro.
(do_scalar_fp16_v82_encode): Change the coproc field to 9 for armv8.2
fp16 scalar instructions.
(neon_check_type): Allow different size from key.
(do_vfp_nsyn_add_sub): Add support SE_H shape support.
(try_vfp_nsyn): Likewise.
(do_vfp_nsyn_mla_mls): Likewise.
(do_vfp_nsyn_fma_fms): Likewise.
(do_vfp_nsyn_ldm_stm): Likewise
(do_vfp_nsyn_sqrt): Likewise
(do_vfp_nsyn_div): Likewise
(do_vfp_nsyn_nmul): Likewise.
(do_vfp_nsyn_cmp): Likewise.
(do_neon_shll): Likewise.
(do_vfp_nsyn_cvt_fpv8): Likewise.
(do_neon_cvttb_2): Likewise.
(do_neon_mov): Likewise.
(do_neon_rshift_round_imm): Likewise.
(do_neon_ldr_str): Likewise.
(do_vfp_nsyn_fpv8): Likewise.
(do_vmaxnm): Likewise.
(do_vrint_1): Likewise.
(insns): New entry for vins, vmovx.
(md_apply_fix): Left shift 1 bit for fp16 vldr/vstr.
* testsuite/gas/arm/armv8-2-fp16-scalar-thumb.d: New.
* testsuite/gas/arm/armv8-2-fp16-scalar.d: New.
* testsuite/gas/arm/armv8-2-fp16-scalar.s: New.
* testsuite/gas/arm/armv8-2-fp16-scalar-bad.s: New
* testsuite/gas/arm/armv8-2-fp16-scalar-bad.d: New
* testsuite/gas/arm/armv8-2-fp16-scalar-bad.l: New

8 years agopowerpc: Support z-point type in gdbserver.
Wei-cheng Wang [Sat, 27 Jun 2015 16:21:39 +0000 (00:21 +0800)]
powerpc: Support z-point type in gdbserver.

Support z-point, so tracepoints and breakpoints can be inserted at the same
location.

gdb/gdbserver/ChangeLog:

2016-02-24  Wei-cheng Wang  <cole945@gmail.com>

* linux-ppc-low.c (ppc_supports_z_point_type): New function:
(ppc_insert_point, ppc_remove_point): Insert/remove z-packet breakpoints.
(ppc64_emit_ops_vector): Add target ops - ppc_supports_z_point_type,
ppc_insert_point, ppc_remove_point.

8 years agoRevert "ABS32"
Renlin Li [Wed, 24 Feb 2016 14:51:12 +0000 (14:51 +0000)]
Revert "ABS32"

This reverts commit 30bdf5c82e5734ac9f0b18eb7af631806d419270.

8 years ago[GAS][ARM][2/3]Add SE_H shape to represent fp16 type.
Renlin Li [Wed, 24 Feb 2016 14:18:16 +0000 (14:18 +0000)]
[GAS][ARM][2/3]Add SE_H shape to represent fp16 type.

gas/

2016-02-24  Renlin Li  <renlin.li@arm.com>

* config/tc-arm.c (NEON_ENC_TAB): Add fp16 instruction shape.
(neon_shape_class): New SC_HALF.
(neon_shape_el): New SE_H.
(neon_shape_el_size): New size for SE_H.
(N_F_ALL): New macro to aggregate N_F16, N_F32, N_64.
(neon_select_shape): Add SE_H support code.
(el_type_of_type_chk): Use N_F_ALL.
(do_vfp_nsyn_cvt): Add SE_H shape support.
(do_neon_cvtz): Likewise.
(do_neon_cvt_1): Likewise.
(do_neon_cvttb_1): Likewise.

8 years ago[OPCODES][ARM][1/3]Add armv8.2 fp16 instruction dissembler support.
Renlin Li [Wed, 24 Feb 2016 14:08:39 +0000 (14:08 +0000)]
[OPCODES][ARM][1/3]Add armv8.2 fp16 instruction dissembler support.

opcodes/

2016-02-24  Renlin Li  <renlin.li@arm.com>

* arm-dis.c (coprocessor_opcodes): Add fp16 instruction entries.
(print_insn_coprocessor): Support fp16 instruction.

gas/

2016-02-24  Renlin Li  <renlin.li@arm.com>

* testsuite/gas/arm/copro.d: Adjust output.
* testsuite/gas/arm/copro.s: Adjust co-processor num.

8 years ago[OPCODES][ARM]Fix mask for a few coprocessor opcodes.
Renlin Li [Wed, 24 Feb 2016 13:55:30 +0000 (13:55 +0000)]
[OPCODES][ARM]Fix mask for a few coprocessor opcodes.

opcodes/

2016-02-24  Renlin Li  <renlin.li@arm.com>

* arm-dis.c (coprocessor_opcodes): Fix mask for vsel, vmaxnm, vminnm,
vrint(mpna).

gas/

2016-02-24  Renlin Li  <renlin.li@arm.com>

* testsuite/gas/arm/mask_1.d: New.
* testsuite/gas/arm/mask_1.s: New.

8 years ago[OPCODE][ARM]Correct disassembler for cdp/cdp2, mcr/mcr2, mrc/mrc2, ldc/ldc2, stc...
Renlin Li [Wed, 24 Feb 2016 13:48:59 +0000 (13:48 +0000)]
[OPCODE][ARM]Correct disassembler for cdp/cdp2, mcr/mcr2, mrc/mrc2, ldc/ldc2, stc/stc2

opcodes/

2016-02-24  Renlin Li  <renlin.li@arm.com>

* arm-dis.c (print_insn_coprocessor): Check co-processor number for
cpd/cpd2, mcr/mcr2, mrc/mrc2, ldc/ldc2, stc/stc2.

gas/

2016-02-24  Renlin Li  <renlin.li@arm.com>

* testsuite/gas/arm/copro.s: Use coprocessor other than 10, 11.
* testsuite/gas/arm/copro.d: Update.

8 years agoABS32
Renlin Li [Thu, 18 Feb 2016 16:50:50 +0000 (16:50 +0000)]
ABS32

8 years agoSet plt_got.offset to (bfd_vma) -1
H.J. Lu [Wed, 24 Feb 2016 13:42:27 +0000 (05:42 -0800)]
Set plt_got.offset to (bfd_vma) -1

Since plt_got.offset may be updated in x86 allocate_dynrelocs, set
plt_got.offset to (bfd_vma) -1 when setting needs_plt to 0.

* elf32-i386.c (elf_i386_allocate_dynrelocs): Set plt_got.offset
to (bfd_vma) -1 when setting needs_plt to 0.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.

8 years agoFix logic in exec_file_locate_attach
Gary Benson [Wed, 24 Feb 2016 11:31:58 +0000 (11:31 +0000)]
Fix logic in exec_file_locate_attach

This commit fixes an error in exec_file_locate_attach where
the main executable could be loaded from outside the sysroot
if a nonempty, non-"target:" sysroot was set but the discovered
executable filename did not exist in that sysroot and did exist
on the main filesystem.

gdb/ChangeLog:

* exec.c (exec_file_locate_attach): Do not attempt to
locate main executable locally if not found in sysroot.

gdb/testsuite/ChangeLog:

* gdb.base/attach-pie-noexec.exp: Do not expect an error
message on attach.

8 years ago[ARM][gas] Add support for Cortex-A32
Kyrylo Tkachov [Wed, 24 Feb 2016 10:55:09 +0000 (10:55 +0000)]
[ARM][gas] Add support for Cortex-A32

2016-02-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * config/tc-arm.c (arm_cpus): Add entry for cortex-a32.
    * doc/c-arm.texi (ARM Options): Document cortex-a32.

8 years ago[ARM][doc] Document cortex-a17 mcpu option
Kyrylo Tkachov [Wed, 24 Feb 2016 10:53:55 +0000 (10:53 +0000)]
[ARM][doc] Document cortex-a17 mcpu option

2016-02-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * doc/c-arm.texi (ARM Options): Document cortex-a17.

8 years agoDocument the GDB 7.11 release in gdb/ChangeLog
Joel Brobecker [Wed, 24 Feb 2016 10:07:27 +0000 (11:07 +0100)]
Document the GDB 7.11 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.11 released.

8 years agoBuild unavailable-stack frames for tracepoint.
Wei-cheng Wang [Mon, 30 Mar 2015 16:30:31 +0000 (00:30 +0800)]
Build unavailable-stack frames for tracepoint.

gdb/ChangeLog:

2016-02-24  Wei-cheng Wang  <cole945@gmail.com>

* rs6000-tdep.c (rs6000_frame_cache, rs6000_frame_this_id): Handle
unavailable PC/SP to build unavailable frame.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 24 Feb 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoExtend "skip" command to support -file, -gfile, -function, -rfunction.
Doug Evans [Tue, 23 Feb 2016 21:25:18 +0000 (13:25 -0800)]
Extend "skip" command to support -file, -gfile, -function, -rfunction.

gdb/ChangeLog:

Extend "skip" command to support -file, -gfile, -function, -rfunction.
* NEWS: Document new features.
* skip.c: #include "fnmatch.h", "gdb_regex.h".
(skiplist_entry) <file>: Renamed from filename.
<function>: Renamed from function_name.
<file_is_glob, function_is_regexp>: New members.
<compiled_function_regexp, compiled_function_regexp_is_valid>:
New members.
(make_skip_entry): New function.
(free_skiplist_entry, free_skiplist_entry_cleanup): New functions.
(make_free_skiplist_entry_cleanup): New function.
(skip_file_command): Update.
(skip_function, skip_function_command): Update.
(compile_skip_regexp): New functions.
(skip_command): Add support for new options.
(skip_info): Update.
(skip_file_p, skip_gfile_p): New functions.
(skip_function_p, skip_rfunction_p): New functions.
(function_name_is_marked_for_skip): Update and simplify.
(_initialize_step_skip): Update.
* symtab.c: #include "fnmatch.h".
(compare_glob_filenames_for_search): New function.
* symtab.h (compare_glob_filenames_for_search): Declare.
* utils.c (count_path_elements): New function.
(strip_leading_path_elements): New function.
* utils.h (count_path_elements): Declare.
(strip_leading_path_elements): Declare.

gdb/doc/ChangeLog:

* gdb.texinfo (Skipping Over Functions and Files): Document new
options to "skip" command.  Update docs of output of "info skip".

gdb/testsuite/ChangeLog:

* gdb.base/skip.c (test_skip): New function.
(end_test_skip_file_and_function): New function.
(test_skip_file_and_function): New function.
* gdb.base/skip1.c (test_skip): New function.
(skip1_test_skip_file_and_function): New function.
* gdb.base/skip.exp: Add tests for new skip options.
* gdb.base/skip-solib.exp: Update expected output.
* gdb.perf/skip-command.cc: New file.
* gdb.perf/skip-command.exp: New file.
* gdb.perf/skip-command.py: New file.

8 years agoSkip tests for common directive on hpux
H.J. Lu [Tue, 23 Feb 2016 18:40:03 +0000 (10:40 -0800)]
Skip tests for common directive on hpux

hpux has a non-standard common directive.

* testsuite/gas/elf/elf.exp: Skip tests for common directive on
hpux.

8 years agoarm-tdep.c: Remove unused "to" parameters
Simon Marchi [Tue, 23 Feb 2016 18:21:10 +0000 (13:21 -0500)]
arm-tdep.c: Remove unused "to" parameters

gdb/ChangeLog:

* arm-tdep.c (arm_decode_svc_copro): Remove "to" parameter.
(thumb_process_displaced_insn): Likewise.
(arm_process_displaced_insn): Adjust calls.