Fix comment typo

ChangeLog:

	* common/cleanups.c (make_cleanup_dtor): Fix comment typo.
X86-64: Allow copy relocs for building PIE

This patch allows copy relocs for non-GOT pc-relative relocation in PIE.

bfd/

	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Always
	allow copy relocs for building executables.
	(elf_x86_64_check_relocs): Allow copy relocs for non-GOT
	pc-relative relocation in shared object.
	(elf_x86_64_adjust_dynamic_symbol): Allocate copy relocs for
	PIE.
	(elf_x86_64_relocate_section): Don't copy a pc-relative
	relocation into the output file if the symbol needs copy reloc.

ld/testsuite/

	* ld-x86-64/copyreloc-lib.c: New file.
	* ld-x86-64/copyreloc-main.c: Likewise.
	* ld-x86-64/copyreloc-main.out: Likewise.
	* ld-x86-64/copyreloc-main1.rd: Likewise.
	* ld-x86-64/copyreloc-main2.rd: Likewise.

	* ld-x86-64/x86-64.exp: Run copyreloc tests.
Automatic date update in version.in
Remove remnant of Chill support.

gdb/ChangeLog:

	* valops.c (do_search_struct_field): Remove remnant of Chill support.
	Ref: commit 4c2260aa5c261f7bfb26dcf3aa7c67876720b17e
dwarf2read.c (peek_die_abbrev): Improve error message text.

gdb/ChangeLog:

	* dwarf2read.c (peek_die_abbrev): Improve error message text.
PR symtab/17591

gdb/ChangeLog:

	PR symtab/17591
	* dwarf2read.c (find_slot_in_mapped_hash): Use cp_remove_params
	to strip parameters.
PR symtab/17602

gdb/ChangeLog:

	PR symtab/17602
	* linespec.c (iterate_name_matcher): Fix arguments to symbol_name_cmp.

gdb/testsuite/ChangeLog:

        PR symtab/17602
	* gdb.cp/anon-ns.cc: Move guts of this file to ...
	* gdb.cp/anon-ns-2.cc: ... here.  New file.
	* gdb.cp/anon-ns.exp: Update.
Discard space for relocs against symbols with copy relocs

This patch reverts the change in elf_x86_64_check_relocs and the partial
change in elf_x86_64_adjust_dynamic_symbol.  Instead, we discard space
in PIE for relocs against symbols which turn out to need copy relocs.

	* elf64-x86-64.c (elf_x86_64_check_relocs): Revert the last
	change.
	(elf_x86_64_adjust_dynamic_symbol): Don't check !info->shared
	with ELIMINATE_COPY_RELOCS.
	(elf_x86_64_allocate_dynrelocs): For PIE, discard space for
	relocs against symbols which turn out to need copy relocs.
Remove cplus_specific from general_symbol_info.

This patch reverts the addition of cplus_specific added here:

2010-07-16  Sami Wagiaalla  <swagiaal@redhat.com>

	* symtab.h (symbol_set_demangled_name): Now takes an optional objfile*
	argument.
	(cplus_specific): New struct.
	* symtab.c (symbol_set_demangled_name): Updated.
	Use cplus_specific for cplus symbols.
	(symbol_get_demangled_name): Retrive the name from the cplus_specific
	struct for cplus symbols.
	(symbol_init_language_specific): Set cplus_specific for cplus symbols.
	(symbol_set_names): Pass objfile to symbol_set_demangled_name.
	* symtab.c (symbol_init_cplus_specific): New function.

It was added in anticipation of improved template support:

https://sourceware.org/ml/gdb-patches/2010-05/msg00594.html
https://sourceware.org/ml/gdb-patches/2010-07/msg00284.html

