Error on shared lib call to @local ifunc

On powerpc32, making ifuncs have non-default visibility in shared
libraries or pies can result in runtime failures.  The problem is that
if gcc is told that a given function has non-default visibility, then
calls to that function are assumed to be local (which is true) and
thus need not go via a plt call stub (which is false for ifunc).  If
the caller has no other reason to set up the got pointer (r30), code
won't be emitted to do so.  However, a pic plt call stub makes use of
r30 to load the plt entry.  So a call to an ifunc, which always needs
a plt entry, will fail.

This patch makes ld emit an error for the problem case, and allows
calls to non-default visibility ifuncs to work in normal executables.
I also fix some cases where ifuncs fail when using the old bss-plt.

	* elf32-ppc.c (ppc_elf_check_relocs): For @local call to ifunc,
	error when shared and force a plt call otherwise.
	(ppc_elf_size_dynamic_sections): Don't emit DT_PPC_GOT unless
	plt_type == PLT_NEW.
	(ppc_elf_relocate_section): Add missing test to resolve ifuncs to
	the appropriate call stub.
missing changelog for last patch
replace XZALLOC with XCNEW

This replaces XZALLOC with XCNEW and removes XZALLOC.
This change is purely mechanical.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* defs.h (XZALLOC): Remove.
	* ada-lang.c (get_ada_inferior_data): Use XCNEW, not XZALLOC.
	* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
	(get_ada_tasks_inferior_data): Likewise.
	* auto-load.c (get_auto_load_pspace_data): Likewise.
	* auxv.c (get_auxv_inferior_data): Likewise.
	* bfd-target.c (target_bfd_reopen): Likewise.
	* breakpoint.c (get_catch_syscall_inferior_data): Likewise.
	(deprecated_insert_raw_breakpoint): Likewise.
	* bsd-uthread.c (bsd_uthread_pid_to_str): Likewise.
	* corelow.c (core_open): Likewise.
	* darwin-nat.c (darwin_check_new_threads): Likewise.
	(darwin_attach_pid): Likewise.
	* dummy-frame.c (dummy_frame_push): Likewise.
	* dwarf2-frame.c (dwarf2_frame_cache): Likewise.
	* dwarf2loc.c (allocate_piece_closure): Likewise.
	* elfread.c (elf_symfile_segments): Likewise.
	* eval.c (ptrmath_type_p): Likewise.
	* exceptions.c (EXCEPTIONS_SIGJMP_BUF): Likewise.
	* gdbtypes.c (alloc_type_arch): Likewise.
	(alloc_type_instance): Likewise.
	* hppa-tdep.c (hppa_gdbarch_init): Likewise.
	* inf-child.c (inf_child_can_use_agent): Likewise.
	* inflow.c (get_inflow_inferior_data): Likewise.
	* infrun.c (save_infcall_suspend_state): Likewise.
	* jit.c (jit_reader_load): Likewise.
	(get_jit_objfile_data): Likewise.
	(get_jit_program_space_data): Likewise.
	(jit_object_open_impl): Likewise.
	(jit_symtab_open_impl): Likewise.
	(jit_block_open_impl): Likewise.
	(jit_frame_sniffer): Likewise.
	* linux-fork.c (add_fork): Likewise.
	* maint.c (make_command_stats_cleanup): Likewise.
	* objfiles.c (get_objfile_pspace_data): Likewise.
	* opencl-lang.c (struct lval_closure): Likewise.
	* osdata.c (osdata_start_osdata): Likewise.
	* progspace.c (new_address_space): Likewise.
	(add_program_space): Likewise.
	* remote-sim.c (get_sim_inferior_data): Likewise.
	* sh-tdep.c (sh_gdbarch_init): Likewise.
	* skip.c (Ignore): Likewise.
	(skip_delete_command): Likewise.
	* solib-aix.c (get_solib_aix_inferior_data): Likewise.
	(library_list_start_library): Likewise.
	(solib_aix_current_sos): Likewise.
	* solib-darwin.c (get_darwin_info): Likewise.
	(darwin_current_sos): Likewise.
	* solib-dsbt.c (get_dsbt_info): Likewise.
	* solib-ia64-hpux.c (new_so_list): Likewise.
	(ia64_hpux_get_solib_linkage_addr): Likewise.
	* solib-spu.c (append_ocl_sos): Likewise.
	(spu_current_sos): Likewise.
	* solib-svr4.c (get_svr4_info): Likewise.
	(svr4_keep_data_in_core): Likewise.
	(library_list_start_library): Likewise.
	(svr4_default_sos): Likewise.
	(svr4_read_so_list): Likewise.
	* solib-target.c (library_list_start_library): Likewise.
	(solib_target_current_sos): Likewise.
	* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
	* symfile-debug.c (install_symfile_debug_logging): Likewise.
	* symfile.c (default_symfile_segments): Likewise.
	* target-descriptions.c (tdesc_data_init): Likewise.
	(tdesc_create_reg): Likewise.
	(struct tdesc_type *): Likewise.
	(tdesc_create_vector): Likewise.
	(tdesc_set_struct_size): Likewise.
	(struct tdesc_type *): Likewise.
	(tdesc_free_feature): Likewise.
	(tdesc_create_feature): Likewise.
	* windows-nat.c (windows_add_thread): Likewise.
	(windows_make_so): Likewise.
	* xml-support.c (gdb_xml_body_text): Likewise.
	(gdb_xml_create_parser_and_cleanup): Likewise.
	(xml_process_xincludes): Likewise.
	* xml-syscall.c (allocate_syscalls_info): Likewise.
	(syscall_create_syscall_desc): Likewise.
