external/binutils.git
8 years agoFix argument passing for call
Denis Chertykov [Sat, 5 Mar 2016 12:17:15 +0000 (15:17 +0300)]
Fix argument passing for call

When calling function with argument of size more than 8 bytes fails with
an error "That operation is not available on integers of more than 8 bytes.".
avr-gdb considers only 8 bytes (sizeof(long long)) in case of passing the
argument in registers. When the argument is of size more than 8 byte
then the utility function to extract bytes failed with the above error.

    gdb/
* avr-tdep.c (AVR_LAST_ARG_REGNUM): Define.
        (avr_push_dummy_call): Correct last needed argument register.
        Write MSB of argument into register and subsequent bytes into
        other registers in decreasing order.

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

8 years agoFix datestamps on ChangeLog entries to read 2015 instead of 2016.
Cary Coutant [Fri, 4 Mar 2016 22:17:39 +0000 (14:17 -0800)]
Fix datestamps on ChangeLog entries to read 2015 instead of 2016.

8 years agoAdd missing ChangeLog entries for commit 82838
H.J. Lu [Fri, 4 Mar 2016 16:28:12 +0000 (08:28 -0800)]
Add missing ChangeLog entries for commit 82838

Fix gold/testsuite/plugin_layout_with_alignment.sh permission.

8 years agoFix undefined symbol errors introduced with previous commit.
Cary Coutant [Fri, 4 Mar 2016 16:10:57 +0000 (08:10 -0800)]
Fix undefined symbol errors introduced with previous commit.

gold/
PR gold/19019
PR gold/19763
* symtab.cc: Instantiate Sized_symbol::init_constant and
Sized_symbol::init_undefined.

8 years agoARM process record: VMOV
Yao Qi [Fri, 4 Mar 2016 16:02:15 +0000 (16:02 +0000)]
ARM process record: VMOV

ARM process record gets the wrong register number for VMOV (from core
register to single-precision register).  That is, we should record
the D register rather than the S pseudo register.  The patch also
removes the condition "bit (arm_insn_r->arm_insn, 20)" check, which
has been checked above.

It fixes the following internal error,

(gdb) PASS: gdb.reverse/finish-precsave.exp: BP at end of main
continue^M
Continuing.^M
../../binutils-gdb/gdb/regcache.c:649: internal-error: regcache_raw_read: Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed.^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-03-04  Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c (arm_record_vdata_transfer_insn): Simplify the
condition check.  Record the right D register number.

8 years agoTweak ARM process record
Yao Qi [Fri, 4 Mar 2016 15:57:55 +0000 (15:57 +0000)]
Tweak ARM process record

This patch removes the printing "Process record does not support",
and do the print by calling arm_record_unsupported_insn in the
caller.  Also, call arm_record_extension_space only when condition
is 0xf.

gdb:

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

* arm-tdep.c (arm_record_extension_space): Remove code
printing "Process record does not support".
(arm_record_data_proc_misc_ld_str): Likewise.
(decode_insn): Call arm_record_extension_space if condition
is 0xf.  Call arm_record_unsupported_insn if ret isn't
ARM_RECORD_SUCCESS.  Use 'ret' instead of 'insn_id' to hold
the value of thumb2_record_decode_insn_handler.

8 years agofeature_to_c.sh: Print help when passing no arguments
Simon Marchi [Fri, 4 Mar 2016 15:03:06 +0000 (10:03 -0500)]
feature_to_c.sh: Print help when passing no arguments

I found that odd that passing no arguments to feature_to_c.sh produces
this:

$ ./feature_to_c.sh
./feature_to_c.sh: 23: shift: can't shift that many

but passing one argument shows the help:

$ ./feature_to_c.sh hello
Usage: ./feature_to_c.sh OUTPUTFILE INPUTFILE...

This patch changes the script to show the help in both cases.

gdb/ChangeLog:

* features/feature_to_c.sh: Print the help when passing no
argument.

8 years agoFix a ChangeLog entry
H.J. Lu [Fri, 4 Mar 2016 14:48:01 +0000 (06:48 -0800)]
Fix a ChangeLog entry

