Commit Graph

79395 Commits

Author SHA1 Message Date
Cary Coutant fd834e57ff Fix problems with the --dynamic-list option.
PR gold/13577 complains that even though symbols listed in
the --dynamic-list script are exported, they are still bound symbolically
if -Bsymbolic is also used. There are two underlying problems here.
First, -Bsymbolic should be overridden by --dynamic-list, since the
dynamic list provides an explicit list of symbols that are not bound
within the library, and if we go ahead and set DT_SYMBOLIC, then the
dynamic loader will bind it within the library anyway. Second, gold
did not properly identify the symbols listed in the file as preemptible.

PR gold/16530 complains that symbols listed in the --dynamic-list script
can still be garbage collected. I've fixed this by checking the symbols
as they're added to the symbol table. (Unlike the --export-dynamic-symbol
option, we can't iterate over the list, because the --dynamic-list script
can have wildcards in it.)

gold/

2014-02-05  Cary Coutant  <ccoutant@google.com>

	PR gold/13577
	* options.cc (General_options::parse_dynamic_list):
	Set have_dynamic_list_.
	(General_options::General_options): Initialize have_dynamic_list_.
	(General_options::finalize): Turn off -Bsymbolic and
	-Bsymbolic-functions if --dynamic-list provided.
	* options.h (General_options::have_dynamic_list): New function.
	(General_options::have_dynamic_list_): New data member.
	* symtab.h (Symbol::is_preemptible): Handle --dynamic-list
	correctly.

	PR gold/16530
	* symtab.cc (Symbol_table::add_from_relobj): If symbol is named
	in --dynamic-list, mark it.

	* testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
	(dynamic_list_2): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/dynamic_list_2.cc: New file.
	* testsuite/dynamic_list_2.t: New file.
	* testsuite/dynamic_list_lib1.cc: New file.
	* testsuite/dynamic_list_lib2.cc: New file.
	* testsuite/gc_dynamic_list_test.c: New file.
	* testsuite/gc_dynamic_list_test.sh: New file.
	* testsuite/gc_dynamic_list_test.t: New file.
2014-02-05 18:01:47 -08:00
Doug Evans ee1e2d4fb6 Keep current_inferior in sync with event_child.
* linux-low.c (linux_wait_for_event): Improve comment.
	(linux_wait_1): Keep current_inferior in sync with event_child.
2014-02-05 16:08:59 -08:00
Alan Modra 2e200ee302 daily update 2014-02-06 09:31:11 +10:30
Mark Kettenis 12c5175d68 Avoid bison-isms when using yacc.
YYPRINT is a bison-ism so c_print_token() ends up being unused when yacc is
used which makes gcc unhappy.  Make sure we only define YYPRINT and
c_print_token() when bison is used to generate the parser.

gdb/ChangeLog:

        * c-exp.y (YYPRINT, c_print_token): Only define if YYBISON is
        defined.
2014-02-05 13:32:48 +01:00
Yao Qi 8dc5b31971 Use rs->buf after getpkt
Hi,
The following code snippet looks wrong to me

 char *buf = rs->buf;

 getpkt (&rs->buf, &rs->buf_size, 0);
 packet_ok (buf, );

if rs->buf is reallocated in getpkt, buf points to an out of dated
memory.  This patch removes local 'buf' and uses rs->buf.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_pass_signals): Remove local 'buf' and use
	rs->buf.
	(remote_program_signals): Likewise.
2014-02-05 20:25:47 +08:00
Yao Qi de7b289385 Create inferior for ctf target.
This patch creates inferior when GDB opens a ctf trace data, to be
consistent with tfile target.  A test case is added to test for
live target, tfile and ctf target.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	* ctf.c: Include "inferior.h" and "gdbthread.h".
	(CTF_PID): A new macro.
	(ctf_open): Call inferior_appeared and add_thread_silent.
	(ctf_close): Call exit_inferior_silent and set inferior_ptid.
	(ctf_thread_alive): New function.
	(init_ctf_ops): Install ctf_thread_alive to to_thread_alive.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/report.exp (use_collected_data): Test the output
	of "info threads" and "info inferiors".
2014-02-05 19:37:25 +08:00
Yao Qi 66d032ac62 Create inferior for tfile target
When a trace file is loaded in Eclipse, it is expected to see thread
and process (=thread-group-started and =thread-created).  Create an
inferior and add a thread for this purpose.

This patch just reverts my previous patch.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	Revert this patch:

	2013-05-24  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/tfile.exp: Test inferior and thread.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	Revert this patch:

	2013-05-24  Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (TFILE_PID): Remove.
	(tfile_open): Don't add thread and inferior.
	(tfile_close): Don't set 'inferior_ptid'.  Don't call
	exit_inferior_silent.
	(tfile_thread_alive): Remove.
	(init_tfile_ops): Don't set field 'to_thread_alive' of
	tfile_ops.