replace XMALLOC with XNEW

This replaces XMALLOC with XNEW, and removes XMALLOC.  The only
non-mechanical bit here was remembering to edit gdbarch.sh.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* defs.h (XMALLOC): Remove.
	* avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC.
	* bfin-tdep.c (bfin_gdbarch_init): Likewise.
	* cli-out.c (struct ui_out *): Likewise.
	* cli/cli-dump.c (add_dump_command): Likewise.
	(add_dump_command): Likewise.
	* complaints.c (get_complaints): Likewise.
	(find_complaint): Likewise.
	* dwarf2-frame.c (execute_cfa_program): Likewise.
	* dwarf2read.c (abbrev_table_read_table): Likewise.
	* gdbarch.sh: Likewise.
	* gdbarch.c: Rebuild.
	* inf-ttrace.c (inf_ttrace_add_page): Likewise.
	* interps.c (interp_new): Likewise.
	* lm32-tdep.c (lm32_gdbarch_init): Likewise.
	* m32r-tdep.c (m32r_gdbarch_init): Likewise.
	* mi/mi-console.c (mi_console_file_new): Likewise.
	* mi/mi-interp.c (mi_interpreter_init): Likewise.
	* mi/mi-out.c (mi_out_new): Likewise.
	* mi/mi-parse.c (mi_parse): Likewise.
	* microblaze-tdep.c (microblaze_gdbarch_init): Likewise.
	* moxie-tdep.c (moxie_gdbarch_init): Likewise.
	* observer.c (xalloc_observer_list_node): Likewise.
	* regcache.c (regcache_xmalloc_1): Likewise.
	* reggroups.c (reggroup_new): Likewise.
	(_initialize_reggroup): Likewise.
	* registry.c (register_data_with_cleanup): Likewise.
	* remote.c (remote_notif_stop_alloc_reply): Likewise.
	* ser-base.c (serial_ttystate): Likewise.
	* ser-mingw.c (make_pipe_state): Likewise.
	* ser-pipe.c (pipe_open): Likewise.
	* serial.c (serial_open): Likewise.
	* sh64-tdep.c (sh64_gdbarch_init): Likewise.
	* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
	(tui_alloc_win_info): Likewise.
	(tui_add_content_elements): Likewise.
	* tui/tui-file.c (tui_file_new): Likewise.
	* tui/tui-out.c (tui_out_new): Likewise.
	* ui-file.c (mem_file_new): Likewise.
	* ui-out.c (push_level): Likewise.
	(make_cleanup_ui_out_end): Likewise.
	(append_header_to_list): Likewise.
	(ui_out_new): Likewise.
	* user-regs.c (user_reg_add_builtin): Likewise.
replace XCALLOC with XCNEWVEC or XCNEW

This removes XCALLOC and replaces it either with XCNEWVEC, or, if the
number of elements being requested was 1, with XCNEW.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* defs.h (XCALLOC): Remove.
	* bcache.c (bcache_xmalloc): Use XCNEW, not XCALLOC.
	(print_bcache_statistics): Use XCNEWVEC, not XCALLOC.
	* dwarf2loc.c (allocate_piece_closure): Likewise.
	* elfread.c (elf_symfile_segments): Likewise.
	(elf_symfile_segments): Likewise.
	* gdbtypes.c (copy_type_recursive): Likewise.
	* i386-tdep.c (i386_gdbarch_init): Use XCNEW, not XCALLOC.
	* jit.c (jit_frame_sniffer): Use XCNEWVEC, not XCALLOC.
	* minsyms.c (prim_record_minimal_symbol_full): Use XCNEW, not
	XCALLOC.
	* mt-tdep.c (mt_gdbarch_init): Likewise.
	* opencl-lang.c (allocate_lval_closure): Use XCNEWVEC, not
	XCALLOC.
	* psymtab.c (psymbol_compare): Use XCNEW, not XCALLOC.
	* regcache.c (regcache_xmalloc_1): Use XCNEWVEC, not XCALLOC.
	* registry.c (registry_alloc_data): Likewise.
	* rs6000-tdep.c (rs6000_gdbarch_init): Use XCNEW, not XCALLOC.
	* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
	* serial.c (serial_fdopen_ops): Likewise.
	* solib-aix.c (solib_aix_get_section_offsets): Use XCNEWVEC, not
	XCALLOC.
	* spu-tdep.c (spu_gdbarch_init): Use XCNEW, not XCALLOC.
	* symfile.c (default_symfile_segments): Use XCNEW and XCNEWVEC,
	not XCALLOC.
tfile: Don't infer the PC from the tracepoint if the PC is a pseudo-register.

