daily update
daily update
2014-09-29  Terry Guo  <terry.guo@arm.com>

        * as.c (create_obj_attrs_section): Move it and call it from ...
        * write.c (create_obj_attrs_section): ... here.
        (subsegs_finish_section): Refactored.
Fix build for OLD_FREEBSD_ABI_LABEL

	PR ld/17440
	* elf32-i386.c (elf_i386_fbsd_post_process_headers): Fix build
	for OLD_FREEBSD_ABI_LABEL.
Fix library-list.dtd -> library-list-svr4.dtd

commit 2268b414f486239cbcc0f756f157c3e03599efac
added file "features/library-list-svr4.dtd" but the added code uses
"library-list.dtd" instead.

Curiously after changing for a test s/name/nXme/ in the DTD making the
gdbserver output non-conforming there is no warning or regression seen (tested
gdb.base/shlib-call.exp, using_xfer is still 1).  I did not check more why the
DTD conformance verification does not work.

gdb/ChangeLog
2014-09-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* solib-svr4.c (svr4_parse_libraries): Use "library-list-svr4.dtd".
daily update
2014-09-29  Sriraman Tallam  <tmsriram@google.com>

	* options.h (--pic-executable): Add negative to alias to -no-pie.
Skip dlopen-libpthread.exp in cross testing

I see the following fails on arm-linux-gnueabi,

result of ldd build-git/arm/gdb/testsuite/gdb.threads/dlopen-libpthread.so is 1
output of ldd build-git/arm/gdb/testsuite/gdb.threads/dlopen-libpthread.so is not a dynamic executable
child process exited abnormally
FAIL: gdb.threads/dlopen-libpthread.exp: ldd dlopen-libpthread.so
FAIL: gdb.threads/dlopen-libpthread.exp: ldd dlopen-libpthread.so output contains libs

the test script invokes ldd (on host) for the target libraries, which
is wrong.  ldd can't be cross because it invokes dynamic linker with
LD_TRACE_LOADED_OBJECTS and gets the dependent libraries.  My first
reaction to this problem is to execute ld.so on the target (like
remote_exec target).  When I start to hack proc build_executable_own_libs,
I find it has assumptions here and there that the native testing is
performed.  Then I check the callers of build_executable_own_libs,
and they are all skipped if isnative is false.  It is reasonable to do
the same in dlopen-libpthread.exp too.

gdb/testsuite:

2014-09-30  Yao Qi  <yao@codesourcery.com>

	* gdb.threads/dlopen-libpthread.exp: Skip it if isnative is
	false.
Error in build_executable_own_libs for non-native target

gdb/testsuite:

2014-09-30  Yao Qi  <yao@codesourcery.com>

	* lib/prelink-support.exp (build_executable_own_libs): Error if
	the target isn't native.
Replace 'core_regset_sections' by iterator method

The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method.  Overall, this reduces the code a bit, and it allows for more
flexibility.