2014-02-05 19:35:39 +08:00
Alan Modra ba74cf67e6 daily update 2014-02-05 09:30:41 +10:30
Christian Eggers f4ccffad18 Call remote_check_symbols even if only symbol-file (not file) has been given
The Eclipse "C/C++ GDB Hardware Debugging" plugin runs only the
"symbol-file" command.  In this case, remote_check_symbols is not
called and no qSymbol:: packet is sent to the server (OpenOCD in my
case).

gdb/
2014-02-04  Christian Eggers  <ceggers@gmx.de>  (tiny change)

	* remote.c (remote_start_remote): Call remote_check_symbols even
	if only symbol-file (not file) has been given.
2014-02-04 19:42:12 +00:00
Jan Kratochvil 2915c55b41 Fix PowerPC targets minor memory leaks found by Coverity
bfd/
2014-02-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* coff-rs6000.c (xcoff_write_archive_contents_big): Free OFFSETS in
	return paths.  Three times.
	* elf64-ppc.c (ppc64_elf_link_hash_table_create): Free HTAB in all
	return paths.
	(ppc64_elf_tls_optimize): Free TOC_REF in return path.
	(ppc64_elf_edit_toc): Free USED in return path.
2014-02-04 20:17:16 +01:00
Ulrich Weigand 591a12a1d4 PowerPC64 ELFv2 ABI: skip global entry point code
This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.

In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself.   The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.

Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point.  Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.

One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point.  Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...

Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.

Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.

As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.

With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:

 gdb_test "break *hello"

Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.

I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...

In one of those two test cases, use of this construct is really
not appropriate.  I think this was added way back when as a means
to work around prologue skipping problems on some platforms.  These
days that shouldn't really be necessary any more ...

For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine.  To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).

gdb/ChangeLog:

	* gdbarch.sh (skip_entrypoint): New callback.
	* gdbarch.c, gdbarch.h: Regenerate.
	* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
	* infrun.c (fill_in_stop_func): Likewise.
	* ppc-linux-tdep.c: Include "elf/ppc64.h".
	(ppc_elfv2_elf_make_msymbol_special): New function.
	(ppc_elfv2_skip_entrypoint): Likewise.
	(ppc_linux_init_abi): Install them for ELFv2.

gdb/testsuite/ChangeLog:

	* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
	on a function.
	* gdb.base/step-bt.c: Call hello via function pointer to make
	sure its first instruction is executed on powerpc64le-linux.
2014-02-04 18:44:14 +01:00
Ulrich Weigand cc0e89c519 PowerPC64 ELFv2 ABI: structure passing / return
Another significant difference in the ELFv2 ABI is that "homogeneous"
floating-point and vector aggregates, i.e. aggregates the consist
(recursively) only of members of the same floating-point or vector type,
are passed in a series of floating-point / vector registers, as if they
were seperate parameters.  (This is similar to the ARM ABI.)  This
applies to both calls and returns.

In addition when returning any aggregate of up to 16 bytes, ELFv2 now
used general-purpose registers.