This PC guessing can't work when the PC is a pseudo-register.
Pseudo-register values don't end up stored in the regcache, they're
always recomputed.  And, it's actually wrong to try to write a
pseudo-register with regcache_raw_supply.  Skip it and add a comment.

gdb/
2014-01-13  Pedro Alves  <palves@redhat.com>

	* tracepoint.c (tfile_fetch_registers): Don't infer the PC from
	the tracepoint if the PC is a pseudo-register.
2014-01-13  Ma Jiang  <ma.jiang@zte.com.cn>

	PR ld/16202
	* elf32-arm.c (elf32_arm_final_link_relocate): Refetch addends for
	R_ARM_ABS8 and R_ARM_ABS16.
Fix MinGW compilation errors in gdbserver/.

gdb/gdbserver/Makefile.in (INCLUDE_CFLAGS): Remove trailing slash from
"-I$(srcdir)/../".  Fixes MinGW compilation errors with old GCC versions.
remove deprecated_set_hook

This removes deprecated_set_hook.  Insight was the last user of this
hook, but I recently checked in a patch to have it use the
command_param_changed observer instead.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* cli/cli-setshow.c (do_set_command): Update.
	* defs.h (deprecated_set_hook): Remove.
	* top.c (deprecated_set_hook): Remove.
New "make check-headers" rule.

Tries to compile each header in isolation, thus ensuring headers are
self-contained.

Defaults to checking all $HFILES_NO_SRCDIR headers.

Do:

  make check-headers CHECK_HEADERS="header.h list.h"

to check specific headers.

gdb/
2014-01-13  Pedro Alves  <palves@redhat.com>

        * Makefile.in (CHECK_HEADERS): New variable.
        (check-headers:): New rule.
Have regdat.sh always rewrite the output register file

The rules for generating the output register files look like:

amd64.c : $(srcdir)/../regformats/i386/amd64.dat $(regdat_sh)
	$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64.dat amd64.c

According to this rule, if regdat.sh is newer than amd64.c, then
regdat.sh shall be invoked on amd64.dat.  According to regdat.sh, if the
script determines that the output file amd64.c has not changed, then it
will not overwrite the existing output file.  This means that a
subsequent invocation of make will trigger the above rule again as
regdat.sh will be perpetually newer than amd64.c.

This then shows up in the make output like so:

/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-linux.dat amd64-linux.c
amd64-linux.c unchanged.
/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-avx-linux.dat amd64-avx-linux.c
amd64-avx-linux.c unchanged.
...

To fix this pathological behavior, it suffices to have regdat.sh
unconditionally rewrite the output register file.

On my machine, which has a regdat.sh file that is newer than some of the
input register files, this change speeds up every invocation of make
under gdb/ by about 5 seconds.
Fix set auto-load safe-path false warning regression (PR 16216)

gdb/
2014-01-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR threads/16216
	* linux-thread-db.c (try_thread_db_load): Add parameter
	check_auto_load_safe.  Move here the file_is_auto_load_safe call.
	(try_thread_db_load_from_pdir_1): Move it there from here.
	(try_thread_db_load_from_sdir): Update caller.
	(try_thread_db_load_from_dir): Move it there from here.
remove unused deprecated_flush_hook declaration

deprecated_flush_hook is declared in defs.h but never defined.
This patch removes the stale declaration.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* defs.h (deprecated_flush_hook): Remove.
remove use_windows

Nothing actually uses use_windows, not even Insight.  So, this patch
removes it.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* defs.h (use_windows): Remove.
	* gdb.c (main): Update.
	* main.c (captured_main, gdb_main): Update.
	* main.h (struct captured_main_args) <use_windows>: Remove.
	* top.c (use_windows): Remove.
remove obsolete declaration

deprecated_core_resize_section_table is declared but never defined.
This patch removes the stale declaration.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* gdbcore.h (deprecated_core_resize_section_table): Remove.
daily update
PR symtab/16426

	* dwarf2read.c (dwarf2_get_dwz_file): Call gdb_bfd_record_inclusion.
	(try_open_dwop_file): Ditto.
	* gdb_bfd.c: #include "vec.h".
	(bfdp): New typedef.
	(struct gdb_bfd_data): New member included_bfds.
	(gdb_bfd_unref): Unref all included bfds.
	(gdb_bfd_record_inclusion): New function.
	* gdb_bfd.h (gdb_bfd_record_inclusion): Declare.
Use bitpos and type to lookup a gdb.Field object when its name is 'None'.

	PR python/15464
	PR python/16113
	* valops.c (value_struct_elt_bitpos): New function
	* py-type.c (convert_field): Set 'name' attribute of a gdb.Field
	object to 'None' if the field name is an empty string ("").
	* python/py-value.c (valpy_getitem): Use 'bitpos' and 'type'
	attribute to look for a field when 'name' is 'None'.
	(get_field_type): New function

	testsuite/
	* gdb.python/py-type.c: Enhance test case.
	* gdb.python/py-value-cc.cc: Likewise
	* gdb.python/py-type.exp: Add new tests.
	* gdb.python/py-value-cc.exp: Likewise