8 years agoTreat common symbol in executable as definition
H.J. Lu [Fri, 4 Mar 2016 14:37:34 +0000 (06:37 -0800)]
Treat common symbol in executable as definition

Common symbol in executable is a definition, which overrides definition
from shared objects.  When linker sees a new definition from a shared
object, the new dynamic definition should be overridden by the previous
common symbol in executable.

bfd/

PR ld/19579
* elflink.c (_bfd_elf_merge_symbol): Treat common symbol in
executable as definition if the new definition comes from a
shared library.

ld/

PR ld/19579
* testsuite/ld-elf/pr19579a.c: New file.
* testsuite/ld-elf/pr19579b.c: Likewise.
* testsuite/ld-elf/shared.exp: Run PR ld/19579 test.

8 years ago[ARM] Build attributes for ARMv8.1-A AdvSIMD
Matthew Wahab [Fri, 4 Mar 2016 14:16:48 +0000 (14:16 +0000)]
[ARM] Build attributes for ARMv8.1-A AdvSIMD

binutils/
2016-03-04  Matthew Wahab  <matthew.wahab@arm.com>

* readelf.c (arm_attry_tag_FP_arch): Add "NEON for ARMv8.1".

gas/
2016-03-04  Matthew Wahab  <matthew.wahab@arm.com>

* config/tc-arm.c (aeabi_set_public_attributes): Emit attribute
for ARMv8.1 AdvSIMD use.
* testsuite/gas/arm/attr-march-armv8-a+rdma.d: New.
* testsuite/gas/arm/attr-march-armv8_1-a+simd.d: New.

Change-Id: I3c356e0681b97df2f9c0dabd7c0fd1b441cc2755

8 years ago[ARM] Add feature check for ARMv8.1 AdvSIMD instructions.
Matthew Wahab [Fri, 4 Mar 2016 11:28:28 +0000 (11:28 +0000)]
[ARM] Add feature check for ARMv8.1 AdvSIMD instructions.

gas/
2016-03-04  Matthew Wahab  <matthew.wahab@arm.com>

* config/gas/tc-arm.c (fpu_neon_ext_v8_1): Restrict to the ARMv8.1 RDMA
feature.
(record_feature_use): New.
(mark_feature_used): Use record_feature_use.
(do_neon_qrdmlah): New.
(insns): Use do_neon_qrdmlah for vqrdmlah and vqrdmlsh and
variants.
(arm_extensions): Put into alphabetical order.  Re-indent "simd"
and "rdma" entries.  Fix the incorrect merge value for "+rdma".
* testsuite/gas/arm/armv8-a+rdma-warning.d: New.
* testsuite/gas/arm/armv8-a+rdma.d: Add assembler command line options.
Make source file explicit.
* testsuite/gas/arm/armv8-a+rdma.l: New.
* testsuite/gas/arm/armv8-a+rdma.s: Remove .arch and .arch_extension
directives.  Fix white-space.
* testsuite/gas/arm/armv8_1-a+simd.d: New.

include/opcode
2016-03-04  Matthew Wahab  <matthew.wahab@arm.com>

* arm.h (ARM_ARCH_V8_1A): Add FPU_NEON_EXT_RDMA.
(ARM_CPU_HAS_FEATURE): Add comment.

Change-Id: Ie19250e8fa50aed44e44ab40ff30b04b38bc1a3d

8 years agoAdd support for STT_SPARC_REGISTER symbols.
Cary Coutant [Fri, 5 Feb 2016 00:55:39 +0000 (16:55 -0800)]
Add support for STT_SPARC_REGISTER symbols.