This patch adds support for these aspects of the ABI, which is relatively
straightforward after the refactoring patch to ppc-sysv-tdep.c.

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine.
	(ppc64_elfv2_abi_homogeneous_aggregate): Likewise.
	(ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs.
	(ppc64_sysv_abi_return_value): Likewise.  Also, handle small
	structures returned in GPRs.
2014-02-04 18:42:35 +01:00
Ulrich Weigand 52f548e41f PowerPC64 ELFv2 ABI: stack frame layout changes
This implementes another change in ELFv2: the stack frame no longer
contains the reserved double words for linker and compiler use
(which weren't really used for much of anything anyway).  This
affects placement of on-stack parameters in inferior calls.

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct
	offset to the stack parameter list for the ELFv2 ABI.
2014-02-04 18:41:36 +01:00
Ulrich Weigand d4094b6a88 PowerPC64 ELFv2 ABI: no function descriptors
This implements the most significant difference with the ELFv2 ABI:
we no longer use function descriptors.  The patch consists mostly
of switching off code to deal with descriptors :-)

In addition, when calling an inferior function, we no longer need
to provide its TOC in r2.  Instead, ELFv2 code expects to be called
with r12 pointing to the code address itself.

gdb/ChangeLog:

	* ppc-linux-tdep.c (ppc_linux_init_abi): Only call
	set_gdbarch_convert_from_func_ptr_addr and
	set_gdbarch_elf_make_msymbol_special for ELFv1.
	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle
	function descriptors on ELFv1.
	(ppc64_sysv_abi_push_dummy_call): Likewise.  On ELFv2,
	set up r12 at function entry.
2014-02-04 18:40:16 +01:00
Ulrich Weigand cd453cd072 PowerPC64 ELFv2 ABI: base support
This is the first patch of a series to implement support for the
PowerPC ELFv2 ABI.  While powerpc64le-linux will use ELFv2, and
the existing powerpc64-linux code will continue to use ELFv1,
in theory ELFv2 is also defined for big-endian systems (and
ELFv1 was also defined for little-endian systems).

Therefore this patch adds a new tdep->elf_abi variable to decide
which ABI version to use.  This is detected from the ELF header
e_flags value; if this is not present, we default to ELFv2 on
little-endian and ELFv1 otherwise.

This patch does not yet introduce any actual difference in GDB's
handling of the two ABIs.  Those will be added by the remainder
of this patch series.

For an overview of the changes in ELFv2, have a look at the
comments in the patch series that added ELFv2 to GCC, starting at:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html

gdb/ChangeLog:

	* ppc-tdep.h (enum powerpc_elf_abi): New data type.
	(struct gdbarch_tdep): New member elf_abi.

	* rs6000-tdep.c: Include "elf/ppc64.h".
	(rs6000_gdbarch_init): Detect ELF ABI version.
2014-02-04 18:38:56 +01:00
Ulrich Weigand 0ff3e01fdc PowerPC64 little-endian fixes: 128-bit DFP parameters / registers
The powerpc64le-linux ABI specifies that when a 128-bit DFP value is
passed in a pair of floating-point registers, the first register holds
the most-significant part of the value.  This is as opposed to the
usual rule on little-endian systems, where the first register would
hold the least-significant part.

This affects two places in GDB, the read/write routines for the
128-bit DFP pseudo-registers, and the function call / return
sequence.  For the former, current code already distinguishes
between big- and little-endian targets, but gets the latter
wrong.  This is presumably because *GCC* also got it wrong,
and GDB matches the old GCC behavior.  But GCC is now fixed:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02145.html
so GDB needs to be fixed too.  (Old code shouldn't really be
an issue since there is no code "out there" so far that uses
dfp128 on little-endian ...)

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order
	within a register pair holding a DFP 128-bit value on little-endian.
	(ppc64_sysv_abi_return_value_base): Likewise.
	* rs6000-tdep.c (dfp_pseudo_register_read): Likewise.
	(dfp_pseudo_register_write): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.
2014-02-04 18:36:54 +01:00
Ulrich Weigand 5b757e5ddb PowerPC64 little-endian fixes: 32-bit DFP parameters
Passing a 32-bit DFP in register needs to use the least-significant part
of the register.  Like with a previous patch that addressed the same
issue for small structs, this patch makes sure the appropriate offset
is used on little-endian systems.

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct
	offset on little-endian when passing _Decimal32.
	(ppc64_sysv_abi_return_value_base): Likewise for return values.
2014-02-04 18:36:47 +01:00
Ulrich Weigand 084ee54552 PowerPC64 little-endian fixes: VSX tests and pseudo-regs
Many VSX test were failing on powerpc64le-linux, since -as opposed to the
AltiVec tests- there never were little-endian versions of the test patterns.

This patch adds such patterns, along the lines of altivec-regs.exp.

In addition, there is an actual code change required: For those VSX
registers that overlap a floating-point register, the FP register
overlaps the most-significant half of the VSX register both on big-
and little-endian systems.  However, on little-endian systems, that
half is stored at an offset of 8 bytes (not 0).  This works already
for the "real" FP registers, but current code gets it wrong for
the "extended" pseudo FP register GDB generates for the second
half of the VSX register bank.

This patch updates the corresponding pseudo read/write routines
to take the appropriate offset into consideration.

gdb/ChangeLog:

	* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
	of the overlapped FP register within the VSX register on little-
	endian platforms.
	(efpr_pseudo_register_write): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.arch/vsx-regs.exp: Check target endianness.  Provide variants
	of the test patterns for use on little-endian systems.
2014-02-04 18:31:38 +01:00
Ulrich Weigand 6ed14ff339 PowerPC64 little-endian fixes: AltiVec tests
A couple of AltiVec tests fail spuriously on powerpc64le-linux, because
they compare against an incorrect pattern.  Note that those tests already
contain little-endian variants of the patterns, but those seem to have
bit-rotted a bit: when outputting a vector, GDB no longer omits trailing
zero elements (as it used to do in the past).

This patch updates the pattern to the new GDB output behavior.

In addition, the patch updates the endian test to use the new
gdb_test_multiple logic instead of gdb_expect.

gdb/testsuite/ChangeLog:

	* gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
	(decimal_vector): Fix for little-endian.
2014-02-04 18:28:24 +01:00
Ulrich Weigand d63167affc PowerPC64 little-endian fixes: structure passing
When passing a small structure in a GPR, the ABI specifies that it
should be passed in the least-significant bytes of the register
(or stack slot).  On big-endian systems, this means the value
needs to be stored at an offset, which is what current code does.

However, on little-endian systems, the least-significant bytes are
addresses with offset 0.  This patch fixes that.

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
	offset on little-endian when passing small structures.
2014-02-04 18:26:26 +01:00
Ulrich Weigand e765b44c38 Refactor ppc64 function call and return value handling
This patch refactors the ppc64 function call and return value handling code
in ppc-sysv-tdep.c.  The main problem to be addressed by this refactoring
is the code duplication caused by certain aggregate types:

According to the ABI, some types are to be decomposed into component types
for parameter and return value handling.  For example, complex types are
to be passed as if the real and imaginary component were separate arguments.
Similarly, certain OpenCL vector types are passed as if they were multiple
separate arguments of the vector element type.  With the new ELFv2 ABI,
there is another case: "homogeneous aggregates" (e.g. a struct containing
4 floats) are passed in multiple floating point registers as well.

Unfortunately, the current code is not structured to easily model these
ABI properties.  For example, code to pass complex values re-implements
code to pass the underlying (floating-point) type.  This has already
led to some unfortunate code duplication, and with the addition of
ELFv2 ABI support, I would have had to add yet more such duplication.

To avoid that, I've decided to refactor the code in order to re-use
subroutines that handle the "base" types when handling those aggregate
types.  This was not intended to cause any difference on current
(ELFv1) ABI code, but in fact it fixes a bug:

FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)