gdb/ChangeLog:

	* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
	(amd64_linux_iterate_over_regset_sections): New.
	(amd64_linux_init_abi_common): Don't install the regset section
	list, but the new iterator in gdbarch.
	* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
	(arm_linux_vfp_regset_sections): Remove.  Move combined logic...
	(arm_linux_iterate_over_regset_sections): ...here.  New function.
	(arm_linux_init_abi): Set iterator instead of section list.
	* corelow.c (get_core_registers_cb): New function, logic moved
	from...
	(get_core_registers): ...loop body here.  Use new iterator method
	instead of walking through the regset section list.
	* gdbarch.sh: Remove 'core_regset_sections'.  New method
	'iterate_over_regset_sections'.  New typedef
	'iterate_over_regset_sections_cb'.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Likewise.
	* i386-linux-tdep.c (i386_linux_regset_sections)
	(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
	Remove.
	(i386_linux_iterate_over_regset_sections): New.
	(i386_linux_init_abi): Don't choose a regset section list, but
	install new iterator in gdbarch.
	* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
	(linux_collect_regset_section_cb): New function, logic moved
	from...
	(linux_collect_thread_registers): ...loop body here.  Use iterator
	method instead of walking through list.
	(linux_make_corefile_notes_1): Check for presence of iterator
	method instead of regset section list.
	* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
	(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
	(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
	(ppc64_linux_fp_regset_sections): Remove.  Move combined logic...
	(ppc_linux_iterate_over_regset_sections): ...here.  New function.
	(ppc_linux_init_abi): Don't choose from above regset section
	lists, but install new iterator in gdbarch.
	* regset.h (struct core_regset_section): Remove.
	* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
	have_linux_v1, have_linux_v2, and have_tdb.
	(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
	(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
	(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
	(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
	(s390x_linux64v2_regset_sections): Remove.  Move combined logic...
	(s390_iterate_over_regset_sections): ...here.  New function.  Use
	new tdep fields.
	(s390_gdbarch_init): Set new tdep fields.  Don't choose from above
	regset section lists, but install new iterator.
Add 'regset' parameter to 'iterate_over_regset_sections_cb'

This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.

This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface.  Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.

gdb/ChangeLog:

	* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
	parameter.
	* gdbarch.h: Regenerate.
	* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
	iterator.
	(get_core_register_section): Add parameter 'regset' and use it, if
	set.  Add parameter 'min_size' and verify the bfd section size
	against it.
	(get_core_registers_cb): Add parameter 'regset' and pass it to
	get_core_register section.  For the "standard" register sections
	".reg" and ".reg2", set an appropriate default for human_name.
	(get_core_registers): Don't abort when the gdbarch has an iterator
	but no regset_from_core_section.  Add NULL/0 for parameters
	'regset'/'min_size' in calls to get_core_register_section.
	* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
	'regset' and use it instead of calling the
	regset_from_core_section gdbarch method.
	* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
	* i386-tdep.c (i386_supply_xstateregset)
	(i386_collect_xstateregset, i386_xstateregset): Moved to
	i386-linux-tdep.c.
	(i386_regset_from_core_section): Drop handling for .reg-xfp and
	.reg-xstate.
	(i386_gdbarch_init): Set tdep field 'fpregset'.  Enable generic
	core file support only if the regset iterator hasn't been set.
	* i386-linux-tdep.c (i386_linux_supply_xstateregset)
	(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
	Moved from i386-tdep.c and renamed to *_linux*.
	(i386_linux_iterate_over_regset_sections): Add regset parameter to
	each callback invocation.  Allow any .reg-xstate size when reading
	from a core file.
	* amd64-tdep.c (amd64_supply_xstateregset)
	(amd64_collect_xstateregset, amd64_xstateregset): Moved to
	amd64-linux-tdep.c.
	(amd64_regset_from_core_section): Remove.
	(amd64_init_abi): Set new tdep field 'fpregset'.  No longer
	install an amd64-specific regset_from_core_section gdbarch method.
	* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
	(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
	Moved from amd64-tdep.c and renamed to *_linux*.
	(amd64_linux_iterate_over_regset_sections): Add regset parameter
	to each callback invocation.  Allow any .reg-xstate size when
	reading from a core file.
	* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
	(arm_linux_iterate_over_regset_sections): Add regset parameter to
	each callback invocation.
	(arm_linux_init_abi): No longer set the regset_from_core_section
	gdbarch method.
	* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
	(ppc_linux_iterate_over_regset_sections): Add regset parameter to
	each callback invocation.
	(ppc_linux_init_abi): No longer set the regset_from_core_section
	gdbarch method.
	* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
	gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
	(s390_regset_from_core_section): Remove.
	(s390_iterate_over_regset_sections): Add regset parameter to each
	callback invocation.
	(s390_gdbarch_init): No longer set the regset_from_core_section
	gdbarch method.  Drop initialization of deleted tdep fields.
Add multi-arch capable 'fbsd_make_corefile_notes' variant

This creates a new version of the FreeBSD core file note generation
logic in the new target-dependent file "fbsd-tdep.c".  The new version
is mostly copied from "fbsd-nat.c", but uses the iterator instead of
regset_from_core_section and defines fbsd_make_corefile_notes as a
gdbarch method instead of a target method.

Consecutive architecture-dependent changes exploit the new version,
migrating away from the target method.  When all FreeBSD targets are
changed, the target method can go away.

gdb/ChangeLog:

	* fbsd-tdep.c: New file.
	* fbsd-tdep.h: New file.
	* Makefile.in (ALL_TARGET_OBS): Add fbsd-tdep.o.
	(HFILES_NO_SRCDIR): Add fbsd-tdep.h.
	(ALLDEPFILES): Add fbsd-tdep.c.
AARCH64: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'

Don't define the 'regset_from_core_section' method, but the iterator
method instead.  This slightly reduces the code and enables non-native
use of the 'generate-core-file' command.

Also, when all instances of 'regset_from_core_section' are replaced,
it can be dropped from the gdbarch interface.

gdb/ChangeLog:

	* aarch64-linux-tdep.c (aarch64_linux_regset_from_core_section):
	Remove.
	(aarch64_linux_iterate_over_regset_sections): New.
	(aarch64_linux_init_abi): Adjust gdbarch initialization.
ALPHA: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'

Don't define the 'regset_from_core_section' method, but the iterator
method instead.  Do this for GNU/Linux- as well as
Net/OpenBSD-targets.  In the case of GNU/Linux this should enable
non-native use of the 'generate-core-file' command.

gdb/ChangeLog:

	* alpha-linux-tdep.c (alpha_linux_regset_from_core_section): Remove.
	(alpha_linux_iterate_over_regset_sections): New.
	(alpha_linux_init_abi): Adjust gdbarch initialization.
	* alphabsd-tdep.h (alphanbsd_regset_from_core_section): Remove
	prototype.
	(alphanbsd_iterate_over_regset_sections): New prototype.
    	* alphafbsd-tdep.c (alphafbsd_init_abi): Add comment for missing
    	fbsd_init_abi invocation.
	* alphanbsd-tdep.c (alphanbsd_supply_gregset): Move below
	alphanbsd_aout_supply_gregset.  Invoke the latter for the
	appropriate size.
	(alphanbsd_aout_gregset): Remove.
	(alphanbsd_regset_from_core_section): Remove.
	(alphanbsd_iterate_over_regset_sections): New.
	(alphanbsd_init_abi): Adjust gdbarch initialization.
	* alphaobsd-tdep.c (alphaobsd_init_abi): Likewise.
ARM: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'

For ARM BSD targets, don't define the gdbarch method
'regset_from_core_section', but the iterator method instead.

gdb/ChangeLog:

	* arm-tdep.h (armbsd_regset_from_core_section): Remove prototype.
	(armbsd_iterate_over_regset_sections): New prototype.
	* armbsd-tdep.c (armbsd_regset_from_core_section): Remove.
	(armbsd_iterate_over_regset_sections): New.
	* armobsd-tdep.c (armobsd_init_abi): Adjust gdbarch
	initialization.
FRV: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'

For FR-V GNU/Linux targets, no longer define the gdbarch method
'regset_from_core_section', but the iterator method instead.

gdb/ChangeLog:

	* frv-linux-tdep.c (frv_linux_regset_from_core_section): Remove.
	(frv_linux_iterate_over_regset_sections): New.
	(frv_linux_init_abi): Adjust gdbarch initialization.
HPPA: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'

For HP PA-RISC targets, no longer define the gdbarch method
'regset_from_core_section', but the iterator method instead.

gdb/ChangeLog:

	* hppa-hpux-tdep.c (hppa_hpux_regset_from_core_section): Remove.
	(hppa_hpux_iterate_over_regset_sections): New.
	(hppa_hpux_init_abi): Adjust gdbarch initialization.
	* hppa-linux-tdep.c (hppa_linux_regset_from_core_section): Remove.
	(hppa_linux_iterate_over_regset_sections): New.
	(hppa_linux_init_abi): Adjust.
	* hppanbsd-tdep.c (hppaobsd_regset_from_core_section): Remove.
	(hppanbsd_iterate_over_regset_sections): New.
	(hppanbsd_init_abi): Adjust.
	* hppaobsd-tdep.c (hppaobsd_regset_from_core_section): Remove.
	(hppaobsd_iterate_over_regset_sections): New.
	(hppaobsd_init_abi): Adjust.
X86: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'

For all I386 and AMD64 targets, replace all occurrences of
regset_from_core_section by the iterator method.

gdb/ChangeLog:

	* amd64obsd-tdep.c (amd64obsd_regset_from_core_section): Remove.
	(amd64obsd_iterate_over_regset_sections): New.
	(amd64obsd_core_init_abi): Adjust gdbarch initialization.
	* i386-cygwin-tdep.c (i386_windows_regset_from_core_section):
	Remove.
	(i386_cygwin_init_abi): Clear tdep->sizeof_fpregset.  Drop
	regset_from_core_section initialization.
	* i386-tdep.c (i386_regset_from_core_section): Remove.
	(i386_iterate_over_regset_sections): New.
	(i386_gdbarch_init): Adjust gdbarch initialization.
	* i386-tdep.h (i386_regset_from_core_section): Remove prototype.
	(i386_iterate_over_regset_sections): New prototype.
	* i386obsd-tdep.c (i386obsd_aout_regset_from_core_section):
	Remove.
	(i386obsd_aout_iterate_over_regset_sections): New.
	(i386obsd_aout_init_abi): Adjust gdbarch initialization.
	* configure.tgt (gdb_target_obs): Add fbsd-tdep.o for all x86 FreeBSD
	targets.
	* amd64fbsd-tdep.c (fbsd-tdep.h): Include.
	(amd64fbsd_init_abi): Call fbsd_init_abi.
	* i386fbsd-tdep.c (fbsd-tdep.h): Include.
	(i386fbsd4_init_abi): Call fbsd_init_abi.
	* amd64fbsd-nat.c (_initialize_amd64fbsd_nat): No longer set
	target method 'make_corefile_notes'.
	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
M32R: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'

For m32r GNU/Linux targets, don't define the gdbarch method
'regset_from_core_section', but the iterator method instead.

gdb/ChangeLog:

	* m32r-linux-tdep.c (M32R_LINUX_GREGS_SIZE): New macro.
	(m32r_linux_regset_from_core_section): Remove.
	(m32r_linux_iterate_over_regset_sections): New.
	(m32r_linux_init_abi): Adjust gdbarch initialization.
M68K: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'

For m68k BSD and GNU/Linux targets, no longer define the gdbarch
method 'regset_from_core_section', but the iterator method instead.

gdb/ChangeLog:

	* m68kbsd-tdep.c (m68kbsd_regset_from_core_section): Remove.
	(m68kbsd_iterate_over_regset_sections): New.
	(m68kbsd_init_abi): Adjust gdbarch initialization.
	* m68klinux-tdep.c (m68k_linux_regset_from_core_section): Remove.
	(m68k_linux_iterate_over_regset_sections): New.
	(m68k_linux_init_abi): Adjust gdbarch initialization.