gold/
PR gold/19019
* layout.h (Layout::add_target_specific_dynamic_tag): New function.
* layout.cc (Layout::add_target_specific_dynamic_tag): New function.
* mips.cc (Target_mips::make_symbol): Adjust function signature.
* sparc.cc (Target_sparc::Target_sparc): Initialize register_syms_.
(Target_sparc::do_is_defined_by_abi): Remove test for
STT_SPARC_REGISTER.
(Target_sparc::Register_symbol): New struct type.
(Target_sparc::register_syms_): New data member.
(Target_sparc<64, true>::sparc_info): Set has_make_symbol to true.
(Target_sparc::make_symbol): New function.
(Target_sparc::do_finalize_sections): Add register symbols and new
dynamic table entries.
* symtab.h (Sized_symbol::init_undefined): Add value parameter.
(Symbol_table::add_target_global_symbol): New function.
(Symbol_table::target_symbols_): New data member.
* symtab.cc (Sized_symbol::init_undefined): Add value parameter.
(Symbol_table::Symbol_table): Initialize target_symbols_.
(Symbol_table::add_from_object): Pass additional parameters to
Target::make_symbol.
(Symbol_table::define_special_symbol): Likewise.
(Symbol_table::add_undefined_symbol_from_command_line): Pass 0 for
undefined symbol value.
(Symbol_table::set_dynsym_indexes): Process target-specific symbols.
(Symbol_table::sized_finalize): Likewise.
(Symbol_table::sized_write_globals): Likewise.
* target.h (Sized_target::make_symbol): Add name, st_type, object,
st_shndx, and value parameters.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 4 Mar 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoDon't handle every plugin symbol as defined.
Rafael Ávila de Espíndola [Thu, 3 Mar 2016 19:42:21 +0000 (14:42 -0500)]
Don't handle every plugin symbol as defined.

Gold was fetching --start-lib/--end-lib members if that member defined
or used a currently undefined symbol.

8 years agoAdd new plugin hooks to support querying section alignment and size.
Cary Coutant [Thu, 3 Mar 2016 20:09:06 +0000 (12:09 -0800)]
Add new plugin hooks to support querying section alignment and size.

include/
2016-03-03  Than McIntosh <thanm@google.com>

* plugin-api.h: Add new hooks to the plugin transfer vector to
to support querying section alignment and section size.
(ld_plugin_get_input_section_alignment): New hook.
(ld_plugin_get_input_section_size): New hook.
(ld_plugin_tag): Add LDPT_GET_INPUT_SECTION_ALIGNMENT
and LDPT_GET_INPUT_SECTION_SIZE.
(ld_plugin_tv): Add tv_get_input_section_alignment and
tv_get_input_section_size.

gold/
2016-03-03  Than McIntosh  <thanm@google.com>

* plugin.cc (Plugin::load): Include hooks for get_input_section_size
and get_input_section_alignment in transfer vector.
(get_input_section_alignment): New function.
(get_input_section_size): New function.
* testsuite/Makefile.am: Add plugin_layout_with_alignment.sh test.
* testsuite/Makefile.in: [Regenerate.]
* testsuite/plugin_section_alignment.cc: New test file.
* testsuite/plugin_layout_with_alignment.cc: New test file.
* testsuite/plugin_layout_with_alignment.sh: New test file.

8 years agoget_symbols() plugin API tweak to support --start-lib/--end-lib.
Evgenii Stepanov [Thu, 3 Mar 2016 19:36:36 +0000 (11:36 -0800)]
get_symbols() plugin API tweak to support --start-lib/--end-lib.

Let the plugin know that a file is not being included in the link by
returning LDPS_NO_SYMS from get_symbols().

include/
* plugin-api.h (enum ld_plugin_tag): Add LDPT_GET_SYMBOLS_V3.

gold/
* plugin.h (Pluginobj::get_symbol_resolution_info): Add version
parameter.
* plugin.cc (get_symbols_v3): New function.
(Plugin::load): Add LDPT_GET_SYMBOLS_V3.
(Pluginobj::get_symbol_resolution_info): Return LDPS_NO_SYMS when using
new version.

8 years agogdb.base/skip.exp: Use with_test_prefix.
Doug Evans [Thu, 3 Mar 2016 18:49:28 +0000 (10:49 -0800)]
gdb.base/skip.exp: Use with_test_prefix.

gdb/testsuite/ChangeLog:

* gdb.base/skip.exp: Use with_test_prefix.

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).