This was caused by the old code in ppc64_sysv_abi_push_float incorrectly
handling floating-point arguments to vararg routines, which just happens
to work out correctly automatically in the refactored code ...

gdb/ChangeLog:

	* ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment.
	(struct ppc64_sysv_argpos): New data structure.
	(ppc64_sysv_abi_push_float): Remove.
	(ppc64_sysv_abi_push_val): New function.
	(ppc64_sysv_abi_push_integer): Likewise.
	(ppc64_sysv_abi_push_freg): Likewise.
	(ppc64_sysv_abi_push_vreg): Likewise.
	(ppc64_sysv_abi_push_param): Likewise.
	(ppc64_sysv_abi_push_dummy_call): Refactor to use those new routines.
	(ppc64_sysv_abi_return_value_base): New function.
	(ppc64_sysv_abi_return_value): Refactor to use it.
2014-02-04 18:24:42 +01:00
Ulrich Weigand 36c24d9538 Document support for powerpc64le-*-linux* target
gdb/ChangeLog:

	* NEWS: Document new target powerpc64le-*-linux*.
2014-02-04 18:23:08 +01:00
Mark Kettenis 26fd922825 Add support for ELF core files on OpenBSD/sparc64.
gdb/ChangeLog:

        * sparc64obsd-tdep.c (sparc64obsd_gregset): New variable.
        (sparc64obsd_supply_gregset): Handle registers sets used in ELF
        core dumps.
        (sparc64obsd_init_abi): Adjust minimum size of the general purpose
        register set used in ELF core dumps.  Add floating-point register set.
2014-02-04 13:18:15 +01:00
Kevin Buettner c5bb736278 Update mn10300 dwarf register map
This change updates the mn10300 dwarf register map.  It reduces the
failure count when doing simulator testing against the default
multilib from 788 to 99.

gdb/ChangeLog:

	* mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Rewrite
	dwarf2_to_gdb[] table using symbolic constants.  Adjust
	penultimate entry from number representing the PC register
	to symbolic constant representing the MDR register.  Add
	constant for the PC register to the end of the table.
2014-02-03 21:52:59 -07:00
Alan Modra f3657eed66 daily update 2014-02-04 09:30:46 +10:30
Sandra Loosemore 1c2de46353 Nios II large-GOT relocations
2014-02-03  Sandra Loosemore  <sandra@codesourcery.com>

	include/elf/
	* nios2.h (R_NIOS2_GOT_LO, R_NIOS2_GOT_HA): New.
	(R_NIOS2_CALL_LO, R_NIOS2_CALL_HA): New.
	(R_NIOS2_ILLEGAL): Adjust.

	gas/
	* config/tc-nios2.c (md_apply_fix): Test for new relocs.
	(nios2_special_reloc): Add %call_lo, %call_hiadj, %got_lo,
	%got_hiadj relocation operators.  Sort table and add comment
	to explain ordering.
	(nios2_fix_adjustable): Test for new relocs.
	* doc/c-nios2.texi (Nios II Relocations): Document new relocation
	operators.

	bfd/
	* reloc.c (BFD_RELOC_NIOS2_GOT_LO, BFD_RELOC_NIOS2_GOT_HA): New.
	(BFD_RELOC_NIOS2_CALL_LO, BFD_RELOC_NIOS2_CALL_HA): New.
	* libbfd.h: Regenerated.
	* bfd-in2.h: Regenerated.
	* elf32-nios2.c (elf_nios2_howto_table_rel): Add new relocations.
	(nios2_reloc_map): Likewise.
	(GOT_USED, CALL_USED): Renamed from GOT16_USED and CALL16_USED.
	Fixed all references.
	(nios2_elf32_relocate_section): Add new relocations.
	(nios2_elf32_check_relocs): Likewise.
	(nios2_elf32_gc_sweep_hook): Likewise.
