Commit Graph

82019 Commits

Author SHA1 Message Date
Jan Kratochvil 413b59aecb Fix add-auto-load-safe-path typo.
gdb/doc/ChangeLog
2014-11-30  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.texinfo (Auto-loading safe path): Fix add-auto-load-safe-path
	description typo.
2014-11-30 20:22:24 +01:00
Martin Galvan f0d4ba1fc4 frame.c: Fix the check for FID_STACK_INVALID in frame_id_eq()
I noticed in frame_id_eq() we were checking for the "l" frame_id being
invalid twice instead of checking both "l" and "r", so this patch
corrects it.

gdb/ChangeLog:

	* frame.c (frame_id_eq): Fix the check for FID_STACK_INVALID.
2014-11-30 19:37:31 +04:00
Alan Modra db76a70026 Power4 should treat mftb as extended mfspr mnemonic
On further reading of ISA manual it appears gas should have been
treating mftb and mftbu as extended mnemonics for mfspr, for ISA 2.03
and later.

opcodes/
	* ppc-opc.c (powerpc_opcodes): Make mftb* generate mfspr for
	power4 and later.
gas/testsuite/
	* gas/ppc/a2.d: Update for mftb change.
	* gas/ppc/476.d: Likewise.
2014-11-30 13:29:24 +10:30
Alan Modra 7b20f09964 Don't output symbol version definitions for non-DT_NEEDED libs
PR 16452, 16457
	* elflink.c (_bfd_elf_link_find_version_dependencies): Exclude
	symbols from libraries that won't be listed in DT_NEEDED.
	(elf_link_output_extsym): Don't output verdefs for such symbols.
2014-11-30 12:11:03 +10:30
GDB Administrator b6a8f012d1 Automatic date update in version.in 2014-11-30 00:00:11 +00:00
Siva Chandra 18ac6ffc9b Check that thread stack temps are not already enabled before enabling them.
This fixes a regression introduced by 6c659fc2c7.

gdb/ChangeLog:

	* eval.c (evaluate_subexp): Check that thread stack temporaries
	are not already enabled before enabling them.
2014-11-29 15:47:39 -08:00
Yao Qi 4072f9208f [arm] compute framereg and framesize when needed
I find local variables framereg and framesize is only used when cache
isn't NULL.  This patch to move the code into "if (cache)" block.

gdb:

2014-11-29  Yao Qi  <yao@codesourcery.com>

	* arm-tdep.c (arm_analyze_prologue): Move local variables
	'framereg' and 'framesize' to inner block.  Move code to
	inner block too.
