Linker foreign output format support for PowerPC64 ELFv2

Makes the ld srec tests pass.  Uses a horrible scan through symbols to
find ELF fields for symbol definitions, but the generic linker doesn't
offer anything better.  Might be slow.  Anyway, sane people will link
to ELF output then objcopy to convert formats.

	* elf64-ppc.c (abiversion, set_abiversion): Move earlier.
	(ppc64_elf_branch_reloc): Adjust addend for ELFv2 local offset.
	(ppc64_elf_set_toc): Set ".TOC." symbol value when using
	generic linker.
	(ppc64_elf_relocate_section): Disable ELFv2 function entry
	optimisation when --traditional-format.
Don't include sys/param.h

sys/param.h on recent versions of powerpc glibc ends up including
asm/elf.h via asm/sigcontex.h.  asm/elf.h defines R_PPC_* and R_PPC64_*
macros, which clash with our include/elf/ppc.h and include/elf/ppc64.h.
It turns out that no current source uses LD_PATHMAX, so there is no
need for limits.h or sys/param.h, except for one occurrence of UINT_MAX.
I don't have a quarrel with limits.h, but it seems unnecessary just
for UINT_MAX.

	* sysdep.h: Don't include limits.h and sys/param.h.  Don't
	include unistd.h twice.
	(LD_PATHMAX): Don't define.
	* ldlang.c (lang_common): Don't use UINT_MAX.
Add symbols for global entry stub, and report stats

The undefined function symbols (with non-zero value) on global entry
stubs are discarded by objdump when disassembling, so give objdump
another symbol to mark the stubs.

Also fixes a couple of bugs:
- entry_section was set to .opd for ELFv2, which meant a hard error
  rather than a warning when _start wasn't defined.
- global entry stubs were not built if they were the only type of
  stub in an executable.

bfd/
	* elf64-ppc.c (ppc_stub_type): Add ppc_stub_global_entry.
	(struct ppc_link_hash_table): Increase size of stub_count array.
	(build_global_entry_stubs): Emit symbol on global entry stub.
	(ppc64_elf_build_stubs): NULL check htab->brlt.  Add global entry
	stub stats.
ld/
	* emultempl/ppc64elf.em (stub_added): Delete.
	(gld${EMULATION_NAME}_finish): Call ppc64_elf_build_stubs even when
	none of the usual stubs have been added.  Only change entry_section
	for ELFv1.
Reorganise struct bfd

for better packing.  Removes a field and a flag that are never set.

bfd/
	* bfd.c (struct bfd): Reorganise for better packing.  Delete
	"ifd" field.  Make "format", "direction" and "flags" bitfields.
	(HAS_LOAD_PAGE): Delete, renumber following flags.
	* bfd-in2.h: Regenerate.
	* coff-tic4x.c: Remove HAS_LOAD_PAGE from extra flags in target vecs.
binutils/
	* objdump.c (dump_bfd_header): Don't print HAS_LOAD_PAGE.
use cmd_sfunc_ftype and cmd_cfunc_ftype more

This patch changes a few more spots to use either cmd_sfunc_ftype or
cmd_cfunc_ftype, as appropriate.  This is a bit cleaner.

Tested by rebuilding.

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

	* breakpoint.c (add_catch_command): Use cmd_sfunc_ftype.
	* breakpoint.h (add_catch_command): Use cmd_sfunc_ftype.
	* cli/cli-decode.c (cmd_cfunc_eq, add_cmd, add_prefix_cmd)
	(add_abbrev_prefix_cmd, add_info, add_com): Use cmd_cfunc_ftype.
	* command.h (cmd_cfunc_ftype): Move earlier.
	(add_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, cmd_cfunc_eq)
	(add_com, add_info): Use cmd_cfunc_ftype.
Handle volatile array types in dwarf2read.c.

read_tag_const_type propagates the cv-qualifier to the array element type,
but read_tag_volatile_type didn't. Make sure that both cv-qualifiers that
apply to array types are handled the same.

gdb/ChangeLog

	* dwarf2read.c (add_array_cv_type): New function.
	(read_tag_const_type): Call add_array_cv_type for TYPE_CODE_ARRAY.
	(read_tag_volatile_type): Likewise.

gdb/testsuite/ChangeLog

	* gdb.base/constvars.c (violent, violet, vips, virgen, vulgar,
	vulture, vilify, villar): New volatile array constants.
	(vindictive, vegetation): New const volatile array constants.
	* gdb.base/volatile.exp: Test volatile and const volatile array
	types.
daily update
Set DF_STATIC_TLS for PIEs

If we can dlopen an object then DF_STATIC_TLS is relevant.

	* elf32-ppc.c (ppc_elf_check_relocs): Set DF_STATIC_TLS for PIEs too.
	* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