2014-02-03 08:42:42 -08:00
Mark Kettenis af09351e0f Fix build on recent versions of OpenBSD.
gdb/ChangeLog:

        * bsd-kvm.c: Include <sys/param.h>
2014-02-03 14:38:59 +01:00
Mark Kettenis 8507e05d53 Fix build on OpenBSD/sparc64.
gdb/ChangeLog:

        * sparc64nbsd-nat.c (sparc64nbsd_supply_fpregset): Fix prototype.
2014-02-03 14:29:28 +01:00
Alan Modra 5446cbdf82 ppc476 icache bug workaround
This implements a work-around for an icache bug on 476 that can cause
execution of stale instructions when control falls through from one
page to the next.  The idea is to prevent such fall-through by
replacing the last instruction on a page with a branch to a patch
area containing the instruction, then branch to the next page.

The patch also fixes a number of bugs in the existing support for long
branch trampolines.

bfd/
	* elf32-ppc.c (struct ppc_elf_link_hash_table): Add params.
	Delete emit_stub_syms, no_tls_get_addr_opt.  Update all uses.
	(ppc_elf_link_params): New function.
	(ppc_elf_create_glink): Align .glink to 64 bytes for ppc476
	workaround.
	(ppc_elf_select_plt_layout): Remove plt_style and emit_stub_syms
	parameters.  Use htab->params instead.
	(ppc_elf_tls_setup): Remove no_tls_get_addr_opt parameter.
	(ppc_elf_size_dynamic_sections): Align __glink_PLTresolve to
	64 bytes for ppc476 workaround.
	(struct ppc_elf_relax_info): New.
	(ppc_elf_relax_section): Exclude linker created sections and
	those too small to hold one instruction.  Don't add another
	branch 	around trampolines on later relax passes.  Don't
	generate trampolines for undefined symbols when !relocatable,
	nor for plugin symbols.  Allocate space for ppc476 workaround
	patch area.  Free fixups on error return path.
	(ppc_elf_relocate_section): Handle ppc476 workaround patching.
	* elf32-ppc.h (struct ppc_elf_params): New.
	(ppc_elf_select_plt_layout, ppc_elf_tls_setup): Update prototype.
	(ppc_elf_link_params): Declare.
	* section.c (SEC_INFO_TYPE_TARGET): Define.
	* bfd-in2.h: Regenerate.
ld/
	* emultempl/ppc32elf.em (no_tls_get_addr_opt, emit_stub_syms)
	plt_style): Delete.  Adjust all refs to instead use..
	(params): ..this.  New variable.
	(ppc_after_open_output): New function.  Tweak params and pass to
	ppc_elf_link_params.
	(ppc_after_open): Adjust ppc_elf_select_plt_layout call.
	(ppc_before_allocation): Adjust ppc_elf_tls_setup call.  Enable
	relaxation for ppc476 workaround.
	(PARSE_AND_LIST_*): Add --{no-,}ppc476-workaround support.
	(LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Define.
2014-02-03 20:24:20 +10:30
Alan Modra 8effdc96dc daily update 2014-02-03 09:30:43 +10:30
Sandra Loosemore 82e9153868 Correct Nios II GOT pointer initialization.
2014-02-02  Sandra Loosemore  <sandra@codesourcery.com>

	bfd/
	* elf32-nios2.c (struct elf32_nios2_link_hash_table): Add
	h_gp_got field.
	(nios2_elf32_relocate_section): Use got_base to adjust
	GOT-pointer-relative relocations relative to _gp_got.
	(create_got_section): Create _gp_got symbol.
	(nios2_elf32_finish_dynamic_symbol): Make _gp_got absolute.
	(nios2_elf32_size_dynamic_sections): Set _gp_got offset.
2014-02-02 10:57:52 -08:00
Sebastian Huber 13075d049d Fix ALIGN_WITH_INPUT
ld/

2014-02-02  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* ld/ld.texinfo: Change ALIGN_WITH_INPUT documentation.
	* ld/ldlang.c (lang_size_sections_1): Add dotdelta
	variable which reflects the VMA change due to alignment
	requirements.  Use dotdelta do change the LMA if
	ALIGN_WITH_INPUT is requested.

ld/testsuite/ChangeLog

2014-02-02  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* ld-scripts/rgn-at9.d: New file.
	* ld-scripts/rgn-at9.t: Likewise.
	* ld-scripts/rgn-at10.d: Likewise.
	* ld-scripts/rgn-at10.s: Likewise.
	* ld-scripts/rgn-at10.t: Likewise.
	* ld-scripts/rgn-at11.d: Likewise.
	* ld-scripts/rgn-at11.t: Likewise.
2014-02-02 06:39:39 -08:00
Alan Modra 665febb3c8 daily update 2014-02-02 09:30:42 +10:30
Hans-Peter Nilsson 0a09fb4a09 Fix MMIX build breakage from bfd_set_section_vma change.
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): Fix typo in
	call to bfd_set_section_vma exposed by recent bfd_set_section_vma
	change.