2014-11-29 22:26:35 +08:00
Siva Chandra 6c659fc2c7 Enable chained function calls in C++ expressions.
gdb/ChangeLog:

	* eval.c: Include gdbthread.h.
	(evaluate_subexp): Enable thread stack temporaries before
	evaluating a complete expression and clean them up after the
	evaluation is complete.
	* gdbthread.h: Include common/vec.h.
	(value_ptr): New typedef.
	(VEC (value_ptr)): New vector type.
	(value_vec): New typedef.
	(struct thread_info): Add new fields stack_temporaries_enabled
	and stack_temporaries.
	(enable_thread_stack_temporaries)
	(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
	(get_last_thread_stack_temporary)
	(value_in_thread_stack_temporaries): Declare.
	* gdbtypes.c (class_or_union_p): New function.
	* gdbtypes.h (class_or_union_p): Declare.
	* infcall.c (call_function_by_hand): Store return values of class
	type as	temporaries on stack.
	* thread.c (enable_thread_stack_temporaries): New function.
	(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
	(get_last_thread_stack_temporary): Likewise.
	(value_in_thread_stack_temporaries): Likewise.
	* value.c (value_force_lval): New function.
	* value.h (value_force_lval): Declare.

gdb/testsuite/ChangeLog:

	* gdb.cp/chained-calls.cc: New file.
	* gdb.cp/chained-calls.exp: New file.
	* gdb.cp/smartp.exp: Remove KFAIL for "p c2->inta".
2014-11-28 16:01:16 -08:00
GDB Administrator f4f855e84b Automatic date update in version.in 2014-11-29 00:00:09 +00:00
Sandra Loosemore d306ce58b4 Remove broken nios2 assembler dwim support.
2014-11-28  Sandra Loosemore  <sandra@codesourcery.com>

	include/opcode/
	* nios2.h (NIOS2_INSN_ADDI, NIOS2_INSN_ANDI): Delete.
	(NIOS2_INSN_ORI, NIOS2_INSN_XORI): Delete.
	(NIOS2_INSN_OPTARG): Renumber.

	opcodes/
	* nios2-opc.c (nios2_r1_opcodes): Remove deleted attributes
	from descriptors.

	gas/
	* config/tc-nios2.c (can_evaluate_expr, get_expr_value): Delete.
	(output_addi, output_andi, output_ori, output_xori): Delete.
	(md_assemble): Remove calls to deleted functions.

	gas/testsuite/
	* gas/nios2/nios2.exp: Make "movi" a list test.
	* gas/nios2/movi.s: Adjust comments, add another case.
	* gas/nios2/movi.l: New.
	* gas/nios2/movi.d: Delete.
2014-11-28 14:41:32 -08:00
Simon Marchi d7fc3181f7 Fix prints in tests for Python 3
Python 3's print requires to use parentheses, so this patch adds them
where they were missing.

gdb/testsuite/ChangeLog:

	* gdb.ada/py_range.exp: Add parentheses to calls to print.
	* gdb.dwarf2/symtab-producer.exp: Same.
	* gdb.gdb/python-interrupts.exp: Same.
	* gdb.gdb/python-selftest.exp: Same.
	* gdb.python/py-linetable.exp: Same.
	* gdb.python/py-type.exp: Same.
	* gdb.python/py-value-cc.exp: Same.
	* gdb.python/py-value.exp: Same.
2014-11-28 11:36:52 -05:00
Oleg Endo 57df9adf2d Correct fabs and fneg insns in simulator
It seems that the implementation of the SH fabs and fneg insns in the
simulator is not correct.  They use the FP_UNARY macro which checks the
FPSCR.PR setting and raises an exception if PR = 1 (double precision)
and the register number is not even (i.e. a valid DF reg number).
For normal unary FP insns this is fine.  However, fneg and fabs perform
the same (integer) operations regardless of the FPSCR.PR setting.

This issue initially popped up here
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

I've checked some of the failing tests mentioned in GCC PR 63260 above
with the patch applied and the failures go away.

sim/sh/ChangeLog (tiny patch):

	* gencode.c (fabs, fneg): Implement as integer operation
	instead of using the FP_UNARY macro.
2014-11-28 19:44:03 +04:00
Pierre Muller f7ca3fcfcc Fix amd64 dwarf register number mapping (MMX register and higher)
Dwarf register numbers are defined in "System V Application Binary
Interface AMD64 Architecture Processor Supplement Draft Version 0.99.6"

The amd64_dwarf_regmap array is missing the 8 MMX registers in Figure
3.36: DWARF Register Number Mapping page 57.  This leads to a wrong
value for the registers past this point.

gdb/ChangeLog:

        Pushed by Joel Brobecker  <brobecker@adacore.com>.
        * amd64-tdep.c (amd64_dwarf_regmap array): Add missing MMX
        registers.

Tested on x86_64-linux.
2014-11-28 19:30:43 +04:00
Ulrich Weigand b2859a9a54 Remove (dead-code) native core file sniffers on Linux targets
Since Andreas Arnez' recent patch series, all Linux targets install
gdbarch_iterate_over_regset_sections routines.  This means that on
Linux native targets, old-style core sniffers are never used.

Most Linux targets haven't been using such sniffers for a long time
anyway, but a couple remain: ia64 and sparc use core-regset.o, and
m68k installs its own core_fns.  All this is now dead code, which
this commit removes.

gdb/
2014-11-28  Ulrich Weigand  <uweigand@de.ibm.com>

	* config/ia64/linux.mh (NATDEPFILES): Remove core-regset.o.
	* config/sparc/linux.mh (NATDEPFILES): Likewise.
	* config/sparc/linux64.mh (NATDEPFILES): Likewise.
	* m68klinux-nat.c (fetch_core_registers): Remove.
	(linux_elf_core_fns): Remove.
	(_initialize_m68k_linux_nat): Do not call deprecated_add_core_fns.
2014-11-28 15:53:05 +01:00
Joel Brobecker 0fa9473ff0 gdb_realpath: Rework comment about handling on Windows.
Rework the comment to explain why we're still relying on GetFullPathName
even though gnulib ensures that canonicalize_file_name is now available
on all platforms, including Windows.

gdb/ChangeLog:

        * utils.c (gdb_realpath): Rework comment about handling on
        Windows.
2014-11-28 18:37:08 +04:00
Yao Qi 6a29c58ef8 Import rename module
This patch is to import rename module.

gdb:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
	rename.
	* gnulib/aclocal.m4: Re-generated.
	* gnulib/config.in: Re-generated.
	* gnulib/configure: Re-generated.
	* gnulib/import/Makefile.am: Re-generated.
	* gnulib/import/Makefile.in: Re-generated.
	* gnulib/import/m4/gnulib-cache.m4: Re-generated.
	* gnulib/import/m4/gnulib-comp.m4: Re-generated.
	* import/basename-lgpl.c: New file.
	* import/dirname-lgpl.c: New file.
	* import/dirname.h: New file.
	* import/m4/dirname.m4: New file.
	* import/m4/malloc.m4: New file.
	* import/m4/rename.m4: New file.
	* import/m4/rmdir.m4: New file.
	* import/m4/stdio_h.m4: New file.
	* import/malloc.c: New file.
	* import/rename.c: New file.
	* import/rmdir.c: New file.
	* import/same-inode.h: New file.
	* import/stdio.c: New file.
	* import/stdio.in.h: New file.
	* import/stripslash.c: New file.
2014-11-28 18:38:21 +08:00
Yao Qi abbffc8924 Use canonicalize_file_name unconditionally
gdb:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* configure.ac (AC_CHECK_FUNCS): Remove canonicalize_file_name
	and realpath.
	* config.in: Re-generated.
	* configure: Re-generated.
	* utils.c (gdb_realpath): Remove code calling realpath,
	canonicalize_file_name and pathconf.
	[!_WIN32]: Call canonicalize_file_name.
2014-11-28 18:38:16 +08:00
Yao Qi 9839978095 Import canonicalize-lgpl
This patch is to import canonicalize-lgpl module, which provides
readlpath and canonicalize_file_name.

gdb:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
	canonicalize-lgpl.
	* aclocal.m4: Re-generated.
	* config.in: Re-generated.
	* configure: Re-generated.
	* import/Makefile.am: Re-generated.
	* import/Makefile.in: Re-generated.
	* import/m4/gnulib-cache.m4: Re-generated.
	* import/m4/gnulib-comp.m4: Re-generated.
	* import/canonicalize-lgpl.c: New file.
	* import/extra/snippet/_Noreturn.h: New file.
	* import/m4/canonicalize.m4: New file.
	* import/m4/double-slash-root.m4: New file.
	* import/m4/eealloc.m4: New file.
	* import/m4/malloca.m4: New file.
	* import/m4/nocrash.m4: New file.
	* import/m4/stdlib_h.m4: New file.
	* import/malloca.c: New file.
	* import/malloca.h: New file.
	* import/malloca.valgrind: New file.
2014-11-28 18:38:10 +08:00
Yao Qi 3332aaf289 Use lstat unconditionally
Since lstat gnulib module is imported, we can use it unconditionally.
lstat usage was introduced by this patch

https://sourceware.org/ml/gdb-patches/2012-01/msg00390.html

during the review, it was suggested to import gnulib lstat module, but
we didn't do that.

gdb:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* configure.ac (AC_CHECK_FUNCS): Remove lstat.
	* config.in, configure: Regenerate.
	* symfile.c (find_separate_debug_file_by_debuglink): Remove
	code checking HAVE_LSTAT is defined.
2014-11-28 18:38:02 +08:00
Yao Qi f45c62c4d5 Import lstat
This patch is to import lstat gnulib module.

gdb:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
	lstat.
	* gnulib/aclocal.m4: Re-generated.
	* gnulib/config.in: Re-generated.
	* gnulib/configure: Re-generated.
	* gnulib/import/Makefile.am: Re-generated.
	* gnulib/import/Makefile.in: Re-generated.
	* gnulib/import/m4/gnulib-cache.m4: Re-generated.
	* gnulib/import/m4/gnulib-comp.m4: Re-generated.
	* gnulib/import/lstat.c: New file.
	* gnulib/import/m4/lstat.m4: New file.
2014-11-28 18:37:57 +08:00
Yao Qi bdca27a2f5 Use readlink unconditionally
Since readlink module is imported, we can use it unconditionally.
This patch is to remove configure checks and HAVE_READLINK checks in
code.  It was mentioned in the patch below

  [RFA/commit] gdbserver: return ENOSYS if readlink not supported.
  https://sourceware.org/ml/gdb-patches/2012-02/msg00148.html

to use readlink in gdbserver, but we chose something simple at that
moment.

gdb:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* configure.ac (AC_CHECK_FUNCS): Remove readlink.
	* config.in, configure: Re-generate.
	* inf-child.c (inf_child_fileio_readlink): Don't check
	HAVE_READLINK is defined.

gdb/gdbserver:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* configure.ac(AC_CHECK_FUNCS): Remove readlink.
	* config.in, configure: Re-generate.
	* hostio.c (handle_unlink): Remove code checking HAVE_READLINK
	is defined.
2014-11-28 18:37:52 +08:00
Yao Qi 2196f55f01 Import readlink
This patch is to import readlink gnulib module.  stat module is imported
too, but it isn't used by gdb.

gdb:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add readlink.
	* gnulib/aclocal.m4: Re-generated.
	* gnulib/config.in: Likewise.
	* gnulib/configure: Likewise.
	* gnulib/import/Makefile.am: Likewise.
	* gnulib/import/Makefile.in: Likewise.
	* gnulib/import/m4/gnulib-cache.m4: Likewise.
	* gnulib/import/m4/gnulib-comp.m4: Likewise.
	* gnulib/import/dosname.h: New file
 	* gnulib/import/m4/largefile.m4: New file.
	* gnulib/import/m4/readlink.m4: New file.
	* gnulib/import/m4/stat.m4: New file.
	* gnulib/import/readlink.c: New file.
 	* gnulib/import/stat.c: New file.
2014-11-28 18:37:47 +08:00
Yao Qi 7014e923da Fix date in changelog 2014-11-28 17:23:26 +08:00
Alan Modra 25ff461f19 Sanity checks on version section
* elf.c (_bfd_elf_slurp_version_tables): Exit loops when vn_next/
	vna_next/vd_next/vda_next is zero.  Correct counts.
2014-11-28 14:39:28 +10:30
Alan Modra 8514e4db84 Don't deprecate powerpc mftb insn
mftb is marked phased out in the architecture manual, but we can keep
it as an extended mnemonic for mftbl.

	* ppc-opc.c (powerpc_opcodes <mftb>): Don't deprecate for power7.
	(TB): Delete.
	(insert_tbr, extract_tbr): Validate tbr number.
2014-11-28 14:34:10 +10:30
Alan Modra 8066deb11b Fix build breakage on 32-bit targets with 64-bit bfd
* readelf.c (get_32bit_elf_symbols): Cast bfd_size_type values to
	unsigned long for %lx.
	(get_64bit_elf_symbols, process_section_groups): Likewise.
2014-11-28 14:34:10 +10:30
Yao Qi 10e79639cc Match library name prefixed with sysroot
We enable systemtap probe in glibc recently, and see the following gdb fail,

(gdb) set solib-absolute-prefix /.
...
Stopped due to shared library event:^M
  Inferior loaded /./foo/bar/gdb.base/break-probes-solib.so
...
(gdb) FAIL: gdb.base/break-probes.exp: run til our library loads (the program exited)

$binfile_lib is /foo/bar/gdb.base/break-probes-solib.so, but the
sysroot is prefixed in solib.c:solib_find, as comments described:

   Global variable GDB_SYSROOT is used as a prefix directory
   to search for shared libraries if they have an absolute path.

so the output becomes "/./foo/bar/gdb.base/break-probes-solib.so", which
is still correct.  However, the test repeatedly continue the program
and tries to match $binfile_lib, finally, the program exits and the
test fails.

This patch is to adjust the pattern to match $sysroot$binfile_lib
instead of $binfile_lib.

gdb/testsuite:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* gdb.base/break-probes.exp: Match library name prefixed with
	sysroot.
2014-11-28 11:21:48 +08:00
GDB Administrator e87e47787e Automatic date update in version.in 2014-11-28 00:00:09 +00:00
Espen Grindhaug c9c1d67440 Fixes an infinite loop in readelf parsing a corrupt binary, and other minor corrections.
PR binutils/17531
	* readelf.c (get_data): Move excessive length check to earlier on
	in the function and allow for wraparound in the arithmetic.
	(get_32bit_elf_symbols): Terminate early if the section size is
	zero.  Check for an invalid sh_entsize.  Check for an index
	section with an invalid size.
	(get_64bit_elf_symbols): Likewise.
	(process_section_groups): Check for an invalid sh_entsize.
2014-11-27 15:49:23 +00:00
H.J. Lu 3a1cfc456f Update mips tests with symbol version string
* ld-mips-elf/got-vers-1.rd: Add symbol version string to
	versioned symbol names in dynamic relocation.
	* ld-mips-elf/reloc-estimate-1.d: Likewise.
	* ld-mips-elf/tlsdyn-o32-1.got: Likewise.
	* ld-mips-elf/tlsdyn-o32-2.got: Likewise.
	* ld-mips-elf/tlsdyn-o32-3.got: Likewise.
	* ld-mips-elf/tlslib-o32-ver.got: Likewise.
2014-11-27 06:44:29 -08:00
Simon Marchi f28a0564dd Fix test always passing in python/py-linetable.exp
The following test is found in python/py-linetable.exp:

gdb_test "python print sorted(fset)" \
    "\[20L, 21L, 22L, 24L, 25L, 28L, 29L, 30L, 32L, 33L, 37L, 39L, 40L, 42L, 44L, 45L, 46L\].*" \
    "Test frozen set contains line numbers"

I noticed that it passed when using Python 3, even though it should fail
because of the missing parentheses for the call print.

There needs to be more escaping of the square brackets. Currently, it is
interpreted as "any one character from this big list of characters,
followed by .*". When adding the required amount of backslashes, the
test starts failing as it should.

Moreover, both in Python 2.7 and Python 3.3 the numbers don't have the L
suffix, so now the test fails because of that. Anybody knows why they
were there in the first place? I just tested with Python 2.4 and there
are no Ls.

gdb/testsuite/ChangeLog:

	* gdb.python/py-linetable.exp: Escape properly sorted(fset)
	test expected output.  Add parentheses for the call to print.
	Remove L suffix from integers.

Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
2014-11-27 09:27:08 -05:00
Nick Clifton 1036838a77 Fixes a few more memory access violations exposed by fuzzed binaries.
PR binutils/17512
	* ecoff.c (_bfd_ecoff_slurp_symbol_table): Warn about and correct
	a discrepancy between the isymMax and ifdMax values in the
	symbolic header.
	* elf.c (_bfd_elf_print_private_bfd_data): Fix the range check
	scanning the external dynamic entries.
2014-11-27 12:19:10 +00:00
GDB Administrator 608ce2f3c8 Automatic date update in version.in 2014-11-27 00:00:13 +00:00
Mark Wielaard 8bc106204c dwarf.c handle new DWARFv5 C11, C++11 and C++14 DW_LANG constants.
binutils/ChangeLog

	* dwarf.c (read_and_display_attr_value): Handle DW_LANG_C11,
	DW_LANG_C_plus_plus_11 and DW_LANG_C_plus_plus_14.
2014-11-27 00:35:18 +01:00
Doug Evans 3fe1ce1d5b gdb.dwarf2/dw2-op-out-param.S: Fix comment.
gdb/ChangeLog:

	* gdb.dwarf2/dw2-op-out-param.S: Fix comment.
2014-11-26 14:44:46 -08:00
Cary Coutant 982bbd97c5 Update list of debug sections for --strip-debug-xxx options.
Add .debug_gdb_scripts, .debug_gnu_pubnames, .debug_gnu_pubtypes,
and .debug_str_offsets to lists of sections to strip or keep
when stripping debug info.

gold/
	* layout.cc (gdb_sections): Keep .debug_gdb_scripts and
	.debug_str_offsets; strip .debug_gnu_pubnames and
	.debug_gnu_pubtypes.
	(lines_only_debug_sections): Strip all four new sections.
2014-11-26 14:41:46 -08:00
Han Shen bb779192ae Fix for gold linking tlsdesc into an executable with -pie.
(Also included in this patch is a minor typo fix in gold/ChangeLog.)

When linking the following tlsdesc access sequence into an executable with -pie,

     adrp    x0, :tlsdesc:tls_gd
     ldr     x1, [x0, #:tlsdesc_lo12:tls_gd]
     add     x0, x0, :tlsdesc_lo12:tls_gd
     .tlsdesccall    tls_gd
     blr	     x1
     mrs	     x1, tpidr_el0
     add	     x0, x1, x0
     ldr	     w0, [x0]

current gold-aarch64 backend does tls-desc-gd-to-ie relaxation, into

       adrp    x0, 1000 <__FRAME_END__+0x720>
       ldr     x1, [x0,#4064]	  ;; <=== the target register should be x0
       nop
       nop
       mrs	x1, tpidr_el0
       add	x0, x1, x0
       ldr	w0, [x0]

This code is wrong. The fix changes ldr target register into x0.
2014-11-26 10:34:46 -08:00
Nick Clifton a11652892c More fixes for memory access errors triggered by attemps to examine corrupted binaries.
PR binutils/17512
	* dwarf.c (display_block): Do nothing if the block starts after
	the end of the buffer.
	(read_and_display_attr_value): Add range checks.
	(struct Frame_Chunk): Make the ncols and ra fields unsigned.
	(frame_need_space): Test for an ncols of zero.
	(read_cie): Fail if the augmentation data extends off the end of
	the buffer.
	(display_debug_frames): Add checks for read_cie failing.  Add
	range checks.
	* coff-h8300.c (rtype2howto): Replace abort with returning a NULL
	value.
	* coff-h8500.c (rtype2howto): Likewise.
	* coff-tic30.c (rtype2howto): Likewise.
	* coff-z80.c (rtype2howto): Likewise.
	* coff-z8k.c (rtype2howto): Likewise.
	* coff-ia64.c (RTYPE2HOWTO): Always return a valid howto.
	* coff-m68k.c (m68k_rtype2howto): Return a NULL howto if none
	could be found.
	* coff-mcore.c (RTYPE2HOWTO): Add range checking.
	* coff-w65.c (rtype2howto): Likewise.
	* coff-we32k.c (RTYPE2HOWTO): Likewise.
	* pe-mips.c (RTYPE2HOWTO): Likewise.
	* coff-x86_64.c (coff_amd64_reloc): Likewise.  Replace abort with
	an error return.
	* coffcode.h (coff_slurp_reloc_table): Allow the rel parameter to
	be unused.
	* coffgen.c (make_a_section_from_file): Check the length of a
	section name before testing to see if it is a debug section name.
	(coff_object_p): Zero out any uninitialised bytes in the opt
	header.
	* ecoff.c (_bfd_ecoff_slurp_symbolic_info): Test for the raw
	source being empty when there are values to be processed.
	(_bfd_ecoff_slurp_symbol_table): Add range check.
	* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Likewise.
	(bfd_mach_o_mangle_sections): Move test for too many sections to
	before the allocation of the section table.
	(bfd_mach_o_read_symtab_strtab): If the read fails, free the
	memory and nullify the symbol pointer.
	* reloc.c (bfd_generic_get_relocated_section_contents): Add
	handling of a bfd_reloc_notsupported return value.
	* versados.c (EDATA): Add range checking.
	(get_record): Likewise.
	(process_otr): Check for contents being available before updating
	them.
	(versados_canonicalize_reloc): Add range check.
2014-11-26 14:11:23 +00:00
Mark Wielaard 0cfd832fc7 Recognize new DWARFv5 C11, C++11 and C++14 DW_LANG constants.
gdb/ChangeLog

	* dwarf2read.c (set_cu_language): Recognize DW_LANG_C11,
	DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14.

include/ChangeLog

	* dwarf2.h: Add DW_LANG_C_plus_plus_11, DW_LANG_C11 and
	DW_LANG_C_plus_plus_14.
2014-11-26 12:47:29 +01:00
Alan Modra 601a03ba3d _bfd_elf_slurp_version_tables tidy
The internal verref buffer is allocated with bfd_zalloc, based on a
count given in headers.  If the headers are broken/fuzzed and contain
an enormous count the alloc can result in OOM.  If we first read the
external verrefs (into a buffer that isn't zeroed on allocation) then
the read provides a sanity check on the headers.

Also prints an error for version info that fails other sanity checks.

	* elf.c (_bfd_elf_slurp_version_tables): Delay allocation of
	internal verref buffer.  Error for zero sh_info.  Print errors.
	Check for zero vd_ndx.  Use bfd_zalloc for vd_auxptr buffer.
2014-11-26 13:29:29 +10:30
Alan Modra a3e60ddb0b Retry powerpc gold stub grouping when groups prove too large
An unusually large number of stubs can result in the default section
group size being too large;  sections plus stubs exceed the range of a
branch.  Restarting the relaxation pass with a smaller group size can
sometimes help.

	* powerpc.cc (struct Stub_table_owner): New.
	(Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
	unsigned int vector.  Update all references.
	(powerpc_relobj::set_stub_table): Take an unsigned int param
	rather than a Stub_table.  Update callers.
	(Powerpc_relobj::clear_stub_table): New function.
	(Target_powerpc): Add relax_failed_, relax_fail_count_ and
	stub_group_size_ vars.
	(Target_powerpc::new_stub_table): Delete.
	(max_branch_delta): New function, extracted from..
	(Target_powerpc::Relocate::relocate): ..here..
	(Target_powerpc::Branch_info::make_stub): ..and here.  Return
	status on whether stub created successfully.
	(Stub_control::Stub_control): Add "no_size_errors" param.  Move
	default sizing to..
	(Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
	reduce on relax failure.
	(Target_powerpc::group_sections): Add "no_size_errors" param.
	Use stub_group_size_.  Set up group info in a temp vector,
	before building Stub_table vector.  Account for input sections
	possibly already converted to relaxed sections.
	(Stub_table::init): Delete.  Merge into..
	(Stub_table::Stub_table): ..here.
	(Stub_table::can_reach_stub): New function.
	(Stub_table::add_plt_call_entry): Add "from" parameter and
	return true iff stub could be reached.
	(Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
	param too.
	(Stub_table::clear_stubs): Add "all" param.
2014-11-26 13:29:29 +10:30
Sandra Loosemore aa4893954a Fix Nios II prologue analyzer to handle multiple stack adjustments.
2014-11-25  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-tdep.c (nios2_analyze_prologue): Replace restriction
	that there can be only one stack adjustment in the prologue
	with tests to detect specific disallowed stack adjustments.
2014-11-25 18:40:28 -08:00
Sandra Loosemore 7f1659b587 Fix Nios II GDB epilogue detection to handle multiple stack adjustments.
2014-11-25  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-tdep.c (nios2_in_epilogue_p): Handle multiple stack
	adjustments.
2014-11-25 18:37:41 -08:00
Sandra Loosemore d53c26c753 Refactor Nios II GDB support to use helper functions for disassembly and
instruction matching.

2014-11-25  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-tdep.c (nios2_fetch_insn): Move up in file.  Disassemble
	the instruction as well as reading it from memory.
	(nios2_match_add): New.
	(nios2_match_sub): New.
	(nios2_match_addi): New.
	(nios2_match_orhi): New.
	(nios2_match_stw): New.
	(nios2_match_ldw): New.
	(nios2_match_rdctl): New.
	(enum branch_condition): New.
	(nios2_match_branch): New.
	(nios2_match_jmpi): New.
	(nios2_match_calli): New.
	(nios2_match_jmpr): New.
	(nios2_match_callr): New.
	(nios2_match_break): New.
	(nios2_match_trap): New.
	(nios2_in_epilogue_p): Rewrite to use new functions.
	(nios2_analyze_prologue): Likewise.
	(nios2_skip_prologue): Delete unused local limit_pc.
	(nios2_breakpoint_from_pc): Make R1-specific encodings explicit.
	(nios2_get_next_pc): Rewrite to use new functions.
2014-11-25 18:34:51 -08:00
Alan Modra a20605cf85 [GOLD] PowerPC relaxation corner case
It's possible for the section grouping code to decide that the last
section looked at (the first section by address) doesn't fit into a
group.  In one case that section is already a group owner and that is
handled correctly.  In other cases the section should be put into its
own group.  Like this:

	* powerpc.cc (Stub_control::set_output_and_owner): New function.
	(Target_powerpc::group_sections): Use it.
2014-11-26 10:50:33 +10:30
GDB Administrator 38bd618497 Automatic date update in version.in 2014-11-26 00:00:13 +00:00
Cary Coutant 43b64debe3 Add file size to ELF symbol labelling start of a binary file.
gold/
	* binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
	(Binary_to_elf::write_symbol): Add st_size parameter.
	* binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
2014-11-25 14:33:51 -08:00
Cary Coutant c924eb67e1 Fix corrupted .eh_frame section with LTO and --gc-sections.
When --gc-sections is turned on during an LTO link, the .eh_frame sections
from deferred files are processed before those from the replacement files.
As a result, the section end-cap from crtendS.o is placed ahead of
the .eh_frame data from the replacement files. This patch fixes the bug
by skipping the layout of the deferred sections during GC pass 2.

gold/
	PR gold/17639
	* object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
	(Sized_relobj_file::do_layout): Handle deferred sections properly
	during GC pass 1. Don't add reloc sections to deferred list twice.
	* object.h (Sized_relobj_file::is_deferred_layout): New function.
	(Sized_relobj_file::is_deferred_layout_): New data member.
2014-11-25 13:56:21 -08:00
H.J. Lu 61e6682207 Update ld-alpha tests for secureplt
* ld-alpha/tlsbin.dd: Updated for secureplt.
	* ld-alpha/tlsbin.rd: Likewise.
	* ld-alpha/tlsbin.sd: Likewise.
	* ld-alpha/tlsbinr.dd: Likewise.
	* ld-alpha/tlsbinr.rd: Likewise.
	* ld-alpha/tlspic.dd: Likewise.
	* ld-alpha/tlspic.rd: Likewise.
	* ld-alpha/tlspic.sd: Likewise.
2014-11-25 13:41:30 -08:00
Max Filippov d92b6eece4 Fix trampolines search code for conditional branches
For conditional branches that need more than one trampoline to reach its
target assembler couldn't always find suitable trampoline because
post-loop condition check was placed inside the loop, resulting in
premature loop termination. Move check outside the loop.

This fixes the following build errors seen when assembling huge files
produced by gcc:
    Error: jump target out of range; no usable trampoline found
    Error: operand 1 of 'j' has out of range value '307307'

2014-11-25  Max Filippov  <jcmvbkbc@gmail.com>

gas/
	* config/tc-xtensa.c (search_trampolines): Move post-loop
	condition check outside the search loop.

gas/testsuite/
	* gas/xtensa/trampoline.d: Add expected output for branches.
	* gas/xtensa/trampoline.s: Add test case for branches.
2014-11-26 00:17:36 +03:00