However, minsyms pay the price for this space too.
For my standard benchmark this patch gets back 44MB of memory
when gdb starts.  [There's still ~440MB of memory used
by the demangled ELF symbols of this benchmark, but that's another topic.]

When the improved templated support is added,
I wonder if this can be moved to struct symbol.
Hmmm, we already have a special version of
struct symbol for templates (struct template_symbol).

gdb/ChangeLog:

	* symtab.c (symbol_init_cplus_specific): Delete.
	(symbol_set_demangled_name): Remove special c++ support.
	(symbol_get_demangled_name, symbol_set_language): Ditto.
	* symtab.h (struct cplus_specific): Delete.
	(struct general_symbol_info) <language_specific>: Remove
	cplus_specific.
Check info->executable for symbols which need copy relocs

	* elf64-x86-64.c (elf_x86_64_relocate_section): Check
	info->executable for symbols which need copy relocs.
callback.h:struct host_callback_struct compilation error on Windows hosts.

On Windows, a recent gnulib update imported the lstat module, and
this caused a remote-sim.c build failure in struct host_callback_struct:

    In file included from /[...]/gdb/remote-sim.c:34:0:
    /[...]/gdb/../include/gdb/callback.h:93:9: error: duplicate member '_stati64'
       int (*lstat) (host_callback *, const char *, struct stat *);
             ^
What happens it that gnulib's stat.h makes the following defines:

     /* Large File Support on native Windows.  */
     #if 1
     # define stat _stati64
     #endif

and then:

    #if 1
    # if ! 0
    /* mingw does not support symlinks, therefore it does not have lstat.  But
       without links, stat does just fine.  */
    #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    #   define lstat stat
    #  endif

So, the following fields in struct host_callback_struct...

      int (*stat) (host_callback *, const char *, struct stat *);
      int (*fstat) (host_callback *, int, struct stat *);
      int (*lstat) (host_callback *, const char *, struct stat *);

... get translated to...

      int (*_stati64) (host_callback *, const char *, struct _stati64 *);
      int (*_fstati64) (host_callback *, int, struct _stati64 *);
      int (*_stati64) (host_callback *, const char *, struct _stati64 *);

... which causes two fields to have the same name.

This patch fixes the issue by renaming the stat-related fields
by adding a "to_" prefix, similar to what is done in GDB's
target_ops vector.

include/gdb/ChangeLog:

	* callback.h (struct host_callback_struct) <to_stat>: Renamed
	from "stat".
	<to_fstat>: Renamed from "fstat".
	<to_lstat>: Renamed from "lstat".

sim/common/ChangeLog:

	* sim-io.c (sim_io_stat, sim_io_fstat): Adjust calls to "stat"
	and "fstat" callbacks by calls to "to_stat" and "to_fstat" (resp)
	callbacks following renaming in callback.h.
	* syscall.c (cb_syscall): Likewise.  Adjust calls to "lstat"
	callback by call to "to_lstat" callback

sim/cris/ChangeLog:

	* traps.c (cris_break_13_handler): Adjust call to "fstat" callback
	by call to "to_fstat" following renaming in callback.h.

sim/h8300/ChangeLog:

	* compile.c (sim_resume):  Adjust calls to "stat" and "fstat"
	callbacks by calls to "to_stat" and "to_fstat" (resp) callbacks
	following renaming in callback.h.
Fix make_cleanup_dtor signature to match declaration

The definition does not use the typedef for the dtor function pointer
type that the declaration uses.  It's a cosmetic-only change.

ChangeLog:

	* common/cleanups.c (make_cleanup_dtor): Use typedef for dtor
	type.
Use core regset iterators on Sparc Solaris

Remove native-only core file handling on Sparc Solaris.  Instead,
enable the sparc target generic core regset logic on Solaris by
providing appropriate register offset maps.

Thanks to Joel Brobecker for testing!

gdb/
	* config/sparc/sol2.mh (NATDEPFILES): Remove core-regset.o.
	* sparc-sol2-tdep.c: Include "regset.h".
	(sparc32_sol2_supply_core_gregset): New function.
	(sparc32_sol2_collect_core_gregset): Likewise.
	(sparc32_sol2_supply_core_fpregset): Likewise.
	(sparc32_sol2_collect_core_fpregset): Likewise.
	(sparc32_sol2_gregset, sparc32_sol2_fpregset): New variables.
	(sparc32_sol2_init_abi): Set tdep->gregset/sizeof_gregset and
	tdep->fpregset/sizeof_fpregset.
	* sparc64-sol2-tdep.c: Include "regset.h".
	(sparc64_sol2_supply_core_gregset): New function.
	(sparc64_sol2_collect_core_gregset): Likewise.
	(sparc64_sol2_supply_core_fpregset): Likewise.
	(sparc64_sol2_collect_core_fpregset): Likewise.
	(sparc64_sol2_gregset, sparc64_sol2_fpregset): New variables.
	(sparc64_sol2_init_abi): Set tdep->gregset/sizeof_gregset and
	tdep->fpregset/sizeof_fpregset.
powerpc gold, fix pr17566

Code stolen from arm.cc.

	PR 17566
	* powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
	when adding dynamic relocations against section symbols.
Reformat elf_x86_64_create_dynamic_sections

	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Reformat.
Replace calls to abort (in readelf) with informative error messages.

	PR binutils/17531
	* readelf.c (get_machine_flags): Replace call to abort with a
	warning message and a return value.
	(get_elf_section_flags): Likewise.
	(get_symbol_visibility): Likewise.
	(get_ia64_symbol_other): Likewise.
	(get_ia64_symbol_other): Likewise.
	(is_32bit_abs_reloc): Likewise.
	(apply_relocations): Likewise.
	(display_arm_attribute): Likewise.
Replace copyreloc-main.c with copyreloc-main.S

	* ld-x86-64/copyreloc-main.c: Removed.
	* ld-x86-64/copyreloc-main.S: New.
	* ld-x86-64/x86-64.exp: Replace copyreloc-main.c with
	copyreloc-main.S.
Compile pie_copyrelocs_test.cc with -fno-exceptions -fno-asynchronous-unwind-tables

	PR gold/17675
	* testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
	* testsuite/Makefile.in: Regenerated.
Fix memory access problems exposed by fuzzed binaries.

	PR binutils/17512
	* objdump.c (free_debug_section): Reset the compress_status as
	well.

	* compress.c (bfd_get_full_section_contents): Fail if there are no
	section contents available when the compress_status is
	COMPRESS_SECTION_DONE.
	* libbfd.c (bfd_malloc): Refuse to allocate a negative size.
	(bfd_malloc2): Use bfd_malloc.
	(bfd_realloc): Refuse to reallocate a negative size.
	(bfd_realloc2): Use bfd_realloc.
	(bfd_realloc_or_free): Use bfd_realloc.
	(bfd_zmalloc): Use bfd_malloc.
	(bfd_zmalloc): Use bfd_malloc2.
	* opncls.c (bfd_alloc): Refuse to allocate a negative size.
MIPS: Add support for microMIPS Linux signal trampolines

The necessity for this change has been revealed in the course of
investigation related to proposed changes in the treatment of the ISA
bit encoded in function symbols on the MIPS target.  This change adds
support for Linux signal trampolines encoded with the microMIPS
instruction set.  Such trampolines are used by the Linux kernel if
compiled as a microMIPS binary (even if the binary run/debugged itself
contains no microMIPS code at all).

To see if we need to check whether the execution mode selected matches
the given trampoline I have checked what the bit patterns of all the
trampoline sequences decode to in the opposite instruction set.  This
produced useless or at least unusual code in most cases, for example:

microMIPS/EB, o32 sigreturn, decoded as MIPS code:
	30401017 	andi	zero,v0,0x1017
	00008b7c 	dsll32	s1,zero,0xd

MIPS/EL, o32 sigreturn, decoded as microMIPS code:
	1017 2402 	addi	zero,s7,9218
	000c 0000 	sll	zero,t0,0x0

However in some corner cases reasonable code can mimic a trampoline, for
example:

MIPS/EB, n32 rt_sigreturn, decoded as microMIPS code:
	2402      	sll	s0,s0,1
	1843 0000 	sb	v0,0(v1)
	000c 0f3c 	jr	t0

-- here the first instruction is a 16-bit one, making things nastier
even as there are some other microMIPS instructions whose first 16-bit
halfword is 0x000c and therefore matches this whole trampoline pattern.

To overcome this problem I have decided the signal trampoline unwinder
has to ask the platform backend whether it can apply a given trampoline
pattern to the code location being concerned or not.  Anticipating the
acceptance of the ISA bit proposal I decided the handler not to merely
be a predicate, but also to be able to provide an adjusted PC if
required.  I decided that returning zero will mean that the trampoline
pattern is not applicable and any other value is the adjusted PC to use;
a handler may return the value requested if the trampoline pattern and
the PC requested as-is are both accepted.

This changes the semantics of the trampoline unwinder a bit in that the
zero PC now has a special value.  I think this should be safe as a NULL
pointer is generally supposed to be invalid.

	* tramp-frame.h (tramp_frame): Add `validate' member.
	* tramp-frame.c (tramp_frame_start): Validate trampoline before
	scanning.
	* mips-linux-tdep.c (MICROMIPS_INST_LI_V0): New macro.
	(MICROMIPS_INST_POOL32A, MICROMIPS_INST_SYSCALL): Likewise.
	(mips_linux_o32_sigframe): Initialize `validate' member.
	(mips_linux_o32_rt_sigframe): Likewise.
	(mips_linux_n32_rt_sigframe): Likewise.
	(mips_linux_n64_rt_sigframe): Likewise.
	(micromips_linux_o32_sigframe): New variable.
	(micromips_linux_o32_rt_sigframe): Likewise.
	(micromips_linux_n32_rt_sigframe): Likewise.
	(micromips_linux_n64_rt_sigframe): Likewise.
	(mips_linux_o32_sigframe_init): Handle microMIPS trampolines.
	(mips_linux_n32n64_sigframe_init): Likewise.
	(mips_linux_sigframe_validate): New function.
	(micromips_linux_sigframe_validate): Likewise.
	(mips_linux_init_abi): Install microMIPS trampoline unwinders.