2014-02-01 01:11:28 +01:00
Alan Modra 00eea2b9e0 daily update 2014-02-01 09:30:51 +10:30
Michael Zolotukhin 83861ea6d6 Add gather/scatter tests with incorrect memory operand
2014-01-31  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

	PR gas/16488
	* gas/i386/inval-avx512f.s: Add test for incorrect memory operand
	for gather/scatter instructions.
	* gas/i386/x86-64-inval-avx512f.s: Likewise.
	* gas/i386/inval-avx512f.l: Adjust correspondingly.
	* gas/i386/x86-64-inval-avx512f.l: Likewise.
2014-01-31 08:13:06 -08:00
Joel Brobecker ae56bfb8e7 Delete ada-lang.h::clear_ada_sym_cache (nonexistant function).
I happen to notice this extern function declaration in ada-lang.h
which does not actually exist...

gdb/ChangeLog:

        * ada-lang.h (clear_ada_sym_cache): Delete.
2014-01-31 15:32:00 +04:00
Sandra Loosemore 78058a5e4f Nios II CALL26 linker relaxation
2014-01-30  Sandra Loosemore  <sandra@codesourcery.com>

	bfd/
	* bfd-in2.h: Update from reloc.c.
	* elf32-nios2.c: Include elf32-nios2.h.
	(elf_nios2_howto_table_rel): Add entry for R_NIOS2_CALL26_NOAT.
	(nios2_reloc_map): Likewise.
	(enum elf32_nios2_stub_type): Declare.
	(struct elf32_nios2_stub_hash_entry): Declare.
	(nios2_stub_hash_entry, nios2_stub_hash_lookup): New macros.
	(struct elf32_nios2_link_hash_entry): Add hsh_cache field.
	(struct elf32_nios2_link_hash_table): Add new fields bstab,
	stub_bfd, add_stub_section, layout_sections_again, stub_group,
	bfd_count, top_index, input_list, all_local_syms.
	(nios2_call26_stub_entry): New.
	(nios2_elf32_install_imm16): Move up in file.
	(nios2_elf32_install_data): Move up in file.
	(hiadj): Move up in file.
	(stub_hash_newfunc): New.
	(link_hash_newfunc): Initialize hsh_cache field.
	(STUB_SUFFIX): New.
	(nios2_stub_name): New.
	(nios2_get_stub_entry): New.
	(nios2_add_stub): New.
	(nios2_elf32_setup_section_lists): New.
	(nios2_elf32_next_input_section): New.
	(CALL26_SEGMENT): New.
	(MAX_STUB_SECTION_SIZE): New.
	(group_sections): New.
	(nios2_type_of_stub): New.
	(nios2_build_one_stub): New.
	(nios2_size_one_stub): New.
	(get_local_syms): New.
	(nios2_elf32_size_stubs): New.
	(nios2_elf32_build_stubs): New.
	(nios2_elf32_do_call26_relocate): Correct CALL26 overflow test.
	(nios2_elf32_relocate_section): Handle R_NIOS2_CALL26_NOAT.  Add
	trampolines for R_NIOS2_CALL26 stubs.
	(nios2_elf32_check_relocs): Handle R_NIOS2_CALL26_NOAT.
	(nios2_elf32_gc_sweep_hook): Likewise.
	(nios2_elf32_link_hash_table_create): Initialize the stub hash table.
	(nios2_elf32_link_hash_table_free): New.
	(bfd_elf32_bfd_link_hash_table_free): Define.
	* elf32-nios2.h: New file.
	* libbfd.h: Update from reloc.c.
	* reloc.c (BFD_RELOC_NIOS2_CALL26_NOAT): New.

	gas/
	* config/tc-nios2.c (md_apply_fix): Handle BFD_RELOC_NIOS2_CALL26_NOAT.
	(nios2_assemble_args_m): Likewise.
	(md_assemble): Likewise.

	gas/testsuite/
	* gas/nios2/call26_noat.d: New.
	* gas/nios2/call26_noat.s: New.
	* gas/nios2/call_noat.d: New.
	* gas/nios2/call_noat.s: New.

	include/elf/
	* nios2.h (elf_nios2_reloc_type): Add R_NIOS2_CALL26_NOAT.

	ld/
	* Makefile.am (enios2elf.c, enios2linux.c): Update dependencies.
	* Makefile.in: Regenerated.
	* emulparams/nios2elf.sh (EXTRA_EM_FILE): Set.
	* emulparams/nios2linux.sh (EXTRA_EM_FILE): Set.
	* emultempl/nios2elf.em: New file.
	* gen-doc.texi (NIOSII): Set.
	* ld.texinfo (NIOSII): Set.

	ld/testsuite/
	* ld-nios2/relax_call26.s: New.
	* ld-nios2/relax_call26_boundary.ld: New.
	* ld-nios2/relax_call26_boundary.s: New.
	* ld-nios2/relax_call26_boundary_c8.d: New.
	* ld-nios2/relax_call26_boundary_cc.d: New.
	* ld-nios2/relax_call26_boundary_d0.d: New.
	* ld-nios2/relax_call26_boundary_d4.d: New.
	* ld-nios2/relax_call26_boundary_d8.d: New.
	* ld-nios2/relax_call26_boundary_dc.d: New.
	* ld-nios2/relax_call26_boundary_f0.d: New.
	* ld-nios2/relax_call26_boundary_f4.d: New.
	* ld-nios2/relax_call26_boundary_f8.d: New.
	* ld-nios2/relax_call26_boundary_fc.d: New.
	* ld-nios2/relax_call26_cache.d: New.
	* ld-nios2/relax_call26_cache.ld: New.
	* ld-nios2/relax_call26_cache.s: New.
	* ld-nios2/relax_call26_multi.d: New.
	* ld-nios2/relax_call26_multi.ld: New.
	* ld-nios2/relax_call26_norelax.d: New.
	* ld-nios2/relax_call26_shared.d: New.
	* ld-nios2/relax_call26_shared.ld: New.