Remove unused Linux libthread_db callbacks

gdb/proc-service.c includes several libthread_db callbacks that do not
exist in gdb/gdbserver/proc-service.c.  Other than in proc_service.h,
there is no reference to any of these callbacks in any revision of
nptl_db or linuxthreads_db in glibc's git repo so it seems likely that
these functions have never been called.  This commit removes them.

gdb/
2014-07-02  Gary Benson  <gbenson@redhat.com>

	* proc-service.c (ps_xfer_memory): Update comment.
	(ps_pstop): Remove unused function.
	(ps_pcontinue): Likewise.
	(ps_lstop): Likewise.
	(ps_lcontinue): Likewise.
	(ps_lgetxregsize): Likewise.
	(ps_lgetxregs): Likewise.
	(ps_lsetxregs): Likewise.
	(ps_plog): Likewise.
	(ps_ptread): Likewise.
	(ps_ptwrite): Likewise.
Taking an undefined function's address in an executable

doesn't always mean you need to define a function symbol on plt code.
If all references are in read-write sections, then using dynamic relocs
is OK.

bfd/
	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Clear
	pointer_equality_needed when !readonly_dynrelocs.
	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
ld/testsuite/
	* ld-powerpc/ambiguousv1.d: Match symbol table too.
	* ld-powerpc/ambiguousv2.d: Likewise.
	* ld-powerpc/ambiguousv1b.d: New.
	* ld-powerpc/ambiguousv2b.d: New.
	* ld-powerpc/powerpc.exp: Run new tests.
This testcase currently does not handle powerpc branches. It kinda
does in a way, because the arm/aarch64 branch instruction is the
same as powerpc's, but the target triplet pattern is not there.

In summary, the testcase fails to locate the branch offset and causes
a failure and the early termination of the test.

The following patch adds a separate conditional block for powerpc (to keep
things organized), allowing the testcase to continue.

2014-07-02  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.trace/entry-values.exp: Handle powerpc-specific branch
	instruction.
2014-07-02  Jing Yu  <jingyu@google.com>

    Initial patch to enable gold aarch64 backend.

    This patch is just a skeleton which almost does nothing.
    It does not support ILP32 now.

    gold/ChangeLog:
	* aarch64.cc: New file
	* Makefile.am (TARGETSOURCES): Add aarch64.cc
	(ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
	* Makefile.in: Regenerate.
	* configure.tgt: Add entries for aarch64*.
	* configure.ac:  Likewise.
	* configure: Likewise.

    elfcpp/ChangeLog:
	* aarch64.h: New file. New enums for aarch64-elf64 relocations.
	* elfcpp.h (EM_AARCH64, SHT_AARCH64_ATTRIBUTES, PT_AARCH64_ARCHEXT,
	PT_AARCH64_UNWIND): New enum constant.
daily update
Reload --as-needed libraries inside groups

When a shared library appears within --start-group/--end-group ld may
only discover a need for loading the library on the second or
subsequent pass over archive libraries, as more objects are extracted.

ld/
	PR 17068
	* ldlang.c (load_symbols): Always check flags.reload.
	(open_input_bfds): Always reload --as-needed shared libraries,
	not just when rescanning.
	* ldlang.h (struct lang_input_statement_flags): Update reload comment.
	* plugin.c (plugin_should_reload): Assume shared library arg.
	* plugin.h (plugin_should_reload): Update comment.
ld/testsuite
	* ld-elf/pr17068.s: New.
	* ld-elf/pr17068a.s: New.
	* ld-elf/pr17068b.s: New.
	* ld-elf/pr17068c.s: New.
	* ld-elf/pr17068d.s: New.
	* ld-elf/pr17068e.s: New.
	* ld-elf/pr17068ez.s: New.
	* ld-elf/elf.exp: Run new test.
Update email address in MAINTAINERS list.
Clarify doc on addr2line output.

binutils/
	* doc/binutils.texi: Clarify addr2line output.
Assign 'targerr' instead of 'targ' to gdb_stdtargerr.
daily update
Update gold POTFILES.in

for recent aarch64 and mips support.

	* po/POTFILES.in: Regenerate
Use modern AC_INIT in configure.in

This removes usage of the obsolete AC_INIT and AM_INIT_AUTOMAKE in all
binutils configure.in files.  The BFD version is now in bfd/version.m4
rather than bfd/configure.in, which allows automake to automatically
track this dependency.

bfd/
	* version.m4: New file.
	* configure.in: Include version.m4.
	(AC_INIT): Update.
	* Makefile.am (RELEASE): Delete.
	(bfdver.h): Depend on development.sh, use instead of RELEASE.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
opcodes/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
binutils/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
gas/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* configure.com: Get bfd version from bfd/version.m4.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
gprof/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
ld/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.