2014-01-30 17:47:07 -08:00
Alan Modra 1b4f7b4d1e daily update 2014-01-31 09:30:43 +10:30
Ulrich Weigand 718ee4dc9b Add support for AT_HWCAP2 auxv entry
Recent ppc64 Linux kernels provide a new auxv entry AT_HWCAP2,
which is currently not recognized by GDB, causing every use of
"info auxv" to show an error.

This commit adds the AT_HWCAP2 define to include/elf/common.h
and handles it in GDB.

include/elf/ChangeLog:

	* common.h (AT_HWCAP2): Define.

gdb/ChangeLog:

	* auxv.c (fprint_target_auxv): Handle AT_HWCAP2.
2014-01-30 19:12:35 +01:00
Michael Zolotukhin eaa9d1ad0e Fix shift for AVX512F gather/scatter instructions
opcodes/

2014-01-30  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
	    Jan Beulich  <jbeulich@suse.com>

	PR binutils/16490
	* i386-dis.c (OP_E_memory): Fix shift computation for
	vex_vsib_q_w_dq_mode.

gas/testsuite/

2014-01-30  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
	    Jan Beulich  <jbeulich@suse.com>

	PR binutils/16490
	* gas/i386/avx512f.d: Fix test output.
	* gas/i386/avx512f-intel.d: Likewise.
	* gas/i386/x86-64-avx512f.d: Likewise.
	* gas/i386/x86-64-avx512f-intel.d: Likewise.
2014-01-30 07:38:09 -08:00
Alan Modra 2c39fc0d9c daily update 2014-01-30 09:30:42 +10:30
H.J. Lu 50a53d3ffe Add rdynamic-1 test
It is added for

commit 409ff343a4
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Nov 8 13:49:11 2011 +0000

      * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark syms in
      executables when export_dynamic.

	* ld-elf/rdynamic-1.c: New file.
	* ld-elf/rdynamic-1.rd: Likewise.

	* ld-elf/shared.exp (build_tests): Add rdynamic-1.
2014-01-29 14:30:41 -08:00
Jose E. Marchesi 401e27fd71 This changeset makes sparc64_linux_step_trap to return 0 when a
breakpoint is set in a `ta 0x6d´ which is not a sigreturn syscall.  In
these cases no rt_frame exists in the stack and thus the read PC is
wrong.

ChangeLog
2014-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* sparc64-linux-tdep.c (sparc64_linux_step_trap): Get PC from
          the sigreturn register save area only if the syscall is
          sigreturn.

testsuite/ChangeLog
2014-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* gdb.arch/sparc-sysstep.exp: New file.
	* gdb.arch/sparc-sysstep.c: Likewise.

	* gdb.arch/Makefile.in (EXECUTABLES): Add sparc-sysstep.
2014-01-29 07:15:05 -08:00
Nick Clifton df3ce959f4 My patch to the binutils strip-10.d test was wrong. The osabi field should always be set to
ELFOSABI_GNU for binaries containing unique symbols.  So I am reverting that patch and
instead applying the patch below to fix up the targets that were triggering the test failure.

bfd/ChangeLog
2014-01-29  Nick Clifton  <nickc@redhat.com>

	* elf32-metag.c (elf_metag_post_process_headers): Call
	_bfd_elf_post_process_headers.
	* elf32-sh64.c (sh64_elf_copy_private_data): Call
	_bfd_elf_copy_private_data.
	* elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise.

binutils/testsuite/ChangeLog
2014-01-29  Nick Clifton  <nickc@redhat.com>

	* binutils-all/strip-10.d: Revert previous delta.
2014-01-29 14:01:54 +00:00
Nick Clifton 27b829ee70 Following up on Tom's suggestion I am checking in a patch to replace the various
bfd_xxx_set macros with static inline functions, so that we can avoid compile time
warnings about comma expressions with unused values.

	* bfd-in.h (bfd_set_section_vma): Delete.
	(bfd_set_section_alignment): Delete.
	(bfd_set_section_userdata): Delete.
	(bfd_set_cacheable): Delete.
	* bfd.c (bfd_set_cacheable): New static inline function.
	* section.c (bfd_set_section_userdata): Likewise.
	(bfd_set_section_vma): Likewise.
	(bfd_set_section_alignment): Likewise.
	* bfd-in2.h: Regenerate.
2014-01-29 13:46:39 +00:00
Joel Brobecker a7c88acd1e Minor reformatting in valops.c::value_slice
I noticed that a small lexical block was over indented by 2 characters.
So this patch starts by reducing the indentation.

While looking at this area of the code, I also noticed a couple of lines
that had trailing spaces, so this patch also removes them.

And finally, it fixes one tiny to put the assignment operator at
the start of the next line, rather than at the end of the first line.

gdb/ChangeLog:

        * valops.c (value_slice): Minor reformatting.
2014-01-29 14:41:04 +04:00
Cary Coutant ec673e648c Add .gdb_index version 7 support.
This patch adds support for .gdb_index version 7, which adds several
flag bits to the symbol index.  It also fixes a problem where it did
not handle compressed debug sections correctly.

Tested with a google/gcc-4_8 branch compiler, which supports
the -ggnu-pubnames option to generate .debug_gnu_pubnames/pubtypes
tables. (We will submit that patch to GCC when stage 1 reopens.)

2014-01-28  Cary Coutant  <ccoutant@google.com>

	* gold/dwarf_reader.cc: include <utility> (for make_pair).
	(Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
	debug sections.
	(Dwarf_ranges_table::read_ranges_table): Likewise.
	(Dwarf_pubnames_table::read_section): Check for GNU-style
	sections, and for compressed debug sections.
	(Dwarf_pubnames_table::read_header): Compute end address of table.
	(Dwarf_pubnames_table::next_name): Return flag_byte.  Check
	for end of list by offset, not by offset == 0.
	(Dwarf_info_reader::do_read_string_table): Check for compressed
	debug sections.
	* gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
	Initialize new data members.
	(Dwarf_pubnames_table::next_name): return flag_byte.
	(Dwarf_pubnames_table::end_of_table_): New data member.
	(Dwarf_pubnames_table::is_gnu_style_): New data member.
	* gold/gdb-index.cc (gdb_index_version): Update to version 7.
	(Gdb_index_info_reader::read_pubtable): Read flag_byte.
	(Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
	read skeleton type unit DIEs.
	(Gdb_index::add_symbol): Add flag_byte; adjust all callers.
	(Gdb_index::do_write): Write flag_byte.
	* gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
	(Gdb_index::Cu_vector): Store flags along with cu indexes.
	* gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
	* gold/testsuite/gdb_index_test_comm.sh: Likewise.
2014-01-28 15:36:00 -08:00
Edjunior Barbosa Machado 8b92472967 Fix info-shared.exp testcase to expect the leading `.' found on ppc64's symbols.
gdb/testsuite/
2014-01-28  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* gdb.base/info-shared.exp: Expect leading `.' on ppc64's symbols.
2014-01-28 15:31:23 -02:00
Ulrich Weigand fa0079ea72 Fix typo in ppc64_standard_linkage7
The ppc64_standard_linkage7 pattern added by Alan's recent patch:
https://sourceware.org/ml/gdb-patches/2013-11/msg00274.html
contains a typo: the ELFv2 TOC slot offset is 24, not 40.
This was correct in the comment, but not the actual code.

ChangeLog:

	* ppc64-tdep.c (ppc64_standard_linkage7): Fix typo.
2014-01-28 17:49:13 +01:00