Merge GDB 7.6.50

Pulled in from:
ftp://sourceware.org/pub/gdb/snapshots/current/gdb-7.6.50.20131211.tar.bz2

Fixes included:
- reorder lines to move declarations to top of functions in gdb/amd-tdep.c
- new header includes in nacl-manifest.c
- target_gdbarch uses changed to target_gdbarch() as it's now a function
pointer

BUG=None
TEST=gdb_tests + debug_stub_tests
R=halyavin@google.com, eaeltsin@google.com, mcgrathr@chromium.org
diff --git a/ChangeLog b/ChangeLog
index f4fbf7e..f66f552 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,512 @@
+2013-11-23  Alan Modra  <amodra@gmail.com>
+
+	* config.sub, config.guess: Import from upstream.
+
+2013-11-07  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* Makefile.in: Regenerate.
+
+	* Makefile.tpl: Fix typo.
+	* Makefile.in: Regenerate partially.
+
+2013-11-04  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	* configure.ac: Added libcilkrts to noconfig list when C++ is not
+	supported.
+	* configure: Regenerated.
+
+2013-10-30  Jason Merrill  <jason@redhat.com>
+
+	* Makefile.tpl (STAGE1_CONFIGURE_FLAGS): Pass
+	--disable-build-format-warnings.
+
+2013-10-29  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	* Makefile.def: Add libcilkrts to target_modules.  Make libcilkrts
+	depend on libstdc++ and libgcc.
+	* configure: Regenerate.
+	* configure.ac: Added libcilkrts to target binaries.  Also, restrict
+	libcilkrts for POSIX and i*86, and x86_64 architectures.
+	* Makefile.in: Added libcilkrts related fields to support building it.
+
+2013-10-26  Jeff Law  <law@redhat.com>
+
+	* Makefile.def (target_modules): Remove libmudflap
+	(languages): Remove check-target-libmudflap).
+	* Makefile.in: Rebuilt.
+	* Makefile.tpl (check-target-libmudflap-c++): Remove.
+	* configure.ac (target_libraries): Remove target-libmudflap.
+	Remove checks which disabled libmudflap on some systems.
+	* configure: Rebuilt.
+	* libmudflap: Directory removed.
+
+2013-10-16  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure.ac: Update from GCC.
+	* configure: Regenerate.
+
+2013-10-15  Hans-Peter Nilsson  <hp@axis.com>
+
+	* src-release (do-proto-toplevel): Support subdir-path-prefixed
+	files in SUPPORT_FILES.
+	(SIM_SUPPORT_DIRS): New variable.
+	(sim.tar.bz2): New rule.
+
+2013-10-08  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure.ac: Update from GCC.
+	* configure: Regenerate.
+
+2013-10-01  Jeff Johnston  <jjohnstn@redhat.com>
+
+	* COPYING.NEWLIB: Update with new copyright.
+
+2013-09-21  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure.ac: Update from GCC.
+	* configure: Regenerate.
+
+2013-09-20  Alan Modra  <amodra@gmail.com>
+
+	* libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
+	ppc host match.  Support little-endian powerpc linux hosts.
+
+2013-08-16  Joel Brobecker  <brobecker@adacore.com>
+
+	* src-release (VER): When using $(TOOL)/common/create-version.sh,
+	strip the "-cvs" suffix from the version number if present.
+
+2013-08-12  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure.ac: Sync with GCC repo.
+	* Makefile.def: Ditto.
+	* configure: Regenerate.
+	* Makefile.in: Ditto.
+
+2013-07-22  Joel Brobecker  <brobecker@adacore.com>
+
+	* src-release (VER): Use $(TOOL)/common/create-version.sh
+	if it exists.
+
+2013-06-22  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* configure.ac (mips*-*-bsd*, mips*-*-ultrix*, mips*-*-osf*)
+	(mips*-*-ecoff*, mips*-*-pe*, mips*-*-irix* [v4 and earlier])
+	(mips*-*-lnews*, mips*-*-riscos*): Add gas and ld to noconfigdirs.
+	* configure: Regenerate.
+
+2013-06-01  George Thomas <george.thomas@atmel.com>
+
+	* include/opcode/avr.h: Rename AVR_ISA_XCH to AVR_ISA_RMW. Remove
+	from AVR_ISA_XMEGA and add new AVR_ISA_XMEGAU
+
+2013-05-06  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* COPYING.NEWLIB: Add Altera Corporation copyright.
+
+2013-04-29  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* config.guess: Update from config repo.
+	* config.sub: Ditto.
+
+2013-04-22  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* Makefile.def: Sync with GCC.
+	* Makefile.in: Regenerate.
+
+2013-04-22  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure.ac: Sync with GCC.
+	* configure: Regenerate.
+
+2013-03-22  Mike Frysinger  <vapier@gentoo.org>
+
+	* src-release (VER): Change bfd/configure.in sed to use the new
+	`bfd/configure --version` output.
+
+2013-02-15  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* configure.ac: Sync with GCC repo.
+	* configure: Ditto.
+
+2013-02-05  Ian Lance Taylor  <iant@google.com>
+
+	PR go/55969
+	* configure.ac: Disable libgo on some systems where it does not
+	work.
+	* configure: Rebuild.
+
+2013-02-05  Alan Modra  <amodra@gmail.com>
+
+	* configure: Regenerate after syncing config/.
+
+2013-01-15  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure.ac: Sync with GCC repo.
+	* configure: Ditto.
+	* Makefile.def: Ditto.
+	* Makefile.in: Ditto.
+
+2013-01-11  Joel Brobecker  <brobecker@adacore.com>
+
+	Sync with GCC, merge:
+
+	2013-01-09  Jason Merrill  <jason@redhat.com>
+
+	* .gitignore: Import from gdb repository.
+
+2013-01-11  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* config.sub: Update from config repo.
+
+2013-01-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* Makefile.tpl (BOOT_ADAFLAGS): Remove -gnata.
+	* Makefile.in: Regenerate.
+
+2013-01-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* Makefile.def (configure-gcc): Depend on all-gmp.
+	(all-gcc): Remove dependency on all-gmp.
+	* Makefile.in: Regenerated.
+
+2013-01-08  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* config.guess: Update from config repo.
+	* config.sub: Ditto.
+
+2013-01-07  Jeff Johnston  <jjohnstn@redhat.com>
+
+	* COPYING.LIBGLOSS: Remove license for mips/lsi33k-stub.h which no longer
+	exists and replace the new bfin license in its location.
+
+2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR gas/14899
+	* Makefile.def (dependencies): Make all-binutils, all-gprof,
+	all-ld and all-gold depend on all-gas.
+	* Makefile.in: Regenerated.
+
+2012-12-29  Ben Elliston  <bje@gnu.org>
+
+	* config.guess: Update to 2012-12-29 version.
+	* config.sub: Likewise.
+
+2012-12-20  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* Makefile.def (install-target-libgo): Depend on
+	install-target-libatomic. Merged from GCC repo.
+	* Makefile.in: Regenerate.
+
+2012-12-17  Jeff Johnston  <jjohnstn@redhat.com>
+
+	* COPYING.LIBGLOSS: Add license for bfin libgloss.
+
+2012-12-16  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* configure.ac (ENABLE_GOLD): Consider *-*-gnu* targets ELF.
+	* configure: Regenerate.
+
+2012-12-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* Makefile.def (target_modules): Add bootstrap=true and
+	raw_cxx=true to libsanitizer.
+	* configure.ac (bootstrap_target_libs): Add libsanitizer.
+	* Makefile.in: Regenerated.
+	* configure: Likewise.
+
+2012-12-08  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* config.sub: Merge from config repo.
+
+2012-11-30  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure.ac: Merge from GCC.
+	* Makefile.tpl: Ditto.
+	* Makefile.in: Ditto.
+	* configure: Ditto.
+
+2012-11-28  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure.ac (noconfigdirs): Merge from GCC.
+	* configure: Regenerate.
+
+2012-11-19  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* config.sub (arm): Merge from upstream: Handle armv[6-8] targets.
+
+2012-11-14  Roland McGrath  <mcgrathr@google.com>
+
+	* configure.ac (ENABLE_GOLD): Consider *-*-nacl* targets ELF.
+	* configure: Regenerate.
+
+2012-11-13  Richard Henderson  <rth@redhat.com>
+
+	* configure.ac: Move libsanitizer logic to subdirectory.
+	* configure: Regenerate.
+
+2012-11-13  Dodji Seketeli  <dodji@redhat.com>
+
+	* configure.ac: Enable libsanitizer just on x86 linux for now.
+	* configure: Re-generate.
+
+2012-11-13  David Edelsohn  <dje.gcc@gmail.com>
+
+	* configure.ac: Merge libquadmath sections.
+	* configure: Regenerate.
+
+2012-11-12  Wei Mi <wmi@google.com>
+
+	* configure.ac: Add libsanitizer to target_libraries.
+	* Makefile.def: Ditto.
+	* configure: Regenerate.
+	* Makefile.in: Regenerate.
+
+2012-11-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* configure: Regenerated.
+
+2012-11-03  Robert Mason  <rbmj@verizon.net>
+
+	* configure.ac: add --disable-libstdcxx configure option
+	and handle defaulted state only for VxWorks, ARM-wince-pe and AVR.
+
+2012-10-24  Corinna Vinschen  <corinna@vinschen.de>
+
+	* configure.ac (FLAGS_FOR_TARGET,target=cygwin): Fix for building
+	against Mingw64 w32api.
+	* configure: Regenerate.
+
+2012-10-23  Eric Botcazou  <ebotcazou@adacore.com>
+
+	PR bootstrap/54820
+	* configure.ac (have_static_libs): Force 'no' for GCC version < 4.5.
+	* configure: Regenerate.
+
+2012-10-22  Eric Botcazou  <ebotcazou@adacore.com>
+
+	PR bootstrap/54820
+	* Makefile.tpl (STAGE1_FLAGS_TO_PASS): New variable.
+	(all-[+prefix+][+module+]): Pass stage1_args to sub-makes.
+	(all-stage[+id+]-[+prefix+][+module+]): Likewise, if prev is false.
+	(clean-stage[+id+]-[+prefix+][+module+]): Likewise, if prev is false.
+	(host_modules): Set stage1_args to STAGE1_FLAGS_TO_PASS.
+	* Makefile.in: Regenerate.
+	* configure.ac (have_static_libs): New variable and associated check.
+	(stage1-ldflags): Move to after stage1_libs and set to -static-libstdc++
+	-static-libgcc if stage1_libs is empty and have_static_libs is yes.
+	* configure: Regenerate.
+
+2012-10-10  David Holsgrove  <david.holsgrove@xilinx.com>
+
+	* config.guess, config.sub: Include updated version from
+	config-patches.  Adds microblaze little endian support.
+
+2012-09-28  Ian Lance Taylor  <iant@google.com>
+
+	* Makefile.def: Make all-target-libgo depend on
+	all-target-libbacktrace.
+	* Makefile.in: Rebuild.
+
+2012-09-26  Ian Lance Taylor  <iant@google.com>
+
+	* Makefile.def: Make all-gcc depend on all-libbacktrace.
+	* Makefile.in: Rebuild.
+
+2012-09-06  Diego Novillo  <dnovillo@google.com>
+
+	* configure.ac: Bump minimum GMP version to 4.2.3.
+	* configure: Re-generate.
+
+2012-09-05  Georg-Johann Lay  <avr@gjlay.de>
+
+	PR target/54461
+	* configure.ac (noconfigdirs,target=avr-*-*): Add target-newlib,
+	target-libgloss if not configured --with-avrlibc=no.
+	* configure: Regenerate.
+
+2012-09-04  Jason Merrill  <jason@redhat.com>
+
+	* configure.ac: Fix --enable-languages=all.
+
+2012-09-03  Richard Guenther  <rguenther@suse.de>
+
+	PR bootstrap/54138
+	* configure.ac: Re-organize ISL / CLOOG checks to allow
+	disabling with either --without-isl or --without-cloog.
+	* configure: Regenerated.
+
+2012-09-03  Georg-Johann Lay  <avr@gjlay.de>
+
+	* configure.ac (noconfigdirs,target=avr): Add target-libquadmath.
+	* configure: Regenerate.
+
+2012-09-21  Steve Ellcey  <sellcey@mips.com>
+
+	* configure.ac: Add mips*-mti-elf* target.
+	* configure: Regenerate.
+
+2012-09-19  Ian Lance Taylor  <iant@google.com>
+
+	* configure.ac (host_libs): Add libbacktrace.
+	(target_libraries): Add libbacktrace.
+	* Makefile.def (host_modules): Add libbacktrace.
+	(target_modules): Likewise.
+	* configure, Makefile.in: Rebuild.
+
+2012-09-15  Jiong Wang  <jiwang@tilera.com>
+
+	* configure.ac (ENABLE_GOLD): support tilegx*
+	* configure: rebuild
+
+2012-09-14  David Edelsohn  <dje.gcc@gmail.com>
+
+	PR target/38607
+	Merge upstream change.
+	* libtool.m4 (_LT_COMPILER_PIC): Add -fPIC to GCC and GXX for AIX.
+
+	* configure.ac: Add target-libquadmath to noconfigdirs for AIX.
+	Add libgomp*.o to compare_exclusions for AIX.
+	* configure: Regenerate.
+
+2012-08-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/4970
+	* Makefile.def (host_modules): Rmove lib_path=.libs from bfd
+	and opcodes.
+	* Makefile.in: Regenerated.
+
+2012-08-14   Diego Novillo  <dnovillo@google.com>
+
+	Merge from cxx-conversion branch.
+
+	* Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove
+	POSTSTAGE1_CONFIGURE_FLAGS.
+	* Makefile.in: Regenerate.
+	* configure.ac (ENABLE_BUILD_WITH_CXX): Remove.  Update all users.
+	Force C++ when bootstrapping.
+	* configure: Regenerate.
+
+2012-07-06  Richard Guenther  <rguenther@suse.de>
+
+	* Makefile.def (cloog): Pass $(HOST_GMPINC) and $(HOST_ISLINC)
+	as CPPFLAGS, pass path to built gmp as LDFLAGS, always use
+	--with-gmp=system.
+	* Makefile.in: Regenerated.
+	* configure: Likewise.
+
+2012-07-06  Richard Guenther  <rguenther@suse.de>
+
+	* configure.ac (extra_isl_gmp_configure_flags): Initialize and subst.
+	* Makefile.def (isl): Use extra_isl_gmp_configure_flags and
+	supply V=1 as extra_make_flags.
+	* configure: Regenerated.
+	* Makefile.in: Likewise.
+
+2012-07-03  Richard Guenther  <rguenther@suse.de>
+
+	* Makfile.def (isl): Remove not necessary extra_exports and
+	extra_make_flags.
+	(cloog): Use $$CPPFLAGS instead of ${CPPFLAGS}.
+	* Makefile.in: Regenerated.
+
+2012-07-03  Richard Guenther  <rguenther@suse.de>
+
+	* Makefile.def (cloog): Add V=1 to extra_make_flags.
+	* configure.ac: If either the ISL or the CLooG check failed
+	do not try to build in-tree versions.
+	* Makefile.in: Regenerated.
+	* configure: Regenerated.
+
+2012-07-02  Richard Guenther  <rguenther@suse.de>
+	Michael Matz  <matz@suse.de>
+	Tobias Grosser <tobias@grosser.es>
+	Sebastian Pop <sebpop@gmail.com>
+
+	* Makefile.def: Add ISL host module, remove PPL host module.
+	Adjust ClooG host module to use the proper ISL.
+	* Makefile.tpl: Pass ISL include flags instead of PPL ones.
+	* configure.ac: Include config/isl.m4.  Add ISL host library,
+	remove PPL.  Remove PPL configury, add ISL configury, adjust
+	ClooG configury.
+	* Makefile.in: Regenerated.
+	* configure: Likewise.
+
+2012-07-02  Richard Guenther  <rguenther@suse.de>
+
+	Merge from graphite branch
+	2011-07-21  Tobias Grosser  <tobias@grosser.es>
+
+	* configure: Regenerated.
+	* config/cloog.m4: Remove support for CLooG-ppl and CLooG-parma,
+	both cloog.org and legacy versions. The only supported version will
+	be CLooG with the isl backend.
+
+	2011-07-21  Tobias Grosser  <tobias@grosser.es>
+
+	* configure: Regenerated.
+	* configure.ac: Require cloog isl 0.17.0
+
+	2011-07-21  Tobias Grosser  <tobias@grosser.es>
+
+	* configure: Regenerated.
+	* config/cloog.m4: Do not define CLOOG_ORG
+
+2012-06-29  Steven Bosscher  <steven@gcc.gnu.org>
+
+	* configure.ac: Skip C if explicitly selected.
+	* configure: Regenerate.
+
+2012-06-28  Christophe Lyon <christophe.lyon@st.com>
+
+	* configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Make sure
+	they contain -O2.
+	* configure: Regenerate.
+
+2012-06-20  Jason Merrill  <jason@redhat.com>
+
+	* Makefile.tpl (check-target-libgomp-c++): New.
+	(check-target-libitm-c++): New.
+	* Makefile.def (c++): Add them.
+	* Makefile.in: Regenerate.
+
+2012-05-16  Olivier Hainque  <hainque@adacore.com>
+
+	* Makefile.tpl (gcc-no-fixedincludes): Rename into ...
+	(gcc-install-no-fixedincludes): Now forwarder to local target in gcc/
+	(install-no-fixedincludes): Adjust accordingly.
+	* Makefile.in: Regenerate.
+
+2012-05-09  Nick Clifton  <nickc@redhat.com>
+	    Paul Smith  <psmith@gnu.org>
+
+	PR bootstrap/50461
+	* configure.ac (mpfr-dir): When using in-tree MPFR sources
+	allow for the fact that from release v3.1.0 of MPFR the source
+	files were moved into a src sub-directory.
+	* configure: Regenerate.
+
+2012-05-07  Janne Blomqvist  <jb@gcc.gnu.org>
+
+	* configure.ac: Bump minimum MPFR version to 2.4.0.
+	* configure: Regenerated.
+
+2012-05-01  Richard Henderson  <rth@redhat.com>
+
+	* Makefile.def (libatomic): New target_module.
+	* configure.ac (target_libraries): Add libatomic.
+	(noconfigdirs): Check if libatomic is supported.
+	* Makefile.in, configure: Rebuild.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	Merge upstream change
+	* libtool.m4 (_LT_ENABLE_LOCK): Support x32.
+
+2011-11-21  Andreas Tobler  <andreast@fgznet.ch>
+
+	* libtool.m4: Additional FreeBSD 10 fixes.
+
 2012-06-28  Christophe Lyon <christophe.lyon@st.com>
 
 	* configure.ac (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Make sure
@@ -118,7 +627,7 @@
 
 	* config.sub: Import these changes from the config project:
 
-	2011-10-08  Joern Rennecke <joern.rennecke@embecosm.com>
+	2011-10-08  Joern Rennecke  <joern.rennecke@embecosm.com>
 	    Ben Elliston  <bje@gnu.org>
 
 	* config.sub (epiphany): New.
diff --git a/Makefile.def b/Makefile.def
index 9e41ff5..32296d1 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -4,8 +4,7 @@
 // Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
 // This file was originally written by Nathanael Nerode.
 //
-//   Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-//   Free Software Foundation
+//   Copyright 2002-2013 Free Software Foundation
 //
 // This file is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -32,8 +31,8 @@
 build_modules= { module= texinfo; };
 build_modules= { module= fixincludes; };
 
-host_modules= { module= bfd; lib_path=.libs; bootstrap=true; };
-host_modules= { module= opcodes; lib_path=.libs; bootstrap=true; };
+host_modules= { module= bfd; bootstrap=true; };
+host_modules= { module= opcodes; bootstrap=true; };
 host_modules= { module= binutils; bootstrap=true; };
 host_modules= { module= bison; no_check_cross= true; };
 host_modules= { module= cgen; };
@@ -61,13 +60,14 @@
 host_modules= { module= mpc; lib_path=.libs; bootstrap=true;
 		extra_configure_flags='--disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@';
 		no_install= true; };
-host_modules= { module= ppl; lib_path=src/.libs; bootstrap=true;
-		extra_configure_flags='--disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/';
+host_modules= { module= isl; lib_path=.libs; bootstrap=true;
+		extra_configure_flags='--disable-shared @extra_isl_gmp_configure_flags@';
+		extra_make_flags='V=1';
 		no_install= true; };
 host_modules= { module= cloog; lib_path=.libs; bootstrap=true;
-		extra_configure_flags='--disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl';
-		extra_exports='CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; ';
-		extra_make_flags='CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"';
+		extra_configure_flags='--disable-shared --with-gmp=system --with-bits=gmp --with-isl=system';
+		extra_exports='CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; ';
+		extra_make_flags='CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1';
 		no_install= true; };
 host_modules= { module= libelf; lib_path=.libs; bootstrap=true;
 		extra_configure_flags='--disable-shared';
@@ -79,6 +79,7 @@
                 missing=mostlyclean; };
 host_modules= { module= itcl; };
 host_modules= { module= ld; bootstrap=true; };
+host_modules= { module= libbacktrace; bootstrap=true; };
 host_modules= { module= libcpp; bootstrap=true; };
 host_modules= { module= libdecnumber; bootstrap=true; };
 host_modules= { module= libgui; };
@@ -116,10 +117,20 @@
 		   bootstrap=true;
 		   lib_path=src/.libs;
 		   raw_cxx=true; };
-target_modules = { module= libmudflap; lib_path=.libs; };
+target_modules = { module= libsanitizer;
+		   bootstrap=true;
+		   lib_path=.libs;
+		   raw_cxx=true; };
+target_modules = { module= libvtv;
+		   bootstrap=true;
+		   lib_path=.libs;
+		   raw_cxx=true; };
+target_modules = { module= libcilkrts;
+		   lib_path=.libs; };
 target_modules = { module= libssp; lib_path=.libs; };
 target_modules = { module= newlib; };
 target_modules = { module= libgcc; bootstrap=true; no_check=true; };
+target_modules = { module= libbacktrace; };
 target_modules = { module= libquadmath; };
 target_modules = { module= libgfortran; };
 target_modules = { module= libobjc; };
@@ -131,7 +142,7 @@
                    missing=maintainer-clean; };
 target_modules = { module= winsup; };
 target_modules = { module= libgloss; no_check=true; };
-target_modules = { module= libffi; };
+target_modules = { module= libffi; no_install=true; };
 target_modules = { module= libjava; raw_cxx=true;
                    extra_configure_flags="$(EXTRA_CONFIGARGS_LIBJAVA)"; };
 target_modules = { module= zlib; };
@@ -139,6 +150,8 @@
 target_modules = { module= rda; };
 target_modules = { module= libada; };
 target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; };
+target_modules = { module= libitm; lib_path=.libs; };
+target_modules = { module= libatomic; lib_path=.libs; };
 
 // These are (some of) the make targets to be done in each subdirectory.
 // Not all; these are the ones which don't have special options.
@@ -282,6 +295,7 @@
 
 // Host modules specific to gcc.
 dependencies = { module=configure-gcc; on=configure-intl; };
+dependencies = { module=configure-gcc; on=all-gmp; };
 dependencies = { module=configure-gcc; on=all-lto-plugin; };
 dependencies = { module=configure-gcc; on=all-binutils; };
 dependencies = { module=configure-gcc; on=all-gas; };
@@ -289,11 +303,9 @@
 dependencies = { module=configure-gcc; on=all-gold; };
 dependencies = { module=configure-gcc; on=all-libelf; };
 dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
-dependencies = { module=all-gcc; on=all-gmp; };
 dependencies = { module=all-gcc; on=all-intl; };
 dependencies = { module=all-gcc; on=all-mpfr; };
 dependencies = { module=all-gcc; on=all-mpc; };
-dependencies = { module=all-gcc; on=all-ppl; };
 dependencies = { module=all-gcc; on=all-cloog; };
 dependencies = { module=all-gcc; on=all-build-texinfo; };
 dependencies = { module=all-gcc; on=all-build-bison; };
@@ -301,6 +313,7 @@
 dependencies = { module=all-gcc; on=all-build-libiberty; };
 dependencies = { module=all-gcc; on=all-build-fixincludes; };
 dependencies = { module=all-gcc; on=all-zlib; };
+dependencies = { module=all-gcc; on=all-libbacktrace; hard=true; };
 dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
 dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; };
 dependencies = { module=all-gcc; on=all-libiberty; };
@@ -313,6 +326,7 @@
 dependencies = { module=install-gcc ; on=install-fixincludes; };
 dependencies = { module=install-gcc ; on=install-lto-plugin; };
 dependencies = { module=install-strip-gcc ; on=install-strip-fixincludes; };
+dependencies = { module=install-strip-gcc ; on=install-strip-lto-plugin; };
 
 dependencies = { module=configure-libcpp; on=configure-libiberty; hard=true; };
 dependencies = { module=configure-libcpp; on=configure-intl; };
@@ -329,9 +343,9 @@
 
 dependencies = { module=configure-mpfr; on=all-gmp; };
 dependencies = { module=configure-mpc; on=all-mpfr; };
-dependencies = { module=configure-ppl; on=all-gmp; };
-dependencies = { module=configure-ppl; on=all-mpfr; };
-dependencies = { module=configure-cloog; on=all-ppl; };
+dependencies = { module=configure-isl; on=all-gmp; };
+dependencies = { module=configure-cloog; on=all-isl; };
+dependencies = { module=configure-cloog; on=all-gmp; };
 
 // Host modules specific to gdb.
 dependencies = { module=configure-gdb; on=all-intl; };
@@ -363,6 +377,9 @@
 dependencies = { module=configure-opcodes; on=configure-libiberty; hard=true; };
 dependencies = { module=all-opcodes; on=all-libiberty; };
 
+// We must build gas before binutils, gprof, ld and gold to avoid race
+// condition in the prev-gcc/as script during bootstrap of combined tree
+// with GCC and binutils.  See PR gas/14899 for details.
 dependencies = { module=configure-binutils; on=configure-intl; };
 dependencies = { module=all-binutils; on=all-libiberty; };
 dependencies = { module=all-binutils; on=all-opcodes; };
@@ -370,6 +387,7 @@
 dependencies = { module=all-binutils; on=all-build-flex; };
 dependencies = { module=all-binutils; on=all-build-bison; };
 dependencies = { module=all-binutils; on=all-intl; };
+dependencies = { module=all-binutils; on=all-gas; };
 
 // We put install-opcodes before install-binutils because the installed
 // binutils might be on PATH, and they might need the shared opcodes
@@ -391,6 +409,7 @@
 dependencies = { module=all-gprof; on=all-bfd; };
 dependencies = { module=all-gprof; on=all-opcodes; };
 dependencies = { module=all-gprof; on=all-intl; };
+dependencies = { module=all-gprof; on=all-gas; };
 dependencies = { module=configure-ld; on=configure-intl; };
 dependencies = { module=all-ld; on=all-libiberty; };
 dependencies = { module=all-ld; on=all-bfd; };
@@ -398,6 +417,7 @@
 dependencies = { module=all-ld; on=all-build-bison; };
 dependencies = { module=all-ld; on=all-build-flex; };
 dependencies = { module=all-ld; on=all-intl; };
+dependencies = { module=all-ld; on=all-gas; };
 dependencies = { module=install-ld; on=install-gold; };
 dependencies = { module=install-strip-ld; on=install-strip-gold; };
 dependencies = { module=configure-gold; on=configure-intl; };
@@ -405,6 +425,7 @@
 dependencies = { module=all-gold; on=all-intl; };
 dependencies = { module=all-gold; on=all-bfd; };
 dependencies = { module=all-gold; on=all-build-bison; };
+dependencies = { module=all-gold; on=all-gas; };
 dependencies = { module=check-gold; on=all-binutils; };
 dependencies = { module=check-gold; on=all-gas; };
 
@@ -471,6 +492,8 @@
 // environment (e.g. on libstdc++).  By default target modules depend
 // on libgcc and newlib/libgloss.
 lang_env_dependencies = { module=libjava; cxx=true; };
+lang_env_dependencies = { module=libitm; cxx=true; };
+lang_env_dependencies = { module=libcilkrts; cxx=true; };
 lang_env_dependencies = { module=newlib; no_c=true; };
 lang_env_dependencies = { module=libgloss; no_c=true; };
 lang_env_dependencies = { module=libgcc; no_gcc=true; no_c=true; };
@@ -484,7 +507,9 @@
 dependencies = { module=all-target-fastjar; on=all-target-zlib; };
 dependencies = { module=configure-target-libgo; on=configure-target-libffi; };
 dependencies = { module=configure-target-libgo; on=all-target-libstdc++-v3; };
+dependencies = { module=all-target-libgo; on=all-target-libbacktrace; };
 dependencies = { module=all-target-libgo; on=all-target-libffi; };
+dependencies = { module=all-target-libgo; on=all-target-libatomic; };
 dependencies = { module=configure-target-libjava; on=configure-target-zlib; };
 dependencies = { module=configure-target-libjava; on=configure-target-boehm-gc; };
 dependencies = { module=configure-target-libjava; on=configure-target-libffi; };
@@ -495,11 +520,27 @@
 dependencies = { module=configure-target-libobjc; on=configure-target-boehm-gc; };
 dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
 dependencies = { module=configure-target-libstdc++-v3; on=configure-target-libgomp; };
+dependencies = { module=configure-target-libsanitizer; on=all-target-libstdc++-v3; };
+dependencies = { module=configure-target-libvtv; on=all-target-libstdc++-v3; };
 // parallel_list.o and parallel_settings.o depend on omp.h, which is
 // generated by the libgomp configure.  Unfortunately, due to the use of
 //  recursive make, we can't be that specific.
 dependencies = { module=all-target-libstdc++-v3; on=configure-target-libgomp; };
 
+dependencies = { module=install-target-libgo; on=install-target-libatomic; };
+dependencies = { module=install-target-libgfortran; on=install-target-libquadmath; };
+dependencies = { module=install-target-libgfortran; on=install-target-libgcc; };
+dependencies = { module=install-target-libsanitizer; on=install-target-libstdc++-v3; };
+dependencies = { module=install-target-libsanitizer; on=install-target-libgcc; };
+dependencies = { module=install-target-libvtv; on=install-target-libstdc++-v3; };
+dependencies = { module=install-target-libvtv; on=install-target-libgcc; };
+dependencies = { module=install-target-libcilkrts; on=install-target-libstdc++-v3; };
+dependencies = { module=install-target-libcilkrts; on=install-target-libgcc; };
+dependencies = { module=install-target-libjava; on=install-target-libgcc; };
+dependencies = { module=install-target-libitm; on=install-target-libgcc; };
+dependencies = { module=install-target-libobjc; on=install-target-libgcc; };
+dependencies = { module=install-target-libstdc++-v3; on=install-target-libgcc; };
+
 // Target modules in the 'src' repository.
 lang_env_dependencies = { module=libtermcap; };
 lang_env_dependencies = { module=rda; };
@@ -512,9 +553,10 @@
 dependencies = { module=configure-target-libgfortran; on=all-target-libquadmath; };
 
 languages = { language=c;	gcc-check-target=check-gcc; };
-languages = { language=c++;	gcc-check-target="check-c++ check-c++0x";
+languages = { language=c++;	gcc-check-target=check-c++;
 				lib-check-target=check-target-libstdc++-v3;
-				lib-check-target=check-target-libmudflap-c++; };
+				lib-check-target=check-target-libitm-c++;
+				lib-check-target=check-target-libgomp-c++; };
 languages = { language=fortran;	gcc-check-target=check-fortran;
 				lib-check-target=check-target-libquadmath;
 				lib-check-target=check-target-libgfortran; };
diff --git a/Makefile.in b/Makefile.in
index 038f801..f9e8e0d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -166,7 +166,7 @@
 	WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
 
 # These variables must be set on the make command line for directories
-# built for the build system to override those in BASE_FLAGS_TO_PASSS.
+# built for the build system to override those in BASE_FLAGS_TO_PASS.
 EXTRA_BUILD_FLAGS = \
 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
@@ -219,8 +219,7 @@
 	HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
 	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
-	PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \
-	PPLINC="$(HOST_PPLINC)"; export PPLINC; \
+	ISLINC="$(HOST_ISLINC)"; export ISLINC; \
 	CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
 	CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
 	LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \
@@ -236,7 +235,7 @@
 @if target-libstdc++-v3-bootstrap
 # Override the above if we're bootstrapping C++.
 POSTSTAGE1_CXX_EXPORT = \
-	CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/g++$(exeext) \
+	CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \
 	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
 	  -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
 	  -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
@@ -310,9 +309,8 @@
 HOST_GMPLIBS = @gmplibs@
 HOST_GMPINC = @gmpinc@
 
-# Where to find PPL
-HOST_PPLLIBS = @ppllibs@
-HOST_PPLINC = @pplinc@
+# Where to find ISL
+HOST_ISLINC = @islinc@
 
 # Where to find CLOOG
 HOST_CLOOGLIBS = @clooglibs@
@@ -366,7 +364,7 @@
 # here so that they can be overridden by Makefile fragments.
 BOOT_CFLAGS= -g -O2
 BOOT_LDFLAGS=
-BOOT_ADAFLAGS=-gnatpg -gnata
+BOOT_ADAFLAGS= -gnatpg
 
 AWK = @AWK@
 SED = @SED@
@@ -422,7 +420,6 @@
 STAGE_CFLAGS = $(BOOT_CFLAGS)
 STAGE_TFLAGS = $(TFLAGS)
 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
-POSTSTAGE1_CONFIGURE_FLAGS = @POSTSTAGE1_CONFIGURE_FLAGS@
 
 
 # Defaults for stage 1; some are overridden below.
@@ -433,10 +430,7 @@
 STAGE1_CXXFLAGS = $(STAGE1_CFLAGS)
 @endif target-libstdc++-v3-bootstrap
 STAGE1_TFLAGS = $(STAGE_TFLAGS)
-# STAGE1_CONFIGURE_FLAGS overridden below, so we can use
-# POSTSTAGE1_CONFIGURE_FLAGS here.
-STAGE1_CONFIGURE_FLAGS = \
-	$(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS)
+STAGE1_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 
 # Defaults for stage 2; some are overridden below.
 STAGE2_CFLAGS = $(STAGE_CFLAGS)
@@ -446,10 +440,7 @@
 STAGE2_CXXFLAGS = $(STAGE2_CFLAGS)
 @endif target-libstdc++-v3-bootstrap
 STAGE2_TFLAGS = $(STAGE_TFLAGS)
-# STAGE1_CONFIGURE_FLAGS overridden below, so we can use
-# POSTSTAGE1_CONFIGURE_FLAGS here.
-STAGE2_CONFIGURE_FLAGS = \
-	$(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS)
+STAGE2_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 
 # Defaults for stage 3; some are overridden below.
 STAGE3_CFLAGS = $(STAGE_CFLAGS)
@@ -459,10 +450,7 @@
 STAGE3_CXXFLAGS = $(STAGE3_CFLAGS)
 @endif target-libstdc++-v3-bootstrap
 STAGE3_TFLAGS = $(STAGE_TFLAGS)
-# STAGE1_CONFIGURE_FLAGS overridden below, so we can use
-# POSTSTAGE1_CONFIGURE_FLAGS here.
-STAGE3_CONFIGURE_FLAGS = \
-	$(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS)
+STAGE3_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 
 # Defaults for stage 4; some are overridden below.
 STAGE4_CFLAGS = $(STAGE_CFLAGS)
@@ -472,10 +460,7 @@
 STAGE4_CXXFLAGS = $(STAGE4_CFLAGS)
 @endif target-libstdc++-v3-bootstrap
 STAGE4_TFLAGS = $(STAGE_TFLAGS)
-# STAGE1_CONFIGURE_FLAGS overridden below, so we can use
-# POSTSTAGE1_CONFIGURE_FLAGS here.
-STAGE4_CONFIGURE_FLAGS = \
-	$(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS)
+STAGE4_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 
 # Defaults for stage profile; some are overridden below.
 STAGEprofile_CFLAGS = $(STAGE_CFLAGS)
@@ -485,10 +470,7 @@
 STAGEprofile_CXXFLAGS = $(STAGEprofile_CFLAGS)
 @endif target-libstdc++-v3-bootstrap
 STAGEprofile_TFLAGS = $(STAGE_TFLAGS)
-# STAGE1_CONFIGURE_FLAGS overridden below, so we can use
-# POSTSTAGE1_CONFIGURE_FLAGS here.
-STAGEprofile_CONFIGURE_FLAGS = \
-	$(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS)
+STAGEprofile_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 
 # Defaults for stage feedback; some are overridden below.
 STAGEfeedback_CFLAGS = $(STAGE_CFLAGS)
@@ -498,10 +480,7 @@
 STAGEfeedback_CXXFLAGS = $(STAGEfeedback_CFLAGS)
 @endif target-libstdc++-v3-bootstrap
 STAGEfeedback_TFLAGS = $(STAGE_TFLAGS)
-# STAGE1_CONFIGURE_FLAGS overridden below, so we can use
-# POSTSTAGE1_CONFIGURE_FLAGS here.
-STAGEfeedback_CONFIGURE_FLAGS = \
-	$(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS)
+STAGEfeedback_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 
 
 # Only build the C compiler for stage1, because that is the only one that
@@ -519,11 +498,10 @@
 #   the last argument when conflicting --enable arguments are passed.
 # * Likewise, we force-disable coverage flags, since the installed
 #   compiler probably has never heard of them.
-# * Don't remove this, because above we added
-#   POSTSTAGE1_CONFIGURE_FLAGS to STAGE_CONFIGURE_FLAGS, which
-#   we don't want for STAGE1_CONFIGURE_FLAGS.
+# * We also disable -Wformat, since older GCCs don't understand newer %s.
 STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
-	  --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)"
+	  --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
+	  --disable-build-format-warnings
 
 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
@@ -599,15 +577,23 @@
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the target machine work.
-TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(HOST_LIB_PATH_gcc)
+TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_libcilkrts)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
 
 @if target-libstdc++-v3
 TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
 @endif target-libstdc++-v3
 
-@if target-libmudflap
-TARGET_LIB_PATH_libmudflap = $$r/$(TARGET_SUBDIR)/libmudflap/.libs:
-@endif target-libmudflap
+@if target-libsanitizer
+TARGET_LIB_PATH_libsanitizer = $$r/$(TARGET_SUBDIR)/libsanitizer/.libs:
+@endif target-libsanitizer
+
+@if target-libvtv
+TARGET_LIB_PATH_libvtv = $$r/$(TARGET_SUBDIR)/libvtv/.libs:
+@endif target-libvtv
+
+@if target-libcilkrts
+TARGET_LIB_PATH_libcilkrts = $$r/$(TARGET_SUBDIR)/libcilkrts/.libs:
+@endif target-libcilkrts
 
 @if target-libssp
 TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs:
@@ -617,11 +603,19 @@
 TARGET_LIB_PATH_libgomp = $$r/$(TARGET_SUBDIR)/libgomp/.libs:
 @endif target-libgomp
 
+@if target-libitm
+TARGET_LIB_PATH_libitm = $$r/$(TARGET_SUBDIR)/libitm/.libs:
+@endif target-libitm
+
+@if target-libatomic
+TARGET_LIB_PATH_libatomic = $$r/$(TARGET_SUBDIR)/libatomic/.libs:
+@endif target-libatomic
+
 
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the host machine work.
-HOST_LIB_PATH = $(HOST_LIB_PATH_bfd)$(HOST_LIB_PATH_opcodes)$(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_ppl)$(HOST_LIB_PATH_cloog)$(HOST_LIB_PATH_libelf)
+HOST_LIB_PATH = $(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_isl)$(HOST_LIB_PATH_cloog)$(HOST_LIB_PATH_libelf)
 
 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
 @if gcc
@@ -629,16 +623,6 @@
 @endif gcc
 
 
-@if bfd
-HOST_LIB_PATH_bfd = \
-  $$r/$(HOST_SUBDIR)/bfd/.libs:$$r/$(HOST_SUBDIR)/prev-bfd/.libs:
-@endif bfd
-
-@if opcodes
-HOST_LIB_PATH_opcodes = \
-  $$r/$(HOST_SUBDIR)/opcodes/.libs:$$r/$(HOST_SUBDIR)/prev-opcodes/.libs:
-@endif opcodes
-
 @if gmp
 HOST_LIB_PATH_gmp = \
   $$r/$(HOST_SUBDIR)/gmp/.libs:$$r/$(HOST_SUBDIR)/prev-gmp/.libs:
@@ -654,10 +638,10 @@
   $$r/$(HOST_SUBDIR)/mpc/.libs:$$r/$(HOST_SUBDIR)/prev-mpc/.libs:
 @endif mpc
 
-@if ppl
-HOST_LIB_PATH_ppl = \
-  $$r/$(HOST_SUBDIR)/ppl/src/.libs:$$r/$(HOST_SUBDIR)/prev-ppl/src/.libs:
-@endif ppl
+@if isl
+HOST_LIB_PATH_isl = \
+  $$r/$(HOST_SUBDIR)/isl/.libs:$$r/$(HOST_SUBDIR)/prev-isl/.libs:
+@endif isl
 
 @if cloog
 HOST_LIB_PATH_cloog = \
@@ -828,6 +812,12 @@
 
 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
 
+# Flags to pass to stage1 or when not bootstrapping.
+
+STAGE1_FLAGS_TO_PASS = \
+	LDFLAGS="$${LDFLAGS}" \
+	HOST_LIBS="$${HOST_LIBS}"
+
 # Flags to pass to stage2 and later makes.
 
 POSTSTAGE1_FLAGS_TO_PASS = \
@@ -907,7 +897,7 @@
     maybe-configure-gmp \
     maybe-configure-mpfr \
     maybe-configure-mpc \
-    maybe-configure-ppl \
+    maybe-configure-isl \
     maybe-configure-cloog \
     maybe-configure-libelf \
     maybe-configure-gold \
@@ -916,6 +906,7 @@
     maybe-configure-tcl \
     maybe-configure-itcl \
     maybe-configure-ld \
+    maybe-configure-libbacktrace \
     maybe-configure-libcpp \
     maybe-configure-libdecnumber \
     maybe-configure-libgui \
@@ -938,10 +929,13 @@
 .PHONY: configure-target
 configure-target:  \
     maybe-configure-target-libstdc++-v3 \
-    maybe-configure-target-libmudflap \
+    maybe-configure-target-libsanitizer \
+    maybe-configure-target-libvtv \
+    maybe-configure-target-libcilkrts \
     maybe-configure-target-libssp \
     maybe-configure-target-newlib \
     maybe-configure-target-libgcc \
+    maybe-configure-target-libbacktrace \
     maybe-configure-target-libquadmath \
     maybe-configure-target-libgfortran \
     maybe-configure-target-libobjc \
@@ -955,7 +949,9 @@
     maybe-configure-target-boehm-gc \
     maybe-configure-target-rda \
     maybe-configure-target-libada \
-    maybe-configure-target-libgomp
+    maybe-configure-target-libgomp \
+    maybe-configure-target-libitm \
+    maybe-configure-target-libatomic
 
 # The target built for a native non-bootstrap build.
 .PHONY: all
@@ -1024,9 +1020,9 @@
 @if mpc-no-bootstrap
 all-host: maybe-all-mpc
 @endif mpc-no-bootstrap
-@if ppl-no-bootstrap
-all-host: maybe-all-ppl
-@endif ppl-no-bootstrap
+@if isl-no-bootstrap
+all-host: maybe-all-isl
+@endif isl-no-bootstrap
 @if cloog-no-bootstrap
 all-host: maybe-all-cloog
 @endif cloog-no-bootstrap
@@ -1045,6 +1041,9 @@
 @if ld-no-bootstrap
 all-host: maybe-all-ld
 @endif ld-no-bootstrap
+@if libbacktrace-no-bootstrap
+all-host: maybe-all-libbacktrace
+@endif libbacktrace-no-bootstrap
 @if libcpp-no-bootstrap
 all-host: maybe-all-libcpp
 @endif libcpp-no-bootstrap
@@ -1080,12 +1079,19 @@
 @if target-libstdc++-v3-no-bootstrap
 all-target: maybe-all-target-libstdc++-v3
 @endif target-libstdc++-v3-no-bootstrap
-all-target: maybe-all-target-libmudflap
+@if target-libsanitizer-no-bootstrap
+all-target: maybe-all-target-libsanitizer
+@endif target-libsanitizer-no-bootstrap
+@if target-libvtv-no-bootstrap
+all-target: maybe-all-target-libvtv
+@endif target-libvtv-no-bootstrap
+all-target: maybe-all-target-libcilkrts
 all-target: maybe-all-target-libssp
 all-target: maybe-all-target-newlib
 @if target-libgcc-no-bootstrap
 all-target: maybe-all-target-libgcc
 @endif target-libgcc-no-bootstrap
+all-target: maybe-all-target-libbacktrace
 all-target: maybe-all-target-libquadmath
 all-target: maybe-all-target-libgfortran
 all-target: maybe-all-target-libobjc
@@ -1102,6 +1108,8 @@
 @if target-libgomp-no-bootstrap
 all-target: maybe-all-target-libgomp
 @endif target-libgomp-no-bootstrap
+all-target: maybe-all-target-libitm
+all-target: maybe-all-target-libatomic
 
 # Do a target for all the subdirectories.  A ``make do-X'' will do a
 # ``make X'' in all subdirectories (because, in general, there is a
@@ -1134,7 +1142,7 @@
 info-host: maybe-info-gmp
 info-host: maybe-info-mpfr
 info-host: maybe-info-mpc
-info-host: maybe-info-ppl
+info-host: maybe-info-isl
 info-host: maybe-info-cloog
 info-host: maybe-info-libelf
 info-host: maybe-info-gold
@@ -1143,6 +1151,7 @@
 info-host: maybe-info-tcl
 info-host: maybe-info-itcl
 info-host: maybe-info-ld
+info-host: maybe-info-libbacktrace
 info-host: maybe-info-libcpp
 info-host: maybe-info-libdecnumber
 info-host: maybe-info-libgui
@@ -1166,10 +1175,13 @@
 .PHONY: info-target
 
 info-target: maybe-info-target-libstdc++-v3
-info-target: maybe-info-target-libmudflap
+info-target: maybe-info-target-libsanitizer
+info-target: maybe-info-target-libvtv
+info-target: maybe-info-target-libcilkrts
 info-target: maybe-info-target-libssp
 info-target: maybe-info-target-newlib
 info-target: maybe-info-target-libgcc
+info-target: maybe-info-target-libbacktrace
 info-target: maybe-info-target-libquadmath
 info-target: maybe-info-target-libgfortran
 info-target: maybe-info-target-libobjc
@@ -1184,6 +1196,8 @@
 info-target: maybe-info-target-rda
 info-target: maybe-info-target-libada
 info-target: maybe-info-target-libgomp
+info-target: maybe-info-target-libitm
+info-target: maybe-info-target-libatomic
 
 .PHONY: do-dvi
 do-dvi:
@@ -1211,7 +1225,7 @@
 dvi-host: maybe-dvi-gmp
 dvi-host: maybe-dvi-mpfr
 dvi-host: maybe-dvi-mpc
-dvi-host: maybe-dvi-ppl
+dvi-host: maybe-dvi-isl
 dvi-host: maybe-dvi-cloog
 dvi-host: maybe-dvi-libelf
 dvi-host: maybe-dvi-gold
@@ -1220,6 +1234,7 @@
 dvi-host: maybe-dvi-tcl
 dvi-host: maybe-dvi-itcl
 dvi-host: maybe-dvi-ld
+dvi-host: maybe-dvi-libbacktrace
 dvi-host: maybe-dvi-libcpp
 dvi-host: maybe-dvi-libdecnumber
 dvi-host: maybe-dvi-libgui
@@ -1243,10 +1258,13 @@
 .PHONY: dvi-target
 
 dvi-target: maybe-dvi-target-libstdc++-v3
-dvi-target: maybe-dvi-target-libmudflap
+dvi-target: maybe-dvi-target-libsanitizer
+dvi-target: maybe-dvi-target-libvtv
+dvi-target: maybe-dvi-target-libcilkrts
 dvi-target: maybe-dvi-target-libssp
 dvi-target: maybe-dvi-target-newlib
 dvi-target: maybe-dvi-target-libgcc
+dvi-target: maybe-dvi-target-libbacktrace
 dvi-target: maybe-dvi-target-libquadmath
 dvi-target: maybe-dvi-target-libgfortran
 dvi-target: maybe-dvi-target-libobjc
@@ -1261,6 +1279,8 @@
 dvi-target: maybe-dvi-target-rda
 dvi-target: maybe-dvi-target-libada
 dvi-target: maybe-dvi-target-libgomp
+dvi-target: maybe-dvi-target-libitm
+dvi-target: maybe-dvi-target-libatomic
 
 .PHONY: do-pdf
 do-pdf:
@@ -1288,7 +1308,7 @@
 pdf-host: maybe-pdf-gmp
 pdf-host: maybe-pdf-mpfr
 pdf-host: maybe-pdf-mpc
-pdf-host: maybe-pdf-ppl
+pdf-host: maybe-pdf-isl
 pdf-host: maybe-pdf-cloog
 pdf-host: maybe-pdf-libelf
 pdf-host: maybe-pdf-gold
@@ -1297,6 +1317,7 @@
 pdf-host: maybe-pdf-tcl
 pdf-host: maybe-pdf-itcl
 pdf-host: maybe-pdf-ld
+pdf-host: maybe-pdf-libbacktrace
 pdf-host: maybe-pdf-libcpp
 pdf-host: maybe-pdf-libdecnumber
 pdf-host: maybe-pdf-libgui
@@ -1320,10 +1341,13 @@
 .PHONY: pdf-target
 
 pdf-target: maybe-pdf-target-libstdc++-v3
-pdf-target: maybe-pdf-target-libmudflap
+pdf-target: maybe-pdf-target-libsanitizer
+pdf-target: maybe-pdf-target-libvtv
+pdf-target: maybe-pdf-target-libcilkrts
 pdf-target: maybe-pdf-target-libssp
 pdf-target: maybe-pdf-target-newlib
 pdf-target: maybe-pdf-target-libgcc
+pdf-target: maybe-pdf-target-libbacktrace
 pdf-target: maybe-pdf-target-libquadmath
 pdf-target: maybe-pdf-target-libgfortran
 pdf-target: maybe-pdf-target-libobjc
@@ -1338,6 +1362,8 @@
 pdf-target: maybe-pdf-target-rda
 pdf-target: maybe-pdf-target-libada
 pdf-target: maybe-pdf-target-libgomp
+pdf-target: maybe-pdf-target-libitm
+pdf-target: maybe-pdf-target-libatomic
 
 .PHONY: do-html
 do-html:
@@ -1365,7 +1391,7 @@
 html-host: maybe-html-gmp
 html-host: maybe-html-mpfr
 html-host: maybe-html-mpc
-html-host: maybe-html-ppl
+html-host: maybe-html-isl
 html-host: maybe-html-cloog
 html-host: maybe-html-libelf
 html-host: maybe-html-gold
@@ -1374,6 +1400,7 @@
 html-host: maybe-html-tcl
 html-host: maybe-html-itcl
 html-host: maybe-html-ld
+html-host: maybe-html-libbacktrace
 html-host: maybe-html-libcpp
 html-host: maybe-html-libdecnumber
 html-host: maybe-html-libgui
@@ -1397,10 +1424,13 @@
 .PHONY: html-target
 
 html-target: maybe-html-target-libstdc++-v3
-html-target: maybe-html-target-libmudflap
+html-target: maybe-html-target-libsanitizer
+html-target: maybe-html-target-libvtv
+html-target: maybe-html-target-libcilkrts
 html-target: maybe-html-target-libssp
 html-target: maybe-html-target-newlib
 html-target: maybe-html-target-libgcc
+html-target: maybe-html-target-libbacktrace
 html-target: maybe-html-target-libquadmath
 html-target: maybe-html-target-libgfortran
 html-target: maybe-html-target-libobjc
@@ -1415,6 +1445,8 @@
 html-target: maybe-html-target-rda
 html-target: maybe-html-target-libada
 html-target: maybe-html-target-libgomp
+html-target: maybe-html-target-libitm
+html-target: maybe-html-target-libatomic
 
 .PHONY: do-TAGS
 do-TAGS:
@@ -1442,7 +1474,7 @@
 TAGS-host: maybe-TAGS-gmp
 TAGS-host: maybe-TAGS-mpfr
 TAGS-host: maybe-TAGS-mpc
-TAGS-host: maybe-TAGS-ppl
+TAGS-host: maybe-TAGS-isl
 TAGS-host: maybe-TAGS-cloog
 TAGS-host: maybe-TAGS-libelf
 TAGS-host: maybe-TAGS-gold
@@ -1451,6 +1483,7 @@
 TAGS-host: maybe-TAGS-tcl
 TAGS-host: maybe-TAGS-itcl
 TAGS-host: maybe-TAGS-ld
+TAGS-host: maybe-TAGS-libbacktrace
 TAGS-host: maybe-TAGS-libcpp
 TAGS-host: maybe-TAGS-libdecnumber
 TAGS-host: maybe-TAGS-libgui
@@ -1474,10 +1507,13 @@
 .PHONY: TAGS-target
 
 TAGS-target: maybe-TAGS-target-libstdc++-v3
-TAGS-target: maybe-TAGS-target-libmudflap
+TAGS-target: maybe-TAGS-target-libsanitizer
+TAGS-target: maybe-TAGS-target-libvtv
+TAGS-target: maybe-TAGS-target-libcilkrts
 TAGS-target: maybe-TAGS-target-libssp
 TAGS-target: maybe-TAGS-target-newlib
 TAGS-target: maybe-TAGS-target-libgcc
+TAGS-target: maybe-TAGS-target-libbacktrace
 TAGS-target: maybe-TAGS-target-libquadmath
 TAGS-target: maybe-TAGS-target-libgfortran
 TAGS-target: maybe-TAGS-target-libobjc
@@ -1492,6 +1528,8 @@
 TAGS-target: maybe-TAGS-target-rda
 TAGS-target: maybe-TAGS-target-libada
 TAGS-target: maybe-TAGS-target-libgomp
+TAGS-target: maybe-TAGS-target-libitm
+TAGS-target: maybe-TAGS-target-libatomic
 
 .PHONY: do-install-info
 do-install-info:
@@ -1519,7 +1557,7 @@
 install-info-host: maybe-install-info-gmp
 install-info-host: maybe-install-info-mpfr
 install-info-host: maybe-install-info-mpc
-install-info-host: maybe-install-info-ppl
+install-info-host: maybe-install-info-isl
 install-info-host: maybe-install-info-cloog
 install-info-host: maybe-install-info-libelf
 install-info-host: maybe-install-info-gold
@@ -1528,6 +1566,7 @@
 install-info-host: maybe-install-info-tcl
 install-info-host: maybe-install-info-itcl
 install-info-host: maybe-install-info-ld
+install-info-host: maybe-install-info-libbacktrace
 install-info-host: maybe-install-info-libcpp
 install-info-host: maybe-install-info-libdecnumber
 install-info-host: maybe-install-info-libgui
@@ -1551,10 +1590,13 @@
 .PHONY: install-info-target
 
 install-info-target: maybe-install-info-target-libstdc++-v3
-install-info-target: maybe-install-info-target-libmudflap
+install-info-target: maybe-install-info-target-libsanitizer
+install-info-target: maybe-install-info-target-libvtv
+install-info-target: maybe-install-info-target-libcilkrts
 install-info-target: maybe-install-info-target-libssp
 install-info-target: maybe-install-info-target-newlib
 install-info-target: maybe-install-info-target-libgcc
+install-info-target: maybe-install-info-target-libbacktrace
 install-info-target: maybe-install-info-target-libquadmath
 install-info-target: maybe-install-info-target-libgfortran
 install-info-target: maybe-install-info-target-libobjc
@@ -1569,6 +1611,8 @@
 install-info-target: maybe-install-info-target-rda
 install-info-target: maybe-install-info-target-libada
 install-info-target: maybe-install-info-target-libgomp
+install-info-target: maybe-install-info-target-libitm
+install-info-target: maybe-install-info-target-libatomic
 
 .PHONY: do-install-pdf
 do-install-pdf:
@@ -1596,7 +1640,7 @@
 install-pdf-host: maybe-install-pdf-gmp
 install-pdf-host: maybe-install-pdf-mpfr
 install-pdf-host: maybe-install-pdf-mpc
-install-pdf-host: maybe-install-pdf-ppl
+install-pdf-host: maybe-install-pdf-isl
 install-pdf-host: maybe-install-pdf-cloog
 install-pdf-host: maybe-install-pdf-libelf
 install-pdf-host: maybe-install-pdf-gold
@@ -1605,6 +1649,7 @@
 install-pdf-host: maybe-install-pdf-tcl
 install-pdf-host: maybe-install-pdf-itcl
 install-pdf-host: maybe-install-pdf-ld
+install-pdf-host: maybe-install-pdf-libbacktrace
 install-pdf-host: maybe-install-pdf-libcpp
 install-pdf-host: maybe-install-pdf-libdecnumber
 install-pdf-host: maybe-install-pdf-libgui
@@ -1628,10 +1673,13 @@
 .PHONY: install-pdf-target
 
 install-pdf-target: maybe-install-pdf-target-libstdc++-v3
-install-pdf-target: maybe-install-pdf-target-libmudflap
+install-pdf-target: maybe-install-pdf-target-libsanitizer
+install-pdf-target: maybe-install-pdf-target-libvtv
+install-pdf-target: maybe-install-pdf-target-libcilkrts
 install-pdf-target: maybe-install-pdf-target-libssp
 install-pdf-target: maybe-install-pdf-target-newlib
 install-pdf-target: maybe-install-pdf-target-libgcc
+install-pdf-target: maybe-install-pdf-target-libbacktrace
 install-pdf-target: maybe-install-pdf-target-libquadmath
 install-pdf-target: maybe-install-pdf-target-libgfortran
 install-pdf-target: maybe-install-pdf-target-libobjc
@@ -1646,6 +1694,8 @@
 install-pdf-target: maybe-install-pdf-target-rda
 install-pdf-target: maybe-install-pdf-target-libada
 install-pdf-target: maybe-install-pdf-target-libgomp
+install-pdf-target: maybe-install-pdf-target-libitm
+install-pdf-target: maybe-install-pdf-target-libatomic
 
 .PHONY: do-install-html
 do-install-html:
@@ -1673,7 +1723,7 @@
 install-html-host: maybe-install-html-gmp
 install-html-host: maybe-install-html-mpfr
 install-html-host: maybe-install-html-mpc
-install-html-host: maybe-install-html-ppl
+install-html-host: maybe-install-html-isl
 install-html-host: maybe-install-html-cloog
 install-html-host: maybe-install-html-libelf
 install-html-host: maybe-install-html-gold
@@ -1682,6 +1732,7 @@
 install-html-host: maybe-install-html-tcl
 install-html-host: maybe-install-html-itcl
 install-html-host: maybe-install-html-ld
+install-html-host: maybe-install-html-libbacktrace
 install-html-host: maybe-install-html-libcpp
 install-html-host: maybe-install-html-libdecnumber
 install-html-host: maybe-install-html-libgui
@@ -1705,10 +1756,13 @@
 .PHONY: install-html-target
 
 install-html-target: maybe-install-html-target-libstdc++-v3
-install-html-target: maybe-install-html-target-libmudflap
+install-html-target: maybe-install-html-target-libsanitizer
+install-html-target: maybe-install-html-target-libvtv
+install-html-target: maybe-install-html-target-libcilkrts
 install-html-target: maybe-install-html-target-libssp
 install-html-target: maybe-install-html-target-newlib
 install-html-target: maybe-install-html-target-libgcc
+install-html-target: maybe-install-html-target-libbacktrace
 install-html-target: maybe-install-html-target-libquadmath
 install-html-target: maybe-install-html-target-libgfortran
 install-html-target: maybe-install-html-target-libobjc
@@ -1723,6 +1777,8 @@
 install-html-target: maybe-install-html-target-rda
 install-html-target: maybe-install-html-target-libada
 install-html-target: maybe-install-html-target-libgomp
+install-html-target: maybe-install-html-target-libitm
+install-html-target: maybe-install-html-target-libatomic
 
 .PHONY: do-installcheck
 do-installcheck:
@@ -1750,7 +1806,7 @@
 installcheck-host: maybe-installcheck-gmp
 installcheck-host: maybe-installcheck-mpfr
 installcheck-host: maybe-installcheck-mpc
-installcheck-host: maybe-installcheck-ppl
+installcheck-host: maybe-installcheck-isl
 installcheck-host: maybe-installcheck-cloog
 installcheck-host: maybe-installcheck-libelf
 installcheck-host: maybe-installcheck-gold
@@ -1759,6 +1815,7 @@
 installcheck-host: maybe-installcheck-tcl
 installcheck-host: maybe-installcheck-itcl
 installcheck-host: maybe-installcheck-ld
+installcheck-host: maybe-installcheck-libbacktrace
 installcheck-host: maybe-installcheck-libcpp
 installcheck-host: maybe-installcheck-libdecnumber
 installcheck-host: maybe-installcheck-libgui
@@ -1782,10 +1839,13 @@
 .PHONY: installcheck-target
 
 installcheck-target: maybe-installcheck-target-libstdc++-v3
-installcheck-target: maybe-installcheck-target-libmudflap
+installcheck-target: maybe-installcheck-target-libsanitizer
+installcheck-target: maybe-installcheck-target-libvtv
+installcheck-target: maybe-installcheck-target-libcilkrts
 installcheck-target: maybe-installcheck-target-libssp
 installcheck-target: maybe-installcheck-target-newlib
 installcheck-target: maybe-installcheck-target-libgcc
+installcheck-target: maybe-installcheck-target-libbacktrace
 installcheck-target: maybe-installcheck-target-libquadmath
 installcheck-target: maybe-installcheck-target-libgfortran
 installcheck-target: maybe-installcheck-target-libobjc
@@ -1800,6 +1860,8 @@
 installcheck-target: maybe-installcheck-target-rda
 installcheck-target: maybe-installcheck-target-libada
 installcheck-target: maybe-installcheck-target-libgomp
+installcheck-target: maybe-installcheck-target-libitm
+installcheck-target: maybe-installcheck-target-libatomic
 
 .PHONY: do-mostlyclean
 do-mostlyclean:
@@ -1827,7 +1889,7 @@
 mostlyclean-host: maybe-mostlyclean-gmp
 mostlyclean-host: maybe-mostlyclean-mpfr
 mostlyclean-host: maybe-mostlyclean-mpc
-mostlyclean-host: maybe-mostlyclean-ppl
+mostlyclean-host: maybe-mostlyclean-isl
 mostlyclean-host: maybe-mostlyclean-cloog
 mostlyclean-host: maybe-mostlyclean-libelf
 mostlyclean-host: maybe-mostlyclean-gold
@@ -1836,6 +1898,7 @@
 mostlyclean-host: maybe-mostlyclean-tcl
 mostlyclean-host: maybe-mostlyclean-itcl
 mostlyclean-host: maybe-mostlyclean-ld
+mostlyclean-host: maybe-mostlyclean-libbacktrace
 mostlyclean-host: maybe-mostlyclean-libcpp
 mostlyclean-host: maybe-mostlyclean-libdecnumber
 mostlyclean-host: maybe-mostlyclean-libgui
@@ -1859,10 +1922,13 @@
 .PHONY: mostlyclean-target
 
 mostlyclean-target: maybe-mostlyclean-target-libstdc++-v3
-mostlyclean-target: maybe-mostlyclean-target-libmudflap
+mostlyclean-target: maybe-mostlyclean-target-libsanitizer
+mostlyclean-target: maybe-mostlyclean-target-libvtv
+mostlyclean-target: maybe-mostlyclean-target-libcilkrts
 mostlyclean-target: maybe-mostlyclean-target-libssp
 mostlyclean-target: maybe-mostlyclean-target-newlib
 mostlyclean-target: maybe-mostlyclean-target-libgcc
+mostlyclean-target: maybe-mostlyclean-target-libbacktrace
 mostlyclean-target: maybe-mostlyclean-target-libquadmath
 mostlyclean-target: maybe-mostlyclean-target-libgfortran
 mostlyclean-target: maybe-mostlyclean-target-libobjc
@@ -1877,6 +1943,8 @@
 mostlyclean-target: maybe-mostlyclean-target-rda
 mostlyclean-target: maybe-mostlyclean-target-libada
 mostlyclean-target: maybe-mostlyclean-target-libgomp
+mostlyclean-target: maybe-mostlyclean-target-libitm
+mostlyclean-target: maybe-mostlyclean-target-libatomic
 
 .PHONY: do-clean
 do-clean:
@@ -1904,7 +1972,7 @@
 clean-host: maybe-clean-gmp
 clean-host: maybe-clean-mpfr
 clean-host: maybe-clean-mpc
-clean-host: maybe-clean-ppl
+clean-host: maybe-clean-isl
 clean-host: maybe-clean-cloog
 clean-host: maybe-clean-libelf
 clean-host: maybe-clean-gold
@@ -1913,6 +1981,7 @@
 clean-host: maybe-clean-tcl
 clean-host: maybe-clean-itcl
 clean-host: maybe-clean-ld
+clean-host: maybe-clean-libbacktrace
 clean-host: maybe-clean-libcpp
 clean-host: maybe-clean-libdecnumber
 clean-host: maybe-clean-libgui
@@ -1936,10 +2005,13 @@
 .PHONY: clean-target
 
 clean-target: maybe-clean-target-libstdc++-v3
-clean-target: maybe-clean-target-libmudflap
+clean-target: maybe-clean-target-libsanitizer
+clean-target: maybe-clean-target-libvtv
+clean-target: maybe-clean-target-libcilkrts
 clean-target: maybe-clean-target-libssp
 clean-target: maybe-clean-target-newlib
 clean-target: maybe-clean-target-libgcc
+clean-target: maybe-clean-target-libbacktrace
 clean-target: maybe-clean-target-libquadmath
 clean-target: maybe-clean-target-libgfortran
 clean-target: maybe-clean-target-libobjc
@@ -1954,6 +2026,8 @@
 clean-target: maybe-clean-target-rda
 clean-target: maybe-clean-target-libada
 clean-target: maybe-clean-target-libgomp
+clean-target: maybe-clean-target-libitm
+clean-target: maybe-clean-target-libatomic
 
 .PHONY: do-distclean
 do-distclean:
@@ -1981,7 +2055,7 @@
 distclean-host: maybe-distclean-gmp
 distclean-host: maybe-distclean-mpfr
 distclean-host: maybe-distclean-mpc
-distclean-host: maybe-distclean-ppl
+distclean-host: maybe-distclean-isl
 distclean-host: maybe-distclean-cloog
 distclean-host: maybe-distclean-libelf
 distclean-host: maybe-distclean-gold
@@ -1990,6 +2064,7 @@
 distclean-host: maybe-distclean-tcl
 distclean-host: maybe-distclean-itcl
 distclean-host: maybe-distclean-ld
+distclean-host: maybe-distclean-libbacktrace
 distclean-host: maybe-distclean-libcpp
 distclean-host: maybe-distclean-libdecnumber
 distclean-host: maybe-distclean-libgui
@@ -2013,10 +2088,13 @@
 .PHONY: distclean-target
 
 distclean-target: maybe-distclean-target-libstdc++-v3
-distclean-target: maybe-distclean-target-libmudflap
+distclean-target: maybe-distclean-target-libsanitizer
+distclean-target: maybe-distclean-target-libvtv
+distclean-target: maybe-distclean-target-libcilkrts
 distclean-target: maybe-distclean-target-libssp
 distclean-target: maybe-distclean-target-newlib
 distclean-target: maybe-distclean-target-libgcc
+distclean-target: maybe-distclean-target-libbacktrace
 distclean-target: maybe-distclean-target-libquadmath
 distclean-target: maybe-distclean-target-libgfortran
 distclean-target: maybe-distclean-target-libobjc
@@ -2031,6 +2109,8 @@
 distclean-target: maybe-distclean-target-rda
 distclean-target: maybe-distclean-target-libada
 distclean-target: maybe-distclean-target-libgomp
+distclean-target: maybe-distclean-target-libitm
+distclean-target: maybe-distclean-target-libatomic
 
 .PHONY: do-maintainer-clean
 do-maintainer-clean:
@@ -2058,7 +2138,7 @@
 maintainer-clean-host: maybe-maintainer-clean-gmp
 maintainer-clean-host: maybe-maintainer-clean-mpfr
 maintainer-clean-host: maybe-maintainer-clean-mpc
-maintainer-clean-host: maybe-maintainer-clean-ppl
+maintainer-clean-host: maybe-maintainer-clean-isl
 maintainer-clean-host: maybe-maintainer-clean-cloog
 maintainer-clean-host: maybe-maintainer-clean-libelf
 maintainer-clean-host: maybe-maintainer-clean-gold
@@ -2067,6 +2147,7 @@
 maintainer-clean-host: maybe-maintainer-clean-tcl
 maintainer-clean-host: maybe-maintainer-clean-itcl
 maintainer-clean-host: maybe-maintainer-clean-ld
+maintainer-clean-host: maybe-maintainer-clean-libbacktrace
 maintainer-clean-host: maybe-maintainer-clean-libcpp
 maintainer-clean-host: maybe-maintainer-clean-libdecnumber
 maintainer-clean-host: maybe-maintainer-clean-libgui
@@ -2090,10 +2171,13 @@
 .PHONY: maintainer-clean-target
 
 maintainer-clean-target: maybe-maintainer-clean-target-libstdc++-v3
-maintainer-clean-target: maybe-maintainer-clean-target-libmudflap
+maintainer-clean-target: maybe-maintainer-clean-target-libsanitizer
+maintainer-clean-target: maybe-maintainer-clean-target-libvtv
+maintainer-clean-target: maybe-maintainer-clean-target-libcilkrts
 maintainer-clean-target: maybe-maintainer-clean-target-libssp
 maintainer-clean-target: maybe-maintainer-clean-target-newlib
 maintainer-clean-target: maybe-maintainer-clean-target-libgcc
+maintainer-clean-target: maybe-maintainer-clean-target-libbacktrace
 maintainer-clean-target: maybe-maintainer-clean-target-libquadmath
 maintainer-clean-target: maybe-maintainer-clean-target-libgfortran
 maintainer-clean-target: maybe-maintainer-clean-target-libobjc
@@ -2108,6 +2192,8 @@
 maintainer-clean-target: maybe-maintainer-clean-target-rda
 maintainer-clean-target: maybe-maintainer-clean-target-libada
 maintainer-clean-target: maybe-maintainer-clean-target-libgomp
+maintainer-clean-target: maybe-maintainer-clean-target-libitm
+maintainer-clean-target: maybe-maintainer-clean-target-libatomic
 
 
 # Here are the targets which correspond to the do-X targets.
@@ -2190,7 +2276,7 @@
     maybe-check-gmp \
     maybe-check-mpfr \
     maybe-check-mpc \
-    maybe-check-ppl \
+    maybe-check-isl \
     maybe-check-cloog \
     maybe-check-libelf \
     maybe-check-gold \
@@ -2199,6 +2285,7 @@
     maybe-check-tcl \
     maybe-check-itcl \
     maybe-check-ld \
+    maybe-check-libbacktrace \
     maybe-check-libcpp \
     maybe-check-libdecnumber \
     maybe-check-libgui \
@@ -2222,10 +2309,13 @@
 .PHONY: check-target
 check-target:  \
     maybe-check-target-libstdc++-v3 \
-    maybe-check-target-libmudflap \
+    maybe-check-target-libsanitizer \
+    maybe-check-target-libvtv \
+    maybe-check-target-libcilkrts \
     maybe-check-target-libssp \
     maybe-check-target-newlib \
     maybe-check-target-libgcc \
+    maybe-check-target-libbacktrace \
     maybe-check-target-libquadmath \
     maybe-check-target-libgfortran \
     maybe-check-target-libobjc \
@@ -2239,7 +2329,9 @@
     maybe-check-target-boehm-gc \
     maybe-check-target-rda \
     maybe-check-target-libada \
-    maybe-check-target-libgomp
+    maybe-check-target-libgomp \
+    maybe-check-target-libitm \
+    maybe-check-target-libatomic
 
 do-check:
 	@: $(MAKE); $(unstage)
@@ -2293,7 +2385,7 @@
     maybe-install-gmp \
     maybe-install-mpfr \
     maybe-install-mpc \
-    maybe-install-ppl \
+    maybe-install-isl \
     maybe-install-cloog \
     maybe-install-libelf \
     maybe-install-gold \
@@ -2302,6 +2394,7 @@
     maybe-install-tcl \
     maybe-install-itcl \
     maybe-install-ld \
+    maybe-install-libbacktrace \
     maybe-install-libcpp \
     maybe-install-libdecnumber \
     maybe-install-libgui \
@@ -2339,7 +2432,7 @@
     maybe-install-gmp \
     maybe-install-mpfr \
     maybe-install-mpc \
-    maybe-install-ppl \
+    maybe-install-isl \
     maybe-install-cloog \
     maybe-install-libelf \
     maybe-install-gold \
@@ -2348,6 +2441,7 @@
     maybe-install-tcl \
     maybe-install-itcl \
     maybe-install-ld \
+    maybe-install-libbacktrace \
     maybe-install-libcpp \
     maybe-install-libdecnumber \
     maybe-install-libgui \
@@ -2371,10 +2465,13 @@
 .PHONY: install-target
 install-target:  \
     maybe-install-target-libstdc++-v3 \
-    maybe-install-target-libmudflap \
+    maybe-install-target-libsanitizer \
+    maybe-install-target-libvtv \
+    maybe-install-target-libcilkrts \
     maybe-install-target-libssp \
     maybe-install-target-newlib \
     maybe-install-target-libgcc \
+    maybe-install-target-libbacktrace \
     maybe-install-target-libquadmath \
     maybe-install-target-libgfortran \
     maybe-install-target-libobjc \
@@ -2388,7 +2485,9 @@
     maybe-install-target-boehm-gc \
     maybe-install-target-rda \
     maybe-install-target-libada \
-    maybe-install-target-libgomp
+    maybe-install-target-libgomp \
+    maybe-install-target-libitm \
+    maybe-install-target-libatomic
 
 uninstall:
 	@echo "the uninstall target is not supported in this tree"
@@ -2405,11 +2504,12 @@
 		true ; \
 	fi
 
-# install-no-fixedincludes is used because Cygnus can not distribute
-# the fixed header files.
+# install-no-fixedincludes is used to allow the elaboration of binary packages
+# suitable for distribution, where we cannot include the fixed system header
+# files.
 .PHONY: install-no-fixedincludes
 install-no-fixedincludes: installdirs install-host-nogcc \
-	install-target gcc-no-fixedincludes
+	install-target gcc-install-no-fixedincludes
 
 .PHONY: install-strip
 install-strip:
@@ -2435,7 +2535,7 @@
     maybe-install-strip-gmp \
     maybe-install-strip-mpfr \
     maybe-install-strip-mpc \
-    maybe-install-strip-ppl \
+    maybe-install-strip-isl \
     maybe-install-strip-cloog \
     maybe-install-strip-libelf \
     maybe-install-strip-gold \
@@ -2444,6 +2544,7 @@
     maybe-install-strip-tcl \
     maybe-install-strip-itcl \
     maybe-install-strip-ld \
+    maybe-install-strip-libbacktrace \
     maybe-install-strip-libcpp \
     maybe-install-strip-libdecnumber \
     maybe-install-strip-libgui \
@@ -2467,10 +2568,13 @@
 .PHONY: install-strip-target
 install-strip-target:  \
     maybe-install-strip-target-libstdc++-v3 \
-    maybe-install-strip-target-libmudflap \
+    maybe-install-strip-target-libsanitizer \
+    maybe-install-strip-target-libvtv \
+    maybe-install-strip-target-libcilkrts \
     maybe-install-strip-target-libssp \
     maybe-install-strip-target-newlib \
     maybe-install-strip-target-libgcc \
+    maybe-install-strip-target-libbacktrace \
     maybe-install-strip-target-libquadmath \
     maybe-install-strip-target-libgfortran \
     maybe-install-strip-target-libobjc \
@@ -2484,7 +2588,9 @@
     maybe-install-strip-target-boehm-gc \
     maybe-install-strip-target-rda \
     maybe-install-strip-target-libada \
-    maybe-install-strip-target-libgomp
+    maybe-install-strip-target-libgomp \
+    maybe-install-strip-target-libitm \
+    maybe-install-strip-target-libatomic
 
 
 ### other supporting targets
@@ -2578,7 +2684,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(BUILD_EXPORTS)  \
 	(cd $(BUILD_SUBDIR)/libiberty && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)   \
 		$(TARGET-build-libiberty))
 @endif build-libiberty
 
@@ -2634,7 +2740,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(BUILD_EXPORTS)  \
 	(cd $(BUILD_SUBDIR)/bison && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)   \
 		$(TARGET-build-bison))
 @endif build-bison
 
@@ -2690,7 +2796,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(BUILD_EXPORTS)  \
 	(cd $(BUILD_SUBDIR)/flex && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)   \
 		$(TARGET-build-flex))
 @endif build-flex
 
@@ -2746,7 +2852,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(BUILD_EXPORTS)  \
 	(cd $(BUILD_SUBDIR)/m4 && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)   \
 		$(TARGET-build-m4))
 @endif build-m4
 
@@ -2802,7 +2908,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(BUILD_EXPORTS)  \
 	(cd $(BUILD_SUBDIR)/texinfo && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)   \
 		$(TARGET-build-texinfo))
 @endif build-texinfo
 
@@ -2858,7 +2964,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(BUILD_EXPORTS)  \
 	(cd $(BUILD_SUBDIR)/fixincludes && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_BUILD_FLAGS)   \
 		$(TARGET-build-fixincludes))
 @endif build-fixincludes
 
@@ -3114,7 +3220,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/bfd && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-bfd))
 @endif bfd
 
@@ -3142,7 +3248,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-bfd)
 
@@ -3157,7 +3264,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/bfd && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif bfd-bootstrap
 
 
@@ -3198,9 +3305,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/bfd && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif bfd-bootstrap
 
 
@@ -3241,9 +3346,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/bfd && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif bfd-bootstrap
 
 
@@ -3284,9 +3387,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/bfd && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif bfd-bootstrap
 
 
@@ -3327,9 +3428,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/bfd && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif bfd-bootstrap
 
 
@@ -3370,9 +3469,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/bfd && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif bfd-bootstrap
 
 
@@ -3995,7 +4092,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/opcodes && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-opcodes))
 @endif opcodes
 
@@ -4023,7 +4120,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-opcodes)
 
@@ -4038,7 +4136,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/opcodes && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif opcodes-bootstrap
 
 
@@ -4079,9 +4177,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/opcodes && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif opcodes-bootstrap
 
 
@@ -4122,9 +4218,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/opcodes && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif opcodes-bootstrap
 
 
@@ -4165,9 +4259,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/opcodes && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif opcodes-bootstrap
 
 
@@ -4208,9 +4300,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/opcodes && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif opcodes-bootstrap
 
 
@@ -4251,9 +4341,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/opcodes && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif opcodes-bootstrap
 
 
@@ -4876,7 +4964,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/binutils && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-binutils))
 @endif binutils
 
@@ -4904,7 +4992,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-binutils)
 
@@ -4919,7 +5008,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/binutils && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif binutils-bootstrap
 
 
@@ -4960,9 +5049,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/binutils && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif binutils-bootstrap
 
 
@@ -5003,9 +5090,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/binutils && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif binutils-bootstrap
 
 
@@ -5046,9 +5131,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/binutils && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif binutils-bootstrap
 
 
@@ -5089,9 +5172,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/binutils && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif binutils-bootstrap
 
 
@@ -5132,9 +5213,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/binutils && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif binutils-bootstrap
 
 
@@ -5561,7 +5640,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/bison && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-bison))
 @endif bison
 
@@ -6004,7 +6083,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/cgen && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-cgen))
 @endif cgen
 
@@ -6444,7 +6523,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/dejagnu && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-dejagnu))
 @endif dejagnu
 
@@ -6884,7 +6963,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/etc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-etc))
 @endif etc
 
@@ -7324,7 +7403,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/fastjar && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-fastjar))
 @endif fastjar
 
@@ -7767,7 +7846,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/fixincludes && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-fixincludes))
 @endif fixincludes
 
@@ -8191,7 +8270,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/flex && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-flex))
 @endif flex
 
@@ -8830,7 +8909,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gas && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-gas))
 @endif gas
 
@@ -8858,7 +8937,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-gas)
 
@@ -8873,7 +8953,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/gas && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif gas-bootstrap
 
 
@@ -8914,9 +8994,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gas && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gas-bootstrap
 
 
@@ -8957,9 +9035,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gas && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gas-bootstrap
 
 
@@ -9000,9 +9076,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gas && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gas-bootstrap
 
 
@@ -9043,9 +9117,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gas && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gas-bootstrap
 
 
@@ -9086,9 +9158,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gas && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gas-bootstrap
 
 
@@ -9711,7 +9781,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		$(TARGET-gcc))
 @endif gcc
 
@@ -9739,7 +9809,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)  $(EXTRA_GCC_FLAGS) \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-gcc)
 
@@ -9754,7 +9825,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(EXTRA_GCC_FLAGS) clean
+	$(STAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -9795,9 +9866,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		$(EXTRA_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -9838,9 +9907,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		$(EXTRA_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -9881,9 +9948,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		$(EXTRA_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -9924,9 +9989,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		$(EXTRA_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -9967,9 +10030,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gcc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		$(EXTRA_GCC_FLAGS) clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) clean
 @endif gcc-bootstrap
 
 
@@ -10598,7 +10659,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gmp && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-gmp))
 @endif gmp
 
@@ -10626,7 +10687,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-gmp)
 
@@ -10641,7 +10703,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif gmp-bootstrap
 
 
@@ -10682,9 +10744,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gmp-bootstrap
 
 
@@ -10725,9 +10785,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gmp-bootstrap
 
 
@@ -10768,9 +10826,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gmp-bootstrap
 
 
@@ -10811,9 +10867,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gmp-bootstrap
 
 
@@ -10854,9 +10908,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gmp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gmp-bootstrap
 
 
@@ -11473,7 +11525,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/mpfr && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-mpfr))
 @endif mpfr
 
@@ -11501,7 +11553,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-mpfr)
 
@@ -11516,7 +11569,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/mpfr && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif mpfr-bootstrap
 
 
@@ -11557,9 +11610,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpfr && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpfr-bootstrap
 
 
@@ -11600,9 +11651,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpfr && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpfr-bootstrap
 
 
@@ -11643,9 +11692,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpfr && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpfr-bootstrap
 
 
@@ -11686,9 +11733,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpfr && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpfr-bootstrap
 
 
@@ -11729,9 +11774,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpfr && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpfr-bootstrap
 
 
@@ -12348,7 +12391,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/mpc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-mpc))
 @endif mpc
 
@@ -12376,7 +12419,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-mpc)
 
@@ -12391,7 +12435,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/mpc && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif mpc-bootstrap
 
 
@@ -12432,9 +12476,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpc-bootstrap
 
 
@@ -12475,9 +12517,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpc-bootstrap
 
 
@@ -12518,9 +12558,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpc-bootstrap
 
 
@@ -12561,9 +12599,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpc-bootstrap
 
 
@@ -12604,9 +12640,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/mpc && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif mpc-bootstrap
 
 
@@ -12974,276 +13008,276 @@
 
 
 
-.PHONY: configure-ppl maybe-configure-ppl
-maybe-configure-ppl:
+.PHONY: configure-isl maybe-configure-isl
+maybe-configure-isl:
 @if gcc-bootstrap
-configure-ppl: stage_current
+configure-isl: stage_current
 @endif gcc-bootstrap
-@if ppl
-maybe-configure-ppl: configure-ppl
-configure-ppl: 
+@if isl
+maybe-configure-isl: configure-isl
+configure-isl: 
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \
+	test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \
 	$(HOST_EXPORTS)  \
-	echo Configuring in $(HOST_SUBDIR)/ppl; \
-	cd "$(HOST_SUBDIR)/ppl" || exit 1; \
+	echo Configuring in $(HOST_SUBDIR)/isl; \
+	cd "$(HOST_SUBDIR)/isl" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \
+	  *) topdir=`echo $(HOST_SUBDIR)/isl/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/ppl"; \
-	libsrcdir="$$s/ppl"; \
+	srcdiroption="--srcdir=$${topdir}/isl"; \
+	libsrcdir="$$s/isl"; \
 	$(SHELL) $${libsrcdir}/configure \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=${target_alias} $${srcdiroption} --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/ \
+	  --target=${target_alias} $${srcdiroption} --disable-shared @extra_isl_gmp_configure_flags@ \
 	  || exit 1
-@endif ppl
+@endif isl
 
 
 
-.PHONY: configure-stage1-ppl maybe-configure-stage1-ppl
-maybe-configure-stage1-ppl:
-@if ppl-bootstrap
-maybe-configure-stage1-ppl: configure-stage1-ppl
-configure-stage1-ppl:
+.PHONY: configure-stage1-isl maybe-configure-stage1-isl
+maybe-configure-stage1-isl:
+@if isl-bootstrap
+maybe-configure-stage1-isl: configure-stage1-isl
+configure-stage1-isl:
 	@[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
-	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE1_TFLAGS)"; \
-	test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \
+	test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \
 	$(HOST_EXPORTS) \
 	CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \
 	LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS;  \
-	echo Configuring stage 1 in $(HOST_SUBDIR)/ppl ; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \
-	cd $(HOST_SUBDIR)/ppl || exit 1; \
+	echo Configuring stage 1 in $(HOST_SUBDIR)/isl ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \
+	cd $(HOST_SUBDIR)/isl || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \
+	  *) topdir=`echo $(HOST_SUBDIR)/isl/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/ppl"; \
-	libsrcdir="$$s/ppl"; \
+	srcdiroption="--srcdir=$${topdir}/isl"; \
+	libsrcdir="$$s/isl"; \
 	$(SHELL) $${libsrcdir}/configure \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} $${srcdiroption} \
 	  $(STAGE1_CONFIGURE_FLAGS) \
-	  --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/
-@endif ppl-bootstrap
+	  --disable-shared @extra_isl_gmp_configure_flags@
+@endif isl-bootstrap
 
-.PHONY: configure-stage2-ppl maybe-configure-stage2-ppl
-maybe-configure-stage2-ppl:
-@if ppl-bootstrap
-maybe-configure-stage2-ppl: configure-stage2-ppl
-configure-stage2-ppl:
+.PHONY: configure-stage2-isl maybe-configure-stage2-isl
+maybe-configure-stage2-isl:
+@if isl-bootstrap
+maybe-configure-stage2-isl: configure-stage2-isl
+configure-stage2-isl:
 	@[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
-	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE2_TFLAGS)"; \
-	test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \
+	test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGE2_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGE2_CXXFLAGS)"; export CXXFLAGS; \
 	LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS;  \
-	echo Configuring stage 2 in $(HOST_SUBDIR)/ppl ; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \
-	cd $(HOST_SUBDIR)/ppl || exit 1; \
+	echo Configuring stage 2 in $(HOST_SUBDIR)/isl ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \
+	cd $(HOST_SUBDIR)/isl || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \
+	  *) topdir=`echo $(HOST_SUBDIR)/isl/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/ppl"; \
-	libsrcdir="$$s/ppl"; \
+	srcdiroption="--srcdir=$${topdir}/isl"; \
+	libsrcdir="$$s/isl"; \
 	$(SHELL) $${libsrcdir}/configure \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE2_CONFIGURE_FLAGS) \
-	  --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/
-@endif ppl-bootstrap
+	  --disable-shared @extra_isl_gmp_configure_flags@
+@endif isl-bootstrap
 
-.PHONY: configure-stage3-ppl maybe-configure-stage3-ppl
-maybe-configure-stage3-ppl:
-@if ppl-bootstrap
-maybe-configure-stage3-ppl: configure-stage3-ppl
-configure-stage3-ppl:
+.PHONY: configure-stage3-isl maybe-configure-stage3-isl
+maybe-configure-stage3-isl:
+@if isl-bootstrap
+maybe-configure-stage3-isl: configure-stage3-isl
+configure-stage3-isl:
 	@[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
-	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE3_TFLAGS)"; \
-	test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \
+	test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGE3_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGE3_CXXFLAGS)"; export CXXFLAGS; \
 	LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS;  \
-	echo Configuring stage 3 in $(HOST_SUBDIR)/ppl ; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \
-	cd $(HOST_SUBDIR)/ppl || exit 1; \
+	echo Configuring stage 3 in $(HOST_SUBDIR)/isl ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \
+	cd $(HOST_SUBDIR)/isl || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \
+	  *) topdir=`echo $(HOST_SUBDIR)/isl/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/ppl"; \
-	libsrcdir="$$s/ppl"; \
+	srcdiroption="--srcdir=$${topdir}/isl"; \
+	libsrcdir="$$s/isl"; \
 	$(SHELL) $${libsrcdir}/configure \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE3_CONFIGURE_FLAGS) \
-	  --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/
-@endif ppl-bootstrap
+	  --disable-shared @extra_isl_gmp_configure_flags@
+@endif isl-bootstrap
 
-.PHONY: configure-stage4-ppl maybe-configure-stage4-ppl
-maybe-configure-stage4-ppl:
-@if ppl-bootstrap
-maybe-configure-stage4-ppl: configure-stage4-ppl
-configure-stage4-ppl:
+.PHONY: configure-stage4-isl maybe-configure-stage4-isl
+maybe-configure-stage4-isl:
+@if isl-bootstrap
+maybe-configure-stage4-isl: configure-stage4-isl
+configure-stage4-isl:
 	@[ $(current_stage) = stage4 ] || $(MAKE) stage4-start
-	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE4_TFLAGS)"; \
-	test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \
+	test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGE4_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGE4_CXXFLAGS)"; export CXXFLAGS; \
 	LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS;  \
-	echo Configuring stage 4 in $(HOST_SUBDIR)/ppl ; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \
-	cd $(HOST_SUBDIR)/ppl || exit 1; \
+	echo Configuring stage 4 in $(HOST_SUBDIR)/isl ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \
+	cd $(HOST_SUBDIR)/isl || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \
+	  *) topdir=`echo $(HOST_SUBDIR)/isl/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/ppl"; \
-	libsrcdir="$$s/ppl"; \
+	srcdiroption="--srcdir=$${topdir}/isl"; \
+	libsrcdir="$$s/isl"; \
 	$(SHELL) $${libsrcdir}/configure \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE4_CONFIGURE_FLAGS) \
-	  --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/
-@endif ppl-bootstrap
+	  --disable-shared @extra_isl_gmp_configure_flags@
+@endif isl-bootstrap
 
-.PHONY: configure-stageprofile-ppl maybe-configure-stageprofile-ppl
-maybe-configure-stageprofile-ppl:
-@if ppl-bootstrap
-maybe-configure-stageprofile-ppl: configure-stageprofile-ppl
-configure-stageprofile-ppl:
+.PHONY: configure-stageprofile-isl maybe-configure-stageprofile-isl
+maybe-configure-stageprofile-isl:
+@if isl-bootstrap
+maybe-configure-stageprofile-isl: configure-stageprofile-isl
+configure-stageprofile-isl:
 	@[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start
-	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGEprofile_TFLAGS)"; \
-	test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \
+	test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGEprofile_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGEprofile_CXXFLAGS)"; export CXXFLAGS; \
 	LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS;  \
-	echo Configuring stage profile in $(HOST_SUBDIR)/ppl ; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \
-	cd $(HOST_SUBDIR)/ppl || exit 1; \
+	echo Configuring stage profile in $(HOST_SUBDIR)/isl ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \
+	cd $(HOST_SUBDIR)/isl || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \
+	  *) topdir=`echo $(HOST_SUBDIR)/isl/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/ppl"; \
-	libsrcdir="$$s/ppl"; \
+	srcdiroption="--srcdir=$${topdir}/isl"; \
+	libsrcdir="$$s/isl"; \
 	$(SHELL) $${libsrcdir}/configure \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEprofile_CONFIGURE_FLAGS) \
-	  --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/
-@endif ppl-bootstrap
+	  --disable-shared @extra_isl_gmp_configure_flags@
+@endif isl-bootstrap
 
-.PHONY: configure-stagefeedback-ppl maybe-configure-stagefeedback-ppl
-maybe-configure-stagefeedback-ppl:
-@if ppl-bootstrap
-maybe-configure-stagefeedback-ppl: configure-stagefeedback-ppl
-configure-stagefeedback-ppl:
+.PHONY: configure-stagefeedback-isl maybe-configure-stagefeedback-isl
+maybe-configure-stagefeedback-isl:
+@if isl-bootstrap
+maybe-configure-stagefeedback-isl: configure-stagefeedback-isl
+configure-stagefeedback-isl:
 	@[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start
-	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
-	test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \
+	test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGEfeedback_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGEfeedback_CXXFLAGS)"; export CXXFLAGS; \
 	LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS;  \
-	echo Configuring stage feedback in $(HOST_SUBDIR)/ppl ; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \
-	cd $(HOST_SUBDIR)/ppl || exit 1; \
+	echo Configuring stage feedback in $(HOST_SUBDIR)/isl ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \
+	cd $(HOST_SUBDIR)/isl || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \
+	  *) topdir=`echo $(HOST_SUBDIR)/isl/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/ppl"; \
-	libsrcdir="$$s/ppl"; \
+	srcdiroption="--srcdir=$${topdir}/isl"; \
+	libsrcdir="$$s/isl"; \
 	$(SHELL) $${libsrcdir}/configure \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEfeedback_CONFIGURE_FLAGS) \
-	  --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/
-@endif ppl-bootstrap
+	  --disable-shared @extra_isl_gmp_configure_flags@
+@endif isl-bootstrap
 
 
 
 
 
-.PHONY: all-ppl maybe-all-ppl
-maybe-all-ppl:
+.PHONY: all-isl maybe-all-isl
+maybe-all-isl:
 @if gcc-bootstrap
-all-ppl: stage_current
+all-isl: stage_current
 @endif gcc-bootstrap
-@if ppl
-TARGET-ppl=all
-maybe-all-ppl: all-ppl
-all-ppl: configure-ppl
+@if isl
+TARGET-isl=all
+maybe-all-isl: all-isl
+all-isl: configure-isl
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
-	(cd $(HOST_SUBDIR)/ppl && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
-		$(TARGET-ppl))
-@endif ppl
+	(cd $(HOST_SUBDIR)/isl && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) V=1 \
+		$(TARGET-isl))
+@endif isl
 
 
 
-.PHONY: all-stage1-ppl maybe-all-stage1-ppl
-.PHONY: clean-stage1-ppl maybe-clean-stage1-ppl
-maybe-all-stage1-ppl:
-maybe-clean-stage1-ppl:
-@if ppl-bootstrap
-maybe-all-stage1-ppl: all-stage1-ppl
-all-stage1: all-stage1-ppl
-TARGET-stage1-ppl = $(TARGET-ppl)
-all-stage1-ppl: configure-stage1-ppl
+.PHONY: all-stage1-isl maybe-all-stage1-isl
+.PHONY: clean-stage1-isl maybe-clean-stage1-isl
+maybe-all-stage1-isl:
+maybe-clean-stage1-isl:
+@if isl-bootstrap
+maybe-all-stage1-isl: all-stage1-isl
+all-stage1: all-stage1-isl
+TARGET-stage1-isl = $(TARGET-isl)
+all-stage1-isl: configure-stage1-isl
 	@[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE1_TFLAGS)"; \
 	$(HOST_EXPORTS)  \
-	cd $(HOST_SUBDIR)/ppl && \
+	cd $(HOST_SUBDIR)/isl && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGE1_CFLAGS)" \
 		CXXFLAGS="$(STAGE1_CXXFLAGS)" \
@@ -13251,41 +13285,42 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS) V=1 \
 		TFLAGS="$(STAGE1_TFLAGS)" \
-		$(TARGET-stage1-ppl)
+		$(TARGET-stage1-isl)
 
-maybe-clean-stage1-ppl: clean-stage1-ppl
-clean-stage1: clean-stage1-ppl
-clean-stage1-ppl:
+maybe-clean-stage1-isl: clean-stage1-isl
+clean-stage1: clean-stage1-isl
+clean-stage1-isl:
 	@if [ $(current_stage) = stage1 ]; then \
-	  [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \
 	else \
-	  [ -f $(HOST_SUBDIR)/stage1-ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/stage1-isl/Makefile ] || exit 0; \
 	  $(MAKE) stage1-start; \
 	fi; \
-	cd $(HOST_SUBDIR)/ppl && \
+	cd $(HOST_SUBDIR)/isl && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
-@endif ppl-bootstrap
+	$(STAGE1_FLAGS_TO_PASS) V=1 clean
+@endif isl-bootstrap
 
 
-.PHONY: all-stage2-ppl maybe-all-stage2-ppl
-.PHONY: clean-stage2-ppl maybe-clean-stage2-ppl
-maybe-all-stage2-ppl:
-maybe-clean-stage2-ppl:
-@if ppl-bootstrap
-maybe-all-stage2-ppl: all-stage2-ppl
-all-stage2: all-stage2-ppl
-TARGET-stage2-ppl = $(TARGET-ppl)
-all-stage2-ppl: configure-stage2-ppl
+.PHONY: all-stage2-isl maybe-all-stage2-isl
+.PHONY: clean-stage2-isl maybe-clean-stage2-isl
+maybe-all-stage2-isl:
+maybe-clean-stage2-isl:
+@if isl-bootstrap
+maybe-all-stage2-isl: all-stage2-isl
+all-stage2: all-stage2-isl
+TARGET-stage2-isl = $(TARGET-isl)
+all-stage2-isl: configure-stage2-isl
 	@[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE2_TFLAGS)"; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS)  \
-	cd $(HOST_SUBDIR)/ppl && \
+	cd $(HOST_SUBDIR)/isl && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGE2_CFLAGS)" \
 		CXXFLAGS="$(STAGE2_CXXFLAGS)" \
@@ -13293,42 +13328,40 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 \
 		TFLAGS="$(STAGE2_TFLAGS)" \
-		$(TARGET-stage2-ppl)
+		$(TARGET-stage2-isl)
 
-maybe-clean-stage2-ppl: clean-stage2-ppl
-clean-stage2: clean-stage2-ppl
-clean-stage2-ppl:
+maybe-clean-stage2-isl: clean-stage2-isl
+clean-stage2: clean-stage2-isl
+clean-stage2-isl:
 	@if [ $(current_stage) = stage2 ]; then \
-	  [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \
 	else \
-	  [ -f $(HOST_SUBDIR)/stage2-ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/stage2-isl/Makefile ] || exit 0; \
 	  $(MAKE) stage2-start; \
 	fi; \
-	cd $(HOST_SUBDIR)/ppl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
-@endif ppl-bootstrap
+	cd $(HOST_SUBDIR)/isl && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 clean
+@endif isl-bootstrap
 
 
-.PHONY: all-stage3-ppl maybe-all-stage3-ppl
-.PHONY: clean-stage3-ppl maybe-clean-stage3-ppl
-maybe-all-stage3-ppl:
-maybe-clean-stage3-ppl:
-@if ppl-bootstrap
-maybe-all-stage3-ppl: all-stage3-ppl
-all-stage3: all-stage3-ppl
-TARGET-stage3-ppl = $(TARGET-ppl)
-all-stage3-ppl: configure-stage3-ppl
+.PHONY: all-stage3-isl maybe-all-stage3-isl
+.PHONY: clean-stage3-isl maybe-clean-stage3-isl
+maybe-all-stage3-isl:
+maybe-clean-stage3-isl:
+@if isl-bootstrap
+maybe-all-stage3-isl: all-stage3-isl
+all-stage3: all-stage3-isl
+TARGET-stage3-isl = $(TARGET-isl)
+all-stage3-isl: configure-stage3-isl
 	@[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE3_TFLAGS)"; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS)  \
-	cd $(HOST_SUBDIR)/ppl && \
+	cd $(HOST_SUBDIR)/isl && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGE3_CFLAGS)" \
 		CXXFLAGS="$(STAGE3_CXXFLAGS)" \
@@ -13336,42 +13369,40 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 \
 		TFLAGS="$(STAGE3_TFLAGS)" \
-		$(TARGET-stage3-ppl)
+		$(TARGET-stage3-isl)
 
-maybe-clean-stage3-ppl: clean-stage3-ppl
-clean-stage3: clean-stage3-ppl
-clean-stage3-ppl:
+maybe-clean-stage3-isl: clean-stage3-isl
+clean-stage3: clean-stage3-isl
+clean-stage3-isl:
 	@if [ $(current_stage) = stage3 ]; then \
-	  [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \
 	else \
-	  [ -f $(HOST_SUBDIR)/stage3-ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/stage3-isl/Makefile ] || exit 0; \
 	  $(MAKE) stage3-start; \
 	fi; \
-	cd $(HOST_SUBDIR)/ppl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
-@endif ppl-bootstrap
+	cd $(HOST_SUBDIR)/isl && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 clean
+@endif isl-bootstrap
 
 
-.PHONY: all-stage4-ppl maybe-all-stage4-ppl
-.PHONY: clean-stage4-ppl maybe-clean-stage4-ppl
-maybe-all-stage4-ppl:
-maybe-clean-stage4-ppl:
-@if ppl-bootstrap
-maybe-all-stage4-ppl: all-stage4-ppl
-all-stage4: all-stage4-ppl
-TARGET-stage4-ppl = $(TARGET-ppl)
-all-stage4-ppl: configure-stage4-ppl
+.PHONY: all-stage4-isl maybe-all-stage4-isl
+.PHONY: clean-stage4-isl maybe-clean-stage4-isl
+maybe-all-stage4-isl:
+maybe-clean-stage4-isl:
+@if isl-bootstrap
+maybe-all-stage4-isl: all-stage4-isl
+all-stage4: all-stage4-isl
+TARGET-stage4-isl = $(TARGET-isl)
+all-stage4-isl: configure-stage4-isl
 	@[ $(current_stage) = stage4 ] || $(MAKE) stage4-start
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE4_TFLAGS)"; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS)  \
-	cd $(HOST_SUBDIR)/ppl && \
+	cd $(HOST_SUBDIR)/isl && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGE4_CFLAGS)" \
 		CXXFLAGS="$(STAGE4_CXXFLAGS)" \
@@ -13379,42 +13410,40 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 \
 		TFLAGS="$(STAGE4_TFLAGS)" \
-		$(TARGET-stage4-ppl)
+		$(TARGET-stage4-isl)
 
-maybe-clean-stage4-ppl: clean-stage4-ppl
-clean-stage4: clean-stage4-ppl
-clean-stage4-ppl:
+maybe-clean-stage4-isl: clean-stage4-isl
+clean-stage4: clean-stage4-isl
+clean-stage4-isl:
 	@if [ $(current_stage) = stage4 ]; then \
-	  [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \
 	else \
-	  [ -f $(HOST_SUBDIR)/stage4-ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/stage4-isl/Makefile ] || exit 0; \
 	  $(MAKE) stage4-start; \
 	fi; \
-	cd $(HOST_SUBDIR)/ppl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
-@endif ppl-bootstrap
+	cd $(HOST_SUBDIR)/isl && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 clean
+@endif isl-bootstrap
 
 
-.PHONY: all-stageprofile-ppl maybe-all-stageprofile-ppl
-.PHONY: clean-stageprofile-ppl maybe-clean-stageprofile-ppl
-maybe-all-stageprofile-ppl:
-maybe-clean-stageprofile-ppl:
-@if ppl-bootstrap
-maybe-all-stageprofile-ppl: all-stageprofile-ppl
-all-stageprofile: all-stageprofile-ppl
-TARGET-stageprofile-ppl = $(TARGET-ppl)
-all-stageprofile-ppl: configure-stageprofile-ppl
+.PHONY: all-stageprofile-isl maybe-all-stageprofile-isl
+.PHONY: clean-stageprofile-isl maybe-clean-stageprofile-isl
+maybe-all-stageprofile-isl:
+maybe-clean-stageprofile-isl:
+@if isl-bootstrap
+maybe-all-stageprofile-isl: all-stageprofile-isl
+all-stageprofile: all-stageprofile-isl
+TARGET-stageprofile-isl = $(TARGET-isl)
+all-stageprofile-isl: configure-stageprofile-isl
 	@[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGEprofile_TFLAGS)"; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS)  \
-	cd $(HOST_SUBDIR)/ppl && \
+	cd $(HOST_SUBDIR)/isl && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGEprofile_CFLAGS)" \
 		CXXFLAGS="$(STAGEprofile_CXXFLAGS)" \
@@ -13422,42 +13451,40 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 \
 		TFLAGS="$(STAGEprofile_TFLAGS)" \
-		$(TARGET-stageprofile-ppl)
+		$(TARGET-stageprofile-isl)
 
-maybe-clean-stageprofile-ppl: clean-stageprofile-ppl
-clean-stageprofile: clean-stageprofile-ppl
-clean-stageprofile-ppl:
+maybe-clean-stageprofile-isl: clean-stageprofile-isl
+clean-stageprofile: clean-stageprofile-isl
+clean-stageprofile-isl:
 	@if [ $(current_stage) = stageprofile ]; then \
-	  [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \
 	else \
-	  [ -f $(HOST_SUBDIR)/stageprofile-ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/stageprofile-isl/Makefile ] || exit 0; \
 	  $(MAKE) stageprofile-start; \
 	fi; \
-	cd $(HOST_SUBDIR)/ppl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
-@endif ppl-bootstrap
+	cd $(HOST_SUBDIR)/isl && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 clean
+@endif isl-bootstrap
 
 
-.PHONY: all-stagefeedback-ppl maybe-all-stagefeedback-ppl
-.PHONY: clean-stagefeedback-ppl maybe-clean-stagefeedback-ppl
-maybe-all-stagefeedback-ppl:
-maybe-clean-stagefeedback-ppl:
-@if ppl-bootstrap
-maybe-all-stagefeedback-ppl: all-stagefeedback-ppl
-all-stagefeedback: all-stagefeedback-ppl
-TARGET-stagefeedback-ppl = $(TARGET-ppl)
-all-stagefeedback-ppl: configure-stagefeedback-ppl
+.PHONY: all-stagefeedback-isl maybe-all-stagefeedback-isl
+.PHONY: clean-stagefeedback-isl maybe-clean-stagefeedback-isl
+maybe-all-stagefeedback-isl:
+maybe-clean-stagefeedback-isl:
+@if isl-bootstrap
+maybe-all-stagefeedback-isl: all-stagefeedback-isl
+all-stagefeedback: all-stagefeedback-isl
+TARGET-stagefeedback-isl = $(TARGET-isl)
+all-stagefeedback-isl: configure-stagefeedback-isl
 	@[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
 	$(HOST_EXPORTS) \
 	$(POSTSTAGE1_HOST_EXPORTS)  \
-	cd $(HOST_SUBDIR)/ppl && \
+	cd $(HOST_SUBDIR)/isl && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGEfeedback_CFLAGS)" \
 		CXXFLAGS="$(STAGEfeedback_CXXFLAGS)" \
@@ -13465,80 +13492,78 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 \
 		TFLAGS="$(STAGEfeedback_TFLAGS)" \
-		$(TARGET-stagefeedback-ppl)
+		$(TARGET-stagefeedback-isl)
 
-maybe-clean-stagefeedback-ppl: clean-stagefeedback-ppl
-clean-stagefeedback: clean-stagefeedback-ppl
-clean-stagefeedback-ppl:
+maybe-clean-stagefeedback-isl: clean-stagefeedback-isl
+clean-stagefeedback: clean-stagefeedback-isl
+clean-stagefeedback-isl:
 	@if [ $(current_stage) = stagefeedback ]; then \
-	  [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \
 	else \
-	  [ -f $(HOST_SUBDIR)/stagefeedback-ppl/Makefile ] || exit 0; \
+	  [ -f $(HOST_SUBDIR)/stagefeedback-isl/Makefile ] || exit 0; \
 	  $(MAKE) stagefeedback-start; \
 	fi; \
-	cd $(HOST_SUBDIR)/ppl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
-@endif ppl-bootstrap
+	cd $(HOST_SUBDIR)/isl && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) V=1 clean
+@endif isl-bootstrap
 
 
 
 
 
-.PHONY: check-ppl maybe-check-ppl
-maybe-check-ppl:
-@if ppl
-maybe-check-ppl: check-ppl
+.PHONY: check-isl maybe-check-isl
+maybe-check-isl:
+@if isl
+maybe-check-isl: check-isl
 
-check-ppl:
+check-isl:
 	@: $(MAKE); $(unstage)
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	(cd $(HOST_SUBDIR)/ppl && \
-	  $(MAKE) $(FLAGS_TO_PASS)  check)
+	(cd $(HOST_SUBDIR)/isl && \
+	  $(MAKE) $(FLAGS_TO_PASS) V=1 check)
 
-@endif ppl
+@endif isl
 
-.PHONY: install-ppl maybe-install-ppl
-maybe-install-ppl:
-@if ppl
-maybe-install-ppl: install-ppl
+.PHONY: install-isl maybe-install-isl
+maybe-install-isl:
+@if isl
+maybe-install-isl: install-isl
 
-install-ppl:
+install-isl:
 
-@endif ppl
+@endif isl
 
-.PHONY: install-strip-ppl maybe-install-strip-ppl
-maybe-install-strip-ppl:
-@if ppl
-maybe-install-strip-ppl: install-strip-ppl
+.PHONY: install-strip-isl maybe-install-strip-isl
+maybe-install-strip-isl:
+@if isl
+maybe-install-strip-isl: install-strip-isl
 
-install-strip-ppl:
+install-strip-isl:
 
-@endif ppl
+@endif isl
 
 # Other targets (info, dvi, pdf, etc.)
 
-.PHONY: maybe-info-ppl info-ppl
-maybe-info-ppl:
-@if ppl
-maybe-info-ppl: info-ppl
+.PHONY: maybe-info-isl info-isl
+maybe-info-isl:
+@if isl
+maybe-info-isl: info-isl
 
-info-ppl: \
-    configure-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+info-isl: \
+    configure-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing info in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing info in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13546,24 +13571,24 @@
 	          info) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-dvi-ppl dvi-ppl
-maybe-dvi-ppl:
-@if ppl
-maybe-dvi-ppl: dvi-ppl
+.PHONY: maybe-dvi-isl dvi-isl
+maybe-dvi-isl:
+@if isl
+maybe-dvi-isl: dvi-isl
 
-dvi-ppl: \
-    configure-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+dvi-isl: \
+    configure-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing dvi in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing dvi in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13571,24 +13596,24 @@
 	          dvi) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-pdf-ppl pdf-ppl
-maybe-pdf-ppl:
-@if ppl
-maybe-pdf-ppl: pdf-ppl
+.PHONY: maybe-pdf-isl pdf-isl
+maybe-pdf-isl:
+@if isl
+maybe-pdf-isl: pdf-isl
 
-pdf-ppl: \
-    configure-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+pdf-isl: \
+    configure-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing pdf in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing pdf in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13596,24 +13621,24 @@
 	          pdf) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-html-ppl html-ppl
-maybe-html-ppl:
-@if ppl
-maybe-html-ppl: html-ppl
+.PHONY: maybe-html-isl html-isl
+maybe-html-isl:
+@if isl
+maybe-html-isl: html-isl
 
-html-ppl: \
-    configure-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+html-isl: \
+    configure-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing html in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing html in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13621,24 +13646,24 @@
 	          html) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-TAGS-ppl TAGS-ppl
-maybe-TAGS-ppl:
-@if ppl
-maybe-TAGS-ppl: TAGS-ppl
+.PHONY: maybe-TAGS-isl TAGS-isl
+maybe-TAGS-isl:
+@if isl
+maybe-TAGS-isl: TAGS-isl
 
-TAGS-ppl: \
-    configure-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+TAGS-isl: \
+    configure-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing TAGS in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing TAGS in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13646,25 +13671,25 @@
 	          TAGS) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-install-info-ppl install-info-ppl
-maybe-install-info-ppl:
-@if ppl
-maybe-install-info-ppl: install-info-ppl
+.PHONY: maybe-install-info-isl install-info-isl
+maybe-install-info-isl:
+@if isl
+maybe-install-info-isl: install-info-isl
 
-install-info-ppl: \
-    configure-ppl \
-    info-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+install-info-isl: \
+    configure-isl \
+    info-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing install-info in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing install-info in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13672,25 +13697,25 @@
 	          install-info) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-install-pdf-ppl install-pdf-ppl
-maybe-install-pdf-ppl:
-@if ppl
-maybe-install-pdf-ppl: install-pdf-ppl
+.PHONY: maybe-install-pdf-isl install-pdf-isl
+maybe-install-pdf-isl:
+@if isl
+maybe-install-pdf-isl: install-pdf-isl
 
-install-pdf-ppl: \
-    configure-ppl \
-    pdf-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+install-pdf-isl: \
+    configure-isl \
+    pdf-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing install-pdf in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing install-pdf in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13698,25 +13723,25 @@
 	          install-pdf) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-install-html-ppl install-html-ppl
-maybe-install-html-ppl:
-@if ppl
-maybe-install-html-ppl: install-html-ppl
+.PHONY: maybe-install-html-isl install-html-isl
+maybe-install-html-isl:
+@if isl
+maybe-install-html-isl: install-html-isl
 
-install-html-ppl: \
-    configure-ppl \
-    html-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+install-html-isl: \
+    configure-isl \
+    html-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing install-html in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing install-html in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13724,24 +13749,24 @@
 	          install-html) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-installcheck-ppl installcheck-ppl
-maybe-installcheck-ppl:
-@if ppl
-maybe-installcheck-ppl: installcheck-ppl
+.PHONY: maybe-installcheck-isl installcheck-isl
+maybe-installcheck-isl:
+@if isl
+maybe-installcheck-isl: installcheck-isl
 
-installcheck-ppl: \
-    configure-ppl 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+installcheck-isl: \
+    configure-isl 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing installcheck in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing installcheck in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13749,23 +13774,23 @@
 	          installcheck) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-mostlyclean-ppl mostlyclean-ppl
-maybe-mostlyclean-ppl:
-@if ppl
-maybe-mostlyclean-ppl: mostlyclean-ppl
+.PHONY: maybe-mostlyclean-isl mostlyclean-isl
+maybe-mostlyclean-isl:
+@if isl
+maybe-mostlyclean-isl: mostlyclean-isl
 
-mostlyclean-ppl: 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+mostlyclean-isl: 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing mostlyclean in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing mostlyclean in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13773,23 +13798,23 @@
 	          mostlyclean) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-clean-ppl clean-ppl
-maybe-clean-ppl:
-@if ppl
-maybe-clean-ppl: clean-ppl
+.PHONY: maybe-clean-isl clean-isl
+maybe-clean-isl:
+@if isl
+maybe-clean-isl: clean-isl
 
-clean-ppl: 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+clean-isl: 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing clean in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing clean in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13797,23 +13822,23 @@
 	          clean) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-distclean-ppl distclean-ppl
-maybe-distclean-ppl:
-@if ppl
-maybe-distclean-ppl: distclean-ppl
+.PHONY: maybe-distclean-isl distclean-isl
+maybe-distclean-isl:
+@if isl
+maybe-distclean-isl: distclean-isl
 
-distclean-ppl: 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+distclean-isl: 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing distclean in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing distclean in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13821,23 +13846,23 @@
 	          distclean) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
-.PHONY: maybe-maintainer-clean-ppl maintainer-clean-ppl
-maybe-maintainer-clean-ppl:
-@if ppl
-maybe-maintainer-clean-ppl: maintainer-clean-ppl
+.PHONY: maybe-maintainer-clean-isl maintainer-clean-isl
+maybe-maintainer-clean-isl:
+@if isl
+maybe-maintainer-clean-isl: maintainer-clean-isl
 
-maintainer-clean-ppl: 
-	@[ -f ./ppl/Makefile ] || exit 0; \
+maintainer-clean-isl: 
+	@[ -f ./isl/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	for flag in $(EXTRA_HOST_FLAGS) V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	echo "Doing maintainer-clean in ppl" ; \
-	(cd $(HOST_SUBDIR)/ppl && \
+	echo "Doing maintainer-clean in isl" ; \
+	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -13845,7 +13870,7 @@
 	          maintainer-clean) \
 	  || exit 1
 
-@endif ppl
+@endif isl
 
 
 
@@ -13861,7 +13886,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	test ! -f $(HOST_SUBDIR)/cloog/Makefile || exit 0; \
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \
-	$(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	$(HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	echo Configuring in $(HOST_SUBDIR)/cloog; \
 	cd "$(HOST_SUBDIR)/cloog" || exit 1; \
 	case $(srcdir) in \
@@ -13873,7 +13898,7 @@
 	libsrcdir="$$s/cloog"; \
 	$(SHELL) $${libsrcdir}/configure \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=${target_alias} $${srcdiroption} --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl \
+	  --target=${target_alias} $${srcdiroption} --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system \
 	  || exit 1
 @endif cloog
 
@@ -13893,7 +13918,7 @@
 	$(HOST_EXPORTS) \
 	CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \
-	LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	echo Configuring stage 1 in $(HOST_SUBDIR)/cloog ; \
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \
 	cd $(HOST_SUBDIR)/cloog || exit 1; \
@@ -13908,7 +13933,7 @@
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
 	  --target=${target_alias} $${srcdiroption} \
 	  $(STAGE1_CONFIGURE_FLAGS) \
-	  --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl
+	  --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system
 @endif cloog-bootstrap
 
 .PHONY: configure-stage2-cloog maybe-configure-stage2-cloog
@@ -13926,7 +13951,7 @@
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGE2_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGE2_CXXFLAGS)"; export CXXFLAGS; \
-	LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	echo Configuring stage 2 in $(HOST_SUBDIR)/cloog ; \
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \
 	cd $(HOST_SUBDIR)/cloog || exit 1; \
@@ -13942,7 +13967,7 @@
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE2_CONFIGURE_FLAGS) \
-	  --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl
+	  --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system
 @endif cloog-bootstrap
 
 .PHONY: configure-stage3-cloog maybe-configure-stage3-cloog
@@ -13960,7 +13985,7 @@
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGE3_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGE3_CXXFLAGS)"; export CXXFLAGS; \
-	LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	echo Configuring stage 3 in $(HOST_SUBDIR)/cloog ; \
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \
 	cd $(HOST_SUBDIR)/cloog || exit 1; \
@@ -13976,7 +14001,7 @@
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE3_CONFIGURE_FLAGS) \
-	  --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl
+	  --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system
 @endif cloog-bootstrap
 
 .PHONY: configure-stage4-cloog maybe-configure-stage4-cloog
@@ -13994,7 +14019,7 @@
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGE4_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGE4_CXXFLAGS)"; export CXXFLAGS; \
-	LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	echo Configuring stage 4 in $(HOST_SUBDIR)/cloog ; \
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \
 	cd $(HOST_SUBDIR)/cloog || exit 1; \
@@ -14010,7 +14035,7 @@
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE4_CONFIGURE_FLAGS) \
-	  --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl
+	  --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system
 @endif cloog-bootstrap
 
 .PHONY: configure-stageprofile-cloog maybe-configure-stageprofile-cloog
@@ -14028,7 +14053,7 @@
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGEprofile_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGEprofile_CXXFLAGS)"; export CXXFLAGS; \
-	LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	echo Configuring stage profile in $(HOST_SUBDIR)/cloog ; \
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \
 	cd $(HOST_SUBDIR)/cloog || exit 1; \
@@ -14044,7 +14069,7 @@
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEprofile_CONFIGURE_FLAGS) \
-	  --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl
+	  --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system
 @endif cloog-bootstrap
 
 .PHONY: configure-stagefeedback-cloog maybe-configure-stagefeedback-cloog
@@ -14062,7 +14087,7 @@
 	$(POSTSTAGE1_HOST_EXPORTS) \
 	CFLAGS="$(STAGEfeedback_CFLAGS)"; export CFLAGS; \
 	CXXFLAGS="$(STAGEfeedback_CXXFLAGS)"; export CXXFLAGS; \
-	LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	echo Configuring stage feedback in $(HOST_SUBDIR)/cloog ; \
 	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \
 	cd $(HOST_SUBDIR)/cloog || exit 1; \
@@ -14078,7 +14103,7 @@
 	  --target=${target_alias} $${srcdiroption} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGEfeedback_CONFIGURE_FLAGS) \
-	  --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl
+	  --disable-shared --with-gmp=system --with-bits=gmp --with-isl=system
 @endif cloog-bootstrap
 
 
@@ -14096,9 +14121,9 @@
 all-cloog: configure-cloog
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	$(HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	(cd $(HOST_SUBDIR)/cloog && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 \
 		$(TARGET-cloog))
 @endif cloog
 
@@ -14117,7 +14142,7 @@
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE1_TFLAGS)"; \
-	$(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	$(HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	cd $(HOST_SUBDIR)/cloog && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGE1_CFLAGS)" \
@@ -14126,7 +14151,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)  CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-cloog)
 
@@ -14141,7 +14167,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/cloog && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean
+	$(STAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 clean
 @endif cloog-bootstrap
 
 
@@ -14159,7 +14185,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE2_TFLAGS)"; \
 	$(HOST_EXPORTS) \
-	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	cd $(HOST_SUBDIR)/cloog && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGE2_CFLAGS)" \
@@ -14168,7 +14194,7 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 \
 		TFLAGS="$(STAGE2_TFLAGS)" \
 		$(TARGET-stage2-cloog)
 
@@ -14182,9 +14208,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/cloog && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 clean
 @endif cloog-bootstrap
 
 
@@ -14202,7 +14226,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE3_TFLAGS)"; \
 	$(HOST_EXPORTS) \
-	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	cd $(HOST_SUBDIR)/cloog && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGE3_CFLAGS)" \
@@ -14211,7 +14235,7 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 \
 		TFLAGS="$(STAGE3_TFLAGS)" \
 		$(TARGET-stage3-cloog)
 
@@ -14225,9 +14249,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/cloog && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 clean
 @endif cloog-bootstrap
 
 
@@ -14245,7 +14267,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGE4_TFLAGS)"; \
 	$(HOST_EXPORTS) \
-	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	cd $(HOST_SUBDIR)/cloog && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGE4_CFLAGS)" \
@@ -14254,7 +14276,7 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 \
 		TFLAGS="$(STAGE4_TFLAGS)" \
 		$(TARGET-stage4-cloog)
 
@@ -14268,9 +14290,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/cloog && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 clean
 @endif cloog-bootstrap
 
 
@@ -14288,7 +14308,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGEprofile_TFLAGS)"; \
 	$(HOST_EXPORTS) \
-	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	cd $(HOST_SUBDIR)/cloog && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGEprofile_CFLAGS)" \
@@ -14297,7 +14317,7 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 \
 		TFLAGS="$(STAGEprofile_TFLAGS)" \
 		$(TARGET-stageprofile-cloog)
 
@@ -14311,9 +14331,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/cloog && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 clean
 @endif cloog-bootstrap
 
 
@@ -14331,7 +14349,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
 	$(HOST_EXPORTS) \
-	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS;  \
+	$(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="$(HOST_GMPINC) $(HOST_ISLINC) $$CPPFLAGS"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/gmp/.libs -L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS;  \
 	cd $(HOST_SUBDIR)/cloog && \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) \
 		CFLAGS="$(STAGEfeedback_CFLAGS)" \
@@ -14340,7 +14358,7 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 \
 		TFLAGS="$(STAGEfeedback_TFLAGS)" \
 		$(TARGET-stagefeedback-cloog)
 
@@ -14354,9 +14372,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/cloog && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 clean
 @endif cloog-bootstrap
 
 
@@ -14374,7 +14390,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/cloog && \
-	  $(MAKE) $(FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" check)
+	  $(MAKE) $(FLAGS_TO_PASS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1 check)
 
 @endif cloog
 
@@ -14409,7 +14425,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing info in cloog" ; \
@@ -14434,7 +14450,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing dvi in cloog" ; \
@@ -14459,7 +14475,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing pdf in cloog" ; \
@@ -14484,7 +14500,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing html in cloog" ; \
@@ -14509,7 +14525,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing TAGS in cloog" ; \
@@ -14535,7 +14551,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-info in cloog" ; \
@@ -14561,7 +14577,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-pdf in cloog" ; \
@@ -14587,7 +14603,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing install-html in cloog" ; \
@@ -14612,7 +14628,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing installcheck in cloog" ; \
@@ -14636,7 +14652,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing mostlyclean in cloog" ; \
@@ -14660,7 +14676,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing clean in cloog" ; \
@@ -14684,7 +14700,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing distclean in cloog" ; \
@@ -14708,7 +14724,7 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \
+	for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="$$CPPFLAGS" LDFLAGS="$$LDFLAGS" V=1; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
 	echo "Doing maintainer-clean in cloog" ; \
@@ -14973,7 +14989,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/libelf && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-libelf))
 @endif libelf
 
@@ -15001,7 +15017,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-libelf)
 
@@ -15016,7 +15033,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/libelf && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif libelf-bootstrap
 
 
@@ -15057,9 +15074,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libelf && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libelf-bootstrap
 
 
@@ -15100,9 +15115,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libelf && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libelf-bootstrap
 
 
@@ -15143,9 +15156,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libelf && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libelf-bootstrap
 
 
@@ -15186,9 +15197,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libelf && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libelf-bootstrap
 
 
@@ -15229,9 +15238,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libelf && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libelf-bootstrap
 
 
@@ -15842,7 +15849,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gold && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-gold))
 @endif gold
 
@@ -15870,7 +15877,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-gold)
 
@@ -15885,7 +15893,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/gold && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif gold-bootstrap
 
 
@@ -15926,9 +15934,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gold && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gold-bootstrap
 
 
@@ -15969,9 +15975,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gold && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gold-bootstrap
 
 
@@ -16012,9 +16016,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gold && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gold-bootstrap
 
 
@@ -16055,9 +16057,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gold && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gold-bootstrap
 
 
@@ -16098,9 +16098,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/gold && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gold-bootstrap
 
 
@@ -16527,7 +16525,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gprof && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-gprof))
 @endif gprof
 
@@ -17163,7 +17161,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/intl && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-intl))
 @endif intl
 
@@ -17191,7 +17189,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-intl)
 
@@ -17206,7 +17205,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/intl && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif intl-bootstrap
 
 
@@ -17247,9 +17246,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/intl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif intl-bootstrap
 
 
@@ -17290,9 +17287,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/intl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif intl-bootstrap
 
 
@@ -17333,9 +17328,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/intl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif intl-bootstrap
 
 
@@ -17376,9 +17369,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/intl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif intl-bootstrap
 
 
@@ -17419,9 +17410,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/intl && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif intl-bootstrap
 
 
@@ -17848,7 +17837,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/tcl && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-tcl))
 @endif tcl
 
@@ -18273,7 +18262,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/itcl && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-itcl))
 @endif itcl
 
@@ -18909,7 +18898,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/ld && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-ld))
 @endif ld
 
@@ -18937,7 +18926,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-ld)
 
@@ -18952,7 +18942,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/ld && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif ld-bootstrap
 
 
@@ -18993,9 +18983,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/ld && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif ld-bootstrap
 
 
@@ -19036,9 +19024,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/ld && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif ld-bootstrap
 
 
@@ -19079,9 +19065,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/ld && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif ld-bootstrap
 
 
@@ -19122,9 +19106,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/ld && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif ld-bootstrap
 
 
@@ -19165,9 +19147,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/ld && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif ld-bootstrap
 
 
@@ -19547,6 +19527,878 @@
 
 
 
+.PHONY: configure-libbacktrace maybe-configure-libbacktrace
+maybe-configure-libbacktrace:
+@if gcc-bootstrap
+configure-libbacktrace: stage_current
+@endif gcc-bootstrap
+@if libbacktrace
+maybe-configure-libbacktrace: configure-libbacktrace
+configure-libbacktrace: 
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	test ! -f $(HOST_SUBDIR)/libbacktrace/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace ; \
+	$(HOST_EXPORTS)  \
+	echo Configuring in $(HOST_SUBDIR)/libbacktrace; \
+	cd "$(HOST_SUBDIR)/libbacktrace" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/libbacktrace/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libbacktrace"; \
+	libsrcdir="$$s/libbacktrace"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif libbacktrace
+
+
+
+.PHONY: configure-stage1-libbacktrace maybe-configure-stage1-libbacktrace
+maybe-configure-stage1-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-configure-stage1-libbacktrace: configure-stage1-libbacktrace
+configure-stage1-libbacktrace:
+	@[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE1_TFLAGS)"; \
+	test ! -f $(HOST_SUBDIR)/libbacktrace/Makefile || exit 0; \
+	$(HOST_EXPORTS) \
+	CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \
+	CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS;  \
+	echo Configuring stage 1 in $(HOST_SUBDIR)/libbacktrace ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace ; \
+	cd $(HOST_SUBDIR)/libbacktrace || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/libbacktrace/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libbacktrace"; \
+	libsrcdir="$$s/libbacktrace"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  $(STAGE1_CONFIGURE_FLAGS)
+@endif libbacktrace-bootstrap
+
+.PHONY: configure-stage2-libbacktrace maybe-configure-stage2-libbacktrace
+maybe-configure-stage2-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-configure-stage2-libbacktrace: configure-stage2-libbacktrace
+configure-stage2-libbacktrace:
+	@[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE2_TFLAGS)"; \
+	test ! -f $(HOST_SUBDIR)/libbacktrace/Makefile || exit 0; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS) \
+	CFLAGS="$(STAGE2_CFLAGS)"; export CFLAGS; \
+	CXXFLAGS="$(STAGE2_CXXFLAGS)"; export CXXFLAGS; \
+	LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS;  \
+	echo Configuring stage 2 in $(HOST_SUBDIR)/libbacktrace ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace ; \
+	cd $(HOST_SUBDIR)/libbacktrace || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/libbacktrace/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libbacktrace"; \
+	libsrcdir="$$s/libbacktrace"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE2_CONFIGURE_FLAGS)
+@endif libbacktrace-bootstrap
+
+.PHONY: configure-stage3-libbacktrace maybe-configure-stage3-libbacktrace
+maybe-configure-stage3-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-configure-stage3-libbacktrace: configure-stage3-libbacktrace
+configure-stage3-libbacktrace:
+	@[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE3_TFLAGS)"; \
+	test ! -f $(HOST_SUBDIR)/libbacktrace/Makefile || exit 0; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS) \
+	CFLAGS="$(STAGE3_CFLAGS)"; export CFLAGS; \
+	CXXFLAGS="$(STAGE3_CXXFLAGS)"; export CXXFLAGS; \
+	LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS;  \
+	echo Configuring stage 3 in $(HOST_SUBDIR)/libbacktrace ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace ; \
+	cd $(HOST_SUBDIR)/libbacktrace || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/libbacktrace/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libbacktrace"; \
+	libsrcdir="$$s/libbacktrace"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE3_CONFIGURE_FLAGS)
+@endif libbacktrace-bootstrap
+
+.PHONY: configure-stage4-libbacktrace maybe-configure-stage4-libbacktrace
+maybe-configure-stage4-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-configure-stage4-libbacktrace: configure-stage4-libbacktrace
+configure-stage4-libbacktrace:
+	@[ $(current_stage) = stage4 ] || $(MAKE) stage4-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE4_TFLAGS)"; \
+	test ! -f $(HOST_SUBDIR)/libbacktrace/Makefile || exit 0; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS) \
+	CFLAGS="$(STAGE4_CFLAGS)"; export CFLAGS; \
+	CXXFLAGS="$(STAGE4_CXXFLAGS)"; export CXXFLAGS; \
+	LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS;  \
+	echo Configuring stage 4 in $(HOST_SUBDIR)/libbacktrace ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace ; \
+	cd $(HOST_SUBDIR)/libbacktrace || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/libbacktrace/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libbacktrace"; \
+	libsrcdir="$$s/libbacktrace"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE4_CONFIGURE_FLAGS)
+@endif libbacktrace-bootstrap
+
+.PHONY: configure-stageprofile-libbacktrace maybe-configure-stageprofile-libbacktrace
+maybe-configure-stageprofile-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-configure-stageprofile-libbacktrace: configure-stageprofile-libbacktrace
+configure-stageprofile-libbacktrace:
+	@[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEprofile_TFLAGS)"; \
+	test ! -f $(HOST_SUBDIR)/libbacktrace/Makefile || exit 0; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS) \
+	CFLAGS="$(STAGEprofile_CFLAGS)"; export CFLAGS; \
+	CXXFLAGS="$(STAGEprofile_CXXFLAGS)"; export CXXFLAGS; \
+	LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS;  \
+	echo Configuring stage profile in $(HOST_SUBDIR)/libbacktrace ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace ; \
+	cd $(HOST_SUBDIR)/libbacktrace || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/libbacktrace/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libbacktrace"; \
+	libsrcdir="$$s/libbacktrace"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGEprofile_CONFIGURE_FLAGS)
+@endif libbacktrace-bootstrap
+
+.PHONY: configure-stagefeedback-libbacktrace maybe-configure-stagefeedback-libbacktrace
+maybe-configure-stagefeedback-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-configure-stagefeedback-libbacktrace: configure-stagefeedback-libbacktrace
+configure-stagefeedback-libbacktrace:
+	@[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
+	test ! -f $(HOST_SUBDIR)/libbacktrace/Makefile || exit 0; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS) \
+	CFLAGS="$(STAGEfeedback_CFLAGS)"; export CFLAGS; \
+	CXXFLAGS="$(STAGEfeedback_CXXFLAGS)"; export CXXFLAGS; \
+	LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS;  \
+	echo Configuring stage feedback in $(HOST_SUBDIR)/libbacktrace ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libbacktrace ; \
+	cd $(HOST_SUBDIR)/libbacktrace || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/libbacktrace/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libbacktrace"; \
+	libsrcdir="$$s/libbacktrace"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGEfeedback_CONFIGURE_FLAGS)
+@endif libbacktrace-bootstrap
+
+
+
+
+
+.PHONY: all-libbacktrace maybe-all-libbacktrace
+maybe-all-libbacktrace:
+@if gcc-bootstrap
+all-libbacktrace: stage_current
+@endif gcc-bootstrap
+@if libbacktrace
+TARGET-libbacktrace=all
+maybe-all-libbacktrace: all-libbacktrace
+all-libbacktrace: configure-libbacktrace
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS)  \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
+		$(TARGET-libbacktrace))
+@endif libbacktrace
+
+
+
+.PHONY: all-stage1-libbacktrace maybe-all-stage1-libbacktrace
+.PHONY: clean-stage1-libbacktrace maybe-clean-stage1-libbacktrace
+maybe-all-stage1-libbacktrace:
+maybe-clean-stage1-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-all-stage1-libbacktrace: all-stage1-libbacktrace
+all-stage1: all-stage1-libbacktrace
+TARGET-stage1-libbacktrace = $(TARGET-libbacktrace)
+all-stage1-libbacktrace: configure-stage1-libbacktrace
+	@[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE1_TFLAGS)"; \
+	$(HOST_EXPORTS)  \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(STAGE1_CFLAGS)" \
+		CXXFLAGS="$(STAGE1_CXXFLAGS)" \
+		LIBCFLAGS="$(LIBCFLAGS)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
+		TFLAGS="$(STAGE1_TFLAGS)" \
+		$(TARGET-stage1-libbacktrace)
+
+maybe-clean-stage1-libbacktrace: clean-stage1-libbacktrace
+clean-stage1: clean-stage1-libbacktrace
+clean-stage1-libbacktrace:
+	@if [ $(current_stage) = stage1 ]; then \
+	  [ -f $(HOST_SUBDIR)/libbacktrace/Makefile ] || exit 0; \
+	else \
+	  [ -f $(HOST_SUBDIR)/stage1-libbacktrace/Makefile ] || exit 0; \
+	  $(MAKE) stage1-start; \
+	fi; \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(EXTRA_HOST_FLAGS)  \
+	$(STAGE1_FLAGS_TO_PASS)  clean
+@endif libbacktrace-bootstrap
+
+
+.PHONY: all-stage2-libbacktrace maybe-all-stage2-libbacktrace
+.PHONY: clean-stage2-libbacktrace maybe-clean-stage2-libbacktrace
+maybe-all-stage2-libbacktrace:
+maybe-clean-stage2-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-all-stage2-libbacktrace: all-stage2-libbacktrace
+all-stage2: all-stage2-libbacktrace
+TARGET-stage2-libbacktrace = $(TARGET-libbacktrace)
+all-stage2-libbacktrace: configure-stage2-libbacktrace
+	@[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE2_TFLAGS)"; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS)  \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(STAGE2_CFLAGS)" \
+		CXXFLAGS="$(STAGE2_CXXFLAGS)" \
+		LIBCFLAGS="$(STAGE2_CFLAGS)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		TFLAGS="$(STAGE2_TFLAGS)" \
+		$(TARGET-stage2-libbacktrace)
+
+maybe-clean-stage2-libbacktrace: clean-stage2-libbacktrace
+clean-stage2: clean-stage2-libbacktrace
+clean-stage2-libbacktrace:
+	@if [ $(current_stage) = stage2 ]; then \
+	  [ -f $(HOST_SUBDIR)/libbacktrace/Makefile ] || exit 0; \
+	else \
+	  [ -f $(HOST_SUBDIR)/stage2-libbacktrace/Makefile ] || exit 0; \
+	  $(MAKE) stage2-start; \
+	fi; \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+@endif libbacktrace-bootstrap
+
+
+.PHONY: all-stage3-libbacktrace maybe-all-stage3-libbacktrace
+.PHONY: clean-stage3-libbacktrace maybe-clean-stage3-libbacktrace
+maybe-all-stage3-libbacktrace:
+maybe-clean-stage3-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-all-stage3-libbacktrace: all-stage3-libbacktrace
+all-stage3: all-stage3-libbacktrace
+TARGET-stage3-libbacktrace = $(TARGET-libbacktrace)
+all-stage3-libbacktrace: configure-stage3-libbacktrace
+	@[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE3_TFLAGS)"; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS)  \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(STAGE3_CFLAGS)" \
+		CXXFLAGS="$(STAGE3_CXXFLAGS)" \
+		LIBCFLAGS="$(STAGE3_CFLAGS)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		TFLAGS="$(STAGE3_TFLAGS)" \
+		$(TARGET-stage3-libbacktrace)
+
+maybe-clean-stage3-libbacktrace: clean-stage3-libbacktrace
+clean-stage3: clean-stage3-libbacktrace
+clean-stage3-libbacktrace:
+	@if [ $(current_stage) = stage3 ]; then \
+	  [ -f $(HOST_SUBDIR)/libbacktrace/Makefile ] || exit 0; \
+	else \
+	  [ -f $(HOST_SUBDIR)/stage3-libbacktrace/Makefile ] || exit 0; \
+	  $(MAKE) stage3-start; \
+	fi; \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+@endif libbacktrace-bootstrap
+
+
+.PHONY: all-stage4-libbacktrace maybe-all-stage4-libbacktrace
+.PHONY: clean-stage4-libbacktrace maybe-clean-stage4-libbacktrace
+maybe-all-stage4-libbacktrace:
+maybe-clean-stage4-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-all-stage4-libbacktrace: all-stage4-libbacktrace
+all-stage4: all-stage4-libbacktrace
+TARGET-stage4-libbacktrace = $(TARGET-libbacktrace)
+all-stage4-libbacktrace: configure-stage4-libbacktrace
+	@[ $(current_stage) = stage4 ] || $(MAKE) stage4-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE4_TFLAGS)"; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS)  \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(STAGE4_CFLAGS)" \
+		CXXFLAGS="$(STAGE4_CXXFLAGS)" \
+		LIBCFLAGS="$(STAGE4_CFLAGS)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		TFLAGS="$(STAGE4_TFLAGS)" \
+		$(TARGET-stage4-libbacktrace)
+
+maybe-clean-stage4-libbacktrace: clean-stage4-libbacktrace
+clean-stage4: clean-stage4-libbacktrace
+clean-stage4-libbacktrace:
+	@if [ $(current_stage) = stage4 ]; then \
+	  [ -f $(HOST_SUBDIR)/libbacktrace/Makefile ] || exit 0; \
+	else \
+	  [ -f $(HOST_SUBDIR)/stage4-libbacktrace/Makefile ] || exit 0; \
+	  $(MAKE) stage4-start; \
+	fi; \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+@endif libbacktrace-bootstrap
+
+
+.PHONY: all-stageprofile-libbacktrace maybe-all-stageprofile-libbacktrace
+.PHONY: clean-stageprofile-libbacktrace maybe-clean-stageprofile-libbacktrace
+maybe-all-stageprofile-libbacktrace:
+maybe-clean-stageprofile-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-all-stageprofile-libbacktrace: all-stageprofile-libbacktrace
+all-stageprofile: all-stageprofile-libbacktrace
+TARGET-stageprofile-libbacktrace = $(TARGET-libbacktrace)
+all-stageprofile-libbacktrace: configure-stageprofile-libbacktrace
+	@[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEprofile_TFLAGS)"; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS)  \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(STAGEprofile_CFLAGS)" \
+		CXXFLAGS="$(STAGEprofile_CXXFLAGS)" \
+		LIBCFLAGS="$(STAGEprofile_CFLAGS)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		TFLAGS="$(STAGEprofile_TFLAGS)" \
+		$(TARGET-stageprofile-libbacktrace)
+
+maybe-clean-stageprofile-libbacktrace: clean-stageprofile-libbacktrace
+clean-stageprofile: clean-stageprofile-libbacktrace
+clean-stageprofile-libbacktrace:
+	@if [ $(current_stage) = stageprofile ]; then \
+	  [ -f $(HOST_SUBDIR)/libbacktrace/Makefile ] || exit 0; \
+	else \
+	  [ -f $(HOST_SUBDIR)/stageprofile-libbacktrace/Makefile ] || exit 0; \
+	  $(MAKE) stageprofile-start; \
+	fi; \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+@endif libbacktrace-bootstrap
+
+
+.PHONY: all-stagefeedback-libbacktrace maybe-all-stagefeedback-libbacktrace
+.PHONY: clean-stagefeedback-libbacktrace maybe-clean-stagefeedback-libbacktrace
+maybe-all-stagefeedback-libbacktrace:
+maybe-clean-stagefeedback-libbacktrace:
+@if libbacktrace-bootstrap
+maybe-all-stagefeedback-libbacktrace: all-stagefeedback-libbacktrace
+all-stagefeedback: all-stagefeedback-libbacktrace
+TARGET-stagefeedback-libbacktrace = $(TARGET-libbacktrace)
+all-stagefeedback-libbacktrace: configure-stagefeedback-libbacktrace
+	@[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
+	$(HOST_EXPORTS) \
+	$(POSTSTAGE1_HOST_EXPORTS)  \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(STAGEfeedback_CFLAGS)" \
+		CXXFLAGS="$(STAGEfeedback_CXXFLAGS)" \
+		LIBCFLAGS="$(STAGEfeedback_CFLAGS)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+		TFLAGS="$(STAGEfeedback_TFLAGS)" \
+		$(TARGET-stagefeedback-libbacktrace)
+
+maybe-clean-stagefeedback-libbacktrace: clean-stagefeedback-libbacktrace
+clean-stagefeedback: clean-stagefeedback-libbacktrace
+clean-stagefeedback-libbacktrace:
+	@if [ $(current_stage) = stagefeedback ]; then \
+	  [ -f $(HOST_SUBDIR)/libbacktrace/Makefile ] || exit 0; \
+	else \
+	  [ -f $(HOST_SUBDIR)/stagefeedback-libbacktrace/Makefile ] || exit 0; \
+	  $(MAKE) stagefeedback-start; \
+	fi; \
+	cd $(HOST_SUBDIR)/libbacktrace && \
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+@endif libbacktrace-bootstrap
+
+
+
+
+
+.PHONY: check-libbacktrace maybe-check-libbacktrace
+maybe-check-libbacktrace:
+@if libbacktrace
+maybe-check-libbacktrace: check-libbacktrace
+
+check-libbacktrace:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(FLAGS_TO_PASS)  check)
+
+@endif libbacktrace
+
+.PHONY: install-libbacktrace maybe-install-libbacktrace
+maybe-install-libbacktrace:
+@if libbacktrace
+maybe-install-libbacktrace: install-libbacktrace
+
+install-libbacktrace: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(FLAGS_TO_PASS)  install)
+
+@endif libbacktrace
+
+.PHONY: install-strip-libbacktrace maybe-install-strip-libbacktrace
+maybe-install-strip-libbacktrace:
+@if libbacktrace
+maybe-install-strip-libbacktrace: install-strip-libbacktrace
+
+install-strip-libbacktrace: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(FLAGS_TO_PASS)  install-strip)
+
+@endif libbacktrace
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-libbacktrace info-libbacktrace
+maybe-info-libbacktrace:
+@if libbacktrace
+maybe-info-libbacktrace: info-libbacktrace
+
+info-libbacktrace: \
+    configure-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing info in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          info) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-dvi-libbacktrace dvi-libbacktrace
+maybe-dvi-libbacktrace:
+@if libbacktrace
+maybe-dvi-libbacktrace: dvi-libbacktrace
+
+dvi-libbacktrace: \
+    configure-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing dvi in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          dvi) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-pdf-libbacktrace pdf-libbacktrace
+maybe-pdf-libbacktrace:
+@if libbacktrace
+maybe-pdf-libbacktrace: pdf-libbacktrace
+
+pdf-libbacktrace: \
+    configure-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing pdf in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          pdf) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-html-libbacktrace html-libbacktrace
+maybe-html-libbacktrace:
+@if libbacktrace
+maybe-html-libbacktrace: html-libbacktrace
+
+html-libbacktrace: \
+    configure-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing html in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          html) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-TAGS-libbacktrace TAGS-libbacktrace
+maybe-TAGS-libbacktrace:
+@if libbacktrace
+maybe-TAGS-libbacktrace: TAGS-libbacktrace
+
+TAGS-libbacktrace: \
+    configure-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing TAGS in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          TAGS) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-install-info-libbacktrace install-info-libbacktrace
+maybe-install-info-libbacktrace:
+@if libbacktrace
+maybe-install-info-libbacktrace: install-info-libbacktrace
+
+install-info-libbacktrace: \
+    configure-libbacktrace \
+    info-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing install-info in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          install-info) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-install-pdf-libbacktrace install-pdf-libbacktrace
+maybe-install-pdf-libbacktrace:
+@if libbacktrace
+maybe-install-pdf-libbacktrace: install-pdf-libbacktrace
+
+install-pdf-libbacktrace: \
+    configure-libbacktrace \
+    pdf-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing install-pdf in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          install-pdf) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-install-html-libbacktrace install-html-libbacktrace
+maybe-install-html-libbacktrace:
+@if libbacktrace
+maybe-install-html-libbacktrace: install-html-libbacktrace
+
+install-html-libbacktrace: \
+    configure-libbacktrace \
+    html-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing install-html in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          install-html) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-installcheck-libbacktrace installcheck-libbacktrace
+maybe-installcheck-libbacktrace:
+@if libbacktrace
+maybe-installcheck-libbacktrace: installcheck-libbacktrace
+
+installcheck-libbacktrace: \
+    configure-libbacktrace 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing installcheck in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          installcheck) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-mostlyclean-libbacktrace mostlyclean-libbacktrace
+maybe-mostlyclean-libbacktrace:
+@if libbacktrace
+maybe-mostlyclean-libbacktrace: mostlyclean-libbacktrace
+
+mostlyclean-libbacktrace: 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing mostlyclean in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          mostlyclean) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-clean-libbacktrace clean-libbacktrace
+maybe-clean-libbacktrace:
+@if libbacktrace
+maybe-clean-libbacktrace: clean-libbacktrace
+
+clean-libbacktrace: 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing clean in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          clean) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-distclean-libbacktrace distclean-libbacktrace
+maybe-distclean-libbacktrace:
+@if libbacktrace
+maybe-distclean-libbacktrace: distclean-libbacktrace
+
+distclean-libbacktrace: 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing distclean in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          distclean) \
+	  || exit 1
+
+@endif libbacktrace
+
+.PHONY: maybe-maintainer-clean-libbacktrace maintainer-clean-libbacktrace
+maybe-maintainer-clean-libbacktrace:
+@if libbacktrace
+maybe-maintainer-clean-libbacktrace: maintainer-clean-libbacktrace
+
+maintainer-clean-libbacktrace: 
+	@[ -f ./libbacktrace/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing maintainer-clean in libbacktrace" ; \
+	(cd $(HOST_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          maintainer-clean) \
+	  || exit 1
+
+@endif libbacktrace
+
+
+
 .PHONY: configure-libcpp maybe-configure-libcpp
 maybe-configure-libcpp:
 @if gcc-bootstrap
@@ -19790,7 +20642,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/libcpp && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-libcpp))
 @endif libcpp
 
@@ -19818,7 +20670,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-libcpp)
 
@@ -19833,7 +20686,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/libcpp && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif libcpp-bootstrap
 
 
@@ -19874,9 +20727,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libcpp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libcpp-bootstrap
 
 
@@ -19917,9 +20768,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libcpp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libcpp-bootstrap
 
 
@@ -19960,9 +20809,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libcpp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libcpp-bootstrap
 
 
@@ -20003,9 +20850,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libcpp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libcpp-bootstrap
 
 
@@ -20046,9 +20891,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libcpp && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libcpp-bootstrap
 
 
@@ -20671,7 +21514,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/libdecnumber && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-libdecnumber))
 @endif libdecnumber
 
@@ -20699,7 +21542,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-libdecnumber)
 
@@ -20714,7 +21558,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/libdecnumber && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif libdecnumber-bootstrap
 
 
@@ -20755,9 +21599,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libdecnumber && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libdecnumber-bootstrap
 
 
@@ -20798,9 +21640,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libdecnumber && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libdecnumber-bootstrap
 
 
@@ -20841,9 +21681,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libdecnumber && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libdecnumber-bootstrap
 
 
@@ -20884,9 +21722,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libdecnumber && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libdecnumber-bootstrap
 
 
@@ -20927,9 +21763,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libdecnumber && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libdecnumber-bootstrap
 
 
@@ -21356,7 +22190,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/libgui && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-libgui))
 @endif libgui
 
@@ -21998,7 +22832,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/libiberty && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-libiberty))
 @endif libiberty
 
@@ -22026,7 +22860,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-libiberty)
 
@@ -22041,7 +22876,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/libiberty && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif libiberty-bootstrap
 
 
@@ -22082,9 +22917,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libiberty && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libiberty-bootstrap
 
 
@@ -22125,9 +22958,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libiberty && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libiberty-bootstrap
 
 
@@ -22168,9 +22999,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libiberty && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libiberty-bootstrap
 
 
@@ -22211,9 +23040,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libiberty && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libiberty-bootstrap
 
 
@@ -22254,9 +23081,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/libiberty && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif libiberty-bootstrap
 
 
@@ -22683,7 +23508,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/libiconv && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-libiconv))
 @endif libiconv
 
@@ -23060,7 +23885,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/m4 && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-m4))
 @endif m4
 
@@ -23500,7 +24325,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/readline && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-readline))
 @endif readline
 
@@ -23940,7 +24765,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/sid && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-sid))
 @endif sid
 
@@ -24380,7 +25205,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/sim && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-sim))
 @endif sim
 
@@ -24820,7 +25645,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/texinfo && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-texinfo))
 @endif texinfo
 
@@ -25444,7 +26269,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/zlib && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-zlib))
 @endif zlib
 
@@ -25472,7 +26297,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-zlib)
 
@@ -25487,7 +26313,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/zlib && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif zlib-bootstrap
 
 
@@ -25528,9 +26354,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/zlib && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif zlib-bootstrap
 
 
@@ -25571,9 +26395,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/zlib && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif zlib-bootstrap
 
 
@@ -25614,9 +26436,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/zlib && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif zlib-bootstrap
 
 
@@ -25657,9 +26477,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/zlib && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif zlib-bootstrap
 
 
@@ -25700,9 +26518,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/zlib && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif zlib-bootstrap
 
 
@@ -26111,7 +26927,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gdb && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-gdb))
 @endif gdb
 
@@ -26551,7 +27367,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/expect && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-expect))
 @endif expect
 
@@ -26991,7 +27807,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/guile && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-guile))
 @endif guile
 
@@ -27431,7 +28247,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/tk && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-tk))
 @endif tk
 
@@ -27871,7 +28687,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/libtermcap && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-libtermcap))
 @endif libtermcap
 
@@ -28245,7 +29061,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/utils && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-utils))
 @endif utils
 
@@ -28679,7 +29495,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/gnattools && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-gnattools))
 @endif gnattools
 
@@ -29321,7 +30137,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
 	(cd $(HOST_SUBDIR)/lto-plugin && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS)  \
 		$(TARGET-lto-plugin))
 @endif lto-plugin
 
@@ -29349,7 +30165,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_HOST_FLAGS)   \
+		$(EXTRA_HOST_FLAGS)  \
+		$(STAGE1_FLAGS_TO_PASS)  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-lto-plugin)
 
@@ -29364,7 +30181,7 @@
 	fi; \
 	cd $(HOST_SUBDIR)/lto-plugin && \
 	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		 clean
+	$(STAGE1_FLAGS_TO_PASS)  clean
 @endif lto-plugin-bootstrap
 
 
@@ -29405,9 +30222,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/lto-plugin && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif lto-plugin-bootstrap
 
 
@@ -29448,9 +30263,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/lto-plugin && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif lto-plugin-bootstrap
 
 
@@ -29491,9 +30304,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/lto-plugin && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif lto-plugin-bootstrap
 
 
@@ -29534,9 +30345,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/lto-plugin && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif lto-plugin-bootstrap
 
 
@@ -29577,9 +30386,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(HOST_SUBDIR)/lto-plugin && \
-	$(MAKE) $(EXTRA_HOST_FLAGS)  \
-		$(POSTSTAGE1_FLAGS_TO_PASS)  \
-		 clean
+	$(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif lto-plugin-bootstrap
 
 
@@ -30295,7 +31102,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(RAW_CXX_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libstdc++-v3 && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
 		$(TARGET-target-libstdc++-v3))
 @endif target-libstdc++-v3
 
@@ -30323,7 +31130,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
+		  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-target-libstdc++-v3)
 
@@ -30338,7 +31146,7 @@
 	fi; \
 	cd $(TARGET_SUBDIR)/libstdc++-v3 && \
 	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
-		 clean
+	  clean
 @endif target-libstdc++-v3-bootstrap
 
 
@@ -30379,9 +31187,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libstdc++-v3 && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
 @endif target-libstdc++-v3-bootstrap
 
 
@@ -30422,9 +31228,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libstdc++-v3 && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
 @endif target-libstdc++-v3-bootstrap
 
 
@@ -30465,9 +31269,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libstdc++-v3 && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
 @endif target-libstdc++-v3-bootstrap
 
 
@@ -30508,9 +31310,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libstdc++-v3 && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
 @endif target-libstdc++-v3-bootstrap
 
 
@@ -30551,9 +31351,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libstdc++-v3 && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
 @endif target-libstdc++-v3-bootstrap
 
 
@@ -30949,139 +31747,656 @@
 
 
 
-.PHONY: configure-target-libmudflap maybe-configure-target-libmudflap
-maybe-configure-target-libmudflap:
+.PHONY: configure-target-libsanitizer maybe-configure-target-libsanitizer
+maybe-configure-target-libsanitizer:
 @if gcc-bootstrap
-configure-target-libmudflap: stage_current
+configure-target-libsanitizer: stage_current
 @endif gcc-bootstrap
-@if target-libmudflap
-maybe-configure-target-libmudflap: configure-target-libmudflap
-configure-target-libmudflap: 
-	@: $(MAKE); $(unstage)
+@if target-libsanitizer
+maybe-configure-target-libsanitizer: configure-target-libsanitizer
+configure-target-libsanitizer: 
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	echo "Checking multilib configuration for libmudflap..."; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libmudflap ; \
-	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libmudflap/multilib.tmp 2> /dev/null ; \
-	if test -r $(TARGET_SUBDIR)/libmudflap/multilib.out; then \
-	  if cmp -s $(TARGET_SUBDIR)/libmudflap/multilib.tmp $(TARGET_SUBDIR)/libmudflap/multilib.out; then \
-	    rm -f $(TARGET_SUBDIR)/libmudflap/multilib.tmp; \
+	echo "Checking multilib configuration for libsanitizer..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libsanitizer/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/multilib.tmp; \
 	  else \
-	    rm -f $(TARGET_SUBDIR)/libmudflap/Makefile; \
-	    mv $(TARGET_SUBDIR)/libmudflap/multilib.tmp $(TARGET_SUBDIR)/libmudflap/multilib.out; \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/Makefile; \
+	    mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
 	  fi; \
 	else \
-	  mv $(TARGET_SUBDIR)/libmudflap/multilib.tmp $(TARGET_SUBDIR)/libmudflap/multilib.out; \
+	  mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
 	fi; \
-	test ! -f $(TARGET_SUBDIR)/libmudflap/Makefile || exit 0; \
-	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libmudflap ; \
-	$(NORMAL_TARGET_EXPORTS)  \
-	echo Configuring in $(TARGET_SUBDIR)/libmudflap; \
-	cd "$(TARGET_SUBDIR)/libmudflap" || exit 1; \
+	test ! -f $(TARGET_SUBDIR)/libsanitizer/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
+	$(RAW_CXX_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libsanitizer; \
+	cd "$(TARGET_SUBDIR)/libsanitizer" || exit 1; \
 	case $(srcdir) in \
 	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
-	  *) topdir=`echo $(TARGET_SUBDIR)/libmudflap/ | \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libsanitizer/ | \
 		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
 	esac; \
-	srcdiroption="--srcdir=$${topdir}/libmudflap"; \
-	libsrcdir="$$s/libmudflap"; \
+	srcdiroption="--srcdir=$${topdir}/libsanitizer"; \
+	libsrcdir="$$s/libsanitizer"; \
 	rm -f no-such-file || : ; \
 	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
 	  --target=${target_alias} $${srcdiroption}  \
 	  || exit 1
-@endif target-libmudflap
+@endif target-libsanitizer
+
+
+
+.PHONY: configure-stage1-target-libsanitizer maybe-configure-stage1-target-libsanitizer
+maybe-configure-stage1-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-configure-stage1-target-libsanitizer: configure-stage1-target-libsanitizer
+configure-stage1-target-libsanitizer:
+	@[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE1_TFLAGS)"; \
+	echo "Checking multilib configuration for libsanitizer..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libsanitizer/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/Makefile; \
+	    mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libsanitizer/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage 1 in $(TARGET_SUBDIR)/libsanitizer ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
+	cd $(TARGET_SUBDIR)/libsanitizer || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libsanitizer/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libsanitizer"; \
+	libsrcdir="$$s/libsanitizer"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  $(STAGE1_CONFIGURE_FLAGS)
+@endif target-libsanitizer-bootstrap
+
+.PHONY: configure-stage2-target-libsanitizer maybe-configure-stage2-target-libsanitizer
+maybe-configure-stage2-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-configure-stage2-target-libsanitizer: configure-stage2-target-libsanitizer
+configure-stage2-target-libsanitizer:
+	@[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE2_TFLAGS)"; \
+	echo "Checking multilib configuration for libsanitizer..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libsanitizer/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/Makefile; \
+	    mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libsanitizer/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage 2 in $(TARGET_SUBDIR)/libsanitizer ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
+	cd $(TARGET_SUBDIR)/libsanitizer || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libsanitizer/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libsanitizer"; \
+	libsrcdir="$$s/libsanitizer"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE2_CONFIGURE_FLAGS)
+@endif target-libsanitizer-bootstrap
+
+.PHONY: configure-stage3-target-libsanitizer maybe-configure-stage3-target-libsanitizer
+maybe-configure-stage3-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-configure-stage3-target-libsanitizer: configure-stage3-target-libsanitizer
+configure-stage3-target-libsanitizer:
+	@[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE3_TFLAGS)"; \
+	echo "Checking multilib configuration for libsanitizer..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libsanitizer/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/Makefile; \
+	    mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libsanitizer/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage 3 in $(TARGET_SUBDIR)/libsanitizer ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
+	cd $(TARGET_SUBDIR)/libsanitizer || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libsanitizer/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libsanitizer"; \
+	libsrcdir="$$s/libsanitizer"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE3_CONFIGURE_FLAGS)
+@endif target-libsanitizer-bootstrap
+
+.PHONY: configure-stage4-target-libsanitizer maybe-configure-stage4-target-libsanitizer
+maybe-configure-stage4-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-configure-stage4-target-libsanitizer: configure-stage4-target-libsanitizer
+configure-stage4-target-libsanitizer:
+	@[ $(current_stage) = stage4 ] || $(MAKE) stage4-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE4_TFLAGS)"; \
+	echo "Checking multilib configuration for libsanitizer..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libsanitizer/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/Makefile; \
+	    mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libsanitizer/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage 4 in $(TARGET_SUBDIR)/libsanitizer ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
+	cd $(TARGET_SUBDIR)/libsanitizer || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libsanitizer/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libsanitizer"; \
+	libsrcdir="$$s/libsanitizer"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE4_CONFIGURE_FLAGS)
+@endif target-libsanitizer-bootstrap
+
+.PHONY: configure-stageprofile-target-libsanitizer maybe-configure-stageprofile-target-libsanitizer
+maybe-configure-stageprofile-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-configure-stageprofile-target-libsanitizer: configure-stageprofile-target-libsanitizer
+configure-stageprofile-target-libsanitizer:
+	@[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEprofile_TFLAGS)"; \
+	echo "Checking multilib configuration for libsanitizer..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libsanitizer/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/Makefile; \
+	    mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libsanitizer/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage profile in $(TARGET_SUBDIR)/libsanitizer ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
+	cd $(TARGET_SUBDIR)/libsanitizer || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libsanitizer/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libsanitizer"; \
+	libsrcdir="$$s/libsanitizer"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGEprofile_CONFIGURE_FLAGS)
+@endif target-libsanitizer-bootstrap
+
+.PHONY: configure-stagefeedback-target-libsanitizer maybe-configure-stagefeedback-target-libsanitizer
+maybe-configure-stagefeedback-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-configure-stagefeedback-target-libsanitizer: configure-stagefeedback-target-libsanitizer
+configure-stagefeedback-target-libsanitizer:
+	@[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
+	echo "Checking multilib configuration for libsanitizer..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libsanitizer/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libsanitizer/Makefile; \
+	    mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libsanitizer/multilib.tmp $(TARGET_SUBDIR)/libsanitizer/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libsanitizer/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage feedback in $(TARGET_SUBDIR)/libsanitizer ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libsanitizer ; \
+	cd $(TARGET_SUBDIR)/libsanitizer || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libsanitizer/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libsanitizer"; \
+	libsrcdir="$$s/libsanitizer"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGEfeedback_CONFIGURE_FLAGS)
+@endif target-libsanitizer-bootstrap
 
 
 
 
 
-.PHONY: all-target-libmudflap maybe-all-target-libmudflap
-maybe-all-target-libmudflap:
+.PHONY: all-target-libsanitizer maybe-all-target-libsanitizer
+maybe-all-target-libsanitizer:
 @if gcc-bootstrap
-all-target-libmudflap: stage_current
+all-target-libsanitizer: stage_current
 @endif gcc-bootstrap
-@if target-libmudflap
-TARGET-target-libmudflap=all
-maybe-all-target-libmudflap: all-target-libmudflap
-all-target-libmudflap: configure-target-libmudflap
+@if target-libsanitizer
+TARGET-target-libsanitizer=all
+maybe-all-target-libsanitizer: all-target-libsanitizer
+all-target-libsanitizer: configure-target-libsanitizer
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		$(TARGET-target-libsanitizer))
+@endif target-libsanitizer
+
+
+
+.PHONY: all-stage1-target-libsanitizer maybe-all-stage1-target-libsanitizer
+.PHONY: clean-stage1-target-libsanitizer maybe-clean-stage1-target-libsanitizer
+maybe-all-stage1-target-libsanitizer:
+maybe-clean-stage1-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-all-stage1-target-libsanitizer: all-stage1-target-libsanitizer
+all-stage1: all-stage1-target-libsanitizer
+TARGET-stage1-target-libsanitizer = $(TARGET-target-libsanitizer)
+all-stage1-target-libsanitizer: configure-stage1-target-libsanitizer
+	@[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE1_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS)  \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
+		  \
+		TFLAGS="$(STAGE1_TFLAGS)" \
+		$(TARGET-stage1-target-libsanitizer)
+
+maybe-clean-stage1-target-libsanitizer: clean-stage1-target-libsanitizer
+clean-stage1: clean-stage1-target-libsanitizer
+clean-stage1-target-libsanitizer:
+	@if [ $(current_stage) = stage1 ]; then \
+	  [ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stage1-libsanitizer/Makefile ] || exit 0; \
+	  $(MAKE) stage1-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
+	  clean
+@endif target-libsanitizer-bootstrap
+
+
+.PHONY: all-stage2-target-libsanitizer maybe-all-stage2-target-libsanitizer
+.PHONY: clean-stage2-target-libsanitizer maybe-clean-stage2-target-libsanitizer
+maybe-all-stage2-target-libsanitizer:
+maybe-clean-stage2-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-all-stage2-target-libsanitizer: all-stage2-target-libsanitizer
+all-stage2: all-stage2-target-libsanitizer
+TARGET-stage2-target-libsanitizer = $(TARGET-target-libsanitizer)
+all-stage2-target-libsanitizer: configure-stage2-target-libsanitizer
+	@[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE2_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGE2_TFLAGS)" \
+		$(TARGET-stage2-target-libsanitizer)
+
+maybe-clean-stage2-target-libsanitizer: clean-stage2-target-libsanitizer
+clean-stage2: clean-stage2-target-libsanitizer
+clean-stage2-target-libsanitizer:
+	@if [ $(current_stage) = stage2 ]; then \
+	  [ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stage2-libsanitizer/Makefile ] || exit 0; \
+	  $(MAKE) stage2-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libsanitizer-bootstrap
+
+
+.PHONY: all-stage3-target-libsanitizer maybe-all-stage3-target-libsanitizer
+.PHONY: clean-stage3-target-libsanitizer maybe-clean-stage3-target-libsanitizer
+maybe-all-stage3-target-libsanitizer:
+maybe-clean-stage3-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-all-stage3-target-libsanitizer: all-stage3-target-libsanitizer
+all-stage3: all-stage3-target-libsanitizer
+TARGET-stage3-target-libsanitizer = $(TARGET-target-libsanitizer)
+all-stage3-target-libsanitizer: configure-stage3-target-libsanitizer
+	@[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE3_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGE3_TFLAGS)" \
+		$(TARGET-stage3-target-libsanitizer)
+
+maybe-clean-stage3-target-libsanitizer: clean-stage3-target-libsanitizer
+clean-stage3: clean-stage3-target-libsanitizer
+clean-stage3-target-libsanitizer:
+	@if [ $(current_stage) = stage3 ]; then \
+	  [ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stage3-libsanitizer/Makefile ] || exit 0; \
+	  $(MAKE) stage3-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libsanitizer-bootstrap
+
+
+.PHONY: all-stage4-target-libsanitizer maybe-all-stage4-target-libsanitizer
+.PHONY: clean-stage4-target-libsanitizer maybe-clean-stage4-target-libsanitizer
+maybe-all-stage4-target-libsanitizer:
+maybe-clean-stage4-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-all-stage4-target-libsanitizer: all-stage4-target-libsanitizer
+all-stage4: all-stage4-target-libsanitizer
+TARGET-stage4-target-libsanitizer = $(TARGET-target-libsanitizer)
+all-stage4-target-libsanitizer: configure-stage4-target-libsanitizer
+	@[ $(current_stage) = stage4 ] || $(MAKE) stage4-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE4_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGE4_TFLAGS)" \
+		$(TARGET-stage4-target-libsanitizer)
+
+maybe-clean-stage4-target-libsanitizer: clean-stage4-target-libsanitizer
+clean-stage4: clean-stage4-target-libsanitizer
+clean-stage4-target-libsanitizer:
+	@if [ $(current_stage) = stage4 ]; then \
+	  [ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stage4-libsanitizer/Makefile ] || exit 0; \
+	  $(MAKE) stage4-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libsanitizer-bootstrap
+
+
+.PHONY: all-stageprofile-target-libsanitizer maybe-all-stageprofile-target-libsanitizer
+.PHONY: clean-stageprofile-target-libsanitizer maybe-clean-stageprofile-target-libsanitizer
+maybe-all-stageprofile-target-libsanitizer:
+maybe-clean-stageprofile-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-all-stageprofile-target-libsanitizer: all-stageprofile-target-libsanitizer
+all-stageprofile: all-stageprofile-target-libsanitizer
+TARGET-stageprofile-target-libsanitizer = $(TARGET-target-libsanitizer)
+all-stageprofile-target-libsanitizer: configure-stageprofile-target-libsanitizer
+	@[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEprofile_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGEprofile_TFLAGS)" \
+		$(TARGET-stageprofile-target-libsanitizer)
+
+maybe-clean-stageprofile-target-libsanitizer: clean-stageprofile-target-libsanitizer
+clean-stageprofile: clean-stageprofile-target-libsanitizer
+clean-stageprofile-target-libsanitizer:
+	@if [ $(current_stage) = stageprofile ]; then \
+	  [ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stageprofile-libsanitizer/Makefile ] || exit 0; \
+	  $(MAKE) stageprofile-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libsanitizer-bootstrap
+
+
+.PHONY: all-stagefeedback-target-libsanitizer maybe-all-stagefeedback-target-libsanitizer
+.PHONY: clean-stagefeedback-target-libsanitizer maybe-clean-stagefeedback-target-libsanitizer
+maybe-all-stagefeedback-target-libsanitizer:
+maybe-clean-stagefeedback-target-libsanitizer:
+@if target-libsanitizer-bootstrap
+maybe-all-stagefeedback-target-libsanitizer: all-stagefeedback-target-libsanitizer
+all-stagefeedback: all-stagefeedback-target-libsanitizer
+TARGET-stagefeedback-target-libsanitizer = $(TARGET-target-libsanitizer)
+all-stagefeedback-target-libsanitizer: configure-stagefeedback-target-libsanitizer
+	@[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGEfeedback_TFLAGS)" \
+		$(TARGET-stagefeedback-target-libsanitizer)
+
+maybe-clean-stagefeedback-target-libsanitizer: clean-stagefeedback-target-libsanitizer
+clean-stagefeedback: clean-stagefeedback-target-libsanitizer
+clean-stagefeedback-target-libsanitizer:
+	@if [ $(current_stage) = stagefeedback ]; then \
+	  [ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stagefeedback-libsanitizer/Makefile ] || exit 0; \
+	  $(MAKE) stagefeedback-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libsanitizer && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libsanitizer-bootstrap
+
+
+
+
+
+
+.PHONY: check-target-libsanitizer maybe-check-target-libsanitizer
+maybe-check-target-libsanitizer:
+@if target-libsanitizer
+maybe-check-target-libsanitizer: check-target-libsanitizer
+
+check-target-libsanitizer:
 	@: $(MAKE); $(unstage)
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS)  \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
-		$(TARGET-target-libmudflap))
-@endif target-libmudflap
+	$(RAW_CXX_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   check)
 
+@endif target-libsanitizer
 
+.PHONY: install-target-libsanitizer maybe-install-target-libsanitizer
+maybe-install-target-libsanitizer:
+@if target-libsanitizer
+maybe-install-target-libsanitizer: install-target-libsanitizer
 
-
-
-.PHONY: check-target-libmudflap maybe-check-target-libmudflap
-maybe-check-target-libmudflap:
-@if target-libmudflap
-maybe-check-target-libmudflap: check-target-libmudflap
-
-check-target-libmudflap:
+install-target-libsanitizer: installdirs
 	@: $(MAKE); $(unstage)
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
-	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
-
-@endif target-libmudflap
-
-.PHONY: install-target-libmudflap maybe-install-target-libmudflap
-maybe-install-target-libmudflap:
-@if target-libmudflap
-maybe-install-target-libmudflap: install-target-libmudflap
-
-install-target-libmudflap: installdirs
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: install-strip-target-libmudflap maybe-install-strip-target-libmudflap
-maybe-install-strip-target-libmudflap:
-@if target-libmudflap
-maybe-install-strip-target-libmudflap: install-strip-target-libmudflap
+.PHONY: install-strip-target-libsanitizer maybe-install-strip-target-libsanitizer
+maybe-install-strip-target-libsanitizer:
+@if target-libsanitizer
+maybe-install-strip-target-libsanitizer: install-strip-target-libsanitizer
 
-install-strip-target-libmudflap: installdirs
+install-strip-target-libsanitizer: installdirs
 	@: $(MAKE); $(unstage)
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
 # Other targets (info, dvi, pdf, etc.)
 
-.PHONY: maybe-info-target-libmudflap info-target-libmudflap
-maybe-info-target-libmudflap:
-@if target-libmudflap
-maybe-info-target-libmudflap: info-target-libmudflap
+.PHONY: maybe-info-target-libsanitizer info-target-libsanitizer
+maybe-info-target-libsanitizer:
+@if target-libsanitizer
+maybe-info-target-libsanitizer: info-target-libsanitizer
 
-info-target-libmudflap: \
-    configure-target-libmudflap 
+info-target-libsanitizer: \
+    configure-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing info in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31089,25 +32404,25 @@
 	           info) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-dvi-target-libmudflap dvi-target-libmudflap
-maybe-dvi-target-libmudflap:
-@if target-libmudflap
-maybe-dvi-target-libmudflap: dvi-target-libmudflap
+.PHONY: maybe-dvi-target-libsanitizer dvi-target-libsanitizer
+maybe-dvi-target-libsanitizer:
+@if target-libsanitizer
+maybe-dvi-target-libsanitizer: dvi-target-libsanitizer
 
-dvi-target-libmudflap: \
-    configure-target-libmudflap 
+dvi-target-libsanitizer: \
+    configure-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing dvi in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31115,25 +32430,25 @@
 	           dvi) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-pdf-target-libmudflap pdf-target-libmudflap
-maybe-pdf-target-libmudflap:
-@if target-libmudflap
-maybe-pdf-target-libmudflap: pdf-target-libmudflap
+.PHONY: maybe-pdf-target-libsanitizer pdf-target-libsanitizer
+maybe-pdf-target-libsanitizer:
+@if target-libsanitizer
+maybe-pdf-target-libsanitizer: pdf-target-libsanitizer
 
-pdf-target-libmudflap: \
-    configure-target-libmudflap 
+pdf-target-libsanitizer: \
+    configure-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing pdf in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31141,25 +32456,25 @@
 	           pdf) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-html-target-libmudflap html-target-libmudflap
-maybe-html-target-libmudflap:
-@if target-libmudflap
-maybe-html-target-libmudflap: html-target-libmudflap
+.PHONY: maybe-html-target-libsanitizer html-target-libsanitizer
+maybe-html-target-libsanitizer:
+@if target-libsanitizer
+maybe-html-target-libsanitizer: html-target-libsanitizer
 
-html-target-libmudflap: \
-    configure-target-libmudflap 
+html-target-libsanitizer: \
+    configure-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing html in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31167,25 +32482,25 @@
 	           html) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-TAGS-target-libmudflap TAGS-target-libmudflap
-maybe-TAGS-target-libmudflap:
-@if target-libmudflap
-maybe-TAGS-target-libmudflap: TAGS-target-libmudflap
+.PHONY: maybe-TAGS-target-libsanitizer TAGS-target-libsanitizer
+maybe-TAGS-target-libsanitizer:
+@if target-libsanitizer
+maybe-TAGS-target-libsanitizer: TAGS-target-libsanitizer
 
-TAGS-target-libmudflap: \
-    configure-target-libmudflap 
+TAGS-target-libsanitizer: \
+    configure-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing TAGS in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31193,26 +32508,26 @@
 	           TAGS) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-install-info-target-libmudflap install-info-target-libmudflap
-maybe-install-info-target-libmudflap:
-@if target-libmudflap
-maybe-install-info-target-libmudflap: install-info-target-libmudflap
+.PHONY: maybe-install-info-target-libsanitizer install-info-target-libsanitizer
+maybe-install-info-target-libsanitizer:
+@if target-libsanitizer
+maybe-install-info-target-libsanitizer: install-info-target-libsanitizer
 
-install-info-target-libmudflap: \
-    configure-target-libmudflap \
-    info-target-libmudflap 
+install-info-target-libsanitizer: \
+    configure-target-libsanitizer \
+    info-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing install-info in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31220,26 +32535,26 @@
 	           install-info) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-install-pdf-target-libmudflap install-pdf-target-libmudflap
-maybe-install-pdf-target-libmudflap:
-@if target-libmudflap
-maybe-install-pdf-target-libmudflap: install-pdf-target-libmudflap
+.PHONY: maybe-install-pdf-target-libsanitizer install-pdf-target-libsanitizer
+maybe-install-pdf-target-libsanitizer:
+@if target-libsanitizer
+maybe-install-pdf-target-libsanitizer: install-pdf-target-libsanitizer
 
-install-pdf-target-libmudflap: \
-    configure-target-libmudflap \
-    pdf-target-libmudflap 
+install-pdf-target-libsanitizer: \
+    configure-target-libsanitizer \
+    pdf-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing install-pdf in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31247,26 +32562,26 @@
 	           install-pdf) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-install-html-target-libmudflap install-html-target-libmudflap
-maybe-install-html-target-libmudflap:
-@if target-libmudflap
-maybe-install-html-target-libmudflap: install-html-target-libmudflap
+.PHONY: maybe-install-html-target-libsanitizer install-html-target-libsanitizer
+maybe-install-html-target-libsanitizer:
+@if target-libsanitizer
+maybe-install-html-target-libsanitizer: install-html-target-libsanitizer
 
-install-html-target-libmudflap: \
-    configure-target-libmudflap \
-    html-target-libmudflap 
+install-html-target-libsanitizer: \
+    configure-target-libsanitizer \
+    html-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing install-html in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31274,25 +32589,25 @@
 	           install-html) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-installcheck-target-libmudflap installcheck-target-libmudflap
-maybe-installcheck-target-libmudflap:
-@if target-libmudflap
-maybe-installcheck-target-libmudflap: installcheck-target-libmudflap
+.PHONY: maybe-installcheck-target-libsanitizer installcheck-target-libsanitizer
+maybe-installcheck-target-libsanitizer:
+@if target-libsanitizer
+maybe-installcheck-target-libsanitizer: installcheck-target-libsanitizer
 
-installcheck-target-libmudflap: \
-    configure-target-libmudflap 
+installcheck-target-libsanitizer: \
+    configure-target-libsanitizer 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing installcheck in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31300,24 +32615,24 @@
 	           installcheck) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-mostlyclean-target-libmudflap mostlyclean-target-libmudflap
-maybe-mostlyclean-target-libmudflap:
-@if target-libmudflap
-maybe-mostlyclean-target-libmudflap: mostlyclean-target-libmudflap
+.PHONY: maybe-mostlyclean-target-libsanitizer mostlyclean-target-libsanitizer
+maybe-mostlyclean-target-libsanitizer:
+@if target-libsanitizer
+maybe-mostlyclean-target-libsanitizer: mostlyclean-target-libsanitizer
 
-mostlyclean-target-libmudflap: 
+mostlyclean-target-libsanitizer: 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31325,24 +32640,24 @@
 	           mostlyclean) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-clean-target-libmudflap clean-target-libmudflap
-maybe-clean-target-libmudflap:
-@if target-libmudflap
-maybe-clean-target-libmudflap: clean-target-libmudflap
+.PHONY: maybe-clean-target-libsanitizer clean-target-libsanitizer
+maybe-clean-target-libsanitizer:
+@if target-libsanitizer
+maybe-clean-target-libsanitizer: clean-target-libsanitizer
 
-clean-target-libmudflap: 
+clean-target-libsanitizer: 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing clean in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31350,24 +32665,24 @@
 	           clean) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-distclean-target-libmudflap distclean-target-libmudflap
-maybe-distclean-target-libmudflap:
-@if target-libmudflap
-maybe-distclean-target-libmudflap: distclean-target-libmudflap
+.PHONY: maybe-distclean-target-libsanitizer distclean-target-libsanitizer
+maybe-distclean-target-libsanitizer:
+@if target-libsanitizer
+maybe-distclean-target-libsanitizer: distclean-target-libsanitizer
 
-distclean-target-libmudflap: 
+distclean-target-libsanitizer: 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing distclean in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31375,24 +32690,24 @@
 	           distclean) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
 
-.PHONY: maybe-maintainer-clean-target-libmudflap maintainer-clean-target-libmudflap
-maybe-maintainer-clean-target-libmudflap:
-@if target-libmudflap
-maybe-maintainer-clean-target-libmudflap: maintainer-clean-target-libmudflap
+.PHONY: maybe-maintainer-clean-target-libsanitizer maintainer-clean-target-libsanitizer
+maybe-maintainer-clean-target-libsanitizer:
+@if target-libsanitizer
+maybe-maintainer-clean-target-libsanitizer: maintainer-clean-target-libsanitizer
 
-maintainer-clean-target-libmudflap: 
+maintainer-clean-target-libsanitizer: 
 	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \
+	@[ -f $(TARGET_SUBDIR)/libsanitizer/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libmudflap" ; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libsanitizer" ; \
 	for flag in $(EXTRA_TARGET_FLAGS); do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
 	done; \
-	(cd $(TARGET_SUBDIR)/libmudflap && \
+	(cd $(TARGET_SUBDIR)/libsanitizer && \
 	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
 	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
 	          "RANLIB=$${RANLIB}" \
@@ -31400,7 +32715,1438 @@
 	           maintainer-clean) \
 	  || exit 1
 
-@endif target-libmudflap
+@endif target-libsanitizer
+
+
+
+
+
+.PHONY: configure-target-libvtv maybe-configure-target-libvtv
+maybe-configure-target-libvtv:
+@if gcc-bootstrap
+configure-target-libvtv: stage_current
+@endif gcc-bootstrap
+@if target-libvtv
+maybe-configure-target-libvtv: configure-target-libvtv
+configure-target-libvtv: 
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Checking multilib configuration for libvtv..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libvtv/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libvtv/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libvtv/Makefile; \
+	    mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libvtv/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
+	$(RAW_CXX_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libvtv; \
+	cd "$(TARGET_SUBDIR)/libvtv" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libvtv/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libvtv"; \
+	libsrcdir="$$s/libvtv"; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif target-libvtv
+
+
+
+.PHONY: configure-stage1-target-libvtv maybe-configure-stage1-target-libvtv
+maybe-configure-stage1-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-configure-stage1-target-libvtv: configure-stage1-target-libvtv
+configure-stage1-target-libvtv:
+	@[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE1_TFLAGS)"; \
+	echo "Checking multilib configuration for libvtv..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libvtv/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libvtv/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libvtv/Makefile; \
+	    mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libvtv/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage 1 in $(TARGET_SUBDIR)/libvtv ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
+	cd $(TARGET_SUBDIR)/libvtv || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libvtv/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libvtv"; \
+	libsrcdir="$$s/libvtv"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  $(STAGE1_CONFIGURE_FLAGS)
+@endif target-libvtv-bootstrap
+
+.PHONY: configure-stage2-target-libvtv maybe-configure-stage2-target-libvtv
+maybe-configure-stage2-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-configure-stage2-target-libvtv: configure-stage2-target-libvtv
+configure-stage2-target-libvtv:
+	@[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE2_TFLAGS)"; \
+	echo "Checking multilib configuration for libvtv..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libvtv/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libvtv/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libvtv/Makefile; \
+	    mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libvtv/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage 2 in $(TARGET_SUBDIR)/libvtv ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
+	cd $(TARGET_SUBDIR)/libvtv || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libvtv/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libvtv"; \
+	libsrcdir="$$s/libvtv"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE2_CONFIGURE_FLAGS)
+@endif target-libvtv-bootstrap
+
+.PHONY: configure-stage3-target-libvtv maybe-configure-stage3-target-libvtv
+maybe-configure-stage3-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-configure-stage3-target-libvtv: configure-stage3-target-libvtv
+configure-stage3-target-libvtv:
+	@[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE3_TFLAGS)"; \
+	echo "Checking multilib configuration for libvtv..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libvtv/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libvtv/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libvtv/Makefile; \
+	    mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libvtv/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage 3 in $(TARGET_SUBDIR)/libvtv ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
+	cd $(TARGET_SUBDIR)/libvtv || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libvtv/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libvtv"; \
+	libsrcdir="$$s/libvtv"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE3_CONFIGURE_FLAGS)
+@endif target-libvtv-bootstrap
+
+.PHONY: configure-stage4-target-libvtv maybe-configure-stage4-target-libvtv
+maybe-configure-stage4-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-configure-stage4-target-libvtv: configure-stage4-target-libvtv
+configure-stage4-target-libvtv:
+	@[ $(current_stage) = stage4 ] || $(MAKE) stage4-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE4_TFLAGS)"; \
+	echo "Checking multilib configuration for libvtv..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libvtv/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libvtv/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libvtv/Makefile; \
+	    mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libvtv/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage 4 in $(TARGET_SUBDIR)/libvtv ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
+	cd $(TARGET_SUBDIR)/libvtv || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libvtv/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libvtv"; \
+	libsrcdir="$$s/libvtv"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGE4_CONFIGURE_FLAGS)
+@endif target-libvtv-bootstrap
+
+.PHONY: configure-stageprofile-target-libvtv maybe-configure-stageprofile-target-libvtv
+maybe-configure-stageprofile-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-configure-stageprofile-target-libvtv: configure-stageprofile-target-libvtv
+configure-stageprofile-target-libvtv:
+	@[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEprofile_TFLAGS)"; \
+	echo "Checking multilib configuration for libvtv..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libvtv/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libvtv/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libvtv/Makefile; \
+	    mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libvtv/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage profile in $(TARGET_SUBDIR)/libvtv ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
+	cd $(TARGET_SUBDIR)/libvtv || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libvtv/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libvtv"; \
+	libsrcdir="$$s/libvtv"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGEprofile_CONFIGURE_FLAGS)
+@endif target-libvtv-bootstrap
+
+.PHONY: configure-stagefeedback-target-libvtv maybe-configure-stagefeedback-target-libvtv
+maybe-configure-stagefeedback-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-configure-stagefeedback-target-libvtv: configure-stagefeedback-target-libvtv
+configure-stagefeedback-target-libvtv:
+	@[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start
+	@$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
+	echo "Checking multilib configuration for libvtv..."; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libvtv/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libvtv/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libvtv/Makefile; \
+	    mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libvtv/multilib.tmp $(TARGET_SUBDIR)/libvtv/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libvtv/Makefile || exit 0; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	 \
+	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
+	LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;  \
+	echo Configuring stage feedback in $(TARGET_SUBDIR)/libvtv ; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libvtv ; \
+	cd $(TARGET_SUBDIR)/libvtv || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libvtv/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libvtv"; \
+	libsrcdir="$$s/libvtv"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption} \
+	  --with-build-libsubdir=$(HOST_SUBDIR) \
+	  $(STAGEfeedback_CONFIGURE_FLAGS)
+@endif target-libvtv-bootstrap
+
+
+
+
+
+.PHONY: all-target-libvtv maybe-all-target-libvtv
+maybe-all-target-libvtv:
+@if gcc-bootstrap
+all-target-libvtv: stage_current
+@endif gcc-bootstrap
+@if target-libvtv
+TARGET-target-libvtv=all
+maybe-all-target-libvtv: all-target-libvtv
+all-target-libvtv: configure-target-libvtv
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		$(TARGET-target-libvtv))
+@endif target-libvtv
+
+
+
+.PHONY: all-stage1-target-libvtv maybe-all-stage1-target-libvtv
+.PHONY: clean-stage1-target-libvtv maybe-clean-stage1-target-libvtv
+maybe-all-stage1-target-libvtv:
+maybe-clean-stage1-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-all-stage1-target-libvtv: all-stage1-target-libvtv
+all-stage1: all-stage1-target-libvtv
+TARGET-stage1-target-libvtv = $(TARGET-target-libvtv)
+all-stage1-target-libvtv: configure-stage1-target-libvtv
+	@[ $(current_stage) = stage1 ] || $(MAKE) stage1-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE1_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS)  \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
+		  \
+		TFLAGS="$(STAGE1_TFLAGS)" \
+		$(TARGET-stage1-target-libvtv)
+
+maybe-clean-stage1-target-libvtv: clean-stage1-target-libvtv
+clean-stage1: clean-stage1-target-libvtv
+clean-stage1-target-libvtv:
+	@if [ $(current_stage) = stage1 ]; then \
+	  [ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stage1-libvtv/Makefile ] || exit 0; \
+	  $(MAKE) stage1-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
+	  clean
+@endif target-libvtv-bootstrap
+
+
+.PHONY: all-stage2-target-libvtv maybe-all-stage2-target-libvtv
+.PHONY: clean-stage2-target-libvtv maybe-clean-stage2-target-libvtv
+maybe-all-stage2-target-libvtv:
+maybe-clean-stage2-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-all-stage2-target-libvtv: all-stage2-target-libvtv
+all-stage2: all-stage2-target-libvtv
+TARGET-stage2-target-libvtv = $(TARGET-target-libvtv)
+all-stage2-target-libvtv: configure-stage2-target-libvtv
+	@[ $(current_stage) = stage2 ] || $(MAKE) stage2-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE2_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGE2_TFLAGS)" \
+		$(TARGET-stage2-target-libvtv)
+
+maybe-clean-stage2-target-libvtv: clean-stage2-target-libvtv
+clean-stage2: clean-stage2-target-libvtv
+clean-stage2-target-libvtv:
+	@if [ $(current_stage) = stage2 ]; then \
+	  [ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stage2-libvtv/Makefile ] || exit 0; \
+	  $(MAKE) stage2-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libvtv-bootstrap
+
+
+.PHONY: all-stage3-target-libvtv maybe-all-stage3-target-libvtv
+.PHONY: clean-stage3-target-libvtv maybe-clean-stage3-target-libvtv
+maybe-all-stage3-target-libvtv:
+maybe-clean-stage3-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-all-stage3-target-libvtv: all-stage3-target-libvtv
+all-stage3: all-stage3-target-libvtv
+TARGET-stage3-target-libvtv = $(TARGET-target-libvtv)
+all-stage3-target-libvtv: configure-stage3-target-libvtv
+	@[ $(current_stage) = stage3 ] || $(MAKE) stage3-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE3_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGE3_TFLAGS)" \
+		$(TARGET-stage3-target-libvtv)
+
+maybe-clean-stage3-target-libvtv: clean-stage3-target-libvtv
+clean-stage3: clean-stage3-target-libvtv
+clean-stage3-target-libvtv:
+	@if [ $(current_stage) = stage3 ]; then \
+	  [ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stage3-libvtv/Makefile ] || exit 0; \
+	  $(MAKE) stage3-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libvtv-bootstrap
+
+
+.PHONY: all-stage4-target-libvtv maybe-all-stage4-target-libvtv
+.PHONY: clean-stage4-target-libvtv maybe-clean-stage4-target-libvtv
+maybe-all-stage4-target-libvtv:
+maybe-clean-stage4-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-all-stage4-target-libvtv: all-stage4-target-libvtv
+all-stage4: all-stage4-target-libvtv
+TARGET-stage4-target-libvtv = $(TARGET-target-libvtv)
+all-stage4-target-libvtv: configure-stage4-target-libvtv
+	@[ $(current_stage) = stage4 ] || $(MAKE) stage4-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGE4_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGE4_TFLAGS)" \
+		$(TARGET-stage4-target-libvtv)
+
+maybe-clean-stage4-target-libvtv: clean-stage4-target-libvtv
+clean-stage4: clean-stage4-target-libvtv
+clean-stage4-target-libvtv:
+	@if [ $(current_stage) = stage4 ]; then \
+	  [ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stage4-libvtv/Makefile ] || exit 0; \
+	  $(MAKE) stage4-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libvtv-bootstrap
+
+
+.PHONY: all-stageprofile-target-libvtv maybe-all-stageprofile-target-libvtv
+.PHONY: clean-stageprofile-target-libvtv maybe-clean-stageprofile-target-libvtv
+maybe-all-stageprofile-target-libvtv:
+maybe-clean-stageprofile-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-all-stageprofile-target-libvtv: all-stageprofile-target-libvtv
+all-stageprofile: all-stageprofile-target-libvtv
+TARGET-stageprofile-target-libvtv = $(TARGET-target-libvtv)
+all-stageprofile-target-libvtv: configure-stageprofile-target-libvtv
+	@[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEprofile_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGEprofile_TFLAGS)" \
+		$(TARGET-stageprofile-target-libvtv)
+
+maybe-clean-stageprofile-target-libvtv: clean-stageprofile-target-libvtv
+clean-stageprofile: clean-stageprofile-target-libvtv
+clean-stageprofile-target-libvtv:
+	@if [ $(current_stage) = stageprofile ]; then \
+	  [ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stageprofile-libvtv/Makefile ] || exit 0; \
+	  $(MAKE) stageprofile-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libvtv-bootstrap
+
+
+.PHONY: all-stagefeedback-target-libvtv maybe-all-stagefeedback-target-libvtv
+.PHONY: clean-stagefeedback-target-libvtv maybe-clean-stagefeedback-target-libvtv
+maybe-all-stagefeedback-target-libvtv:
+maybe-clean-stagefeedback-target-libvtv:
+@if target-libvtv-bootstrap
+maybe-all-stagefeedback-target-libvtv: all-stagefeedback-target-libvtv
+all-stagefeedback: all-stagefeedback-target-libvtv
+TARGET-stagefeedback-target-libvtv = $(TARGET-target-libvtv)
+all-stagefeedback-target-libvtv: configure-stagefeedback-target-libvtv
+	@[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	TFLAGS="$(STAGEfeedback_TFLAGS)"; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	  \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(BASE_FLAGS_TO_PASS) \
+		CFLAGS="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)" \
+		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
+		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
+		$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
+		TFLAGS="$(STAGEfeedback_TFLAGS)" \
+		$(TARGET-stagefeedback-target-libvtv)
+
+maybe-clean-stagefeedback-target-libvtv: clean-stagefeedback-target-libvtv
+clean-stagefeedback: clean-stagefeedback-target-libvtv
+clean-stagefeedback-target-libvtv:
+	@if [ $(current_stage) = stagefeedback ]; then \
+	  [ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0; \
+	else \
+	  [ -f $(TARGET_SUBDIR)/stagefeedback-libvtv/Makefile ] || exit 0; \
+	  $(MAKE) stagefeedback-start; \
+	fi; \
+	cd $(TARGET_SUBDIR)/libvtv && \
+	$(MAKE) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   clean
+@endif target-libvtv-bootstrap
+
+
+
+
+
+
+.PHONY: check-target-libvtv maybe-check-target-libvtv
+maybe-check-target-libvtv:
+@if target-libvtv
+maybe-check-target-libvtv: check-target-libvtv
+
+check-target-libvtv:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   check)
+
+@endif target-libvtv
+
+.PHONY: install-target-libvtv maybe-install-target-libvtv
+maybe-install-target-libvtv:
+@if target-libvtv
+maybe-install-target-libvtv: install-target-libvtv
+
+install-target-libvtv: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libvtv
+
+.PHONY: install-strip-target-libvtv maybe-install-strip-target-libvtv
+maybe-install-strip-target-libvtv:
+@if target-libvtv
+maybe-install-strip-target-libvtv: install-strip-target-libvtv
+
+install-strip-target-libvtv: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+
+@endif target-libvtv
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libvtv info-target-libvtv
+maybe-info-target-libvtv:
+@if target-libvtv
+maybe-info-target-libvtv: info-target-libvtv
+
+info-target-libvtv: \
+    configure-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           info) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-dvi-target-libvtv dvi-target-libvtv
+maybe-dvi-target-libvtv:
+@if target-libvtv
+maybe-dvi-target-libvtv: dvi-target-libvtv
+
+dvi-target-libvtv: \
+    configure-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-pdf-target-libvtv pdf-target-libvtv
+maybe-pdf-target-libvtv:
+@if target-libvtv
+maybe-pdf-target-libvtv: pdf-target-libvtv
+
+pdf-target-libvtv: \
+    configure-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           pdf) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-html-target-libvtv html-target-libvtv
+maybe-html-target-libvtv:
+@if target-libvtv
+maybe-html-target-libvtv: html-target-libvtv
+
+html-target-libvtv: \
+    configure-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           html) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-TAGS-target-libvtv TAGS-target-libvtv
+maybe-TAGS-target-libvtv:
+@if target-libvtv
+maybe-TAGS-target-libvtv: TAGS-target-libvtv
+
+TAGS-target-libvtv: \
+    configure-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-install-info-target-libvtv install-info-target-libvtv
+maybe-install-info-target-libvtv:
+@if target-libvtv
+maybe-install-info-target-libvtv: install-info-target-libvtv
+
+install-info-target-libvtv: \
+    configure-target-libvtv \
+    info-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-install-pdf-target-libvtv install-pdf-target-libvtv
+maybe-install-pdf-target-libvtv:
+@if target-libvtv
+maybe-install-pdf-target-libvtv: install-pdf-target-libvtv
+
+install-pdf-target-libvtv: \
+    configure-target-libvtv \
+    pdf-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-pdf) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-install-html-target-libvtv install-html-target-libvtv
+maybe-install-html-target-libvtv:
+@if target-libvtv
+maybe-install-html-target-libvtv: install-html-target-libvtv
+
+install-html-target-libvtv: \
+    configure-target-libvtv \
+    html-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-html) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-installcheck-target-libvtv installcheck-target-libvtv
+maybe-installcheck-target-libvtv:
+@if target-libvtv
+maybe-installcheck-target-libvtv: installcheck-target-libvtv
+
+installcheck-target-libvtv: \
+    configure-target-libvtv 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-mostlyclean-target-libvtv mostlyclean-target-libvtv
+maybe-mostlyclean-target-libvtv:
+@if target-libvtv
+maybe-mostlyclean-target-libvtv: mostlyclean-target-libvtv
+
+mostlyclean-target-libvtv: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-clean-target-libvtv clean-target-libvtv
+maybe-clean-target-libvtv:
+@if target-libvtv
+maybe-clean-target-libvtv: clean-target-libvtv
+
+clean-target-libvtv: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-distclean-target-libvtv distclean-target-libvtv
+maybe-distclean-target-libvtv:
+@if target-libvtv
+maybe-distclean-target-libvtv: distclean-target-libvtv
+
+distclean-target-libvtv: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libvtv
+
+.PHONY: maybe-maintainer-clean-target-libvtv maintainer-clean-target-libvtv
+maybe-maintainer-clean-target-libvtv:
+@if target-libvtv
+maybe-maintainer-clean-target-libvtv: maintainer-clean-target-libvtv
+
+maintainer-clean-target-libvtv: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libvtv/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(RAW_CXX_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libvtv" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libvtv && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libvtv
+
+
+
+
+
+.PHONY: configure-target-libcilkrts maybe-configure-target-libcilkrts
+maybe-configure-target-libcilkrts:
+@if gcc-bootstrap
+configure-target-libcilkrts: stage_current
+@endif gcc-bootstrap
+@if target-libcilkrts
+maybe-configure-target-libcilkrts: configure-target-libcilkrts
+configure-target-libcilkrts: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Checking multilib configuration for libcilkrts..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libcilkrts ; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libcilkrts/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libcilkrts/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libcilkrts/multilib.tmp $(TARGET_SUBDIR)/libcilkrts/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libcilkrts/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libcilkrts/Makefile; \
+	    mv $(TARGET_SUBDIR)/libcilkrts/multilib.tmp $(TARGET_SUBDIR)/libcilkrts/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libcilkrts/multilib.tmp $(TARGET_SUBDIR)/libcilkrts/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libcilkrts/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libcilkrts ; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libcilkrts; \
+	cd "$(TARGET_SUBDIR)/libcilkrts" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libcilkrts/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libcilkrts"; \
+	libsrcdir="$$s/libcilkrts"; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif target-libcilkrts
+
+
+
+
+
+.PHONY: all-target-libcilkrts maybe-all-target-libcilkrts
+maybe-all-target-libcilkrts:
+@if gcc-bootstrap
+all-target-libcilkrts: stage_current
+@endif gcc-bootstrap
+@if target-libcilkrts
+TARGET-target-libcilkrts=all
+maybe-all-target-libcilkrts: all-target-libcilkrts
+all-target-libcilkrts: configure-target-libcilkrts
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
+		$(TARGET-target-libcilkrts))
+@endif target-libcilkrts
+
+
+
+
+
+.PHONY: check-target-libcilkrts maybe-check-target-libcilkrts
+maybe-check-target-libcilkrts:
+@if target-libcilkrts
+maybe-check-target-libcilkrts: check-target-libcilkrts
+
+check-target-libcilkrts:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
+
+@endif target-libcilkrts
+
+.PHONY: install-target-libcilkrts maybe-install-target-libcilkrts
+maybe-install-target-libcilkrts:
+@if target-libcilkrts
+maybe-install-target-libcilkrts: install-target-libcilkrts
+
+install-target-libcilkrts: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libcilkrts
+
+.PHONY: install-strip-target-libcilkrts maybe-install-strip-target-libcilkrts
+maybe-install-strip-target-libcilkrts:
+@if target-libcilkrts
+maybe-install-strip-target-libcilkrts: install-strip-target-libcilkrts
+
+install-strip-target-libcilkrts: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+
+@endif target-libcilkrts
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libcilkrts info-target-libcilkrts
+maybe-info-target-libcilkrts:
+@if target-libcilkrts
+maybe-info-target-libcilkrts: info-target-libcilkrts
+
+info-target-libcilkrts: \
+    configure-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           info) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-dvi-target-libcilkrts dvi-target-libcilkrts
+maybe-dvi-target-libcilkrts:
+@if target-libcilkrts
+maybe-dvi-target-libcilkrts: dvi-target-libcilkrts
+
+dvi-target-libcilkrts: \
+    configure-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-pdf-target-libcilkrts pdf-target-libcilkrts
+maybe-pdf-target-libcilkrts:
+@if target-libcilkrts
+maybe-pdf-target-libcilkrts: pdf-target-libcilkrts
+
+pdf-target-libcilkrts: \
+    configure-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           pdf) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-html-target-libcilkrts html-target-libcilkrts
+maybe-html-target-libcilkrts:
+@if target-libcilkrts
+maybe-html-target-libcilkrts: html-target-libcilkrts
+
+html-target-libcilkrts: \
+    configure-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           html) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-TAGS-target-libcilkrts TAGS-target-libcilkrts
+maybe-TAGS-target-libcilkrts:
+@if target-libcilkrts
+maybe-TAGS-target-libcilkrts: TAGS-target-libcilkrts
+
+TAGS-target-libcilkrts: \
+    configure-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-install-info-target-libcilkrts install-info-target-libcilkrts
+maybe-install-info-target-libcilkrts:
+@if target-libcilkrts
+maybe-install-info-target-libcilkrts: install-info-target-libcilkrts
+
+install-info-target-libcilkrts: \
+    configure-target-libcilkrts \
+    info-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-install-pdf-target-libcilkrts install-pdf-target-libcilkrts
+maybe-install-pdf-target-libcilkrts:
+@if target-libcilkrts
+maybe-install-pdf-target-libcilkrts: install-pdf-target-libcilkrts
+
+install-pdf-target-libcilkrts: \
+    configure-target-libcilkrts \
+    pdf-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-pdf) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-install-html-target-libcilkrts install-html-target-libcilkrts
+maybe-install-html-target-libcilkrts:
+@if target-libcilkrts
+maybe-install-html-target-libcilkrts: install-html-target-libcilkrts
+
+install-html-target-libcilkrts: \
+    configure-target-libcilkrts \
+    html-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-html) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-installcheck-target-libcilkrts installcheck-target-libcilkrts
+maybe-installcheck-target-libcilkrts:
+@if target-libcilkrts
+maybe-installcheck-target-libcilkrts: installcheck-target-libcilkrts
+
+installcheck-target-libcilkrts: \
+    configure-target-libcilkrts 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-mostlyclean-target-libcilkrts mostlyclean-target-libcilkrts
+maybe-mostlyclean-target-libcilkrts:
+@if target-libcilkrts
+maybe-mostlyclean-target-libcilkrts: mostlyclean-target-libcilkrts
+
+mostlyclean-target-libcilkrts: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-clean-target-libcilkrts clean-target-libcilkrts
+maybe-clean-target-libcilkrts:
+@if target-libcilkrts
+maybe-clean-target-libcilkrts: clean-target-libcilkrts
+
+clean-target-libcilkrts: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-distclean-target-libcilkrts distclean-target-libcilkrts
+maybe-distclean-target-libcilkrts:
+@if target-libcilkrts
+maybe-distclean-target-libcilkrts: distclean-target-libcilkrts
+
+distclean-target-libcilkrts: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libcilkrts
+
+.PHONY: maybe-maintainer-clean-target-libcilkrts maintainer-clean-target-libcilkrts
+maybe-maintainer-clean-target-libcilkrts:
+@if target-libcilkrts
+maybe-maintainer-clean-target-libcilkrts: maintainer-clean-target-libcilkrts
+
+maintainer-clean-target-libcilkrts: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libcilkrts/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libcilkrts" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libcilkrts && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libcilkrts
 
 
 
@@ -31467,7 +34213,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libssp && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libssp))
 @endif target-libssp
 
@@ -31924,7 +34670,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/newlib && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-newlib))
 @endif target-newlib
 
@@ -32649,7 +35395,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libgcc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libgcc))
 @endif target-libgcc
 
@@ -32677,7 +35423,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_TARGET_FLAGS)   \
+		$(EXTRA_TARGET_FLAGS)  \
+		  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-target-libgcc)
 
@@ -32692,7 +35439,7 @@
 	fi; \
 	cd $(TARGET_SUBDIR)/libgcc && \
 	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		 clean
+	  clean
 @endif target-libgcc-bootstrap
 
 
@@ -32733,9 +35480,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgcc && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgcc-bootstrap
 
 
@@ -32776,9 +35521,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgcc && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgcc-bootstrap
 
 
@@ -32819,9 +35562,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgcc && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgcc-bootstrap
 
 
@@ -32862,9 +35603,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgcc && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgcc-bootstrap
 
 
@@ -32905,9 +35644,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgcc && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgcc-bootstrap
 
 
@@ -33298,6 +36035,463 @@
 
 
 
+.PHONY: configure-target-libbacktrace maybe-configure-target-libbacktrace
+maybe-configure-target-libbacktrace:
+@if gcc-bootstrap
+configure-target-libbacktrace: stage_current
+@endif gcc-bootstrap
+@if target-libbacktrace
+maybe-configure-target-libbacktrace: configure-target-libbacktrace
+configure-target-libbacktrace: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Checking multilib configuration for libbacktrace..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libbacktrace ; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libbacktrace/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libbacktrace/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libbacktrace/multilib.tmp $(TARGET_SUBDIR)/libbacktrace/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libbacktrace/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libbacktrace/Makefile; \
+	    mv $(TARGET_SUBDIR)/libbacktrace/multilib.tmp $(TARGET_SUBDIR)/libbacktrace/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libbacktrace/multilib.tmp $(TARGET_SUBDIR)/libbacktrace/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libbacktrace/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libbacktrace ; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libbacktrace; \
+	cd "$(TARGET_SUBDIR)/libbacktrace" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libbacktrace/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libbacktrace"; \
+	libsrcdir="$$s/libbacktrace"; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif target-libbacktrace
+
+
+
+
+
+.PHONY: all-target-libbacktrace maybe-all-target-libbacktrace
+maybe-all-target-libbacktrace:
+@if gcc-bootstrap
+all-target-libbacktrace: stage_current
+@endif gcc-bootstrap
+@if target-libbacktrace
+TARGET-target-libbacktrace=all
+maybe-all-target-libbacktrace: all-target-libbacktrace
+all-target-libbacktrace: configure-target-libbacktrace
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
+		$(TARGET-target-libbacktrace))
+@endif target-libbacktrace
+
+
+
+
+
+.PHONY: check-target-libbacktrace maybe-check-target-libbacktrace
+maybe-check-target-libbacktrace:
+@if target-libbacktrace
+maybe-check-target-libbacktrace: check-target-libbacktrace
+
+check-target-libbacktrace:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
+
+@endif target-libbacktrace
+
+.PHONY: install-target-libbacktrace maybe-install-target-libbacktrace
+maybe-install-target-libbacktrace:
+@if target-libbacktrace
+maybe-install-target-libbacktrace: install-target-libbacktrace
+
+install-target-libbacktrace: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libbacktrace
+
+.PHONY: install-strip-target-libbacktrace maybe-install-strip-target-libbacktrace
+maybe-install-strip-target-libbacktrace:
+@if target-libbacktrace
+maybe-install-strip-target-libbacktrace: install-strip-target-libbacktrace
+
+install-strip-target-libbacktrace: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+
+@endif target-libbacktrace
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libbacktrace info-target-libbacktrace
+maybe-info-target-libbacktrace:
+@if target-libbacktrace
+maybe-info-target-libbacktrace: info-target-libbacktrace
+
+info-target-libbacktrace: \
+    configure-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           info) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-dvi-target-libbacktrace dvi-target-libbacktrace
+maybe-dvi-target-libbacktrace:
+@if target-libbacktrace
+maybe-dvi-target-libbacktrace: dvi-target-libbacktrace
+
+dvi-target-libbacktrace: \
+    configure-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-pdf-target-libbacktrace pdf-target-libbacktrace
+maybe-pdf-target-libbacktrace:
+@if target-libbacktrace
+maybe-pdf-target-libbacktrace: pdf-target-libbacktrace
+
+pdf-target-libbacktrace: \
+    configure-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           pdf) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-html-target-libbacktrace html-target-libbacktrace
+maybe-html-target-libbacktrace:
+@if target-libbacktrace
+maybe-html-target-libbacktrace: html-target-libbacktrace
+
+html-target-libbacktrace: \
+    configure-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           html) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-TAGS-target-libbacktrace TAGS-target-libbacktrace
+maybe-TAGS-target-libbacktrace:
+@if target-libbacktrace
+maybe-TAGS-target-libbacktrace: TAGS-target-libbacktrace
+
+TAGS-target-libbacktrace: \
+    configure-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-install-info-target-libbacktrace install-info-target-libbacktrace
+maybe-install-info-target-libbacktrace:
+@if target-libbacktrace
+maybe-install-info-target-libbacktrace: install-info-target-libbacktrace
+
+install-info-target-libbacktrace: \
+    configure-target-libbacktrace \
+    info-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-install-pdf-target-libbacktrace install-pdf-target-libbacktrace
+maybe-install-pdf-target-libbacktrace:
+@if target-libbacktrace
+maybe-install-pdf-target-libbacktrace: install-pdf-target-libbacktrace
+
+install-pdf-target-libbacktrace: \
+    configure-target-libbacktrace \
+    pdf-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-pdf) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-install-html-target-libbacktrace install-html-target-libbacktrace
+maybe-install-html-target-libbacktrace:
+@if target-libbacktrace
+maybe-install-html-target-libbacktrace: install-html-target-libbacktrace
+
+install-html-target-libbacktrace: \
+    configure-target-libbacktrace \
+    html-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-html) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-installcheck-target-libbacktrace installcheck-target-libbacktrace
+maybe-installcheck-target-libbacktrace:
+@if target-libbacktrace
+maybe-installcheck-target-libbacktrace: installcheck-target-libbacktrace
+
+installcheck-target-libbacktrace: \
+    configure-target-libbacktrace 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-mostlyclean-target-libbacktrace mostlyclean-target-libbacktrace
+maybe-mostlyclean-target-libbacktrace:
+@if target-libbacktrace
+maybe-mostlyclean-target-libbacktrace: mostlyclean-target-libbacktrace
+
+mostlyclean-target-libbacktrace: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-clean-target-libbacktrace clean-target-libbacktrace
+maybe-clean-target-libbacktrace:
+@if target-libbacktrace
+maybe-clean-target-libbacktrace: clean-target-libbacktrace
+
+clean-target-libbacktrace: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-distclean-target-libbacktrace distclean-target-libbacktrace
+maybe-distclean-target-libbacktrace:
+@if target-libbacktrace
+maybe-distclean-target-libbacktrace: distclean-target-libbacktrace
+
+distclean-target-libbacktrace: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+.PHONY: maybe-maintainer-clean-target-libbacktrace maintainer-clean-target-libbacktrace
+maybe-maintainer-clean-target-libbacktrace:
+@if target-libbacktrace
+maybe-maintainer-clean-target-libbacktrace: maintainer-clean-target-libbacktrace
+
+maintainer-clean-target-libbacktrace: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libbacktrace/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libbacktrace" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libbacktrace && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libbacktrace
+
+
+
+
+
 .PHONY: configure-target-libquadmath maybe-configure-target-libquadmath
 maybe-configure-target-libquadmath:
 @if gcc-bootstrap
@@ -33359,7 +36553,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libquadmath && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libquadmath))
 @endif target-libquadmath
 
@@ -33816,7 +37010,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libgfortran && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libgfortran))
 @endif target-libgfortran
 
@@ -34273,7 +37467,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libobjc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libobjc))
 @endif target-libobjc
 
@@ -34730,7 +37924,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libgo && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libgo))
 @endif target-libgo
 
@@ -35187,7 +38381,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libtermcap && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libtermcap))
 @endif target-libtermcap
 
@@ -35579,7 +38773,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/winsup && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-winsup))
 @endif target-winsup
 
@@ -36036,7 +39230,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libgloss && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libgloss))
 @endif target-libgloss
 
@@ -36488,7 +39682,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libffi && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libffi))
 @endif target-libffi
 
@@ -36516,13 +39710,8 @@
 @if target-libffi
 maybe-install-target-libffi: install-target-libffi
 
-install-target-libffi: installdirs
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	(cd $(TARGET_SUBDIR)/libffi && \
-	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+# Dummy target for uninstallable.
+install-target-libffi:
 
 @endif target-libffi
 
@@ -36531,13 +39720,8 @@
 @if target-libffi
 maybe-install-strip-target-libffi: install-strip-target-libffi
 
-install-strip-target-libffi: installdirs
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	(cd $(TARGET_SUBDIR)/libffi && \
-	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+# Dummy target for uninstallable.
+install-strip-target-libffi:
 
 @endif target-libffi
 
@@ -36945,7 +40129,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(RAW_CXX_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libjava && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'   \
 		$(TARGET-target-libjava))
 @endif target-libjava
 
@@ -37402,7 +40586,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/zlib && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-zlib))
 @endif target-zlib
 
@@ -37859,7 +41043,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/boehm-gc && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-boehm-gc))
 @endif target-boehm-gc
 
@@ -38316,7 +41500,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/rda && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-rda))
 @endif target-rda
 
@@ -38773,7 +41957,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libada))
 @endif target-libada
 
@@ -39498,7 +42682,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(NORMAL_TARGET_EXPORTS)  \
 	(cd $(TARGET_SUBDIR)/libgomp && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
 		$(TARGET-target-libgomp))
 @endif target-libgomp
 
@@ -39526,7 +42710,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		$(EXTRA_TARGET_FLAGS)   \
+		$(EXTRA_TARGET_FLAGS)  \
+		  \
 		TFLAGS="$(STAGE1_TFLAGS)" \
 		$(TARGET-stage1-target-libgomp)
 
@@ -39541,7 +42726,7 @@
 	fi; \
 	cd $(TARGET_SUBDIR)/libgomp && \
 	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		 clean
+	  clean
 @endif target-libgomp-bootstrap
 
 
@@ -39582,9 +42767,7 @@
 	  $(MAKE) stage2-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgomp && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgomp-bootstrap
 
 
@@ -39625,9 +42808,7 @@
 	  $(MAKE) stage3-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgomp && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgomp-bootstrap
 
 
@@ -39668,9 +42849,7 @@
 	  $(MAKE) stage4-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgomp && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgomp-bootstrap
 
 
@@ -39711,9 +42890,7 @@
 	  $(MAKE) stageprofile-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgomp && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgomp-bootstrap
 
 
@@ -39754,9 +42931,7 @@
 	  $(MAKE) stagefeedback-start; \
 	fi; \
 	cd $(TARGET_SUBDIR)/libgomp && \
-	$(MAKE) $(EXTRA_TARGET_FLAGS)  \
-		  \
-		 clean
+	$(MAKE) $(EXTRA_TARGET_FLAGS)   clean
 @endif target-libgomp-bootstrap
 
 
@@ -40150,12 +43325,933 @@
 
 
 
-@if target-libmudflap
-.PHONY: check-target-libmudflap-c++
-check-target-libmudflap-c++:
-	$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++frags.exp" check-target-libmudflap
 
-@endif target-libmudflap
+
+.PHONY: configure-target-libitm maybe-configure-target-libitm
+maybe-configure-target-libitm:
+@if gcc-bootstrap
+configure-target-libitm: stage_current
+@endif gcc-bootstrap
+@if target-libitm
+maybe-configure-target-libitm: configure-target-libitm
+configure-target-libitm: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Checking multilib configuration for libitm..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libitm ; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libitm/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libitm/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libitm/multilib.tmp $(TARGET_SUBDIR)/libitm/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libitm/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libitm/Makefile; \
+	    mv $(TARGET_SUBDIR)/libitm/multilib.tmp $(TARGET_SUBDIR)/libitm/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libitm/multilib.tmp $(TARGET_SUBDIR)/libitm/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libitm/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libitm ; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libitm; \
+	cd "$(TARGET_SUBDIR)/libitm" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libitm/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libitm"; \
+	libsrcdir="$$s/libitm"; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif target-libitm
+
+
+
+
+
+.PHONY: all-target-libitm maybe-all-target-libitm
+maybe-all-target-libitm:
+@if gcc-bootstrap
+all-target-libitm: stage_current
+@endif gcc-bootstrap
+@if target-libitm
+TARGET-target-libitm=all
+maybe-all-target-libitm: all-target-libitm
+all-target-libitm: configure-target-libitm
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
+		$(TARGET-target-libitm))
+@endif target-libitm
+
+
+
+
+
+.PHONY: check-target-libitm maybe-check-target-libitm
+maybe-check-target-libitm:
+@if target-libitm
+maybe-check-target-libitm: check-target-libitm
+
+check-target-libitm:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
+
+@endif target-libitm
+
+.PHONY: install-target-libitm maybe-install-target-libitm
+maybe-install-target-libitm:
+@if target-libitm
+maybe-install-target-libitm: install-target-libitm
+
+install-target-libitm: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libitm
+
+.PHONY: install-strip-target-libitm maybe-install-strip-target-libitm
+maybe-install-strip-target-libitm:
+@if target-libitm
+maybe-install-strip-target-libitm: install-strip-target-libitm
+
+install-strip-target-libitm: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+
+@endif target-libitm
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libitm info-target-libitm
+maybe-info-target-libitm:
+@if target-libitm
+maybe-info-target-libitm: info-target-libitm
+
+info-target-libitm: \
+    configure-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           info) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-dvi-target-libitm dvi-target-libitm
+maybe-dvi-target-libitm:
+@if target-libitm
+maybe-dvi-target-libitm: dvi-target-libitm
+
+dvi-target-libitm: \
+    configure-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-pdf-target-libitm pdf-target-libitm
+maybe-pdf-target-libitm:
+@if target-libitm
+maybe-pdf-target-libitm: pdf-target-libitm
+
+pdf-target-libitm: \
+    configure-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           pdf) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-html-target-libitm html-target-libitm
+maybe-html-target-libitm:
+@if target-libitm
+maybe-html-target-libitm: html-target-libitm
+
+html-target-libitm: \
+    configure-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           html) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-TAGS-target-libitm TAGS-target-libitm
+maybe-TAGS-target-libitm:
+@if target-libitm
+maybe-TAGS-target-libitm: TAGS-target-libitm
+
+TAGS-target-libitm: \
+    configure-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-install-info-target-libitm install-info-target-libitm
+maybe-install-info-target-libitm:
+@if target-libitm
+maybe-install-info-target-libitm: install-info-target-libitm
+
+install-info-target-libitm: \
+    configure-target-libitm \
+    info-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-install-pdf-target-libitm install-pdf-target-libitm
+maybe-install-pdf-target-libitm:
+@if target-libitm
+maybe-install-pdf-target-libitm: install-pdf-target-libitm
+
+install-pdf-target-libitm: \
+    configure-target-libitm \
+    pdf-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-pdf) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-install-html-target-libitm install-html-target-libitm
+maybe-install-html-target-libitm:
+@if target-libitm
+maybe-install-html-target-libitm: install-html-target-libitm
+
+install-html-target-libitm: \
+    configure-target-libitm \
+    html-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-html) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-installcheck-target-libitm installcheck-target-libitm
+maybe-installcheck-target-libitm:
+@if target-libitm
+maybe-installcheck-target-libitm: installcheck-target-libitm
+
+installcheck-target-libitm: \
+    configure-target-libitm 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-mostlyclean-target-libitm mostlyclean-target-libitm
+maybe-mostlyclean-target-libitm:
+@if target-libitm
+maybe-mostlyclean-target-libitm: mostlyclean-target-libitm
+
+mostlyclean-target-libitm: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-clean-target-libitm clean-target-libitm
+maybe-clean-target-libitm:
+@if target-libitm
+maybe-clean-target-libitm: clean-target-libitm
+
+clean-target-libitm: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-distclean-target-libitm distclean-target-libitm
+maybe-distclean-target-libitm:
+@if target-libitm
+maybe-distclean-target-libitm: distclean-target-libitm
+
+distclean-target-libitm: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libitm
+
+.PHONY: maybe-maintainer-clean-target-libitm maintainer-clean-target-libitm
+maybe-maintainer-clean-target-libitm:
+@if target-libitm
+maybe-maintainer-clean-target-libitm: maintainer-clean-target-libitm
+
+maintainer-clean-target-libitm: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libitm/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libitm" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libitm && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libitm
+
+
+
+
+
+.PHONY: configure-target-libatomic maybe-configure-target-libatomic
+maybe-configure-target-libatomic:
+@if gcc-bootstrap
+configure-target-libatomic: stage_current
+@endif gcc-bootstrap
+@if target-libatomic
+maybe-configure-target-libatomic: configure-target-libatomic
+configure-target-libatomic: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Checking multilib configuration for libatomic..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libatomic ; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libatomic/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libatomic/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libatomic/multilib.tmp $(TARGET_SUBDIR)/libatomic/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libatomic/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libatomic/Makefile; \
+	    mv $(TARGET_SUBDIR)/libatomic/multilib.tmp $(TARGET_SUBDIR)/libatomic/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libatomic/multilib.tmp $(TARGET_SUBDIR)/libatomic/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libatomic/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libatomic ; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libatomic; \
+	cd "$(TARGET_SUBDIR)/libatomic" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libatomic/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libatomic"; \
+	libsrcdir="$$s/libatomic"; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif target-libatomic
+
+
+
+
+
+.PHONY: all-target-libatomic maybe-all-target-libatomic
+maybe-all-target-libatomic:
+@if gcc-bootstrap
+all-target-libatomic: stage_current
+@endif gcc-bootstrap
+@if target-libatomic
+TARGET-target-libatomic=all
+maybe-all-target-libatomic: all-target-libatomic
+all-target-libatomic: configure-target-libatomic
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)   \
+		$(TARGET-target-libatomic))
+@endif target-libatomic
+
+
+
+
+
+.PHONY: check-target-libatomic maybe-check-target-libatomic
+maybe-check-target-libatomic:
+@if target-libatomic
+maybe-check-target-libatomic: check-target-libatomic
+
+check-target-libatomic:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
+
+@endif target-libatomic
+
+.PHONY: install-target-libatomic maybe-install-target-libatomic
+maybe-install-target-libatomic:
+@if target-libatomic
+maybe-install-target-libatomic: install-target-libatomic
+
+install-target-libatomic: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libatomic
+
+.PHONY: install-strip-target-libatomic maybe-install-strip-target-libatomic
+maybe-install-strip-target-libatomic:
+@if target-libatomic
+maybe-install-strip-target-libatomic: install-strip-target-libatomic
+
+install-strip-target-libatomic: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+
+@endif target-libatomic
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libatomic info-target-libatomic
+maybe-info-target-libatomic:
+@if target-libatomic
+maybe-info-target-libatomic: info-target-libatomic
+
+info-target-libatomic: \
+    configure-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           info) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-dvi-target-libatomic dvi-target-libatomic
+maybe-dvi-target-libatomic:
+@if target-libatomic
+maybe-dvi-target-libatomic: dvi-target-libatomic
+
+dvi-target-libatomic: \
+    configure-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-pdf-target-libatomic pdf-target-libatomic
+maybe-pdf-target-libatomic:
+@if target-libatomic
+maybe-pdf-target-libatomic: pdf-target-libatomic
+
+pdf-target-libatomic: \
+    configure-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           pdf) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-html-target-libatomic html-target-libatomic
+maybe-html-target-libatomic:
+@if target-libatomic
+maybe-html-target-libatomic: html-target-libatomic
+
+html-target-libatomic: \
+    configure-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           html) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-TAGS-target-libatomic TAGS-target-libatomic
+maybe-TAGS-target-libatomic:
+@if target-libatomic
+maybe-TAGS-target-libatomic: TAGS-target-libatomic
+
+TAGS-target-libatomic: \
+    configure-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-install-info-target-libatomic install-info-target-libatomic
+maybe-install-info-target-libatomic:
+@if target-libatomic
+maybe-install-info-target-libatomic: install-info-target-libatomic
+
+install-info-target-libatomic: \
+    configure-target-libatomic \
+    info-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-install-pdf-target-libatomic install-pdf-target-libatomic
+maybe-install-pdf-target-libatomic:
+@if target-libatomic
+maybe-install-pdf-target-libatomic: install-pdf-target-libatomic
+
+install-pdf-target-libatomic: \
+    configure-target-libatomic \
+    pdf-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-pdf) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-install-html-target-libatomic install-html-target-libatomic
+maybe-install-html-target-libatomic:
+@if target-libatomic
+maybe-install-html-target-libatomic: install-html-target-libatomic
+
+install-html-target-libatomic: \
+    configure-target-libatomic \
+    html-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-html) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-installcheck-target-libatomic installcheck-target-libatomic
+maybe-installcheck-target-libatomic:
+@if target-libatomic
+maybe-installcheck-target-libatomic: installcheck-target-libatomic
+
+installcheck-target-libatomic: \
+    configure-target-libatomic 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-mostlyclean-target-libatomic mostlyclean-target-libatomic
+maybe-mostlyclean-target-libatomic:
+@if target-libatomic
+maybe-mostlyclean-target-libatomic: mostlyclean-target-libatomic
+
+mostlyclean-target-libatomic: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-clean-target-libatomic clean-target-libatomic
+maybe-clean-target-libatomic:
+@if target-libatomic
+maybe-clean-target-libatomic: clean-target-libatomic
+
+clean-target-libatomic: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-distclean-target-libatomic distclean-target-libatomic
+maybe-distclean-target-libatomic:
+@if target-libatomic
+maybe-distclean-target-libatomic: distclean-target-libatomic
+
+distclean-target-libatomic: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libatomic
+
+.PHONY: maybe-maintainer-clean-target-libatomic maintainer-clean-target-libatomic
+maybe-maintainer-clean-target-libatomic:
+@if target-libatomic
+maybe-maintainer-clean-target-libatomic: maintainer-clean-target-libatomic
+
+maintainer-clean-target-libatomic: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libatomic/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libatomic" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libatomic && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libatomic
+
+
+
+@if target-libgomp
+.PHONY: check-target-libgomp-c++
+check-target-libgomp-c++:
+	$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
+
+@endif target-libgomp
+
+@if target-libitm
+.PHONY: check-target-libitm-c++
+check-target-libitm-c++:
+	$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm
+
+@endif target-libitm
 
 # ----------
 # GCC module
@@ -40190,8 +44286,8 @@
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
-	(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++ check-c++0x);
-check-c++: check-gcc-c++ check-target-libstdc++-v3 check-target-libmudflap-c++
+	(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++);
+check-c++: check-gcc-c++ check-target-libstdc++-v3 check-target-libitm-c++ check-target-libgomp-c++
 
 .PHONY: check-gcc-fortran check-fortran
 check-gcc-fortran:
@@ -40242,25 +44338,16 @@
 check-go: check-gcc-go check-target-libgo
 
 
-# Install the gcc headers files, but not the fixed include files,
-# which Cygnus is not allowed to distribute.  This rule is very
-# dependent on the workings of the gcc Makefile.in.
-.PHONY: gcc-no-fixedincludes
-gcc-no-fixedincludes:
+# The gcc part of install-no-fixedincludes, which relies on an intimate
+# knowledge of how a number of gcc internal targets (inter)operate.  Delegate.
+.PHONY: gcc-install-no-fixedincludes
+gcc-install-no-fixedincludes:
 	@if [ -f ./gcc/Makefile ]; then \
-	  rm -rf gcc/tmp-include; \
-	  mv gcc/include gcc/tmp-include 2>/dev/null; \
-	  mkdir gcc/include; \
-	  cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
-	  touch gcc/stmp-fixinc gcc/include/fixed; \
-	  rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
 	  r=`${PWD_COMMAND}`; export r; \
-	  s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
+	  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	  $(HOST_EXPORTS) \
-	  (cd ./gcc && \
-	   $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
-	  rm -rf gcc/include; \
-	  mv gcc/tmp-include gcc/include 2>/dev/null; \
+	  (cd ./gcc \
+	   && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
 	else true; fi
 @endif gcc
 
@@ -40362,11 +44449,11 @@
 	  mkdir stage1-mpc; \
 	mv stage1-mpc mpc 
 @endif mpc
-@if ppl
-	@cd $(HOST_SUBDIR); [ -d stage1-ppl ] || \
-	  mkdir stage1-ppl; \
-	mv stage1-ppl ppl 
-@endif ppl
+@if isl
+	@cd $(HOST_SUBDIR); [ -d stage1-isl ] || \
+	  mkdir stage1-isl; \
+	mv stage1-isl isl 
+@endif isl
 @if cloog
 	@cd $(HOST_SUBDIR); [ -d stage1-cloog ] || \
 	  mkdir stage1-cloog; \
@@ -40392,6 +44479,11 @@
 	  mkdir stage1-ld; \
 	mv stage1-ld ld 
 @endif ld
+@if libbacktrace
+	@cd $(HOST_SUBDIR); [ -d stage1-libbacktrace ] || \
+	  mkdir stage1-libbacktrace; \
+	mv stage1-libbacktrace libbacktrace 
+@endif libbacktrace
 @if libcpp
 	@cd $(HOST_SUBDIR); [ -d stage1-libcpp ] || \
 	  mkdir stage1-libcpp; \
@@ -40462,11 +44554,11 @@
 	  cd $(HOST_SUBDIR); mv mpc stage1-mpc  ; \
 	fi
 @endif mpc
-@if ppl
-	@if test -d $(HOST_SUBDIR)/ppl ; then \
-	  cd $(HOST_SUBDIR); mv ppl stage1-ppl  ; \
+@if isl
+	@if test -d $(HOST_SUBDIR)/isl ; then \
+	  cd $(HOST_SUBDIR); mv isl stage1-isl  ; \
 	fi
-@endif ppl
+@endif isl
 @if cloog
 	@if test -d $(HOST_SUBDIR)/cloog ; then \
 	  cd $(HOST_SUBDIR); mv cloog stage1-cloog  ; \
@@ -40492,6 +44584,11 @@
 	  cd $(HOST_SUBDIR); mv ld stage1-ld  ; \
 	fi
 @endif ld
+@if libbacktrace
+	@if test -d $(HOST_SUBDIR)/libbacktrace ; then \
+	  cd $(HOST_SUBDIR); mv libbacktrace stage1-libbacktrace  ; \
+	fi
+@endif libbacktrace
 @if libcpp
 	@if test -d $(HOST_SUBDIR)/libcpp ; then \
 	  cd $(HOST_SUBDIR); mv libcpp stage1-libcpp  ; \
@@ -40613,12 +44710,12 @@
 	mv stage2-mpc mpc  ; \
 	mv stage1-mpc prev-mpc || test -f stage1-lean 
 @endif mpc
-@if ppl
-	@cd $(HOST_SUBDIR); [ -d stage2-ppl ] || \
-	  mkdir stage2-ppl; \
-	mv stage2-ppl ppl  ; \
-	mv stage1-ppl prev-ppl || test -f stage1-lean 
-@endif ppl
+@if isl
+	@cd $(HOST_SUBDIR); [ -d stage2-isl ] || \
+	  mkdir stage2-isl; \
+	mv stage2-isl isl  ; \
+	mv stage1-isl prev-isl || test -f stage1-lean 
+@endif isl
 @if cloog
 	@cd $(HOST_SUBDIR); [ -d stage2-cloog ] || \
 	  mkdir stage2-cloog; \
@@ -40649,6 +44746,12 @@
 	mv stage2-ld ld  ; \
 	mv stage1-ld prev-ld || test -f stage1-lean 
 @endif ld
+@if libbacktrace
+	@cd $(HOST_SUBDIR); [ -d stage2-libbacktrace ] || \
+	  mkdir stage2-libbacktrace; \
+	mv stage2-libbacktrace libbacktrace  ; \
+	mv stage1-libbacktrace prev-libbacktrace || test -f stage1-lean 
+@endif libbacktrace
 @if libcpp
 	@cd $(HOST_SUBDIR); [ -d stage2-libcpp ] || \
 	  mkdir stage2-libcpp; \
@@ -40733,12 +44836,12 @@
 	  mv prev-mpc stage1-mpc ; :  ; \
 	fi
 @endif mpc
-@if ppl
-	@if test -d $(HOST_SUBDIR)/ppl ; then \
-	  cd $(HOST_SUBDIR); mv ppl stage2-ppl ; \
-	  mv prev-ppl stage1-ppl ; :  ; \
+@if isl
+	@if test -d $(HOST_SUBDIR)/isl ; then \
+	  cd $(HOST_SUBDIR); mv isl stage2-isl ; \
+	  mv prev-isl stage1-isl ; :  ; \
 	fi
-@endif ppl
+@endif isl
 @if cloog
 	@if test -d $(HOST_SUBDIR)/cloog ; then \
 	  cd $(HOST_SUBDIR); mv cloog stage2-cloog ; \
@@ -40769,6 +44872,12 @@
 	  mv prev-ld stage1-ld ; :  ; \
 	fi
 @endif ld
+@if libbacktrace
+	@if test -d $(HOST_SUBDIR)/libbacktrace ; then \
+	  cd $(HOST_SUBDIR); mv libbacktrace stage2-libbacktrace ; \
+	  mv prev-libbacktrace stage1-libbacktrace ; :  ; \
+	fi
+@endif libbacktrace
 @if libcpp
 	@if test -d $(HOST_SUBDIR)/libcpp ; then \
 	  cd $(HOST_SUBDIR); mv libcpp stage2-libcpp ; \
@@ -40919,12 +45028,12 @@
 	mv stage3-mpc mpc  ; \
 	mv stage2-mpc prev-mpc || test -f stage2-lean 
 @endif mpc
-@if ppl
-	@cd $(HOST_SUBDIR); [ -d stage3-ppl ] || \
-	  mkdir stage3-ppl; \
-	mv stage3-ppl ppl  ; \
-	mv stage2-ppl prev-ppl || test -f stage2-lean 
-@endif ppl
+@if isl
+	@cd $(HOST_SUBDIR); [ -d stage3-isl ] || \
+	  mkdir stage3-isl; \
+	mv stage3-isl isl  ; \
+	mv stage2-isl prev-isl || test -f stage2-lean 
+@endif isl
 @if cloog
 	@cd $(HOST_SUBDIR); [ -d stage3-cloog ] || \
 	  mkdir stage3-cloog; \
@@ -40955,6 +45064,12 @@
 	mv stage3-ld ld  ; \
 	mv stage2-ld prev-ld || test -f stage2-lean 
 @endif ld
+@if libbacktrace
+	@cd $(HOST_SUBDIR); [ -d stage3-libbacktrace ] || \
+	  mkdir stage3-libbacktrace; \
+	mv stage3-libbacktrace libbacktrace  ; \
+	mv stage2-libbacktrace prev-libbacktrace || test -f stage2-lean 
+@endif libbacktrace
 @if libcpp
 	@cd $(HOST_SUBDIR); [ -d stage3-libcpp ] || \
 	  mkdir stage3-libcpp; \
@@ -41039,12 +45154,12 @@
 	  mv prev-mpc stage2-mpc ; :  ; \
 	fi
 @endif mpc
-@if ppl
-	@if test -d $(HOST_SUBDIR)/ppl ; then \
-	  cd $(HOST_SUBDIR); mv ppl stage3-ppl ; \
-	  mv prev-ppl stage2-ppl ; :  ; \
+@if isl
+	@if test -d $(HOST_SUBDIR)/isl ; then \
+	  cd $(HOST_SUBDIR); mv isl stage3-isl ; \
+	  mv prev-isl stage2-isl ; :  ; \
 	fi
-@endif ppl
+@endif isl
 @if cloog
 	@if test -d $(HOST_SUBDIR)/cloog ; then \
 	  cd $(HOST_SUBDIR); mv cloog stage3-cloog ; \
@@ -41075,6 +45190,12 @@
 	  mv prev-ld stage2-ld ; :  ; \
 	fi
 @endif ld
+@if libbacktrace
+	@if test -d $(HOST_SUBDIR)/libbacktrace ; then \
+	  cd $(HOST_SUBDIR); mv libbacktrace stage3-libbacktrace ; \
+	  mv prev-libbacktrace stage2-libbacktrace ; :  ; \
+	fi
+@endif libbacktrace
 @if libcpp
 	@if test -d $(HOST_SUBDIR)/libcpp ; then \
 	  cd $(HOST_SUBDIR); mv libcpp stage3-libcpp ; \
@@ -41281,12 +45402,12 @@
 	mv stage4-mpc mpc  ; \
 	mv stage3-mpc prev-mpc || test -f stage3-lean 
 @endif mpc
-@if ppl
-	@cd $(HOST_SUBDIR); [ -d stage4-ppl ] || \
-	  mkdir stage4-ppl; \
-	mv stage4-ppl ppl  ; \
-	mv stage3-ppl prev-ppl || test -f stage3-lean 
-@endif ppl
+@if isl
+	@cd $(HOST_SUBDIR); [ -d stage4-isl ] || \
+	  mkdir stage4-isl; \
+	mv stage4-isl isl  ; \
+	mv stage3-isl prev-isl || test -f stage3-lean 
+@endif isl
 @if cloog
 	@cd $(HOST_SUBDIR); [ -d stage4-cloog ] || \
 	  mkdir stage4-cloog; \
@@ -41317,6 +45438,12 @@
 	mv stage4-ld ld  ; \
 	mv stage3-ld prev-ld || test -f stage3-lean 
 @endif ld
+@if libbacktrace
+	@cd $(HOST_SUBDIR); [ -d stage4-libbacktrace ] || \
+	  mkdir stage4-libbacktrace; \
+	mv stage4-libbacktrace libbacktrace  ; \
+	mv stage3-libbacktrace prev-libbacktrace || test -f stage3-lean 
+@endif libbacktrace
 @if libcpp
 	@cd $(HOST_SUBDIR); [ -d stage4-libcpp ] || \
 	  mkdir stage4-libcpp; \
@@ -41401,12 +45528,12 @@
 	  mv prev-mpc stage3-mpc ; :  ; \
 	fi
 @endif mpc
-@if ppl
-	@if test -d $(HOST_SUBDIR)/ppl ; then \
-	  cd $(HOST_SUBDIR); mv ppl stage4-ppl ; \
-	  mv prev-ppl stage3-ppl ; :  ; \
+@if isl
+	@if test -d $(HOST_SUBDIR)/isl ; then \
+	  cd $(HOST_SUBDIR); mv isl stage4-isl ; \
+	  mv prev-isl stage3-isl ; :  ; \
 	fi
-@endif ppl
+@endif isl
 @if cloog
 	@if test -d $(HOST_SUBDIR)/cloog ; then \
 	  cd $(HOST_SUBDIR); mv cloog stage4-cloog ; \
@@ -41437,6 +45564,12 @@
 	  mv prev-ld stage3-ld ; :  ; \
 	fi
 @endif ld
+@if libbacktrace
+	@if test -d $(HOST_SUBDIR)/libbacktrace ; then \
+	  cd $(HOST_SUBDIR); mv libbacktrace stage4-libbacktrace ; \
+	  mv prev-libbacktrace stage3-libbacktrace ; :  ; \
+	fi
+@endif libbacktrace
 @if libcpp
 	@if test -d $(HOST_SUBDIR)/libcpp ; then \
 	  cd $(HOST_SUBDIR); mv libcpp stage4-libcpp ; \
@@ -41631,12 +45764,12 @@
 	mv stageprofile-mpc mpc  ; \
 	mv stage1-mpc prev-mpc || test -f stage1-lean 
 @endif mpc
-@if ppl
-	@cd $(HOST_SUBDIR); [ -d stageprofile-ppl ] || \
-	  mkdir stageprofile-ppl; \
-	mv stageprofile-ppl ppl  ; \
-	mv stage1-ppl prev-ppl || test -f stage1-lean 
-@endif ppl
+@if isl
+	@cd $(HOST_SUBDIR); [ -d stageprofile-isl ] || \
+	  mkdir stageprofile-isl; \
+	mv stageprofile-isl isl  ; \
+	mv stage1-isl prev-isl || test -f stage1-lean 
+@endif isl
 @if cloog
 	@cd $(HOST_SUBDIR); [ -d stageprofile-cloog ] || \
 	  mkdir stageprofile-cloog; \
@@ -41667,6 +45800,12 @@
 	mv stageprofile-ld ld  ; \
 	mv stage1-ld prev-ld || test -f stage1-lean 
 @endif ld
+@if libbacktrace
+	@cd $(HOST_SUBDIR); [ -d stageprofile-libbacktrace ] || \
+	  mkdir stageprofile-libbacktrace; \
+	mv stageprofile-libbacktrace libbacktrace  ; \
+	mv stage1-libbacktrace prev-libbacktrace || test -f stage1-lean 
+@endif libbacktrace
 @if libcpp
 	@cd $(HOST_SUBDIR); [ -d stageprofile-libcpp ] || \
 	  mkdir stageprofile-libcpp; \
@@ -41751,12 +45890,12 @@
 	  mv prev-mpc stage1-mpc ; :  ; \
 	fi
 @endif mpc
-@if ppl
-	@if test -d $(HOST_SUBDIR)/ppl ; then \
-	  cd $(HOST_SUBDIR); mv ppl stageprofile-ppl ; \
-	  mv prev-ppl stage1-ppl ; :  ; \
+@if isl
+	@if test -d $(HOST_SUBDIR)/isl ; then \
+	  cd $(HOST_SUBDIR); mv isl stageprofile-isl ; \
+	  mv prev-isl stage1-isl ; :  ; \
 	fi
-@endif ppl
+@endif isl
 @if cloog
 	@if test -d $(HOST_SUBDIR)/cloog ; then \
 	  cd $(HOST_SUBDIR); mv cloog stageprofile-cloog ; \
@@ -41787,6 +45926,12 @@
 	  mv prev-ld stage1-ld ; :  ; \
 	fi
 @endif ld
+@if libbacktrace
+	@if test -d $(HOST_SUBDIR)/libbacktrace ; then \
+	  cd $(HOST_SUBDIR); mv libbacktrace stageprofile-libbacktrace ; \
+	  mv prev-libbacktrace stage1-libbacktrace ; :  ; \
+	fi
+@endif libbacktrace
 @if libcpp
 	@if test -d $(HOST_SUBDIR)/libcpp ; then \
 	  cd $(HOST_SUBDIR); mv libcpp stageprofile-libcpp ; \
@@ -41914,12 +46059,12 @@
 	mv stagefeedback-mpc mpc  ; \
 	mv stageprofile-mpc prev-mpc || test -f stageprofile-lean 
 @endif mpc
-@if ppl
-	@cd $(HOST_SUBDIR); [ -d stagefeedback-ppl ] || \
-	  mkdir stagefeedback-ppl; \
-	mv stagefeedback-ppl ppl  ; \
-	mv stageprofile-ppl prev-ppl || test -f stageprofile-lean 
-@endif ppl
+@if isl
+	@cd $(HOST_SUBDIR); [ -d stagefeedback-isl ] || \
+	  mkdir stagefeedback-isl; \
+	mv stagefeedback-isl isl  ; \
+	mv stageprofile-isl prev-isl || test -f stageprofile-lean 
+@endif isl
 @if cloog
 	@cd $(HOST_SUBDIR); [ -d stagefeedback-cloog ] || \
 	  mkdir stagefeedback-cloog; \
@@ -41950,6 +46095,12 @@
 	mv stagefeedback-ld ld  ; \
 	mv stageprofile-ld prev-ld || test -f stageprofile-lean 
 @endif ld
+@if libbacktrace
+	@cd $(HOST_SUBDIR); [ -d stagefeedback-libbacktrace ] || \
+	  mkdir stagefeedback-libbacktrace; \
+	mv stagefeedback-libbacktrace libbacktrace  ; \
+	mv stageprofile-libbacktrace prev-libbacktrace || test -f stageprofile-lean 
+@endif libbacktrace
 @if libcpp
 	@cd $(HOST_SUBDIR); [ -d stagefeedback-libcpp ] || \
 	  mkdir stagefeedback-libcpp; \
@@ -42034,12 +46185,12 @@
 	  mv prev-mpc stageprofile-mpc ; :  ; \
 	fi
 @endif mpc
-@if ppl
-	@if test -d $(HOST_SUBDIR)/ppl ; then \
-	  cd $(HOST_SUBDIR); mv ppl stagefeedback-ppl ; \
-	  mv prev-ppl stageprofile-ppl ; :  ; \
+@if isl
+	@if test -d $(HOST_SUBDIR)/isl ; then \
+	  cd $(HOST_SUBDIR); mv isl stagefeedback-isl ; \
+	  mv prev-isl stageprofile-isl ; :  ; \
 	fi
-@endif ppl
+@endif isl
 @if cloog
 	@if test -d $(HOST_SUBDIR)/cloog ; then \
 	  cd $(HOST_SUBDIR); mv cloog stagefeedback-cloog ; \
@@ -42070,6 +46221,12 @@
 	  mv prev-ld stageprofile-ld ; :  ; \
 	fi
 @endif ld
+@if libbacktrace
+	@if test -d $(HOST_SUBDIR)/libbacktrace ; then \
+	  cd $(HOST_SUBDIR); mv libbacktrace stagefeedback-libbacktrace ; \
+	  mv prev-libbacktrace stageprofile-libbacktrace ; :  ; \
+	fi
+@endif libbacktrace
 @if libcpp
 	@if test -d $(HOST_SUBDIR)/libcpp ; then \
 	  cd $(HOST_SUBDIR); mv libcpp stagefeedback-libcpp ; \
@@ -42213,7 +46370,19 @@
 configure-stage4-target-libstdc++-v3: maybe-all-stage4-gcc
 configure-stageprofile-target-libstdc++-v3: maybe-all-stageprofile-gcc
 configure-stagefeedback-target-libstdc++-v3: maybe-all-stagefeedback-gcc
-configure-target-libmudflap: stage_last
+configure-stage1-target-libsanitizer: maybe-all-stage1-gcc
+configure-stage2-target-libsanitizer: maybe-all-stage2-gcc
+configure-stage3-target-libsanitizer: maybe-all-stage3-gcc
+configure-stage4-target-libsanitizer: maybe-all-stage4-gcc
+configure-stageprofile-target-libsanitizer: maybe-all-stageprofile-gcc
+configure-stagefeedback-target-libsanitizer: maybe-all-stagefeedback-gcc
+configure-stage1-target-libvtv: maybe-all-stage1-gcc
+configure-stage2-target-libvtv: maybe-all-stage2-gcc
+configure-stage3-target-libvtv: maybe-all-stage3-gcc
+configure-stage4-target-libvtv: maybe-all-stage4-gcc
+configure-stageprofile-target-libvtv: maybe-all-stageprofile-gcc
+configure-stagefeedback-target-libvtv: maybe-all-stagefeedback-gcc
+configure-target-libcilkrts: stage_last
 configure-target-libssp: stage_last
 configure-target-newlib: stage_last
 configure-stage1-target-libgcc: maybe-all-stage1-gcc
@@ -42222,6 +46391,7 @@
 configure-stage4-target-libgcc: maybe-all-stage4-gcc
 configure-stageprofile-target-libgcc: maybe-all-stageprofile-gcc
 configure-stagefeedback-target-libgcc: maybe-all-stagefeedback-gcc
+configure-target-libbacktrace: stage_last
 configure-target-libquadmath: stage_last
 configure-target-libgfortran: stage_last
 configure-target-libobjc: stage_last
@@ -42241,14 +46411,19 @@
 configure-stage4-target-libgomp: maybe-all-stage4-gcc
 configure-stageprofile-target-libgomp: maybe-all-stageprofile-gcc
 configure-stagefeedback-target-libgomp: maybe-all-stagefeedback-gcc
+configure-target-libitm: stage_last
+configure-target-libatomic: stage_last
 @endif gcc-bootstrap
 
 @if gcc-no-bootstrap
 configure-target-libstdc++-v3: maybe-all-gcc
-configure-target-libmudflap: maybe-all-gcc
+configure-target-libsanitizer: maybe-all-gcc
+configure-target-libvtv: maybe-all-gcc
+configure-target-libcilkrts: maybe-all-gcc
 configure-target-libssp: maybe-all-gcc
 configure-target-newlib: maybe-all-gcc
 configure-target-libgcc: maybe-all-gcc
+configure-target-libbacktrace: maybe-all-gcc
 configure-target-libquadmath: maybe-all-gcc
 configure-target-libgfortran: maybe-all-gcc
 configure-target-libobjc: maybe-all-gcc
@@ -42263,6 +46438,8 @@
 configure-target-rda: maybe-all-gcc
 configure-target-libada: maybe-all-gcc
 configure-target-libgomp: maybe-all-gcc
+configure-target-libitm: maybe-all-gcc
+configure-target-libatomic: maybe-all-gcc
 @endif gcc-no-bootstrap
 
 
@@ -42298,6 +46475,14 @@
 configure-stage4-gcc: maybe-configure-stage4-intl
 configure-stageprofile-gcc: maybe-configure-stageprofile-intl
 configure-stagefeedback-gcc: maybe-configure-stagefeedback-intl
+configure-gcc: maybe-all-gmp
+
+configure-stage1-gcc: maybe-all-stage1-gmp
+configure-stage2-gcc: maybe-all-stage2-gmp
+configure-stage3-gcc: maybe-all-stage3-gmp
+configure-stage4-gcc: maybe-all-stage4-gmp
+configure-stageprofile-gcc: maybe-all-stageprofile-gmp
+configure-stagefeedback-gcc: maybe-all-stagefeedback-gmp
 configure-gcc: maybe-all-lto-plugin
 
 configure-stage1-gcc: maybe-all-stage1-lto-plugin
@@ -42354,14 +46539,6 @@
 all-stage4-gcc: all-stage4-libiberty
 all-stageprofile-gcc: all-stageprofile-libiberty
 all-stagefeedback-gcc: all-stagefeedback-libiberty
-all-gcc: maybe-all-gmp
-
-all-stage1-gcc: maybe-all-stage1-gmp
-all-stage2-gcc: maybe-all-stage2-gmp
-all-stage3-gcc: maybe-all-stage3-gmp
-all-stage4-gcc: maybe-all-stage4-gmp
-all-stageprofile-gcc: maybe-all-stageprofile-gmp
-all-stagefeedback-gcc: maybe-all-stagefeedback-gmp
 all-gcc: maybe-all-intl
 
 all-stage1-gcc: maybe-all-stage1-intl
@@ -42386,14 +46563,6 @@
 all-stage4-gcc: maybe-all-stage4-mpc
 all-stageprofile-gcc: maybe-all-stageprofile-mpc
 all-stagefeedback-gcc: maybe-all-stagefeedback-mpc
-all-gcc: maybe-all-ppl
-
-all-stage1-gcc: maybe-all-stage1-ppl
-all-stage2-gcc: maybe-all-stage2-ppl
-all-stage3-gcc: maybe-all-stage3-ppl
-all-stage4-gcc: maybe-all-stage4-ppl
-all-stageprofile-gcc: maybe-all-stageprofile-ppl
-all-stagefeedback-gcc: maybe-all-stagefeedback-ppl
 all-gcc: maybe-all-cloog
 
 all-stage1-gcc: maybe-all-stage1-cloog
@@ -42450,6 +46619,14 @@
 all-stage4-gcc: maybe-all-stage4-zlib
 all-stageprofile-gcc: maybe-all-stageprofile-zlib
 all-stagefeedback-gcc: maybe-all-stagefeedback-zlib
+all-gcc: all-libbacktrace
+
+all-stage1-gcc: all-stage1-libbacktrace
+all-stage2-gcc: all-stage2-libbacktrace
+all-stage3-gcc: all-stage3-libbacktrace
+all-stage4-gcc: all-stage4-libbacktrace
+all-stageprofile-gcc: all-stageprofile-libbacktrace
+all-stagefeedback-gcc: all-stagefeedback-libbacktrace
 all-gcc: all-libcpp
 
 all-stage1-gcc: all-stage1-libcpp
@@ -42518,6 +46695,7 @@
 install-gcc: maybe-install-fixincludes
 install-gcc: maybe-install-lto-plugin
 install-strip-gcc: maybe-install-strip-fixincludes
+install-strip-gcc: maybe-install-strip-lto-plugin
 configure-libcpp: configure-libiberty
 
 configure-stage1-libcpp: configure-stage1-libiberty
@@ -42577,30 +46755,30 @@
 configure-stage4-mpc: maybe-all-stage4-mpfr
 configure-stageprofile-mpc: maybe-all-stageprofile-mpfr
 configure-stagefeedback-mpc: maybe-all-stagefeedback-mpfr
-configure-ppl: maybe-all-gmp
+configure-isl: maybe-all-gmp
 
-configure-stage1-ppl: maybe-all-stage1-gmp
-configure-stage2-ppl: maybe-all-stage2-gmp
-configure-stage3-ppl: maybe-all-stage3-gmp
-configure-stage4-ppl: maybe-all-stage4-gmp
-configure-stageprofile-ppl: maybe-all-stageprofile-gmp
-configure-stagefeedback-ppl: maybe-all-stagefeedback-gmp
-configure-ppl: maybe-all-mpfr
+configure-stage1-isl: maybe-all-stage1-gmp
+configure-stage2-isl: maybe-all-stage2-gmp
+configure-stage3-isl: maybe-all-stage3-gmp
+configure-stage4-isl: maybe-all-stage4-gmp
+configure-stageprofile-isl: maybe-all-stageprofile-gmp
+configure-stagefeedback-isl: maybe-all-stagefeedback-gmp
+configure-cloog: maybe-all-isl
 
-configure-stage1-ppl: maybe-all-stage1-mpfr
-configure-stage2-ppl: maybe-all-stage2-mpfr
-configure-stage3-ppl: maybe-all-stage3-mpfr
-configure-stage4-ppl: maybe-all-stage4-mpfr
-configure-stageprofile-ppl: maybe-all-stageprofile-mpfr
-configure-stagefeedback-ppl: maybe-all-stagefeedback-mpfr
-configure-cloog: maybe-all-ppl
+configure-stage1-cloog: maybe-all-stage1-isl
+configure-stage2-cloog: maybe-all-stage2-isl
+configure-stage3-cloog: maybe-all-stage3-isl
+configure-stage4-cloog: maybe-all-stage4-isl
+configure-stageprofile-cloog: maybe-all-stageprofile-isl
+configure-stagefeedback-cloog: maybe-all-stagefeedback-isl
+configure-cloog: maybe-all-gmp
 
-configure-stage1-cloog: maybe-all-stage1-ppl
-configure-stage2-cloog: maybe-all-stage2-ppl
-configure-stage3-cloog: maybe-all-stage3-ppl
-configure-stage4-cloog: maybe-all-stage4-ppl
-configure-stageprofile-cloog: maybe-all-stageprofile-ppl
-configure-stagefeedback-cloog: maybe-all-stagefeedback-ppl
+configure-stage1-cloog: maybe-all-stage1-gmp
+configure-stage2-cloog: maybe-all-stage2-gmp
+configure-stage3-cloog: maybe-all-stage3-gmp
+configure-stage4-cloog: maybe-all-stage4-gmp
+configure-stageprofile-cloog: maybe-all-stageprofile-gmp
+configure-stagefeedback-cloog: maybe-all-stagefeedback-gmp
 configure-gdb: maybe-all-intl
 configure-gdb: maybe-configure-sim
 configure-gdb: maybe-all-bfd
@@ -42722,6 +46900,14 @@
 all-stage4-binutils: maybe-all-stage4-intl
 all-stageprofile-binutils: maybe-all-stageprofile-intl
 all-stagefeedback-binutils: maybe-all-stagefeedback-intl
+all-binutils: maybe-all-gas
+
+all-stage1-binutils: maybe-all-stage1-gas
+all-stage2-binutils: maybe-all-stage2-gas
+all-stage3-binutils: maybe-all-stage3-gas
+all-stage4-binutils: maybe-all-stage4-gas
+all-stageprofile-binutils: maybe-all-stageprofile-gas
+all-stagefeedback-binutils: maybe-all-stagefeedback-gas
 install-binutils: maybe-install-opcodes
 install-strip-binutils: maybe-install-strip-opcodes
 install-opcodes: maybe-install-bfd
@@ -42771,6 +46957,7 @@
 all-gprof: maybe-all-bfd
 all-gprof: maybe-all-opcodes
 all-gprof: maybe-all-intl
+all-gprof: maybe-all-gas
 configure-ld: maybe-configure-intl
 
 configure-stage1-ld: maybe-configure-stage1-intl
@@ -42827,6 +47014,14 @@
 all-stage4-ld: maybe-all-stage4-intl
 all-stageprofile-ld: maybe-all-stageprofile-intl
 all-stagefeedback-ld: maybe-all-stagefeedback-intl
+all-ld: maybe-all-gas
+
+all-stage1-ld: maybe-all-stage1-gas
+all-stage2-ld: maybe-all-stage2-gas
+all-stage3-ld: maybe-all-stage3-gas
+all-stage4-ld: maybe-all-stage4-gas
+all-stageprofile-ld: maybe-all-stageprofile-gas
+all-stagefeedback-ld: maybe-all-stagefeedback-gas
 install-ld: maybe-install-gold
 install-strip-ld: maybe-install-strip-gold
 configure-gold: maybe-configure-intl
@@ -42869,6 +47064,14 @@
 all-stage4-gold: maybe-all-build-bison
 all-stageprofile-gold: maybe-all-build-bison
 all-stagefeedback-gold: maybe-all-build-bison
+all-gold: maybe-all-gas
+
+all-stage1-gold: maybe-all-stage1-gas
+all-stage2-gold: maybe-all-stage2-gas
+all-stage3-gold: maybe-all-stage3-gas
+all-stage4-gold: maybe-all-stage4-gas
+all-stageprofile-gold: maybe-all-stageprofile-gas
+all-stagefeedback-gold: maybe-all-stagefeedback-gas
 check-gold: maybe-all-binutils
 
 check-stage1-gold: maybe-all-stage1-binutils
@@ -42964,7 +47167,9 @@
 all-target-fastjar: maybe-all-target-zlib
 configure-target-libgo: maybe-configure-target-libffi
 configure-target-libgo: maybe-all-target-libstdc++-v3
+all-target-libgo: maybe-all-target-libbacktrace
 all-target-libgo: maybe-all-target-libffi
+all-target-libgo: maybe-all-target-libatomic
 configure-target-libjava: maybe-configure-target-zlib
 configure-target-libjava: maybe-configure-target-boehm-gc
 configure-target-libjava: maybe-configure-target-libffi
@@ -42982,6 +47187,22 @@
 configure-stage4-target-libstdc++-v3: maybe-configure-stage4-target-libgomp
 configure-stageprofile-target-libstdc++-v3: maybe-configure-stageprofile-target-libgomp
 configure-stagefeedback-target-libstdc++-v3: maybe-configure-stagefeedback-target-libgomp
+configure-target-libsanitizer: maybe-all-target-libstdc++-v3
+
+configure-stage1-target-libsanitizer: maybe-all-stage1-target-libstdc++-v3
+configure-stage2-target-libsanitizer: maybe-all-stage2-target-libstdc++-v3
+configure-stage3-target-libsanitizer: maybe-all-stage3-target-libstdc++-v3
+configure-stage4-target-libsanitizer: maybe-all-stage4-target-libstdc++-v3
+configure-stageprofile-target-libsanitizer: maybe-all-stageprofile-target-libstdc++-v3
+configure-stagefeedback-target-libsanitizer: maybe-all-stagefeedback-target-libstdc++-v3
+configure-target-libvtv: maybe-all-target-libstdc++-v3
+
+configure-stage1-target-libvtv: maybe-all-stage1-target-libstdc++-v3
+configure-stage2-target-libvtv: maybe-all-stage2-target-libstdc++-v3
+configure-stage3-target-libvtv: maybe-all-stage3-target-libstdc++-v3
+configure-stage4-target-libvtv: maybe-all-stage4-target-libstdc++-v3
+configure-stageprofile-target-libvtv: maybe-all-stageprofile-target-libstdc++-v3
+configure-stagefeedback-target-libvtv: maybe-all-stagefeedback-target-libstdc++-v3
 all-target-libstdc++-v3: maybe-configure-target-libgomp
 
 all-stage1-target-libstdc++-v3: maybe-configure-stage1-target-libgomp
@@ -42990,6 +47211,19 @@
 all-stage4-target-libstdc++-v3: maybe-configure-stage4-target-libgomp
 all-stageprofile-target-libstdc++-v3: maybe-configure-stageprofile-target-libgomp
 all-stagefeedback-target-libstdc++-v3: maybe-configure-stagefeedback-target-libgomp
+install-target-libgo: maybe-install-target-libatomic
+install-target-libgfortran: maybe-install-target-libquadmath
+install-target-libgfortran: maybe-install-target-libgcc
+install-target-libsanitizer: maybe-install-target-libstdc++-v3
+install-target-libsanitizer: maybe-install-target-libgcc
+install-target-libvtv: maybe-install-target-libstdc++-v3
+install-target-libvtv: maybe-install-target-libgcc
+install-target-libcilkrts: maybe-install-target-libstdc++-v3
+install-target-libcilkrts: maybe-install-target-libgcc
+install-target-libjava: maybe-install-target-libgcc
+install-target-libitm: maybe-install-target-libgcc
+install-target-libobjc: maybe-install-target-libgcc
+install-target-libstdc++-v3: maybe-install-target-libgcc
 all-target-libgloss: maybe-all-target-newlib
 all-target-winsup: maybe-all-target-libtermcap
 configure-target-newlib: maybe-all-binutils
@@ -43009,6 +47243,18 @@
 configure-stage4-target-libstdc++-v3: maybe-all-stage4-target-libgcc
 configure-stageprofile-target-libstdc++-v3: maybe-all-stageprofile-target-libgcc
 configure-stagefeedback-target-libstdc++-v3: maybe-all-stagefeedback-target-libgcc
+configure-stage1-target-libsanitizer: maybe-all-stage1-target-libgcc
+configure-stage2-target-libsanitizer: maybe-all-stage2-target-libgcc
+configure-stage3-target-libsanitizer: maybe-all-stage3-target-libgcc
+configure-stage4-target-libsanitizer: maybe-all-stage4-target-libgcc
+configure-stageprofile-target-libsanitizer: maybe-all-stageprofile-target-libgcc
+configure-stagefeedback-target-libsanitizer: maybe-all-stagefeedback-target-libgcc
+configure-stage1-target-libvtv: maybe-all-stage1-target-libgcc
+configure-stage2-target-libvtv: maybe-all-stage2-target-libgcc
+configure-stage3-target-libvtv: maybe-all-stage3-target-libgcc
+configure-stage4-target-libvtv: maybe-all-stage4-target-libgcc
+configure-stageprofile-target-libvtv: maybe-all-stageprofile-target-libgcc
+configure-stagefeedback-target-libvtv: maybe-all-stagefeedback-target-libgcc
 configure-stage1-target-libgomp: maybe-all-stage1-target-libgcc
 configure-stage2-target-libgomp: maybe-all-stage2-target-libgcc
 configure-stage3-target-libgomp: maybe-all-stage3-target-libgcc
@@ -43019,9 +47265,12 @@
 
 @if gcc-no-bootstrap
 configure-target-libstdc++-v3: maybe-all-target-libgcc
-configure-target-libmudflap: maybe-all-target-libgcc
+configure-target-libsanitizer: maybe-all-target-libgcc
+configure-target-libvtv: maybe-all-target-libgcc
+configure-target-libcilkrts: maybe-all-target-libgcc
 configure-target-libssp: maybe-all-target-libgcc
 configure-target-newlib: maybe-all-target-libgcc
+configure-target-libbacktrace: maybe-all-target-libgcc
 configure-target-libquadmath: maybe-all-target-libgcc
 configure-target-libgfortran: maybe-all-target-libgcc
 configure-target-libobjc: maybe-all-target-libgcc
@@ -43036,17 +47285,26 @@
 configure-target-rda: maybe-all-target-libgcc
 configure-target-libada: maybe-all-target-libgcc
 configure-target-libgomp: maybe-all-target-libgcc
+configure-target-libitm: maybe-all-target-libgcc
+configure-target-libatomic: maybe-all-target-libgcc
 @endif gcc-no-bootstrap
 
 
 configure-target-libstdc++-v3: maybe-all-target-newlib maybe-all-target-libgloss
 
-configure-target-libmudflap: maybe-all-target-newlib maybe-all-target-libgloss
+configure-target-libsanitizer: maybe-all-target-newlib maybe-all-target-libgloss
+
+configure-target-libvtv: maybe-all-target-newlib maybe-all-target-libgloss
+
+configure-target-libcilkrts: maybe-all-target-newlib maybe-all-target-libgloss
+configure-target-libcilkrts: maybe-all-target-libstdc++-v3
 
 configure-target-libssp: maybe-all-target-newlib maybe-all-target-libgloss
 
 
 
+configure-target-libbacktrace: maybe-all-target-newlib maybe-all-target-libgloss
+
 configure-target-libquadmath: maybe-all-target-newlib maybe-all-target-libgloss
 
 configure-target-libgfortran: maybe-all-target-newlib maybe-all-target-libgloss
@@ -43075,6 +47333,11 @@
 
 configure-target-libgomp: maybe-all-target-newlib maybe-all-target-libgloss
 
+configure-target-libitm: maybe-all-target-newlib maybe-all-target-libgloss
+configure-target-libitm: maybe-all-target-libstdc++-v3
+
+configure-target-libatomic: maybe-all-target-newlib maybe-all-target-libgloss
+
 
 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
 GDB_TK = @GDB_TK@
diff --git a/Makefile.tpl b/Makefile.tpl
index ae263e6..92f3f61 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -169,7 +169,7 @@
 	WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
 
 # These variables must be set on the make command line for directories
-# built for the build system to override those in BASE_FLAGS_TO_PASSS.
+# built for the build system to override those in BASE_FLAGS_TO_PASS.
 EXTRA_BUILD_FLAGS = \
 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
@@ -222,8 +222,7 @@
 	HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
 	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
-	PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \
-	PPLINC="$(HOST_PPLINC)"; export PPLINC; \
+	ISLINC="$(HOST_ISLINC)"; export ISLINC; \
 	CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
 	CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
 	LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \
@@ -239,7 +238,7 @@
 @if target-libstdc++-v3-bootstrap
 # Override the above if we're bootstrapping C++.
 POSTSTAGE1_CXX_EXPORT = \
-	CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/g++$(exeext) \
+	CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \
 	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
 	  -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
 	  -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
@@ -313,9 +312,8 @@
 HOST_GMPLIBS = @gmplibs@
 HOST_GMPINC = @gmpinc@
 
-# Where to find PPL
-HOST_PPLLIBS = @ppllibs@
-HOST_PPLINC = @pplinc@
+# Where to find ISL
+HOST_ISLINC = @islinc@
 
 # Where to find CLOOG
 HOST_CLOOGLIBS = @clooglibs@
@@ -369,7 +367,7 @@
 # here so that they can be overridden by Makefile fragments.
 BOOT_CFLAGS= -g -O2
 BOOT_LDFLAGS=
-BOOT_ADAFLAGS=-gnatpg -gnata
+BOOT_ADAFLAGS= -gnatpg
 
 AWK = @AWK@
 SED = @SED@
@@ -425,7 +423,6 @@
 STAGE_CFLAGS = $(BOOT_CFLAGS)
 STAGE_TFLAGS = $(TFLAGS)
 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
-POSTSTAGE1_CONFIGURE_FLAGS = @POSTSTAGE1_CONFIGURE_FLAGS@
 
 [+ FOR bootstrap-stage +]
 # Defaults for stage [+id+]; some are overridden below.
@@ -436,10 +433,7 @@
 STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
 @endif target-libstdc++-v3-bootstrap
 STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
-# STAGE1_CONFIGURE_FLAGS overridden below, so we can use
-# POSTSTAGE1_CONFIGURE_FLAGS here.
-STAGE[+id+]_CONFIGURE_FLAGS = \
-	$(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS)
+STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 [+ ENDFOR bootstrap-stage +]
 
 # Only build the C compiler for stage1, because that is the only one that
@@ -457,11 +451,10 @@
 #   the last argument when conflicting --enable arguments are passed.
 # * Likewise, we force-disable coverage flags, since the installed
 #   compiler probably has never heard of them.
-# * Don't remove this, because above we added
-#   POSTSTAGE1_CONFIGURE_FLAGS to STAGE[+id+]_CONFIGURE_FLAGS, which
-#   we don't want for STAGE1_CONFIGURE_FLAGS.
+# * We also disable -Wformat, since older GCCs don't understand newer %s.
 STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
-	  --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)"
+	  --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
+	  --disable-build-format-warnings
 
 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
@@ -624,6 +617,12 @@
 
 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
 
+# Flags to pass to stage1 or when not bootstrapping.
+
+STAGE1_FLAGS_TO_PASS = \
+	LDFLAGS="$${LDFLAGS}" \
+	HOST_LIBS="$${HOST_LIBS}"
+
 # Flags to pass to stage2 and later makes.
 
 POSTSTAGE1_FLAGS_TO_PASS = \
@@ -906,11 +905,12 @@
 		true ; \
 	fi
 
-# install-no-fixedincludes is used because Cygnus can not distribute
-# the fixed header files.
+# install-no-fixedincludes is used to allow the elaboration of binary packages
+# suitable for distribution, where we cannot include the fixed system header
+# files.
 .PHONY: install-no-fixedincludes
 install-no-fixedincludes: installdirs install-host-nogcc \
-	install-target gcc-no-fixedincludes
+	install-target gcc-install-no-fixedincludes
 
 .PHONY: install-strip
 install-strip:
@@ -1084,7 +1084,7 @@
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	[+exports+] [+extra_exports+] \
 	(cd [+subdir+]/[+module+] && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
 		$(TARGET-[+prefix+][+module+]))
 @endif [+prefix+][+module+]
 
@@ -1117,9 +1117,8 @@
 		CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
 		CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
 		LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-		[+args+] [+
-		IF prev +][+poststage1_args+][+ ENDIF prev
-		+] [+extra_make_flags+] \
+		[+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
+		[+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
 		TFLAGS="$(STAGE[+id+]_TFLAGS)" \
 		$(TARGET-stage[+id+]-[+prefix+][+module+])
 
@@ -1133,9 +1132,8 @@
 	  $(MAKE) stage[+id+]-start; \
 	fi; \
 	cd [+subdir+]/[+module+] && \
-	$(MAKE) [+args+] [+ IF prev +] \
-		[+poststage1_args+] [+ ENDIF prev +] \
-		[+extra_make_flags+] clean
+	$(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
+	[+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
 @endif [+prefix+][+module+]-bootstrap
 
 [+ ENDFOR bootstrap_stage +]
@@ -1170,6 +1168,7 @@
        exports="$(HOST_EXPORTS)"
        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
        args="$(EXTRA_HOST_FLAGS)"
+       stage1_args="$(STAGE1_FLAGS_TO_PASS)"
        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
 
 .PHONY: check-[+module+] maybe-check-[+module+]
@@ -1407,12 +1406,19 @@
 [+ ENDFOR recursive_targets +]
 [+ ENDFOR target_modules +]
 
-@if target-libmudflap
-.PHONY: check-target-libmudflap-c++
-check-target-libmudflap-c++:
-	$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++frags.exp" check-target-libmudflap
+@if target-libgomp
+.PHONY: check-target-libgomp-c++
+check-target-libgomp-c++:
+	$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
 
-@endif target-libmudflap
+@endif target-libgomp
+
+@if target-libitm
+.PHONY: check-target-libitm-c++
+check-target-libitm-c++:
+	$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm
+
+@endif target-libitm
 
 # ----------
 # GCC module
@@ -1443,25 +1449,16 @@
 check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
 [+ ENDFOR languages +]
 
-# Install the gcc headers files, but not the fixed include files,
-# which Cygnus is not allowed to distribute.  This rule is very
-# dependent on the workings of the gcc Makefile.in.
-.PHONY: gcc-no-fixedincludes
-gcc-no-fixedincludes:
+# The gcc part of install-no-fixedincludes, which relies on an intimate
+# knowledge of how a number of gcc internal targets (inter)operate.  Delegate.
+.PHONY: gcc-install-no-fixedincludes
+gcc-install-no-fixedincludes:
 	@if [ -f ./gcc/Makefile ]; then \
-	  rm -rf gcc/tmp-include; \
-	  mv gcc/include gcc/tmp-include 2>/dev/null; \
-	  mkdir gcc/include; \
-	  cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
-	  touch gcc/stmp-fixinc gcc/include/fixed; \
-	  rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
 	  r=`${PWD_COMMAND}`; export r; \
-	  s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
+	  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	  $(HOST_EXPORTS) \
-	  (cd ./gcc && \
-	   $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
-	  rm -rf gcc/include; \
-	  mv gcc/tmp-include gcc/include 2>/dev/null; \
+	  (cd ./gcc \
+	   && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
 	else true; fi
 @endif gcc
 
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index da9e6a2..b98a08c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,838 +1,164 @@
-2012-07-13  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+2013-12-08  Alan Modra  <amodra@gmail.com>
 
-	* elf64-s390.c: Include elf-s390-common.c.
-	(R_390_IRELATIVE): New reloc.
-	(elf_s390_reloc_type_lookup): Support R_390_IRELATIVE.
-	(RELA_ENTRY_SIZE): New macro.
-	(elf_s390_link_hash_entry): New fields ifunc_resolver_address and
-	*ifunc_resolver_section.
-	(struct plt_entry): New struct.
-	(struct elf_s390_obj_tdata): New field local_plt.
-	(elf_s390_local_plt): New macro.
-	(struct elf_s390_link_hash_table): New field irelifunc.
-	(ELF64): New macro.
-	(link_hash_newfunc): Initialize new fields.
-	(elf_s390_check_relocs): Handle IFUNC symbols.
-	(elf_s390_adjust_dynamic_symbol): Don't do anything for IFUNC
+	* elflink.c (_bfd_elf_add_default_symbol): Set dynamic_def
+	and ref_dynamic_nonweak when chaining together indirect
 	symbols.
-	(allocate_dynrelocs): Call s390_elf_allocate_ifunc_dyn_relocs for
-	IFUNC symbols.
-	(elf_s390_size_dynamic_sections): Handle IFUNC symbols.
-	(elf_s390_relocate_section): Likewise.
-	(elf_s390_finish_dynamic_symbol): Likewise.
-	(elf_s390_finish_dynamic_sections): Handle local IFUNC symbols.
-	(elf_s390_finish_ifunc_symbol): New function.
-	(elf_s390_gc_sweep_hook): Handle local plt entries.
-	(elf_backend_add_symbol_hook): Define.
-	* elf32-s390.c: See elf64-s390.c changes.
-	* elf-s390-common.c: New file.
-	* bfd-in2.h (BFD_RELOC_390_IRELATIVE): New enum field.
-	* libbfd.h (BFD_RELOC_390_IRELATIVE): New entry for
-	BFD_RELOC_390_IRELATIVE.
-	* reloc.c (BFD_RELOC_390_IRELATIVE): Document new relocation.
 
-2012-07-13  Nick Clifton  <nickc@redhat.com>
+2013-12-06  Tristan Gingold  <gingold@adacore.com>
 
-	* aix386-core.c: Remove use of PTR and PARAMS macros.
-	* archive.c: Likewise.
-	* cache.c: Likewise.
-	* cisco-core.c: Likewise.
-	* coff-alpha.c: Likewise.
-	* coff-apollo.c: Likewise.
-	* coff-aux.c: Likewise.
-	* coff-h8300.c: Likewise.
-	* coff-h8500.c: Likewise.
-	* coff-i386.c: Likewise.
-	* coff-i960.c: Likewise.
-	* coff-ia64.c: Likewise.
-	* coff-m68k.c: Likewise.
-	* coff-m88k.c: Likewise.
-	* coff-mcore.c: Likewise.
-	* coff-mips.c: Likewise.
-	* coff-or32.c: Likewise.
-	* coff-ppc.c: Likewise.
-	* coff-rs6000.c: Likewise.
-	* coff-sh.c: Likewise.
-	* coff-sparc.c: Likewise.
-	* coff-stgo32.c: Likewise.
-	* coff-tic30.c: Likewise.
-	* coff-tic4x.c: Likewise.
-	* coff-tic54x.c: Likewise.
-	* coff-tic80.c: Likewise.
-	* coff-w65.c: Likewise.
-	* cofflink.c: Likewise.
-	* cpu-arc.c: Likewise.
-	* cpu-cris.c: Likewise.
-	* cpu-h8500.c: Likewise.
-	* cpu-i960.c: Likewise.
-	* cpu-msp430.c: Likewise.
-	* cpu-ns32k.c: Likewise.
-	* cpu-powerpc.c: Likewise.
-	* cpu-rs6000.c: Likewise.
-	* cpu-tic4x.c: Likewise.
-	* cpu-w65.c: Likewise.
-	* ecoff.c: Likewise.
-	* ecofflink.c: Likewise.
-	* elf-m10200.c: Likewise.
-	* elf32-bfin.c: Likewise.
-	* elf32-cris.c: Likewise.
-	* elf32-crx.c: Likewise.
-	* elf32-fr30.c: Likewise.
-	* elf32-frv.c: Likewise.
-	* elf32-h8300.c: Likewise.
-	* elf32-i960.c: Likewise.
-	* elf32-m32c.c: Likewise.
-	* elf32-m68hc11.c: Likewise.
-	* elf32-m68hc12.c: Likewise.
-	* elf32-m68hc1x.c: Likewise.
-	* elf32-m68k.c: Likewise.
-	* elf32-mcore.c: Likewise.
-	* elf32-rl78.c: Likewise.
-	* elf32-rx.c: Likewise.
-	* elf32-s390.c: Likewise.
-	* elf32-vax.c: Likewise.
-	* elf64-alpha.c: Likewise.
-	* elf64-mmix.c: Likewise.
-	* elf64-s390.c: Likewise.
-	* elf64-sparc.c: Likewise.
-	* elfnn-ia64.c: Likewise.
-	* elfxx-mips.c: Likewise.
-	* elfxx-sparc.c: Likewise.
-	* hash.c: Likewise.
-	* hp300hpux.c: Likewise.
-	* hppabsd-core.c: Likewise.
-	* hpux-core.c: Likewise.
-	* i386dynix.c: Likewise.
-	* i386linux.c: Likewise.
-	* i386lynx.c: Likewise.
-	* i386mach3.c: Likewise.
-	* i386msdos.c: Likewise.
-	* i386os9k.c: Likewise.
-	* irix-core.c: Likewise.
-	* lynx-core.c: Likewise.
-	* m68klinux.c: Likewise.
-	* mach-o.h: Likewise.
-	* mipsbsd.c: Likewise.
-	* netbsd-core.c: Likewise.
-	* nlm32-i386.c: Likewise.
-	* osf-core.c: Likewise.
-	* pc532-mach.c: Likewise.
-	* pef.c: Likewise.
-	* ppcboot.c: Likewise.
-	* ptrace-core.c: Likewise.
-	* reloc16.c: Likewise.
-	* sco5-core.c: Likewise.
-	* som.h: Likewise.
-	* sparclinux.c: Likewise.
-	* sparclynx.c: Likewise.
-	* ticoff.h: Likewise.
-	* trad-core.c: Likewise.
-	* vms-lib.c: Likewise.
-	* xsym.h: Likewise.
+	* pei-x86_64.c (pex64_xdata_print_uwd_codes): Add argument rf.
+	Display epilog opcode.
+	(pex64_dump_xdata): Add argument rf; make addr a local variable.
+	Adjust call to pex64_xdata_print_uwd_codes.
+	(pex64_bfd_print_pdata): Display code range, adjust call to
 
-2012-07-09  Alan Modra  <amodra@gmail.com>
+2013-12-05  Tristan Gingold  <gingold@adacore.com>
 
-	PR ld/14323
-	* elflink.c (elf_sort_symbol): Sort by size too.
-	(elf_link_add_object_symbols <weakdefs>): Simplify binary search.
-	Do not depend on ordering of symbol aliases.  Match largest size.
+	* mach-o.c (bfd_mach_o_mkobject_init): Use bfd_zalloc.
 
-2012-07-03  H.J. Lu  <hongjiu.lu@intel.com>
+2013-12-03  Nick Clifton  <nickc@redhat.com>
 
-	* elf.c (assign_section_numbers): Check if number of sections
-	>= SHN_LORESERVE.
-	* elfcode.h (elf_object_p): Likewise.
+	* peXXigen.c (pe_print_resource_entries): New function: Displays
+	an entry in a .rsrc section.
+	(pe_print_resource_directory): New function: Displays a directory
+	in a .rsrc section.
+	(pe_print_rsrc): New function: Displays the contents of .rsrc
+	section.
+	(_bfd_XX_print_private_bfd_data_common): Call pe_print_rsrc.
 
-2012-07-03  Nick Clifton  <nickc@redhat.com>
+2013-12-03  Alan Modra  <amodra@gmail.com>
 
-	* archive.c (bsd_write_armap): Catch attempts to create an archive
-	with indicies bigger than 4Gb.
-	(coff_write_armap): Likewise.
+	* elf64-ppc.c (ppc_build_one_stub <ppc_stub_plt_branch_r2off>):
+	Don't omit saving of r2 for ELFv2.  Don't addi 2,2,0.
+	(ppc_size_one_stub <ppc_stub_plt_branch_r2off>): Adjust to suit.
 
-2012-07-03  H.J. Lu  <hongjiu.lu@intel.com>
+2013-12-03  Alan Modra  <amodra@gmail.com>
 
-	PR binutils/14319
-	* elf.c (_bfd_elf_make_section_from_shdr): Don't compress empty
-	debug section.
+	* elf64-ppc.c (ppc64_elf_link_just_syms): Remove .got check.
+	Handle ELFv2.
 
-2012-07-03  H.J. Lu  <hongjiu.lu@intel.com>
+2013-11-26  Will Newton  <will.newton@linaro.org>
 
-	PR ld/3351
-	* elflink.c (_bfd_elf_update_dynamic_flags): New.
-	(_bfd_elf_merge_symbol): Update both real and indirect symbol
-	dynamic flags.
-	(_bfd_elf_add_default_symbol): Make the real symbol dynamic if
-	the indirect symbol is defined in a shared library.
-	(elf_link_add_object_symbols): Likewise.  If the indirect
-	symbol has been forced local, don't make the real symbol
-	dynamic.
-	(elf_link_check_versioned_symbol): Check indirect symbol.
-	(elf_link_output_extsym): Use real symbol definition when
-	reporting indirect symbol error.  Check version info for
-	dynamic versioned symbol.
+	* elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol):
+	Handle STT_GNU_IFUNC symbols correctly in static links.
 
-2012-07-03  Alan Modra  <amodra@gmail.com>
+2013-11-26  Will Newton  <will.newton@linaro.org>
 
-	PR ld/14207
-	* elf.c (assign_file_positions_for_load_sections): Remove assertions
-	that only PT_LOAD headers include file header and section headers.
-	(assign_file_positions_for_non_load_sections): Similarly don't
-	assert PT_GNU_RELRO header does not include file and section headers.
-	Compare first section vma rather than PT_LOAD p_vaddr against
-	relro_start when looking for PT_LOAD covering PT_GNU_RELRO.  Replace
-	abort with assertion.
+	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Ensure
+	PLT_INDEX is calculated using correct header size.
 
-2012-07-02  Alan Modra  <amodra@gmail.com>
+2013-11-22  Cory Fields  <cory@coryfields.com>
 
-	* elf32-m32c.c (m32c_elf_check_relocs): Use bfd_make_section
-	"anyway" variant when creating .plt.
-	(m32c_elf_relax_plt_section): Remove redundant test and unused param.
-	(m32c_elf_relax_section): Test SEC_LINKER_CREATED before calling
-	m32c_elf_relax_plt_section.
-	* elfxx-mips.c (mips_elf_create_got_section): Use make anyway variant
-	when creating .got and .got.plt.
-	(_bfd_mips_elf_final_link): Likewise for .rtproc, and use
-	bfd_get_linker_section.
-	* sunos.c: Similarly throughout.
+	* libcoff-in.h: Add insert_timestamp flag to the pe_data struct.
+	* libcoff.h: Regenerate.
+	* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Only use a real
+	timestamp if --insert-timestamp was used.
 
-2012-07-01  Andreas Schwab  <schwab@linux-m68k.org>
+2013-11-19  Roland McGrath  <mcgrathr@google.com>
 
-	* elf.c (_bfd_elf_make_section_from_shdr): Fix typo in error
-	message.
+	* elf-nacl.c (nacl_modify_segment_map): Calculate SIZEOF_HEADERS
+	when not doing linking (i.e. INFO is a null pointer).
 
-2012-06-29  H.J. Lu  <hongjiu.lu@intel.com>
+2013-11-19  H.J. Lu  <hongjiu.lu@intel.com>
 
-	* elf64-x86-64.c (elf_x86_64_relocate_section): Return FALSE
-	on unresolvable relocation.
+	* elf64-x86-64.c (elf_x86_64_section_from_shdr): Re-indent.
 
-2012-06-29  H.J. Lu  <hongjiu.lu@intel.com>
+2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
 
-	* archive.c (_bfd_compute_and_write_armap): Simplify global
-	symbol handling.
-
-2012-06-29  Nick Clifton  <nickc@redhat.com>
-
-	PR ld/14189
-	* elf32-arm.c (elf32_arm_check_relocs): Do not increment refcount
-	for locally bound symbols.
-
-2012-06-29  Alan Modra  <amodra@gmail.com>
-
-	* section.c (bfd_get_linker_section): New function.
-	* elf32-arm.c: When retrieving SEC_LINKER_CREATED sections, use
-	the above throughout rather than bfd_get_section_by_name.  Use
-	bfd_make_section_anyway rather than bfd_make_section when creating
-	them.
-	* elf32-bfin.c: Likewise.
-	* elf32-cr16.c: Likewise.
-	* elf32-cris.c: Likewise.
-	* elf32-frv.c: Likewise.
-	* elf32-hppa.c: Likewise.
-	* elf32-i370.c: Likewise.
-	* elf32-i386.c: Likewise.
-	* elf32-lm32.c: Likewise.
-	* elf32-m32c.c: Likewise.
-	* elf32-m32r.c: Likewise.
-	* elf32-m68k.c: Likewise.
-	* elf32-microblaze.c: Likewise.
-	* elf32-ppc.c: Likewise.
-	* elf32-rl78.c: Likewise.
-	* elf32-s390.c: Likewise.
-	* elf32-score.c: Likewise.
-	* elf32-score7.c: Likewise.
-	* elf32-sh.c: Likewise.
-	* elf32-tic6x.c: Likewise.
-	* elf32-tilepro.c: Likewise.
-	* elf32-vax.c: Likewise.
-	* elf32-xstormy16.c: Likewise.
-	* elf32-xtensa.c: Likewise.
-	* elf64-alpha.c: Likewise.
-	* elf64-hppa.c: Likewise.
-	* elf64-ia64-vms.c: Likewise.
-	* elf64-ppc.c: Likewise.
-	* elf64-s390.c: Likewise.
-	* elf64-sh64.c: Likewise.
-	* elf64-sparc.c: Likewise.
-	* elf64-x86-64.c: Likewise.
-	* elfnn-ia64.c: Likewise.
-	* elfxx-mips.c: Likewise.
-	* elfxx-sparc.c: Likewise.
-	* elfxx-tilegx.c: Likewise.
-	* elflink.c: Likewise.
-	* elf-vxworks.c: Likewise.
-	* elf-m10300.c: Likewise.  Also make use of htab plt, got and
-	gotplt shortcuts.
-	* bfd-in2.h: Regenerate.
-	* elf32-lm32.c (lm32_elf_check_relocs): Use the correct bfd when
-	calling create_rofixup_section.
-	* elflink.c (bfd_elf_final_link): Simplify test for .dynstr.
-
-2012-06-29  Alan Modra  <amodra@gmail.com>
-
-	* elf32-sh.c (sh_elf_create_dynamic_sections): Don't create .rela
-	section for bss type sections, except for .rela.bss.
-	* elf-m10300.c (_bfd_mn10300_elf_create_dynamic_sections): Likewise.
-	* elf32-cr16.c (_bfd_cr16_elf_create_dynamic_sections): Likewise.
-	* elf32-lm32.c (lm32_elf_create_dynamic_sections): Likewise.
-	* elf32-m32r.c (m32r_elf_create_dynamic_sections): Likewise.
-	* elf64-sh64.c (sh64_elf64_create_dynamic_sections): Likewise.
-
-2012-06-28  Roland McGrath  <mcgrathr@google.com>
-
-	* elf32-arm.c (elf32_arm_populate_plt_entry): Use int32_t for
-	displacement calculation in nacl_p case.
-
-2012-06-28  Nick Clifton  <nickc@redhat.com>
-
-	* po/uk.po: New Ukranian translation.
-	* configure.in (ALL_LINGUAS): Add uk.
-	* configure: Regenerate.
-
-2012-06-26  Alan Modra  <amodra@gmail.com>
-
-	* elf64-ppc.c (ppc64_elf_next_toc_section): Don't error if input
-	file has multiple .got/.toc sections and all don't fit in
-	current toc group.
-
-2012-06-22  Roland McGrath  <mcgrathr@google.com>
-
-	* elf.c (assign_file_positions_for_non_load_sections): Define
-	__ehdr_start symbol if it's referenced and there's a PT_LOAD
-	segment that covers both the file and program headers.
-
-2012-06-22  Andreas Schwab  <schwab@linux-m68k.org>
-
-	* elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Don't make
-	_GLOBAL_OFFSET_TABLE_ and _DYNAMIC absolute.
-
-2012-06-22  Alan Modra  <amodra@gmail.com>
-
-	* elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't emit out-of-line
-	save/restore functions when relocatable.  Make "funcs" static.
-
-2012-06-18  Hans-Peter Nilsson  <hp@axis.com>
-
-	* elf32-cris.c (cris_elf_plt_sym_val): Rewrite to work in presence
-	of merged .got and .got.plt entries.
-
-2012-06-18  John Szakmeister  <john@szakmeister.net>
-
-	* elf32-arm.c (elf32_arm_final_link_relocate): Correct return value.
-
-2012-06-17  Hans-Peter Nilsson  <hp@axis.com>
-
-	* elf32-cris.c (cris_elf_relocate_section): <R_CRIS_32_IE>
-	<R_CRIS_32_GOT_TPREL, R_CRIS_16_GOT_TPREL>: Handle references to
-	thread common symbols.
-
-2012-06-13  Nick Clifton  <nickc@redhat.com>
-
-	* elf32-arm.c (bfd_arm_get_mach_from_attributes): New function.
-	(elf32_arm_object_p): If the machine number could not be deduced
-	from the notes, call bfd_arm_get_mach_from_attributes to get the
-	number from the attributes.
-
-2012-06-12  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR bfd/14207
-	* elf.c (assign_file_positions_for_non_load_sections): Abort if
-	PT_GNU_RELRO segment doesn't fit in PT_LOAD segment.
-
-2012-06-12  Alan Modra  <amodra@gmail.com>
-
-	PR ld/14207
-	* elf.c (_bfd_elf_map_sections_to_segments): Disregard bss type
-	sections at end of PT_LOAD segment when searching for segment
-	that contains end of relro extent.
-
-2012-06-11  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* elf.c (assign_file_positions_for_non_load_sections): Reindent.
-
-2012-06-11  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* elf.c (_bfd_elf_map_sections_to_segments): Reindent.
-
-2012-06-06  Alan Modra  <amodra@gmail.com>
-
-	* elflink.c (elf_link_input_bfd): Provide a file symbol for
-	each input file with local syms, if the input lacks such.
-	(bfd_elf_final_link): Add a file symbol to mark end of locals
-	for which we can associate with input files.
-	(struct elf_final_link_info): Add filesym_count field.
-	(struct elf_outext_info): Add need_second_pass and second_pass.
-	(elf_link_output_extsym): Detect symbols defined in the output
-	file, emit them on second pass over locals.
-
-2012-06-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument
-	of target_read_memory as bfd_size_type.
-	* bfd-in2.h: Regenerate.
-	* elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN
-	argument of target_read_memory as bfd_size_type.
-	(_bfd_elf32_bfd_from_remote_memory): Likewise.
-	(_bfd_elf64_bfd_from_remote_memory): Likewise.
-	* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
-	* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): Likewise.
-
-2012-06-03  Alan Modra  <amodra@gmail.com>
-
-	PR binutils/13897
-	* elf.c (elf_find_function): Cache last function sym info.
-	(_bfd_elf_maybe_function_sym): Return function size, pass in
-	section of interest.
-	* elf-bfd.h (struct elf_backend_data <maybe_function_sym>): Likewise.
-	(_bfd_elf_maybe_function_sym): Likewise.
-	* elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise.
-	(opd_entry_value): Add in_code_sec param.  Revert caching code.
-	Return -1 if in_code_sec and function found in wrong section.
-	Update all calls.
-
-2012-06-01  Siddhesh Poyarekar  <siddhesh@redhat.com>
-
-	* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument
-	of target_read_memory as size_t.
-	* bfd-in2.h: Regenerate.
-	* elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN
-	argument of target_read_memory as size_t.
-	(_bfd_elf32_bfd_from_remote_memory): Likewise.
-	(_bfd_elf64_bfd_from_remote_memory): Likewise.
-	* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
-	* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): Likewise.
-
-2012-06-01  Alan Modra  <amodra@gmail.com>
-
-	PR binutils/13897
-	* elf64-ppc.c (opd_entry_value): Rewrite cache code.
-
-2012-05-29  Tom Tromey  <tromey@redhat.com>
-
-	* opncls.c (bfd_fopen): Always close fd on failure.
-	(bfd_fdopenr): Likewise.
-
-2012-05-27  Alan Modra  <amodra@gmail.com>
-
-	PR ld/14170
-	* elflink.c (_bfd_elf_merge_symbol): When a symbol defined in
-	a dynamic library finds a new instance with non-default
-	visibility in a regular object, correctly handle symbols
-	already on the undefs list and undo dynamic symbol state when
-	the new symbol is hidden or internal.
-
-2012-05-25  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* elf32-i386.c (elf_i386_create_dynamic_sections): Don't use
-	dynamic_sec_flags to create PLT .eh_frame section.
-	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
-
-2012-05-25  Alan Modra  <amodra@gmail.com>
-
-	PR ld/13909
-	* elf-eh-frame.c (_bfd_elf_eh_frame_present): New function.
-	(_bfd_elf_maybe_strip_eh_frame_hdr): Use it here.
-	* elf-bfd.h (_bfd_elf_eh_frame_present): Declare.
-	* elflink.c (bfd_elf_size_dynamic_sections): Let the backend
-	size dynamic sections before stripping eh_frame_hdr.
-	(bfd_elf_gc_sections): Handle multiple .eh_frame sections.
-	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Drop glink_eh_frame
-	if no other .eh_frame sections exist.
-	* elf64-ppc.c (ppc64_elf_size_stubs): Likewise.
-	* elf32-i386.c (elf_i386_create_dynamic_sections): Don't size
-	or alloc plt_eh_frame here..
-	(elf_i386_size_dynamic_sections): ..do it here instead.  Don't
-	specially keep sgotplt, iplt, tgotplt, sdynbss for symbols.
-	(elf_i386_finish_dynamic_sections): Check plt_eh_frame->contents
-	before writing plt offset.
-	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Don't size
-	or alloc plt_eh_frame here..
-	(elf_x86_64_size_dynamic_sections): ..do it here instead.
-	(elf_x86_64_finish_dynamic_sections): Check plt_eh_frame->contents
-	before writing plt offset.
-
-2012-05-24  Alan Modra  <amodra@gmail.com>
-
-	PR ld/14158
-	* elf64-ppc.c (ppc64_elf_size_stubs): Round up glink_eh_frame
-	size to output section alignment.
-	(ppc64_elf_build_stubs): Likewise, and extend last FDE to cover.
-
-2012-05-23  Alan Modra  <amodra@gmail.com>
-
-	* elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Handle
-        BFDs with multiple .eh_frame sections.
-
-2012-05-23  Alan Modra  <amodra@gmail.com>
-
-	PR ld/13909
-	* elflink.c (bfd_elf_discard_info): Don't ignore dynamic BFDs.
-
-2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR ld/13909
-	* elf32-i386.c (elf_i386_create_dynamic_sections): Revert the
-	last change.
-	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
-
-2012-05-22  Alan Modra  <amodra@gmail.com>
-
-	* elflink.c (bfd_elf_discard_info): Look for next .eh_frame if
-	first one is zero size or discarded.
-	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Set most of
-	glink_eh_frame contents here..
-	(ppc_elf_finish_dynamic_sections): ..rather than here.  Just set
-	offset to .glink.
-
-2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR ld/13909
-	* elf32-i386.c (elf_i386_create_dynamic_sections): Create PLT
-	eh_frame section if there is an input .eh_frame section.
-	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
-
-2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR ld/14105
-	* elf32-i386.c (elf_i386_create_dynamic_sections): Always
-	create PLT eh_frame section with SEC_LINKER_CREATED.
-	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
-
-2012-05-22  Alan Modra  <amodra@gmail.com>
-
-	* elflink.c (bfd_elf_discard_info): Handle multiple .eh_frame
-	sections attached to a BFD.
-	* section.c (bfd_get_section_by_name): Rewrite description.
-	(bfd_get_next_section_by_name): New function.
-	* bfd-in2.h: Regenerate.
-
-2012-05-21  Andreas Schwab  <schwab@linux-m68k.org>
-
-	* elf32-m68k.c (elf_m68k_grok_prstatus): New function.
-	(elf_m68k_grok_psinfo): New function.
-	(elf_backend_grok_prstatus): Define.
-	(elf_backend_grok_psinfo): Define.
-
-2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
-
-	* elf64-mips.c (elf_backend_got_header_size): Correct definition.
-	* elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Use the ELF
-	backend's GOT header size instead of hardcoding it.
-
-2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
-
-	* elf32-vax.c (elf_vax_relocate_section)
-	<R_VAX_8, R_VAX_16, R_VAX_32>: Don't check if info->shared again.
-
-2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
-
-	* elf32-vax.c (elf_vax_relocate_section)
-	<R_VAX_8, R_VAX_16, R_VAX_32>: Use section flags rather than
-	its name as the check for text sections.
-
-2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
-
-	* elf64-mips.c (mips_elf64_be_swap_reloc_out): Also make sure
-	the third reloc offset is the same as the first.
-
-2012-05-19  Alan Modra  <amodra@gmail.com>
-
-	* elf32-ppc.h (has_vle_insns, is_ppc_vle): Delete.
-	(has_tls_reloc, has_tls_get_addr_call): Move back to..
-	* elf32-ppc.c: ..here.
-	(ppc_elf_section_flags, elf_backend_section_flags): Delete.
-	(ppc_elf_modify_segment_map): Use ELF sh_flags to detect VLE sections.
-
-2012-05-18  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* elf32-i386.c (elf_i386_finish_dynamic_symbol): Don't make
-	_DYNAMIC nor _GLOBAL_OFFSET_TABLE_ absolute.
-	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
-
-2012-05-18  Roland McGrath  <mcgrathr@google.com>
-
-	* archive.c (_bfd_generic_read_ar_hdr_mag): Fix last change so as
-	not to clobber the ar_fmag field stored in ARED->arch_header.
-
-2012-05-18  Pedro Alves  <palves@redhat.com>
-
-	* mach-o.h: Don't include sysdep.h.
-
-2012-05-18  Nick Clifton  <nickc@redhat.com>
-
-	PR 14072
-	* bfd-in.h: Check for PACKAGE or PACKAGE_VERSION before
-	complaining about config.h not having been included.
-	* bfd-in2.h: Regenerate.
-
-2012-05-18  Andreas Schwab  <schwab@linux-m68k.org>
-
-	* aclocal.m4: Regenerate.
-	* Makefile.in: Regenerate.
-
-2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
-	    Nick Clifton  <nickc@redhat.com>
-
-	PR 14072
-	* configure.in: Add check that sysdep.h has been included before
-	any system header files.
-	* configure: Regenerate.
-	* config.in: Regenerate.
-	* aclocal.m4: Regenerate.
-	* bfd-in.h: Generate an error if included before config.h.
-	* sysdep.h: Likewise.
-	* bfd-in2.h: Regenerate.
-	* compress.c: Remove #include "config.h".
-	* plugin.c: Likewise.
-	* elf32-m68hc1x.c: Include sysdep.h before alloca-conf.h.
-	* elf64-hppa.c: Likewise.
-	* som.c: Likewise.
-	* xsymc.c: Likewise.
-
-2012-05-17  Maciej W. Rozycki  <macro@linux-mips.org>
-	    Alan Modra  <amodra@gmail.com>
-
-	* elf.c (ignore_section_sym): Correct comment.  Don't return
-	true for absolute section.
-	(elf_map_symbols): Move stray comment.  Adjust for above change.
-	Don't discard global section symbols.
-
-2012-05-17  Alan Modra  <amodra@gmail.com>
-
-	* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make _DYNAMIC,
-	_GLOBAL_OFFSET_TABLE_ or _PROCEDURE_LINKAGE_TABLE_ absolute.
-	* elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Don't make _DYNAMIC
-	absolute.
-
-2012-05-17  Alan Modra  <amodra@gmail.com>
-
-	* elf32-ppc.c (has_tls_reloc, has_tls_get_addr_call, has_vle_insns,
-	is_ppc_vle): Move to..
-	* elf32-ppc.h: ..here, making is_ppc_vle a macro.
-
-2012-05-16  Sergio Durigan Junior  <sergiodj@redhat.com>
-
-	* bfd-in.h (bfd_get_section_name, bfd_get_section_vma,
-	bfd_get_section_lma, bfd_get_section_alignment,
-	bfd_get_section_flags, bfd_get_section_userdata): Rewrite macros
-	in order to use the `bfd' argument.
-	* bfd-in2.h: Regenerate.
-	* elf-vxworks.c (elf_vxworks_finish_dynamic_entry): Pass proper `bfd'
-	as the first argument for `bfd_get_section_alignment'.
-	* elf32-arm.c (create_ifunc_sections): Likewise, for
-	`bfd_set_section_alignment'.
-	* elf32-m32r.c (m32r_elf_relocate_section): Likewise, for
-	`bfd_get_section_name'.
-	* elf32-microblaze.c (microblaze_elf_relocate_section): Likewise.
-	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
-	(ppc_elf_relocate_section): Likewise.
-	* elf64-mmix.c (mmix_final_link_relocate): Likewise, for
-	`bfd_get_section_vma'.
-	* elf64-ppc.c (create_linkage_sections): Likewise, for
-	`bfd_set_section_alignment'.
-
-2012-05-16  Georg-Johann Lay  <avr@gjlay.de>
-
-	PR target/13503
-	* reloc.c: Rename BFD_RELOC_AVR_8_HHI to BFD_RELOC_AVR_8_HLO.
-	* bfd-in2.h: Regenerate.
-	* libbfd.h: Regenrate.
-	* elf32-avr.c (elf_avr_howto_table): Rename R_AVR_8_HHI8 to
-	R_AVR_8_HLO8.
-	(avr_reloc_map): Likewise.
-
-2012-05-16  Daniel Richard G.  <skunk@iskunk.org>
-
-	PR binutils/13558
-	* bfd/aout-cris.c: Include sysdep.h before bfd.h.
-	* bfd/aout-ns32k.c: Likewise.
-	* bfd/aout-sparcle.c: Likewise.
-	* bfd/aout0.c: Likewise.
-	* bfd/bfd-in2.h: Likewise.
-	* bfd/coff-stgo32.c: Likewise.
-	* bfd/cpu-lm32.c: Likewise.
-	* bfd/cpu-microblaze.c: Likewise.
-	* bfd/cpu-score.c: Likewise.
-	* bfd/cpu-tilegx.c: Likewise.
-	* bfd/cpu-tilepro.c: Likewise.
-	* bfd/elf32-lm32.c: Likewise.
-	* bfd/elf32-microblaze.c: Likewise.
-	* bfd/elf32-score7.c: Likewise.
-	* bfd/elf32-tilepro.c: Likewise.
-	* bfd/elfxx-tilegx.c: Likewise.
-	* bfd/mach-o.h: Likewise.
-	* bfd/nlm32-ppc.c: Likewise.
-	* bfd/ns32knetbsd.c: Likewise.
-	* bfd/pef.h: Likewise.
-	* bfd/plugin.c: Likewise.
-	* bfd/stab-syms.c: Likewise.
-	* bfd/sunos.c: Likewise.
-	* bfd/syms.c: Likewise.
-	* bfd/xsym.h: Likewise.
-
-2012-05-16  Alan Modra  <amodra@gmail.com>
-
-	* elflink.c: Rename flaginfo to flinfo throughout, except..
-	(bfd_elf_lookup_section_flags): ..here, rename finfo to flaginfo.
-	Formatting, style.  Simplify flag match.
-
-2012-05-16  Alan Modra  <amodra@gmail.com>
-
-	* dwarf2.c: Formatting.
-	(arange_add): Pass in unit rather than bfd.  Update callers.
-	Ignore empty ranges.  Don't ask for cleared memory.
-	(parse_comp_unit): Only set unit->base_address if processing
-	DW_TAG_compile_unit.
-	(find_debug_info): Optimise section lookup.
-	(place_sections): Use bfd_alloc for stash->adjusted_sections.
-	(find_line): Match previously parsed comp unit addresses as we
-	do for newly parsed comp units.
-
-2012-05-16  Alan Modra  <amodra@gmail.com>
-
-	* archive.c (_bfd_generic_read_ar_hdr_mag):  Ensure sscanf
-	stops at end of ar_size field.
-
-2012-05-16  Alan Modra  <amodra@gmail.com>
-
- 	PR ld/13962
- 	PR ld/7023
-	* elf.c (bfd_section_from_shdr): Fail when .dynsym sh_info is
-	out of range.  As a special case, fix sh_info for zero sh_size.
-	Do the same for .symtab.
-
-2012-05-15  James Murray <jsm@jsm-net.demon.co.uk>
-	    Stephane Carrez <stcarrez@nerim.fr>
-
-	* archures.c: Add bfd_arch_m9s12x and bfd_arch_m9s12xg.
-	* config.bfd: Likewise.
-	* cpu-m9s12x.c: New.
-	* cpu-m9s12xg.c: New.
-	* elf32-m68hc12.c: Add S12X and XGATE co-processor support.
-	Add option to offset S12 addresses into XGATE memory space.
-	Fix carry bug in IMM16 (IMM8 low/high) relocate.
-	* Makefile.am (ALL_MACHINES): Add cpu-m9s12x and cpu-m9s12xg.
-	(ALL_MACHINES_CFILES): Likewise.
-	* reloc.c: Add S12X relocs.
-	* Makefile.in: Regenerate.
-	* bfd-in2.h: Regenerate.
-	* libbfd.h: Regenerate.
-
-2012-05-14  James Lemke  <jwlemke@codesourcery.com>
-	    Catherine Moore  <clm@codesourcery.com>
-
-	* bfd.c (bfd_lookup_section_flags): Add section parm.
-	* ecoff.c (bfd_debug_section): Remove flag_info initializer.
-	* elf-bfd.h (bfd_elf_section_data): Move in section_flag_info.
-	(bfd_elf_lookup_section_flags): Add section parm.
-	* elf32-ppc.c (is_ppc_vle): New function.
-	(ppc_elf_modify_segment_map): New function.
-	(elf_backend_modify_segment_map): Define.
-	(has_vle_insns): New define.
-	* elf32-ppc.h (ppc_elf_modify_segment_map): Declare.
-	* elflink.c (bfd_elf_lookup_section_flags): Add return value & parm.
-	Move in logic to omit / include a section.
-	* libbfd-in.h (bfd_link_info): Add section parm.
-	(bfd_generic_lookup_section_flags): Likewise.
-	* reloc.c (bfd_generic_lookup_section_flags): Likewise.
-	* section.c (bfd_section): Move out section_flag_info.
-	(BFD_FAKE_SECTION): Remove flag_info initializer.
-	* targets.c (_bfd_lookup_section_flags): Add section parm.
-
-2012-05-14  Catherine Moore  <clm@codesourcery.com>
-
-	* archures.c (bfd_mach_ppc_vle): New.
+	* elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_PC32_BND
+	and R_X86_64_PLT32_BND.
+	(R_X86_64_standard): Replace R_X86_64_RELATIVE64 with
+	R_X86_64_PLT32_BND.
+	(IS_X86_64_PCREL_TYPE): Add R_X86_64_PLT32_BND.
+	(x86_64_reloc_map): Add BFD_RELOC_X86_64_PC32_BND and
+	BFD_RELOC_X86_64_PLT32_BND.
+	(elf_x86_64_check_relocs): Handle R_X86_64_PC32_BND and
+	R_X86_64_PLT32_BND.
+	(elf_x86_64_gc_sweep_hook): Likewise.
+	(elf_x86_64_relocate_section): Likewise.
+	* reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_PC32_BND
+	and BFD_RELOC_X86_64_PLT32_BND.
 	* bfd-in2.h: Regenerated.
-	* cpu-powerpc.c (bfd_powerpc_archs): New entry for vle.
-	* elf32-ppc.c (split16_format_type): New enumeration.
-	(ppc_elf_vle_split16): New function.
-	(HOWTO): Add entries for R_PPC_VLE relocations.
-	(ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations.
-	(ppc_elf_section_flags): New function.
-	(ppc_elf_lookup_section_flags): New function.
-	(ppc_elf_section_processing): New function.
-	(ppc_elf_check_relocs): Handle PPC_VLE relocations.
-	(ppc_elf_relocation_section): Likewise.
-	(elf_backend_lookup_section_flags_hook): Define.
-	(elf_backend_section_flags): Define.
-	(elf_backend_section_processing): Define.
-	* elf32-ppc.h (ppc_elf_section_processing): Declare.
-	* libbfd.h: Regenerated.
-	* reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15,
-	BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A,
-	BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A,
-	BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A,
-	BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21,
-	BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A,
-	BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A,
-	BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A,
-	BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations.
+	* libbfd.h: Likewise.
 
-2012-05-11  Georg-Johann Lay  <avr@gjlay.de>
+2013-11-15  H.J. Lu  <hongjiu.lu@intel.com>
 
-	PR target/13503
-	* reloc.c: Add new ENUM for BFD_RELOC_AVR_8_LO,
-	BFD_RELOC_AVR_8_HI, BFD_RELOC_AVR_8_HHI.
+	* elf32-i386.c (elf_i386_allocate_dynrelocs): Make room for
+	PLT0 directly.
+	* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
+
+2013-11-14  Nick Clifton  <nickc@redhat.com>
+
+	PR ld/16017
+	* elf32-arm.c (elf32_arm_populate_plt_entry): Return a boolean
+	value, TRUE for success, FALSE for failure.
+	Fail if attempting to create a PLT entry for a thumb only target.
+	(elf32_arm_final_link_relocate): Check result of calling
+	elf32_arm_populate_plt_entry.
+	(elf32_arm_finish_dynamic_symbol): Likewise.
+
+2013-11-14  Guy Martin <gmsoft@tuxicoman.be>
+
+	PR ld/16082
+	* elf32-hppa.c (elf32_hppa_hide_symbol): Remove old version
+	information when forcing a symbol to be local.
+
+2013-11-13  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* elfnn-aarch64.c (elfNN_aarch64_howto_table): Use
+	R_AARCH64_TLS_DTPMOD64 instead of R_AARCH64_TLS_DTPMOD;
+	likewise for R_AARCH64_TLS_DTPREL and R_AARCH64_TLS_TPREL.
+
+2013-11-12  Matthew Leach  <Matthew.Leach@arm.comm>
+
+	* elfxx-aarch64.c (_bfd_aarch64_elf_grok_prstatus): Fix hard-coded
+	size of struct elf_prstatus.
+
+2013-11-11  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (allocate_dynrelocs): Revert 2013-11-04 change.
+
+2013-11-11  Ulrich Weigand  <uweigand@de.ibm.com>
+
+	* elf64-ppc.c (ppc64_elf_edit_toc): Use SYMBOL_REFERENCES_LOCAL
+	here, not SYMBOL_CALLS_LOCAL.
+	(ppc64_elf_relocate_section): Likewise.
+	(size_global_entry_stubs): Set undefined symbols on their global
+	entry stubs here..
+	(build_global_entry_stubs): ..rather than here.
+	(ppc64_elf_build_stubs): Don't reset glink->size before calling
+	build_global_entry_stubs.
+
+2013-11-07  Roland McGrath  <mcgrathr@google.com>
+
+	* archures.c (bfd_mach_i386_nacl): Fix definition so it doesn't
+	collide with bfd_mach_l1om.
 	* bfd-in2.h: Regenerate.
-	* libbfd.h: Regenrate.
-	* elf32-avr.c (elf_avr_howto_table): Add entries for
-	R_AVR_8_LO8, R_AVR_8_HI8, R_AVR_8_HHI8.
-	(avr_reloc_map): Add RELOC mappings for R_AVR_8_LO8, R_AVR_8_HI8,
-	R_AVR_8_HHI8.
 
-2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
+	* elf32-i386.c (elf32_i386_nacl_elf_object_p): New function.
+	(elf_backend_object_p): Use that in elf32-i386-nacl definition.
+	* elf64-x86-64.c (elf64_x86_64_nacl_elf_object_p): New function.
+	(elf_backend_object_p): Use that in elf64-x86-64-nacl definition.
+	(elf32_x86_64_nacl_elf_object_p): New function.
+	(elf_backend_object_p): Use that in elf32-x86-64-nacl definition.
 
-	* elf64-x86-64.c (elf_x86_64_relocate_section): Use int in x32
-	addend overflow check.
+2013-11-05  DJ Delorie  <dj@redhat.com>
 
-2012-05-10  DJ Delorie  <dj@redhat.com>
+	* elf32-rl78.c (elf32_rl78_relax_delete_bytes): Make sure relocs
+	are loaded before trying to use them.
 
-	* elf32-rx.c (rx_elf_object_p): Ignore empty segments.
+2013-11-05  H.J. Lu  <hongjiu.lu@intel.com>
+	    Bernhard Rosenkränzer <bernhard.rosenkranzer@linaro.org>
 
-2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* elf64-x86-64.c (elf_x86_64_relocate_section): Display signed
-	hex number in x32 addend overflow check.
-
-2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* elf64-x86-64.c (elf_x86_64_reloc_type_class): Handle
-	R_X86_64_RELATIVE64.
-
-2012-05-09  H.J. Lu  <hongjiu.lu@intel.com>
-
-	* elf64-x86-64.c (elf_x86_64_relocate_section): Check addend
-	overflow for R_X86_64_RELATIVE64.
-
-2012-05-08  Ben Cheng  <bccheng@google.com>
-
-	* elf.c: Preserve the original p_align and p_flags if they are
-	valid.
-
-2012-05-07  Alan Modra  <amodra@gmail.com>
-
-	* elf64-ia64-vms.c (elf64_ia64_relocate_section): Update
-	RELOC_AGAINST_DISCARDED_SECTION invocation.
-
-2012-05-07  Hans-Peter Nilsson  <hp@axis.com>
-
-	* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Declare and use
-	local variable i_ instead of assuming and using a variable i.
-
-2012-05-07  Maciej W. Rozycki  <macro@linux-mips.org>
-
-	* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Handle compound
-	relocations.
-	* elfxx-mips.c (mips_reloc_against_discarded_section): New
-	function.
-	(_bfd_mips_elf_relocate_section): Call it, in place of
-	RELOC_AGAINST_DISCARDED_SECTION.
-	* elf-m10200.c (mn10200_elf_relocate_section): Update arguments
-	to RELOC_AGAINST_DISCARDED_SECTION.
+	PR ld/4409
+	* elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Add an argument for
+	error ignored.
+	* elf-m10200.c (mn10200_elf_relocate_section): Updated.
 	* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
 	* elf32-arm.c (elf32_arm_relocate_section): Likewise.
 	* elf32-avr.c (elf32_avr_relocate_section): Likewise.
-	* elf32-bfin.c (bfin_relocate_section): Likewise.
-	(bfinfdpic_relocate_section): Likewise.
+	* elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
+	(bfin_relocate_section): Likewise.
 	* elf32-cr16.c (elf32_cr16_relocate_section): Likewise.
 	* elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise.
 	* elf32-cris.c (cris_elf_relocate_section): Likewise.
@@ -843,1248 +169,2858 @@
 	* elf32-frv.c (elf32_frv_relocate_section): Likewise.
 	* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
 	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
-	* elf32-i370.c (i370_elf_relocate_section): Likewise.
 	* elf32-i386.c (elf_i386_relocate_section): Likewise.
 	* elf32-i860.c (elf32_i860_relocate_section): Likewise.
 	* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
 	* elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
 	* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
-	* elf32-m32c.c (m32c_elf_relocate_section): Likewise.
-	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
 	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
 	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+	* elf32-metag.c (elf_metag_relocate_section): Likewise.
+	* elf32-microblaze.c (microblaze_elf_relocate_section): Likewise.
 	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
 	* elf32-mep.c (mep_elf_relocate_section): Likewise.
 	* elf32-moxie.c (moxie_elf_relocate_section): Likewise.
 	* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
 	* elf32-mt.c (mt_elf_relocate_section): Likewise.
+	* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
 	* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
 	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
 	* elf32-rl78.c (rl78_elf_relocate_section): Likewise.
 	* elf32-rx.c (rx_elf_relocate_section): Likewise.
-	* elf32-s390.c (elf_s390_relocate_section): Likewise.
-	* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
-	* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
-	* elf32-sh.c (sh_elf_relocate_section): Likewise.
-	* elf32-spu.c (spu_elf_relocate_section): Likewise.
 	* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
 	* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
+	* elf32-s390.c (elf_s390_relocate_section): Likewise.
 	* elf32-v850.c (v850_elf_relocate_section): Likewise.
 	* elf32-vax.c (elf_vax_relocate_section): Likewise.
 	* elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise.
 	* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
 	* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
-	* elf64-alpha.c (elf64_alpha_relocate_section_r): Likewise.
-	(elf64_alpha_relocate_section): Likewise.
-	* elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
+	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+	* elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise.
 	* elf64-mmix.c (mmix_elf_relocate_section): Likewise.
 	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
 	* elf64-s390.c (elf_s390_relocate_section): Likewise.
-	* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
-	* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
-	* elfnn-ia64.c (elfNN_ia64_relocate_section): Likewise.
+	* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
 	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
 	* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
+	* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.
 
-2012-05-05  Alan Modra  <amodra@gmail.com>
+	* elfnn-ia64.c (elfNN_ia64_relocate_section): Skip if error
+	from RELOC_FOR_GLOBAL_SYMBOL in executable is ignored.
 
-	PR ld/14052
-	PR ld/13621
-	* linker.c (_bfd_nearby_section): Revert 2012-02-13 change.
+2013-11-05  Alan Modra  <amodra@gmail.com>
 
-2012-05-05  Alan Modra  <amodra@gmail.com>
+	* elf64-ppc.c (ppc64_elf_func_desc_adjust): Make .TOC. defined and
+	hidden.
+	(ppc64_elf_set_toc): Adjust.
 
-	* aout-arm.c: Replace all uses of bfd_abs_section, bfd_com_section,
-	bfd_und_section and bfd_ind_section with their _ptr variants, or
-	use corresponding bfd_is_* macros.
-	* aout-ns32k.c: Likewise.
-	* aout-tic30.c: Likewise.
-	* coff-arm.c: Likewise.
-	* coff-tic54x.c: Likewise.
-	* cpu-ns32k.c: Likewise.
-	* elf-attrs.c: Likewise.
-	* elfcode.h: Likewise.
+2013-11-05  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (struct ppc_link_hash_table): Remove got, plt, relplt,
+	iplt, reliplt.  Update all references to use elf.sgot, elf.splt,
+	elf.srelplt, elf.iplt and elf.irelplt.
+
+2013-11-03  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* elf32-niso2.c (nios2_elf32_do_hi16_relocate): Remove incorrect
+	ATTRIBUTE_UNUSED from parameter.
+	(nios2_elf_do_lo16_relocate): Likewise.
+	(nios2_elf32_do_hiadj16_relocate): Likewise.
+	(nios2_elf32_do_pcrel_lo16_relocate): Likewise.
+	(nios2_elf32_do_pcrel_hiadj16_relocate): Likewise.
+	(nios2_elf32_do_pcrel16_relocate): Likewise.
+	(nios2_elf32_do_call26_relocate): Likewise.
+	(nios2_elf32_do_gprel_relocate): Likewise.
+	(nios2_elf32_do_ujmp_relocate): Likewise.
+	(nios2_elf32_do_cjmp_relocate): Likewise.
+	(nios2_elf32_do_callr_relocate): Likewise.
+	(nios2_elf32_gc_mark_hook): Likewise.
+
+2013-11-04  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_relocate_section): Edit global entry
+	prologue to non-PIC in non-PIC executables.
+
+2013-11-04  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Copy
+	pointer_equality_needed flag.
+	(ppc64_elf_check_relocs): For ELFv2 arrange to emit plt
+	entries for references to functions in shared libraries on
+	non-call relocs.
+	(readonly_dynrelocs): Split into function of the same name and..
+	(maybe_set_textrel): ..this new function.  Update call.
+	(ppc64_elf_adjust_dynamic_symbol): Don't emit dynrelocs for
+	ELFv2 in most cases if we have a plt entry.  Use new
+	readonly_relocs.
+	(allocate_dynrelocs): For ELFv2, don't allocate dynreloc space
+	for ifunc in static executables.
+	(size_global_entry_stubs): New function.
+	(ppc64_elf_size_dynamic_sections): Call size_global_entry_stubs.
+	Save end of glink branch table.
+	(ppc64_elf_hash_symbol): New function.
+	(build_global_entry_stubs): New function.
+	(ppc64_elf_build_stubs): Call build_global_entry_stubs.  Adjust
+	glink sizing.
+	(ppc64_elf_relocate_section): Tidy plt16/32/64 reloc code.
+	(ppc64_elf_finish_dynamic_symbol): For ELFv2, adjust symbols
+	defined on plt code.
+
+2013-11-02  Alan Modra  <amodra@gmail.com>
+
+	* opncls.c (_bfd_new_bfd): Don't init vars already zeroed.
+
+2013-11-02  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_next_input_section): Always set toc_off
+	to value for object file.
+
+2013-11-01  Roland McGrath  <mcgrathr@google.com>
+
+	* elf-nacl.c (segment_eligible_for_headers): Drop requirement that
+	some section have SEC_HAS_CONTENTS set.  It's not set for
+	.note.gnu.build-id, and a segment of only read-only SHT_NOBITS
+	sections is implausible and not really supportable anyway.
+
+2013-10-30  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Use new DT_PPC_OPT
+	tag to specify tls optimisation.
+	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
+	(ppc64_elf_finish_dynamic_sections): Specify whether multiple
+	toc pointers are used via DT_PPC64_OPT.
+
+2013-10-30  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (STK_LR, STK_TOC, STK_LINKER): Define.
+	(savegpr0_tail, restgpr0_tail, savefpr0_tail, restfpr0_tail)
+	build_plt_stub, build_tls_get_addr_stub, ppc_build_one_stub,
+	ppc64_elf_relocate_section): Use new defines.
+
+2013-10-30  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (PLT_ENTRY_SIZE, PLT_INITIAL_ENTRY_SIZE): Add htab
+	parameter and adjust for ELFv2.  Update all uses.
+	(PLT_CALL_STUB_SIZE): Delete.
+	(ppc64_elf_get_synthetic_symtab): Support new glink layout.
+	(allocate_dynrelocs): Likewise.
+	(plt_stub_size, build_plt_stub): Adjust for ELFv2.
+	(get_r2off): Return 0 for ELFv2 -R.
+	(ppc_build_one_stub, ppc_size_one_stub): Adjust for ELFv2.
+	(ppc64_elf_size_stubs): Likewise.
+	(ppc64_elf_build_stubs): Add new ELFv2 glink.
+
+2013-10-30  Alan Modra  <amodra@gmail.com>
+	    Ulrich Weigand  <uweigand@de.ibm.com>
+
+	* elf64-ppc.c (struct ppc_stub_hash_entry): Add "other".
+	(stub_hash_newfunc): Init new ppc_stub_hash_entry field, and one
+	we forgot, "plt_ent".
+	(ppc64_elf_add_symbol_hook): Check ELFv1 objects don't have
+	st_other bits only valid in ELFv2.
+	(ppc64_elf_merge_symbol_attribute): New function.
+	(ppc_type_of_stub): Add local_off param to test branch range.
+	(ppc_build_one_stub): Adjust destinations for ELFv2 locals.
+	(ppc_size_one_stub, toc_adjusting_stub_needed): Similarly.
+	(ppc64_elf_size_stubs): Pass local_off to ppc_type_of_stub.
+	Set "other" field.
+	(ppc64_elf_relocate_section): Adjust destination for ELFv2 local
+	calls.
+
+2013-10-30  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (abiversion, set_abiversion): New functions.
+	(ppc64_elf_get_synthetic_symtab): Handle ELFv2 objects without .opd.
+	(struct ppc_link_hash_table): Add opd_abi.
+	(ppc64_elf_check_relocs): Check no .opd with ELFv2.
+	(ppc64_elf_merge_private_bfd_data): New function.
+	(ppc64_elf_print_private_bfd_data): New function.
+	(ppc64_elf_tls_setup): Set htab->opd_abi.
+	(ppc64_elf_size_dynamic_sections): Don't emit OPD related dynamic
+	tags for ELFv2.
+	(ppc_build_one_stub): Use R_PPC64_IRELATIVE for ELFv2 ifunc.
+	(ppc64_elf_finish_dynamic_symbol): Likewise
+
+2013-10-30  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (build_plt_stub): Switch stubs to use r11 as base
+	reg and r12 as destination.
+	(ppc_build_one_stub): Likewise.
+	(ppc64_elf_build_stubs): Likewise for glink.
+
+2013-10-30  Alan Modra  <amodra@gmail.com>
+
+	* reloc.c (BFD_RELOC_PPC64_ADDR16_HIGH, BFD_RELOC_PPC64_ADDR16_HIGHA,
+	BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA,
+	BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA): New.
+	* elf64-ppc.c (ppc64_elf_howto_raw): Add entries for new relocs.
+	Make all _HA and _HI relocs report signed overflow.
+	(ppc64_elf_reloc_type_lookup): Handle new relocs.
+	(must_be_dyn_reloc, ppc64_elf_check_relocs): Likewise.
+	(dec_dynrel_count, ppc64_elf_relocate_section): Likewise.
+	(ppc64_elf_relocate_section): Don't apply 0x8000 adjust to
+	R_PPC64_TPREL16_HIGHER, R_PPC64_TPREL16_HIGHEST,
+	R_PPC64_DTPREL16_HIGHER, and R_PPC64_DTPREL16_HIGHEST.
+	* libbfd.h: Regenerate.
+	* bfd-in2.h: Regenerate.
+
+2013-10-29  Roland McGrath  <mcgrathr@google.com>
+
+	* elf64-x86-64.c (elf_x86_64_nacl_plt0_entry): Correct 9-byte nop
+	sequence to match what the assembler generates.
+
+2013-10-29  Jan Beulich <jbeulich@suse.com>
+
+	* elflink.c (struct elf_outext_info): Add field file_sym_done.
+	(bfd_elf_final_link): Initialize new field. Move fake STT_FILE
+	symbol emission from here ...
+	(elf_link_output_extsym): ... to here.
+
+2013-10-24  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/15994
+	* dwarf2.c (lookup_address_in_line_info_table): Change return type
+	to be the range of addresses covered by the table.
+	(comp_unit_find_nearest_line): Likewise.
+	(find_line): Search all CUs.  Select the one that matches and
+	covers the smallest address range.
+
+2013-10-18  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elf32-cris.c (cris_elf_check_relocs): Don't assume
+	a registered dynobj means that a .got has been created.
+
+2013-10-17  Alan Modra  <amodra@gmail.com>
+
+	PR 16056
+	* elf.c (copy_elf_program_header): Only consider SEC_ALLOC sections
+	when finding lowest_section.
+
+2013-10-14  Chao-ying Fu  <Chao-ying.Fu@imgtec.com>
+
+	* elfxx-mips.c (mips_elf_obj_tdata): Add abi_msa_bfd.
+	(mips_elf_merge_obj_attributes): Set abi_msa_bfd to the first object
+	file that has a Tag_GNU_MIPS_ABI_MSA attribute.
+	Merge Tag_GNU_MIPS_ABI_MSA attributes.
+
+2013-10-14  Nick Clifton  <nickc@redhat.com>
+
+	* gen-aout.c (main): Fix formatting.  Close file.
+
+2013-10-13  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_use_local_got_p): New function.
+	(mips_elf_count_got_symbols, mips_elf_calculate_relocation): Use it.
+	(_bfd_mips_elf_check_relocs): Set pointer_equality_needed for
+	GOT and absolute references.
+
+2013-10-09  Roland McGrath  <mcgrathr@google.com>
+
+	* elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Cast switch
+	expression to int to silence over-eager compiler warnings.
+
+	* xcofflink.c (_bfd_xcoff_bfd_final_link): Don't touch EREL in
+	loop that doesn't use (or initialize) it.
+
+	* elfxx-tilegx.c (tilegx32_plt_tail_entry, tilegx32_plt_tail_entry):
+	Move second const qualifier so it applies to the pointer.
+
+2013-10-09  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/16022
+	* elf32-rx.c (rx_dump_symtab): Add missing break statements.
+
+2013-10-09  Tom Tromey  <tromey@redhat.com>
+
+	* opncls.c (get_alt_debug_link_info_shim): Update type of 'len'.
+
+2013-10-09  Nick Clifton  <nickc@redhat.com>
+
+	PR ld/16021
+	* elf32-rl78.c (rl78_dump_symtab): Delete.
+	(rl78_get_reloc): Delete.
+
+2013-10-09  Tom Tromey  <tromey@redhat.com>
+
+	* bfd-in2.h: Rebuild.
+	* opncls.c (bfd_get_alt_debug_link_info): Change type of
+	buildid_len to bfd_size_type.
+
+2013-10-09  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR binutils/15993
+	* elf32-m32c.c (dump_symtab): Add missing "break;" statement on each
+	"case".  Reindent "switch" statements.
+
+2013-10-08  Tom Tromey  <tromey@redhat.com>
+
+	* bfd-in2.h: Rebuild.
+	* opncls.c (bfd_get_alt_debug_link_info): Add buildid_len
+	parameter.  Change type of buildid_out.  Update.
+	(get_alt_debug_link_info_shim): New function.
+	(bfd_follow_gnu_debuglink): Use it.
+
+2013-10-08  Andreas Schwab  <schwab@suse.de>
+
+	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Add DT_DEBUG also
+	for PIE executables.
+
+2013-10-04  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+	* configure: Regenerate.
+
+2013-10-03  Will Newton  <will.newton@linaro.org>
+
+	* configure: Regenerate.
+	* configure.in: Build elf-ifunc.o for AArch64.
+	* elfnn-aarch64.c: Include objalloc.h.
+	(elfNN_aarch64_local_htab_hash): New function.
+	(elfNN_aarch64_local_htab_eq): New function.
+	(elfNN_aarch64_get_local_sym_hash): New function.
+	(elfNN_aarch64_link_hash_table_create): Initialize local STT_GNU_IFUNC
+	symbol hash.
+	(elfNN_aarch64_hash_table_free): Free local STT_GNU_IFUNC symbol hash.
+	(elfNN_aarch64_final_link_relocate): Add sym argument.  Add support
+	for handling STT_GNU_IFUNC symbols.
+	(elfNN_aarch64_gc_sweep_hook): Add support for garbage collecting
+	references to STT_GNU_IFUNC symbols.
+	(elfNN_aarch64_adjust_dynamic_symbol): Add support for handling
+	STT_GNU_IFUNC symbols.
+	(elfNN_aarch64_check_relocs): Add support for handling STT_GNU_IFUNC
+	symbols.  Ensure we don't increase plt.refcount from -1 to 0.
+	(elfNN_aarch64_post_process_headers): Call _bfd_elf_set_osabi.
+	(elfNN_aarch64_is_function_type): Remove function.
+	(elfNN_aarch64_allocate_dynrelocs): Handle STT_GNU_IFUNC symbols.
+	(elfNN_aarch64_allocate_ifunc_dynrelocs): New function.
+	(elfNN_aarch64_allocate_local_dynrelocs): New function.
+	(elfNN_aarch64_allocate_local_ifunc_dynrelocs): New function.
+	(elfNN_aarch64_size_dynamic_sections): Call
+	elfNN_aarch64_allocate_local_dynrelocs.
+	(elfNN_aarch64_create_small_pltn_entry): Add info argument.
+	Add support for creating .iplt entries for STT_GNU_IFUNC symbols.
+	(elfNN_aarch64_finish_dynamic_symbol): Add support for handling
+	STT_GNU_IFUNC symbols and .iplt.
+	(elfNN_aarch64_finish_local_dynamic_symbol): New function.
+	(elfNN_aarch64_finish_dynamic_sections): Call
+	elfNN_aarch64_finish_local_dynamic_symbol.
+
+2013-09-30  Nick Clifton  <nickc@redhat.com>
+
+	* cpu-msp430.c: Use printable names that match the values
+	displayed by readelf.
+
+2013-08-25  Andrew Pinski  <apinski@cavium.com>
+
+	* elfnn-aarch64.c (TCB_SIZE): Base on the ARCH_SIZE rather than a
+	fixed size of 16.
+
+2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>
+
+	* elfxx-mips.c (mips_elf_create_got_section): Hide
+	_GLOBAL_OFFSET_TABLE_.
+
+2013-09-24  Alan Modra  <amodra@gmail.com>
+
+	* elf32-mips.c (ELF_OSABI): Undef for vxworks.
+
+2013-09-24  Alan Modra  <amodra@gmail.com>
+
+	* syms.c (_bfd_stab_section_find_nearest_line): Ignore partial
+	stabs at end of .stab.  Tidy variable usage.  Don't drop the need
+	for a NULL function name stab if If N_FUN stab is ignored.
+	Ensure index entry count loop matches write loop.
+
+2013-09-20  Alan Modra  <amodra@gmail.com>
+
+	* configure: Regenerate.
+
+2013-09-18  Tristan Gingold  <gingold@adacore.com>
+
+	* configure.in: Bump version to 2.24.51
+	* configure: Regenerate.
+
+2013-09-17  Doug Gilmore  <Doug.Gilmore@imgtec.com>
+
+	* elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): Handle
+	EF_MIPS_FP64.
+
+2013-08-31  John David Anglin  <dave.anglin@bell.net>
+
+	* elf64-hppa.c (elf_hppa_final_link_relocate): Add missing '%' to
+	format string.
+
+2013-08-29  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf64-x86-64.c (elf_x86_64_check_tls_transition): Allow
+	64-bit -mcmodel=large -fpic TLS GD and LD sequences.
+	(elf_x86_64_relocate_section): Handle -mcmodel=large -fpic
+	TLS GD and LD sequences in GD->LE, GD->IE and LD->LE transitions.
+
+2013-08-27  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (struct elf_backend_data): Remove as_needed_cleanup.
+	Add notice_as_needed.
+	* elf64-ppc.c (elf_backend_as_needed_cleanup): Don't define.
+	(elf_backend_notice_as_needed): Define.
+	(ppc64_elf_as_needed_cleanup): Rename and adjust..
+	(ppc64_elf_notice_as_needed): ..to this.
+	* elflink.c (_bfd_elf_notice_as_needed): New function, extracted..
+	(elf_link_add_object_symbols): ..from here.
+	* elfxx-target.h (elf_backend_as_needed_cleanup): Don't define.
+	(elf_backend_notice_as_needed): Define..
+	(elfNN_bed): ..and use here.
+
+2013-08-26  Roland McGrath  <mcgrathr@google.com>
+
+	* archures.c (bfd_mach_i386_nacl, bfd_mach_i386_i386_nacl): New macros.
+	(bfd_mach_x86_64_nacl, bfd_mach_x64_32_nacl): New macros.
+	* cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): New function.
+	(bfd_i386_nacl_arch): New variable.
+	(bfd_x86_64_nacl_arch, bfd_x64_32_nacl_arch): New variables.
+	(bfd_x64_32_arch_intel_syntax): Link them into the list.
+	* bfd-in2.h: Regenerate.
+
+2013-08-26  Roland McGrath  <mcgrathr@google.com>
+
+	* elf-nacl.c (nacl_modify_segment_map): Fix logic reordering the
+	elf_segment_map list.  If an executable segment is page-aligned
+	but does not end with a full page, then append a fake section into
+	the segment map entry that pads out the page.
+	(nacl_final_write_processing): New function.  Write the code fill
+	laid out in nacl_modify_segment_map.
+	* elf-nacl.h: Declare it.
+	* elf32-arm.c (elf32_arm_nacl_final_write_processing): New function.
+	(elf_backend_final_write_processing): Define it for NaCl backend.
+	* elf32-i386.c (elf_backend_final_write_processing): Likewise.
+	* elf64-x86-64.c (elf_backend_final_write_processing): Likewise.
+
+	* elf-nacl.c (segment_eligible_for_headers): Rename MAXPAGESIZE
+	parameter to MINPAGESIZE.
+	(nacl_modify_segment_map): Use minpagesize instead of maxpagesize.
+
+	* elf32-arm.c (ELF_MINPAGESIZE, ELF_COMMONPAGESIZE): #undef for NaCl.
+
+2013-08-24  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-tilepro.c (tilepro_elf_finish_dynamic_sections): Don't
+	set GOT's entry size if there is no ELF section data.
+	* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
+	* elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_sections):
+	Likewise.
+
+2013-08-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf64-x86-64.c (get_elf_x86_64_arch_data): New.
+	(get_elf_x86_64_backend_data): Use it.
+	(elf_x86_64_size_dynamic_sections): Likewise.
+
+2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
+
+	PR binutils/15834
+	* bfdio.c: Fix typos.
+	* elf32-spu.c: Likewise.
+	* elfnn-aarch64.c: Likewise.
+
+2013-08-21  Tristan Gingold  <gingold@adacore.com>
+
+	* coff-rs6000.c (_bfd_xcoff_sizeof_headers): Also count
+	.ovrflo sections.
+	* coffcode.h (coff_compute_section_file_positions): Force
+	match between file offset and vma offset.
+
+2013-08-21  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_merge_symbol): Set *poldbfd, *poldweak,
+	and *poldalignment before exiting when !relocs_compatible.
+
+2013-08-21  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_define_linkage_sym): Don't set STV_INTERNAL
+	symbols to STV_HIDDEN.
+
+2013-08-14  John Tytgat  <john@bass-software.com>
+
+	PR ld/15787
+	* elf32-arm.c (elf32_arm_final_link_relocate): Use origin of output
+	segment containing the relocating symbol instead of assuming 0 for
+	sb group relocations.
+
+2013-08-09  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-rl78.c (rl78_elf_merge_private_bfd_data): Complain if G10
+	flag bits do not match.
+	(rl78_elf_print_private_bfd_data): Describe G10 flag.
+
+2013-08-05  John Tytgat  <john@bass-software.com>
+
+	* po/BLD-POTFILES.in: Regenerate.
+	* po/SRC-POTFILES.in: Likewise.
+
+2013-07-31  John Tytgat  <john@bass-software.com>
+
+	PR ld/15787
+	* elf32-arm.c (elf32_arm_final_link_relocate): Base SB on the
+	output section VMA.
+
+2013-07-28  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf64-hppa.c (elf64_hppa_finish_dynamic_sections)
+	<DT_HP_LOAD_MAP>: Return unsuccessfully if there's no `.data'
+	section.
+
+2013-07-27  Andrew Pinski  <apinski@cavium.com>
+
+	* elfnn-aarch64.c (elfNN_aarch64_check_relocs):
+	Use the correct alignment for
+	_bfd_elf_make_dynamic_reloc_section for ILP32.
+
+2013-07-27  Andrew Pinski  <apinski@cavium.com>
+
+	* elfnn-aarch64.c (elfNN_aarch64_howto_from_bfd_reloc): Handle
+	BFD_RELOC_AARCH64_NONE explicitly.
+
+2013-07-27  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_finish_dynamic_sections): Don't set GOT's
+	entry size if there is no ELF section data.
+
+2013-07-27  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_check_relocs) <R_VAX_GOT32, R_VAX_PLT32>:
+	Don't check symbol visibility here.  Remove a check already
+	asserted for.
+	(elf_vax_instantiate_got_entries): Use SYMBOL_REFERENCES_LOCAL
+	instead of individual checks.
+	(elf_vax_relocate_section) <R_VAX_GOT32, R_VAX_PLT32>: Only
+	check the offset to decide if produce a GOT or PLT entry.
+	Remove redundant assertions.  Remove code to produce GOT entries
+	for local symbols.  Remove a duplicate comment and add a comment
+	on GOT relocations.
+	(elf_vax_finish_dynamic_symbol): Remove code to produce RELATIVE
+	dynamic relocs.
+
+2013-07-27  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_always_size_sections): Correct a comment
+	typo.
+
+2013-07-27  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_discard_got_entries): New function.
+	(elf_vax_always_size_sections): Likewise.
+	(elf_vax_size_dynamic_sections): Remove code moved to
+	elf_vax_always_size_sections.  Make comment on
+	elf_vax_instantiate_got_entries match reality.
+	(elf_vax_instantiate_got_entries): Assert that rather than check
+	if dynobj is null.  Don't check for dynamic_sections_created.
+	Make function description match reality.
+	(elf_backend_always_size_sections): New macro.
+
+2013-07-25  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (struct ppc64_elf_obj_tdata): Replace opd_relocs
+	with a union.
+	(opd_entry_value): Cache .opd section contents.
+	(ppc64_elf_relocate_section): Adjust.
+
+2013-07-25  Alan Modra  <amodra@gmail.com>
+
+	PR ld/15762
+	PR ld/12761
+	* elflink.c (elf_link_add_object_symbols): Correct test in
+	last patch.  Remove unnecessary code.
+
+2013-07-24  Tristan Gingold  <gingold@adacore.com>
+
+	* coff-rs6000.c (xcoff_howto_table): Fix masks and pc_relative for
+	R_RBR.  Add numbers in comments.
+	(_bfd_xcoff_reloc_type_lookup): Handle BFD_RELOC_PPC_B16.
+	* coff64-rs6000.c: Likewise.
+
+2013-07-20  Alan Modra  <amodra@gmail.com>
+
+	PR ld/15762
+	PR ld/12761
+	* elflink.c (elf_link_add_object_symbols): Don't clobber
+	.gnu.warning.symbol sections when shared.
+
+2013-07-19  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-rx.c (rx_elf_relocate_section): Fix typo: move
+	saw_subtract from R_RX_OPdiv to R_RX_OPneg.
+
+2013-07-18  Travis Snoozy  <quandary@remstate.com>
+
+	PR ld/15721
+	* elf32-msp430.c (R_MSP430_10_PCREL): Use 10-bit source and
+	destination masks.
+	* R_MSP430_2X_PCREL: Likewise.
+	* R_MSP430X_10_PCREL: Likewise.
+	* R_MSP430X_2X_PCREL: Likewise.
+
+2013-07-18  Terry Guo  <terry.guo@arm.com>
+
+	* elf32-arm.c (arm_type_of_stub): Don't use ST_BRANCH_TO_ARM for
+	thumb only targets.
+	(elf32_arm_final_link_relocate): Likewise.
+
+2013-07-18  Bill Neubauer  <wcn@google.com>
+
+	* mach-o.c (mach_o_section_name_xlat dw): Add entry for
+	.debug_gdb_scripts
+
+2013-07-18  Roland McGrath  <mcgrathr@google.com>
+
+	* elf32-arm.c (elf32_arm_stub_long_branch_arm_nacl): New variable.
+	(elf32_arm_stub_long_branch_arm_nacl_pic): New variable.
+	(arm_build_one_stub): Increase MAXRELOCS to 3.
+	(arm_type_of_stub): Use them if GLOBALS->nacl_p.
+	(struct elf32_arm_link_hash_table): Give add_stub_section member's
+	pointee type a third argument.
+	(elf32_arm_create_or_find_stub_sec): Update caller.
+	(elf32_arm_size_stubs): Update argument type.
+	* bfd-in.h (elf32_arm_size_stubs): Update decl.
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+
+2013-07-15  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (mips_elf_merge_obj_attributes): Replace hardcoded
+	magic numbers with enum values.
+
+2013-07-12  Roland McGrath  <mcgrathr@google.com>
+
+	* reloc.c: Add BFD_RELOC_390_PC12DBL, BFD_RELOC_390_PLT12DBL,
+	BFD_RELOC_390_PC24DBL, BFD_RELOC_390_PLT24DBL (should have
+	been added here with 2013-07-05 elf32-s390.c change).
+	* bfd-in2.h: Regenerate (no-op).
+	* libbfd.h: Regenerate (no-op).
+
+2013-07-12  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Handle
+	EF_MIPS_NAN2008.
+	(_bfd_mips_elf_print_private_bfd_data): Likewise.
+
+2013-07-09  Tristan Gingold  <gingold@adacore.com>
+
+	* vms-alpha.c (struct vms_private_data_struct): Remove
+	flag_hash_long_names and flag_show_after_trunc.
+	(hash_string): Remove.
+	(_bfd_vms_length_hash_symbol): Remove.
+	(alpha_vms_write_exec): Remove call to _bfd_vms_length_hash_symbol.
+	(_bfd_vms_write_egsd): Likewise.  Rewrite condition.
+	(_bfd_vms_write_ehdr): Remove code that set removed flags.
+	(_bfd_vms_write_etir): Remove call to _bfd_vms_length_hash_symbol.
+	(vms_bfd_is_local_label_name): Remove trace call.
+
+2013-07-09  Tristan Gingold  <gingold@adacore.com>
+
+	* hosts/alphavms.h: Include config.h and ansidecl.h, remove useless
+	macros.
+	* configure.com: Adjust to match changes in configure.
+	* makefile.vms (OBJS): Update list.
+
+2013-07-05  Tristan Gingold  <gingold@adacore.com>
+
+	* coffcode.h (coff_write_object_contents): Use ".ovrflo" name for
+	overflow sections.
+
+2013-07-05  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf32-s390.c: Add new relocation definitions R_390_PC12DBL,
+	R_390_PLT12DBL, R_390_PC24DBL, and R_390_PLT24DBL.
+	(elf_s390_reloc_type_lookup, elf_s390_check_relocs)
+	(elf_s390_gc_sweep_hook, elf_s390_relocate_section): Support new
+	relocations.
+	* elf64-s390.c: See elf32-s390.c
+	* bfd-in2.h: Add new relocs to enum bfd_reloc_code_real.
+	* libbfd.h: Add new reloc strings.
+
+2013-07-03  Marcus Shawcroft  <marcus.shawcroft@arm.com>
+
+	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Reorder case
+	values.
+	(elfNN_aarch64_relocate_section): Likewise.
+	(elfNN_aarch64_gc_sweep_hook): Likewise.
+	(elfNN_aarch64_check_relocs): Likewise.
+
+2013-07-03  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't hide .TOC.
+	when relocatable.  Don't change root.type or type here.
+	(ppc64_elf_set_toc): Set type of .TOC. to STT_OBJECT.
+
+2013-07-03  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (struct ppc_stub_hash_entry): Delete "addend".
+	(ppc64_elf_size_stubs): Don't set "addend".
+	(ppc64_elf_relocate_section): Don't allow calls via
+	toc-adjusting stubs without a following nop even in an
+	executable, except for self-calls and both libc_start_main
+	and .libc_start_main.
+
+2013-07-03  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_func_desc_adjust): Hide ".TOC.".
+
+2013-07-02  Tristan Gingold  <gingold@adacore.com>
+
+	* coff-rs6000.c (xcoff_find_nearest_line_discriminator): Add missing
+	line.
+
+2013-07-02  Tristan Gingold  <gingold@adacore.com>
+
+	* vms-alpha.c (_bfd_generic_find_nearest_line_discriminator): Define.
+	(_bfd_vms_find_nearest_line_discriminator): New function.
+
+2013-07-02  Tristan Gingold  <gingold@adacore.com>
+
+	* coff-rs6000.c (xcoff_create_csect_from_smclas): Handle more smclas.
+
+2013-07-02  Tristan Gingold  <gingold@adacore.com>
+
+	* coff-rs6000.c (xcoff_find_nearest_line_discriminator): New function.
+	(rs6000coff_vec): Reference it.
+
+2013-07-02  Marcus Shawcroft  <marcus.shawcroft@arm.com>
+
+	* elfnn-aarch64.c (aarch64_elf_create_got_section): New.
+	(elfNN_aarch64_check_relocs): Use aarch64_elf_create_got_section.
+	(elfNN_aarch64_create_dynamic_sections): Do not define
+	_GLOBAL_OFFSET_TABLE_; call aarch64_elf_create_got_section.
+
+2013-07-02  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_relocate_section): Set "relocation" for
+	.TOC. after relocatable check.
+
+2013-07-01  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.h (ppc64_elf_toc): Delete.
+	(ppc64_elf_set_toc): Declare.
+	* elf64-ppc.c (ppc64_elf_toc_reloc): Replace call to ppc64_elf_toc
+	with call the ppc64_elf_set_toc.
+	(ppc64_elf_toc_ha_reloc, ppc64_elf_toc64_reloc): Likewise.
+	(ppc64_elf_start_multitoc_partition): Likewise.
+	(struct ppc_link_hash_table): Delete dot_toc_dot.  Replace all uses
+	with elf.hgot.
+	(ppc64_elf_process_dot_syms): Don't make a fake function descriptor
+	for ".TOC.".
+	(ppc64_elf_check_relocs): Mark sections with a reference to .TOC.
+	as needing a toc pointer.
+	(ppc64_elf_size_stubs): Don't set dot_toc_dot here.
+	(ppc64_elf_set_toc): Rename from ppc64_elf_toc.  Add info param.
+	Set elf.hgot value.
+
+2013-06-28  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/15685
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Handle
+	R_X86_64_DTPOFF64.
+
+2013-06-28  Nick Clifton  <nickc@redhat.com>
+
+	PR ld/15302
+	* elf32-arm.c (allocate_dynrelocs_for_symbol): Revert previous patch.
+
+2013-06-27  Marcus Shawcroft  <marcus.shawcroft@arm.com>
+
+	* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Reserve one slot
+	in sgot.
+	(elfNN_aarch64_finish_dynamic_sections): Place the &_DYNAMIC reference
+	in sgot[0] rather than sgotplt[0].
+
+2013-06-26  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* Makefile.am (elf32-aarch64.c): Add a #line cpp directive at the
+	beginning of the generated file.
+	(elf64-aarch64.c): Likewise.
+	* Makefile.in: Re-generated.
+
+2013-06-26  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* Makefile.am (BFD64_BACKENDS): Add elfxx-aarch64.c.
+	(BFD64_BACKENDS_CFILES): Add elfxx-aarch64.lo.
+	* Makefile.in: Re-generated.
+	* configure.in (bfd_elf64_bigaarch64_vec): Add elfxx-aarch64.lo.
+	(bfd_elf64_littleaarch64_vec): Likewise.
+	(bfd_elf32_bigaarch64_vec): Likewise.
+	(bfd_elf32_littleaarch64_vec): Likewise.
+	* configure: Re-generated.
+	* elfxx-aarch64.c: New file; split from elf64-aarch64.c.
+	* elfxx-aarch64.h: New file.
+	* elfnn-aarch64.c: Include "elfxx-aarch64.h"; move the following
+	stuff to elfxx-aarch64.c.
+	(bfd_elf_aarch64_put_addend): Removed.
+	(PG_OFFSET, PG): Likewise.
+	(elfNN_aarch64_small_plt0_entry): Support ELF32.
+	(elfNN_aarch64_tlsdesc_small_plt_entry): Likewise.
+	(elf64_aarch64_grok_prstatus): Removed.
+	(elf_backend_grok_prstatus): Removed.
+	(insn32): Likewise.
+	(aarch64_unsigned_overflow): Likewise.
+	(aarch64_signed_overflow): Likewise.
+	(aarch64_resolve_relocation): Likewise.
+	(MASK): Likewise.
+	(decode_branch_ofs_26): Likewise.
+	(decode_cond_branch_ofs_19): Likewise.
+	(decode_ld_lit_ofs_19): Likewise.
+	(decode_tst_branch_ofs_14): Likewise.
+	(decode_movw_imm): Likewise.
+	(decode_adr_imm): Likewise.
+	(decode_add_imm): Likewise.
+	(reencode_branch_ofs_26): Likewise.
+	(reencode_cond_branch_ofs_19): Likewise.
+	(reencode_ld_lit_ofs_19): Likewise.
+	(reencode_tst_branch_ofs_14): Likewise.
+	(reencode_movw_imm): Likewise.
+	(reencode_adr_imm): Likewise.
+	(reencode_ldst_pos_imm): Likewise.
+	(reencode_add_imm): Likewise.
+	(reencode_movzn_to_movz): Likewise.
+	(reencode_movzn_to_movn): Likewise.
+	(aarch64_relocate): Update to call the new function names in
+	elfxx-aarch64.c.
+	(aarch64_calculate_got_entry_vma): Likewise.
+	(elfNN_aarch64_final_link_relocate): Likewise.
+	(elf64_aarch64_update_plt_entry): Likewise; change the type of the
+	parameter 'r_type' to bfd_reloc_code_real_type; rename to ...
+	(elf_aarch64_update_plt_entry): ... this.
+	(elfNN_aarch64_create_small_pltn_entry): Update.
+	(elfNN_aarch64_init_small_plt0_entry): Remove plt_got_base; add
+	bfd_vma plt_got_2nd_ent; update to call elf_aarch64_update_plt_entry.
+	(elfNN_aarch64_finish_dynamic_sections): Add plt_entry; update to
+	call elf_aarch64_update_plt_entry.
+
+2013-06-26  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* bfd-in2.h: Re-generated.
+	* elfnn-aarch64.c (HOWTO64, HOWTO32): New define.
+	(IS_AARCH64_TLS_RELOC): Change to be based on the
+	bfd reloc enumerators.
+	(IS_AARCH64_TLSDESC_RELOC): Likewise.
+	(PG, PG_OFFSET): Cast literal to bfd_vma.
+	(elf64_aarch64_howto_table): Removed.
+	(elf64_aarch64_howto_dynrelocs): Removed.
+	(elf64_aarch64_tls_howto_table): Removed.
+	(elf64_aarch64_tlsdesc_howto_table): Removed.
+	(elfNN_aarch64_howto_table): New table to host all howto entires..
+	(R_AARCH64_*): Replaced by AARCH64_R (*) and AARCH64_R_STR (*).
+	(elfNN_aarch64_bfd_reloc_from_howto): New function.
+	(elfNN_aarch64_bfd_reloc_from_type): Ditto.
+	(struct elf_aarch64_reloc_map): New.
+	(elf_aarch64_reloc_map): New table.
+	(elfNN_aarch64_howto_from_bfd_reloc): New function.
+	(elfNN_aarch64_howto_from_type): Update to look up the new table
+	elfNN_aarch64_howto_table.
+	(struct elf64_aarch64_reloc_map): Remove.
+	(elf64_aarch64_reloc_map): Remove.
+	(elfNN_aarch64_reloc_type_lookup): Change to call
+	elfNN_aarch64_howto_from_bfd_reloc.
+	(elfNN_aarch64_reloc_name_lookup): Change to look up the new table
+	elfNN_aarch64_howto_table.
+	(aarch64_resolve_relocation): Refactor to switch on the bfd
+	reloc enumerators.
+	(bfd_elf_aarch64_put_addend): Likewise.
+	(elfNN_aarch64_final_link_relocate): Likewise.
+	(aarch64_tls_transition_without_check): Likewise.
+	(aarch64_reloc_got_type): Likewise.
+	(aarch64_can_relax_tls): Likewise.
+	(aarch64_tls_transition): Likewise.
+	(elfNN_aarch64_tls_relax): Likewise.
+	(elfNN_aarch64_final_link_relocate): Likewise.
+	(elfNN_aarch64_relocate_section): Likewise.
+	(elfNN_aarch64_gc_sweep_hook): Likewise.
+	(elfNN_aarch64_check_relocs): Likewise.
+	(aarch64_tls_transition): Change to return a bfd reloc enumerator.
+	* libbfd.h: Re-generated.
+	* reloc.c: Re-order the AArch64 bfd reloc enumerators.
+	(BFD_RELOC_AARCH64_RELOC_START)
+	(BFD_RELOC_AARCH64_RELOC_END)
+	(BFD_RELOC_AARCH64_LD_GOT_LO12_NC)
+	(BFD_RELOC_AARCH64_LD32_GOT_LO12_NC)
+	(BFD_RELOC_AARCH64_TLSDESC_LD_LO12_NC)
+	(BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC)
+	(BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC)
+	(BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC)
+	(BFD_RELOC_AARCH64_IRELATIVE): New relocs.
+
+2013-06-26  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* Makefile.am (BFD64_BACKENDS): Add elf32-aarch64.lo.
+	(BUILD_CFILES): Add elf32-aarch64.c.
+	(elf32-aarch64.c): New rule for generating from elfnn-aarch64.c.
+	* Makefile.in: Re-generated.
+	* archures.c (bfd_mach_aarch64_ilp32): New define.
+	* bfd-in.h (bfd_elf32_aarch64_init_maps): New declaration.
+	(bfd_elf32_aarch64_set_options): Ditto.
+	(elf32_aarch64_setup_section_lists): Ditto.
+	(elf32_aarch64_next_input_section): Ditto.
+	(elf32_aarch64_size_stubs): Ditto.
+	(elf32_aarch64_build_stubs): Ditto.
+	* bfd-in2.h: Re-generated.
+	* config.bfd (aarch64-*-elf): Add bfd_elf32_littleaarch64_vec
+	and bfd_elf32_bigaarch64_vec.
+	(aarch64-*-linux*): Likewise.
+	(aarch64_be-*-elf): Likewise.
+	(aarch64_be-*-linux*): Likewise.
+	* configure.in (bfd_elf32_bigaarch64_vec)
+	(bfd_elf32_littleaarch64_vec): New.
+	* configure: Re-generated.
+	* cpu-aarch64.c (compatible): Don't allow mixing ilp32 objects with
+	lp64 ones.
+	(bfd_aarch64_arch_ilp32): New.
+	(bfd_aarch64_arch): Link to bfd_aarch64_arch_ilp32.
+	* elfnn-aarch64.c (ARCH_SIZE): New define.
+	(AARCH64_R, AARCH64_R_STR, LOG_FILE_ALIGN): New defines.
+	(GOT_ENTRY_SIZE): Re-define as (ARCH_SIZE / 8).
+	(elf64_aarch64_*): Rename to elfNN_aarch64_*.
+	(ELF64_R_*): Rename to ELFNN_R_*.
+	Plus other paramaterization.
+	* targets.c (bfd_elf32_bigaarch64_vec, bfd_elf32_littleaarch64_vec):
+	New declarations.
+	(_bfd_target_vector): Add bfd_elf32_bigaarch64_vec and
+	bfd_elf32_littleaarch64_vec.
+
+2013-06-26  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* Makefile.am (BFD64_BACKENDS_CFILES): Remove elf64-aarch64.c.
+	(BUILD_CFILES): Add elf64-aarch64.c.
+	(elf64-aarch64.c): New rule for generating from elfnn-aarch64.c.
+	* Makefile.in: Re-generated.
+	* elf64-aarch64.c: Rename to ...
+	* elfnn-aarch64.c: ... this.
+
+2013-06-25  Maciej W. Rozycki  <macro@codesourcery.com>
+            Paul Brook  <paul@codesourcery.com>
+
+	* elfxx-mips.h (_bfd_mips_elf_insn32): New prototype.
+	* elfxx-mips.c (mips_elf_link_hash_table): Add insn32 member.
+	(STUB_MOVE32_MICROMIPS, STUB_JALR32_MICROMIPS): New macros.
+	(MICROMIPS_INSN32_FUNCTION_STUB_NORMAL_SIZE): Likewise.
+	(MICROMIPS_INSN32_FUNCTION_STUB_BIG_SIZE): Likewise.
+	(micromips_insn32_o32_exec_plt0_entry): New variable.
+	(micromips_insn32_o32_exec_plt_entry): Likewise.
+	(_bfd_mips_elf_adjust_dynamic_symbol): Handle insn32 mode.
+	(mips_elf_estimate_stub_size): Likewise.
+	(_bfd_mips_elf_size_dynamic_sections): Likewise.
+	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
+	(mips_finish_exec_plt): Likewise.
+	(_bfd_mips_elf_relax_section): Likewise.
+	(_bfd_mips_elf_insn32): New function.
+	(_bfd_mips_elf_get_synthetic_symtab): Handle insn32 PLT.
+
+2013-06-24  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.h (_bfd_mips_elf_get_synthetic_symtab): New
+	prototype.
+	* elf32-mips.c (elf_backend_plt_sym_val): Remove macro.
+	(bfd_elf32_get_synthetic_symtab): New macro.
+	* elfxx-mips.c (plt_entry): New structure.
+	(mips_elf_link_hash_entry): Add use_plt_entry member.
+	(mips_elf_link_hash_table): Rename plt_entry_size member to
+	plt_mips_entry_size.  Add plt_comp_entry_size, plt_mips_offset,
+	plt_comp_offset, plt_got_index entries and plt_header_is_comp
+	members.
+	(STUB_LW_MICROMIPS, STUB_MOVE_MICROMIPS): New macros.
+	(STUB_LUI_MICROMIPS, STUB_JALR_MICROMIPS): Likewise.
+	(STUB_ORI_MICROMIPS, STUB_LI16U_MICROMIPS): Likewise.
+	(STUB_LI16S_MICROMIPS): Likewise.
+	(MICROMIPS_FUNCTION_STUB_NORMAL_SIZE): Likewise.
+	(MICROMIPS_FUNCTION_STUB_BIG_SIZE): Likewise.
+	(micromips_o32_exec_plt0_entry): New variable.
+	(mips16_o32_exec_plt_entry): Likewise.
+	(micromips_o32_exec_plt_entry): Likewise.
+	(mips_elf_link_hash_newfunc): Initialize use_plt_entry.
+	(mips_elf_output_extsym): Update to use gotplt_union's plist
+	member rather than offset.
+	(mips_elf_gotplt_index): Likewise.  Remove the VxWorks
+	restriction.  Use MIPS_ELF_GOT_SIZE to calculate GOT address.
+	(mips_elf_count_got_symbols): Update to use gotplt_union's plist
+	member rather than offset.
+	(mips_elf_calculate_relocation): Handle MIPS16/microMIPS PLT
+	entries.
+	(_bfd_mips_elf_create_dynamic_sections): Don't set PLT sizes
+	here.
+	(mips_elf_make_plt_record): New function.
+	(_bfd_mips_elf_check_relocs): Update comment.  Record occurences
+	of JAL relocations that might need a PLT entry.
+	(_bfd_mips_elf_adjust_dynamic_symbol): Update to use
+	gotplt_union's plist member rather than offset.  Set individual
+	PLT entry sizes here.  Handle MIPS16/microMIPS PLT entries.
+	Don't set the symbol's value in the symbol table for PLT
+	references here.  Don't set the PLT or PLT GOT section sizes
+	here.
+	(mips_elf_estimate_stub_size): Handle microMIPS stubs.
+	(mips_elf_allocate_lazy_stub): Likewise.
+	(mips_elf_lay_out_lazy_stubs): Likewise.  Define a _MIPS_STUBS_
+	magic symbol.
+	(mips_elf_set_plt_sym_value): New function.
+	(_bfd_mips_elf_size_dynamic_sections): Set PLT header size and
+	PLT and PLT GOT section sizes here.  Set the symbol values in
+	the symbol table for PLT references here.  Handle microMIPS
+	annotation of the _PROCEDURE_LINKAGE_TABLE_ magic symbol.
+	(_bfd_mips_elf_finish_dynamic_symbol): Update to use
+	gotplt_union's plist member rather than offset.  Handle
+	MIPS16/microMIPS PLT entries.  Handle microMIPS stubs.
+	(_bfd_mips_vxworks_finish_dynamic_symbol): Update to use
+	gotplt_union's plist member rather than offset.  Use
+	MIPS_ELF_GOT_SIZE to calculate GOT address.
+	(mips_finish_exec_plt): Handle microMIPS PLT.  Return status.
+	(_bfd_mips_elf_finish_dynamic_sections): Handle result from
+	mips_finish_exec_plt.
+	(_bfd_mips_elf_link_hash_table_create): Update to use
+	gotplt_union's plist member rather than offset.
+	(_bfd_mips_elf_get_synthetic_symtab): New function.
+
+2013-06-24  Wawa  <caojinyu@msn.com>
+
+	PR 15657
+	* hash.c (_bfd_stringtab_add): Copy the string if COPY is true.
+
+2013-06-23  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Move MIPS ELF
+	files to...
+	(BFD64_BACKENDS, BFD64_BACKENDS_CFILES): ...here.
+	* Makefile.in: Regenerate.
+	* config.bfd: Enclose all MIPS ELF targets in #ifdef BFD64.
+	Set want64 to true for them at the end.
+	* targets.c (_bfd_target_vector): Protect MIPS ELF targets with
+	#ifdef BFD64.
+
+2013-06-22  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* elf32-nios2.c (nios2_elf32_finish_dynamic_sections): Don't
+	set sh_entsize for PLT section.
+
+2013-06-20  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* bfd-in.h (bfd_elf64_aarch64_set_options): Add 'extern'.
+	* bfd-in2.h: Re-generated.
+	* elf64-aarch64.c (RELOC_SECTION): Removed.
+	(SWAP_RELOC_IN, SWAP_RELOC_OUT): Ditto.
+	(AARCH64_ELF_OS_ABI_VERSION): Ditto.
+	(elf64_aarch64_link_hash_traverse): Ditto.
+	(elf64_aarch64_size_stubs): Change 'Aarch64' to 'AArch64' in the
+	comment.
+
+2013-06-19  Will Newton  <will.newton@linaro.org>
+
+	* configure: Regenerated.
+	* configure.in: Remove aarch64 dependency on elf-ifunc.c.
+	* elf64-aarch64.c: Remove objalloc.h include.
+	(elf64_aarch64_howto_dynrelocs): Remove R_AARCH64_IRELATIVE howto.
+	(struct elf64_aarch64_link_hash_table): Remove ifunc related
+	members. (elf_aarch64_local_htab_hash): Remove function.
+	(elf_aarch64_local_htab_eq): Remove function.
+	(elf_aarch64_get_local_sym_hash): Remove function.
+	(elf64_aarch64_link_hash_table_create): Remove local hash
+	table initialization.
+	(elf64_aarch64_final_link_relocate): Remove sym argument and
+	handling of ifunc symbols.
+	(elf64_aarch64_relocate_section): Don't pass sym argument to
+	elf64_aarch64_final_link_relocate.
+	(elf64_aarch64_gc_sweep_hook): Remove handling of ifunc symbols.
+	(elf64_aarch64_adjust_dynamic_symbol): Likewise.
+	(elf64_aarch64_check_relocs): Likewise.
+	(elf64_aarch64_post_process_headers): Remove call to
+	_bfd_elf_set_osabi.
+	(elf64_aarch64_is_function_type): New function.
+	(elf64_aarch64_allocate_dynrelocs): Remove handling of ifunc
+	symbols. (elf_aarch64_allocate_local_dynrelocs): Remove function.
+	(elf64_aarch64_size_dynamic_sections): Remove call to
+	elf_aarch64_allocate_local_dynrelocs.
+	(elf64_aarch64_create_small_pltn_entry): Remove info argument.
+	Remove creation of R_AARCH64_IRELATIVE dynamic relocs.
+	(elf64_aarch64_finish_dynamic_symbol): Remove handling of ifunc
+	symbols. (elf_aarch64_finish_local_dynamic_symbol): Remove
+	function. (elf64_aarch64_finish_dynamic_sections): Remove call to
+	elf_aarch64_finish_local_dynamic_symbol.
+	(elf64_aarch64_add_symbol_hook): Remove function.
+
+2013-06-14  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* elf64-aarch64.c (elf64_aarch64_final_link_relocate): Call
+	aarch64_resolve_relocation and bfd_elf_aarch64_put_addend to
+	handle the relocations of R_AARCH64_JUMP26, R_AARCH64_CALL26,
+	R_AARCH64_LD64_GOT_LO12_NC, R_AARCH64_ADR_GOT_PAGE and
+	R_AARCH64_GOT_LD_PREL19.
+
+2013-06-13  Terry Guo  <terry.guo@arm.com>
+
+	PR ld/15302
+	* elf32-arm.c (allocate_dynrelocs_for_symbol): Transform
+	ST_BRANCH_TO_ARM into ST_BRANCH_TO_THUMB if the target only
+	supports thumb instructions.
+
+2013-06-11  DJ Delorie  <dj@redhat.com>
+
+	* elf32-rl78.c (rl78_elf_relocate_section): Fix OPsub math.
+
+2013-06-11  Will Newton  <will.newton@linaro.org>
+
+	* elf64-aarch64.c (elf_aarch64_get_local_sym_hash): Use
+	ELF64_R_SYM instead of ELF32_R_SYM.
+
+2013-06-11  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-rl78.c (rl78_elf_finish_dynamic_sections): Onlly run
+	checks if the dynamic sections have been created and relaxation
+	has not been performed.
+
+2013-06-07  Will Newton  <will.newton@linaro.org>
+
+	* configure: Regenerate.
+	* configure.in: Build elf-ifunc.o for AArch64.
+	* elf64-aarch64.c: Include objalloc.h.
+	(elf64_aarch64_howto_dynrelocs): Add R_AARCH64_IRELATIVE howto.
+	(struct elf64_aarch64_link_hash_table): Add members for handling
+	R_AARCH64_IRELATIVE relocations.
+	(elf_aarch64_local_htab_hash): New function.
+	(elf_aarch64_local_htab_eq): New function.
+	(elf_aarch64_get_local_sym_hash): New function.
+	(elf64_aarch64_link_hash_table_create): Initialize local STT_GNU_IFUNC
+	symbol hash.
+	(elf64_aarch64_hash_table_free): Free local STT_GNU_IFUNC symbol hash.
+	(elf64_aarch64_final_link_relocate): Add sym argument.  Add support
+	for handling STT_GNU_IFUNC symbols.
+	(elf64_aarch64_gc_sweep_hook): Add support for garbage collecting
+	references to STT_GNU_IFUNC symbols.
+	(elf64_aarch64_adjust_dynamic_symbol): Add support for handling
+	STT_GNU_IFUNC symbols.
+	(elf64_aarch64_check_relocs): Add support for handling STT_GNU_IFUNC
+	symbols.  Ensure we don't increase plt.refcount from -1 to 0.
+	(elf64_aarch64_post_process_headers): Call _bfd_elf_set_osabi.
+	(elf64_aarch64_is_function_type): Remove function.
+	(elf64_aarch64_allocate_dynrelocs): Call
+	_bfd_elf_allocate_ifunc_dyn_relocs for STT_GNU_IFUNC symbols.
+	(elf_aarch64_allocate_local_dynrelocs): New function.
+	(elf64_aarch64_size_dynamic_sections): Call
+	elf_aarch64_allocate_local_dynrelocs.  Initialize next_irelative_index.
+	(elf64_aarch64_create_small_pltn_entry): Add info argument.
+	Add support for creating .iplt entries for STT_GNU_IFUNC symbols.
+	(elf64_aarch64_finish_dynamic_symbol): Add support for handling
+	STT_GNU_IFUNC symbols and .iplt.
+	(elf_aarch64_finish_local_dynamic_symbol): New function.
+	(elf64_aarch64_finish_dynamic_sections): Call
+	elf_aarch64_finish_local_dynamic_symbol.
+	(elf64_aarch64_add_symbol_hook): New function.
+
+2013-06-03  Alan Modra  <amodra@gmail.com>
+
+	* syms.c (_bfd_stab_section_find_nearest_line): Add last_str
+	var.  Use it with last_stab.
+
+2013-05-30  Paul Brook  <paul@codesourcery.com>
+
+	* bfd-in2.h: Regenerate.
+	* elf32-mips.c (elf_mips_eh_howto): New.
+	(bfd_elf32_bfd_reloc_type_lookup ): Support BFD_RELOC_MIPS_EH.
+	(bfd_elf32_bfd_reloc_name_lookup): Likewise.
+	(mips_elf32_rtype_to_howto): Support R_MIPS_EH.
+	* elf64-mips.c (elf_mips_eh_howto): New.
+	(bfd_elf64_bfd_reloc_type_lookup): Support BFD_RELOC_MIPS_EH.
+	(bfd_elf64_bfd_reloc_name_lookup): Likewise.
+	(mips_elf64_rtype_to_howto): Support R_MIPS_EH.
+	* libbfd.h: Regenerate.
+	* reloc.c (BFD_RELOC_MIPS_EH): New.
+
+2013-05-29  Nick Clifton  <nickc@redhat.com>
+
+	* dwarf2.c (struct dwarf2_debug): Add fields for handling
+	alternate debug info source.
+	(dwarf_debug_sections): Add entries for alternate .debug_str and
+	.debug_info sections.
+	(dwarf_debug_section_enum): Likewise.
+	(read_alt_indirect_string): New function.  Handles a
+	DW_FORM_GNU_strp_alt attribute.
+	(read_alt_indirect_ref): New function.  Handles a
+	DW_FORM_GNU_ref_alt attribute.
+	(read_attribute_value): Process DW_FORM_GNU_ref_alt and
+	DW_FORM_GNU_strp_alt.
+	(find_abstract_instance_name): Handle DW_FORM_GNU_ref_alt
+	attributes.
+	(_bfd_dwarf2_cleanup_debug_info): Free alternate debug info
+	sources.
+	* opncls.c (GNU_DEBUGALTLINK): Define.
+	(bfd_get_alt_debug_link_info): New function.
+	(separate_alt_debug_file_exists): New function.
+	(find_separate_debug_file): Add parameters for fetch and check
+	functions.
+	(bfd_follow_gnu_debugaltlink): New function.
+	* bfd-in2.h: Regenerate.
+
+2013-05-28  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* reloc.c (BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE): Rename to ...
+	(BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21): ... this.
+	(BFD_RELOC_AARCH64_TLSDESC_LD64_PREL19): Rename to ...
+	(BFD_RELOC_AARCH64_TLSDESC_LD_PREL19): ...  this.
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+	* elf64-aarch64.c (IS_AARCH64_TLSDESC_RELOC): Update to use
+	the correct names.
+	(elf64_aarch64_tlsdesc_howto_table): Likewise.
+	(elf64_aarch64_reloc_map): Likewise.
+	(aarch64_resolve_relocation): Likewise.
+	(bfd_elf_aarch64_put_addend): Likewise.
+	(aarch64_tls_transition_without_check): Likewise.
+	(aarch64_reloc_got_type): Likewise.
+	(elf64_aarch64_final_link_relocate): Likewise.
+	(elf64_aarch64_tls_relax): Likewise.
+	(elf64_aarch64_relocate_section): Likewise.
+	(elf64_aarch64_gc_sweep_hook): Likewise.
+	(elf64_aarch64_check_relocs): Likewise.
+
+2013-05-26  Mark Wielaard  <mjw@redhat.com>
+
+	* cache.c (BFD_CACHE_MAX_OPEN): Remove define.
+	(max_open_files): New static int initialized to zero.
+	(bfd_cache_max_open): New static function to set and return
+	max_open_files.
+	(bfd_cache_init): Use bfd_cache_max_open.
+	(bfd_open_file): Likewise.
+	* configure.in (AC_CHECK_HEADERS): Add sys/resource.h.
+	(AC_CHECK_FUNCS): Add getrlimit.
+	* configure: Regenerated.
+	* config.in: Likewise.
+	* sysdep.h: Check and include sys/resource.h for getrlimit.
+
+2013-05-23  Alan Modra  <amodra@gmail.com>
+
+	* format.c (bfd_check_format_matches): Don't match a target in
+	targ_selvecs if some other target is a better match.  If
+	targets implement match priority, fall back to the first of
+	the best matches.
+
+2013-05-22  Eric Herman  <eric@freesa.org>
+
+	PR binutils/15462
+	* elfxx-mips.c (_bfd_mips_elf_relocate_section): Warning fix.
+
+2013-05-22  Ralf Dreesen  <gamma@dreesen.net>
+
+	PR binutils/15474
+	* srec.c (srec_set_section_contents): Properly convert size
+	and offset to address when octets_per_byte is not unity.
+
+2013-05-20  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_instantiate_got_entries): Only set the
+	refcount member of the gotplt_union when resetting the reference
+	count.  Adjust comment.
+
+2013-05-20  Will Newton  <will.newton@linaro.org>
+
+	* elf64-aarch64.c (elf64_aarch64_link_hash_entry): Remove
+	relocs_copied member.
+	(elf64_aarch64_link_hash_newfunc): Remove initialization of
+	relocs_copied member.
+	(elf64_aarch64_copy_indirect_symbol): Remove code to copy
+	relocs_copied member.
+
+2013-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_adjust_dynamic_symbol): Convert K&R
+	function definition.
+
+2013-05-16  Cary Coutant  <ccoutant@google.com>
+
+	* ecoff.c (ecoff_link_check_archive_element): Add initializers for
+	external_ext_size and esize.
+
+2013-05-16  Tristan Gingold  <gingold@adacore.com>
+
+	* coff-rs6000.c (_bfd_xcoff_reloc_type_lookup): Handle BFD_RELOC_16.
+	* coff64-rs6000.c (xcoff64_reloc_type_lookup): Likewise.
+
+2013-05-15  Andreas Schwab  <schwab@suse.de>
+
+	* elf64-aarch64.c (elf_backend_default_execstack): Define to 0.
+
+2013-05-10  Joel Brobecker  <brobecker@adacore.com>
+
+	* coffcode.h (styp_to_sec_flags) [RS6000COFF_C]: Add handling
+	of STYP_EXCEPT, STYP_LOADER and STYP_TYPCHK sections.
+
+2013-05-09  Joel Brobecker  <brobecker@adacore.com>
+
+	* bfd.c (_bfd_default_error_handler): Replace use of putc
+	by fputc.  Add comment explaining why.
+
+2013-05-09  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (elf_link_add_object_symbols): Don't omit reading
+	of symbols when hashes already exist.
+
+2013-05-07  Will Newton  <will.newton@linaro.org>
+
+	* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Add a
+	plt_header_size argument for ports where it differs from
+	plt_entry_size.
+	* elf-bfd.h: Likewise.
+	* elf32-i386.c: Pass plt_header_size to
+	_bfd_elf_allocate_ifunc_dyn_relocs.
+	* elf64-x86-64.c: Likewise.
+
+2013-05-07  Will Newton  <will.newton@linaro.org>
+
+	* elf-ifunc.c (_bfd_elf_create_ifunc_dyn_reloc): Remove unused
+	function.
+	* elf-bfd.h: Likewise.
+
+2013-05-06  Paul Brook  <paul@codesourcery.com>
+
+	* elf64-mips.c (elf_mips_gnu_pcrel32): New.
+	(bfd_elf64_bfd_reloc_type_lookup, bfd_elf64_bfd_reloc_name_lookup,
+	mips_elf64_rtype_to_howto): Handle R_MIPS_PC32.
+	* elfn32-mips.c (elf_mips_gnu_pcrel32): New.
+	(bfd_elfn32_bfd_reloc_type_lookup, bfd_elfn32_bfd_reloc_name_lookup,
+	mips_elfn32_rtype_to_howto): Handle R_MIPS_PC32.
+
+2013-05-06  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (opd_entry_value): Handle case where symbol
+	hashes are not available.
+
+2013-05-06  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (elf_link_add_object_symbols): Don't save symbol
+	hashes around loading as-needed library.  Zero them on allocation,
+	and restore to initial all-zero state if library not needed.
+	Arrange to reuse hashes if we load library again later.
+
+2013-05-04  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elf32-mips.c (elf_mips_copy_howto, elf_mips_jump_slot_howto):
+	Use _bfd_mips_elf_generic_reloc instead of bfd_elf_generic_reloc.
+	* elfn32-mips.c: Likewise.
+	* elf64-mips.c: Likewise.
+
+2013-05-02  Nick Clifton  <nickc@redhat.com>
+
+	* archures.c: Add some more MSP430 machine numbers.
+	* config.bfd (msp430): Define targ_selvecs.
+	* configure.in: Add bfd_elf32_msp430_ti_vec.
+	* cpu-msp430.c: Add some more MSP430 machine numbers.
+	* elf32-msp430.c Add support for MSP430X relocations.
+	Add support for TI compiler generated relocations.
+	Add support for sym_diff relocations.
+	Add support for relaxing out of range short branches into long
+	branches.
+	Add support for MSP430 attribute section.
+	* reloc.c: Add MSP430X relocations.
+	* targets.c: Add bfd_elf32_msp430_ti_vec.
+	* bfd-in2.h: Regenerate.
+	* configure: Regenerate.
+	* libbfd.h: Regenerate.
+
+2013-05-01  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* config.bfd: Replace alpha*-*-linuxecoff* pattern with
+	alpha*-*-linux*ecoff*.
+
+2013-04-30  Olaf Flebbe  <o.flebbe@science-computing.de>
+
+	PR binutils/15417
+	* elflink.c (elf_link_add_object_symbols): Initialise 'idx' to
+	zero.
+
+2013-04-30  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (bfd_elf_record_link_assignment): Dont make
+	STV_INTERNAL symbols STV_HIDDEN.
+
+2013-04-29  Nick Clifton  <nickc@redhat.com>
+
+	* elflink.c (_bfd_elf_gc_mark_extra_sections): Remove mark from
+	fragmented .debug_line sections associated with unmarked code
+	sections.
+
+2013-04-29  Will Newton  <will.newton@linaro.org>
+
+	* elf32-arm.c (elf32_arm_populate_plt_entry): Call
+	elf32_arm_add_dynreloc when emitting R_ARM_IRELATIVE relocs.
+
+2013-04-29  Will Newton  <will.newton@linaro.org>
+
+	* elf64-aarch64.c (elf64_aarch64_check_relocs): Move relocation
+	error check up and add error message.
+
+2013-04-26  Will Newton  <will.newton@linaro.org>
+
+	* elf64-aarch64.c (elf64_aarch64_check_relocs): Remove dead code.
+
+2013-04-25  Alan Modra  <amodra@gmail.com>
+
+	* config.bfd: Add powerpc64le-linux.
+
+2013-04-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config.bfd (targ_selvecs): Add bfd_elf32_x86_64_vec for
+	x86_64-*-elf*.
+
+2013-04-24  Roland McGrath  <mcgrathr@google.com>
+
+	* elf32-arm.c (elf32_arm_allocate_plt_entry): If HTAB->nacl_p,
+	allocate space for PLT header even if IS_IPLT_ENTRY.
+	(arm_nacl_put_plt0): New function, broken out of ...
+	(elf32_arm_finish_dynamic_sections): ... here.  Call it.
+	If HTAB->nacl_p, set up the PLT header in .iplt too.
+	(elf32_arm_output_arch_local_syms): If HTAB->nacl_p, write
+	a mapping symbol for the start of .iplt too.
+
+2013-04-19  Luca Pizzamiglio  <luca.pizzamiglio@gmail.com>
+
+	* ecoff.c (_bfd_ecoff_sizeof_headers): Cast the return value of
+	BFD_ALIGN to int.
+	* elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Remove unused
+	variables.
+	* elf32-v850.c (v850_elf_relax_section): Redefine the type of 'i'
+	to bfd_vma.
+	* vms-alpha.c (evax_bfd_print_etir): Initialize sec_len.
+
+2013-04-22  Alan Modra  <amodra@gmail.com>
+
+	PR ld/15382
+	* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Don't multiply
+	sh_size or reloc_count adjustment by count.
+
+2013-04-22  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_check_relocs): Don't call
+	create_linkage_sections here..
+	(ppc64_elf_init_stub_bfd): ..do so here.  Return status.
+	(create_linkage_sections): Move earlier in file.
+	(ppc64_elf_setup_section_lists): Remove now useless htab->brlt test.
+	* elf64-ppc.h (ppc64_elf_init_stub_bfd): Update proto.
+
+2013-04-19  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/15356
+	* compress.c (decompress_contents): Always call inflateEnd, even
+	when another inflation operation fails.
+
+2013-04-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf-ifunc.c: Update copyright year.
+
+2013-04-17 Luca Pizzamiglio  <luca.pizzamiglio@gmail.com>
+
+	* coffcode.h: Added a cast to void when a bfd_set_section_*()
+	macro's return value is ignored.
+	* elf32-hppa.c: Likewise.
+	* elf32-tic6x.c: Likewise.
+	* mach-o.c: Likewise.
+	* mmo.c: Likewise.
+	* opncls.c: Likewise.
 	* peicode.h: Likewise.
-	* reloc.c: Likewise.
-	* riscix.c: Likewise.
-	* versados.c: Likewise.
-	* section.c: Likewise.
-	(bfd_abs_section, bfd_ind_section, bfd_com_section,
-	bfd_ind_section): Delete.
-	(std_section): New array replacing above.
-	(bfd_abs_section_ptr, bfd_ind_section_ptr, bfd_com_section_ptr,
-	bfd_ind_section_ptr, STD_SECTION): Update.
-	(BFD_FAKE_SECTION, GLOBAL_SYM_INIT): Remove unnecessary casts.
+	* elf32-m32r.c: Check return value of bfd_set_section_*().
+	* elfnn-ia64.c: Likewise.
+	* elfxx-mips.c: Likewise.
+	* vms-alpha.c: Likewise.
+
+2013-04-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/15371
+	* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Check
+	regular reference without non-GOT reference when building
+	shared library.
+
+2013-04-15  Alan Modra  <amodra@gmail.com>
+
+	* archive.c (_bfd_archive_close_and_cleanup): Clear parent
+	cache slot for archives.
+
+2013-04-14  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* mmo.c (mmo_write_chunk): Break out abfd->tdata.mmo_data to new
+	local variable mmop.
+
+2013-04-09  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
+
+	PR ld/12494
+	* elf32-avr.c: Consider all sections to determine if linker
+	relaxation can safely delete a ret after a call/jmp
+
+2013-04-09  Mingjie Xing  <mingjie.xing@gmail.com>
+
+	* bfd.c (typedef bfd, Error reporting, Miscellaneous): Add
+	INODEs.
+
+2013-04-08  Tom Tromey  <tromey@redhat.com>
+
+	* som.c (bfd_section_from_som_symbol): No longer static.
+	* som.h (bfd_section_from_som_symbol): Declare.
+
+2013-04-06  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.c (ppc_elf_check_relocs): Use SYMBOLIC_BIND.
+	* elf64-ppc.c (ppc64_elf_check_relocs, dec_dynrel_count): Likewise.
+
+2013-04-05  Nick Clifton  <nickc@redhat.com>
+
+	* elflink.c (elf_link_add_object_symbols): Revert accidental commit.
+
+2013-04-04  Alan Modra  <amodra@gmail.com>
+
+	* bfd.c (bfd_error_type, bfd_errmsgs): Add bfd_error_missing_dso.
 	* bfd-in2.h: Regenerate.
+	* elflink.c (elf_link_add_object_symbols): Use new error.
 
-2012-05-03  Sean Keys  <skeys@ipdatasys.com>
+2013-04-03  Nick Clifton  <nickc@redhat.com>
 
-	* cpu-xgate.c: New file. Added XGATE support.
-	* archures.c (bfd_architecture): Add XGATE architecture.
-	(bfd_archures_list): Add reference to XGATE architecture info.
-	* elf-bfd.h (prep_headers): Handle bfd_arch_xgate.
-	* reloc.c: Add various XGATE relocation enums.
-	* targets.c (bfd_elf32_xgate_vec): Declare and add to target vector
-	list.
-	* Makefile.am: Add support for XGATE elf.
-	* configure.in: Ditto.
-	* config.bfd: Ditto.
-	* Makefile.in: Regenerate.
-	* configure: Ditto.
-	* bfd-in2.h: Ditto.
-	* libbfd.h: Ditto.
-	Added files for XGATE relocations.
-	* elf32-xgate.c: Created minimal relocation file.
-	* elf32-xgate.h: Created minimal header file for elf32-xgate.
+	* elf32-v850.c (v850_elf_is_target_special_symbol): New function.
+	(bfd_elf32_bfd_is_target_special_symbol): Define.
 
-2012-05-03  Tristan Gingold  <gingold@adacore.com>
+2013-04-03   Venkataramanan Kumar  <venkataramanan.kumar@linaro.org>
 
-	* dwarf2.c (decode_line_info): Ignore
-	DW_LNE_HP_source_file_correlation.
+	* elf64-aarch64.c (elf64_aarch64_gc_sweep_hook): Use
+	elf64_aarch64_locals to get local GOT reference counts.
 
-2012-05-01  Nick Clifton  <nickc@redhat.com>
+2013-04-02  DJ Delorie  <dj@redhat.com>
 
-	PR binutils/13121
-	* aoutx.h: Rename 'finfo' to 'flaginfo' to avoid conflicts with
-	AIX system headers.
-	* coff-ppc.c: Likewise.
-	* cofflink.c: Likewise.
-	* elf32-arm.c: Likewise.
-	* elf64-sparc.c: Likewise.
-	* elflink.c: Likewise.
-	* pdp11.c: Likewise.
-	* rescoff.c: Likewise.
+	* elf32-rl78.c (GET_RELOC): Assert that there are relocs to get.
+	(rl78_elf_relax_section): Only fetch the next reloc if there is
+	one expected.
 
-2012-04-26  Mark Wielaard  <mjw@redhat.com>
+2013-03-30  Alan Modra  <amodra@gmail.com>
 
-	* dwarf2.c (scan_unit_for_symbols): Account for DW_AT_high_pc
-	possibly being relative to DW_AT_low_pc.
-	(parse_comp_unit): Likewise.
+	PR ld/15323
+	* elf-m10300.c (mn10300_elf_check_relocs): Set non_ir_ref for
+	global symbols referenced by relocs.
+	* elf32-arm.c (elf32_arm_check_relocs): Likewise.
+	* elf32-bfin.c (bfin_check_relocs): Likewise.
+	* elf32-cr16.c (cr16_elf_check_relocs): Likewise.
+	* elf32-cris.c (cris_elf_check_relocs): Likewise.
+	* elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
+	* elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
+	* elf32-fr30.c (fr30_elf_check_relocs): Likewise.
+	* elf32-frv.c (elf32_frv_check_relocs): Likewise.
+	* elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
+	* elf32-i370.c (i370_elf_check_relocs): Likewise.
+	* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
+	* elf32-lm32.c (lm32_elf_check_relocs): Likewise.
+	* elf32-m32c.c (m32c_elf_check_relocs): Likewise.
+	* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
+	* elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
+	* elf32-m68k.c (elf_m68k_check_relocs): Likewise.
+	* elf32-mcore.c (mcore_elf_check_relocs): Likewise.
+	* elf32-metag.c (elf_metag_check_relocs): Likewise.
+	* elf32-microblaze.c (microblaze_elf_check_relocs): Likewise.
+	* elf32-moxie.c (moxie_elf_check_relocs): Likewise.
+	* elf32-msp430.c (elf32_msp430_check_relocs): Likewise.
+	* elf32-mt.c (mt_elf_check_relocs): Likewise.
+	* elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
+	* elf32-openrisc.c (openrisc_elf_check_relocs): Likewise.
+	* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
+	* elf32-rl78.c (rl78_elf_check_relocs): Likewise.
+	* elf32-s390.c (elf_s390_check_relocs): Likewise.
+	* elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
+	* elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
+	* elf32-sh.c (sh_elf_check_relocs): Likewise.
+	* elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
+	* elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
+	* elf32-v850.c (v850_elf_check_relocs): Likewise.
+	* elf32-vax.c (elf_vax_check_relocs): Likewise.
+	* elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
+	* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
+	* elf64-aarch64.c (elf64_aarch64_check_relocs): Likewise.
+	* elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
+	* elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
+	* elf64-ia64-vms.c (elf64_ia64_check_relocs): Likewise.
+	* elf64-mmix.c (mmix_elf_check_relocs): Likewise.
+	* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
+	* elf64-s390.c (elf_s390_check_relocs): Likewise.
+	* elf64-sh64.c (sh_elf64_check_relocs): Likewise.
+	* elfnn-ia64.c (elfNN_ia64_check_relocs): Likewise.
+	* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
+	* elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
+	* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.  Don't
+	test indirect/warning links for NULL.
 
-2012-04-26  Andreas Schwab  <schwab@linux-m68k.org>
+2013-03-29  H.J. Lu  <hongjiu.lu@intel.com>
 
-	* elf32-m68k.c (elf_m68k_check_relocs): Mark non-GOT references
-	also when generating PIE.
-	(elf_m68k_discard_copies): Mark undefined weak symbols referenced
-	by relocations as dynamic.
+	PR ld/15323
+	* elf32-i386.c (elf_i386_check_relocs): Set non_ir_ref if a
+	symbol is referenced by a non-shared object.
+	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
 
-2012-04-26  Hans-Peter Nilsson  <hp@axis.com>
+2013-03-28  Joe Seymour  <jseymour@codesourcery.com>
 
-	Provide a way for programs to recognize BFD_ASSERT calls.
-	* bfd.c (bfd_assert_handler_type): New API type.
-	(bfd_set_assert_handler, bfd_get_assert_handler): New API functions.
-	(_bfd_assert_handler): New variable.
-	(_bfd_default_assert_handler): New function.
-	(bfd_assert): Call _bfd_assert_handler, not _bfd_error_handler.
-	* libbfd-in.h (_bfd_assert_handler): Declare.
-	* libbfd.h, bfd-in2.h: Regenerate.
+	* elf32-sh.c (sh_elf_relocate_section): Suppress warnings for
+	R_SH_REL32 relocations against undefined weak symbols.
 
-2012-04-24  Hans-Peter Nilsson  <hp@axis.com>
+2013-03-28  Alan Modra  <amodra@gmail.com>
 
-	PR ld/13990
-	* elf32-arm.c (elf32_arm_gc_sweep_hook): Handle a forced-local
-	symbol, where PLT refcount is set to -1.
+	* elf64-ppc.c (struct ppc_dyn_relocs): New.
+	(ppc64_elf_check_relocs): Separate dynrel counts for local syms
+	into ifunc and non-ifunc.
+	(dec_dynrel_count): Pass in sym rather than sym_sec.  Handle
+	separate ifunc/non-ifunc dynrel counts.
+	(allocate_got): Always use reliplt for ifunc.
+	(allocate_dynrelocs): Likewise.
+	(ppc64_elf_size_dynamic_sections): Likewise.
+	(ppc64_elf_layout_multitoc): Likewise.
+	(ppc64_elf_relocate_section): Likewise.
 
-2012-04-24  Alan Modra  <amodra@gmail.com>
+2013-03-28  Alan Modra  <amodra@gmail.com>
 
-	PR ld/13991
-	* elf-bfd.h (_bfd_elf_link_just_syms): Define as
-	_bfd_generic_link_just_syms.
-	* elflink.c (_bfd_elf_link_just_syms): Delete.
-	* linker.c (_bfd_generic_link_just_syms): Set sec_info_type.
+	* elf32-ppc.c (struct ppc_dyn_relocs): New.
+	(ppc_elf_check_relocs): Separate dynrel counts for local syms
+	into ifunc and non-ifunc.
+	(allocate_dynrelocs): Always put ifunc relocs into reliplt.
+	(ppc_elf_size_dynamic_sections): Likewise.
+	(ppc_elf_relocate_section): Likewise.
 
-	* bfd-in.h (discarded_section): Renamed from elf_discarded_section.
-	* section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS,
-	SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME,
-	SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE.
-	* elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
-	* elf.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c,
-	* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c,
-	* elf32-crx.c, * elf32-d10v.c, * elf32-epiphany.c,
-	* elf32-fr30.c, * elf32-frv.c, * elf32-h8300.c,
-	* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c,
-	* elf32-i860.c, * elf32-ip2k.c, * elf32-iq2000.c,
-	* elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c,
-	* elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
-	* elf32-mep.c, * elf32-moxie.c, * elf32-msp430.c,
-	* elf32-mt.c, * elf32-openrisc.c, * elf32-ppc.c,
-	* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c,
-	* elf32-score.c, * elf32-score7.c, * elf32-sh.c,
-	* elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c,
-	* elf32-v850.c, * elf32-vax.c, * elf32-xc16x.c,
-	* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
-	* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
-	* elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c,
-	* elf64-x86-64.c, * elflink.c, * elfnn-ia64.c,
-	* elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c,
-	* reloc.c: Update all references.
+2013-03-28  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (enum elf_reloc_type_class): Add reloc_class_ifunc.
+	(struct elf_backend_data <elf_backed_reloc_type_class>): Add
+	bfd_link_info* and asection* params.
+	(_bfd_elf_reloc_type_class): Likewise.
+	* elf.c (_bfd_elf_reloc_type_class): Likewise.
+	* elflink.c (elf_link_sort_cmp2): Sort first on reloc class.
+	(elf_link_sort_relocs): Update elf_backed_reloc_type_class call.
+	* elf32-ppc.c (ppc_elf_reloc_type_class): Return reloc_class_ifunc
+	for any reliplt reloc.  Don't return reloc_class_plt for
+	R_PPC_REL24 and R_PPC_ADDR24.
+	* elf64-ppc.c (allocate_got): Formatting.
+	(ppc64_elf_reloc_type_class): Return reloc_class_ifunc for any
+	reliplt reloc.
+	* elf-m10300.c, * elf32-arm.c, * elf32-bfin.c, * elf32-cr16.c,
+	* elf32-cris.c, * elf32-hppa.c, * elf32-i386.c, * elf32-lm32.c,
+	* elf32-m32r.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c,
+	* elf32-s390.c, * elf32-sh.c, * elf32-sparc.c, * elf32-tilepro.c,
+	* elf32-vax.c, * elf32-xtensa.c, * elf64-aarch64.c, * elf64-alpha.c,
+	* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-s390.c, * elf64-sparc.c,
+	* elf64-x86-64.c, * elfnn-ia64.c, * elfxx-tilegx.c, * elfxx-tilegx.h:
+	Add extra params to the various reloc_type_class functions.
+
+2013-03-27  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.c (ppc_elf_check_relocs): Set PLT_IFUNC in local got
+	masks for all local ifunc syms.
+	(allocate_dynrelocs): Don't use htab->relgot for ifunc.
+	(ppc_elf_size_dynamic_sections): Likewise.
+	(ppc_elf_relocate_section): Likewise.
+
+2013-03-27  Will Newton  <will.newton@linaro.org>
+
+	* elf32-arm.c (elf32_arm_final_link_relocate): Avoid emitting a
+	dynamic reloc for symbols with dynindx == -1.
+	(allocate_dynrelocs_for_symbol): Avoid allocating space for a
+	dynamic reloc for symbols with dynindx == -1.
+
+2013-03-27  Will Newton  <will.newton@linaro.org>
+
+	* elf32-arm.c (elf32_arm_final_link_relocate): Avoid emitting a
+	dynamic reloc for non-default visibility undefined weaks.
+	(allocate_dynrelocs_for_symbol): Avoid allocating space for a
+	dynamic reloc for non-default visibility undefined weaks.
+
+2013-03-26  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_add_default_symbol): Preserve section
+	over _bfd_elf_merge_symbol calls.
+
+2013-03-26  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (elf_link_add_object_symbols): Add assertion for
+	common override alignment check code.  Formatting.
+
+2013-03-25  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_merge_symbol): Set old_alignment for
+	usual common symbols as well as for dynamic.  Add poldbfd param.
+	Save old bfd.  Adjust callers.
+	(_bfd_elf_add_default_symbol): Add poldbfd param.  Pass "section"
+	and "value" by value, not pointer.  Adjust caller.
+	(elf_link_add_object_symbols): Combine undef_bfd and old_bfd vars.
+	Delete code to set same.  Use old_bfd and old_alignment from
+	_bfd_elf_merge_symbol instead.  Add default symbol before
+	alignment and size checks.  Wrap overlong lines.
+
+2013-03-25  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_add_default_symbol): Delete "override" param.
+	(elf_link_add_object_symbols): Don't call _bfd_elf_add_default_symbol
+	when override is true.
+
+2013-03-25  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_merge_symbol): Use local var holding value
+	of *sym_hash.
+
+2013-03-25  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_merge_symbol): Don't discard TLS symbols here.
+	Wrap long lines.
+	(elf_link_add_object_symbols): Discard TLS symbols for --just-syms
+	early in symbol loop.
+
+2013-03-25  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (struct elf_backend_data <merge_symbol>): Update proto.
+	(_bfd_elf_init_reloc_shdr): Delete.
+	* elf.c (_bfd_elf_init_reloc_shdr): Make static.
+	* elf64-x86-64.c (elf_x86_64_merge_symbol): Trim parameters to
+	just what is needed.
+	* elflink.c (_bfd_elf_merge_symbol): Update bed->merge_symbol call.
+
+2013-03-23  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (_bfd_elf_merge_symbol): Delete declaration.
+	* elflink.c (_bfd_elf_merge_symbol): Make static.
+	* elf32-sh-symbian.c (sh_symbian_relocate_section): Don't call
+	_bfd_elf_merge_symbol, call _bfd_generic_link_add_one_symbol.
+
+2013-03-23  Alan Modra  <amodra@gmail.com>
+
+	PR ld/15270
+	* elflink.c (elf_link_add_object_symbols): Don't set def_regular
+	or ref_regular for BFD_PLUGIN owned syms, or have them affect
+	def_dynamic/ref_dynamic.
+	(_bfd_elf_fix_symbol_flags): Don't set def_regular for BFD_PLUGIN
+	owned syms.
+
+2013-03-22  David S. Miller  <davem@davemloft.net>
+
+	* elfxx-sparc.c (_bfd_sparc_elf_merge_private_bfd_data): Set type of
+	hwcaps attribute.
+
+2013-03-22  Achille Fouilleul  <achille.fouilleul+binutils@gadz.org>
+
+	PR ld/14902
+	* elf32-h8300.c (elf32_h8_relax_delete_bytes): Fix off by one
+	errors adjusting relocs and symbols.
+
+2013-03-21  Michael Schewe  <michael.schewe@gmx.net>
+
+	* elf32-h8300 (h8_relax_section): Add new relaxation of mov
+	@(disp:32,ERx) to mov @(disp:16,ERx).
+	(R_H8_DISP32A16): New reloc.
+	Comments added and corrected.
+	* reloc.c (BFD_RELOC_H8_DISP32A16): New reloc.
 	* bfd-in2.h: Regenerate.
-
-2012-04-20  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
-
-	* elf32-s390.c (ELF_DYNAMIC_INTERPRETER): Set to the GCC default.
-	* elf64-s390.c (ELF_DYNAMIC_INTERPRETER): Set to the GCC default.
-
-2012-04-19  Thomas Schwinge  <thomas@codesourcery.com>
-
-	* elf32-sh.c (elf_sh_link_hash_entry): Specify an enum identifier for
-	got_type.
-	(allocate_dynrelocs, sh_elf_relocate_section, sh_elf_check_relocs): Use
-	it.
-
-2012-04-17  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
-
-	* elf32-sh.c (allocate_dynrelocs): Don't allocate dynamic
-	relocations when LE conversion happens on the IE tls symbol.
-
-2012-04-17  Roland McGrath  <mcgrathr@google.com>
-
-	* elf64-x86-64.c (elf_x86_64_nacl_plt0_entry): Fix nop padding
-	so that 32-byte boundary is a proper instruction boundary.
-
-2012-04-17  Tristan Gingold  <gingold@adacore.com>
-
-	* vms-lib.c (_bfd_vms_lib_get_module): Append .obj extension to
-	member of an object archive.<
-
-2012-04-17  Tristan Gingold  <gingold@adacore.com>
-
-	* vms-lib.c (MAX_EKEYLEN): Define.
-	(MAX_KEYLEN): Fix value.
-	(vms_write_index): Add comments and fix indentation.
-	Adjust comparaison.  Add assertions.  Free kbn_blk.
-	(_bfd_vms_lib_write_archive_contents): Use MAX_EKEYLEN.
-	Compense MAX_KEYLEN adjustment.
-
-2012-04-16  Maciej W. Rozycki  <macro@linux-mips.org>
-
-	* elfxx-mips.c (mips16_stub_symndx): Handle n64 compound relocs.
-	(_bfd_mips_elf_check_relocs): Update accordingly.
-
-2012-04-13  Alan Modra  <amodra@gmail.com>
-
-	PR ld/13947
-	* elflink.c (bfd_elf_final_link): Set reloc_count to 0 for
-	reloc sections.
-
-2012-04-12  David S. Miller  <davem@davemloft.net>
-
-	* reloc.c (BFD_RELOC_SPARC_H34, BFD_RELOC_SPARC_SIZE32,
-	BFD_RELOC_SPARC_SIZE64, BFD_RELOC_SPARC_WDISP10): New relocs.
 	* libbfd.h: Regenerate.
-	* bfd-in2.h: Likewise.
-	* elfxx-sparc.c (sparc_elf_wdisp10_reloc): New function.
-	(_bfd_sparc_elf_howto_table): Add entries for R_SPARC_H34,
-	R_SPARC_SIZE32, R_SPARC_64, and R_SPARC_WDISP10.
-	(_bfd_sparc_elf_reloc_type_lookup): Handle new relocs.
-	(_bfd_sparc_elf_check_relocs): Likewise.
-	(_bfd_sparc_elf_gc_sweep_hook): Likewise.
-	(_bfd_sparc_elf_relocate_section): Likewise.
 
-2012-04-12  Roland McGrath  <mcgrathr@google.com>
+2013-03-21  Kai Tietz  <ktietz@redhat.com>
 
-	* elf32-arm.c (elf32_arm_nacl_plt0_entry, elf32_arm_nacl_plt_entry):
-	New variables.
-	(struct elf32_arm_link_hash_table): New member `nacl_p'.
-	(elf32_arm_link_hash_table_create): Initialize it.
-	(elf32_arm_nacl_link_hash_table_create): New function.
-	(arm_movw_immediate, arm_movt_immediate): New functions.
-	(elf32_arm_populate_plt_entry): Test HTAB->nacl_p.
-	(elf32_arm_finish_dynamic_sections): Likewise.
-	(elf32_arm_output_plt_map_1): Likewise.
-	(bfd_elf32_littlearm_nacl_vec, bfd_elf32_bigarm_nacl_vec):
-	New backend vector stanza.
-	(elf32_arm_nacl_modify_segment_map): New function.
-	* config.bfd: Handle arm-*-nacl*, armeb-*-nacl*.
-	* targets.c: Support bfd_elf32_{big,little}_nacl_vec.
-	* configure.in: Likewise.
-	(bfd_elf32_bigarm_nacl_vec): Add elf-nacl.lo here.
-	(bfd_elf32_littlearm_nacl_vec): Likewise.
-	(bfd_elf32_bigarm_vec, bfd_elf32_littlearm_vec): Likewise.
-	(bfd_elf32_bigarm_symbian_vec): Likewise.
-	(bfd_elf32_littlearm_symbian_vec): Likewise.
-	(bfd_elf32_bigarm_vxworks_vec): Likewise.
-	(bfd_elf32_littlearm_vxworks_vec): Likewise.
-	* configure: Regenerated.
+	* coffgen.c (coff_real_object_p): Make global.
+	* peicode.h (coff_real_object_p): Add prototype.
+	(FILHDR): Defined for COFF_IMAGE_WITH_PE as
+	external_PEI_IMAGE_hdr structure.
+	(coff_swap_filehdr_in): Handle variable header-size.
+	* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Just handle amount
+	of directory-entiries as specified in pe-header.
 
-2012-04-12  Tristan Gingold  <gingold@adacore.com>
+2013-03-21  Nick Clifton  <nickc@redhat.com>
 
-	* elflink.c (elf_link_output_extsym): Add a guard.
-	(bfd_elf_final_link): Remove assertion.
-	(bfd_elf_final_link): Add a guard.
-	* elfnn-ia64.c (INCLUDE_IA64_VMS): Removed.
-	(elfNN_vms_section_from_shdr, elfNN_vms_object_p)
-	(elfNN_vms_post_process_headers, elfNN_vms_section_processing)
-	(elfNN_vms_final_write_processing, elfNN_vms_close_and_cleanup):
-	Remove.
-	(elfNN-ia64-vms target): Move to ...
-	* elf64-ia64-vms.c: New file.
-	* configure.in (bfd_elf64_ia64_vms_vec): Add elf64-ia64-vms.lo
-	* Makefile.am (BFD64_BACKENDS): Add elf64-ia64-vms.lo.
-	(BFD64_BACKENDS_CFILES): Ad elf64-ia64-vms.c.
+	PR sim/15286
+	* elf32-arm.c (bfd_arm_get_mach_from_attributes): Identify XScale,
+	iWMMXt and iWMMXt2 processors from attributes.
+
+2013-03-20  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_make_dynamic_reloc_section): Override
+	sh_type according to is_rela.
+
+2013-03-18  Alan Modra  <amodra@gmail.com>
+
+	PR ld/12549
+	* elflink.c (elf_link_add_object_symbols): Exclude weak refs when
+	considering whether an --as-needed library is needed.
+
+2013-03-14  Tom Tromey  <tromey@redhat.com>
+
+	* opncls.c (bfd_get_debug_link_info): Rename from
+	get_debug_link_info.  Export.  Update comment.
+	(find_separate_debug_file): Update.
+	* bfd-in2.h: Rebuild.
+
+2013-03-08  Venkataramanan Kumar  <venkataramanan.kumar@linaro.org>
+
+	* elf64-aarch64.c (elf_backend_can_gc_sections): Enable gc-section
+	support.
+	(elf64_aarch64_gc_sweep_hook): Handle GOT, TLS and PLT related
+	relocs.
+
+2013-03-08  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+	* elf-bfd.h (elfcore_write_s390_tdb): Add prototype.
+	* elf.c (elfcore_write_s390_tdb): New function.
+	(elfcore_write_register_note): Call it.
+	(elfcore_grok_s390_tdb): New function.
+	(elfcore_grok_note): Call it.
+
+2013-03-08  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (mips_elf_allocate_lazy_stub): Correct data type.
+
+2013-03-05  Corinna Vinschen  <vinschen@redhat.com>
+
+	* config.bfd: Add x86_64-*-cygwin to list of supported targets.
+
+2013-03-04  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.c (ppc_elf_relocate_section <R_PPC_PLTREL24>): Adjust
+	non-zero addends when relocatable, rather than addends >= 32768.
+	Always zero "addend" before applying relocation.
+
+2013-03-04  Nick Clifton  <nickc@redhat.com>
+
+	* archive64.c (bfd_elf64_archive_write_armap): Fix calculation of
+	file pointer offsets for thin archives.
+
+2013-02-28  Nathan Sidwell  <nathan@codesourcery.com>
+
+	* elf32-arm.c (elf32_arm_size_dynamic_sections): Don't call
+	elf32_arm_allocate_dynrelocs for source reloc for non-dynamic link.
+
+2013-02-27  DJ Delorie  <dj@redhat.com>
+
+	* reloc.c (BFD_RELOC_RL78_CODE): Add.
+	* libbfd.h: Regenerate.
+	* bfd-in2.h: Regenerate.
+	* elf32-rl78.c (rl78_elf_relocate_section): Handle weak code
+	references in compuated relocs.
+
+2013-02-26  Anthony Green  <green@moxielogic.com>
+
+	* config.bfd: Extend moxie-rtems target triplet name support.
+
+2013-02-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/15167
+	* elf64-ia64-vms.c (elf64_vms_link_add_object_symbols): Set
+	unique_global only for definition.
+	* elflink.c (_bfd_elf_merge_symbol): Don't set unique_global
+	here.
+	(elf_link_add_object_symbols): Set unique_global only
+	for definition.
+
+2013-02-21  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (struct elf_build_id): Extracted from..
+	(struct elf_build_id_info): ..here.  Delete.
+	(struct output_elf_obj_tdata): New, extracted from..
+	(struct elf_obj_tdata): ..here.  Reorganize for better packing.
+	Add "o" field.
+	(elf_program_header_size): Reference tdata->o.
+	(elf_seg_map, elf_next_file_pos, elf_eh_frame_hdr, elf_linker,
+	elf_stack_flags, elf_shstrtab, elf_strtab_sec, elf_shstrtab_sec,
+	elf_section_syms, elf_num_section_syms, elf_flags_init): Likewise.
+	* elf.c (bfd_elf_allocate_object): Allocate output_elf_obj_tdata
+	when opening bfd in any mode that might write.
+	(_bfd_elf_write_object_contents): Use build_id field in
+	output_elf_obj_tdata.
+	(_bfd_elf_close_and_cleanup): Tweak elf_shstrtab test.
+	(elfobj_grok_gnu_build_id): Adjust for elf_tdata changes.
+
+2013-02-21  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (struct core_elf_obj_tdata): New.
+	(struct elf_obj_tdata): Delete core_signal, core_pid, core_lwpid,
+	core_program, and core_command.  Add "core".
+	* elf.c (bfd_elf_mkcorefile): Allocate "core" struct.
+	Update all refs to tdata core fields.
+	* elf32-am33lin.c, * elf32-arm.c, * elf32-cris.c, * elf32-frv.c,
+	* elf32-hppa.c, * elf32-i386.c, * elf32-m68k.c, * elf32-mips.c,
+	* elf32-nios2.c, * elf32-ppc.c, * elf32-s390.c, * elf32-score.c,
+	* elf32-score7.c, * elf32-sh.c, * elf32-sparc.c, * elf32-tilegx.c,
+	* elf32-tilepro.c, * elf32-xtensa.c, * elf64-aarch64.c,
+	* elf64-hppa.c, * elf64-mips.c, * elf64-ppc.c, * elf64-tilegx.c,
+	* elf64-x86-64.c, * elfcore.h, * elfn32-mips.c: Update all refs
+	to tdata core fields.
+
+2013-02-21  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (struct elf_obj_tdata): Rename segment_map to seg_map.
+	Delete num_locals and num_globals.
+	(elf_num_locals, elf_num_globals): Don't define.
+	(elf_seg_map, elf_next_file_pos, elf_eh_frame_hdr, elf_linker,
+	elf_stack_flags, elf_strtab_sec, elf_shstrtab_sec): Define.
+	* bfd.c, * elf-eh-frame.c, * elf-nacl.c, * elf-vxworks.c, * elf.c,
+	* elf32-arm.c, * elf32-lm32.c, * elf32-ppc.c, * elf32-rx.c,
+	* elf32-spu.c, * elf64-hppa.c, * elfcode.h, * elflink.c,
+	* elfnn-ia64.c, * elfxx-mips.c: Use newly defined elf_obj_tdata
+	accessor macros.
+	* elf.c (elf_map_symbols): Add pnum_locals param.  Return
+	number of locals syms via new param.
+	(swap_out_syms): Adjust to suit elf_map_symbols change.
+
+2013-02-19  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Also clear
+	STO_MICROMIPS annotation.
+
+2013-02-19  Alan Modra  <amodra@gmail.com>
+
+	* configure.in: Bump version to 2.23.52.
+	* elf-bfd.h (struct elf_build_id_info): New.
+	(struct elf_obj_tdata): Delete after_write_object_contents,
+	after_write_object_contents_info and build_id_size.  Make build_id
+	a pointer to struct elf_build_id_info.
+	* elf.c (_bfd_elf_write_object_contents): Style.  Update
+	after_write_ibject_contents invocation.
+	(elfobj_grok_gnu_build_id): Update for new build_id struct.  Don't
+	allow zero size notes.
 	* configure: Regenerate.
-	* Makefile.in: Regenerate.
 
-2012-04-11  Nick Clifton  <nickc@redhat.com>
+2013-02-18  Maciej W. Rozycki  <macro@codesourcery.com>
 
-	PR binutils/13897
-	* elf64-ppc.c (opd_entry_value): When dealing with sections
-	without relocs, keep the last section loaded in order to avoid
-	unnecessary reloads.
+	* elf64-mips.c (micromips_elf64_howto_table_rel): Add
+	R_MICROMIPS_SCN_DISP and R_MICROMIPS_JALR.
+	(micromips_elf64_howto_table_rela): Likewise.
+	(micromips_reloc_map): Add BFD_RELOC_MICROMIPS_JALR.
+	* elfn32-mips.c (elf_micromips_howto_table_rel): Add
+	R_MICROMIPS_SCN_DISP and R_MICROMIPS_JALR.
+	(elf_micromips_howto_table_rela): Likewise.
+	(micromips_reloc_map): Add BFD_RELOC_MICROMIPS_JALR.
 
-2012-04-09  Roland McGrath  <mcgrathr@google.com>
+2013-02-18  Paul Brook  <paul@codesourcery.com>
 
-	* elf.c (_bfd_elf_map_sections_to_segments): Set INFO->user_phdrs.
-	* elf-nacl.c (nacl_modify_segment_map): Do nothing if INFO->user_phdrs.
-	(nacl_modify_program_headers): Likewise.
+	* elfxx-mips.c (MICROMIPS_P): New macro.
+	(_bfd_mips_elf_symbol_processing): Use it.
 
-2012-04-03  Roland McGrath  <mcgrathr@google.com>
+2013-02-18  Maciej W. Rozycki  <macro@codesourcery.com>
 
-	* elf-nacl.c: New file.
-	* elf-nacl.h: New file.
-	* elf32-i386.c (elf_backend_modify_segment_map): Define for
-	bfd_elf32_i386_nacl_vec.
-	(elf_backend_modify_program_headers): Likewise.
-	* elf64-x86-64.c (elf_backend_modify_segment_map): Define for
-	bfd_elf64_x86_64_nacl_vec and bfd_elf32_x86_64_nacl_vec.
-	(elf_backend_modify_program_headers): Likewise.
-	* Makefile.am (BFD32_BACKENDS, BFD64_BACKENDS): Add elf-nacl.lo here.
-	(BFD32_BACKENDS_CFILES, BFD64_BACKENDS_CFILES): Add elf-nacl.c here.
+	* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Clarify
+	comment on _PROCEDURE_LINKAGE_TABLE_ creation.
+
+2013-02-18  Alan Modra  <amodra@gmail.com>
+
+	PR ld/12549
+	* elf-bfd.h (_bfd_elf_strtab_clear_refs): Delete.
+	(_bfd_elf_strtab_clear_all_refs): Declare.
+	(_bfd_elf_strtab_resize): Declare.
+	* elf-strtab.c (_bfd_elf_strtab_clear_refs): Delete.
+	(_bfd_elf_strtab_clear_all_refs): New function.
+	(_bfd_elf_strtab_resize): Likewise.
+	* elflink.c (elf_link_add_object_symbols): Use _bfd_elf_strtab_resize.
+
+2013-02-18  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs,
+	local_call_stubs, elf_data_symbol, elf_text_symbol, elf_data_section,
+	and elf_text_section to..
+	* elfxx-mips.c (struct mips_elf_obj_tdata): ..here.  Update all refs.
+	* elf64-alpha.c (struct mips_elf_find_line): Rename to..
+	(struct alpha_elf_find_line): ..this.
+	(struct alpha_elf_obj_tdata): Add find_line_info, update refs.
+
+2013-02-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/15146
+	* elflink.c (elf_link_add_object_symbols): Don't add DT_NEEDED
+	for references from the dummy bfd.
+
+2013-02-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/15149
+	* elflink.c (elf_link_add_object_symbols): Also track weak
+	references.
+
+2013-02-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/15151
+	* archive.c (_bfd_find_nested_archive): Don't allow a nested
+	archive pointing to itself.
+	(_bfd_get_elt_at_filepos): Revert the last 2 changes.
+
+2013-02-15  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/15140
+	* archive.c (_bfd_get_elt_at_filepos): Prevent an infinite loop
+	accessing a corrupt nested archive.
+
+2013-02-13  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_got_page_ref): New structure.
+	(mips_got_page_entry): Use a section rather than a (bfd, symndx)
+	pair to represent the anchor point.
+	(mips_got_info): Add a got_page_refs field.
+	(mips_elf_link_hash_table): Add a sym_cache field.
+	(mips_got_page_ref_hash, mips_got_page_ref_eq): New functions.
+	(mips_got_page_entry_hash, mips_got_page_entry_eq): Update for
+	new anchor representation.
+	(mips_elf_create_got_info): Create got_page_refs rather than
+	got_page_entries.
+	(mips_elf_record_got_page_ref): New function.
+	(mips_elf_pages_for_range): Move further down file.
+	(mips_elf_record_got_page_entry): Likewise.  Take a got as argument.
+	Use a section rather than a (bfd, symndx) pair to represent the
+	anchor point.
+	(mips_elf_resolve_got_page_ref): New function.
+	(mips_elf_resolve_final_got_entries): Use it to populate
+	got_page_entries.
+	(_bfd_mips_elf_check_relocs): Call mips_elf_record_got_page_ref
+	rather than mips_elf_record_got_page_entry.  Only nullify h
+	afterwards.
+	(mips_elf_lay_out_got): Call mips_elf_resolve_final_got_entries
+	earlier.
+
+2013-02-12  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_lay_out_got): Count VxWorks GOT relocs
+	in g->relocs.
+
+2013-02-12  Alan Modra  <amodra@gmail.com>
+
+	* elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Provide
+	suitable definition when using generic linker hash table.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_count_got_entries): Delete.
+	(mips_elf_check_recreate_got, mips_elf_recreate_got): Take a
+	mips_elf_traverse_got_arg.  Count GOT entries.
+	(mips_elf_resolve_final_got_entries): Take the bfd_link_info
+	as argument.  Update after above changes.
+	(mips_elf_merge_got, mips_elf_lay_out_got): Don't call
+	mips_elf_count_got_entries.  Update the calls to
+	mips_elf_resolve_final_got_entries.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_got_tls_type): New enum.
+	(mips_got_entry): Add tls_initialized.
+	(mips_elf_got_entry_hash, mips_elf_got_entry_eq, mips_tls_got_relocs)
+	(mips_elf_count_got_entry, mips_elf_initialize_tls_index): Remove
+	GOT_TLS_TYPE masks.
+	(mips_elf_reloc_tls_type, mips_tls_got_entries)
+	(mips_elf_record_global_got_symbol, mips_elf_initialize_tls_index)
+	(_bfd_mips_elf_finish_dynamic_symbol): Use GOT_TLS_NONE rather
+	than GOT_NORMAL.
+	(mips_elf_initialize_tls_slots): Replace got_offset and tls_type_p
+	arguments with a GOT entry.  Remove GOT_TLS_TYPE masks.  Use
+	tls_initialized rather than GOT_TLS_DONE.
+	(mips_tls_got_index): Delete.
+	(mips_elf_local_got_index, mips_elf_global_got_index): Use
+	mips_elf_initialize_tls_slots rather than mips_tls_got_index.
+	(mips_elf_record_got_entry): Initialize tls_initialized.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_got_entry): Remove tls_ldm_offset.
+	(mips_elf_link_hash_entry): Remove tls_ie_type, tls_gd_type,
+	tls_ie_got_offset and tls_gd_got_offset.
+	(mips_elf_link_hash_newfunc): Remove initialization.
+	(mips_elf_create_got_info): Likewise.
+	(mips_elf_count_local_got_entries, mips_elf_count_global_tls_entries)
+	(mips_tls_single_got_index): Delete.
+	(mips_elf_local_got_index): Always use the GOT entry to track
+	GOT indices.
+	(mips_elf_global_got_index): Likewise.
+	(mips_elf_create_local_got_entry): Assert that TLS entries have
+	already been allocated.
+	(mips_elf_record_global_got_symbol): Don't initialize
+	tls_ie_type or tls_gd_type.
+	(mips_elf_count_got_symbols): Only count reloc-only GOT entries here.
+	(mips_elf_initialize_tls_index): Allocate a GOT index for every TLS
+	entry.
+	(mips_elf_lay_out_got): Use mips_elf_count_got_entries to count
+	the GOT entries.
+	(_bfd_mips_elf_finish_dynamic_symbol): Assert that TLS GOT offsets
+	have been allocated.
+	(_bfd_mips_elf_copy_indirect_symbol): Remove handling of
+	tls_ie_type and tls_gd_type.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_create_local_got_entry): Tidy.  Avoid
+	aliasing violation.  Check for htab allocation failures.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_primary_global_got_index): New function,
+	split out from...
+	(mips_elf_global_got_index): ...here.  Reorder arguments so that
+	the output bfd and info come first.
+	(mips_elf_calculate_relocation): Update the call to
+	mips_elf_global_got_index accordingly.
+	(_bfd_mips_elf_finish_dynamic_symbol): Use
+	mips_elf_primary_global_got_index rather than
+	mips_elf_global_got_index.
+	(_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_got_entry): Update comments.
+	(mips_elf_multi_got_entry_eq): Rename to...
+	(mips_elf_got_entry_eq): ...this, deleting the old definition.
+	(mips_elf_create_got_info): Remove master_got_p argument.
+	Always use mips_elf_got_entry_eq.
+	(mips_elf_bfd_got, mips_elf_multi_got, mips_elf_create_got_section):
+	Update calls accordingly.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_got_info): Remove bfd2got.
+	(mips_elf_bfd2got_hash): Delete.
+	(mips_elf_got_per_bfd_arg): Remove bfd2got.
+	(mips_elf_replace_bfd_got, mips_elf_count_got_entries): New functions.
+	(mips_elf_global_got_index, mips_elf_create_local_got_entry): Use
+	g->next to test for the multigot case.  Use mips_elf_bfd_got rather
+	than mips_elf_got_for_ibfd.
+	(mips_elf_bfd2got_entry_hash, mips_elf_bfd2got_entry_eq)
+	(mips_elf_got_for_ibfd, mips_elf_get_got_for_bfd): Delete.
+	(mips_elf_make_got_per_bfd): Replace with...
+	(mips_elf_add_got_entry): ...this new function.
+	(mips_elf_make_got_pages_per_bfd): Replace with...
+	(mips_elf_add_got_page_entry): ...this new function.
+	(mips_elf_merge_got_with): Replace bfd2got argument with separate
+	bfd and GOT arguments.  Use mips_elf_add_got_entry and
+	mips_elf_add_got_page_entry instead of mips_elf_make_got_per_bfd
+	and mips_elf_make_got_pages_per_bfd.  Use mips_elf_replace_bfd_got
+	to set the BFD's GOT and free the old table.
+	(mips_elf_merge_got): Replace bfd2got argument with separate
+	bfd and GOT arguments.  Apply mips_elf_resolve_final_got_entries.
+	Use mips_elf_count_got_entries to count the number of entries in
+	each GOT.  Update the calls to mips_elf_merge_got_with.
+	(mips_elf_adjust_gp): Use g->next to test for the multigot case.
+	Use mips_elf_bfd_got rather than mips_elf_got_for_ibfd.
+	(mips_elf_multi_got): Don't create the bfd2got hash table.
+	Replace hash table traversal with a walk over the input bfds,
+	updating the call to mips_elf_merge_got.  Use mips_elf_replace_bfd_got
+	to set the output bfd's GOT.
+	(mips_elf_lay_out_got): Rename "sub" to "ibfd".  Record that all
+	bfds use the master GOT in the single-GOT case.
+	(_bfd_mips_elf_finish_dynamic_sections): Use mips_elf_bfd_got
+	rather than mips_elf_got_for_ibfd.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_obj_tdata): Add a got field.
+	(mips_elf_bfd_got, mips_elf_record_got_entry): New functions.
+	(mips_elf_record_global_got_symbol): Update the hash entry before
+	adding the mips_got_entry.  Use mips_elf_record_got_entry to do
+	the latter.
+	(mips_elf_record_local_got_symbol): Use mips_elf_record_got_entry.
+	(mips_elf_record_got_page_entry): Record the entry in both the
+	master and bfd GOTs.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_recreate_got): Don't change the entry;
+	create another one if necessary.
+	(mips_elf_set_gotidx): New function.
+	(mips_elf_set_global_gotidx): Use it.
+	(mips_elf_initialize_tls_index): Likewise.  Take a
+	mips_elf_traverse_got_arg as argument.
+	(mips_elf_lay_out_got): Update use of mips_elf_initialize_tls_index.
+	(mips_elf_multi_got): Likewise.  Cope with error returns from
+	mips_elf_set_global_gotidx.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_got_info): Add relocs field.
+	(mips_elf_set_global_got_offset_arg, mips_elf_count_tls_arg): Replace
+	with...
+	(mips_elf_traverse_got_arg): ...this new structure.
+	(mips_elf_count_local_tls_relocs): Delete.
+	(mips_elf_count_global_tls_relocs): Likewise.
+	(mips_elf_count_got_entry): New function.
+	(mips_elf_count_local_got_entries): Likewise.
+	(mips_elf_count_global_tls_entries): Take a mips_elf_traverse_got_arg
+	rather than a mips_elf_count_tls_arg.  Count both relocs and entries.
+	(mips_elf_record_local_got_symbol): Don't count got entries here.
+	(mips_elf_make_got_per_bfd): Use mips_elf_count_got_entry.
+	(mips_elf_set_global_got_offset): Split into...
+	(mips_elf_set_global_got_area, mips_elf_set_global_gotidx): ...these
+	new functions.  Take a mips_elf_traverse_got_arg rather than a
+	mips_elf_set_global_got_offset_arg.  Don't count TLS relocs here.
+	Use g->relocs to record the number of relocs needed for global GOT
+	entries.
+	(mips_elf_multi_got): Use mips_elf_traverse_got_arg rather than
+	mips_elf_set_global_got_offset_arg.  Use the relocs field to count
+	relocations.  Update for above function split.
+	(mips_elf_lay_out_got): Use mips_elf_count_local_got_entries
+	to count both the number of GOT entries and the number of TLS
+	relocs required by local entries.  Likewise
+	mips_elf_count_global_tls_entries and global entries.
+	Remove uses of mips_elf_count_local_tls_relocs and
+	mips_elf_count_global_tls_relocs.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_got_entry): Update comment above tls_type entry
+	to say that each structure represents only one type of TLS reference.
+	(GOT_TLS_TYPE): New define.
+	(mips_elf_link_hash_entry): Temporarily split tls_type and
+	tls_got_offset into two variables each.
+	(mips_elf_link_hash_newfunc): Update accordingly.
+	(mips_elf_got_entry_eq, mips_elf_got_entry_hash)
+	(mips_elf_multi_got_entry_eq): Require the tls_type to be the same.
+	(mips_elf_reloc_tls_type, mips_tls_got_entries): New functions.
+	(mips_tls_got_relocs): Use a switch statement.
+	(mips_elf_count_global_tls_entries): Handle the new hash entry fields.
+	(mips_elf_initialize_tls_slots): Use a switch statement.  Avoid
+	local "offset" variable.
+	(mips_tls_got_index): Remove r_type argument and assert.  Remove
+	code that handled entries with two TLS types; always use the
+	original got_index instead.
+	(mips_tls_single_got_index): New function.
+	(mips_elf_local_got_index): Use entry->tls_type to check for
+	TLS entries.  Use mips_tls_single_got_index.  Update call to
+	mips_tls_got_index.
+	(mips_elf_global_got_index): Use mips_elf_reloc_tls_type.
+	Use p->tls_type to check for TLS entries.  Update call to
+	mips_tls_got_index.  Use mips_tls_single_got_index.
+	(mips_elf_create_local_got_entry): Use mips_elf_reloc_tls_type.
+	Use entry.tls_type to check for TLS entries.
+	(mips_elf_record_global_got_symbol): Replace tls_flag argument
+	with r_type argument.  Use mips_elf_reloc_tls_type.
+	Set up the new hash entry fields.
+	(mips_elf_record_local_got_symbol): Replace tls_flag argument
+	with r_type argument.  Use mips_elf_reloc_tls_type and
+	mips_tls_got_entries.  Remove code that handled entries
+	with multiple TLS types.
+	(mips_elf_make_got_per_bfd): Use mips_tls_got_entries.
+	(mips_elf_initialize_tls_index): Handle new hash entry fields.
+	Use equality rather than masks when checking for specific TLS types.
+	Use mips_tls_got_entries.  Remove code that handled entries
+	with multiple TLS types.
+	(mips_elf_calculate_relocation): Use TLS_RELOC_P instead of
+	testing the hash table entry.
+	(_bfd_mips_elf_check_relocs): Update calls to
+	mips_elf_record_global_got_symbol and mips_elf_record_local_got_symbol.
+	(_bfd_mips_elf_finish_dynamic_symbol): Don't check h->type.
+	(_bfd_mips_elf_copy_indirect_symbol): Handle new hash entry fields.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_multi_got_entry_hash): Rename to...
+	(mips_elf_got_entry_hash): ...this, deleting the old version.
+	(mips_elf_create_got_info): Use mips_elf_got_entry_hash for
+	both types of GOT.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_create_got_info): New function.
+	(mips_elf_get_got_for_bfd, mips_elf_multi_got): Use it.
+	(mips_elf_create_got_section): Likewise.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_record_local_got_symbol): Always set
+	gotidx to -1.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_multi_got): Simplify size calculation.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_got_info): Move global_gotsym to...
+	(mips_elf_link_hash_table): ...here.  Update rest of file accordingly.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_count_global_tls_entries)
+	(mips_elf_count_global_tls_relocs): Don't count indirect or
+	warning symbols.
+	(mips_elf_multi_got, mips_elf_lay_out_got): Assert that the right
+	number of TLS entries were allocated.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_sort_hash_table_f): Remove asserts.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_merge_got_with): Only use arg->global_count
+	if there are TLS relocations.
+
+2013-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	* elfxx-mips.c (mips_elf_recreate_got): Remove free.
+	(mips_elf_resolve_final_got_entries): Remove bogus comment.
+
+2013-02-11  Alan Modra  <amodra@gmail.com>
+
+	* elfcode.h (elf_checksum_contents): Free contents.
+	* elf-bfd.h (_bfd_elf_link_hash_table_free): Declare.
+	* elflink.c (_bfd_elf_link_hash_table_free): New function.
+	(elf_final_link_free): New function, extracted from..
+	(bfd_elf_final_link): ..here.  Always call
+	_bfd_elf_write_section_eh_frame_hdr.
+	* elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to
+	_bfd_elf_link_hash_table_free.
+	* libbfd-in.h (_bfd_merge_sections_free): Declare.
+	* libbfd.h: Regenerate.
+	* merge.c (_bfd_merge_sections_free): New function.
+	* elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free
+	hdr_info->array.
+	* elf-m10300.c (elf32_mn10300_link_hash_table_free): Call
+	_bfd_elf_link_hash_table_free.
+	* elf32-arm.c (elf32_arm_link_hash_table_free): Likewise.
+	* elf32-avr.c (elf32_avr_link_hash_table_free): Likewise.
+	* elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise.
+	* elf32-i386.c (elf_i386_link_hash_table_free): Likewise.
+	* elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise.
+	* elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise.
+	* elf32-metag.c (elf_metag_link_hash_table_free): Likewise.
+	* elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise.
+	* elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise.
+	* elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise.
+	* elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise.
+	* elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise.
+	* elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise.
+	* elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete.
+	(bfd_elf32_bfd_link_hash_table_free): Don't define.
+	* elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete.
+	(bfd_elf32_bfd_link_hash_table_free): Dont' define.
+
+2013-02-10  Alan Modra  <amodra@gmail.com>
+
+	* coff-arm.c (coff_arm_link_hash_table_create): Use bfd_zmalloc.
+	* coff-h8300.c (h8300_coff_link_hash_table_create): Likewise.
+	* m68klinux.c (linux_link_hash_table_create): Likewise.
+	* sparclinux.c (linux_link_hash_table_create): Likewise.
+	* sunos.c (sunos_link_hash_table_create): Likewise.
+	* xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise.
+	* elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise.
+	* elf32-arm.c (elf32_arm_link_hash_table_create): Likewise.
+	* elf32-avr.c (elf32_avr_link_hash_table_create): Likewise.
+	* elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
+	* elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
+	* elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise.
+	* elf32-i386.c (elf_i386_link_hash_table_create): Likewise.
+	* elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
+	* elf32-m32r.c (m32r_elf_link_hash_table_create): Likewise.
+	* elf32-m68hc1x.c (m68hc11_elf_hash_table_create): Likewise.
+	* elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
+	* elf32-metag.c (elf_metag_link_hash_table_create): Likewise.
+	* elf32-nios2.c (nios2_elf32_link_hash_table_create): Likewise.
+	* elf32-s390.c (elf_s390_link_hash_table_create): Likewise.
+	* elf32-score.c (elf32_score_link_hash_table_create): Likewise.
+	* elf32-spu.c (spu_elf_link_hash_table_create): Likewise.
+	* elf32-tic6x.c (elf32_tic6x_link_hash_table_create): Likewise.
+	* elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
+	* elf32-xgate.c (xgate_elf_bfd_link_hash_table_create): Likewise.
+	* elf32-xtensa.c (elf_xtensa_link_hash_table_create): Likewise.
+	* elf64-aarch64.c (elf64_aarch64_link_hash_table_create): Likewise.
+	* elf64-s390.c (elf_s390_link_hash_table_create): Likewise.
+	* elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise.
+	* elf64-x86-64.c (elf_x86_64_link_hash_table_create): Likewise.
+	* elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise.
+	* elflink.c (_bfd_elf_link_hash_table_create): Likewise.
+	(_bfd_elf_link_hash_table_init): Assume zero fill table on entry.
+
+2013-02-10  Alan Modra  <amodra@gmail.com>
+
+	* i386linux.c (linux_link_hash_table_create): Allocate table
+	with bfd_zmalloc, not bfd_alloc.
+	* pdp11.c (link_hash_table_create): Allocate table with
+	bfd_malloc, not bfd_alloc.
+	* elf32-bfin.c (bfinfdpic_elf_link_hash_table_create): Allocate table
+	with bfd_zmalloc, not bfd_zalloc.
+	(bfin_link_hash_table_create): Likewise.
+	* elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
+	* elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
+
+2013-02-10  Alan Modra  <amodra@gmail.com>
+
+	PR ld/15113
+	* elf32-sh.c (sh_elf_link_hash_table_create): Use bfd_zmalloc.
+
+2013-02-08  Markos Chandras  <markos.chandras@imgtec.com>
+
+	* elf32-metag.c: Use bfd_get_linker_section to get SEC_LINKER_CREATED
+	sections.
+	(elf_metag_adjust_dynamic_symbol): Don't error on zero size dynbss
+	symbol.
+
+2013-02-08  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* elf64-aarch64.c (elf64_aarch64_grok_prstatus): Change 'size' from
+	288 to 272.
+
+2013-02-08  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/15106
+	* elf-bfd.h (struct elf_obj_tdata): Add elf_find_function_cache.
+	* elf.c (elf_find_function): Revert last change.  Use new
+	tdata field rather than static vars for cache.
+
+2013-02-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/15107
+	* elflink.c (elf_link_output_extsym): Set STB_GNU_UNIQUE only if
+	symbol is defined in regular object.
+
+2013-02-07  Roberto Agostino Vitillo  <ra.vitillo@gmail.com>
+
+	PR binutils/15106
+	* elf.c (elf_find_function): Don't cache if symbols change.
+
+2013-02-07  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/14873
+	* elf-attrs.c (_bfd_elf_copy_obj_attributes): Don't attempt to
+	copy attributes from or to non-ELF.
+
+2013-02-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_allocate_dynrelocs): Don't clear pc_count
+	for non-zero TLS symbol.
+	(elf_i386_relocate_section): Don't resolve size relocation against
+	non-zero TLS symbol.
+	* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Don't clear
+	pc_count for non-zero TLS symbol.
+	(elf_x86_64_relocate_section): Don't resolve size relocation
+	against non-zero TLS symbol.
+
+2013-02-06  Sandra Loosemore  <sandra@codesourcery.com>
+	    Andrew Jenner <andrew@codesourcery.com>
+
+	Based on patches from Altera Corporation.
+
+	* Makefile.am (ALL_MACHINES): Add cpu-nios2.lo.
+	(ALL_MACHINES_CFILES): Add cpu-nios2.c.
+	(BFD_BACKENDS): Add elf32-nios2.lo.
+	(BFD32_BACKENDS_CFILES): Add elf32-nios2.c.
 	* Makefile.in: Regenerated.
-	* configure.in (bfd_elf64_x86_64_nacl_vec): Add elf-nacl.o to tb here.
-	(bfd_elf32_x86_64_nacl_vec): Likewise.
-	(bfd_elf64_x86_64_vec, bfd_elf32_x86_64_vec): Likewise.
-	(bfd_elf64_x86_64_freebsd_vec, bfd_elf64_x86_64_sol2_vec): Likewise.
-	(bfd_elf64_l1om_vec, bfd_elf64_l1om_freebsd_vec): Likewise.
-	(bfd_elf64_k1om_vec, bfd_elf64_k1om_freebsd_vec): Likewise.
-	(bfd_elf32_i386_nacl_vec): Likewise.
-	(bfd_elf32_i386_sol2_vec, bfd_elf32_i386_freebsd_vec): Likewise.
-	(bfd_elf32_i386_vxworks_vec, bfd_elf32_i386_vec): Likewise.
+	* configure.in: Add entries for bfd_elf32_bignios2_vec and
+	bfd_elf32_littlenios2_vec.
 	* configure: Regenerated.
-
-2012-03-31  Andreas Schwab  <schwab@linux-m68k.org>
-
-	* elf32-m68k.c (elf_m68k_relocate_section): Allow
-	R_68K_TLS_LE{8,16,32} for PIE.
-
-2012-03-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
-
-	* elf64-s390.c: Fix several comments regarding PLT entry
-	description.
-	* elf32-s390.c: Likewise.
-
-2012-03-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
-
-	* elf64-s390.c: Use the section pointer shortcuts in
-	elf_link_hash_table and remove them from the target specific
-	variant.
-	* elf32-s390.c: Likewise.
-
-2012-03-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
-
-	* elf64-s390.c (elf_s390x_plt_entry, elf_s390x_first_plt_entry):
-	New definitions.
-	(PLT_PIC_ENTRY_WORD*, PLT_PIC12_ENTRY_WORD*): Remove.
-	(elf_s390_finish_dynamic_symbol): Use memcpy instead of bfd_put_32.
-	(elf_s390_finish_dynamic_sections): Likewise.
-	* elf32-s390.c (elf_s390_plt_entry, elf_s390_plt_pic_entry)
-	(elf_s390_plt_pic12_entry, elf_s390_plt_pic16_entry)
-	(elf_s390_plt_first_entry, elf_s390_plt_pic_first_entry): New definitions.
-	(PLT_PIC16_ENTRY_WORD*, PLT_ENTRY_WORD*)
-	(PLT_PIC_FIRST_ENTRY_WORD*, PLT_FIRST_ENTRY_WORD*): Remove.
-
-2012-03-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
-
-	* elf32-s390.c (struct elf_s390_dyn_relocs): Remove.
-	Rename all occurrences in the file to elf_dyn_relocs.
-	* elf64-s390.c: Likewise.
-
-2012-03-30  Alan Modra  <amodra@gmail.com>
-
-	* elflink.c (_bfd_elf_gc_mark_reloc): Don't delve into dynamic
-	libraries.
-
-2012-03-29  Alan Modra  <amodra@gmail.com>
-
-	* bfd-in.h (bfd_get_arch_size, bfd_get_sign_extend_vma): Delete.
-	* bfd-in2.h: Regenerate.
-
-2012-03-23  Alan Modra  <amodra@gmail.com>
-
-	* elf.c (assign_file_positions_for_non_load_sections): Don't warn
-	on empty alloc sections.
-
-2012-03-23  Alan Modra  <amodra@gmail.com>
-
-	* linker.c (_bfd_nearby_section): New function, split out from..
-	(fix_syms): ..here.
-	* bfd-in.h (_bfd_nearby_section): Declare.
-	* bfd-in2.h: Regenerate.
-	* elflink.c (elf_link_input_bfd): Don't use text_index_section or
-	data_index_section with ld -q or ld -r output relocs against
-	stripped output sections.  Instead use _bfd_nearby_section.
-
-2012-03-23  Alan Modra  <amodra@gmail.com>
-
-	PR binutils/13894
-	* elf64-ppc.c (opd_entry_value): Read full symbol table when
-	sym hashes unavailable.
-
-2012-03-21  Eliot Dresselhaus  <eliot@sonic.net>
-
-	* elf32-tic6x.c (elf32_tic6x_merge_private_bfd_data): Return TRUE
-	for non-C6X objects.
-
-2012-03-20  Kai Tietz  <ktietz@redhat.com>
-
-	PR ld/12742
-	* configure.in (AC_CHECK_HEADERS): Test for windows.h and dlfcn.h.
-	* plugin.c: Guard include of dlfcn.h if HAVE_DLFCN_H is defined.
-	Add windows.h header include if HAVE_WINDOWS_H is defined.
-	(dlerror): New static function if windows variant is used instead
-	of dlfcn.h.
-	(dlclose): Likewise.
-	(dlopen): Likewise.
-	(dlsym): Likewise.
-	* configure: Regenerated.
-	* config.in: Regenerated.
-
-2012-03-20  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR ld/13880
-	* elf32-i386.c (elf_i386_relocate_section): Don't issue an error
-	for R_386_GOTOFF relocation against protected function if
-	SYMBOLIC_BIND is true.
-
-	* elf64-x86-64.c (elf_x86_64_relocate_section): Don't issue an
-	error for R_X86_64_GOTOFF64 relocation against protected function
-	when building executable or SYMBOLIC_BIND is true.
-
-2012-03-16  Roland McGrath  <mcgrathr@google.com>
-
-	* config.bfd: Handle x86_64-*-nacl*.
-	* elf64-x86-64.c (bfd_elf64_x86_64_nacl_vec): New backend vector stanza.
-	(bfd_elf32_x86_64_nacl_vec): Likewise.
-	* targets.c: Support them.
-	* configure.in: Likewise.
-	* configure: Regenerated.
-
-2012-03-16  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
-
-	* elf32-arm.c (elf32_arm_attributes_accept_div): New function.
-	(elf32_arm_attributes_forbid_div): Likewise.
-	(elf32_arm_merge_eabi_attributes): Correct handling of
-	Tag_DIV_use.
-
-2012-03-15  Roland McGrath  <mcgrathr@google.com>
-
-	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Use
-	elf_x86_64_backend_data parameters for plt_eh_frame.
-
-	* elf64-x86-64.c (struct elf_x86_64_backend_data): New type.
-	(get_elf_x86_64_backend_data, GET_PLT_ENTRY_SIZE): New macros.
-	(elf_x86_64_arch_bed): New variable.
-	(elf_backend_arch_data): New macro.
-	(elf_x86_64_adjust_dynamic_symbol): Use GET_PLT_ENTRY_SIZE.
-	(elf_x86_64_allocate_dynrelocs): Likewise.
-	(elf_x86_64_relocate_section): Likewise.
-	(elf_x86_64_plt_sym_val): Likewise.
-	(elf_x86_64_finish_dynamic_symbol): Use elf_x86_64_backend_data
-	parameters for PLT details.
-	(elf_x86_64_finish_dynamic_sections): Likewise.
-
-2012-03-14  Roland McGrath  <mcgrathr@google.com>
-
-	* elf32-i386.c (elf_i386_nacl_pic_plt0_entry): Initialize up
-	to the full size, padding out with nop instructions.
-
-2012-03-12  Alan Modra  <amodra@gmail.com>
-
-	* elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Don't warn
-	on zero size dynbss symbol.
-	* elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise.
-	* elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise.
-	* elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise.
-	* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
-	* elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise.
-	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise.
-	* elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise.
-	* elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise.
-	* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
-	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
-	* elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
-	* elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise.
-	* elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise.
-	* elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol): Likewise.
-	* elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise.
-	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
-	* elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
-	* elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise.
-	* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
-	* elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise.
-	* elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol): Likewise.
-
-2012-03-10  Edmar Wienskoski  <edmar@freescale.com>
-
-	* archures.c: Add bfd_mach_ppc_e5500 and bfd_mach_ppc_e6500.
-	* bfd-in2.h: Regenerate.
-	* cpu-powerpc.c (bfd_powerpc_archs): Add entries for
-	bfd_mach_ppc_e5500 and bfd_mach_ppc_e6500.
-
-2012-03-09  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR ld/13817
-	* elf32-i386.c (elf_i386_relocate_section): Restore
-	R_386_IRELATIVE.
-
-	* elf64-x86-64.c (elf_x86_64_relocate_section): Restore
-	R_X86_64_IRELATIVE.
-
-2012-03-08  Tristan Gingold  <gingold@adacore.com>
-
-	* vms-lib.c (_bfd_vms_lib_write_archive_contents): Set maximum
-	keylen according to archive kind.  Set nextvbn and nextrfa lhd
-	fields.  Add comments.
-
-2012-03-07  Nick Clifton  <nickc@redhat.com>
-
-	* elf-m10300.c (elf32_mn10300_link_hash_entry): Add tls_type
-	field.
-	(elf32_mn10300_link_hash_table): Add tls_ldm_got entry;
-	(elf_mn10300_tdata): Define.
-	(elf_mn10300_local_got_tls_type): Define.
-	(elf_mn10300_howto_table): Add entries for R_MN10300_TLS_GD,
-	R_MN10300_TLS_LD, R_MN10300_TLS_LDO, R_MN10300_TLS_GOTIE,
-	R_MN10300_TLS_IE, R_MN10300_TLS_LE, R_MN10300_TLS_DPTMOD,
-	R_MN10300_TLS_DTPOFF, R_MN10300_TLS_TPOFF relocs.
-	(mn10300_reloc_map): Likewise.
-	(elf_mn10300_tls_transition): New function.
-	(dtpoff, tpoff, mn10300_do_tls_transition): New functions.
-	(mn10300_elf_check_relocs): Add TLS support.
-	(mn10300_elf_final_link_relocate): Likewise.
-	(mn10300_elf_relocate_section): Likewise.
-	(mn10300_elf_relax_section): Likewise.
-	(elf32_mn10300_link_hash_newfunc): Initialise new field.
-	(_bfd_mn10300_copy_indirect_symbol): New function.
-	(elf32_mn10300_link_hash_table_create): Initialise new fields.
-	(_bfd_mn10300_elf_size_dynamic_sections): Add TLS support.
-	(_bfd_mn10300_elf_finish_dynamic_symbol): Likewise.
-	(_bfd_mn10300_elf_reloc_type_class): Allocate an
-	elf_mn10300_obj_tdata structure.
-	(elf_backend_copy_indirect_symbol): Define.
-	* reloc.c (BFD_MN10300_TLS_GD, BFD_MN10300_TLS_LD,
-	BFD_MN10300_TLS_LDO, BFD_MN10300_TLS_GOTIE, BFD_MN10300_TLS_IE,
-	BFD_MN10300_TLS_LE, BFD_MN10300_TLS_DPTMOD,
-	BFD_MN10300_TLS_DTPOFF, BFD_MN10300_TLS_TPOFF): New relocations.
-	(BFD_RELOC_MN10300_32_PCREL, BFD_RELOC_MN10300_16_PCREL): Move to
-	alongside other MN10300 relocations.
-	* bfd-in2.h: Regenerate.
-	* libbfd.h: Regenerate.
-
-2012-03-06  Jakub Jelinek  <jakub@redhat.com>
-
-	* elf64-x86-64.c (elf_x86_64_relocate_section): For R_X86_64_RELATIVE
-	set relocate to TRUE.
-
-2012-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
-
-	PR ld/12152
-	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Also ignore
-	overflows for R_SPARC_UA32 in .stab sections.
-
-2012-03-01  Alan Modra  <amodra@gmail.com>
-
-	* elfxx-tilegx.c (tilegx_elf_relocate_section): Silence bogus warning.
-
-2012-02-27  Alan Modra  <amodra@gmail.com>
-
-	* elf32-sh.c (sh_elf_osec_to_segment): Check for elf flavour bfd
-	before calling elf specific function.
-	(sh_elf_osec_readonly_p): Test for error return from above.
-
-2012-02-27  Alan Modra  <amodra@gmail.com>
-
-	* elf32-spu.c (build_stub): Fix malloc under-allocation.
-
-2012-02-25  Walter Lee  <walt@tilera.com>
-	* reloc.c: Add BFD_RELOC_TILEPRO_TLS_GD_CALL,
-	BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD,
-	BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD,
-	BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD,
-	BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD,
-	BFD_RELOC_TILEPRO_TLS_IE_LOAD, BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE,
-	BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE,
-	BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_LO,
-	BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_LO,
-	BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HI,
-	BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HI,
-	BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA,
-	BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA,
-	BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE,
-	BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_LE,
-	BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_LE,
-	BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_LE,
-	BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_LE,
-	BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_LE,
-	BFD_RELOC_TILEGX_TLS_GD_CALL, BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD,
-	BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD,
-	BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD,
-	BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD, BFD_RELOC_TILEGX_TLS_IE_LOAD,
-	BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD,
-	BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD,
-	BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD, BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD.
-	Delete BFD_RELOC_TILEGX_IMM16_X0_HW1_GOT,
-	BFD_RELOC_TILEGX_IMM16_X1_HW1_GOT,
-	BFD_RELOC_TILEGX_IMM16_X0_HW2_GOT,
-	BFD_RELOC_TILEGX_IMM16_X1_HW2_GOT,
-	BFD_RELOC_TILEGX_IMM16_X0_HW3_GOT,
-	BFD_RELOC_TILEGX_IMM16_X1_HW3_GOT,
-	BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_GOT,
-	BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_GOT,
-	BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_GD,
-	BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_GD,
-	BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_GD,
-	BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_GD,
-	BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_GD,
-	BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_GD,
-	BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_GD,
-	BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_GD,
-	BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_IE,
-	BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_IE,
-	BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_IE,
-	BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_IE,
-	BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_IE,
-	BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_IE,
-	BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_IE,
-	BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_IE.
-	* elf32-tilepro.c (tilepro_elf_howto_table): Update tilepro
-	relocations.
-	(tilepro_reloc_map): Ditto.
-	(tilepro_info_to_howto_rela): Ditto.
-	(reloc_to_create_func): Ditto.
-	(tilepro_tls_translate_to_le): New.
-	(tilepro_tls_translate_to_ie): New.
-	(tilepro_elf_tls_transition): New.
-	(tilepro_elf_check_relocs): Handle new tls relocations.
-	(tilepro_elf_gc_sweep_hook): Ditto.
-	(allocate_dynrelocs): Ditto.
-	(tilepro_elf_relocate_section): Ditto.
-	(tilepro_replace_insn): New.
-	(insn_mask_X1): New.
-	(insn_mask_X0_no_dest_no_srca): New
-	(insn_mask_X1_no_dest_no_srca): New
-	(insn_mask_Y0_no_dest_no_srca): New
-	(insn_mask_Y1_no_dest_no_srca): New
-	(srca_mask_X0): New
-	(srca_mask_X1): New
-	(insn_tls_le_move_X1): New
-	(insn_tls_le_move_zero_X0X1): New
-	(insn_tls_ie_lw_X1): New
-	(insn_tls_ie_add_X0X1): New
-	(insn_tls_ie_add_Y0Y1): New
-	(insn_tls_gd_add_X0X1): New
-	(insn_tls_gd_add_Y0Y1): New
-	* elfxx-tilegx.c (tilegx_elf_howto_table): Update tilegx
-	relocations.
-	(tilegx_reloc_map): Ditto.
-	(tilegx_info_to_howto_rela): Ditto.
-	(reloc_to_create_func): Ditto.
-	(tilegx_elf_link_hash_table): New field disable_le_transition.
-	(tilegx_tls_translate_to_le): New.
-	(tilegx_tls_translate_to_ie): New.
-	(tilegx_elf_tls_transition): New.
-	(tilegx_elf_check_relocs): Handle new tls relocations.
-	(tilegx_elf_gc_sweep_hook): Ditto.
-	(allocate_dynrelocs): Ditto.
-	(tilegx_elf_relocate_section): Ditto.
-	(tilegx_copy_bits): New.
-	(tilegx_replace_insn): New.
-	(insn_mask_X1): New.
-	(insn_mask_X0_no_dest_no_srca): New.
-	(insn_mask_X1_no_dest_no_srca): New.
-	(insn_mask_Y0_no_dest_no_srca): New.
-	(insn_mask_Y1_no_dest_no_srca): New.
-	(insn_mask_X0_no_operand): New.
-	(insn_mask_X1_no_operand): New.
-	(insn_mask_Y0_no_operand): New.
-	(insn_mask_Y1_no_operand): New.
-	(insn_tls_ie_ld_X1): New.
-	(insn_tls_ie_ld4s_X1): New.
-	(insn_tls_ie_add_X0X1): New.
-	(insn_tls_ie_add_Y0Y1): New.
-	(insn_tls_ie_addx_X0X1): New.
-	(insn_tls_ie_addx_Y0Y1): New.
-	(insn_tls_gd_add_X0X1): New.
-	(insn_tls_gd_add_Y0Y1): New.
-	(insn_move_X0X1): New.
-	(insn_move_Y0Y1): New.
-	(insn_add_X0X1): New.
-	(insn_add_Y0Y1): New.
-	(insn_addx_X0X1): New.
-	(insn_addx_Y0Y1): New.
-	* libbfd.h: Regenerate.
-	* bfd-in2.h: Regenerate.
-
-2012-02-25  Walter Lee  <walt@tilera.com>
-
-	* config.bfd (tilegx-*-*): rename little endian vector; add big
-	endian vector.
-	(tilegxbe-*-*): New case.
-	* configure.in (bfd_elf32_tilegx_vec): Rename...
-	(bfd_elf32_tilegx_le_vec): ... to this.
-	(bfd_elf32_tilegx_be_vec): New vector.
-	(bfd_elf64_tilegx_vec): Rename...
-	(bfd_elf64_tilegx_le_vec): ... to this.
-	(bfd_elf64_tilegx_be_vec): New vector.
-	* configure: Regenerate.
-	* elf32-tilegx.c (TARGET_LITTLE_SYM): Rename.
-	(TARGET_LITTLE_NAME): Ditto.
-	(TARGET_BIG_SYM): Define.
-	(TARGET_BIG_NAME): Define.
-	* elf64-tilegx.c (TARGET_LITTLE_SYM): Rename.
-	(TARGET_LITTLE_NAME): Ditto.
-	(TARGET_BIG_SYM): Define.
-	(TARGET_BIG_NAME): Define.
-	* targets.c (bfd_elf32_tilegx_vec): Rename...
-	(bfd_elf32_tilegx_le_vec): ... to this.
-	(bfd_elf32_tilegx_be_vec): Declare.
-	(bfd_elf64_tilegx_vec): Rename...
-	(bfd_elf64_tilegx_le_vec): ... to this.
-	(bfd_elf64_tilegx_be_vec): Declare.
-	(_bfd_target_vector): Add / rename above vectors.
-	* arctures.c (bfd_architecture): Define bfd_mach_tilegx32.
-	* bfd-in2.h: Regenerate.
-	* cpu-tilegx.c (bfd_tilegx32_arch): define.
-	(bfd_tilegx_arch): link to bfd_tilegx32_arch.
-
-2012-02-24  Nick Clifton  <nickc@redhat.com>
-
-	PR ld/13730
-	* reloc.c (bfd_generic_get_relocated_section_contents): Issue an
-	error message instead of aborting, when an outofrange reloc is
-	encountered.
-
-2012-02-23  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_swap_in_non_scattered_reloc): New.
-	(bfd_mach_o_canonicalize_one_reloc):  Swap non-scattered reloc
-	bit-fields when target and host differ in endian-ness.  When
-	PAIRs are non-scattered	find the 'symbol' from the preceding
-	reloc.  Add FIXME re. reloc symbols on section boundaries.
-	(bfd_mach_o_swap_out_non_scattered_reloc): New.
-	(bfd_mach_o_write_relocs): Use bfd_mach_o_encode_non_scattered_reloc.
-
-2012-02-17  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o-i386.c (i386_howto_table): Add support for 16 bit
-	sect-diffs.
-	(bfd_mach_o_i386_swap_reloc_in): Handle 16bit sect-diffs.
-	(bfd_mach_o_i386_swap_reloc_out): Likewise.
-
-2012-02-17  Tristan Gingold  <gingold@adacore.com>
-
-	* reloc.c (BFD_RELOC_MACH_O_LOCAL_SECTDIFF):
+	* config.bfd: Add cases for nios2.
+	* archures.c (enum bfd_architecture): Add bfd_arch_nios2.
+	(bfd_mach_nios2): Define.
+	(bfd_nios2_arch): Declare.
+	(bfd_archures_list): Add bfd_nios2_arch.
+	* targets.c (bfd_elf32_bignios2_vec): Declare.
+	(bfd_elf32_littlenios2_vec): Declare.
+	(_bfd_target_vector): Add entries for bfd_elf32_bignios2_vec and
+	bfd_elf32_littlenios2_vec.
+	* elf-bfd.h (enum elf_target_id): Add NIOS2_ELF_DATA.
+	* reloc.c (enum bfd_reloc_code_real): Add Nios II relocations.
+	* bfd-in2.h: Regenerated.
 	* libbfd.h: Regenerated.
+	* cpu-nios2.c: New file.
+	* elf32-nios2.c: New file.
+
+2013-02-06  Alan Modra  <amodra@gmail.com>
+
+	* elf32-arm.c (elf32_arm_final_link_relocate): Only test for
+	stubs in stub_bfd.
+
+2013-02-06  Alan Modra  <amodra@gmail.com>
+
+	* Makefile.am (SOURCE_HFILES): Add `elf-linux-psinfo.h'.
+	* Makefile.in: Regenerate.
+
+2013-02-04  Sergio Durigan Junior  <sergiodj@redhat.com>
+	    Pedro Alves  <palves@redhat.com>
+
+	* Makefile.in (SOURCE_HFILES): Add `elf-linux-psinfo.h'.
+	* elf-bfd.h (elf_internal_linux_prpsinfo): New structure
+	declaration.
+	(elfcore_write_linux_prpsinfo32, elfcore_write_linux_prpsinfo64)
+	(elfcore_write_ppc32_linux_prpsinfo32): New declarations.
+	* elf-linux-psinfo.h: New file.
+	* elf.c: Include elf-linux-psinfo.h.
+	(elfcore_write_linux_prpsinfo32, elfcore_write_linux_prpsinfo64):
+	New functions.
+	* elf32-ppc.c: Include `elf-linux-psinfo.h'.
+	(elf_external_ppc_linux_prpsinfo32): New structure declaration.
+	(PPC_LINUX_PRPSINFO32_SWAP_FIELDS): New macro.
+	(elfcore_write_ppc_linux_prpsinfo32): New function.
+
+2013-02-04  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_scan_start_address): Do not fail if no
+	start address.
+
+2013-02-04  Alan Modra  <amodra@gmail.com>
+
+	* Makefile.am (BFD64_BACKENDS): Remove elf-nacl.lo.
+	(BFD64_BACKENDS_CFILES): Remove elf-nacl.c.
+	* Makefile.in: Regenerate.
+	* po/SRC-POTFILES.in: Regenerate.
+
+2013-02-04  Alan Modra  <amodra@gmail.com>
+
+	* coff-tic54x.c (SWAP_OUT_RELOC_EXTRA): Delete.
+	* coff-tic80.c (SWAP_OUT_RELOC_EXTRA): Delete.
+
+2013-02-01  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (dec_dynrel_count): Don't error when elf_gc_sweep_symbol
+	clears def_regular.
+
+2013-01-31  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_scan): Call bfd_mach_o_flatten_sections
+	earlier.  Fix status checking of bfd_mach_o_scan_start_address.
+	(bfd_mach_o_scan_start_address): Handle LC_MAIN.
+
+2013-01-31  Alan Modra  <amodra@gmail.com>
+	    David S. Miller  <davem@davemloft.net>
+
+	PR ld/15056
+	* elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Handle implicit
+	references to __tls_get_addr.
+	* elf32-tilpro.c (tilepro_elf_gc_mark_hook): Likewise.  Correct
+	vtinherit and vtentry reloc handling too.
+	* elfxx-tilegx.c (tilegx_elf_gc_mark_hook): As for tilepro.
+
+2013-01-31  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc_stub_name): Trim off trailing "+0".
+
+2013-01-31  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (build_plt_stub): Correct plt stub branch to glink.
+
+2013-01-28  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c: Use %T to print symbols names and remove redundant
+	"relocation" in error messages throughout file.
+	(ppc64_elf_relocate_section): Remove sibling call error message,
+	replace with "call lacks nop".  Specially report errors for
+	branches to function entry points via OPD lookup and branches
+	to stubs.  Remove NULL symbol handling now done by %T.
+
+2013-01-28  Alan Modra  <amodra@gmail.com>
+
+	* archive.c (bfd_generic_archive_p): Return target and keep
+	ardata on partial matches.
+	* format.c (bfd_check_format_matches): Adjust for above
+	change.  Remove bfd_error_file_ambiguously_recognized dead
+	code.
+
+2013-01-26  Alan Modra  <amodra@gmail.com>
+
+	* bfd.c (struct bfd_preserve, bfd_preserve_save, bfd_preserve_restore,
+	bfd_preserve_finish): Move to..
+	* format.c: ..here, splitting out..
+	(bfd_reinit): ..this.  New function.
+	(bfd_check_format_matches): Use bfd_preserve_save/restore to
+	keep bfd state for a match.
+	* elfcode.h (elf_object_p): Don't use bfd_preserve_save/restore.
+	* elfcore.h (elf_core_file_p): Likewise.
+	* mach-o.c (bfd_mach_o_header_p): Likewise.
+	* pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
+	* xsym.c (bfd_sym_object_p): Likewise.
+	* mmo.c (mmo_scan): Clear abfd->symcount.
+	* opncls.c (_bfd_new_bfd): Use a smaller section hash table.
+	* section.c (bfd_section_list_clear): Clear section_htab.count.
+	* bfd-in2.h: Regenerate.
+
+2013-01-25  Michael Schewe  <michael.schewe@gmx.net>
+
+	* elf32-h8300.c (elf32_h8_relax_section): When checking for a
+	second reloc, make sure that the reloc potentially exists first.
+
+2013-01-24  Nick Clifton  <nickc@redhat.com>
+
+	* archures.c: Add bfd_mach_v850e3v5.
+	* bfd-in2.h: Regenerate.
+	* cpu-v850.c: Add entries for v850e2v5 and v850e3v5.
+	* cpu-v850_rh850.c: Likewise.
+	* elf32-v850.c: Add support for v850e3v5 architecture.
+
+2013-01-23  Markos Chandras  <markos.chandras@imgtec.com>
+
+	* elf32-metag.c: Error on HIADDR16/LOADDR16 in shared link.
+
+2013-01-23  Leif Ekblad  <leif@rdos.net>
+
+	* config.bfd (x86_64-*-rdos*): Remove targ_selvecs.
+
+2013-01-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_allocate_dynrelocs): Clear pc_count for
+	non-zero TLS symbol.
+	(elf_i386_relocate_section): Resolve size relocation against
+	non-zero TLS symbol.
+	* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Clear pc_count
+	for non-zero TLS symbol.
+	(elf_x86_64_relocate_section): Resolve size relocation against
+	non-zero TLS symbol.
+
+2013-01-18  Mike Frysinger  <vapier@gentoo.org>
+
+	* elflink.c (bfd_elf_size_dynamic_sections): Only add DT_RPATH
+	when new_dtags is false.  Only add DT_RUNPATH when new_dtags is
+	true.
+
+2013-01-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_check_relocs): Count size relocation as
+	PC-relative relocation.
+	* elf64-x86-64.c (elf_x86_64_check_relocs): Count size relocation
+	as PC-relative relocation.
+
+2013-01-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_check_relocs): Update R_386_SIZE32
+	check.
+	(elf_i386_relocate_section): Don't check TLS for R_386_SIZE32.
+
+	* elf64-x86-64.c (elf_x86_64_check_relocs): Update R_X86_64_SIZE32
+	and R_X86_64_SIZE64 check.
+	(elf_x86_64_relocate_section): Don't check TLS for R_X86_64_SIZE32
+	nor R_X86_64_SIZE64.
+
+2013-01-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* bfd-in2.h: Regenerated.
+	* libbfd.h: Likewise.
+
+	* elf32-i386.c (elf_howto_table): Fill R_386_SIZE32 entry.
+	(elf_i386_reloc_type_lookup): Support BFD_RELOC_SIZE32.
+	(elf_i386_check_relocs): Handle R_386_SIZE32.
+	(elf_i386_gc_sweep_hook): Likewise.
+	(elf_i386_relocate_section): Likewise.
+
+	* elf64-x86-64.c (x86_64_elf_howto_table): Fill R_X86_64_SIZE32
+	and R_X86_64_SIZE64 entries.
+	(x86_64_reloc_map): Add BFD_RELOC_SIZE32 and BFD_RELOC_SIZE64,
+	(elf_x86_64_rtype_to_howto): Handle R_X86_64_SIZE32 for x32.
+	(elf_x86_64_reloc_name_lookup): Likewise.
+	(elf_x86_64_check_relocs): Handle R_X86_64_SIZE32 and
+	R_X86_64_SIZE64.
+	(elf_x86_64_gc_sweep_hook): Likewise.
+	(elf_x86_64_relocate_section): Likewise.
+
+	* reloc.c (bfd_reloc_code_type): Add BFD_RELOC_SIZE32 and
+	BFD_RELOC_SIZE64.
+
+2013-01-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf64-x86-64.c (R_X86_64_standard): Replace R_X86_64_IRELATIVE
+	with R_X86_64_RELATIVE64.
+
+2013-01-15  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-msp430.c: Fix spelling typo.
+
+2013-01-15  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_size_stubs): Default shared libs to
+	plt-thread-safe.
+
+2013-01-14  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/14813
+	* bfdio.c (struct bfd_iovec <bclose>): Revert 2012-11-06.
+	(memory_bclose): Likewise.  Return 0 on success.
+	* cache.c (cache_bclose): Likewise.
+	* opncls.c (opncls_bclose, bfd_close): Likewise.
+	* vms-lib.c (vms_lib_bclose): Likewise.
+	* libbfd.h: Regenerate.
+
+2013-01-13  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (struct elf_link_hash_entry): Delete dynamic_weak.
+	Add ref_dynamic_nonweak.
+	* elflink.c (_bfd_elf_mark_dynamic_def_weak): Delete.
+	(_bfd_elf_merge_symbol): Don't call above function.  Move
+	setting of ref_dynamic_nonweak and dynamic_def earlier.  Don't
+	clear dynamic_def.
+	(elf_link_add_object_symbols): Delete redundant "override" test.
+	Don't set dynamic_def here.
+	(elf_link_output_extsym): Update.
+
+2013-01-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_check_relocs): Set bfd errror for
+	normal and TLS symbol access.
+	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
+
+2013-01-12  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h (_bfd_elf_strtab_refcount): Declare.
+	* elf-strtab.c (_bfd_elf_strtab_refcount): New function.
+	* elflink.c (elf_add_dt_needed_tag): Use _bfd_elf_strtab_refcount.
+
+2013-01-12  Alan Modra  <amodra@gmail.com>
+
+	PR ld/12549
+	* elf-bfd.h (_bfd_elf_strtab_clear_refs): Declare.
+	(_bfd_elf_strtab_clear_all_refs): Define.
+	* elf-strtab.c (_bfd_elf_strtab_clear_refs): New function.
+	(_bfd_elf_strtab_clear_all_refs): Delete.
+	* elflink.c (elf_link_add_object_symbols): Clear out added
+	strtab refs.  Correct handling of warning common symbols.
+
+2013-01-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* aout0.c: Remove trailing white spaces.
+	* archive.c: Likewise.
+	* archures.c: Likewise.
+	* bfd-in.h: Likewise.
 	* bfd-in2.h: Likewise.
-	* mach-o-i386.c (i386_howto_table): Include local sectdiff.
-	(bfd_mach_o_i386_swap_reloc_in): Update for local sectdiff.
-	(bfd_mach_o_i386_swap_reloc_out): Likewise.
-
-2012-02-17  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
-
-	* elf32-s390.c (elf_s390_relocate_section): Support basr in the
-	GD->LE and LD->LE optimizations.
-
-2012-02-16  Alan Modra  <amodra@gmail.com>
-
-	PR binutils/13355
-	* elf32-rx.c (elf32_rx_relax_section): Correct width check.
-
-2012-02-13  Richard Henderson  <rth@redhat.com>
-
-	PR ld/13621
-	* linker.c (fix_syms): Force symbols outside any section into
-	bfd_abs_section_ptr.
-
-2012-02-13  Alan Modra  <amodra@gmail.com>
-
-	* elf32-m68hc1x.c (elf32_m68hc11_merge_symbol_attribute): New function.
-	* elf32-m68hc1x.h (elf32_m68hc11_merge_symbol_attribute): Declare.
-	* elf32-m68hc11.c (elf_backend_merge_symbol_attribute): Define.
-	* elf32-m68hc12.c (elf_backend_merge_symbol_attribute): Define.
-
-2012-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
-	    Nick Clifton  <nickc@redhat.com>
-
-	* oasys.c (oasys_write_header): Fix compilation warning on zero-sized
-	memset.
-
-2012-02-10  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_build_seg_command): Count zerofill section
-	vma additions in their logical, rather than physical order.
-
-2012-02-10  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (mach_o_section_name_xlat): Correct eh-frame section
-	parameters.
-	* mach-o-x86-64.c (text_section_names_xlat): New.
-	(mach_o_x86_64_segsec_names_xlat): New.
-	(bfd_mach_o_tgt_seg_table): Define to mach_o_x86_64_segsec_names_xlat.
-	* mach-o-i386.c (text_section_names_xlat): Correct section parameters.
-
-2012-02-10  Tristan Gingold  <gingold@adacore.com>
-
-	* elfnn-ia64.c (elfNN_vms_object_p): Change comparison operator
-	to avoid infinite loop.  Add comments.
-
-2012-02-09  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR ld/13675
-	* cpu-i386.c (bfd_arch_i386_fill): Updated to support multi byte
-	nop instructions.
-	(bfd_arch_i386_short_nop_fill): New.
-	(bfd_arch_i386_long_nop_fill): Likewise.
-	Use bfd_arch_i386_short_nop_fill in 32bit bfd_arch_info
-	initializers.  Use bfd_arch_i386_long_nop_fill on 64bit
-	bfd_arch_info initializers.
-
-	* cpu-k1om.c (bfd_arch_i386_fill): Renamed to ...
-	(bfd_arch_i386_short_nop_fill): This.
-	Update bfd_arch_info initializers.
-	* cpu-l1om.c: Likewise.
-
-2012-02-08  Alan Modra  <amodra@gmail.com>
-
-	* elflink.c (_bfd_elf_gc_mark_rsec): Mark weakdef syms too.
-	(_bfd_elf_fix_symbol_flags): When a weakdef is def_regular, clear
-	the correct h->u.weakdef.
-
-2012-02-07  Alan Modra  <amodra@gmail.com>
-
-	* elf.c (elf_find_function): Don't use internal_elf_sym.
-	(_bfd_elf_maybe_function_sym): Likewise.  Replace elf_symbol_type
-	parameter with asymbol.
-	* elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise.
-	* elf-bfd.h (_bfd_elf_maybe_function_sym): Update prototype.
-	(struct elf_backend_data <maybe_function_sym>): Likewise.
-
-2012-02-02  Vidya Praveen (vidya.praveen@atmel.com)
-
-	PR bfd/13410
-	* elf32-avr.c (elf32_avr_relax_section): Correct the
-	condition that qualifies the candidates for relaxation.
-
-2012-02-02  Tristan Gingold  <gingold@adacore.com>
-
-	* bfdio.c (real_fopen): Remove unused vms_modes variable.
-
-2012-02-02  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o.c (bfd_mach_o_read_header): Silent uninitialized
-	variable warning.
-
-2012-02-02  Tristan Gingold  <gingold@adacore.com>
-
-	* archive.c (bfd_slurp_armap): Fix thinko in cast.
-
-2012-01-31  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR ld/13616
-	* archures.c (bfd_arch_info): Add fill.
-	(bfd_default_arch_struct): Add bfd_arch_default_fill.
-	(bfd_arch_default_fill): New.
-
-	* configure.in: Set bfd version to 2.22.52.
-	* configure: Regenerated.
-
-	* cpu-alpha.c: Add bfd_arch_default_fill to bfd_arch_info
-	initializer.
-	* cpu-arc.c: Likewise.
+	* coff-alpha.c: Likewise.
+	* coff-i860.c: Likewise.
+	* coff-mips.c: Likewise.
+	* coff-ppc.c: Likewise.
+	* coff-tic80.c: Likewise.
+	* coff-x86_64.c: Likewise.
+	* coff-z80.c: Likewise.
+	* coffcode.h: Likewise.
+	* coffgen.c: Likewise.
+	* cofflink.c: Likewise.
+	* compress.c: Likewise.
+	* corefile.c: Likewise.
 	* cpu-arm.c: Likewise.
 	* cpu-avr.c: Likewise.
 	* cpu-bfin.c: Likewise.
 	* cpu-cr16.c: Likewise.
 	* cpu-cr16c.c: Likewise.
-	* cpu-cris.c: Likewise.
 	* cpu-crx.c: Likewise.
-	* cpu-d10v.c: Likewise.
-	* cpu-d30v.c: Likewise.
-	* cpu-dlx.c: Likewise.
-	* cpu-epiphany.c: Likewise.
-	* cpu-fr30.c: Likewise.
-	* cpu-frv.c: Likewise.
 	* cpu-h8300.c: Likewise.
-	* cpu-h8500.c: Likewise.
-	* cpu-hppa.c: Likewise.
-	* cpu-i370.c: Likewise.
-	* cpu-i860.c: Likewise.
-	* cpu-i960.c: Likewise.
-	* cpu-ia64.c: Likewise.
-	* cpu-ip2k.c: Likewise.
-	* cpu-iq2000.c: Likewise.
+	* cpu-i386.c: Likewise.
 	* cpu-lm32.c: Likewise.
-	* cpu-m10200.c: Likewise.
-	* cpu-m10300.c: Likewise.
-	* cpu-m32c.c: Likewise.
-	* cpu-m32r.c: Likewise.
-	* cpu-m68hc11.c: Likewise.
-	* cpu-m68hc12.c: Likewise.
 	* cpu-m68k.c: Likewise.
-	* cpu-m88k.c: Likewise.
-	* cpu-mcore.c: Likewise.
-	* cpu-mep.c: Likewise.
-	* cpu-microblaze.c: Likewise.
-	* cpu-mips.c: Likewise.
-	* cpu-mmix.c: Likewise.
 	* cpu-moxie.c: Likewise.
 	* cpu-msp430.c: Likewise.
-	* cpu-mt.c: Likewise.
-	* cpu-ns32k.c: Likewise.
-	* cpu-openrisc.c: Likewise.
-	* cpu-or32.c: Likewise.
-	* cpu-pdp11.c: Likewise.
-	* cpu-pj.c: Likewise.
-	* cpu-plugin.c: Likewise.
-	* cpu-powerpc.c: Likewise.
-	* cpu-rl78.c: Likewise.
-	* cpu-rs6000.c: Likewise.
-	* cpu-rx.c: Likewise.
-	* cpu-s390.c: Likewise.
-	* cpu-score.c: Likewise.
 	* cpu-sh.c: Likewise.
-	* cpu-sparc.c: Likewise.
-	* cpu-spu.c: Likewise.
-	* cpu-tic30.c: Likewise.
-	* cpu-tic4x.c: Likewise.
-	* cpu-tic54x.c: Likewise.
-	* cpu-tic6x.c: Likewise.
-	* cpu-tic80.c: Likewise.
-	* cpu-tilegx.c: Likewise.
-	* cpu-tilepro.c: Likewise.
-	* cpu-v850.c: Likewise.
-	* cpu-vax.c: Likewise.
-	* cpu-w65.c: Likewise.
-	* cpu-we32k.c: Likewise.
 	* cpu-xc16x.c: Likewise.
-	* cpu-xstormy16.c: Likewise.
-	* cpu-xtensa.c: Likewise.
-	* cpu-z80.c: Likewise.
-	* cpu-z8k.c: Likewise.
+	* dwarf2.c: Likewise.
+	* ecofflink.c: Likewise.
+	* ecoffswap.h: Likewise.
+	* elf-ifunc.c: Likewise.
+	* elf-m10300.c: Likewise.
+	* elf-vxworks.c: Likewise.
+	* elf32-avr.c: Likewise.
+	* elf32-avr.h: Likewise.
+	* elf32-cr16.c: Likewise.
+	* elf32-cr16c.c: Likewise.
+	* elf32-cris.c: Likewise.
+	* elf32-crx.c: Likewise.
+	* elf32-frv.c: Likewise.
+	* elf32-hppa.c: Likewise.
+	* elf32-i860.c: Likewise.
+	* elf32-ip2k.c: Likewise.
+	* elf32-iq2000.c: Likewise.
+	* elf32-m32c.c: Likewise.
+	* elf32-m68hc1x.c: Likewise.
+	* elf32-msp430.c: Likewise.
+	* elf32-mt.c: Likewise.
+	* elf32-ppc.c: Likewise.
+	* elf32-rl78.c: Likewise.
+	* elf32-s390.c: Likewise.
+	* elf32-score.h: Likewise.
+	* elf32-sh-symbian.c: Likewise.
+	* elf32-sh.c: Likewise.
+	* elf32-spu.c: Likewise.
+	* elf32-tic6x.c: Likewise.
+	* elf32-v850.c: Likewise.
+	* elf32-xc16x.c: Likewise.
+	* elf32-xtensa.c: Likewise.
+	* elf64-alpha.c: Likewise.
+	* elf64-hppa.c: Likewise.
+	* elf64-ppc.c: Likewise.
+	* elf64-s390.c: Likewise.
+	* elfcore.h: Likewise.
+	* elflink.c: Likewise.
+	* elfxx-mips.c: Likewise.
+	* elfxx-sparc.c: Likewise.
+	* elfxx-tilegx.c: Likewise.
+	* ieee.c: Likewise.
+	* libcoff.h: Likewise.
+	* libpei.h: Likewise.
+	* libxcoff.h: Likewise.
+	* linker.c: Likewise.
+	* mach-o-i386.c: Likewise.
+	* mach-o-target.c: Likewise.
+	* mach-o.c: Likewise.
+	* mach-o.h: Likewise.
+	* mmo.c: Likewise.
+	* opncls.c: Likewise.
+	* pdp11.c: Likewise.
+	* pe-x86_64.c: Likewise.
+	* peXXigen.c: Likewise.
+	* pef-traceback.h: Likewise.
+	* pei-x86_64.c: Likewise.
+	* peicode.h: Likewise.
+	* plugin.c: Likewise.
+	* reloc.c: Likewise.
+	* riscix.c: Likewise.
+	* section.c: Likewise.
+	* som.c: Likewise.
+	* syms.c: Likewise.
+	* tekhex.c: Likewise.
+	* ticoff.h: Likewise.
+	* vaxbsd.c: Likewise.
+	* xcofflink.c: Likewise.
+	* xtensa-isa.c: Likewise.
 
-	* cpu-i386.c: Include "libiberty.h".
-	(bfd_arch_i386_fill): New.
-	Add bfd_arch_i386_fill to  bfd_arch_info initializer.
+2013-01-10  Will Newton <will.newton@imgtec.com>
 
-	* cpu-k1om.c: Add bfd_arch_i386_fill to  bfd_arch_info initializer.
-	* cpu-l1om.c: Likewise.
-
-	* linker.c (default_data_link_order): Call abfd->arch_info->fill
-	if fill size is 0.
-
-	* bfd-in2.h: Regenerated.
-
-2012-01-27  Michael Eager  <eager@eagercon.com>
-
-	* elf32-microblaze.c (create_got_section):
-	Reuse existing .rela.got section.
-
-2012-01-23  Alan Modra  <amodra@gmail.com>
-
-	* elf-bfd.h: Formatting.
-	(struct elf_backend_data): Add "maybe_function_sym".
-	(_bfd_elf_maybe_function_sym): Declare.
-	* elfxx-target.h (elf_backend_maybe_function_sym): Define.
-	(elfNN_bed): Init new field.
-	* elf.c (elf_find_function): Use maybe_function_sym.
-	(_bfd_elf_maybe_function_sym): New function.
-	* elf64-ppc.c (elf_backend_maybe_function_sym): Define.
-	(ppc64_elf_maybe_function_sym): New function.
-
-2012-01-20  Francois Gouget  <fgouget@codeweavers.com>
-
-	PR binutils/13534
-	* archive.c (_bfd_ar_sizepad): New function. Correctly install and
-	pad the size field in an archive header.
-	(_bfd_generic_read_ar_hdr_mag): Use the correct type and scan
-	function for the archive size field.
-	(bfd_generic_openr_next_archived_file): Likewise.
-	(do_slurp_coff_armap): Likewise.
-	(_bfd_write_archive_contents): Likewise.
-	(_bfd_bsd44_write_ar_hdr): Use the new function.
-	(bfd_ar_hdr_from_filesystem): Likewise.
-	(_bfd_write_archive_contents): Likewise.
-	(bsd_write_armap): Likewise.
-	(coff_write_armap): Likewise.
-	* archive64.c (bfd_elf64_archive_write_armap): Likewise.
-	* bfdio.c (bfd_bread): Use correct type for archive element
-	sizes.
-	* ar.c (open_inarch): Likewise.
-	(extract_file): Likewise.
-	* libbfd-in.h (struct areltdata): Use correct types for
-	parsed_size and extra_size fields.
-	Prototype _bfd_ar_sizepad function.
+	* Makefile.am: Add Meta.
+	* Makefile.in: Regenerate.
+	* archures.c (bfd_mach_metag): New.
+	* bfd-in2.h: Regenerate.
+	* config.bfd: Add Meta.
+	* configure: Regenerate.
+	* configure.in: Add Meta.
+	* cpu-metag.c: New file.
+	* elf-bfd.h: Add Meta.
+	* elf32-metag.c: New file.
+	* elf32-metag.h: New file.
 	* libbfd.h: Regenerate.
+	* reloc.c: Add Meta relocations.
+	* targets.c: Add Meta.
 
-2012-01-20  Ulrich Weigand  <ulrich.weigand@linaro.org>
+2013-01-08  Yufeng Zhang  <yufeng.zhang@arm.com>
 
-	* elf.c (elfcore_write_prpsinfo): Provide unconditionally.
-	Return NULL if core file generation is unsupported.
-	(elfcore_write_prstatus): Likewise.
-	* elf32-arm.c (elf32_arm_nabi_write_core_note): New function.
-	(elf_backend_write_core_note): Define.
+	* elf-bfd.h (elfcore_write_aarch_tls): Add prototype.
+	(elfcore_write_aarch_hw_break): Likewise.
+	(elfcore_write_aarch_hw_watch): Likewise.
+	* elf.c (elfcore_grok_aarch_tls): New function.
+	(elfcore_grok_aarch_hw_break): Likewise.
+	(elfcore_grok_aarch_hw_watch): Likewise.
+	(elfcore_grok_note): Call the new functions to handle the
+	corresponding notes.
+	(elfcore_write_aarch_tls): New function.
+	(elfcore_write_aarch_hw_break): Likewise.
+	(elfcore_write_aarch_hw_watch): Likewise.
+	(elfcore_write_register_note): Call the new functions to handle the
+	corresponding pseudo sections.
 
-2012-01-19  Tristan Gingold  <gingold@adacore.com>
+2013-01-07  Tom Tromey  <tromey@redhat.com>
 
-	* pef.c: Add a comment.
-	* xsym.c: Likewise.
+	* section.c (_bfd_std_section): Rename from std_section.
+	(bfd_com_section_ptr, bfd_und_section_ptr, bfd_abs_section_ptr)
+	(STD_SECTION): Update.
+	* bfd-in2.h: Rebuild.
 
-2012-01-17  Alan Modra  <amodra@gmail.com>
+2013-01-04  Juergen Urban <JuergenUrban@gmx.de>
 
-	* elf32-ppc.c (ppc_elf_write_core_note <NT_PRPSINFO>): Don't leave
-	trailing garbage in the note.
-	* elf64-ppc.c (ppc64_elf_write_core_note <NT_PRPSINFO>): Likewise.
+	* archures.c (bfd_mach_mips5900): Define.
+	* bfd-in2.h: Regenerate.
+	* config.bfd: Add mips64-ps2-elf and mips-ps2-elf targets.
+	* cpu-mips.c: Add support for MIPS r5900.
+	* elfxx-mips.c: Add support for MIPS r5900 (extension of r4000).
 
-2012-01-16  Daniel Green  <venix1@gmail.com>
+2013-01-03  Nickolai Zeldovich  <nickolai@csail.mit.edu>
+	    Nick Clifton  <nickc@redhat.com>
 
-	PR ld/13491
-	* coff-i386.c (coff_i386_rtype_to_howto <R_SECREL32>): Test
-	h->root.type not h->type.
-	* coff-x86_64.c (coff_amd64_rtype_to_howto <R_AMD64_SECREL>): Likewise.
+	* elflink.c (get_value): Prevent the use of an undefined shift
+	operation.  Add sanity checks.
 
-2012-01-13  Iain Sandoe  <idsandoe@googlemail.com>
+2013-01-02  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>
 
-	* mach-o.c (bfd_mach_o_build_dysymtab_command): Handle absolute
-	indirect symbols.
+	* config.bfd (cr16*-*-uclinux*): New target support.
 
-2012-01-13  Iain Sandoe  <idsandoe@googlemail.com>
 
-	* mach-o.c (bfd_mach_o_write_relocs): Move computation of relocs file
-	position from here... to (bfd_mach_o_build_seg_command): Here.
-
-2012-01-12  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_count_indirect_symbols): New.
-	(bfd_mach_o_build_dysymtab_command): Populate indirect symbol table.
-	* mach-o.h (bfd_mach_o_asymbol): Move declaration to start of the
-	file. (bfd_mach_o_section): Add indirect_syms field.
-
-2012-01-11  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_build_seg_command): Separate computation of
-	vmsize from filesize.  Don't compute offsets or file sizes for
-	zerofill sections.
-
-2012-01-11  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_build_commands): Make the building of each
-	command type independent.
-
-2012-01-11  Alan Modra  <amodra@gmail.com>
-
-	* elf64-ppc.c: Define more insns used in plt call stubs.
-	(ppc64_elf_brtaken_reloc): Assume isa version 2 or above.
-	(ppc64_elf_relocate_section): Likewise.
-	(enum ppc_stub_type): Add ppc_stub_plt_call_r2save.
-	(struct ppc_link_hash_table): Increase size of stub_count array.
-	Add plt_stub_align and plt_thread_safe.
-	(ALWAYS_USE_FAKE_DEP, ALWAYS_EMIT_R2SAVE): Define.
-	(plt_stub_size, plt_stub_pad): New functions.
-	(build_plt_stub): Emit barriers for power7 thread safety.  Don't
-	emit needless save of r2.
-	(build_tls_get_addr_stub): Adjust params.
-	(ppc_build_one_stub): Handle ppc_stub_plt_call_r2save and aligning
-	plt stubs.  Adjust build_*plt_stub calls.
-	(ppc_size_one_stub): Similarly.
-	(ppc64_elf_size_stubs): Accept plt_thread_safe and plt_stub_align
-	params.  Choose default for plt_thread_safe based on existence of
-	calls to thread creation functions.  Modify plt_call to
-	plt_call_r2save when no tocsave reloc found.  Align tail of stub
-	sections.
-	(ppc64_elf_build_stubs): Align tail of stub sections.  Adjust
-	output of stub statistics.
-	(ppc64_elf_relocate_section): Handle ppc_stub_plt_call_r2save.
-	* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
-
-2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR ld/13581
-	* elf64-x86-64.c (elf_x86_64_relocate_section): Remove ABI_64_P
-	check on R_X86_64_PCXX.
-
-2012-01-10  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o.c (bfd_mach_o_build_commands): Avoid uninitialized false
-	warning.
-
-2012-01-10  Tristan Gingold  <gingold@adacore.com>
-
-	* bfdio.c (bfd_tell): Handle nested archives.
-	(bfd_seek): Ditto.
-	* cache.c (bfd_cache_lookup_worker): Ditto.
-	* archive.c (_bfd_get_elt_at_filepos): Remove code dealing with
-	nested archives.
-	(bfd_generic_openr_next_archived_file): Likewise.
-
-2012-01-09  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_bfd_copy_private_symbol_data): Implement.
-	(bfd_mach_o_write_symtab): Remove handling for indirect syms.
-	(bfd_mach_o_primary_symbol_sort_key): Likewise.
-	(bfd_mach_o_cf_symbols): Likewise.
-	(bfd_mach_o_sort_symbol_table): Remove.
-	(bfd_mach_o_mangle_symbols): Adjust arguments, remove handling
-	for indirect and dysymtab counts.  Do the symbol sorting here.
-	(bfd_mach_o_build_dysymtab_command): Count the symbol types here.
-	Make the indirect symbols a TODO.
-	(bfd_mach_o_build_commands): Adjust call to bfd_mach_o_mangle_symbols.
-	(bfd_mach_o_make_empty_symbol): Specifically flag unset symbols with
-	a non-zero value.
-	(bfd_mach_o_read_symtab_symbol): Record the symbol index.
-	(bfd_mach_o_read_symtab_symbol): Adjust recording of global status.
-	* mach-o.h (mach_o_data_struct): Remove indirect and dysymtab entries.
-	(IS_MACHO_INDIRECT): Remove.
-	(SYM_MACHO_FIELDS_UNSET, SYM_MACHO_FIELDS_NOT_VALIDATED): New.
-
-2012-01-06  Nick Clifton  <nickc@redhat.com>
-
-	PR binutils/13121
-	* reloc.c (bfd_generic_lookup_section_flags): Rename 'finfo' to
-	'flaginfo' to avoid conflicts with AIX system headers.
-
-2012-01-06  Tristan Gingold  <gingold@adacore.com>
-
-	* bfdio.c (bfd_bread): Use arelt_size macro.
-
-2012-01-06  Tristan Gingold  <gingold@adacore.com>
-
-	* config.bfd (i[3-7]86-*-darwin*): Define targ64_selvecs.
-
-2012-01-05  Nick Clifton  <nickc@redhat.com>
-
-	PR ld/12161
-	* elf32-avr.c (elf32_avr_relax_delete_bytes): Read in relocs if
-	necessary.
-
-2012-01-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-	Fix zero registers core files when built by gcc-4.7.
-	* elf64-x86-64.c (elf_x86_64_write_core_note): Remove variables p and
-	size.  Call elfcore_write_note for the local variables.  Remove the
-	final elfcore_write_note call.  Add NOTREACHED comments.
-
-2012-01-04  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o.c (bfd_mach_o_fat_stat_arch_elt): New function.
-	(bfd_mach_o_generic_stat_arch_elt): Adjust.
-
-2012-01-04  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o.c (bfd_mach_o_fat_member_init): New function.
-	(bfd_mach_o_openr_next_archived_file): Reindent.
-	Adjust to call bfd_mach_o_fat_member_init.
-	(bfd_mach_o_fat_extract): Adjust to call bfd_mach_o_fat_member_init.
-
-2012-01-04  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o-x86-64.c (bfd_mach_o_x86_64_swap_reloc_out): Handle
-	BFD_RELOC_32, BFD_RELOC_MACH_O_X86_64_PCREL32_1,
-	BFD_RELOC_MACH_O_X86_64_PCREL32_2,
-	BFD_RELOC_MACH_O_X86_64_PCREL32_4,
-	BFD_RELOC_MACH_O_X86_64_BRANCH32,
-	BFD_RELOC_MACH_O_X86_64_SUBTRACTOR32,
-	BFD_RELOC_MACH_O_X86_64_GOT.
-
-2012-01-04  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o.h (bfd_mach_o_fvmlib_command): New structure.
-	(bfd_mach_o_load_command): Add fvmlib field.
-
-	* mach-o.c (bfd_mach_o_read_fvmlib): New function.
-	(bfd_mach_o_read_command): Handle fvmlib.
-
-2012-01-04  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o.c (bfd_mach_o_convert_architecture): Reindent.
-	Decode msubtype for ARM.
-
-2012-01-04  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o.c (bfd_mach_o_get_synthetic_symtab): Add comments.
-
-2012-01-04  Tristan Gingold  <gingold@adacore.com>
-
-	* mach-o.h: Reindent header.
-	(bfd_mach_o_encryption_info_command): New structure.
-	(bfd_mach_o_load_command): Add encryption_info field.
-
-	* mach-o.c (bfd_mach_o_read_encryption_info): New function.
-	(bfd_mach_o_read_command): Handle BFD_MACH_O_LC_ENCRYPTION_INFO.
-	(bfd_mach_o_read_command): Adjust error message.
-
-2012-01-04  Shinichiro Hamaji  <shinichiro.hamaji@gmail.com>
-
-	* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Factor out the part
-	which reads DWARF2 and stores in stash from find_line.
-	(find_line) Call _bfd_dwarf2_slurp_debug_info.
-	* libbfd-in.h (_bfd_dwarf2_slurp_debug_info): Add declaration.
-	* libbfd.h (_bfd_dwarf2_slurp_debug_info): Regenerate.
-	* mach-o.c (dsym_subdir): The name of subdir where debug
-	information may be stored.
-	(bfd_mach_o_lookup_uuid_command): New. Lookup a load command whose
-	type is UUID.
-	(bfd_mach_o_dsym_for_uuid_p): New. Check if the specified BFD is
-	corresponding to the executable.
-	(bfd_mach_o_find_dsym): New. Find a debug information BFD in the
-	specified binary file.
-	(bfd_mach_o_follow_dsym): New. Find a debug information BFD for
-	the original BFD.
-	(bfd_mach_o_find_nearest_line): Check dSYM files for Mach-O
-	executables, dylibs, and bundles.
-	(bfd_mach_o_close_and_cleanup): Clean up BFDs for the dSYM file.
-	* mach-o.h (dsym_bfd): The BFD of the dSYM file.
-
-2012-01-03  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_mangle_symbols): Put in the section index
-	for stabd symbols.
-	(bfd_mach_o_primary_symbol_sort_key): Adjust for stabs.
-	(bfd_mach_o_cf_symbols): Likewise.
-
-2012-01-03  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_mangle_symbols): Correct typo.
-
-2012-01-03  Iain Sandoe  <idsandoe@googlemail.com>
-
-	* mach-o.c (bfd_mach_o_write_symtab): Fill in the string table index
-	as the value of an indirect symbol.  Keep the string table index in
-	non-indirect syms for reference.
-	(bfd_mach_o_write_dysymtab): New.
-	(bfd_mach_o_primary_symbol_sort_key): New.
-	(bfd_mach_o_cf_symbols): New.
-	(bfd_mach_o_sort_symbol_table): New.
-	(bfd_mach_o_mangle_symbols): Return early if no symbols.  Sort symbols.
-	If we are emitting a dysymtab, process indirect symbols and count the
-	number of each other kind.
-	(bfd_mach_o_mangle_sections): New.
-	(bfd_mach_o_write_contents): Split out some pre-requisite code into
-	the command builder. Write dysymtab if the command is present.
-	(bfd_mach_o_count_sections_for_seg): New.
-	(bfd_mach_o_build_seg_command): New.
-	(bfd_mach_o_build_dysymtab_command): New.
-	(bfd_mach_o_build_commands): Reorganize to support the fact that some
-	commands are optional and should not be emitted if there are no
-	sections or symbols.
-	(bfd_mach_o_set_section_contents): Amend comment.
-	* mach-o.h: Amend and add to comments.
-	(mach_o_data_struct): Add fields for dysymtab symbols counts and a
-	pointer to the indirects, when present.
-	(bfd_mach_o_should_emit_dysymtab): New macro.
-	(IS_MACHO_INDIRECT): Likewise.
-
-For older changes see ChangeLog-2011
+For older changes see ChangeLog-2012
 
+Copyright (C) 2013 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-0001 b/bfd/ChangeLog-0001
index b5a3475..63015db 100644
--- a/bfd/ChangeLog-0001
+++ b/bfd/ChangeLog-0001
@@ -9584,6 +9584,12 @@
 
 For older changes see ChangeLog-9899
 
+Copyright (C) 2002 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-0203 b/bfd/ChangeLog-0203
index 1b1abb1..20b0e30 100644
--- a/bfd/ChangeLog-0203
+++ b/bfd/ChangeLog-0203
@@ -1303,7 +1303,7 @@
 	(elf32_hppa_check_relocs): Don't set SEC_HAS_GOT_REF flag.
 	(elf32_hppa_size_stubs): Pass info to hppa_type_of_stub.
 	(final_link_relocate): Change all DLTIND relocs to DPREL relocs in a
-	non-shared link.  Convert instructions that use the the linkage table
+	non-shared link.  Convert instructions that use the linkage table
 	pointer, or a facsimile thereof, to use the global data pointer when
 	the reloc has been changed.
 
@@ -11397,6 +11397,12 @@
 
 For older changes see ChangeLog-0001
 
+Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2004 b/bfd/ChangeLog-2004
index 0c47096..09d816f 100644
--- a/bfd/ChangeLog-2004
+++ b/bfd/ChangeLog-2004
@@ -5055,6 +5055,12 @@
 
 For older changes see ChangeLog-0203
 
+Copyright (C) 2004 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2005 b/bfd/ChangeLog-2005
index 95746fc..7c9b0d3 100644
--- a/bfd/ChangeLog-2005
+++ b/bfd/ChangeLog-2005
@@ -5261,6 +5261,12 @@
 
 For older changes see ChangeLog-2004
 
+Copyright (C) 2005 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2006 b/bfd/ChangeLog-2006
index 82216d6..dc15581 100644
--- a/bfd/ChangeLog-2006
+++ b/bfd/ChangeLog-2006
@@ -30,7 +30,7 @@
 	EF_M68K_CPU32_FIDO_A.
 
 2006-12-25  Mei Ligang  <ligang@sunnorth.com.cn>
-	
+
 	* elf32-score.c (score_elf_got_lo16_reloc): Change some variables
 	type from unsigned to signed.
 	(score_elf_final_link_relocate): Fix bugs of handling relocation
@@ -3593,6 +3593,12 @@
 
 For older changes see ChangeLog-2005
 
+Copyright (C) 2006 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2007 b/bfd/ChangeLog-2007
index be94259..85076b9 100644
--- a/bfd/ChangeLog-2007
+++ b/bfd/ChangeLog-2007
@@ -23,7 +23,7 @@
 	* elf32-frv.c (_frvfdpic_osec_to_segment): Use new function.
 	* elf32-hppa.c (hppa_record_segment_addr): Use new function.
 	* elfxx-ia64.c (elfNN_ia64_relocate_section): Use new function.
-	
+
 2007-12-28  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
 	PR binutils/5146
@@ -65,7 +65,7 @@
 
 	* elf32-xtensa.c (relax_section): Update DIFF relocations in the
 	same way as other relocations.
-	
+
 2007-12-18  Daniel Jacobowitz  <dan@codesourcery.com>
 
 	* section.c (BFD_FAKE_SECTION): Update.
@@ -91,7 +91,7 @@
 	when clearing the removed flag.
 	(_bfd_elf_eh_frame_section_offset): Remove offsets_adjusted handling.
 	(_bfd_elf_write_section_eh_frame): Likewise.  Apply output_offsets
-	where appropriate.  
+	where appropriate.
 
 2007-12-15  Richard Sandiford  <rsandifo@nildram.co.uk>
 
@@ -229,7 +229,7 @@
 	(elf_xtensa_relocate_section): Check for R_XTENSA_32_PCREL for dynamic
 	symbols.
 	(check_section_ebb_pcrels_fit): Ignore R_XTENSA_32_PCREL relocations.
-	
+
 2007-12-05  Alan Modra  <amodra@bigpond.net.au>
 
 	* elf32-spu.c (spu_elf_size_stubs): Do consider branches to
@@ -262,7 +262,7 @@
 	and Loongson-2F flags.
 	(mips_set_isa_flags): Likewise.
 	(mips_mach_extensions): Add Loongson-2E and Loongson-2F
-	entries. 
+	entries.
 
 2007-11-29  Nick Clifton  <nickc@redhat.com>
 
@@ -491,7 +491,7 @@
 	* elf-m10300.h: Handle R_MN10300_ALIGN relocs.
 	(mn10300_elf_relax_delete_bytes): Honour R_MN10300_ALIGN relocs.
 	Re-fix off by one error in comparisons.
-  
+
 2007-10-25  Pedro Alves  <pedro_alves@portugalmail.pt>
 
 	* bfd-in.h (STRING_COMMA_LEN): Don't handle NULL STR case.
@@ -538,7 +538,7 @@
 	(mn10300_elf_check_relocs): Do not create dynamic relocs for
 	symbol differences or relocations against absolute symbols.
 	(mn10300_elf_final_link_relocate): Likewise.
-	Handle R_MN10300_SYM_DIFF relocs. 
+	Handle R_MN10300_SYM_DIFF relocs.
 	(mn10300_elf_relocate_section): Fix for creating local copys of
 	dynamic relocs.
 	(mn10300_elf_relax_delete_bytes): Adjust symbols at the end of the
@@ -575,23 +575,23 @@
 
 	* elf32-xtensa.c (relax_section): Check for a reference to a discarded
 	DWARF section and anticipate its replacement with the kept section.
-	
+
 2007-10-16  Bob Wilson  <bob.wilson@acm.org>
 
 	* elf32-xtensa.c (elf_xtensa_discard_info_for_section): Remove
 	unnecessary size variables.  Set sec->rawsize.
 	(relax_section, relax_property_section): Likewise.
-	
+
 2007-10-16  Bob Wilson  <bob.wilson@acm.org>
 
 	* section.c (struct bfd_section): Clarify comment for rawsize field.
 	* bfd-in2.h: Regenerate.
-	
+
 2007-10-16  Bob Wilson  <bob.wilson@acm.org>
 
 	* elflink.c (_bfd_elf_check_kept_section): Use the section rawsize
 	values if they are set.
-	
+
 2007-10-16  Nick Clifton  <nickc@redhat.com>
 
 	PR 5146
@@ -613,7 +613,7 @@
 	the type of emitted common symbols to STT_COMMON.
 	* elfcode.h (elf_slurp_symbol_table): Accept STT_COMMON symbol
 	types.
-	
+
 2007-10-15  Alan Modra  <amodra@bigpond.net.au>
 
 	* coff-arm.c (arm_emit_base_file_entry): Check fwrite return value.
@@ -653,7 +653,7 @@
 	segment only when needed.
 
 2007-10-05  Bob Wilson  <bob.wilson@acm.org>
-	
+
 	* elf32-xtensa.c (relax_section): Call pin_internal_relocs when
 	changing a relocation's offset.  Adjust call to translate_reloc.  Do
 	not add a fix record for a DIFF reloc.  For other relocs, only add a
@@ -665,21 +665,21 @@
 	assertion.  Compute separate offset adjustments for the base symbol
 	and the addend, and set the new relocation's addend correctly.  Return
 	the new target section.
-	
+
 2007-10-05  Bob Wilson  <bob.wilson@acm.org>
-	
+
 	* elf32-xtensa.c (elf_xtensa_relocate_section): Remove updates of
 	r_type and howto after calling do_fix_for_relocateable_link and
 	do_fix_for_final_link.
-	
+
 2007-10-05  Bob Wilson  <bob.wilson@acm.org>
-	
+
 	* elf32-xtensa.c (removed_by_actions): New.
 	(offset_with_removed_text): Reimplement using removed_by_actions.
 	(offset_with_removed_text_before_fill): Delete.
 	(relax_property_section): Use removed_by_actions.  Rearrange logic.
 	(relax_section_symbols): Likewise.
-	
+
 2007-10-04  Bob Wilson  <bob.wilson@acm.org>
 
 	* elf32-xtensa.c (reloc_bfd_fix_struct): Delete target_abfd field.
@@ -860,7 +860,7 @@
 	* Makefile.in: Regenerate.
 	* arange-set.c: New file.
 	* arange-set.h: New file.
-	* dwarf2.c: Include arange-set.h.  
+	* dwarf2.c: Include arange-set.h.
 	(struct dwarf2_debug) Add new fields comp_unit_count and
 	comp_unit_arange_set.
 	(struct comp_unit) Replace field arange with a new field arange_set.
@@ -893,8 +893,8 @@
 
 2007-09-21  Olivier Hainque  <hainque@adacore.com>
 	    Tristan Gingold  <gingold@adacore.com>
-	
-	* syms.c (_bfd_stab_section_find_nearest_line): Look at the 
+
+	* syms.c (_bfd_stab_section_find_nearest_line): Look at the
         specific SOM sections for stabs if the regular ones are not found.
 	* som.h (struct somdata): Add a line_info field, to be used by
         som_find_nearest_line.
@@ -949,7 +949,7 @@
 	PT_GNU_RELRO segment for copying executable/shared library.
 	(rewrite_elf_program_header): Remove PT_GNU_RELRO segment.
 	(copy_elf_program_header): Set p_size and p_size_valid fields for
-	PT_GNU_RELRO segment. 
+	PT_GNU_RELRO segment.
 
 2007-09-17  Nick Clifton  <nickc@redhat.com>
 
@@ -1035,7 +1035,7 @@
 
 2007-09-04  Michael Snyder  <msnyder@access-company.com>
 
-	* elf32-bfin.c (howto_table): Cut and paste error?  
+	* elf32-bfin.c (howto_table): Cut and paste error?
 	Name field of reloc is wrong.
 
 2007-09-04  Alan Modra  <amodra@bigpond.net.au>
@@ -1319,7 +1319,7 @@
 	(elf32_arm_gc_sweep_hook): Call check_use_blx.  Update plt counts
 	for R_ARM_THM_JUMP24 and R_ARM_THM_JUMP19.
 	(elf32_arm_check_relocs): Update plt counts for R_ARM_THM_JUMP24
-	and R_ARM_THM_JUMP19.  
+	and R_ARM_THM_JUMP19.
 	(allocate_dynrelocs): Use plt_maybe_thumb_refcount.
 	(elf32_arm_finish_dynamic_symbol): Ditto.
 	(elf32_arm_output_plt_map): Ditto.
@@ -1412,7 +1412,7 @@
 
 	* coff-i386.c (coff_i386_rtype_to_howto): Guard against null.
 
-	* linker.c (bfd_section_already_linked_table_insert): Change 
+	* linker.c (bfd_section_already_linked_table_insert): Change
 	return type from void to boolean.  Return FALSE on failure.
 	(_bfd_generic_section_already_linked): Test return value of
 	bfd_section_already_linked_table_insert, call fatal on error.
@@ -1435,10 +1435,10 @@
 	* linker.c (already_linked_newfunc): Check for NULL return from
 	bfd_hash_allocate.
 
-	* coffgen.c (fixup_symbol_value): Guard against null; 
+	* coffgen.c (fixup_symbol_value): Guard against null;
 	bfd_is_com_section will dereference the section pointer.
 
-	* syms.c (bfd_decode_symclass): Guard against NULL, since 
+	* syms.c (bfd_decode_symclass): Guard against NULL, since
 	bfd_is_com_section dereferences the pointer.
 
 	* srec.c (srec_scan): Check for EOF (critical because return value
@@ -1452,7 +1452,7 @@
 
 	* tekhex.c (first_phase): Check return value for null.
 
-	* elf.c (_bfd_elf_get_synthetic_symtab): Remove meaningless 
+	* elf.c (_bfd_elf_get_synthetic_symtab): Remove meaningless
 	pointer increment.
 
 2007-07-26  Alan Modra  <amodra@bigpond.net.au>
@@ -3553,6 +3553,12 @@
 
 For older changes see ChangeLog-2006
 
+Copyright (C) 2007 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2008 b/bfd/ChangeLog-2008
index eb63e09..b61a790 100644
--- a/bfd/ChangeLog-2008
+++ b/bfd/ChangeLog-2008
@@ -22,7 +22,7 @@
 	PR ld/7036
 	* elfxx-ia64.c (elfNN_ia64_relax_section): Assume linker will
 	always insert 32byte between the .plt and .text sections after
-	the the first relaxation pass.
+	the first relaxation pass.
 
 2008-12-23  Nick Clifton  <nickc@redhat.com>
 
@@ -3378,6 +3378,12 @@
 
 For older changes see ChangeLog-2007
 
+Copyright (C) 2008 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2009 b/bfd/ChangeLog-2009
index cc33261..a3f7b24 100644
--- a/bfd/ChangeLog-2009
+++ b/bfd/ChangeLog-2009
@@ -408,7 +408,8 @@
 	PR binutils/10802
 	* opncls.c (_maybe_make_executable): Make DYNAMIC files executable.
 
-2009-10-19  Hans-Peter Nilsson  <hp@axis.com>
+2009-10-19  Edgar E. Iglesias  <edgar@axis.com>
+	    Hans-Peter Nilsson  <hp@axis.com>
 
 	* elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_DTPREL>:
 	Don't subtract the size of the TLS block for non-shared objects
@@ -3606,7 +3607,7 @@
 	(bfd_xcoff_set_archive_import_path): Likewise.
 	(xcoff_set_import_path): Move earlier in file.
 	(xcoff_link_add_dynamic_symbols): Set the import path of a non-archive
-	object to the the directory part of the bfd's filename.  Get the
+	object to the directory part of the bfd's filename.  Get the
 	import path and filename of an archive object from the archive's
 	xcoff_tdata, initializing it if necessary.  Update use of
 	import_file_id.
@@ -5146,6 +5147,12 @@
 
 For older changes see ChangeLog-2008
 
+Copyright (C) 2009 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2010 b/bfd/ChangeLog-2010
index c486f58..4dd4cb1 100644
--- a/bfd/ChangeLog-2010
+++ b/bfd/ChangeLog-2010
@@ -1173,11 +1173,11 @@
 
 	* elf64-x86-64.c (elf64_x86_64_grok_prstatus): Write the LWPID to
 	elf_tdata's core_lwpid instead of to core_pid.
-	(elf64_x86_64_grok_psinfo): Extract the the main process's PID,
+	(elf64_x86_64_grok_psinfo): Extract the main process's PID,
 	and store it in elf_tdata's core_pid field.
 	* elf32-i386.c (elf_i386_grok_prstatus): Write the LWPID to
 	elf_tdata's core_lwpid instead of to core_pid.
-	(elf_i386_grok_psinfo): Extract the the main process's PID, and
+	(elf_i386_grok_psinfo): Extract the main process's PID, and
 	store it in elf_tdata's core_pid field.
 
 	* elf32-am33lin.c (elf32_am33lin_grok_prstatus): Write the LWPID
@@ -3554,6 +3554,12 @@
 
 For older changes see ChangeLog-2009
 
+Copyright (C) 2010 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2011 b/bfd/ChangeLog-2011
index 9af9565..e4e2cc0 100644
--- a/bfd/ChangeLog-2011
+++ b/bfd/ChangeLog-2011
@@ -3375,6 +3375,12 @@
 
 For older changes see ChangeLog-2010
 
+Copyright (C) 2011 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-2012 b/bfd/ChangeLog-2012
new file mode 100644
index 0000000..7d82ace
--- /dev/null
+++ b/bfd/ChangeLog-2012
@@ -0,0 +1,3300 @@
+2012-12-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* config.bfd (i[3-7]86-*-linux-*): Add x86_64pei_vec to
+	targ64_selvecs.
+
+2012-12-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Check
+	R_X86_64_standard instead of R_X86_64_max for unrecognized
+	relocation.
+
+2012-12-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/14980
+	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Properly
+	adjust h->plt.refcount.
+	* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
+
+2012-12-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_relocate_section): Replace
+	bfd_elf32_swap_reloc_out with elf_append_rel.
+	(elf_i386_finish_dynamic_symbol): Likewise.
+
+	* elflink.c (elf_append_rel): Call swap_reloc_out instead of
+	swap_reloca_out.
+
+2012-12-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_finish_dynamic_symbol): Reindent.
+
+2012-12-18  Edgar E. Iglesias <edgar.iglesias@gmail.com>
+
+	PR ld/14736
+	* elf32-microblaze.c (calc_fixup): Add end range.
+
+2012-12-18  Alan Modra  <amodra@gmail.com>
+
+	* elf.c (swap_out_syms): Set shndx to SHN_ABS when not one of
+	the special MAP_* values.
+
+2012-12-17  Roland McGrath  <mcgrathr@google.com>
+	    Alan Modra  <amodra@gmail.com>
+
+	* elf32-arm.c (elf32_arm_size_stubs): Skip input BFDs that are
+	not ARM ELF.
+
+2012-12-17  Nick Clifton  <nickc@redhat.com>
+
+	* MAINTAINERS: Add copyright notice.
+	* Makefile.am: Likewise.
+	* PORTING: Likewise.
+	* README: Likewise.
+	* TODO: Likewise.
+	* acinclude.m4: Likewise.
+	* bfd.m4: Likewise.
+	* config.bfd: Likewise.
+	* configure.com: Likewise.
+	* configure.host: Likewise.
+	* configure.in: Likewise.
+	* makefile.vms: Likewise.
+	* warning.m4: Likewise.
+	* elf64-hppa.c: Fix copyright notice.
+	* Makefile.in: Regenerate.
+
+2012-12-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_check_relocs): Don't check IFUNC
+	relocations here.
+	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
+
+2012-12-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/14968
+	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Also check
+	local IFUNC references.
+	* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
+
+2012-12-14  Tom Tromey  <tromey@redhat.com>
+
+	* elf.c (elfcore_grok_note) <NT_FILE>: New case.
+
+2012-12-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/14956
+	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Check local
+	IFUNC calls.
+	* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
+
+2012-12-10  Edgar E. Iglesias <edgar.iglesias@gmail.com>
+
+	* reloc.c (MICROBLAZE): Document new relocations
+	* bfd-in2.h: Regenerated
+	* libbfd.h: Regenerated
+	* elf32-microblaze.c (microblaze_elf_howto_raw): Add TLS relocations
+	(microblaze_elf_reloc_type_lookup): Likewise
+	(elf32_mb_link_hash_entry): define TLS reference types
+	(elf32_mb_link_hash_table): add TLS Local dynamic GOT entry
+	#define has_tls_reloc if section has TLS relocs
+	(dtprel_base), (check_unique_offset): New
+	(microblaze_elf_output_dynamic_relocation): output simple
+	dynamic relocation into SRELOC.
+	(microblaze_elf_relocate_section): Accommodate TLS relocations.
+	(microblaze_elf_check_relocs): Likewise
+	(update_local_sym_info): New
+	(microblaze_elf_copy_indirect_symbol): Add tls_mask.
+	(allocate_dynrelocs): Handle TLS symbol
+	(microblaze_elf_size_dynamic_sections): Set size and offset
+	(microblaze_elf_finish_dynamic_symbol): Use
+	microblaze_elf_output_dynamic_relocation
+
+2012-12-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/14933
+	* archive.c (bsd_write_armap): Properly check indicies bigger
+	than 4Gb.
+
+2012-12-07  Alan Modra  <amodra@gmail.com>
+
+	PR ld/14926
+	* elf.c (_bfd_elf_map_sections_to_segments): Include elf header
+	size when determining phdr_in_segment.
+
+2012-12-06  Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* elf64-aarch64.c (elf64_aarch64_grok_prstatus): New function.
+	(elf_backend_grok_prstatus): Define to elf64_aarch64_grok_prstatus.
+
+2012-12-06  Alan Modra  <amodra@gmail.com>
+
+	* elfxx-mips.c (allocate_dynrelocs): Correct test for symbol
+	defined in a regular file to include common symbols.
+
+2012-12-05  Leif Ekblad  <leif@rdos.net>
+
+	* config.bfd: Add x86_64-*-rdos.
+
+2012-12-05  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (build_plt_stub): Fix off by one error in branch
+	to glink.
+
+2012-12-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	PR ld/10629
+	* elfxx-mips.c (mips_elf_link_hash_table): Update comment for
+	use_rld_obj_head.
+	(_bfd_mips_elf_create_dynamic_sections): Always create a
+	.rld_map section if no __rld_obj_head symbol has been seen.
+
+2012-12-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elf32-mips.c (mips_elf32_object_p): Return right away when the
+	ABI is not compatible.
+	* elfn32-mips.c (mips_elf_n32_object_p): Likewise.
+
+2012-12-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elf32-tilepro.c (tilepro_elf_mkobject): New function.
+	(bfd_elf32_mkobject): New macro.
+
+2012-12-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elf32-mips.c (bfd_elf32_mkobject): New macro.
+	* elf64-mips.c (bfd_elf64_mkobject): Likewise.
+	* elfn32-mips.c (bfd_elf32_mkobject): Likewise.
+	* elfxx-mips.h (_bfd_mips_elf_mkobject): New prototype.
+	* elfxx-mips.c (mips_elf_obj_tdata): New struct.
+	(mips_elf_tdata): New macro.
+	(_bfd_mips_elf_mkobject): New function.
+	(mips_elf_merge_obj_attributes): Report the originating input BFD
+	on attribute conflicts.
+
+2012-12-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (mips_elf_merge_obj_attributes): Correct messages
+	for the -mdouble-float and -msingle-float cases throughout; make
+	all the messages report the output file consistently on the
+	left-hand side.
+
+2012-11-29  Roland McGrath  <mcgrathr@google.com>
+
+	* elf-nacl.c (segment_eligible_for_headers): Disallow writable segments.
+
+2012-11-26  Roland McGrath  <mcgrathr@google.com>
+
+	* elf-nacl.c (nacl_modify_segment_map): Don't crash when INFO is null.
+
+2012-11-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/14493
+	* elf.c (copy_elf_program_header): When rewriting program
+	header, set the output maxpagesize to the maximum alignment
+	of input PT_LOAD segments.
+
+2012-11-21  Roland McGrath  <mcgrathr@google.com>
+
+	* elf-nacl.c (segment_nonexecutable_and_has_contents): Renamed to ...
+	(segment_eligible_for_headers): ... this.  Take new arguments
+	MAXPAGESIZE and SIZEOF_HEADERS.  Return false if the first section's
+	start address doesn't leave space for the headers.
+	(nacl_modify_segment_map): Update caller.
+
+2012-11-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/14862
+	* elf-bfd.h (elf_link_hash_entry): Remove ref_dynamic_nonweak
+	added by accident.
+	(elf_link_add_object_symbols): Don't set nor check
+	ref_dynamic_nonweak.
+
+2012-11-20  Alan Modra  <amodra@gmail.com>
+
+	* elf32-rx.c (rx_elf_print_private_bfd_data): Warning fix.
+
+2012-11-16  Joey Ye  <joey.ye@arm.com>
+
+	* elf32-arm.c (elf32_arm_final_link_relocate
+	<case R_ARM_THM_ALU_PREL_11_0, case R_ARM_THM_PC12>): Align address of
+	the place being relocated.
+	(elf32_arm_final_link_relocate, case R_ARM_THM_PC8): Align address
+	of the place being relocated and truncate addend.
+	(Pa): New macro.
+
+2012-11-14  Roland McGrath  <mcgrathr@google.com>
+
+	* elf32-arm.c (elf32_arm_nacl_plt0_entry): Use bic rather than bfc
+	instruction for data sandboxing.
+
+2012-11-14  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_read_main)
+	(bfd_mach_o_read_source_version): New functions.
+	(bfd_mach_o_read_command): Handle BFD_MACH_O_LC_DATA_IN_CODE,
+	BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS, BFD_MACH_O_LC_MAIN,
+	BFD_MACH_O_LC_SOURCE_VERSION.
+	* mach-o.h (bfd_mach_o_main_command)
+	(bfd_mach_o_source_version_command): New types.
+	(bfd_mach_o_load_command): Add fields for these new types.
+
+2012-11-14  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Add a special
+	handling for non-scattered pairs.  Update comments.
+
+2012-11-13  Joe Seymour  <jseymour@codesourcery.com>
+
+	* elf.c (rewrite_elf_program_header): Allocate elf_segment_map
+	with bfd_zalloc, instead of bfd_alloc.
+
+2012-11-09  Nick Clifton  <nickc@redhat.com>
+
+	* Makefile.am (ALL_MACHINES): Add cpu-v850-rh850.lo.
+	(ALL_MACHINES_CFILES): Add cpu-v850-rh850.c.
+	* archures.c (bfd_arch_info): Add bfd_v850_rh850_arch.
+	* config.bfd: Likewise.
+	* configure.in: Add bfd_elf32_v850_rh850_vec.
+	* cpu-v850.c: Update printed description.
+	* cpu-v850_rh850.c: New file.
+	* elf32-v850.c (v850_elf_check_relocs): Add support for RH850 ABI
+	relocs.
+	(v850_elf_perform_relocation): Likewise.
+	(v850_elf_final_link_relocate): Likewise.
+	(v850_elf_relocate_section): Likewise.
+	(v850_elf_relax_section): Likewise.
+	(v800_elf_howto_table): New.
+	(v850_elf_object_p): Add support for RH850 ABI values.
+	(v850_elf_final_write_processing): Likewise.
+	(v850_elf_merge_private_bfd_data): Likewise.
+	(v850_elf_print_private_bfd_data): Likewise.
+	(v800_elf_reloc_map): New.
+	(v800_elf_reloc_type_lookup): New.
+	(v800_elf_reloc_name_lookup): New.
+	(v800_elf_info_to_howto): New.
+	(bfd_elf32_v850_rh850_vec): New.
+	(bfd_arch_v850_rh850): New.
+	* targets.c (_bfd_targets): Add bfd_elf32_v850_rh850_vec.
+	* Makefile.in: Regenerate.
+	* bfd-in2.h: Regenerate.
+	* configure: Regenerate.
+
+	* elf32-rx.c (describe_flags): New function.  Returns a buffer
+	containing a description of the E_FLAG_RX_... values set.
+	(rx_elf_merge_private_bfd_data): Use it.
+	(rx_elf_print_private_bfd_data): Likewise.
+	(elf32_rx_machine): Skip EF_RX_CPU_RX check.
+	(elf32_rx_special_sections): Define.
+	(elf_backend_special_sections): Define.
+
+2012-11-09  Edgar E. Iglesias <edgar.iglesias@gmail.com>
+
+	* config.bfd: Add microblazeel-*-*
+	* configure.in: Likewise.
+	* configure: Regenerate.
+	* elf32-microblaze.c (microblaze_elf_relocate_section): Add endian awareness.
+	(microblaze_elf_merge_private_bfd_data): New.
+	(microblaze_bfd_write_imm_value_32): New.
+	(microblaze_bfd_write_imm_value_64): New.
+	(microblaze_elf_relax_section): Add endian awareness.
+	(microblaze_elf_add_symbol_hook): Define TARGET_LITTLE_NAME,
+	TARGET_LITTLE_SYM and bfd_elf32_bfd_merge_private_bfd_data.
+	* targets.c: Add bfd target bfd_elf32_microblazeel_vec.
+
+2012-11-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* aout-tic30.c (MY_final_link_callback): Remove trailing
+	redundant `;'.
+	* coff-h8500.c (extra_case): Likewise.
+	(bfd_coff_reloc16_get_value): Likewise.
+	* dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Likewise.
+	* elf.c (_bfd_elf_slurp_version_tables): Likewise.
+	* elf32-frv.c (elf32_frv_relocate_section): Likewise.
+	* elf32-v850.c (v850_elf_perform_relocation): Likewise.
+	* opncls.c (bfd_calc_gnu_debuglink_crc32): Likewise.
+	* plugin.c (add_symbols): Likewise.
+	* reloc.c (bfd_check_overflow): Likewise.
+	* vms-lib.c (_bfd_vms_lib_archive_p): Likewise.
+
+2012-11-08  Tom Tromey  <tromey@redhat.com>
+
+	* elf.c (elfcore_grok_note) <NT_SIGINFO>: New case; make
+	pseudosection.
+
+2012-11-08  Alan Modra  <amodra@gmail.com>
+
+	* aclocal.m4: Regenerate.
+	* Makefile.in: Regenerate.
+	* po/SRC-POTFILES.in: Regenerate.
+
+2012-11-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* section.c (bfd_get_section_contents): Replace memcpy
+	with memmove.
+
+2012-11-07  Hans-Peter Nilsson  <hp@axis.com>
+
+	PR binutils/14481
+	* aout-target.h (MY_close_and_cleanup): Make local function
+	instead of alias of MY_bfd_free_cached_info.  Also call
+	_bfd_generic_close_and_cleanup.
+
+2012-11-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/14813
+	* bfdio.c (bfd_iovec): Change return type of bclose to
+	bfd_boolean.
+	(memory_bclose): Change return type to bfd_boolean.
+	* cache.c (cache_bclose): Likewise.
+	* opncls.c (opncls_bclose): Likewise.  Return TRUE on success.
+	* vms-lib.c (vms_lib_bclose): Likewise.  Return TRUE.
+	* libbfd.h: Regenerated.
+
+2012-11-06  Tristan Gingold  <gingold@adacore.com>
+
+	* coff-x86_64.c (_bfd_generic_find_nearest_line_discriminator):
+	Define as coff_find_nearest_line_discriminator.
+
+2012-11-06  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/14567
+	* opncls.c (opncls_iovec): Forward declare.
+	(_bfd_new_bfd_contained_in): If using opncls_iovec, copy iostream
+	to new bfd.
+
+2012-11-06  Alan Modra  <amodra@gmail.com>
+
+	* mach-o.c (bfd_mach_o_close_and_cleanup): Don't call
+	_bfd_generic_close_and_cleanup for mach_o_fat archives.
+
+2012-11-06  Alan Modra  <amodra@gmail.com>
+
+	* coff-tic4x.c (tic4x_coff0_vec, tic4x_coff0_beh_vec,
+	tic4x_coff1_vec, tic4x_coff1_beh_vec, tic4x_coff2_vec,
+	tic4x_coff2_beh_vec): Allow SEC_CODE and SEC_READONLY in
+	section flags.
+	* coff-ppc.c (TARGET_LITTLE_SYM): Likewise.
+	(TARGET_BIG_SYM): Likewise.
+
+2012-11-06  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (struct ppc_link_hash_table): Add dot_toc_dot.
+	(ppc64_elf_size_stubs): Lookup ".TOC.".
+	(ppc64_elf_relocate_section): Resolve special symbol ".TOC.".
+
+2012-11-06  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (maybe_strip_output): Heed SEC_KEEP.
+
+2012-11-05  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	PR target/14788
+	* elf32-s390.c (elf_s390_relocate_section): Set elf.dynobj for
+	local ifunc symbols.
+	* elf64-s390.c (elf_s390_relocate_section): Likewise.
+
+2012-11-05  Alan Modra  <amodra@gmail.com>
+
+	* configure.in: Apply 2012-09-10 change to config.in here.
+
+2012-11-05  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_edit_toc): Clear "repeat" inside
+	loop.  Really mark toc entry referring to another toc entry
+	only if the first is used.
+
+2012-10-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* configure.in: Also handle --enable-64-bit-bfd when setting
+	CORE_HEADER for 'i[3-7]86-*-linux-*'.
+
+2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
+
+	* elf32-arm.c (elf32_arm_print_private_bfd_data): Recognise and
+	display the new ARM hard-float/soft-float ABI flags for EABI_VER5
+	(elf32_arm_post_process_headers): Add the hard-float/soft-float
+	ABI flag as appropriate for ET_DYN/ET_EXEC in EABI_VER5.
+
+2012-10-30  Yao Qi  <yao@codesourcery.com>
+	    H.J. Lu  <hongjiu.lu@intel.com>
+
+	* configure.in: Set CORE_HEADER to hosts/x86-64linux.h for
+	'i[3-7]86-*-linux-*' if x86_64-*linux is enabled.
+	* configure: Regenerated.
+
+	* elf64-x86-64.c (elf_x86_64_write_core_note): Replace type
+	'prpsinfo_t' and 'prstatus_t' with 'prpsinfo64_t' and
+	'prstatus64_t' respectively.
+
+	* hosts/x86-64linux.h (a8_uint64_t): New.
+	(user_regsx32_struct): Renamed to ...
+	(user_regs64_struct): This.  Replace uint64_t with a8_uint64_t.
+	(elf_gregx32_t): Renamed to ...
+	(elf_greg64_t): This.  Replace uint64_t with a8_uint64_t.
+	(ELF_NGREGX32): Removed.
+	(ELF_NGREG64): New.
+	(elf_gregx32_t): Removed.
+	(elf_greg64_t): New.
+	(struct prstatus64_timeval): New.
+	(elf_prstatusx32): Replace elf_gregsetx32_t with elf_gregset64_t.
+	(elf_prstatus64): New.
+	(elf_prpsinfo64): New.
+	(prstatus64_t, prpsinfo64_t): New typedef.
+
+2012-10-29  Sean Keys <skeys@ipdatasys.com>
+
+	* elf32-xgate.c(elf_xgate_howto_table): Fix src and dest mask for
+	R_XGATE_16
+
+2012-10-29  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask in
+	R_PPC_VLE_LO16A, R_PPC_VLE_HI16A, R_PPC_VLE_HA16A,
+	R_PPC_VLE_SDAREL_LO16A, R_PPC_VLE_SDAREL_HI16A,
+	R_PPC_VLE_SDAREL_HA16A reloc howtos.
+
+2012-10-26  Nick Clifton  <nickc@redhat.com>
+
+	* po/uk.po: Updated Ukranian translation.
+
+2012-10-26  Alan Modra  <amodra@gmail.com>
+
+	PR gas/14758
+	* elf32-ppc.c (ppc_elf_reloc_type_lookup): Decode ppc64 _DS
+	bfd_reloc values.  Map to corresponding D-form relocs.
+	(is_insn_ds_form, is_insn_qs_form): New functions.
+	(ppc_elf_relocate_section): Validate insn with DS-form or DQ-form
+	fields using D-form reloc.
+
+2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_size_dynamic_sections): Replace
+	_GLOBAL_OFFSET_TABLE_ lookup with htab->elf.hgot.
+	* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.
+
+2012-10-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* compress.c (bfd_is_section_compressed): Don't decompress the
+	section.
+
+2012-10-23  Nathan Sidwell  <nathan@codesourcery.com>
+
+	* bfd-in.h (bfd_elf_stack_segment_size): Declare.
+	* bfd-in2.h: Rebuilt.
+	* elfxx-target.h (elf_backend_stack_align): New.
+	(elfNN_bed): Add it.
+	* elf-bfd.h (struct elf_backend_data): Add stack_align field.
+	* elf.c (bfd_elf_map_sections_to_segments): Pay attention to
+	stack_align and stacksize for PT_GNU_STACK segment.
+	(assign_file_positions_for_non_load_sections): Set p_memsz for
+	PT_GNU_STACK segment.
+	(copy_elf_program_header): Copy PT_GNU_STACK size.
+	* elflink.c (bfd_elf_stack_segment_size): New function, taken from
+	uclinux backends.
+	(bfd_elf_size_dynamic_sections): Determine
+	PT_GNU_STACK requirements after calling backend.  Pay attention to
+	stacksize.
+	* elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Call
+	bfd_elf_stack_segment_size.
+	(elf32_bfinfdpic_modify_program_headers): Delete.
+	(elf32_bfingfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK
+	here.
+	(elf_backend_stack_align): Override.
+	(elf_backend_modify_program_headers): Don't override.
+	* elf32-frv.c (frvfdpic_always_size_sections): Call
+	bfd_elf_stack_segment_size.
+	(elf32_frvfdpic_modify_program_headers): Delete.
+	(elf32_frvfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK
+	here.
+	(elf_backend_stack_align): Override.
+	(elf_backend_modify_program_headers): Don't override.
+	* elf32-lm32.c (lm32_elf_always_size_sections): Leave
+	PT_GNU_STACK creation to underlying elf support.  Check
+	__stacksize here for backwards compatibility, and set it if
+	needed.
+	(lm32_elf_modify_segment_map): Delete.
+	(lm32_elf_modify_program_headers): Delete.
+	(elf_backend_stack_align): Override.
+	(elf_backend_modify_segment_map): Don't override.
+	(elf_backend_modify_program_headers): Don't override.
+	* elf32-sh.c (sh_elf_always_size_sections): Call
+	bfd_elf_stack_segment_size.
+	(sh_elf_modify_program_headers): Delete.
+	(sh_elf_copy_private_data): Don't copy PT_GNU_STACK
+	here.
+	(elf_backend_stack_align): Override.
+	(elf_backend_modify_program_headers): Don't override.
+	* elf32-tic6x.c (elf32_tic6x_always_size_sections): Call
+	bfd_elf_stack_segment_size.
+	(elf32_tic6x_modify_program_headers): Delete.
+	(elf32_tic6x_copy_private_data): Delete.
+	(elf_backend_stack_align): Override.
+	(bfd_elf32_bfd_copy_private_bfd_data): Don't override.
+	(elf_backend_modify_program_headers): Don't override.
+
+2012-10-22  Alan Modra  <amodra@gmail.com>
+
+	* cache.c (cache_bmmap): Don't use void* arithmetic.
+
+2012-10-21  Alan Modra  <amodra@gmail.com>
+
+	* compress.c (bfd_cache_section_contents): New function.
+	* bfd-in2.h: Regenerate.
+
+2012-10-21  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* linker.c (_bfd_generic_link_output_symbols): Handle a
+	no-longer-global symbol entered through a plugin.
+
+2012-10-20  Alan Modra  <amodra@gmail.com>
+
+	* compress.c: Reinstate 2012-10-19 change.
+	(bfd_get_full_section_contents): Don't free unless we alloc.
+	Use proper decompress size.  Delete some vars, rename others.
+
+2012-10-19  Tom Tromey  <tromey@redhat.com>
+
+	* compress.c: Revert previous patch.
+
+2012-10-19  Tom Tromey  <tromey@redhat.com>
+
+	* compress.c (bfd_get_full_section_contents): Don't cache
+	decompressed contents.
+
+2012-10-18  Kai Tietz  <ktietz@redhat.com>
+
+	PR binutils/14067
+	* coff-i386.c (bfd_target): Add section flag SEC_EXCLUDE.
+	Allow BFD_COMPRESS and BFD_DECOMPRESS flags.
+	* coff-x86_64.c: Likewise.
+	* coffcode.h (DOT_ZDEBUG): New define.
+	(sec_to_styp_flags): Check for .zdebug.
+	(styp_to_sec_flags): Likewise.
+	* coffgen.c (make_a_section): Handle .debug_* section
+	compression/decompression flags.
+	* cofflink.c (mark_relocs): Ignore relocations
+	for a section, which isn't marked as used.
+	(_bfd_coff_link_input_bfd): Add support of compressed
+	debug sections.
+	* compress.c (decompress_contents): Loop as long
+	as there is input available and there is room for
+	output.
+	* bfd/pe-arm.c: Add .zdebug_ partial match entry.
+	* pe-i386.c: Likewise.
+	* pe-x86_64.c: Likewise.
+	* peXXigen.c (_bfd_XXi_swap_aouthdr_out): Don't clear all
+	data-directories as this might destroy content.
+
+	* coff-i386.c (_bfd_generic_find_nearest_line_discriminator):
+	define as coff_find_nearest_line_discriminator.
+	* libcoff-in.h (coff_find_nearest_line_discriminator): New
+	* libcoff.h: Regenerated.
+	* coff-x86_64.c: Likewise.
+	* coffgen.c (coff_find_nearest_line_discriminator): New function.
+	prototype.
+
+2012-10-16  Joel Brobecker  <brobecker@adacore.com>
+
+	* coff64-rs6000.c (rs6000coff64_vec): Set _close_and_cleanup
+	field to _bfd_archive_close_and_cleanup.
+	(aix5coff64_vec): Likewise.
+
+2012-10-16  Joel Brobecker  <brobecker@adacore.com>
+
+	* coff-rs6000.c (rs6000coff_vec): Set _close_and_cleanup
+	field to _bfd_archive_close_and_cleanup.
+	(pmac_xcoff_vec): Likewise.
+
+2012-10-16  Sofiane Naci  <sofiane.naci@arm.com>
+
+	* elf64-aarch64.c (elf64_aarch64_tls_howto_table): Fix shift value for
+	R_AARCH64_TLSIE_LD_GOTTPREL_PREL19, R_AARCH64_TLSLE_MOVW_TPREL_G2,
+	R_AARCH64_TLSLE_MOVW_TPREL_G1, R_AARCH64_TLSLE_MOVW_TPREL_G1_NC,
+	R_AARCH64_TLSLE_ADD_TPREL_HI12.
+	(elf64_aarch64_tlsdesc_howto_table): Fix shift value for
+	R_AARCH64_TLSDESC_LD64_PREL19 and R_AARCH64_TLSDESC_OFF_G1.
+	(elf64_aarch64_final_link_relocate): Add signed_addend when resolving
+	AARCH64_TLSLE_*_TPREL_* relocations.
+
+2012-10-16  Alan Modra  <amodra@gmail.com>
+
+	* elf32-xtensa.c (free_section_cache): Renamed from
+	clear_section_cache.  Don't zero cache.
+	(section_cache_section): Remove ineffectual zero of cache.
+	Call init_section_cache instead.
+
+2012-10-15  Doug Evans  <dje@google.com>
+
+	* elf.c (special_sections_d): Add comment.
+
+2012-10-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR bfd/14430
+	* Makefile.am (LIBDL): Replace -ldl with @lt_cv_dlopen_libs@.
+	* configure.in (lt_cv_dlopen_libs): AC_SUBST.
+	* Makefile.in: Regenerated.
+	* configure: Likewise.
+
+2012-10-08  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/14662
+	* elf.c (_bfd_elf_make_section_from_shdr): Treat .gdb_index as
+	SEC_DEBUGGING.
+
+2012-09-20  Walter Lee  <walt@tilera.com>
+
+	* elf32-tilepro.c (tilepro_elf_relocate_section): Adjust got
+	relocations with value of hgot.
+	* elfxx-tilegx.c (tilegx_elf_relocate_section): Ditto.
+
+2012-09-19  Steve Ellcey  <sellcey@mips.com>
+
+	* config.bfd: Add mips*-mti-elf* target.
+
+2012-09-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/14591
+	* elf-bfd.h (_bfd_elf_merge_symbol): Add an argument to return
+	if the old symbol is weak.
+
+	* elf32-sh-symbian.c (sh_symbian_relocate_section): Update
+	_bfd_elf_merge_symbol call.
+
+	* elflink.c (_bfd_elf_merge_symbol): Add an argument to return
+	if the old symbol is weak.
+	(_bfd_elf_add_default_symbol): Update _bfd_elf_merge_symbol
+	call.
+	(elf_link_add_object_symbols): Don't update symbol type from a
+	weak definition.  Update symbol type from a common symbol when
+	overriding a weak symbol.
+
+2012-09-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_convert_mov_to_lea): Ignore discarded
+	section.
+	* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
+
+2012-09-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_finish_dynamic_symbol): Replace return
+	FALSE with abort.
+	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
+
+2012-09-17  Walter Lee  <walt@tilera.com>
+
+	* elf32-tilepro.c (tilepro_elf_relocate_section): Remove unused
+	got_base variable.
+	* elfxx-tilegx.c (tilegx_elf_relocate_section): Ditto.
+
+2012-09-17  Walter Lee  <walt@tilera.com>
+
+	* elf32-tilepro.c (tilepro_elf_relocate_section): Fix computation
+	of got relocations for when .got.plt section is merged with .got.
+	* elfxx-tilegx.c (tilegx_elf_relocate_section): Ditto.
+
+2012-09-14  David Edelsohn  <dje.gcc@gmail.com>
+
+	* configure: Regenerate.
+
+2012-09-13  Anthony Green  <green@moxielogic.com>
+
+	* targets.c (bfd_elf32_bigmoxie_vec, bfd_elf32_littlemoxie_vec):
+	Define.
+	(bfd_elf32_moxie_vec): Remove.
+	* config.bfd, configure.in: Add bi-endian support for moxie.
+	* configure: Rebuilt.
+	* elf32-moxie.c (TARGET_LITTLE_NAME, TARGET_LITTLE_SYM): Define.
+	(TARGET_BIG_NAME, TARGET_BIG_SYM): Update for bi-endian support.
+
+2012-09-12  Doug Kwan  <dougkwan@google.com>
+
+	* elf64-ppc.c (ppc64_elf_relocate_section): Use pre-adjusted
+	relocation for stub lookup.
+
+2012-09-12  Chris Schlumberger-Socha  <chris.schlumberger-socha@arm.com>
+
+	* bfd-in2.h: Regenerated.
+	* elf64-aarch64.c
+	(elf64_aarch64_howto_table): Add R_AARCH64_GOT_LD_PREL19 reloc to HOWTO.
+	(elf64_aarch64_reloc_map): Add reloc entry.
+	(aarch64_resolve_relocation): Likewise.
+	(bfd_elf_aarch64_put_addend): Likewise.
+	(aarch64_reloc_got_type): Likewise.
+	(elf64_aarch64_final_link_relocate): Likewise.
+	(lf64_aarch64_check_relocs): Likewise.
+	(elf64_aarch64_check_relocs): New case for R_AARCH64_ADR_PREL_LO21
+	reloc.
+	* libbfd.h: Regenerated.
+	* reloc.c (R_AARCH64_GOT_LD_PREL19): New reloc.
+
+2012-09-10  Matthias Klose  <doko@ubuntu.com>
+
+	* config.in: Disable sanity check for kfreebsd.
+
+2012-09-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* configure: Regenerated.
+
+2012-09-04  Sergey A. Guriev <sergey.a.guriev@intel.com>
+
+	* cpu-ia64-opc.c (ins_cnt6a): New function.
+	(ext_cnt6a): Ditto.
+	(ins_strd5b): Ditto.
+	(ext_strd5b): Ditto.
+	(elf64_ia64_operands): Add new operand types.
+
+2012-09-04  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/14493
+	* elf.c (ignore_section_sym): Also ignore section symbols without
+	a BFD section.
+
+2012-09-03  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf32-s390.c (elf_s390_relocate_section): Handle PLTOFF for
+	local and global ifunc symbols.
+	* elf64-s390.c (elf_s390_relocate_section): Likewise.
+
+2012-09-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf-bfd.h (elf_link_hash_table): Add hdynamic for the
+	_DYNAMIC symbol.
+
+	* elflink.c (_bfd_elf_link_create_dynamic_sections): Set
+	hdynamic.
+
+	* elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Check
+	hdynamic instead of "_DYNAMIC".
+	* elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise.
+	* elf32-cr16.c (elf32_arm_finish_dynamic_symbol): Likewise.
+	* elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
+	* elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
+	* elf32-i386.c (elf_i386_convert_mov_to_lea): Likewise.
+	* elf32-lm32.c (lm32_elf_finish_dynamic_symbol): Likewise.
+	* elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise.
+	* elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
+	* elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise.
+	* elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
+	* elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
+	* elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise.
+	* elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise.
+	* elf64-aarch64.c elf64_aarch64_finish_dynamic_symbol(): Likewise.
+	* elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise.
+	* elf64-ia64-vms.c (elf64_ia64_finish_dynamic_symbol): Likewise.
+	* elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
+	* elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise.
+	* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
+	* elfnn-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise.
+	* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
+	* elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
+	* elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
+
+	* elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Check
+	hdynamic, hgot, hplt instead of _DYNAMIC, _GLOBAL_OFFSET_TABLE_,
+	_PROCEDURE_LINKAGE_TABLE_.
+	* elf32-score.c (s3_bfd_score_elf_finish_dynamic_symbol): Likewise.
+	* elf32-score7.c (s7_bfd_score_elf_finish_dynamic_symbol): Likewise.
+
+2012-08-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_convert_mov_to_lea): Don't optimize
+	_DYNAMIC.
+	* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
+
+2012-08-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_convert_mov_to_lea): New.
+	(elf_i386_size_dynamic_sections): Use it on input sections.
+	(elf_i386_relocate_section): Don't convert
+	"mov foo@GOT(%reg), %reg" to "lea foo@GOTOFF(%reg), %reg"
+	for local symbols here.
+
+	* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): New.
+	(elf_x86_64_size_dynamic_sections): Use it on input sections.
+	(elf_x86_64_relocate_section): Don't convert
+	"mov foo@GOTPCREL(%rip), %reg" to "lea foo(%rip), %reg"
+	for local symbols here.
+
+2012-08-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_relocate_section): Convert
+	"mov foo@GOT(%reg), %reg" to "lea foo@GOTOFF(%reg), %reg"
+	for local symbols.
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Convert
+	"mov foo@GOTPCREL(%rip), %reg" to "lea foo(%rip), %reg"
+	for local symbols.
+
+2012-08-31  Alan Modra  <amodra@gmail.com>
+
+	PR ld/14464
+	* elf64-ppc.c (ppc64_elf_relocate_section): Map symbols defined
+	by a linker script in .opd to corresponding input .opd section.
+
+2012-08-28  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elf32-ppc.c (ppc_elf_relocate_section): Assert that dynindx is
+	not minus one.
+	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+
+2012-08-28  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elflink.c (_bfd_elf_merge_symbol): Also override the version
+	a dynamic symbol defaulted to if preempted with a hidden or
+	internal definition.
+
+2012-08-28  Walter Lee  <walt@tilera.com>
+
+	* elf32-tilepro.c (allocate_dynrelocs): Use PLT_ENTRY_SIZE as size
+	of header.
+	(tilepro_plt_entry_build): Account for new header size.
+	(tilepro_elf_finish_dynamic_sections): Ditto.
+	(tilepro_elf_plt_sym_val): Ditto.
+	* elfxx-tilegx.c (allocate_dynrelocs): Use PLT_ENTRY_SIZE as size
+	of header + tail.
+	(tilegx_elf_finish_dynamic_sections): Account for new padding.
+
+2012-08-27  Walter Lee  <walt@tilera.com>
+
+	* reloc.c (Add BFD_RELOC_TILEGX_IMM16_X0_HW0_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X1_HW0_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X0_HW1_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X1_HW1_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X0_HW2_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X1_HW2_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X0_HW3_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X1_HW3_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL,
+	BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL): new relocations.
+	* elfxx-tilegx.c (tilegx_elf_howto_table): Handle new relocations.
+	(tilegx_reloc_map): Ditto.
+	(reloc_to_create_func): Ditto.
+	(tilegx_elf_check_relocs): Ditto.
+	(tilegx_elf_gc_sweep_hook): Ditto.
+	(tilegx_elf_relocate_section): Ditto.
+	* libbfd.h: Regenerate.
+	* bfd-in2.h: Regenerate.
+
+2012-08-24  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+	* elf32-arm.c (v8): New array.
+	(tag_cpu_arch_combine): Add support for ARMv8 attributes.
+	(elf32_arm_merge_eabi_attributes): Likewise.
+	(VFP_VERSION_COUNT): New define.
+
+2012-08-20  Tom Tromey  <tromey@redhat.com>
+
+	* vms-lib.c (_bfd_vms_lib_get_module): Use bfd_zmalloc for
+	areltdata.
+	* opncls.c (_bfd_delete_bfd): Free arelt_data.
+	* mach-o.c (bfd_mach_o_fat_member_init): Use bfd_zmalloc for
+	areltdata.
+	* ecoff.c (_bfd_ecoff_slurp_armap): Use free for mapdata.
+	* coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Use bfd_zmalloc for
+	areltdata.
+	(xcoff_write_archive_contents_old): Likewise.
+	(xcoff_write_archive_contents_big): Likewise.
+	* archive64.c (bfd_elf64_archive_slurp_armap): Use free for
+	areltdata.
+	* archive.c (_bfd_generic_read_ar_hdr_mag): Use bfd_zmalloc and
+	free for areltdata.
+	(_bfd_get_elt_at_filepos): Likewise.  Clear n_nfd->arelt_data on
+	failure.
+	(do_slurp_bsd_armap): Use bfd_zmalloc and free for areltdata.
+	(do_slurp_coff_armap): Likewise.
+	(_bfd_slurp_extended_name_table): Likewise.
+	(bfd_slurp_bsd_armap_f2): Likewise.  Don't leak 'mapdata'.
+
+2012-08-17  Nick Clifton  <nickc@redhat.com>
+
+	* po/vi.po: Updated Vietnamese translation.
+
+2012-08-17  Yuri Chornoivan  <yurchor@ukr.net>
+
+	* elf-bfd.h, * elf32-ppc.c, * elf64-ia64-vms.c, * elfnn-ia64.c,
+	* elfxx-mips.c, * vms-alpha.c: Typo fixes.
+
+2012-08-17  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/14475:
+	* archive.c (bfd_ar_hdr_from_filesystem): Revert last change.
+	Instead malloc areltdata.
+
+2012-08-16  Tom Tromey  <tromey@redhat.com>
+
+	PR binutils/14475:
+	* archive.c (bfd_ar_hdr_from_filesystem): Allocate areltdata on
+	'member' BFD.  Don't try to free 'ared'.
+
+2012-08-14  Nick Clifton  <nickc@redhat.com>
+
+	* po/uk.po: Updated Ukranian translation.
+
+2012-08-13  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Look up
+	the options section in the output rather than input BFD to
+	decide if to add a DT_MIPS_OPTIONS tag.
+
+2012-08-13  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* config.bfd: Wrap mips*el-*-linux* and mips*-*-linux* into
+	#ifdef BFD64.
+
+2012-08-13  Ian Bolton  <ian.bolton@arm.com>
+            Laurent Desnogues  <laurent.desnogues@arm.com>
+            Jim MacArthur  <jim.macarthur@arm.com>
+            Marcus Shawcroft  <marcus.shawcroft@arm.com>
+            Nigel Stephens  <nigel.stephens@arm.com>
+            Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
+            Richard Earnshaw  <rearnsha@arm.com>
+            Sofiane Naci  <sofiane.naci@arm.com>
+            Tejas Belagod  <tejas.belagod@arm.com>
+            Yufeng Zhang  <yufeng.zhang@arm.com>
+
+	* Makefile.am: Add AArch64 files.
+	* Makefile.in: Regenerate.
+	* archures.c (bfd_aarch64_arch): New declaration.
+	(bfd_archures_list): Use bfd_archures_list.
+	* bfd-in.h (bfd_elf64_aarch64_init_maps): New declaration.
+	(bfd_aarch64_process_before_allocation): New declaration.
+	(bfd_elf64_aarch64_process_before_allocation): New declaration.
+	(bfd_elf64_aarch64_set_options): New declaration.
+	(bfd_elf64_aarch64_add_glue_sections_to_bfd): New declaration.
+	(BFD_AARCH64_SPECIAL_SYM_TYPE_MAP): New definition.
+	(BFD_AARCH64_SPECIAL_SYM_TYPE_TAG): New definition.
+	(BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER): New definition.
+	(BFD_AARCH64_SPECIAL_SYM_TYPE_ANY): New definition.
+	(bfd_is_aarch64_special_symbol_name): New declaration.
+	(bfd_aarch64_merge_machines): New declaration.
+	(bfd_aarch64_update_notes): New declaration.
+	(int bfd_aarch64_get_mach_from_notes): New declaration.
+	(elf64_aarch64_setup_section_lists): New declaration.
+	(elf64_aarch64_next_input_section): New declaration.
+	(elf64_aarch64_size_stubs): New declaration.
+	(elf64_aarch64_build_stubs): New declaration.
+	* config.bfd: Add AArch64.
+	* configure.in: Add AArch64.
+	* configure: Regenerate.
+	* cpu-aarch64.c: New file.
+	* elf-bfd.h: Add AArch64.
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+	* elf64-aarch64.c: New file.
+	* reloc.c: Add AArch64 relocations.
+	* targets.c: Add AArch64.
+	* po/SRC-POTFILES.in: Regenerate.
+
+2012-08-13  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (mips_elf_calculate_relocation): Fix the handling
+	of protected symbols.
+
+2012-08-10  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/14444
+	* elf.c (IS_VALID_GROUP_SECTION_HEADER) Add minsize param.
+	(setup_group): Adjust uses.
+	(bfd_section_from_shdr): Allow SHT_GROUP sections with just a flag
+	word.
+
+2012-08-09  Nick Clifton  <nickc@redhat.com>
+
+	* po/vi.po: Updated Vietnamese translation.
+
+2012-08-09  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (LA25_LUI_MICROMIPS_1, LA25_LUI_MICROMIPS_2):
+	Remove macros, folding them into...
+	(LA25_LUI_MICROMIPS): ... this new macro.
+	(LA25_J_MICROMIPS_1, LA25_J_MICROMIPS_2): Likewise into...
+	(LA25_J_MICROMIPS): ... this new macro.
+	(LA25_ADDIU_MICROMIPS_1, LA25_ADDIU_MICROMIPS_2): Likewise
+	into...
+	(LA25_ADDIU_MICROMIPS): ... this new macro.
+	(bfd_put_micromips_32, bfd_get_micromips_32): New functions.
+	(mips_elf_create_la25_stub): Use them.
+	(check_br32_dslot, check_br32, check_relocated_bzc): Likewise.
+	(_bfd_mips_elf_relax_section): Likewise.
+
+2012-08-09  Alan Modra  <amodra@gmail.com>
+	    Tom Tromey  <tromey@redhat.com>
+
+	* archive.c (SECTION Archives): Update documentation.
+	(_bfd_delete_archive_data): Remove.
+	(_bfd_add_bfd_to_archive_cache): Set 'parent_cache' and 'key'.
+	(archive_close_worker, _bfd_archive_close_and_cleanup): New
+	functions.
+	* libbfd-in.h (struct areltdata <parent_cache, key>): New fields.
+	(_bfd_delete_archive_data): Don't declare.
+	(_bfd_archive_close_and_cleanup): Declare.
+	(_bfd_generic_close_and_cleanup): Redefine.
+	* libbfd.h: Rebuild.
+	* opncls.c (_bfd_delete_bfd): Don't call _bfd_delete_archive_data.
+	(bfd_close): Don't close nested thin archives here.
+
+2012-08-07  Tom Tromey  <tromey@redhat.com>
+
+	* archive.c (_bfd_delete_archive_data): New function.
+	* libbfd-in.h (_bfd_delete_archive_data): Declare.
+	* libbfd.h: Rebuild.
+	* opncls.c (_bfd_delete_bfd): Call _bfd_delete_archive_data.
+
+2012-08-07  Nick Clifton  <nickc@redhat.com>
+
+	* po/uk.po: Updated Ukranian translation.
+
+2012-08-06  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elflink.c (bfd_elf_record_link_assignment): Remove --defsym
+	symbols special case.
+
+2012-08-05  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_adjust_dynamic_symbol): Don't allocate
+	PLT slots for local symbols.
+
+2012-08-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elf64-mips.c (mips16_elf64_howto_table_rela): Correct src_mask
+	field initializers throughout.
+	* elfn32-mips.c (elf_mips16_howto_table_rela): Likewise.
+
+2012-08-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (mips_elf_perform_relocation): Update the
+	cross-mode jump message.
+
+2012-08-03  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Update the
+	comment on DT_MIPS_RLD_MAP.
+
+2012-08-03  Tom Tromey  <tromey@redhat.com>
+
+	* opncls.c (_bfd_delete_bfd): Now static.
+	* libbfd-in.h (_bfd_delete_bfd): Don't declare.
+	* libbfd.h: Rebuild.
+
+2012-08-02  Sean Keys  <skeys@ipdatasys.com>
+
+	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Modified
+	conditional statment to allow suppression of mismatched bank
+	warning.
+
+2012-08-01  Alan Modra  <amodra@gmail.com>
+
+	* dwarf2.c (struct dwarf2_debug): Add close_on_cleanup.
+	(_bfd_dwarf2_slurp_debug_info): Set close_on_cleanup if we open
+	gnu_debuglink bfd.
+	(_bfd_dwarf2_cleanup_debug_info): Act on close_on_cleanup.
+
+2012-07-30  Nick Clifton  <nickc@redhat.com>
+
+	* po/bfd.pot: Updated template.
+	* po/es.po: Updated Spanish translation.
+	* po/fi.po: Updated Finnish translation.
+	* po/fr.po: Updated French translation.
+	* po/ru.po: Updated Russian translation.
+	* po/uk.po: Updated Ukranian translation.
+
+2012-07-27  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.in (AC_INIT): Call with the args bfd and 2.22.52.
+	(AM_INIT_AUTOMAKE): Remove args.
+	* configure: Regenerate.
+
+2012-07-27  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* cpu-s390.c (bfd_s390_64_arch, bfd_s390_arch): Pick the default
+	arch depending on the target size.
+
+2012-07-27  Tristan Gingold  <gingold@adacore.com>
+
+	* configure.in: Bump version to 2.23.51
+	* configure: Regenerate.
+
+2012-07-26  Teresa Johnson  <tejohnson@google.com>
+
+	* bfd/dwarf2.c (find_line): Initialize discriminator_ptr
+	if it is non-NULL.
+
+2012-07-26  Meador Inge  <meadori@codesourcery.com>
+	    Nick Clifton  <nickc@redhat.com>
+
+	PR ld/14397
+	* elf32-arm.c (elf32_arm_finish_dynamic_sections): Report an error
+	if a required section is missing from the linker script.
+
+2012-07-24  Jan Waclawek <konfera@efton.sk>
+	PR 13899
+	* elf32-avr.c (elf32_avr_relax_delete_bytes): Call
+	_bfd_elf_link_read_relocs with keep_memory as TRUE.
+
+2012-07-24  Teresa Johnson  <tejohnson@google.com>
+
+	* bfd.c (bfd_find_nearest_line_discriminator): New macro.
+	* coff-rs6000.c: Init _bfd_find_nearest_line_discriminator.
+	* coff64-rs6000.c: Likewise.
+	* dwarf2.c (struct line_info): Add discriminator field.
+	(add_line_info): Fill in new discriminator field.
+	(decode_line_info): Record discriminator information instead
+	of ignoring it.
+	(lookup_address_in_line_info_table): Return discriminator field if
+	requested.
+	(comp_unit_find_nearest_line): Add discriminator argument.
+	(find_line): Likewise.
+	(_bfd_dwarf2_find_nearest_line): Likewise.
+	(_bfd_dwarf2_find_line): Likewise.
+	* elf-bfd.h (_bfd_elf_find_nearest_line_discriminator): New.
+	(_bfd_elf_find_line_discriminator): Likewise.
+	(_bfd_generic_find_nearest_line_discriminator): Likewise. Defined.
+	* elf.c (_bfd_elf_find_nearest_line): Change to a wrapper
+	that invokes _bfd_elf_find_nearest_line_discriminator with correct
+	arguments.
+	(_bfd_elf_find_nearest_line_discriminator): New.
+	(_bfd_elf_find_line): Change to a wrapper
+	that invokes _bfd_elf_find_line_discriminator with correct
+	arguments.
+	(_bfd_elf_find_line_discriminator): New.
+	* coffgen.c (coff_find_nearest_line_with_names): Handle
+	new discriminator argument.
+	* elf32-arm.c (elf32_arm_find_nearest_line): Likewise.
+	* elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise.
+	* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
+	* mach-o.c (bfd_mach_o_find_nearest_line): Likewise.
+	* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Add discriminator
+	argument.
+	(_bfd_dwarf2_find_line): Likewise.
+	(_bfd_generic_find_nearest_line_discriminator): New.
+	* libbfd.c (_bfd_generic_find_nearest_line_discriminator): New.
+	* bfd-in2.h: Regenerated.
+	* libbfd.h: Likewise.
+	* targets.c (BFD_JUMP_TABLE_SYMBOLS): Initialize
+	_bfd_find_nearest_line_discriminator with
+	_bfd_generic_find_nearest_line_discriminator.
+	(bfd_target): Add _bfd_find_nearest_line_discriminator.
+
+2012-07-24  Sean Keys  <skeys@ipdatasys.com>
+
+	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Added code
+	that enables the linker to offset addresses, when linking against
+	symbols from the XGATE processor and vice versa.
+
+2012-07-23  Nick Clifton  <nickc@redhat.com>
+
+	* cisco-core.c (cisco_core_file_failing_command): Make static.
+	(cisco_core_file_failing_signal): Make static.
+
+2012-07-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* bfd-in2.h: Regenerated.
+
+2012-07-18  Nicolàs Alejandro Di Risio <sheeva@tiscali.it>
+
+	PR binutils/14335
+	* section.c: Fix a typo in comments.
+
+2012-07-13  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf64-s390.c: Include elf-s390-common.c.
+	(R_390_IRELATIVE): New reloc.
+	(elf_s390_reloc_type_lookup): Support R_390_IRELATIVE.
+	(RELA_ENTRY_SIZE): New macro.
+	(elf_s390_link_hash_entry): New fields ifunc_resolver_address and
+	*ifunc_resolver_section.
+	(struct plt_entry): New struct.
+	(struct elf_s390_obj_tdata): New field local_plt.
+	(elf_s390_local_plt): New macro.
+	(struct elf_s390_link_hash_table): New field irelifunc.
+	(ELF64): New macro.
+	(link_hash_newfunc): Initialize new fields.
+	(elf_s390_check_relocs): Handle IFUNC symbols.
+	(elf_s390_adjust_dynamic_symbol): Don't do anything for IFUNC
+	symbols.
+	(allocate_dynrelocs): Call s390_elf_allocate_ifunc_dyn_relocs for
+	IFUNC symbols.
+	(elf_s390_size_dynamic_sections): Handle IFUNC symbols.
+	(elf_s390_relocate_section): Likewise.
+	(elf_s390_finish_dynamic_symbol): Likewise.
+	(elf_s390_finish_dynamic_sections): Handle local IFUNC symbols.
+	(elf_s390_finish_ifunc_symbol): New function.
+	(elf_s390_gc_sweep_hook): Handle local plt entries.
+	(elf_backend_add_symbol_hook): Define.
+	* elf32-s390.c: See elf64-s390.c changes.
+	* elf-s390-common.c: New file.
+	* bfd-in2.h (BFD_RELOC_390_IRELATIVE): New enum field.
+	* libbfd.h (BFD_RELOC_390_IRELATIVE): New entry for
+	BFD_RELOC_390_IRELATIVE.
+	* reloc.c (BFD_RELOC_390_IRELATIVE): Document new relocation.
+
+2012-07-13  Nick Clifton  <nickc@redhat.com>
+
+	* aix386-core.c: Remove use of PTR and PARAMS macros.
+	* archive.c: Likewise.
+	* cache.c: Likewise.
+	* cisco-core.c: Likewise.
+	* coff-alpha.c: Likewise.
+	* coff-apollo.c: Likewise.
+	* coff-aux.c: Likewise.
+	* coff-h8300.c: Likewise.
+	* coff-h8500.c: Likewise.
+	* coff-i386.c: Likewise.
+	* coff-i960.c: Likewise.
+	* coff-ia64.c: Likewise.
+	* coff-m68k.c: Likewise.
+	* coff-m88k.c: Likewise.
+	* coff-mcore.c: Likewise.
+	* coff-mips.c: Likewise.
+	* coff-or32.c: Likewise.
+	* coff-ppc.c: Likewise.
+	* coff-rs6000.c: Likewise.
+	* coff-sh.c: Likewise.
+	* coff-sparc.c: Likewise.
+	* coff-stgo32.c: Likewise.
+	* coff-tic30.c: Likewise.
+	* coff-tic4x.c: Likewise.
+	* coff-tic54x.c: Likewise.
+	* coff-tic80.c: Likewise.
+	* coff-w65.c: Likewise.
+	* cofflink.c: Likewise.
+	* cpu-arc.c: Likewise.
+	* cpu-cris.c: Likewise.
+	* cpu-h8500.c: Likewise.
+	* cpu-i960.c: Likewise.
+	* cpu-msp430.c: Likewise.
+	* cpu-ns32k.c: Likewise.
+	* cpu-powerpc.c: Likewise.
+	* cpu-rs6000.c: Likewise.
+	* cpu-tic4x.c: Likewise.
+	* cpu-w65.c: Likewise.
+	* ecoff.c: Likewise.
+	* ecofflink.c: Likewise.
+	* elf-m10200.c: Likewise.
+	* elf32-bfin.c: Likewise.
+	* elf32-cris.c: Likewise.
+	* elf32-crx.c: Likewise.
+	* elf32-fr30.c: Likewise.
+	* elf32-frv.c: Likewise.
+	* elf32-h8300.c: Likewise.
+	* elf32-i960.c: Likewise.
+	* elf32-m32c.c: Likewise.
+	* elf32-m68hc11.c: Likewise.
+	* elf32-m68hc12.c: Likewise.
+	* elf32-m68hc1x.c: Likewise.
+	* elf32-m68k.c: Likewise.
+	* elf32-mcore.c: Likewise.
+	* elf32-rl78.c: Likewise.
+	* elf32-rx.c: Likewise.
+	* elf32-s390.c: Likewise.
+	* elf32-vax.c: Likewise.
+	* elf64-alpha.c: Likewise.
+	* elf64-mmix.c: Likewise.
+	* elf64-s390.c: Likewise.
+	* elf64-sparc.c: Likewise.
+	* elfnn-ia64.c: Likewise.
+	* elfxx-mips.c: Likewise.
+	* elfxx-sparc.c: Likewise.
+	* hash.c: Likewise.
+	* hp300hpux.c: Likewise.
+	* hppabsd-core.c: Likewise.
+	* hpux-core.c: Likewise.
+	* i386dynix.c: Likewise.
+	* i386linux.c: Likewise.
+	* i386lynx.c: Likewise.
+	* i386mach3.c: Likewise.
+	* i386msdos.c: Likewise.
+	* i386os9k.c: Likewise.
+	* irix-core.c: Likewise.
+	* lynx-core.c: Likewise.
+	* m68klinux.c: Likewise.
+	* mach-o.h: Likewise.
+	* mipsbsd.c: Likewise.
+	* netbsd-core.c: Likewise.
+	* nlm32-i386.c: Likewise.
+	* osf-core.c: Likewise.
+	* pc532-mach.c: Likewise.
+	* pef.c: Likewise.
+	* ppcboot.c: Likewise.
+	* ptrace-core.c: Likewise.
+	* reloc16.c: Likewise.
+	* sco5-core.c: Likewise.
+	* som.h: Likewise.
+	* sparclinux.c: Likewise.
+	* sparclynx.c: Likewise.
+	* ticoff.h: Likewise.
+	* trad-core.c: Likewise.
+	* vms-lib.c: Likewise.
+	* xsym.h: Likewise.
+
+2012-07-09  Alan Modra  <amodra@gmail.com>
+
+	PR ld/14323
+	* elflink.c (elf_sort_symbol): Sort by size too.
+	(elf_link_add_object_symbols <weakdefs>): Simplify binary search.
+	Do not depend on ordering of symbol aliases.  Match largest size.
+
+2012-07-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf.c (assign_section_numbers): Check if number of sections
+	>= SHN_LORESERVE.
+	* elfcode.h (elf_object_p): Likewise.
+
+2012-07-03  Nick Clifton  <nickc@redhat.com>
+
+	* archive.c (bsd_write_armap): Catch attempts to create an archive
+	with indicies bigger than 4Gb.
+	(coff_write_armap): Likewise.
+
+2012-07-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/14319
+	* elf.c (_bfd_elf_make_section_from_shdr): Don't compress empty
+	debug section.
+
+2012-07-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/3351
+	* elflink.c (_bfd_elf_update_dynamic_flags): New.
+	(_bfd_elf_merge_symbol): Update both real and indirect symbol
+	dynamic flags.
+	(_bfd_elf_add_default_symbol): Make the real symbol dynamic if
+	the indirect symbol is defined in a shared library.
+	(elf_link_add_object_symbols): Likewise.  If the indirect
+	symbol has been forced local, don't make the real symbol
+	dynamic.
+	(elf_link_check_versioned_symbol): Check indirect symbol.
+	(elf_link_output_extsym): Use real symbol definition when
+	reporting indirect symbol error.  Check version info for
+	dynamic versioned symbol.
+
+2012-07-03  Alan Modra  <amodra@gmail.com>
+
+	PR ld/14207
+	* elf.c (assign_file_positions_for_load_sections): Remove assertions
+	that only PT_LOAD headers include file header and section headers.
+	(assign_file_positions_for_non_load_sections): Similarly don't
+	assert PT_GNU_RELRO header does not include file and section headers.
+	Compare first section vma rather than PT_LOAD p_vaddr against
+	relro_start when looking for PT_LOAD covering PT_GNU_RELRO.  Replace
+	abort with assertion.
+
+2012-07-02  Alan Modra  <amodra@gmail.com>
+
+	* elf32-m32c.c (m32c_elf_check_relocs): Use bfd_make_section
+	"anyway" variant when creating .plt.
+	(m32c_elf_relax_plt_section): Remove redundant test and unused param.
+	(m32c_elf_relax_section): Test SEC_LINKER_CREATED before calling
+	m32c_elf_relax_plt_section.
+	* elfxx-mips.c (mips_elf_create_got_section): Use make anyway variant
+	when creating .got and .got.plt.
+	(_bfd_mips_elf_final_link): Likewise for .rtproc, and use
+	bfd_get_linker_section.
+	* sunos.c: Similarly throughout.
+
+2012-07-01  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* elf.c (_bfd_elf_make_section_from_shdr): Fix typo in error
+	message.
+
+2012-06-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Return FALSE
+	on unresolvable relocation.
+
+2012-06-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* archive.c (_bfd_compute_and_write_armap): Simplify global
+	symbol handling.
+
+2012-06-29  Nick Clifton  <nickc@redhat.com>
+
+	PR ld/14189
+	* elf32-arm.c (elf32_arm_check_relocs): Do not increment refcount
+	for locally bound symbols.
+
+2012-06-29  Alan Modra  <amodra@gmail.com>
+
+	* section.c (bfd_get_linker_section): New function.
+	* elf32-arm.c: When retrieving SEC_LINKER_CREATED sections, use
+	the above throughout rather than bfd_get_section_by_name.  Use
+	bfd_make_section_anyway rather than bfd_make_section when creating
+	them.
+	* elf32-bfin.c: Likewise.
+	* elf32-cr16.c: Likewise.
+	* elf32-cris.c: Likewise.
+	* elf32-frv.c: Likewise.
+	* elf32-hppa.c: Likewise.
+	* elf32-i370.c: Likewise.
+	* elf32-i386.c: Likewise.
+	* elf32-lm32.c: Likewise.
+	* elf32-m32c.c: Likewise.
+	* elf32-m32r.c: Likewise.
+	* elf32-m68k.c: Likewise.
+	* elf32-microblaze.c: Likewise.
+	* elf32-ppc.c: Likewise.
+	* elf32-rl78.c: Likewise.
+	* elf32-s390.c: Likewise.
+	* elf32-score.c: Likewise.
+	* elf32-score7.c: Likewise.
+	* elf32-sh.c: Likewise.
+	* elf32-tic6x.c: Likewise.
+	* elf32-tilepro.c: Likewise.
+	* elf32-vax.c: Likewise.
+	* elf32-xstormy16.c: Likewise.
+	* elf32-xtensa.c: Likewise.
+	* elf64-alpha.c: Likewise.
+	* elf64-hppa.c: Likewise.
+	* elf64-ia64-vms.c: Likewise.
+	* elf64-ppc.c: Likewise.
+	* elf64-s390.c: Likewise.
+	* elf64-sh64.c: Likewise.
+	* elf64-sparc.c: Likewise.
+	* elf64-x86-64.c: Likewise.
+	* elfnn-ia64.c: Likewise.
+	* elfxx-mips.c: Likewise.
+	* elfxx-sparc.c: Likewise.
+	* elfxx-tilegx.c: Likewise.
+	* elflink.c: Likewise.
+	* elf-vxworks.c: Likewise.
+	* elf-m10300.c: Likewise.  Also make use of htab plt, got and
+	gotplt shortcuts.
+	* bfd-in2.h: Regenerate.
+	* elf32-lm32.c (lm32_elf_check_relocs): Use the correct bfd when
+	calling create_rofixup_section.
+	* elflink.c (bfd_elf_final_link): Simplify test for .dynstr.
+
+2012-06-29  Alan Modra  <amodra@gmail.com>
+
+	* elf32-sh.c (sh_elf_create_dynamic_sections): Don't create .rela
+	section for bss type sections, except for .rela.bss.
+	* elf-m10300.c (_bfd_mn10300_elf_create_dynamic_sections): Likewise.
+	* elf32-cr16.c (_bfd_cr16_elf_create_dynamic_sections): Likewise.
+	* elf32-lm32.c (lm32_elf_create_dynamic_sections): Likewise.
+	* elf32-m32r.c (m32r_elf_create_dynamic_sections): Likewise.
+	* elf64-sh64.c (sh64_elf64_create_dynamic_sections): Likewise.
+
+2012-06-28  Roland McGrath  <mcgrathr@google.com>
+
+	* elf32-arm.c (elf32_arm_populate_plt_entry): Use int32_t for
+	displacement calculation in nacl_p case.
+
+2012-06-28  Nick Clifton  <nickc@redhat.com>
+
+	* po/uk.po: New Ukranian translation.
+	* configure.in (ALL_LINGUAS): Add uk.
+	* configure: Regenerate.
+
+2012-06-26  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_next_toc_section): Don't error if input
+	file has multiple .got/.toc sections and all don't fit in
+	current toc group.
+
+2012-06-22  Roland McGrath  <mcgrathr@google.com>
+
+	* elf.c (assign_file_positions_for_non_load_sections): Define
+	__ehdr_start symbol if it's referenced and there's a PT_LOAD
+	segment that covers both the file and program headers.
+
+2012-06-22  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Don't make
+	_GLOBAL_OFFSET_TABLE_ and _DYNAMIC absolute.
+
+2012-06-22  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't emit out-of-line
+	save/restore functions when relocatable.  Make "funcs" static.
+
+2012-06-18  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elf32-cris.c (cris_elf_plt_sym_val): Rewrite to work in presence
+	of merged .got and .got.plt entries.
+
+2012-06-18  John Szakmeister  <john@szakmeister.net>
+
+	* elf32-arm.c (elf32_arm_final_link_relocate): Correct return value.
+
+2012-06-17  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elf32-cris.c (cris_elf_relocate_section): <R_CRIS_32_IE>
+	<R_CRIS_32_GOT_TPREL, R_CRIS_16_GOT_TPREL>: Handle references to
+	thread common symbols.
+
+2012-06-13  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-arm.c (bfd_arm_get_mach_from_attributes): New function.
+	(elf32_arm_object_p): If the machine number could not be deduced
+	from the notes, call bfd_arm_get_mach_from_attributes to get the
+	number from the attributes.
+
+2012-06-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR bfd/14207
+	* elf.c (assign_file_positions_for_non_load_sections): Abort if
+	PT_GNU_RELRO segment doesn't fit in PT_LOAD segment.
+
+2012-06-12  Alan Modra  <amodra@gmail.com>
+
+	PR ld/14207
+	* elf.c (_bfd_elf_map_sections_to_segments): Disregard bss type
+	sections at end of PT_LOAD segment when searching for segment
+	that contains end of relro extent.
+
+2012-06-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf.c (assign_file_positions_for_non_load_sections): Reindent.
+
+2012-06-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf.c (_bfd_elf_map_sections_to_segments): Reindent.
+
+2012-06-06  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (elf_link_input_bfd): Provide a file symbol for
+	each input file with local syms, if the input lacks such.
+	(bfd_elf_final_link): Add a file symbol to mark end of locals
+	for which we can associate with input files.
+	(struct elf_final_link_info): Add filesym_count field.
+	(struct elf_outext_info): Add need_second_pass and second_pass.
+	(elf_link_output_extsym): Detect symbols defined in the output
+	file, emit them on second pass over locals.
+
+2012-06-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument
+	of target_read_memory as bfd_size_type.
+	* bfd-in2.h: Regenerate.
+	* elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN
+	argument of target_read_memory as bfd_size_type.
+	(_bfd_elf32_bfd_from_remote_memory): Likewise.
+	(_bfd_elf64_bfd_from_remote_memory): Likewise.
+	* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
+	* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): Likewise.
+
+2012-06-03  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/13897
+	* elf.c (elf_find_function): Cache last function sym info.
+	(_bfd_elf_maybe_function_sym): Return function size, pass in
+	section of interest.
+	* elf-bfd.h (struct elf_backend_data <maybe_function_sym>): Likewise.
+	(_bfd_elf_maybe_function_sym): Likewise.
+	* elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise.
+	(opd_entry_value): Add in_code_sec param.  Revert caching code.
+	Return -1 if in_code_sec and function found in wrong section.
+	Update all calls.
+
+2012-06-01  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+	* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument
+	of target_read_memory as size_t.
+	* bfd-in2.h: Regenerate.
+	* elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN
+	argument of target_read_memory as size_t.
+	(_bfd_elf32_bfd_from_remote_memory): Likewise.
+	(_bfd_elf64_bfd_from_remote_memory): Likewise.
+	* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
+	* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): Likewise.
+
+2012-06-01  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/13897
+	* elf64-ppc.c (opd_entry_value): Rewrite cache code.
+
+2012-05-29  Tom Tromey  <tromey@redhat.com>
+
+	* opncls.c (bfd_fopen): Always close fd on failure.
+	(bfd_fdopenr): Likewise.
+
+2012-05-27  Alan Modra  <amodra@gmail.com>
+
+	PR ld/14170
+	* elflink.c (_bfd_elf_merge_symbol): When a symbol defined in
+	a dynamic library finds a new instance with non-default
+	visibility in a regular object, correctly handle symbols
+	already on the undefs list and undo dynamic symbol state when
+	the new symbol is hidden or internal.
+
+2012-05-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_create_dynamic_sections): Don't use
+	dynamic_sec_flags to create PLT .eh_frame section.
+	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
+
+2012-05-25  Alan Modra  <amodra@gmail.com>
+
+	PR ld/13909
+	* elf-eh-frame.c (_bfd_elf_eh_frame_present): New function.
+	(_bfd_elf_maybe_strip_eh_frame_hdr): Use it here.
+	* elf-bfd.h (_bfd_elf_eh_frame_present): Declare.
+	* elflink.c (bfd_elf_size_dynamic_sections): Let the backend
+	size dynamic sections before stripping eh_frame_hdr.
+	(bfd_elf_gc_sections): Handle multiple .eh_frame sections.
+	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Drop glink_eh_frame
+	if no other .eh_frame sections exist.
+	* elf64-ppc.c (ppc64_elf_size_stubs): Likewise.
+	* elf32-i386.c (elf_i386_create_dynamic_sections): Don't size
+	or alloc plt_eh_frame here..
+	(elf_i386_size_dynamic_sections): ..do it here instead.  Don't
+	specially keep sgotplt, iplt, tgotplt, sdynbss for symbols.
+	(elf_i386_finish_dynamic_sections): Check plt_eh_frame->contents
+	before writing plt offset.
+	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Don't size
+	or alloc plt_eh_frame here..
+	(elf_x86_64_size_dynamic_sections): ..do it here instead.
+	(elf_x86_64_finish_dynamic_sections): Check plt_eh_frame->contents
+	before writing plt offset.
+
+2012-05-24  Alan Modra  <amodra@gmail.com>
+
+	PR ld/14158
+	* elf64-ppc.c (ppc64_elf_size_stubs): Round up glink_eh_frame
+	size to output section alignment.
+	(ppc64_elf_build_stubs): Likewise, and extend last FDE to cover.
+
+2012-05-23  Alan Modra  <amodra@gmail.com>
+
+	* elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Handle
+	BFDs with multiple .eh_frame sections.
+
+2012-05-23  Alan Modra  <amodra@gmail.com>
+
+	PR ld/13909
+	* elflink.c (bfd_elf_discard_info): Don't ignore dynamic BFDs.
+
+2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/13909
+	* elf32-i386.c (elf_i386_create_dynamic_sections): Revert the
+	last change.
+	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
+
+2012-05-22  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (bfd_elf_discard_info): Look for next .eh_frame if
+	first one is zero size or discarded.
+	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Set most of
+	glink_eh_frame contents here..
+	(ppc_elf_finish_dynamic_sections): ..rather than here.  Just set
+	offset to .glink.
+
+2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/13909
+	* elf32-i386.c (elf_i386_create_dynamic_sections): Create PLT
+	eh_frame section if there is an input .eh_frame section.
+	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
+
+2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/14105
+	* elf32-i386.c (elf_i386_create_dynamic_sections): Always
+	create PLT eh_frame section with SEC_LINKER_CREATED.
+	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Likewise.
+
+2012-05-22  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (bfd_elf_discard_info): Handle multiple .eh_frame
+	sections attached to a BFD.
+	* section.c (bfd_get_section_by_name): Rewrite description.
+	(bfd_get_next_section_by_name): New function.
+	* bfd-in2.h: Regenerate.
+
+2012-05-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* elf32-m68k.c (elf_m68k_grok_prstatus): New function.
+	(elf_m68k_grok_psinfo): New function.
+	(elf_backend_grok_prstatus): Define.
+	(elf_backend_grok_psinfo): Define.
+
+2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf64-mips.c (elf_backend_got_header_size): Correct definition.
+	* elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Use the ELF
+	backend's GOT header size instead of hardcoding it.
+
+2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_relocate_section)
+	<R_VAX_8, R_VAX_16, R_VAX_32>: Don't check if info->shared again.
+
+2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf32-vax.c (elf_vax_relocate_section)
+	<R_VAX_8, R_VAX_16, R_VAX_32>: Use section flags rather than
+	its name as the check for text sections.
+
+2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf64-mips.c (mips_elf64_be_swap_reloc_out): Also make sure
+	the third reloc offset is the same as the first.
+
+2012-05-19  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.h (has_vle_insns, is_ppc_vle): Delete.
+	(has_tls_reloc, has_tls_get_addr_call): Move back to..
+	* elf32-ppc.c: ..here.
+	(ppc_elf_section_flags, elf_backend_section_flags): Delete.
+	(ppc_elf_modify_segment_map): Use ELF sh_flags to detect VLE sections.
+
+2012-05-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_finish_dynamic_symbol): Don't make
+	_DYNAMIC nor _GLOBAL_OFFSET_TABLE_ absolute.
+	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
+
+2012-05-18  Roland McGrath  <mcgrathr@google.com>
+
+	* archive.c (_bfd_generic_read_ar_hdr_mag): Fix last change so as
+	not to clobber the ar_fmag field stored in ARED->arch_header.
+
+2012-05-18  Pedro Alves  <palves@redhat.com>
+
+	* mach-o.h: Don't include sysdep.h.
+
+2012-05-18  Nick Clifton  <nickc@redhat.com>
+
+	PR 14072
+	* bfd-in.h: Check for PACKAGE or PACKAGE_VERSION before
+	complaining about config.h not having been included.
+	* bfd-in2.h: Regenerate.
+
+2012-05-18  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* aclocal.m4: Regenerate.
+	* Makefile.in: Regenerate.
+
+2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
+	    Nick Clifton  <nickc@redhat.com>
+
+	PR 14072
+	* configure.in: Add check that sysdep.h has been included before
+	any system header files.
+	* configure: Regenerate.
+	* config.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* bfd-in.h: Generate an error if included before config.h.
+	* sysdep.h: Likewise.
+	* bfd-in2.h: Regenerate.
+	* compress.c: Remove #include "config.h".
+	* plugin.c: Likewise.
+	* elf32-m68hc1x.c: Include sysdep.h before alloca-conf.h.
+	* elf64-hppa.c: Likewise.
+	* som.c: Likewise.
+	* xsymc.c: Likewise.
+
+2012-05-17  Maciej W. Rozycki  <macro@linux-mips.org>
+	    Alan Modra  <amodra@gmail.com>
+
+	* elf.c (ignore_section_sym): Correct comment.  Don't return
+	true for absolute section.
+	(elf_map_symbols): Move stray comment.  Adjust for above change.
+	Don't discard global section symbols.
+
+2012-05-17  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make _DYNAMIC,
+	_GLOBAL_OFFSET_TABLE_ or _PROCEDURE_LINKAGE_TABLE_ absolute.
+	* elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Don't make _DYNAMIC
+	absolute.
+
+2012-05-17  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.c (has_tls_reloc, has_tls_get_addr_call, has_vle_insns,
+	is_ppc_vle): Move to..
+	* elf32-ppc.h: ..here, making is_ppc_vle a macro.
+
+2012-05-16  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	* bfd-in.h (bfd_get_section_name, bfd_get_section_vma,
+	bfd_get_section_lma, bfd_get_section_alignment,
+	bfd_get_section_flags, bfd_get_section_userdata): Rewrite macros
+	in order to use the `bfd' argument.
+	* bfd-in2.h: Regenerate.
+	* elf-vxworks.c (elf_vxworks_finish_dynamic_entry): Pass proper `bfd'
+	as the first argument for `bfd_get_section_alignment'.
+	* elf32-arm.c (create_ifunc_sections): Likewise, for
+	`bfd_set_section_alignment'.
+	* elf32-m32r.c (m32r_elf_relocate_section): Likewise, for
+	`bfd_get_section_name'.
+	* elf32-microblaze.c (microblaze_elf_relocate_section): Likewise.
+	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
+	(ppc_elf_relocate_section): Likewise.
+	* elf64-mmix.c (mmix_final_link_relocate): Likewise, for
+	`bfd_get_section_vma'.
+	* elf64-ppc.c (create_linkage_sections): Likewise, for
+	`bfd_set_section_alignment'.
+
+2012-05-16  Georg-Johann Lay  <avr@gjlay.de>
+
+	PR target/13503
+	* reloc.c: Rename BFD_RELOC_AVR_8_HHI to BFD_RELOC_AVR_8_HLO.
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+	* elf32-avr.c (elf_avr_howto_table): Rename R_AVR_8_HHI8 to
+	R_AVR_8_HLO8.
+	(avr_reloc_map): Likewise.
+
+2012-05-16  Daniel Richard G.  <skunk@iskunk.org>
+
+	PR binutils/13558
+	* bfd/aout-cris.c: Include sysdep.h before bfd.h.
+	* bfd/aout-ns32k.c: Likewise.
+	* bfd/aout-sparcle.c: Likewise.
+	* bfd/aout0.c: Likewise.
+	* bfd/bfd-in2.h: Likewise.
+	* bfd/coff-stgo32.c: Likewise.
+	* bfd/cpu-lm32.c: Likewise.
+	* bfd/cpu-microblaze.c: Likewise.
+	* bfd/cpu-score.c: Likewise.
+	* bfd/cpu-tilegx.c: Likewise.
+	* bfd/cpu-tilepro.c: Likewise.
+	* bfd/elf32-lm32.c: Likewise.
+	* bfd/elf32-microblaze.c: Likewise.
+	* bfd/elf32-score7.c: Likewise.
+	* bfd/elf32-tilepro.c: Likewise.
+	* bfd/elfxx-tilegx.c: Likewise.
+	* bfd/mach-o.h: Likewise.
+	* bfd/nlm32-ppc.c: Likewise.
+	* bfd/ns32knetbsd.c: Likewise.
+	* bfd/pef.h: Likewise.
+	* bfd/plugin.c: Likewise.
+	* bfd/stab-syms.c: Likewise.
+	* bfd/sunos.c: Likewise.
+	* bfd/syms.c: Likewise.
+	* bfd/xsym.h: Likewise.
+
+2012-05-16  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c: Rename flaginfo to flinfo throughout, except..
+	(bfd_elf_lookup_section_flags): ..here, rename finfo to flaginfo.
+	Formatting, style.  Simplify flag match.
+
+2012-05-16  Alan Modra  <amodra@gmail.com>
+
+	* dwarf2.c: Formatting.
+	(arange_add): Pass in unit rather than bfd.  Update callers.
+	Ignore empty ranges.  Don't ask for cleared memory.
+	(parse_comp_unit): Only set unit->base_address if processing
+	DW_TAG_compile_unit.
+	(find_debug_info): Optimise section lookup.
+	(place_sections): Use bfd_alloc for stash->adjusted_sections.
+	(find_line): Match previously parsed comp unit addresses as we
+	do for newly parsed comp units.
+
+2012-05-16  Alan Modra  <amodra@gmail.com>
+
+	* archive.c (_bfd_generic_read_ar_hdr_mag):  Ensure sscanf
+	stops at end of ar_size field.
+
+2012-05-16  Alan Modra  <amodra@gmail.com>
+
+	PR ld/13962
+	PR ld/7023
+	* elf.c (bfd_section_from_shdr): Fail when .dynsym sh_info is
+	out of range.  As a special case, fix sh_info for zero sh_size.
+	Do the same for .symtab.
+
+2012-05-15  James Murray <jsm@jsm-net.demon.co.uk>
+	    Stephane Carrez <stcarrez@nerim.fr>
+
+	* archures.c: Add bfd_arch_m9s12x and bfd_arch_m9s12xg.
+	* config.bfd: Likewise.
+	* cpu-m9s12x.c: New.
+	* cpu-m9s12xg.c: New.
+	* elf32-m68hc12.c: Add S12X and XGATE co-processor support.
+	Add option to offset S12 addresses into XGATE memory space.
+	Fix carry bug in IMM16 (IMM8 low/high) relocate.
+	* Makefile.am (ALL_MACHINES): Add cpu-m9s12x and cpu-m9s12xg.
+	(ALL_MACHINES_CFILES): Likewise.
+	* reloc.c: Add S12X relocs.
+	* Makefile.in: Regenerate.
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+
+2012-05-14  James Lemke  <jwlemke@codesourcery.com>
+	    Catherine Moore  <clm@codesourcery.com>
+
+	* bfd.c (bfd_lookup_section_flags): Add section parm.
+	* ecoff.c (bfd_debug_section): Remove flag_info initializer.
+	* elf-bfd.h (bfd_elf_section_data): Move in section_flag_info.
+	(bfd_elf_lookup_section_flags): Add section parm.
+	* elf32-ppc.c (is_ppc_vle): New function.
+	(ppc_elf_modify_segment_map): New function.
+	(elf_backend_modify_segment_map): Define.
+	(has_vle_insns): New define.
+	* elf32-ppc.h (ppc_elf_modify_segment_map): Declare.
+	* elflink.c (bfd_elf_lookup_section_flags): Add return value & parm.
+	Move in logic to omit / include a section.
+	* libbfd-in.h (bfd_link_info): Add section parm.
+	(bfd_generic_lookup_section_flags): Likewise.
+	* reloc.c (bfd_generic_lookup_section_flags): Likewise.
+	* section.c (bfd_section): Move out section_flag_info.
+	(BFD_FAKE_SECTION): Remove flag_info initializer.
+	* targets.c (_bfd_lookup_section_flags): Add section parm.
+
+2012-05-14  Catherine Moore  <clm@codesourcery.com>
+
+	* archures.c (bfd_mach_ppc_vle): New.
+	* bfd-in2.h: Regenerated.
+	* cpu-powerpc.c (bfd_powerpc_archs): New entry for vle.
+	* elf32-ppc.c (split16_format_type): New enumeration.
+	(ppc_elf_vle_split16): New function.
+	(HOWTO): Add entries for R_PPC_VLE relocations.
+	(ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations.
+	(ppc_elf_section_flags): New function.
+	(ppc_elf_lookup_section_flags): New function.
+	(ppc_elf_section_processing): New function.
+	(ppc_elf_check_relocs): Handle PPC_VLE relocations.
+	(ppc_elf_relocation_section): Likewise.
+	(elf_backend_lookup_section_flags_hook): Define.
+	(elf_backend_section_flags): Define.
+	(elf_backend_section_processing): Define.
+	* elf32-ppc.h (ppc_elf_section_processing): Declare.
+	* libbfd.h: Regenerated.
+	* reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15,
+	BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A,
+	BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A,
+	BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A,
+	BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21,
+	BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A,
+	BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A,
+	BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A,
+	BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations.
+
+2012-05-11  Georg-Johann Lay  <avr@gjlay.de>
+
+	PR target/13503
+	* reloc.c: Add new ENUM for BFD_RELOC_AVR_8_LO,
+	BFD_RELOC_AVR_8_HI, BFD_RELOC_AVR_8_HHI.
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+	* elf32-avr.c (elf_avr_howto_table): Add entries for
+	R_AVR_8_LO8, R_AVR_8_HI8, R_AVR_8_HHI8.
+	(avr_reloc_map): Add RELOC mappings for R_AVR_8_LO8, R_AVR_8_HI8,
+	R_AVR_8_HHI8.
+
+2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Use int in x32
+	addend overflow check.
+
+2012-05-10  DJ Delorie  <dj@redhat.com>
+
+	* elf32-rx.c (rx_elf_object_p): Ignore empty segments.
+
+2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Display signed
+	hex number in x32 addend overflow check.
+
+2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf64-x86-64.c (elf_x86_64_reloc_type_class): Handle
+	R_X86_64_RELATIVE64.
+
+2012-05-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Check addend
+	overflow for R_X86_64_RELATIVE64.
+
+2012-05-08  Ben Cheng  <bccheng@google.com>
+
+	* elf.c: Preserve the original p_align and p_flags if they are
+	valid.
+
+2012-05-07  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ia64-vms.c (elf64_ia64_relocate_section): Update
+	RELOC_AGAINST_DISCARDED_SECTION invocation.
+
+2012-05-07  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Declare and use
+	local variable i_ instead of assuming and using a variable i.
+
+2012-05-07  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Handle compound
+	relocations.
+	* elfxx-mips.c (mips_reloc_against_discarded_section): New
+	function.
+	(_bfd_mips_elf_relocate_section): Call it, in place of
+	RELOC_AGAINST_DISCARDED_SECTION.
+	* elf-m10200.c (mn10200_elf_relocate_section): Update arguments
+	to RELOC_AGAINST_DISCARDED_SECTION.
+	* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+	* elf32-arm.c (elf32_arm_relocate_section): Likewise.
+	* elf32-avr.c (elf32_avr_relocate_section): Likewise.
+	* elf32-bfin.c (bfin_relocate_section): Likewise.
+	(bfinfdpic_relocate_section): Likewise.
+	* elf32-cr16.c (elf32_cr16_relocate_section): Likewise.
+	* elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise.
+	* elf32-cris.c (cris_elf_relocate_section): Likewise.
+	* elf32-crx.c (elf32_crx_relocate_section): Likewise.
+	* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
+	* elf32-epiphany.c (epiphany_elf_relocate_section): Likewise.
+	* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+	* elf32-frv.c (elf32_frv_relocate_section): Likewise.
+	* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
+	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+	* elf32-i370.c (i370_elf_relocate_section): Likewise.
+	* elf32-i386.c (elf_i386_relocate_section): Likewise.
+	* elf32-i860.c (elf32_i860_relocate_section): Likewise.
+	* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
+	* elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
+	* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
+	* elf32-m32c.c (m32c_elf_relocate_section): Likewise.
+	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
+	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+	* elf32-mep.c (mep_elf_relocate_section): Likewise.
+	* elf32-moxie.c (moxie_elf_relocate_section): Likewise.
+	* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
+	* elf32-mt.c (mt_elf_relocate_section): Likewise.
+	* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
+	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+	* elf32-rl78.c (rl78_elf_relocate_section): Likewise.
+	* elf32-rx.c (rx_elf_relocate_section): Likewise.
+	* elf32-s390.c (elf_s390_relocate_section): Likewise.
+	* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
+	* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
+	* elf32-sh.c (sh_elf_relocate_section): Likewise.
+	* elf32-spu.c (spu_elf_relocate_section): Likewise.
+	* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
+	* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
+	* elf32-v850.c (v850_elf_relocate_section): Likewise.
+	* elf32-vax.c (elf_vax_relocate_section): Likewise.
+	* elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise.
+	* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
+	* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
+	* elf64-alpha.c (elf64_alpha_relocate_section_r): Likewise.
+	(elf64_alpha_relocate_section): Likewise.
+	* elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
+	* elf64-mmix.c (mmix_elf_relocate_section): Likewise.
+	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+	* elf64-s390.c (elf_s390_relocate_section): Likewise.
+	* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
+	* elfnn-ia64.c (elfNN_ia64_relocate_section): Likewise.
+	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
+	* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
+
+2012-05-05  Alan Modra  <amodra@gmail.com>
+
+	PR ld/14052
+	PR ld/13621
+	* linker.c (_bfd_nearby_section): Revert 2012-02-13 change.
+
+2012-05-05  Alan Modra  <amodra@gmail.com>
+
+	* aout-arm.c: Replace all uses of bfd_abs_section, bfd_com_section,
+	bfd_und_section and bfd_ind_section with their _ptr variants, or
+	use corresponding bfd_is_* macros.
+	* aout-ns32k.c: Likewise.
+	* aout-tic30.c: Likewise.
+	* coff-arm.c: Likewise.
+	* coff-tic54x.c: Likewise.
+	* cpu-ns32k.c: Likewise.
+	* elf-attrs.c: Likewise.
+	* elfcode.h: Likewise.
+	* peicode.h: Likewise.
+	* reloc.c: Likewise.
+	* riscix.c: Likewise.
+	* versados.c: Likewise.
+	* section.c: Likewise.
+	(bfd_abs_section, bfd_ind_section, bfd_com_section,
+	bfd_ind_section): Delete.
+	(std_section): New array replacing above.
+	(bfd_abs_section_ptr, bfd_ind_section_ptr, bfd_com_section_ptr,
+	bfd_ind_section_ptr, STD_SECTION): Update.
+	(BFD_FAKE_SECTION, GLOBAL_SYM_INIT): Remove unnecessary casts.
+	* bfd-in2.h: Regenerate.
+
+2012-05-03  Sean Keys  <skeys@ipdatasys.com>
+
+	* cpu-xgate.c: New file. Added XGATE support.
+	* archures.c (bfd_architecture): Add XGATE architecture.
+	(bfd_archures_list): Add reference to XGATE architecture info.
+	* elf-bfd.h (prep_headers): Handle bfd_arch_xgate.
+	* reloc.c: Add various XGATE relocation enums.
+	* targets.c (bfd_elf32_xgate_vec): Declare and add to target vector
+	list.
+	* Makefile.am: Add support for XGATE elf.
+	* configure.in: Ditto.
+	* config.bfd: Ditto.
+	* Makefile.in: Regenerate.
+	* configure: Ditto.
+	* bfd-in2.h: Ditto.
+	* libbfd.h: Ditto.
+	Added files for XGATE relocations.
+	* elf32-xgate.c: Created minimal relocation file.
+	* elf32-xgate.h: Created minimal header file for elf32-xgate.
+
+2012-05-03  Tristan Gingold  <gingold@adacore.com>
+
+	* dwarf2.c (decode_line_info): Ignore
+	DW_LNE_HP_source_file_correlation.
+
+2012-05-01  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/13121
+	* aoutx.h: Rename 'finfo' to 'flaginfo' to avoid conflicts with
+	AIX system headers.
+	* coff-ppc.c: Likewise.
+	* cofflink.c: Likewise.
+	* elf32-arm.c: Likewise.
+	* elf64-sparc.c: Likewise.
+	* elflink.c: Likewise.
+	* pdp11.c: Likewise.
+	* rescoff.c: Likewise.
+
+2012-04-26  Mark Wielaard  <mjw@redhat.com>
+
+	* dwarf2.c (scan_unit_for_symbols): Account for DW_AT_high_pc
+	possibly being relative to DW_AT_low_pc.
+	(parse_comp_unit): Likewise.
+
+2012-04-26  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* elf32-m68k.c (elf_m68k_check_relocs): Mark non-GOT references
+	also when generating PIE.
+	(elf_m68k_discard_copies): Mark undefined weak symbols referenced
+	by relocations as dynamic.
+
+2012-04-26  Hans-Peter Nilsson  <hp@axis.com>
+
+	Provide a way for programs to recognize BFD_ASSERT calls.
+	* bfd.c (bfd_assert_handler_type): New API type.
+	(bfd_set_assert_handler, bfd_get_assert_handler): New API functions.
+	(_bfd_assert_handler): New variable.
+	(_bfd_default_assert_handler): New function.
+	(bfd_assert): Call _bfd_assert_handler, not _bfd_error_handler.
+	* libbfd-in.h (_bfd_assert_handler): Declare.
+	* libbfd.h, bfd-in2.h: Regenerate.
+
+2012-04-24  Hans-Peter Nilsson  <hp@axis.com>
+
+	PR ld/13990
+	* elf32-arm.c (elf32_arm_gc_sweep_hook): Handle a forced-local
+	symbol, where PLT refcount is set to -1.
+
+2012-04-24  Alan Modra  <amodra@gmail.com>
+
+	PR ld/13991
+	* elf-bfd.h (_bfd_elf_link_just_syms): Define as
+	_bfd_generic_link_just_syms.
+	* elflink.c (_bfd_elf_link_just_syms): Delete.
+	* linker.c (_bfd_generic_link_just_syms): Set sec_info_type.
+
+	* bfd-in.h (discarded_section): Renamed from elf_discarded_section.
+	* section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS,
+	SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME,
+	SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE.
+	* elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
+	* elf.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c,
+	* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c,
+	* elf32-crx.c, * elf32-d10v.c, * elf32-epiphany.c,
+	* elf32-fr30.c, * elf32-frv.c, * elf32-h8300.c,
+	* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c,
+	* elf32-i860.c, * elf32-ip2k.c, * elf32-iq2000.c,
+	* elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c,
+	* elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
+	* elf32-mep.c, * elf32-moxie.c, * elf32-msp430.c,
+	* elf32-mt.c, * elf32-openrisc.c, * elf32-ppc.c,
+	* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c,
+	* elf32-score.c, * elf32-score7.c, * elf32-sh.c,
+	* elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c,
+	* elf32-v850.c, * elf32-vax.c, * elf32-xc16x.c,
+	* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
+	* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
+	* elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c,
+	* elf64-x86-64.c, * elflink.c, * elfnn-ia64.c,
+	* elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c,
+	* reloc.c: Update all references.
+	* bfd-in2.h: Regenerate.
+
+2012-04-20  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf32-s390.c (ELF_DYNAMIC_INTERPRETER): Set to the GCC default.
+	* elf64-s390.c (ELF_DYNAMIC_INTERPRETER): Set to the GCC default.
+
+2012-04-19  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* elf32-sh.c (elf_sh_link_hash_entry): Specify an enum identifier for
+	got_type.
+	(allocate_dynrelocs, sh_elf_relocate_section, sh_elf_check_relocs): Use
+	it.
+
+2012-04-17  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* elf32-sh.c (allocate_dynrelocs): Don't allocate dynamic
+	relocations when LE conversion happens on the IE tls symbol.
+
+2012-04-17  Roland McGrath  <mcgrathr@google.com>
+
+	* elf64-x86-64.c (elf_x86_64_nacl_plt0_entry): Fix nop padding
+	so that 32-byte boundary is a proper instruction boundary.
+
+2012-04-17  Tristan Gingold  <gingold@adacore.com>
+
+	* vms-lib.c (_bfd_vms_lib_get_module): Append .obj extension to
+	member of an object archive.<
+
+2012-04-17  Tristan Gingold  <gingold@adacore.com>
+
+	* vms-lib.c (MAX_EKEYLEN): Define.
+	(MAX_KEYLEN): Fix value.
+	(vms_write_index): Add comments and fix indentation.
+	Adjust comparaison.  Add assertions.  Free kbn_blk.
+	(_bfd_vms_lib_write_archive_contents): Use MAX_EKEYLEN.
+	Compense MAX_KEYLEN adjustment.
+
+2012-04-16  Maciej W. Rozycki  <macro@linux-mips.org>
+
+	* elfxx-mips.c (mips16_stub_symndx): Handle n64 compound relocs.
+	(_bfd_mips_elf_check_relocs): Update accordingly.
+
+2012-04-13  Alan Modra  <amodra@gmail.com>
+
+	PR ld/13947
+	* elflink.c (bfd_elf_final_link): Set reloc_count to 0 for
+	reloc sections.
+
+2012-04-12  David S. Miller  <davem@davemloft.net>
+
+	* reloc.c (BFD_RELOC_SPARC_H34, BFD_RELOC_SPARC_SIZE32,
+	BFD_RELOC_SPARC_SIZE64, BFD_RELOC_SPARC_WDISP10): New relocs.
+	* libbfd.h: Regenerate.
+	* bfd-in2.h: Likewise.
+	* elfxx-sparc.c (sparc_elf_wdisp10_reloc): New function.
+	(_bfd_sparc_elf_howto_table): Add entries for R_SPARC_H34,
+	R_SPARC_SIZE32, R_SPARC_64, and R_SPARC_WDISP10.
+	(_bfd_sparc_elf_reloc_type_lookup): Handle new relocs.
+	(_bfd_sparc_elf_check_relocs): Likewise.
+	(_bfd_sparc_elf_gc_sweep_hook): Likewise.
+	(_bfd_sparc_elf_relocate_section): Likewise.
+
+2012-04-12  Roland McGrath  <mcgrathr@google.com>
+
+	* elf32-arm.c (elf32_arm_nacl_plt0_entry, elf32_arm_nacl_plt_entry):
+	New variables.
+	(struct elf32_arm_link_hash_table): New member `nacl_p'.
+	(elf32_arm_link_hash_table_create): Initialize it.
+	(elf32_arm_nacl_link_hash_table_create): New function.
+	(arm_movw_immediate, arm_movt_immediate): New functions.
+	(elf32_arm_populate_plt_entry): Test HTAB->nacl_p.
+	(elf32_arm_finish_dynamic_sections): Likewise.
+	(elf32_arm_output_plt_map_1): Likewise.
+	(bfd_elf32_littlearm_nacl_vec, bfd_elf32_bigarm_nacl_vec):
+	New backend vector stanza.
+	(elf32_arm_nacl_modify_segment_map): New function.
+	* config.bfd: Handle arm-*-nacl*, armeb-*-nacl*.
+	* targets.c: Support bfd_elf32_{big,little}_nacl_vec.
+	* configure.in: Likewise.
+	(bfd_elf32_bigarm_nacl_vec): Add elf-nacl.lo here.
+	(bfd_elf32_littlearm_nacl_vec): Likewise.
+	(bfd_elf32_bigarm_vec, bfd_elf32_littlearm_vec): Likewise.
+	(bfd_elf32_bigarm_symbian_vec): Likewise.
+	(bfd_elf32_littlearm_symbian_vec): Likewise.
+	(bfd_elf32_bigarm_vxworks_vec): Likewise.
+	(bfd_elf32_littlearm_vxworks_vec): Likewise.
+	* configure: Regenerated.
+
+2012-04-12  Tristan Gingold  <gingold@adacore.com>
+
+	* elflink.c (elf_link_output_extsym): Add a guard.
+	(bfd_elf_final_link): Remove assertion.
+	(bfd_elf_final_link): Add a guard.
+	* elfnn-ia64.c (INCLUDE_IA64_VMS): Removed.
+	(elfNN_vms_section_from_shdr, elfNN_vms_object_p)
+	(elfNN_vms_post_process_headers, elfNN_vms_section_processing)
+	(elfNN_vms_final_write_processing, elfNN_vms_close_and_cleanup):
+	Remove.
+	(elfNN-ia64-vms target): Move to ...
+	* elf64-ia64-vms.c: New file.
+	* configure.in (bfd_elf64_ia64_vms_vec): Add elf64-ia64-vms.lo
+	* Makefile.am (BFD64_BACKENDS): Add elf64-ia64-vms.lo.
+	(BFD64_BACKENDS_CFILES): Ad elf64-ia64-vms.c.
+	* configure: Regenerate.
+	* Makefile.in: Regenerate.
+
+2012-04-11  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/13897
+	* elf64-ppc.c (opd_entry_value): When dealing with sections
+	without relocs, keep the last section loaded in order to avoid
+	unnecessary reloads.
+
+2012-04-09  Roland McGrath  <mcgrathr@google.com>
+
+	* elf.c (_bfd_elf_map_sections_to_segments): Set INFO->user_phdrs.
+	* elf-nacl.c (nacl_modify_segment_map): Do nothing if INFO->user_phdrs.
+	(nacl_modify_program_headers): Likewise.
+
+2012-04-03  Roland McGrath  <mcgrathr@google.com>
+
+	* elf-nacl.c: New file.
+	* elf-nacl.h: New file.
+	* elf32-i386.c (elf_backend_modify_segment_map): Define for
+	bfd_elf32_i386_nacl_vec.
+	(elf_backend_modify_program_headers): Likewise.
+	* elf64-x86-64.c (elf_backend_modify_segment_map): Define for
+	bfd_elf64_x86_64_nacl_vec and bfd_elf32_x86_64_nacl_vec.
+	(elf_backend_modify_program_headers): Likewise.
+	* Makefile.am (BFD32_BACKENDS, BFD64_BACKENDS): Add elf-nacl.lo here.
+	(BFD32_BACKENDS_CFILES, BFD64_BACKENDS_CFILES): Add elf-nacl.c here.
+	* Makefile.in: Regenerated.
+	* configure.in (bfd_elf64_x86_64_nacl_vec): Add elf-nacl.o to tb here.
+	(bfd_elf32_x86_64_nacl_vec): Likewise.
+	(bfd_elf64_x86_64_vec, bfd_elf32_x86_64_vec): Likewise.
+	(bfd_elf64_x86_64_freebsd_vec, bfd_elf64_x86_64_sol2_vec): Likewise.
+	(bfd_elf64_l1om_vec, bfd_elf64_l1om_freebsd_vec): Likewise.
+	(bfd_elf64_k1om_vec, bfd_elf64_k1om_freebsd_vec): Likewise.
+	(bfd_elf32_i386_nacl_vec): Likewise.
+	(bfd_elf32_i386_sol2_vec, bfd_elf32_i386_freebsd_vec): Likewise.
+	(bfd_elf32_i386_vxworks_vec, bfd_elf32_i386_vec): Likewise.
+	* configure: Regenerated.
+
+2012-03-31  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* elf32-m68k.c (elf_m68k_relocate_section): Allow
+	R_68K_TLS_LE{8,16,32} for PIE.
+
+2012-03-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf64-s390.c: Fix several comments regarding PLT entry
+	description.
+	* elf32-s390.c: Likewise.
+
+2012-03-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf64-s390.c: Use the section pointer shortcuts in
+	elf_link_hash_table and remove them from the target specific
+	variant.
+	* elf32-s390.c: Likewise.
+
+2012-03-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf64-s390.c (elf_s390x_plt_entry, elf_s390x_first_plt_entry):
+	New definitions.
+	(PLT_PIC_ENTRY_WORD*, PLT_PIC12_ENTRY_WORD*): Remove.
+	(elf_s390_finish_dynamic_symbol): Use memcpy instead of bfd_put_32.
+	(elf_s390_finish_dynamic_sections): Likewise.
+	* elf32-s390.c (elf_s390_plt_entry, elf_s390_plt_pic_entry)
+	(elf_s390_plt_pic12_entry, elf_s390_plt_pic16_entry)
+	(elf_s390_plt_first_entry, elf_s390_plt_pic_first_entry): New definitions.
+	(PLT_PIC16_ENTRY_WORD*, PLT_ENTRY_WORD*)
+	(PLT_PIC_FIRST_ENTRY_WORD*, PLT_FIRST_ENTRY_WORD*): Remove.
+
+2012-03-30  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf32-s390.c (struct elf_s390_dyn_relocs): Remove.
+	Rename all occurrences in the file to elf_dyn_relocs.
+	* elf64-s390.c: Likewise.
+
+2012-03-30  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_gc_mark_reloc): Don't delve into dynamic
+	libraries.
+
+2012-03-29  Alan Modra  <amodra@gmail.com>
+
+	* bfd-in.h (bfd_get_arch_size, bfd_get_sign_extend_vma): Delete.
+	* bfd-in2.h: Regenerate.
+
+2012-03-23  Alan Modra  <amodra@gmail.com>
+
+	* elf.c (assign_file_positions_for_non_load_sections): Don't warn
+	on empty alloc sections.
+
+2012-03-23  Alan Modra  <amodra@gmail.com>
+
+	* linker.c (_bfd_nearby_section): New function, split out from..
+	(fix_syms): ..here.
+	* bfd-in.h (_bfd_nearby_section): Declare.
+	* bfd-in2.h: Regenerate.
+	* elflink.c (elf_link_input_bfd): Don't use text_index_section or
+	data_index_section with ld -q or ld -r output relocs against
+	stripped output sections.  Instead use _bfd_nearby_section.
+
+2012-03-23  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/13894
+	* elf64-ppc.c (opd_entry_value): Read full symbol table when
+	sym hashes unavailable.
+
+2012-03-21  Eliot Dresselhaus  <eliot@sonic.net>
+
+	* elf32-tic6x.c (elf32_tic6x_merge_private_bfd_data): Return TRUE
+	for non-C6X objects.
+
+2012-03-20  Kai Tietz  <ktietz@redhat.com>
+
+	PR ld/12742
+	* configure.in (AC_CHECK_HEADERS): Test for windows.h and dlfcn.h.
+	* plugin.c: Guard include of dlfcn.h if HAVE_DLFCN_H is defined.
+	Add windows.h header include if HAVE_WINDOWS_H is defined.
+	(dlerror): New static function if windows variant is used instead
+	of dlfcn.h.
+	(dlclose): Likewise.
+	(dlopen): Likewise.
+	(dlsym): Likewise.
+	* configure: Regenerated.
+	* config.in: Regenerated.
+
+2012-03-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/13880
+	* elf32-i386.c (elf_i386_relocate_section): Don't issue an error
+	for R_386_GOTOFF relocation against protected function if
+	SYMBOLIC_BIND is true.
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Don't issue an
+	error for R_X86_64_GOTOFF64 relocation against protected function
+	when building executable or SYMBOLIC_BIND is true.
+
+2012-03-16  Roland McGrath  <mcgrathr@google.com>
+
+	* config.bfd: Handle x86_64-*-nacl*.
+	* elf64-x86-64.c (bfd_elf64_x86_64_nacl_vec): New backend vector stanza.
+	(bfd_elf32_x86_64_nacl_vec): Likewise.
+	* targets.c: Support them.
+	* configure.in: Likewise.
+	* configure: Regenerated.
+
+2012-03-16  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+	* elf32-arm.c (elf32_arm_attributes_accept_div): New function.
+	(elf32_arm_attributes_forbid_div): Likewise.
+	(elf32_arm_merge_eabi_attributes): Correct handling of
+	Tag_DIV_use.
+
+2012-03-15  Roland McGrath  <mcgrathr@google.com>
+
+	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Use
+	elf_x86_64_backend_data parameters for plt_eh_frame.
+
+	* elf64-x86-64.c (struct elf_x86_64_backend_data): New type.
+	(get_elf_x86_64_backend_data, GET_PLT_ENTRY_SIZE): New macros.
+	(elf_x86_64_arch_bed): New variable.
+	(elf_backend_arch_data): New macro.
+	(elf_x86_64_adjust_dynamic_symbol): Use GET_PLT_ENTRY_SIZE.
+	(elf_x86_64_allocate_dynrelocs): Likewise.
+	(elf_x86_64_relocate_section): Likewise.
+	(elf_x86_64_plt_sym_val): Likewise.
+	(elf_x86_64_finish_dynamic_symbol): Use elf_x86_64_backend_data
+	parameters for PLT details.
+	(elf_x86_64_finish_dynamic_sections): Likewise.
+
+2012-03-14  Roland McGrath  <mcgrathr@google.com>
+
+	* elf32-i386.c (elf_i386_nacl_pic_plt0_entry): Initialize up
+	to the full size, padding out with nop instructions.
+
+2012-03-12  Alan Modra  <amodra@gmail.com>
+
+	* elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Don't warn
+	on zero size dynbss symbol.
+	* elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise.
+	* elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise.
+	* elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise.
+	* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
+	* elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise.
+	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise.
+	* elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise.
+	* elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise.
+	* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
+	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
+	* elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
+	* elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise.
+	* elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise.
+	* elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol): Likewise.
+	* elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise.
+	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
+	* elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
+	* elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise.
+	* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
+	* elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise.
+	* elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol): Likewise.
+
+2012-03-10  Edmar Wienskoski  <edmar@freescale.com>
+
+	* archures.c: Add bfd_mach_ppc_e5500 and bfd_mach_ppc_e6500.
+	* bfd-in2.h: Regenerate.
+	* cpu-powerpc.c (bfd_powerpc_archs): Add entries for
+	bfd_mach_ppc_e5500 and bfd_mach_ppc_e6500.
+
+2012-03-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/13817
+	* elf32-i386.c (elf_i386_relocate_section): Restore
+	R_386_IRELATIVE.
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Restore
+	R_X86_64_IRELATIVE.
+
+2012-03-08  Tristan Gingold  <gingold@adacore.com>
+
+	* vms-lib.c (_bfd_vms_lib_write_archive_contents): Set maximum
+	keylen according to archive kind.  Set nextvbn and nextrfa lhd
+	fields.  Add comments.
+
+2012-03-07  Nick Clifton  <nickc@redhat.com>
+
+	* elf-m10300.c (elf32_mn10300_link_hash_entry): Add tls_type
+	field.
+	(elf32_mn10300_link_hash_table): Add tls_ldm_got entry;
+	(elf_mn10300_tdata): Define.
+	(elf_mn10300_local_got_tls_type): Define.
+	(elf_mn10300_howto_table): Add entries for R_MN10300_TLS_GD,
+	R_MN10300_TLS_LD, R_MN10300_TLS_LDO, R_MN10300_TLS_GOTIE,
+	R_MN10300_TLS_IE, R_MN10300_TLS_LE, R_MN10300_TLS_DPTMOD,
+	R_MN10300_TLS_DTPOFF, R_MN10300_TLS_TPOFF relocs.
+	(mn10300_reloc_map): Likewise.
+	(elf_mn10300_tls_transition): New function.
+	(dtpoff, tpoff, mn10300_do_tls_transition): New functions.
+	(mn10300_elf_check_relocs): Add TLS support.
+	(mn10300_elf_final_link_relocate): Likewise.
+	(mn10300_elf_relocate_section): Likewise.
+	(mn10300_elf_relax_section): Likewise.
+	(elf32_mn10300_link_hash_newfunc): Initialise new field.
+	(_bfd_mn10300_copy_indirect_symbol): New function.
+	(elf32_mn10300_link_hash_table_create): Initialise new fields.
+	(_bfd_mn10300_elf_size_dynamic_sections): Add TLS support.
+	(_bfd_mn10300_elf_finish_dynamic_symbol): Likewise.
+	(_bfd_mn10300_elf_reloc_type_class): Allocate an
+	elf_mn10300_obj_tdata structure.
+	(elf_backend_copy_indirect_symbol): Define.
+	* reloc.c (BFD_MN10300_TLS_GD, BFD_MN10300_TLS_LD,
+	BFD_MN10300_TLS_LDO, BFD_MN10300_TLS_GOTIE, BFD_MN10300_TLS_IE,
+	BFD_MN10300_TLS_LE, BFD_MN10300_TLS_DPTMOD,
+	BFD_MN10300_TLS_DTPOFF, BFD_MN10300_TLS_TPOFF): New relocations.
+	(BFD_RELOC_MN10300_32_PCREL, BFD_RELOC_MN10300_16_PCREL): Move to
+	alongside other MN10300 relocations.
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+
+2012-03-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf64-x86-64.c (elf_x86_64_relocate_section): For R_X86_64_RELATIVE
+	set relocate to TRUE.
+
+2012-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	PR ld/12152
+	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Also ignore
+	overflows for R_SPARC_UA32 in .stab sections.
+
+2012-03-01  Alan Modra  <amodra@gmail.com>
+
+	* elfxx-tilegx.c (tilegx_elf_relocate_section): Silence bogus warning.
+
+2012-02-27  Alan Modra  <amodra@gmail.com>
+
+	* elf32-sh.c (sh_elf_osec_to_segment): Check for elf flavour bfd
+	before calling elf specific function.
+	(sh_elf_osec_readonly_p): Test for error return from above.
+
+2012-02-27  Alan Modra  <amodra@gmail.com>
+
+	* elf32-spu.c (build_stub): Fix malloc under-allocation.
+
+2012-02-25  Walter Lee  <walt@tilera.com>
+	* reloc.c: Add BFD_RELOC_TILEPRO_TLS_GD_CALL,
+	BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD,
+	BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD,
+	BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD,
+	BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD,
+	BFD_RELOC_TILEPRO_TLS_IE_LOAD, BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE,
+	BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE,
+	BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_LO,
+	BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_LO,
+	BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HI,
+	BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HI,
+	BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA,
+	BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA,
+	BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE,
+	BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_LE,
+	BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_LE,
+	BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_LE,
+	BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_LE,
+	BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_LE,
+	BFD_RELOC_TILEGX_TLS_GD_CALL, BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD,
+	BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD,
+	BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD,
+	BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD, BFD_RELOC_TILEGX_TLS_IE_LOAD,
+	BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD,
+	BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD,
+	BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD, BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD.
+	Delete BFD_RELOC_TILEGX_IMM16_X0_HW1_GOT,
+	BFD_RELOC_TILEGX_IMM16_X1_HW1_GOT,
+	BFD_RELOC_TILEGX_IMM16_X0_HW2_GOT,
+	BFD_RELOC_TILEGX_IMM16_X1_HW2_GOT,
+	BFD_RELOC_TILEGX_IMM16_X0_HW3_GOT,
+	BFD_RELOC_TILEGX_IMM16_X1_HW3_GOT,
+	BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_GOT,
+	BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_GOT,
+	BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_GD,
+	BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_GD,
+	BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_GD,
+	BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_GD,
+	BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_GD,
+	BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_GD,
+	BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_GD,
+	BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_GD,
+	BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_IE,
+	BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_IE,
+	BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_IE,
+	BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_IE,
+	BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_IE,
+	BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_IE,
+	BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_IE,
+	BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_IE.
+	* elf32-tilepro.c (tilepro_elf_howto_table): Update tilepro
+	relocations.
+	(tilepro_reloc_map): Ditto.
+	(tilepro_info_to_howto_rela): Ditto.
+	(reloc_to_create_func): Ditto.
+	(tilepro_tls_translate_to_le): New.
+	(tilepro_tls_translate_to_ie): New.
+	(tilepro_elf_tls_transition): New.
+	(tilepro_elf_check_relocs): Handle new tls relocations.
+	(tilepro_elf_gc_sweep_hook): Ditto.
+	(allocate_dynrelocs): Ditto.
+	(tilepro_elf_relocate_section): Ditto.
+	(tilepro_replace_insn): New.
+	(insn_mask_X1): New.
+	(insn_mask_X0_no_dest_no_srca): New
+	(insn_mask_X1_no_dest_no_srca): New
+	(insn_mask_Y0_no_dest_no_srca): New
+	(insn_mask_Y1_no_dest_no_srca): New
+	(srca_mask_X0): New
+	(srca_mask_X1): New
+	(insn_tls_le_move_X1): New
+	(insn_tls_le_move_zero_X0X1): New
+	(insn_tls_ie_lw_X1): New
+	(insn_tls_ie_add_X0X1): New
+	(insn_tls_ie_add_Y0Y1): New
+	(insn_tls_gd_add_X0X1): New
+	(insn_tls_gd_add_Y0Y1): New
+	* elfxx-tilegx.c (tilegx_elf_howto_table): Update tilegx
+	relocations.
+	(tilegx_reloc_map): Ditto.
+	(tilegx_info_to_howto_rela): Ditto.
+	(reloc_to_create_func): Ditto.
+	(tilegx_elf_link_hash_table): New field disable_le_transition.
+	(tilegx_tls_translate_to_le): New.
+	(tilegx_tls_translate_to_ie): New.
+	(tilegx_elf_tls_transition): New.
+	(tilegx_elf_check_relocs): Handle new tls relocations.
+	(tilegx_elf_gc_sweep_hook): Ditto.
+	(allocate_dynrelocs): Ditto.
+	(tilegx_elf_relocate_section): Ditto.
+	(tilegx_copy_bits): New.
+	(tilegx_replace_insn): New.
+	(insn_mask_X1): New.
+	(insn_mask_X0_no_dest_no_srca): New.
+	(insn_mask_X1_no_dest_no_srca): New.
+	(insn_mask_Y0_no_dest_no_srca): New.
+	(insn_mask_Y1_no_dest_no_srca): New.
+	(insn_mask_X0_no_operand): New.
+	(insn_mask_X1_no_operand): New.
+	(insn_mask_Y0_no_operand): New.
+	(insn_mask_Y1_no_operand): New.
+	(insn_tls_ie_ld_X1): New.
+	(insn_tls_ie_ld4s_X1): New.
+	(insn_tls_ie_add_X0X1): New.
+	(insn_tls_ie_add_Y0Y1): New.
+	(insn_tls_ie_addx_X0X1): New.
+	(insn_tls_ie_addx_Y0Y1): New.
+	(insn_tls_gd_add_X0X1): New.
+	(insn_tls_gd_add_Y0Y1): New.
+	(insn_move_X0X1): New.
+	(insn_move_Y0Y1): New.
+	(insn_add_X0X1): New.
+	(insn_add_Y0Y1): New.
+	(insn_addx_X0X1): New.
+	(insn_addx_Y0Y1): New.
+	* libbfd.h: Regenerate.
+	* bfd-in2.h: Regenerate.
+
+2012-02-25  Walter Lee  <walt@tilera.com>
+
+	* config.bfd (tilegx-*-*): rename little endian vector; add big
+	endian vector.
+	(tilegxbe-*-*): New case.
+	* configure.in (bfd_elf32_tilegx_vec): Rename...
+	(bfd_elf32_tilegx_le_vec): ... to this.
+	(bfd_elf32_tilegx_be_vec): New vector.
+	(bfd_elf64_tilegx_vec): Rename...
+	(bfd_elf64_tilegx_le_vec): ... to this.
+	(bfd_elf64_tilegx_be_vec): New vector.
+	* configure: Regenerate.
+	* elf32-tilegx.c (TARGET_LITTLE_SYM): Rename.
+	(TARGET_LITTLE_NAME): Ditto.
+	(TARGET_BIG_SYM): Define.
+	(TARGET_BIG_NAME): Define.
+	* elf64-tilegx.c (TARGET_LITTLE_SYM): Rename.
+	(TARGET_LITTLE_NAME): Ditto.
+	(TARGET_BIG_SYM): Define.
+	(TARGET_BIG_NAME): Define.
+	* targets.c (bfd_elf32_tilegx_vec): Rename...
+	(bfd_elf32_tilegx_le_vec): ... to this.
+	(bfd_elf32_tilegx_be_vec): Declare.
+	(bfd_elf64_tilegx_vec): Rename...
+	(bfd_elf64_tilegx_le_vec): ... to this.
+	(bfd_elf64_tilegx_be_vec): Declare.
+	(_bfd_target_vector): Add / rename above vectors.
+	* arctures.c (bfd_architecture): Define bfd_mach_tilegx32.
+	* bfd-in2.h: Regenerate.
+	* cpu-tilegx.c (bfd_tilegx32_arch): define.
+	(bfd_tilegx_arch): link to bfd_tilegx32_arch.
+
+2012-02-24  Nick Clifton  <nickc@redhat.com>
+
+	PR ld/13730
+	* reloc.c (bfd_generic_get_relocated_section_contents): Issue an
+	error message instead of aborting, when an outofrange reloc is
+	encountered.
+
+2012-02-23  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_swap_in_non_scattered_reloc): New.
+	(bfd_mach_o_canonicalize_one_reloc):  Swap non-scattered reloc
+	bit-fields when target and host differ in endian-ness.  When
+	PAIRs are non-scattered	find the 'symbol' from the preceding
+	reloc.  Add FIXME re. reloc symbols on section boundaries.
+	(bfd_mach_o_swap_out_non_scattered_reloc): New.
+	(bfd_mach_o_write_relocs): Use bfd_mach_o_encode_non_scattered_reloc.
+
+2012-02-17  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o-i386.c (i386_howto_table): Add support for 16 bit
+	sect-diffs.
+	(bfd_mach_o_i386_swap_reloc_in): Handle 16bit sect-diffs.
+	(bfd_mach_o_i386_swap_reloc_out): Likewise.
+
+2012-02-17  Tristan Gingold  <gingold@adacore.com>
+
+	* reloc.c (BFD_RELOC_MACH_O_LOCAL_SECTDIFF):
+	* libbfd.h: Regenerated.
+	* bfd-in2.h: Likewise.
+	* mach-o-i386.c (i386_howto_table): Include local sectdiff.
+	(bfd_mach_o_i386_swap_reloc_in): Update for local sectdiff.
+	(bfd_mach_o_i386_swap_reloc_out): Likewise.
+
+2012-02-17  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* elf32-s390.c (elf_s390_relocate_section): Support basr in the
+	GD->LE and LD->LE optimizations.
+
+2012-02-16  Alan Modra  <amodra@gmail.com>
+
+	PR binutils/13355
+	* elf32-rx.c (elf32_rx_relax_section): Correct width check.
+
+2012-02-13  Richard Henderson  <rth@redhat.com>
+
+	PR ld/13621
+	* linker.c (fix_syms): Force symbols outside any section into
+	bfd_abs_section_ptr.
+
+2012-02-13  Alan Modra  <amodra@gmail.com>
+
+	* elf32-m68hc1x.c (elf32_m68hc11_merge_symbol_attribute): New function.
+	* elf32-m68hc1x.h (elf32_m68hc11_merge_symbol_attribute): Declare.
+	* elf32-m68hc11.c (elf_backend_merge_symbol_attribute): Define.
+	* elf32-m68hc12.c (elf_backend_merge_symbol_attribute): Define.
+
+2012-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
+	    Nick Clifton  <nickc@redhat.com>
+
+	* oasys.c (oasys_write_header): Fix compilation warning on zero-sized
+	memset.
+
+2012-02-10  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_build_seg_command): Count zerofill section
+	vma additions in their logical, rather than physical order.
+
+2012-02-10  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (mach_o_section_name_xlat): Correct eh-frame section
+	parameters.
+	* mach-o-x86-64.c (text_section_names_xlat): New.
+	(mach_o_x86_64_segsec_names_xlat): New.
+	(bfd_mach_o_tgt_seg_table): Define to mach_o_x86_64_segsec_names_xlat.
+	* mach-o-i386.c (text_section_names_xlat): Correct section parameters.
+
+2012-02-10  Tristan Gingold  <gingold@adacore.com>
+
+	* elfnn-ia64.c (elfNN_vms_object_p): Change comparison operator
+	to avoid infinite loop.  Add comments.
+
+2012-02-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/13675
+	* cpu-i386.c (bfd_arch_i386_fill): Updated to support multi byte
+	nop instructions.
+	(bfd_arch_i386_short_nop_fill): New.
+	(bfd_arch_i386_long_nop_fill): Likewise.
+	Use bfd_arch_i386_short_nop_fill in 32bit bfd_arch_info
+	initializers.  Use bfd_arch_i386_long_nop_fill on 64bit
+	bfd_arch_info initializers.
+
+	* cpu-k1om.c (bfd_arch_i386_fill): Renamed to ...
+	(bfd_arch_i386_short_nop_fill): This.
+	Update bfd_arch_info initializers.
+	* cpu-l1om.c: Likewise.
+
+2012-02-08  Alan Modra  <amodra@gmail.com>
+
+	* elflink.c (_bfd_elf_gc_mark_rsec): Mark weakdef syms too.
+	(_bfd_elf_fix_symbol_flags): When a weakdef is def_regular, clear
+	the correct h->u.weakdef.
+
+2012-02-07  Alan Modra  <amodra@gmail.com>
+
+	* elf.c (elf_find_function): Don't use internal_elf_sym.
+	(_bfd_elf_maybe_function_sym): Likewise.  Replace elf_symbol_type
+	parameter with asymbol.
+	* elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise.
+	* elf-bfd.h (_bfd_elf_maybe_function_sym): Update prototype.
+	(struct elf_backend_data <maybe_function_sym>): Likewise.
+
+2012-02-02  Vidya Praveen (vidya.praveen@atmel.com)
+
+	PR bfd/13410
+	* elf32-avr.c (elf32_avr_relax_section): Correct the
+	condition that qualifies the candidates for relaxation.
+
+2012-02-02  Tristan Gingold  <gingold@adacore.com>
+
+	* bfdio.c (real_fopen): Remove unused vms_modes variable.
+
+2012-02-02  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_read_header): Silent uninitialized
+	variable warning.
+
+2012-02-02  Tristan Gingold  <gingold@adacore.com>
+
+	* archive.c (bfd_slurp_armap): Fix thinko in cast.
+
+2012-01-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/13616
+	* archures.c (bfd_arch_info): Add fill.
+	(bfd_default_arch_struct): Add bfd_arch_default_fill.
+	(bfd_arch_default_fill): New.
+
+	* configure.in: Set bfd version to 2.22.52.
+	* configure: Regenerated.
+
+	* cpu-alpha.c: Add bfd_arch_default_fill to bfd_arch_info
+	initializer.
+	* cpu-arc.c: Likewise.
+	* cpu-arm.c: Likewise.
+	* cpu-avr.c: Likewise.
+	* cpu-bfin.c: Likewise.
+	* cpu-cr16.c: Likewise.
+	* cpu-cr16c.c: Likewise.
+	* cpu-cris.c: Likewise.
+	* cpu-crx.c: Likewise.
+	* cpu-d10v.c: Likewise.
+	* cpu-d30v.c: Likewise.
+	* cpu-dlx.c: Likewise.
+	* cpu-epiphany.c: Likewise.
+	* cpu-fr30.c: Likewise.
+	* cpu-frv.c: Likewise.
+	* cpu-h8300.c: Likewise.
+	* cpu-h8500.c: Likewise.
+	* cpu-hppa.c: Likewise.
+	* cpu-i370.c: Likewise.
+	* cpu-i860.c: Likewise.
+	* cpu-i960.c: Likewise.
+	* cpu-ia64.c: Likewise.
+	* cpu-ip2k.c: Likewise.
+	* cpu-iq2000.c: Likewise.
+	* cpu-lm32.c: Likewise.
+	* cpu-m10200.c: Likewise.
+	* cpu-m10300.c: Likewise.
+	* cpu-m32c.c: Likewise.
+	* cpu-m32r.c: Likewise.
+	* cpu-m68hc11.c: Likewise.
+	* cpu-m68hc12.c: Likewise.
+	* cpu-m68k.c: Likewise.
+	* cpu-m88k.c: Likewise.
+	* cpu-mcore.c: Likewise.
+	* cpu-mep.c: Likewise.
+	* cpu-microblaze.c: Likewise.
+	* cpu-mips.c: Likewise.
+	* cpu-mmix.c: Likewise.
+	* cpu-moxie.c: Likewise.
+	* cpu-msp430.c: Likewise.
+	* cpu-mt.c: Likewise.
+	* cpu-ns32k.c: Likewise.
+	* cpu-openrisc.c: Likewise.
+	* cpu-or32.c: Likewise.
+	* cpu-pdp11.c: Likewise.
+	* cpu-pj.c: Likewise.
+	* cpu-plugin.c: Likewise.
+	* cpu-powerpc.c: Likewise.
+	* cpu-rl78.c: Likewise.
+	* cpu-rs6000.c: Likewise.
+	* cpu-rx.c: Likewise.
+	* cpu-s390.c: Likewise.
+	* cpu-score.c: Likewise.
+	* cpu-sh.c: Likewise.
+	* cpu-sparc.c: Likewise.
+	* cpu-spu.c: Likewise.
+	* cpu-tic30.c: Likewise.
+	* cpu-tic4x.c: Likewise.
+	* cpu-tic54x.c: Likewise.
+	* cpu-tic6x.c: Likewise.
+	* cpu-tic80.c: Likewise.
+	* cpu-tilegx.c: Likewise.
+	* cpu-tilepro.c: Likewise.
+	* cpu-v850.c: Likewise.
+	* cpu-vax.c: Likewise.
+	* cpu-w65.c: Likewise.
+	* cpu-we32k.c: Likewise.
+	* cpu-xc16x.c: Likewise.
+	* cpu-xstormy16.c: Likewise.
+	* cpu-xtensa.c: Likewise.
+	* cpu-z80.c: Likewise.
+	* cpu-z8k.c: Likewise.
+
+	* cpu-i386.c: Include "libiberty.h".
+	(bfd_arch_i386_fill): New.
+	Add bfd_arch_i386_fill to  bfd_arch_info initializer.
+
+	* cpu-k1om.c: Add bfd_arch_i386_fill to  bfd_arch_info initializer.
+	* cpu-l1om.c: Likewise.
+
+	* linker.c (default_data_link_order): Call abfd->arch_info->fill
+	if fill size is 0.
+
+	* bfd-in2.h: Regenerated.
+
+2012-01-27  Michael Eager  <eager@eagercon.com>
+
+	* elf32-microblaze.c (create_got_section):
+	Reuse existing .rela.got section.
+
+2012-01-23  Alan Modra  <amodra@gmail.com>
+
+	* elf-bfd.h: Formatting.
+	(struct elf_backend_data): Add "maybe_function_sym".
+	(_bfd_elf_maybe_function_sym): Declare.
+	* elfxx-target.h (elf_backend_maybe_function_sym): Define.
+	(elfNN_bed): Init new field.
+	* elf.c (elf_find_function): Use maybe_function_sym.
+	(_bfd_elf_maybe_function_sym): New function.
+	* elf64-ppc.c (elf_backend_maybe_function_sym): Define.
+	(ppc64_elf_maybe_function_sym): New function.
+
+2012-01-20  Francois Gouget  <fgouget@codeweavers.com>
+
+	PR binutils/13534
+	* archive.c (_bfd_ar_sizepad): New function. Correctly install and
+	pad the size field in an archive header.
+	(_bfd_generic_read_ar_hdr_mag): Use the correct type and scan
+	function for the archive size field.
+	(bfd_generic_openr_next_archived_file): Likewise.
+	(do_slurp_coff_armap): Likewise.
+	(_bfd_write_archive_contents): Likewise.
+	(_bfd_bsd44_write_ar_hdr): Use the new function.
+	(bfd_ar_hdr_from_filesystem): Likewise.
+	(_bfd_write_archive_contents): Likewise.
+	(bsd_write_armap): Likewise.
+	(coff_write_armap): Likewise.
+	* archive64.c (bfd_elf64_archive_write_armap): Likewise.
+	* bfdio.c (bfd_bread): Use correct type for archive element
+	sizes.
+	* ar.c (open_inarch): Likewise.
+	(extract_file): Likewise.
+	* libbfd-in.h (struct areltdata): Use correct types for
+	parsed_size and extra_size fields.
+	Prototype _bfd_ar_sizepad function.
+	* libbfd.h: Regenerate.
+
+2012-01-20  Ulrich Weigand  <ulrich.weigand@linaro.org>
+
+	* elf.c (elfcore_write_prpsinfo): Provide unconditionally.
+	Return NULL if core file generation is unsupported.
+	(elfcore_write_prstatus): Likewise.
+	* elf32-arm.c (elf32_arm_nabi_write_core_note): New function.
+	(elf_backend_write_core_note): Define.
+
+2012-01-19  Tristan Gingold  <gingold@adacore.com>
+
+	* pef.c: Add a comment.
+	* xsym.c: Likewise.
+
+2012-01-17  Alan Modra  <amodra@gmail.com>
+
+	* elf32-ppc.c (ppc_elf_write_core_note <NT_PRPSINFO>): Don't leave
+	trailing garbage in the note.
+	* elf64-ppc.c (ppc64_elf_write_core_note <NT_PRPSINFO>): Likewise.
+
+2012-01-16  Daniel Green  <venix1@gmail.com>
+
+	PR ld/13491
+	* coff-i386.c (coff_i386_rtype_to_howto <R_SECREL32>): Test
+	h->root.type not h->type.
+	* coff-x86_64.c (coff_amd64_rtype_to_howto <R_AMD64_SECREL>): Likewise.
+
+2012-01-13  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_build_dysymtab_command): Handle absolute
+	indirect symbols.
+
+2012-01-13  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_write_relocs): Move computation of relocs file
+	position from here... to (bfd_mach_o_build_seg_command): Here.
+
+2012-01-12  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_count_indirect_symbols): New.
+	(bfd_mach_o_build_dysymtab_command): Populate indirect symbol table.
+	* mach-o.h (bfd_mach_o_asymbol): Move declaration to start of the
+	file. (bfd_mach_o_section): Add indirect_syms field.
+
+2012-01-11  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_build_seg_command): Separate computation of
+	vmsize from filesize.  Don't compute offsets or file sizes for
+	zerofill sections.
+
+2012-01-11  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_build_commands): Make the building of each
+	command type independent.
+
+2012-01-11  Alan Modra  <amodra@gmail.com>
+
+	* elf64-ppc.c: Define more insns used in plt call stubs.
+	(ppc64_elf_brtaken_reloc): Assume isa version 2 or above.
+	(ppc64_elf_relocate_section): Likewise.
+	(enum ppc_stub_type): Add ppc_stub_plt_call_r2save.
+	(struct ppc_link_hash_table): Increase size of stub_count array.
+	Add plt_stub_align and plt_thread_safe.
+	(ALWAYS_USE_FAKE_DEP, ALWAYS_EMIT_R2SAVE): Define.
+	(plt_stub_size, plt_stub_pad): New functions.
+	(build_plt_stub): Emit barriers for power7 thread safety.  Don't
+	emit needless save of r2.
+	(build_tls_get_addr_stub): Adjust params.
+	(ppc_build_one_stub): Handle ppc_stub_plt_call_r2save and aligning
+	plt stubs.  Adjust build_*plt_stub calls.
+	(ppc_size_one_stub): Similarly.
+	(ppc64_elf_size_stubs): Accept plt_thread_safe and plt_stub_align
+	params.  Choose default for plt_thread_safe based on existence of
+	calls to thread creation functions.  Modify plt_call to
+	plt_call_r2save when no tocsave reloc found.  Align tail of stub
+	sections.
+	(ppc64_elf_build_stubs): Align tail of stub sections.  Adjust
+	output of stub statistics.
+	(ppc64_elf_relocate_section): Handle ppc_stub_plt_call_r2save.
+	* elf64-ppc.h (ppc64_elf_size_stubs): Update prototype.
+
+2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/13581
+	* elf64-x86-64.c (elf_x86_64_relocate_section): Remove ABI_64_P
+	check on R_X86_64_PCXX.
+
+2012-01-10  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_build_commands): Avoid uninitialized false
+	warning.
+
+2012-01-10  Tristan Gingold  <gingold@adacore.com>
+
+	* bfdio.c (bfd_tell): Handle nested archives.
+	(bfd_seek): Ditto.
+	* cache.c (bfd_cache_lookup_worker): Ditto.
+	* archive.c (_bfd_get_elt_at_filepos): Remove code dealing with
+	nested archives.
+	(bfd_generic_openr_next_archived_file): Likewise.
+
+2012-01-09  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_bfd_copy_private_symbol_data): Implement.
+	(bfd_mach_o_write_symtab): Remove handling for indirect syms.
+	(bfd_mach_o_primary_symbol_sort_key): Likewise.
+	(bfd_mach_o_cf_symbols): Likewise.
+	(bfd_mach_o_sort_symbol_table): Remove.
+	(bfd_mach_o_mangle_symbols): Adjust arguments, remove handling
+	for indirect and dysymtab counts.  Do the symbol sorting here.
+	(bfd_mach_o_build_dysymtab_command): Count the symbol types here.
+	Make the indirect symbols a TODO.
+	(bfd_mach_o_build_commands): Adjust call to bfd_mach_o_mangle_symbols.
+	(bfd_mach_o_make_empty_symbol): Specifically flag unset symbols with
+	a non-zero value.
+	(bfd_mach_o_read_symtab_symbol): Record the symbol index.
+	(bfd_mach_o_read_symtab_symbol): Adjust recording of global status.
+	* mach-o.h (mach_o_data_struct): Remove indirect and dysymtab entries.
+	(IS_MACHO_INDIRECT): Remove.
+	(SYM_MACHO_FIELDS_UNSET, SYM_MACHO_FIELDS_NOT_VALIDATED): New.
+
+2012-01-06  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/13121
+	* reloc.c (bfd_generic_lookup_section_flags): Rename 'finfo' to
+	'flaginfo' to avoid conflicts with AIX system headers.
+
+2012-01-06  Tristan Gingold  <gingold@adacore.com>
+
+	* bfdio.c (bfd_bread): Use arelt_size macro.
+
+2012-01-06  Tristan Gingold  <gingold@adacore.com>
+
+	* config.bfd (i[3-7]86-*-darwin*): Define targ64_selvecs.
+
+2012-01-05  Nick Clifton  <nickc@redhat.com>
+
+	PR ld/12161
+	* elf32-avr.c (elf32_avr_relax_delete_bytes): Read in relocs if
+	necessary.
+
+2012-01-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix zero registers core files when built by gcc-4.7.
+	* elf64-x86-64.c (elf_x86_64_write_core_note): Remove variables p and
+	size.  Call elfcore_write_note for the local variables.  Remove the
+	final elfcore_write_note call.  Add NOTREACHED comments.
+
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_fat_stat_arch_elt): New function.
+	(bfd_mach_o_generic_stat_arch_elt): Adjust.
+
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_fat_member_init): New function.
+	(bfd_mach_o_openr_next_archived_file): Reindent.
+	Adjust to call bfd_mach_o_fat_member_init.
+	(bfd_mach_o_fat_extract): Adjust to call bfd_mach_o_fat_member_init.
+
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o-x86-64.c (bfd_mach_o_x86_64_swap_reloc_out): Handle
+	BFD_RELOC_32, BFD_RELOC_MACH_O_X86_64_PCREL32_1,
+	BFD_RELOC_MACH_O_X86_64_PCREL32_2,
+	BFD_RELOC_MACH_O_X86_64_PCREL32_4,
+	BFD_RELOC_MACH_O_X86_64_BRANCH32,
+	BFD_RELOC_MACH_O_X86_64_SUBTRACTOR32,
+	BFD_RELOC_MACH_O_X86_64_GOT.
+
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.h (bfd_mach_o_fvmlib_command): New structure.
+	(bfd_mach_o_load_command): Add fvmlib field.
+
+	* mach-o.c (bfd_mach_o_read_fvmlib): New function.
+	(bfd_mach_o_read_command): Handle fvmlib.
+
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_convert_architecture): Reindent.
+	Decode msubtype for ARM.
+
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.c (bfd_mach_o_get_synthetic_symtab): Add comments.
+
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+	* mach-o.h: Reindent header.
+	(bfd_mach_o_encryption_info_command): New structure.
+	(bfd_mach_o_load_command): Add encryption_info field.
+
+	* mach-o.c (bfd_mach_o_read_encryption_info): New function.
+	(bfd_mach_o_read_command): Handle BFD_MACH_O_LC_ENCRYPTION_INFO.
+	(bfd_mach_o_read_command): Adjust error message.
+
+2012-01-04  Shinichiro Hamaji  <shinichiro.hamaji@gmail.com>
+
+	* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Factor out the part
+	which reads DWARF2 and stores in stash from find_line.
+	(find_line) Call _bfd_dwarf2_slurp_debug_info.
+	* libbfd-in.h (_bfd_dwarf2_slurp_debug_info): Add declaration.
+	* libbfd.h (_bfd_dwarf2_slurp_debug_info): Regenerate.
+	* mach-o.c (dsym_subdir): The name of subdir where debug
+	information may be stored.
+	(bfd_mach_o_lookup_uuid_command): New. Lookup a load command whose
+	type is UUID.
+	(bfd_mach_o_dsym_for_uuid_p): New. Check if the specified BFD is
+	corresponding to the executable.
+	(bfd_mach_o_find_dsym): New. Find a debug information BFD in the
+	specified binary file.
+	(bfd_mach_o_follow_dsym): New. Find a debug information BFD for
+	the original BFD.
+	(bfd_mach_o_find_nearest_line): Check dSYM files for Mach-O
+	executables, dylibs, and bundles.
+	(bfd_mach_o_close_and_cleanup): Clean up BFDs for the dSYM file.
+	* mach-o.h (dsym_bfd): The BFD of the dSYM file.
+
+2012-01-03  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_mangle_symbols): Put in the section index
+	for stabd symbols.
+	(bfd_mach_o_primary_symbol_sort_key): Adjust for stabs.
+	(bfd_mach_o_cf_symbols): Likewise.
+
+2012-01-03  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_mangle_symbols): Correct typo.
+
+2012-01-03  Iain Sandoe  <idsandoe@googlemail.com>
+
+	* mach-o.c (bfd_mach_o_write_symtab): Fill in the string table index
+	as the value of an indirect symbol.  Keep the string table index in
+	non-indirect syms for reference.
+	(bfd_mach_o_write_dysymtab): New.
+	(bfd_mach_o_primary_symbol_sort_key): New.
+	(bfd_mach_o_cf_symbols): New.
+	(bfd_mach_o_sort_symbol_table): New.
+	(bfd_mach_o_mangle_symbols): Return early if no symbols.  Sort symbols.
+	If we are emitting a dysymtab, process indirect symbols and count the
+	number of each other kind.
+	(bfd_mach_o_mangle_sections): New.
+	(bfd_mach_o_write_contents): Split out some pre-requisite code into
+	the command builder. Write dysymtab if the command is present.
+	(bfd_mach_o_count_sections_for_seg): New.
+	(bfd_mach_o_build_seg_command): New.
+	(bfd_mach_o_build_dysymtab_command): New.
+	(bfd_mach_o_build_commands): Reorganize to support the fact that some
+	commands are optional and should not be emitted if there are no
+	sections or symbols.
+	(bfd_mach_o_set_section_contents): Amend comment.
+	* mach-o.h: Amend and add to comments.
+	(mach_o_data_struct): Add fields for dysymtab symbols counts and a
+	pointer to the indirects, when present.
+	(bfd_mach_o_should_emit_dysymtab): New macro.
+	(IS_MACHO_INDIRECT): Likewise.
+
+For older changes see ChangeLog-2011
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+End:
diff --git a/bfd/ChangeLog-9193 b/bfd/ChangeLog-9193
index 01863de..31aa237 100644
--- a/bfd/ChangeLog-9193
+++ b/bfd/ChangeLog-9193
@@ -7840,6 +7840,12 @@
 	(_write_symbol_table):  Initialize <idx> counter.
 	(foop):  Eliminate debugging code.
 
+Copyright (C) 1991-1993 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-9495 b/bfd/ChangeLog-9495
index a208f42..1af501c 100644
--- a/bfd/ChangeLog-9495
+++ b/bfd/ChangeLog-9495
@@ -10035,6 +10035,12 @@
 
 For older changes see ChangeLog-9193
 
+Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-9697 b/bfd/ChangeLog-9697
index e9a5c1d..add810b 100644
--- a/bfd/ChangeLog-9697
+++ b/bfd/ChangeLog-9697
@@ -6721,6 +6721,12 @@
 
 For older changes see ChangeLog-9495
 
+Copyright (C) 1996,1997 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/ChangeLog-9899 b/bfd/ChangeLog-9899
index 6d7f5cd..fdc2d89 100644
--- a/bfd/ChangeLog-9899
+++ b/bfd/ChangeLog-9899
@@ -5591,6 +5591,12 @@
 
 For older changes see ChangeLog-9697
 
+Copyright (C) 1998,1999 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/MAINTAINERS b/bfd/MAINTAINERS
index d59a3bd..e7d8ff8 100644
--- a/bfd/MAINTAINERS
+++ b/bfd/MAINTAINERS
@@ -1 +1,7 @@
 See ../binutils/MAINTAINERS
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index b7271cc..6f0e477 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -1,4 +1,21 @@
 ## Process this file with automake to generate Makefile.in
+#
+#   Copyright 2012 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
 
 AUTOMAKE_OPTIONS = 1.11 no-dist foreign
 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
@@ -35,7 +52,7 @@
 AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
 if PLUGINS
 bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
-LIBDL = -ldl
+LIBDL = @lt_cv_dlopen_libs@
 endif
 
 # bfd.h goes here, for now
@@ -71,6 +88,7 @@
 # This list is alphabetized to make it easier to keep in sync
 # with the decls and initializer in archures.c.
 ALL_MACHINES = \
+	cpu-aarch64.lo \
 	cpu-alpha.lo \
 	cpu-arc.lo \
 	cpu-arm.lo \
@@ -111,12 +129,14 @@
 	cpu-m88k.lo \
 	cpu-mcore.lo \
 	cpu-mep.lo \
+	cpu-metag.lo \
 	cpu-microblaze.lo \
 	cpu-mips.lo \
 	cpu-mmix.lo \
 	cpu-moxie.lo \
 	cpu-msp430.lo \
 	cpu-mt.lo \
+	cpu-nios2.lo \
 	cpu-ns32k.lo \
 	cpu-openrisc.lo \
 	cpu-or32.lo \
@@ -140,6 +160,7 @@
 	cpu-tilegx.lo \
 	cpu-tilepro.lo \
 	cpu-v850.lo \
+	cpu-v850_rh850.lo \
 	cpu-vax.lo \
 	cpu-w65.lo \
 	cpu-we32k.lo \
@@ -151,6 +172,7 @@
 	cpu-z8k.lo
 
 ALL_MACHINES_CFILES = \
+	cpu-aarch64.c \
 	cpu-alpha.c \
 	cpu-arc.c \
 	cpu-arm.c \
@@ -191,6 +213,7 @@
 	cpu-m88k.c \
 	cpu-mcore.c \
 	cpu-mep.c \
+	cpu-metag.c \
 	cpu-microblaze.c \
 	cpu-mips.c \
 	cpu-mmix.c \
@@ -198,6 +221,7 @@
 	cpu-msp430.c \
 	cpu-mt.c \
 	cpu-ns32k.c \
+	cpu-nios2.c \
 	cpu-openrisc.c \
 	cpu-or32.c \
 	cpu-pdp11.c \
@@ -220,6 +244,7 @@
 	cpu-tilegx.c \
 	cpu-tilepro.c \
 	cpu-v850.c \
+	cpu-v850_rh850.c \
 	cpu-vax.c \
 	cpu-w65.c \
 	cpu-we32k.c \
@@ -319,11 +344,12 @@
 	elf32-m88k.lo \
 	elf32-mcore.lo \
 	elf32-mep.lo \
+	elf32-metag.lo \
 	elf32-microblaze.lo \
-	elf32-mips.lo \
 	elf32-moxie.lo \
 	elf32-msp430.lo \
 	elf32-mt.lo \
+	elf32-nios2.lo \
 	elf32-openrisc.lo \
 	elf32-or32.lo \
 	elf32-pj.lo \
@@ -348,7 +374,6 @@
 	elf32-xtensa.lo \
 	elf32.lo \
 	elflink.lo \
-	elfxx-mips.lo \
 	elfxx-sparc.lo \
 	elfxx-tilegx.lo \
 	epoc-pe-arm.lo \
@@ -507,11 +532,12 @@
 	elf32-m88k.c \
 	elf32-mcore.c \
 	elf32-mep.c \
+	elf32-metag.c \
 	elf32-microblaze.c \
-	elf32-mips.c \
 	elf32-moxie.c \
 	elf32-msp430.c \
 	elf32-mt.c \
+	elf32-nios2.c \
 	elf32-openrisc.c \
 	elf32-or32.c \
 	elf32-pj.c \
@@ -536,7 +562,6 @@
 	elf32-xtensa.c \
 	elf32.c \
 	elflink.c \
-	elfxx-mips.c \
 	elfxx-sparc.c \
 	elfxx-tilegx.c \
 	epoc-pe-arm.c \
@@ -613,14 +638,17 @@
 # elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in
 # BFD32_BACKENDS.
 BFD64_BACKENDS = \
+	elf32-aarch64.lo \
+	elf64-aarch64.lo \
+	elfxx-aarch64.lo \
 	aix5ppc-core.lo \
 	aout64.lo \
 	coff-alpha.lo \
 	coff-x86_64.lo \
 	coff64-rs6000.lo \
 	demo64.lo \
-	elf-nacl.lo \
 	elf32-ia64.lo \
+	elf32-mips.lo \
 	elf32-score.lo \
 	elf32-score7.lo \
 	elf64-alpha.lo \
@@ -639,6 +667,7 @@
 	elf64.lo \
 	elfn32-mips.lo \
 	elfxx-ia64.lo \
+	elfxx-mips.lo \
 	mach-o-x86-64.lo \
 	mmo.lo \
 	nlm32-alpha.lo \
@@ -657,7 +686,7 @@
 	coff-x86_64.c \
 	coff64-rs6000.c \
 	demo64.c \
-	elf-nacl.c \
+	elf32-mips.c \
 	elf32-score.c \
 	elf32-score7.c \
 	elf64-alpha.c \
@@ -674,7 +703,9 @@
 	elf64-x86-64.c \
 	elf64.c \
 	elfn32-mips.c \
+	elfxx-aarch64.c \
 	elfxx-ia64.c \
+	elfxx-mips.c \
 	mach-o-x86-64.c \
 	mmo.c \
 	nlm32-alpha.c \
@@ -735,6 +766,7 @@
 	$(OPTIONAL_BACKENDS_CFILES)
 
 BUILD_CFILES = \
+	elf32-aarch64.c elf64-aarch64.c \
 	elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c
 
 CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
@@ -742,7 +774,7 @@
 ## This is a list of all .h files which are in the source tree.
 SOURCE_HFILES = \
 	aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
-	elf-bfd.h elf-hppa.h elf32-hppa.h \
+	elf-bfd.h elf-hppa.h elf-linux-psinfo.h elf32-hppa.h \
 	elf64-hppa.h elfcode.h elfcore.h \
 	freebsd.h genlink.h go32stub.h \
 	libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
@@ -883,6 +915,18 @@
 	sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
 	mv -f elf64-target.new elf64-target.h
 
+elf32-aarch64.c : elfnn-aarch64.c
+	rm -f elf32-aarch64.c
+	echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf32-aarch64.new
+	sed -e s/NN/32/g < $(srcdir)/elfnn-aarch64.c >> elf32-aarch64.new
+	mv -f elf32-aarch64.new elf32-aarch64.c
+
+elf64-aarch64.c : elfnn-aarch64.c
+	rm -f elf64-aarch64.c
+	echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf64-aarch64.new
+	sed -e s/NN/64/g < $(srcdir)/elfnn-aarch64.c >> elf64-aarch64.new
+	mv -f elf64-aarch64.new elf64-aarch64.c
+
 elf32-ia64.c : elfnn-ia64.c
 	rm -f elf32-ia64.c
 	sed -e s/NN/32/g < $(srcdir)/elfnn-ia64.c > elf32-ia64.new
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 8ee6681..8a38a76 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -15,6 +15,24 @@
 
 @SET_MAKE@
 
+#
+#   Copyright 2012 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
+
 
 
 VPATH = @srcdir@
@@ -47,8 +65,7 @@
 	$(top_srcdir)/po/Make-in $(srcdir)/../depcomp \
 	$(am__bfdinclude_HEADERS_DIST)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../bfd/bfd.m4 \
-	$(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/depstand.m4 \
 	$(top_srcdir)/../config/gettext-sister.m4 \
 	$(top_srcdir)/../config/largefile.m4 \
@@ -61,6 +78,7 @@
 	$(top_srcdir)/../config/stdint.m4 $(top_srcdir)/../libtool.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/zlib.m4 \
 	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -293,6 +311,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_cv_dlopen_libs = @lt_cv_dlopen_libs@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -336,7 +355,7 @@
 @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la
 AM_CFLAGS = $(WARN_CFLAGS)
 AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
-@PLUGINS_TRUE@LIBDL = -ldl
+@PLUGINS_TRUE@LIBDL = @lt_cv_dlopen_libs@
 
 # bfd.h goes here, for now
 BFD_H = bfd.h
@@ -370,6 +389,7 @@
 # This list is alphabetized to make it easier to keep in sync
 # with the decls and initializer in archures.c.
 ALL_MACHINES = \
+	cpu-aarch64.lo \
 	cpu-alpha.lo \
 	cpu-arc.lo \
 	cpu-arm.lo \
@@ -410,12 +430,14 @@
 	cpu-m88k.lo \
 	cpu-mcore.lo \
 	cpu-mep.lo \
+	cpu-metag.lo \
 	cpu-microblaze.lo \
 	cpu-mips.lo \
 	cpu-mmix.lo \
 	cpu-moxie.lo \
 	cpu-msp430.lo \
 	cpu-mt.lo \
+	cpu-nios2.lo \
 	cpu-ns32k.lo \
 	cpu-openrisc.lo \
 	cpu-or32.lo \
@@ -439,6 +461,7 @@
 	cpu-tilegx.lo \
 	cpu-tilepro.lo \
 	cpu-v850.lo \
+	cpu-v850_rh850.lo \
 	cpu-vax.lo \
 	cpu-w65.lo \
 	cpu-we32k.lo \
@@ -450,6 +473,7 @@
 	cpu-z8k.lo
 
 ALL_MACHINES_CFILES = \
+	cpu-aarch64.c \
 	cpu-alpha.c \
 	cpu-arc.c \
 	cpu-arm.c \
@@ -490,6 +514,7 @@
 	cpu-m88k.c \
 	cpu-mcore.c \
 	cpu-mep.c \
+	cpu-metag.c \
 	cpu-microblaze.c \
 	cpu-mips.c \
 	cpu-mmix.c \
@@ -497,6 +522,7 @@
 	cpu-msp430.c \
 	cpu-mt.c \
 	cpu-ns32k.c \
+	cpu-nios2.c \
 	cpu-openrisc.c \
 	cpu-or32.c \
 	cpu-pdp11.c \
@@ -519,6 +545,7 @@
 	cpu-tilegx.c \
 	cpu-tilepro.c \
 	cpu-v850.c \
+	cpu-v850_rh850.c \
 	cpu-vax.c \
 	cpu-w65.c \
 	cpu-we32k.c \
@@ -619,11 +646,12 @@
 	elf32-m88k.lo \
 	elf32-mcore.lo \
 	elf32-mep.lo \
+	elf32-metag.lo \
 	elf32-microblaze.lo \
-	elf32-mips.lo \
 	elf32-moxie.lo \
 	elf32-msp430.lo \
 	elf32-mt.lo \
+	elf32-nios2.lo \
 	elf32-openrisc.lo \
 	elf32-or32.lo \
 	elf32-pj.lo \
@@ -648,7 +676,6 @@
 	elf32-xtensa.lo \
 	elf32.lo \
 	elflink.lo \
-	elfxx-mips.lo \
 	elfxx-sparc.lo \
 	elfxx-tilegx.lo \
 	epoc-pe-arm.lo \
@@ -807,11 +834,12 @@
 	elf32-m88k.c \
 	elf32-mcore.c \
 	elf32-mep.c \
+	elf32-metag.c \
 	elf32-microblaze.c \
-	elf32-mips.c \
 	elf32-moxie.c \
 	elf32-msp430.c \
 	elf32-mt.c \
+	elf32-nios2.c \
 	elf32-openrisc.c \
 	elf32-or32.c \
 	elf32-pj.c \
@@ -836,7 +864,6 @@
 	elf32-xtensa.c \
 	elf32.c \
 	elflink.c \
-	elfxx-mips.c \
 	elfxx-sparc.c \
 	elfxx-tilegx.c \
 	epoc-pe-arm.c \
@@ -914,14 +941,17 @@
 # elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in
 # BFD32_BACKENDS.
 BFD64_BACKENDS = \
+	elf32-aarch64.lo \
+	elf64-aarch64.lo \
+	elfxx-aarch64.lo \
 	aix5ppc-core.lo \
 	aout64.lo \
 	coff-alpha.lo \
 	coff-x86_64.lo \
 	coff64-rs6000.lo \
 	demo64.lo \
-	elf-nacl.lo \
 	elf32-ia64.lo \
+	elf32-mips.lo \
 	elf32-score.lo \
 	elf32-score7.lo \
 	elf64-alpha.lo \
@@ -940,6 +970,7 @@
 	elf64.lo \
 	elfn32-mips.lo \
 	elfxx-ia64.lo \
+	elfxx-mips.lo \
 	mach-o-x86-64.lo \
 	mmo.lo \
 	nlm32-alpha.lo \
@@ -958,7 +989,7 @@
 	coff-x86_64.c \
 	coff64-rs6000.c \
 	demo64.c \
-	elf-nacl.c \
+	elf32-mips.c \
 	elf32-score.c \
 	elf32-score7.c \
 	elf64-alpha.c \
@@ -975,7 +1006,9 @@
 	elf64-x86-64.c \
 	elf64.c \
 	elfn32-mips.c \
+	elfxx-aarch64.c \
 	elfxx-ia64.c \
+	elfxx-mips.c \
 	mach-o-x86-64.c \
 	mmo.c \
 	nlm32-alpha.c \
@@ -1038,12 +1071,13 @@
 	$(OPTIONAL_BACKENDS_CFILES)
 
 BUILD_CFILES = \
+	elf32-aarch64.c elf64-aarch64.c \
 	elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c
 
 CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
 SOURCE_HFILES = \
 	aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
-	elf-bfd.h elf-hppa.h elf32-hppa.h \
+	elf-bfd.h elf-hppa.h elf-linux-psinfo.h elf32-hppa.h \
 	elf64-hppa.h elfcode.h elfcore.h \
 	freebsd.h genlink.h go32stub.h \
 	libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \
@@ -1270,6 +1304,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cofflink.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corefile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-aarch64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-alpha.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-arc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-arm.Plo@am__quote@
@@ -1310,12 +1345,14 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-m9s12xg.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-mcore.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-mep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-metag.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-microblaze.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-mips.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-mmix.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-moxie.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-msp430.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-mt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-nios2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-ns32k.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-openrisc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-or32.Plo@am__quote@
@@ -1339,6 +1376,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-tilegx.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-tilepro.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-v850.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-v850_rh850.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-vax.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-w65.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-we32k.Plo@am__quote@
@@ -1362,6 +1400,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-strtab.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-vxworks.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-aarch64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-am33lin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-arc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-arm.Plo@am__quote@
@@ -1397,11 +1436,13 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-m88k.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-mcore.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-mep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-metag.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-microblaze.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-mips.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-moxie.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-msp430.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-mt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-nios2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-openrisc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-or32.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-pj.Plo@am__quote@
@@ -1427,6 +1468,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-xstormy16.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-xtensa.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-aarch64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-alpha.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-gen.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@
@@ -1443,6 +1485,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elflink.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfn32-mips.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-aarch64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-ia64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-mips.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-sparc.Plo@am__quote@
@@ -1951,6 +1994,18 @@
 	sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
 	mv -f elf64-target.new elf64-target.h
 
+elf32-aarch64.c : elfnn-aarch64.c
+	rm -f elf32-aarch64.c
+	echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf32-aarch64.new
+	sed -e s/NN/32/g < $(srcdir)/elfnn-aarch64.c >> elf32-aarch64.new
+	mv -f elf32-aarch64.new elf32-aarch64.c
+
+elf64-aarch64.c : elfnn-aarch64.c
+	rm -f elf64-aarch64.c
+	echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf64-aarch64.new
+	sed -e s/NN/64/g < $(srcdir)/elfnn-aarch64.c >> elf64-aarch64.new
+	mv -f elf64-aarch64.new elf64-aarch64.c
+
 elf32-ia64.c : elfnn-ia64.c
 	rm -f elf32-ia64.c
 	sed -e s/NN/32/g < $(srcdir)/elfnn-ia64.c > elf32-ia64.new
diff --git a/bfd/PORTING b/bfd/PORTING
index c8bfd77..b820525 100644
--- a/bfd/PORTING
+++ b/bfd/PORTING
@@ -81,3 +81,9 @@
 TARGETNAME
 	The name of the target, for run-time lookups.
 	Usually "a.out-<target>"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/bfd/README b/bfd/README
index fe6b6f3..5ecfd29 100644
--- a/bfd/README
+++ b/bfd/README
@@ -47,3 +47,9 @@
 
 Bug reports without patches will be remembered, but they may never get
 fixed until somebody volunteers to fix them.
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/bfd/TODO b/bfd/TODO
index 7a12735..012d624 100644
--- a/bfd/TODO
+++ b/bfd/TODO
@@ -19,7 +19,9 @@
      the stupid quips and fill in all the blanks.
 
  o - upgrade the reloc handling as per Steve's suggestion.
+
+Copyright (C) 2012 Free Software Foundation, Inc.
 
-
-
-
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index d9813bd..3518592 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -1,3 +1,21 @@
+dnl
+dnl   Copyright 2012 Free Software Foundation
+dnl
+dnl This file is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; see the file COPYING3.  If not see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
 sinclude([../config/zlib.m4])
 
 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
index bf4ef1d..d9e743e 100644
--- a/bfd/aclocal.m4
+++ b/bfd/aclocal.m4
@@ -968,8 +968,6 @@
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
-m4_include([../bfd/bfd.m4])
-m4_include([../bfd/warning.m4])
 m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
 m4_include([../config/gettext-sister.m4])
@@ -986,4 +984,6 @@
 m4_include([../ltsugar.m4])
 m4_include([../ltversion.m4])
 m4_include([../lt~obsolete.m4])
+m4_include([bfd.m4])
+m4_include([warning.m4])
 m4_include([acinclude.m4])
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index f6e8bd2..1ffef87 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -577,7 +577,18 @@
 #endif
 
 #ifndef MY_close_and_cleanup
-#define MY_close_and_cleanup MY_bfd_free_cached_info
+
+/* Handle closing of a BFD including the resource-releasing parts.  */
+
+static bfd_boolean
+MY_close_and_cleanup (bfd *abfd)
+{
+  if (!MY_bfd_free_cached_info (abfd))
+    return FALSE;
+
+  return _bfd_generic_close_and_cleanup (abfd);
+}
+
 #endif
 
 #ifndef MY_get_dynamic_symtab_upper_bound
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index f3b0d36..d8ce9be 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -701,7 +701,7 @@
 
   *ptreloff = obj_datasec (abfd)->filepos + execp->a_data;
   *pdreloff = *ptreloff + execp->a_trsize;
-  *psymoff = *pdreloff + execp->a_drsize;;
+  *psymoff = *pdreloff + execp->a_drsize;
 }
 
 #endif
diff --git a/bfd/aout0.c b/bfd/aout0.c
index 7cec377..be73fa0 100644
--- a/bfd/aout0.c
+++ b/bfd/aout0.c
@@ -4,7 +4,7 @@
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
diff --git a/bfd/archive.c b/bfd/archive.c
index fe57755..32b07a7 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1,7 +1,5 @@
 /* BFD back-end for archive files (libraries).
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-   2012  Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
    Written by Cygnus Support.  Mostly Gumby Henkel-Wallace's fault.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -42,11 +40,17 @@
 	have to read the entire archive if you don't want
 	to!  Read it until you find what you want.
 
+	A BFD returned by <<bfd_openr_next_archived_file>> can be
+	closed manually with <<bfd_close>>.  If you do not close it,
+	then a second iteration through the members of an archive may
+	return the same BFD.  If you close the archive BFD, then all
+	the member BFDs will automatically be closed as well.
+
 	Archive contents of output BFDs are chained through the
-	<<next>> pointer in a BFD.  The first one is findable through
-	the <<archive_head>> slot of the archive.  Set it with
-	<<bfd_set_archive_head>> (q.v.).  A given BFD may be in only one
-	open output archive at a time.
+	<<archive_next>> pointer in a BFD.  The first one is findable
+	through the <<archive_head>> slot of the archive.  Set it with
+	<<bfd_set_archive_head>> (q.v.).  A given BFD may be in only
+	one open output archive at a time.
 
 	As expected, the BFD archive code is more general than the
 	archive code of any given environment.  BFD archives may
@@ -362,6 +366,10 @@
   cache->arbfd = new_elt;
   *htab_find_slot (hash_table, (const void *) cache, INSERT) = cache;
 
+  /* Provide a means of accessing this from child.  */
+  arch_eltdata (new_elt)->parent_cache = hash_table;
+  arch_eltdata (new_elt)->key = filepos;
+
   return TRUE;
 }
 
@@ -371,6 +379,13 @@
   bfd *abfd;
   const char *target;
 
+  /* PR 15140: Don't allow a nested archive pointing to itself.  */
+  if (filename_cmp (filename, arch_bfd->filename) == 0)
+    {
+      bfd_set_error (bfd_error_malformed_archive);
+      return NULL;
+    }
+
   for (abfd = arch_bfd->nested_archives;
        abfd != NULL;
        abfd = abfd->archive_next)
@@ -507,7 +522,7 @@
       parsed_size -= namelen;
       extra_size = namelen;
 
-      allocptr = (char *) bfd_zalloc (abfd, allocsize);
+      allocptr = (char *) bfd_zmalloc (allocsize);
       if (allocptr == NULL)
 	return NULL;
       filename = (allocptr
@@ -515,6 +530,7 @@
 		  + sizeof (struct ar_hdr));
       if (bfd_bread (filename, namelen, abfd) != namelen)
 	{
+	  free (allocptr);
 	  if (bfd_get_error () != bfd_error_system_call)
 	    bfd_set_error (bfd_error_no_more_archived_files);
 	  return NULL;
@@ -550,7 +566,7 @@
 
   if (!allocptr)
     {
-      allocptr = (char *) bfd_zalloc (abfd, allocsize);
+      allocptr = (char *) bfd_zmalloc (allocsize);
       if (allocptr == NULL)
 	return NULL;
     }
@@ -633,7 +649,10 @@
 	{
 	  filename = _bfd_append_relative_path (archive, filename);
 	  if (filename == NULL)
-	    return NULL;
+	    {
+	      free (new_areldata);
+	      return NULL;
+	    }
 	}
 
       if (new_areldata->origin > 0)
@@ -645,13 +664,13 @@
 	  if (ext_arch == NULL
 	      || ! bfd_check_format (ext_arch, bfd_archive))
 	    {
-	      bfd_release (archive, new_areldata);
+	      free (new_areldata);
 	      return NULL;
 	    }
 	  n_nfd = _bfd_get_elt_at_filepos (ext_arch, new_areldata->origin);
 	  if (n_nfd == NULL)
 	    {
-	      bfd_release (archive, new_areldata);
+	      free (new_areldata);
 	      return NULL;
 	    }
 	  n_nfd->proxy_origin = bfd_tell (archive);
@@ -673,7 +692,7 @@
 
   if (n_nfd == NULL)
     {
-      bfd_release (archive, new_areldata);
+      free (new_areldata);
       return NULL;
     }
 
@@ -697,7 +716,8 @@
   if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
     return n_nfd;
 
-  bfd_release (archive, new_areldata);
+  free (new_areldata);
+  n_nfd->arelt_data = NULL;
   return NULL;
 }
 
@@ -837,11 +857,7 @@
 	  first->target_defaulted = FALSE;
 	  if (bfd_check_format (first, bfd_object)
 	      && first->xvec != abfd->xvec)
-	    {
-	      bfd_set_error (bfd_error_wrong_object_format);
-	      bfd_ardata (abfd) = tdata_hold;
-	      return NULL;
-	    }
+	    bfd_set_error (bfd_error_wrong_object_format);
 	  /* And we ought to close `first' here too.  */
 	}
     }
@@ -884,7 +900,7 @@
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, mapdata);	/* Don't need it any more.  */
+  free (mapdata);
 
   raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
   if (raw_armap == NULL)
@@ -960,7 +976,7 @@
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, mapdata);	/* Don't need it any more.  */
+  free (mapdata);
 
   if (bfd_bread (int_buf, 4, abfd) != 4)
     {
@@ -1053,7 +1069,7 @@
 	    ardata->first_file_filepos +=
 	      (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~(unsigned) 1;
 	  }
-	bfd_release (abfd, tmp);
+	free (tmp);
       }
   }
 
@@ -1170,15 +1186,17 @@
 
   if (mapdata->parsed_size < HPUX_SYMDEF_COUNT_SIZE + BSD_STRING_COUNT_SIZE)
     {
+      free (mapdata);
     wrong_format:
       bfd_set_error (bfd_error_wrong_format);
     byebye:
-      bfd_release (abfd, mapdata);
       return FALSE;
     }
   left = mapdata->parsed_size - HPUX_SYMDEF_COUNT_SIZE - BSD_STRING_COUNT_SIZE;
 
   amt = mapdata->parsed_size;
+  free (mapdata);
+
   raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt);
   if (raw_armap == NULL)
     goto byebye;
@@ -1280,7 +1298,7 @@
       if (bfd_ardata (abfd)->extended_names == NULL)
 	{
 	byebye:
-	  bfd_release (abfd, namedata);
+	  free (namedata);
 	  return FALSE;
 	}
 
@@ -1317,8 +1335,7 @@
       bfd_ardata (abfd)->first_file_filepos +=
 	(bfd_ardata (abfd)->first_file_filepos) % 2;
 
-      /* FIXME, we can't release namedata here because it was allocated
-	 below extended_names on the objalloc...  */
+      free (namedata);
     }
   return TRUE;
 }
@@ -1886,7 +1903,7 @@
     }
 
   amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
-  ared = (struct areltdata *) bfd_zalloc (abfd, amt);
+  ared = (struct areltdata *) bfd_zmalloc (amt);
   if (ared == NULL)
     return NULL;
   hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
@@ -2408,9 +2425,6 @@
   unsigned int count;
   struct ar_hdr hdr;
   long uid, gid;
-  file_ptr max_first_real = 1;
-
-  max_first_real <<= 31;
 
   firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
 
@@ -2453,6 +2467,7 @@
 
   for (count = 0; count < orl_count; count++)
     {
+      unsigned int offset;
       bfd_byte buf[BSD_SYMDEF_SIZE];
 
       if (map[count].u.abfd != last_elt)
@@ -2472,12 +2487,13 @@
       /* The archive file format only has 4 bytes to store the offset
 	 of the member.  Check to make sure that firstreal has not grown
 	 too big.  */
-      if (firstreal >= max_first_real)
+      offset = (unsigned int) firstreal;
+      if (firstreal != (file_ptr) offset)
 	{
 	  bfd_set_error (bfd_error_file_truncated);
 	  return FALSE;
 	}
-      
+
       last_elt = current;
       H_PUT_32 (arch, map[count].namidx, buf);
       H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
@@ -2682,3 +2698,58 @@
 
   return TRUE;
 }
+
+static int
+archive_close_worker (void **slot, void *inf ATTRIBUTE_UNUSED)
+{
+  struct ar_cache *ent = (struct ar_cache *) *slot;
+
+  bfd_close_all_done (ent->arbfd);
+  return 1;
+}
+
+bfd_boolean
+_bfd_archive_close_and_cleanup (bfd *abfd)
+{
+  if (bfd_read_p (abfd) && abfd->format == bfd_archive)
+    {
+      bfd *nbfd;
+      bfd *next;
+      htab_t htab;
+
+      /* Close nested archives (if this bfd is a thin archive).  */
+      for (nbfd = abfd->nested_archives; nbfd; nbfd = next)
+	{
+	  next = nbfd->archive_next;
+	  bfd_close (nbfd);
+	}
+
+      htab = bfd_ardata (abfd)->cache;
+      if (htab)
+	{
+	  htab_traverse_noresize (htab, archive_close_worker, NULL);
+	  htab_delete (htab);
+	  bfd_ardata (abfd)->cache = NULL;
+	}
+    }
+  if (arch_eltdata (abfd) != NULL)
+    {
+      struct areltdata *ared = arch_eltdata (abfd);
+      htab_t htab = (htab_t) ared->parent_cache;
+
+      if (htab)
+	{
+	  struct ar_cache ent;
+	  void **slot;
+
+	  ent.ptr = ared->key;
+	  slot = htab_find_slot (htab, &ent, NO_INSERT);
+	  if (slot != NULL)
+	    {
+	      BFD_ASSERT (((struct ar_cache *) *slot)->arbfd == abfd);
+	      htab_clear_slot (htab, slot);
+	    }
+	}
+    }
+  return TRUE;
+}
diff --git a/bfd/archive64.c b/bfd/archive64.c
index f3a13d3..be64e0d 100644
--- a/bfd/archive64.c
+++ b/bfd/archive64.c
@@ -1,6 +1,5 @@
-/* MIPS-specific support for 64-bit ELF
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007,
-   2010, 2012  Free Software Foundation, Inc.
+/* Support for 64-bit ELF archives.
+   Copyright 1996-2013 Free Software Foundation, Inc.
    Ian Lance Taylor, Cygnus Support
    Linker support added by Mark Mitchell, CodeSourcery, LLC.
    <mark@codesourcery.com>
@@ -77,7 +76,7 @@
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, mapdata);
+  free (mapdata);
 
   if (bfd_bread (int_buf, 8, abfd) != 8)
     {
@@ -200,7 +199,7 @@
        current = current->archive_next)
     {
       /* For each symbol which is used defined in this object, write out
-	 the object file's address in the archive */
+	 the object file's address in the archive.  */
 
       for (;
 	   count < symbol_count && map[count].u.abfd == current;
@@ -210,9 +209,11 @@
 	  if (bfd_bwrite (buf, 8, arch) != 8)
 	    return FALSE;
 	}
+
       /* Add size of this archive entry */
-      archive_member_file_ptr += (arelt_size (current)
-				  + sizeof (struct ar_hdr));
+      archive_member_file_ptr += sizeof (struct ar_hdr);
+      if (! bfd_is_thin_archive (arch))
+	archive_member_file_ptr += arelt_size (current);
       /* remember about the even alignment */
       archive_member_file_ptr += archive_member_file_ptr % 2;
     }
diff --git a/bfd/archures.c b/bfd/archures.c
index a23534b..97c540a 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -1,7 +1,5 @@
 /* BFD library support routines for architectures.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-   2012 Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
    Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -145,7 +143,7 @@
 .#define bfd_mach_sparc_64bit_p(mach) \
 .  ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
 .  bfd_arch_spu,       {* PowerPC SPU *}
-.#define bfd_mach_spu		256 
+.#define bfd_mach_spu		256
 .  bfd_arch_mips,      {* MIPS Rxxxx *}
 .#define bfd_mach_mips3000		3000
 .#define bfd_mach_mips3900		3900
@@ -161,6 +159,7 @@
 .#define bfd_mach_mips5000		5000
 .#define bfd_mach_mips5400		5400
 .#define bfd_mach_mips5500		5500
+.#define bfd_mach_mips5900		5900
 .#define bfd_mach_mips6000		6000
 .#define bfd_mach_mips7000		7000
 .#define bfd_mach_mips8000		8000
@@ -199,6 +198,10 @@
 .  bfd_arch_k1om,   {* Intel K1OM *}
 .#define bfd_mach_k1om			(1 << 6)
 .#define bfd_mach_k1om_intel_syntax	(bfd_mach_k1om | bfd_mach_i386_intel_syntax)
+.#define bfd_mach_i386_nacl		(1 << 7)
+.#define bfd_mach_i386_i386_nacl	(bfd_mach_i386_i386 | bfd_mach_i386_nacl)
+.#define bfd_mach_x86_64_nacl		(bfd_mach_x86_64 | bfd_mach_i386_nacl)
+.#define bfd_mach_x64_32_nacl		(bfd_mach_x64_32 | bfd_mach_i386_nacl)
 .  bfd_arch_we32k,     {* AT&T WE32xxx *}
 .  bfd_arch_tahoe,     {* CCI/Harris Tahoe *}
 .  bfd_arch_i860,      {* Intel 860 *}
@@ -323,11 +326,13 @@
 .  bfd_arch_tic6x,     {* Texas Instruments TMS320C6X *}
 .  bfd_arch_tic80,     {* TI TMS320c80 (MVP) *}
 .  bfd_arch_v850,      {* NEC V850 *}
+.  bfd_arch_v850_rh850,{* NEC V850 (using RH850 ABI) *}
 .#define bfd_mach_v850          1
 .#define bfd_mach_v850e 	'E'
 .#define bfd_mach_v850e1        '1'
 .#define bfd_mach_v850e2        0x4532
 .#define bfd_mach_v850e2v3      0x45325633
+.#define bfd_mach_v850e3v5      0x45335635 {* ('E'|'3'|'V'|'5') *}
 .  bfd_arch_arc,       {* ARC Cores *}
 .#define bfd_mach_arc_5         5
 .#define bfd_mach_arc_6         6
@@ -363,6 +368,8 @@
 .#define bfd_mach_mep		1
 .#define bfd_mach_mep_h1	0x6831
 .#define bfd_mach_mep_c5	0x6335
+.  bfd_arch_metag,
+.#define bfd_mach_metag		1
 .  bfd_arch_ia64,      {* HP/Intel ia64 *}
 .#define bfd_mach_ia64_elf64	64
 .#define bfd_mach_ia64_elf32	32
@@ -417,7 +424,7 @@
 .  bfd_arch_s390,      {* IBM s390 *}
 .#define bfd_mach_s390_31       31
 .#define bfd_mach_s390_64       64
-.  bfd_arch_score,     {* Sunplus score *} 
+.  bfd_arch_score,     {* Sunplus score *}
 .#define bfd_mach_score3         3
 .#define bfd_mach_score7         7
 .  bfd_arch_openrisc,  {* OpenRISC *}
@@ -432,7 +439,12 @@
 .#define bfd_mach_msp14          14
 .#define bfd_mach_msp15          15
 .#define bfd_mach_msp16          16
+.#define bfd_mach_msp20          20
 .#define bfd_mach_msp21          21
+.#define bfd_mach_msp22          22
+.#define bfd_mach_msp23          23
+.#define bfd_mach_msp24          24
+.#define bfd_mach_msp26          26
 .#define bfd_mach_msp31          31
 .#define bfd_mach_msp32          32
 .#define bfd_mach_msp33          33
@@ -440,6 +452,10 @@
 .#define bfd_mach_msp42          42
 .#define bfd_mach_msp43          43
 .#define bfd_mach_msp44          44
+.#define bfd_mach_msp430x        45
+.#define bfd_mach_msp46          46
+.#define bfd_mach_msp47          47
+.#define bfd_mach_msp54          54
 .  bfd_arch_xc16x,     {* Infineon's XC16X Series.               *}
 .#define bfd_mach_xc16x         1
 .#define bfd_mach_xc16xl        2
@@ -461,6 +477,11 @@
 .#define bfd_mach_tilepro   1
 .#define bfd_mach_tilegx    1
 .#define bfd_mach_tilegx32  2
+.  bfd_arch_aarch64,   {* AArch64  *}
+.#define bfd_mach_aarch64 0
+.#define bfd_mach_aarch64_ilp32	32
+.  bfd_arch_nios2,
+.#define bfd_mach_nios2	0
 .  bfd_arch_last
 .  };
 */
@@ -505,6 +526,7 @@
 .
 */
 
+extern const bfd_arch_info_type bfd_aarch64_arch;
 extern const bfd_arch_info_type bfd_alpha_arch;
 extern const bfd_arch_info_type bfd_arc_arch;
 extern const bfd_arch_info_type bfd_arm_arch;
@@ -543,6 +565,7 @@
 extern const bfd_arch_info_type bfd_m88k_arch;
 extern const bfd_arch_info_type bfd_mcore_arch;
 extern const bfd_arch_info_type bfd_mep_arch;
+extern const bfd_arch_info_type bfd_metag_arch;
 extern const bfd_arch_info_type bfd_mips_arch;
 extern const bfd_arch_info_type bfd_microblaze_arch;
 extern const bfd_arch_info_type bfd_mmix_arch;
@@ -551,6 +574,7 @@
 extern const bfd_arch_info_type bfd_moxie_arch;
 extern const bfd_arch_info_type bfd_msp430_arch;
 extern const bfd_arch_info_type bfd_mt_arch;
+extern const bfd_arch_info_type bfd_nios2_arch;
 extern const bfd_arch_info_type bfd_ns32k_arch;
 extern const bfd_arch_info_type bfd_openrisc_arch;
 extern const bfd_arch_info_type bfd_or32_arch;
@@ -575,6 +599,7 @@
 extern const bfd_arch_info_type bfd_tilegx_arch;
 extern const bfd_arch_info_type bfd_tilepro_arch;
 extern const bfd_arch_info_type bfd_v850_arch;
+extern const bfd_arch_info_type bfd_v850_rh850_arch;
 extern const bfd_arch_info_type bfd_vax_arch;
 extern const bfd_arch_info_type bfd_w65_arch;
 extern const bfd_arch_info_type bfd_we32k_arch;
@@ -590,6 +615,7 @@
 #ifdef SELECT_ARCHITECTURES
     SELECT_ARCHITECTURES,
 #else
+    &bfd_aarch64_arch,
     &bfd_alpha_arch,
     &bfd_arc_arch,
     &bfd_arm_arch,
@@ -628,6 +654,7 @@
     &bfd_m88k_arch,
     &bfd_mcore_arch,
     &bfd_mep_arch,
+    &bfd_metag_arch,
     &bfd_microblaze_arch,
     &bfd_mips_arch,
     &bfd_mmix_arch,
@@ -636,6 +663,7 @@
     &bfd_moxie_arch,
     &bfd_msp430_arch,
     &bfd_mt_arch,
+    &bfd_nios2_arch,
     &bfd_ns32k_arch,
     &bfd_openrisc_arch,
     &bfd_or32_arch,
@@ -657,6 +685,7 @@
     &bfd_tilegx_arch,
     &bfd_tilepro_arch,
     &bfd_v850_arch,
+    &bfd_v850_rh850_arch,
     &bfd_vax_arch,
     &bfd_w65_arch,
     &bfd_we32k_arch,
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 5300b14..3afd71b 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -1,8 +1,6 @@
 /* Main header file for the bfd library -- portable access to object files.
 
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-   2012 Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
@@ -62,7 +60,7 @@
    problem for example when trying to use STRING_COMMA_LEN to build
    the arguments to the strncmp() macro.  Hence this alternative
    definition of strncmp is provided here.
-   
+
    Note - these macros do NOT work if STR2 is not a constant string.  */
 #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
   /* strcpy() can have a similar problem, but since we know we are
@@ -648,6 +646,8 @@
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean bfd_elf_get_bfd_needed_list
   (bfd *, struct bfd_link_needed_list **);
+extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
+					       const char *, bfd_vma);
 extern bfd_boolean bfd_elf_size_dynamic_sections
   (bfd *, const char *, const char *, const char *, const char *, const char *,
    const char * const *, struct bfd_link_info *, struct bfd_section **);
@@ -909,7 +909,8 @@
   (struct bfd_link_info *, struct bfd_section *);
 extern bfd_boolean elf32_arm_size_stubs
   (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
-   struct bfd_section * (*) (const char *, struct bfd_section *), void (*) (void));
+   struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int),
+   void (*) (void));
 extern bfd_boolean elf32_arm_build_stubs
   (struct bfd_link_info *);
 
@@ -928,6 +929,50 @@
 extern unsigned int _bfd_elf_ppc_at_tprel_transform
   (unsigned int, unsigned int);
 
+extern void bfd_elf64_aarch64_init_maps
+  (bfd *);
+
+extern void bfd_elf32_aarch64_init_maps
+  (bfd *);
+
+extern void bfd_elf64_aarch64_set_options
+  (bfd *, struct bfd_link_info *, int, int, int);
+
+extern void bfd_elf32_aarch64_set_options
+  (bfd *, struct bfd_link_info *, int, int, int);
+
+/* ELF AArch64 mapping symbol support.  */
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP	(1 << 0)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG	(1 << 1)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER	(1 << 2)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY	(~0)
+extern bfd_boolean bfd_is_aarch64_special_symbol_name
+  (const char * name, int type);
+
+/* AArch64 stub generation support for ELF64.  Called from the linker.  */
+extern int elf64_aarch64_setup_section_lists
+  (bfd *, struct bfd_link_info *);
+extern void elf64_aarch64_next_input_section
+  (struct bfd_link_info *, struct bfd_section *);
+extern bfd_boolean elf64_aarch64_size_stubs
+  (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
+   struct bfd_section * (*) (const char *, struct bfd_section *),
+   void (*) (void));
+extern bfd_boolean elf64_aarch64_build_stubs
+  (struct bfd_link_info *);
+/* AArch64 stub generation support for ELF32.  Called from the linker.  */
+extern int elf32_aarch64_setup_section_lists
+  (bfd *, struct bfd_link_info *);
+extern void elf32_aarch64_next_input_section
+  (struct bfd_link_info *, struct bfd_section *);
+extern bfd_boolean elf32_aarch64_size_stubs
+  (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
+   struct bfd_section * (*) (const char *, struct bfd_section *),
+   void (*) (void));
+extern bfd_boolean elf32_aarch64_build_stubs
+  (struct bfd_link_info *);
+
+
 /* TI COFF load page support.  */
 extern void bfd_ticoff_set_section_load_page
   (struct bfd_section *, int);
@@ -963,6 +1008,5 @@
   long symbol;
 };
 
-extern struct coff_comdat_info *bfd_coff_get_comdat_section
+extern struct coff_comdat_info * bfd_coff_get_comdat_section
   (bfd *, struct bfd_section *);
-
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index c1c5e90..846116b 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7,9 +7,7 @@
 
 /* Main header file for the bfd library -- portable access to object files.
 
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-   2012 Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
@@ -69,7 +67,7 @@
    problem for example when trying to use STRING_COMMA_LEN to build
    the arguments to the strncmp() macro.  Hence this alternative
    definition of strncmp is provided here.
-   
+
    Note - these macros do NOT work if STR2 is not a constant string.  */
 #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
   /* strcpy() can have a similar problem, but since we know we are
@@ -655,6 +653,8 @@
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean bfd_elf_get_bfd_needed_list
   (bfd *, struct bfd_link_needed_list **);
+extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
+					       const char *, bfd_vma);
 extern bfd_boolean bfd_elf_size_dynamic_sections
   (bfd *, const char *, const char *, const char *, const char *, const char *,
    const char * const *, struct bfd_link_info *, struct bfd_section **);
@@ -916,7 +916,8 @@
   (struct bfd_link_info *, struct bfd_section *);
 extern bfd_boolean elf32_arm_size_stubs
   (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
-   struct bfd_section * (*) (const char *, struct bfd_section *), void (*) (void));
+   struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int),
+   void (*) (void));
 extern bfd_boolean elf32_arm_build_stubs
   (struct bfd_link_info *);
 
@@ -935,6 +936,50 @@
 extern unsigned int _bfd_elf_ppc_at_tprel_transform
   (unsigned int, unsigned int);
 
+extern void bfd_elf64_aarch64_init_maps
+  (bfd *);
+
+extern void bfd_elf32_aarch64_init_maps
+  (bfd *);
+
+extern void bfd_elf64_aarch64_set_options
+  (bfd *, struct bfd_link_info *, int, int, int);
+
+extern void bfd_elf32_aarch64_set_options
+  (bfd *, struct bfd_link_info *, int, int, int);
+
+/* ELF AArch64 mapping symbol support.  */
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP	(1 << 0)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG	(1 << 1)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER	(1 << 2)
+#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY	(~0)
+extern bfd_boolean bfd_is_aarch64_special_symbol_name
+  (const char * name, int type);
+
+/* AArch64 stub generation support for ELF64.  Called from the linker.  */
+extern int elf64_aarch64_setup_section_lists
+  (bfd *, struct bfd_link_info *);
+extern void elf64_aarch64_next_input_section
+  (struct bfd_link_info *, struct bfd_section *);
+extern bfd_boolean elf64_aarch64_size_stubs
+  (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
+   struct bfd_section * (*) (const char *, struct bfd_section *),
+   void (*) (void));
+extern bfd_boolean elf64_aarch64_build_stubs
+  (struct bfd_link_info *);
+/* AArch64 stub generation support for ELF32.  Called from the linker.  */
+extern int elf32_aarch64_setup_section_lists
+  (bfd *, struct bfd_link_info *);
+extern void elf32_aarch64_next_input_section
+  (struct bfd_link_info *, struct bfd_section *);
+extern bfd_boolean elf32_aarch64_size_stubs
+  (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
+   struct bfd_section * (*) (const char *, struct bfd_section *),
+   void (*) (void));
+extern bfd_boolean elf32_aarch64_build_stubs
+  (struct bfd_link_info *);
+
+
 /* TI COFF load page support.  */
 extern void bfd_ticoff_set_section_load_page
   (struct bfd_section *, int);
@@ -970,9 +1015,8 @@
   long symbol;
 };
 
-extern struct coff_comdat_info *bfd_coff_get_comdat_section
+extern struct coff_comdat_info * bfd_coff_get_comdat_section
   (bfd *, struct bfd_section *);
-
 /* Extracted from init.c.  */
 void bfd_init (void);
 
@@ -1021,8 +1065,16 @@
 unsigned long bfd_calc_gnu_debuglink_crc32
    (unsigned long crc, const unsigned char *buf, bfd_size_type len);
 
+char *bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out);
+
+char *bfd_get_alt_debug_link_info (bfd * abfd,
+    bfd_size_type *buildid_len,
+    bfd_byte **buildid_out);
+
 char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
 
+char *bfd_follow_gnu_debugaltlink (bfd *abfd, const char *dir);
+
 struct bfd_section *bfd_create_gnu_debuglink_section
    (bfd *abfd, const char *filename);
 
@@ -1534,12 +1586,12 @@
 } asection;
 
 /* Relax table contains information about instructions which can
-   be removed by relaxation -- replacing a long address with a 
+   be removed by relaxation -- replacing a long address with a
    short address.  */
 struct relax_table {
   /* Address where bytes may be deleted. */
   bfd_vma addr;
-  
+
   /* Number of bytes to be deleted.  */
   int size;
 };
@@ -1547,7 +1599,7 @@
 /* These sections are global, and are managed by BFD.  The application
    and target back end are not permitted to change the values in
    these sections.  */
-extern asection std_section[4];
+extern asection _bfd_std_section[4];
 
 #define BFD_ABS_SECTION_NAME "*ABS*"
 #define BFD_UND_SECTION_NAME "*UND*"
@@ -1555,13 +1607,13 @@
 #define BFD_IND_SECTION_NAME "*IND*"
 
 /* Pointer to the common section.  */
-#define bfd_com_section_ptr (&std_section[0])
+#define bfd_com_section_ptr (&_bfd_std_section[0])
 /* Pointer to the undefined section.  */
-#define bfd_und_section_ptr (&std_section[1])
+#define bfd_und_section_ptr (&_bfd_std_section[1])
 /* Pointer to the absolute section.  */
-#define bfd_abs_section_ptr (&std_section[2])
+#define bfd_abs_section_ptr (&_bfd_std_section[2])
 /* Pointer to the indirect section.  */
-#define bfd_ind_section_ptr (&std_section[3])
+#define bfd_ind_section_ptr (&_bfd_std_section[3])
 
 #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
 #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
@@ -1848,7 +1900,7 @@
 #define bfd_mach_sparc_64bit_p(mach) \
   ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
   bfd_arch_spu,       /* PowerPC SPU */
-#define bfd_mach_spu           256 
+#define bfd_mach_spu           256
   bfd_arch_mips,      /* MIPS Rxxxx */
 #define bfd_mach_mips3000              3000
 #define bfd_mach_mips3900              3900
@@ -1864,6 +1916,7 @@
 #define bfd_mach_mips5000              5000
 #define bfd_mach_mips5400              5400
 #define bfd_mach_mips5500              5500
+#define bfd_mach_mips5900              5900
 #define bfd_mach_mips6000              6000
 #define bfd_mach_mips7000              7000
 #define bfd_mach_mips8000              8000
@@ -1902,6 +1955,10 @@
   bfd_arch_k1om,   /* Intel K1OM */
 #define bfd_mach_k1om                  (1 << 6)
 #define bfd_mach_k1om_intel_syntax     (bfd_mach_k1om | bfd_mach_i386_intel_syntax)
+#define bfd_mach_i386_nacl             (1 << 7)
+#define bfd_mach_i386_i386_nacl        (bfd_mach_i386_i386 | bfd_mach_i386_nacl)
+#define bfd_mach_x86_64_nacl           (bfd_mach_x86_64 | bfd_mach_i386_nacl)
+#define bfd_mach_x64_32_nacl           (bfd_mach_x64_32 | bfd_mach_i386_nacl)
   bfd_arch_we32k,     /* AT&T WE32xxx */
   bfd_arch_tahoe,     /* CCI/Harris Tahoe */
   bfd_arch_i860,      /* Intel 860 */
@@ -2026,11 +2083,13 @@
   bfd_arch_tic6x,     /* Texas Instruments TMS320C6X */
   bfd_arch_tic80,     /* TI TMS320c80 (MVP) */
   bfd_arch_v850,      /* NEC V850 */
+  bfd_arch_v850_rh850,/* NEC V850 (using RH850 ABI) */
 #define bfd_mach_v850          1
 #define bfd_mach_v850e         'E'
 #define bfd_mach_v850e1        '1'
 #define bfd_mach_v850e2        0x4532
 #define bfd_mach_v850e2v3      0x45325633
+#define bfd_mach_v850e3v5      0x45335635 /* ('E'|'3'|'V'|'5') */
   bfd_arch_arc,       /* ARC Cores */
 #define bfd_mach_arc_5         5
 #define bfd_mach_arc_6         6
@@ -2066,6 +2125,8 @@
 #define bfd_mach_mep           1
 #define bfd_mach_mep_h1        0x6831
 #define bfd_mach_mep_c5        0x6335
+  bfd_arch_metag,
+#define bfd_mach_metag         1
   bfd_arch_ia64,      /* HP/Intel ia64 */
 #define bfd_mach_ia64_elf64    64
 #define bfd_mach_ia64_elf32    32
@@ -2120,7 +2181,7 @@
   bfd_arch_s390,      /* IBM s390 */
 #define bfd_mach_s390_31       31
 #define bfd_mach_s390_64       64
-  bfd_arch_score,     /* Sunplus score */ 
+  bfd_arch_score,     /* Sunplus score */
 #define bfd_mach_score3         3
 #define bfd_mach_score7         7
   bfd_arch_openrisc,  /* OpenRISC */
@@ -2135,7 +2196,12 @@
 #define bfd_mach_msp14          14
 #define bfd_mach_msp15          15
 #define bfd_mach_msp16          16
+#define bfd_mach_msp20          20
 #define bfd_mach_msp21          21
+#define bfd_mach_msp22          22
+#define bfd_mach_msp23          23
+#define bfd_mach_msp24          24
+#define bfd_mach_msp26          26
 #define bfd_mach_msp31          31
 #define bfd_mach_msp32          32
 #define bfd_mach_msp33          33
@@ -2143,6 +2209,10 @@
 #define bfd_mach_msp42          42
 #define bfd_mach_msp43          43
 #define bfd_mach_msp44          44
+#define bfd_mach_msp430x        45
+#define bfd_mach_msp46          46
+#define bfd_mach_msp47          47
+#define bfd_mach_msp54          54
   bfd_arch_xc16x,     /* Infineon's XC16X Series.               */
 #define bfd_mach_xc16x         1
 #define bfd_mach_xc16xl        2
@@ -2164,6 +2234,11 @@
 #define bfd_mach_tilepro   1
 #define bfd_mach_tilegx    1
 #define bfd_mach_tilegx32  2
+  bfd_arch_aarch64,   /* AArch64  */
+#define bfd_mach_aarch64 0
+#define bfd_mach_aarch64_ilp32 32
+  bfd_arch_nios2,
+#define bfd_mach_nios2 0
   bfd_arch_last
   };
 
@@ -2489,6 +2564,10 @@
   BFD_RELOC_HI16_S_PLTOFF,
   BFD_RELOC_8_PLTOFF,
 
+/* Size relocations.  */
+  BFD_RELOC_SIZE32,
+  BFD_RELOC_SIZE64,
+
 /* Relocations used by 68K ELF.  */
   BFD_RELOC_68K_GLOB_DAT,
   BFD_RELOC_68K_JMP_SLOT,
@@ -2881,6 +2960,7 @@
   BFD_RELOC_MICROMIPS_TLS_TPREL_HI16,
   BFD_RELOC_MIPS_TLS_TPREL_LO16,
   BFD_RELOC_MICROMIPS_TLS_TPREL_LO16,
+  BFD_RELOC_MIPS_EH,
 
 
 /* MIPS ELF relocations (VxWorks and PLT extensions).  */
@@ -3045,6 +3125,8 @@
   BFD_RELOC_X86_64_TLSDESC_CALL,
   BFD_RELOC_X86_64_TLSDESC,
   BFD_RELOC_X86_64_IRELATIVE,
+  BFD_RELOC_X86_64_PC32_BND,
+  BFD_RELOC_X86_64_PLT32_BND,
 
 /* ns32k relocations  */
   BFD_RELOC_NS32K_IMM_8,
@@ -3143,6 +3225,8 @@
   BFD_RELOC_PPC64_TOC16_LO_DS,
   BFD_RELOC_PPC64_PLTGOT16_DS,
   BFD_RELOC_PPC64_PLTGOT16_LO_DS,
+  BFD_RELOC_PPC64_ADDR16_HIGH,
+  BFD_RELOC_PPC64_ADDR16_HIGHA,
 
 /* PowerPC and PowerPC64 thread-local storage relocations.  */
   BFD_RELOC_PPC_TLS,
@@ -3187,6 +3271,10 @@
   BFD_RELOC_PPC64_DTPREL16_HIGHERA,
   BFD_RELOC_PPC64_DTPREL16_HIGHEST,
   BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
+  BFD_RELOC_PPC64_TPREL16_HIGH,
+  BFD_RELOC_PPC64_TPREL16_HIGHA,
+  BFD_RELOC_PPC64_DTPREL16_HIGH,
+  BFD_RELOC_PPC64_DTPREL16_HIGHA,
 
 /* IBM 370/390 relocations  */
   BFD_RELOC_I370_D12,
@@ -3964,6 +4052,46 @@
   BFD_RELOC_MEP_GNU_VTENTRY,
 
 
+/* Imagination Technologies Meta relocations.  */
+  BFD_RELOC_METAG_HIADDR16,
+  BFD_RELOC_METAG_LOADDR16,
+  BFD_RELOC_METAG_RELBRANCH,
+  BFD_RELOC_METAG_GETSETOFF,
+  BFD_RELOC_METAG_HIOG,
+  BFD_RELOC_METAG_LOOG,
+  BFD_RELOC_METAG_REL8,
+  BFD_RELOC_METAG_REL16,
+  BFD_RELOC_METAG_HI16_GOTOFF,
+  BFD_RELOC_METAG_LO16_GOTOFF,
+  BFD_RELOC_METAG_GETSET_GOTOFF,
+  BFD_RELOC_METAG_GETSET_GOT,
+  BFD_RELOC_METAG_HI16_GOTPC,
+  BFD_RELOC_METAG_LO16_GOTPC,
+  BFD_RELOC_METAG_HI16_PLT,
+  BFD_RELOC_METAG_LO16_PLT,
+  BFD_RELOC_METAG_RELBRANCH_PLT,
+  BFD_RELOC_METAG_GOTOFF,
+  BFD_RELOC_METAG_PLT,
+  BFD_RELOC_METAG_COPY,
+  BFD_RELOC_METAG_JMP_SLOT,
+  BFD_RELOC_METAG_RELATIVE,
+  BFD_RELOC_METAG_GLOB_DAT,
+  BFD_RELOC_METAG_TLS_GD,
+  BFD_RELOC_METAG_TLS_LDM,
+  BFD_RELOC_METAG_TLS_LDO_HI16,
+  BFD_RELOC_METAG_TLS_LDO_LO16,
+  BFD_RELOC_METAG_TLS_LDO,
+  BFD_RELOC_METAG_TLS_IE,
+  BFD_RELOC_METAG_TLS_IENONPIC,
+  BFD_RELOC_METAG_TLS_IENONPIC_HI16,
+  BFD_RELOC_METAG_TLS_IENONPIC_LO16,
+  BFD_RELOC_METAG_TLS_TPOFF,
+  BFD_RELOC_METAG_TLS_DTPMOD,
+  BFD_RELOC_METAG_TLS_DTPOFF,
+  BFD_RELOC_METAG_TLS_LE,
+  BFD_RELOC_METAG_TLS_LE_HI16,
+  BFD_RELOC_METAG_TLS_LE_LO16,
+
 /* These are relocations for the GETA instruction.  */
   BFD_RELOC_MMIX_GETA,
   BFD_RELOC_MMIX_GETA_1,
@@ -4063,7 +4191,7 @@
 command address) into 8 bit immediate value of LDI insn.  */
   BFD_RELOC_AVR_LO8_LDI_PM,
 
-/* This is a 16 bit reloc for the AVR that stores 8 bit value 
+/* This is a 16 bit reloc for the AVR that stores 8 bit value
 (command address) into 8 bit immediate value of LDI insn. If the address
 is beyond the 128k boundary, the linker inserts a jump stub for this reloc
 in the lower 128k.  */
@@ -4158,6 +4286,7 @@
   BFD_RELOC_RL78_HI16,
   BFD_RELOC_RL78_HI8,
   BFD_RELOC_RL78_LO16,
+  BFD_RELOC_RL78_CODE,
 
 /* Renesas RX Relocations.  */
   BFD_RELOC_RX_NEG8,
@@ -4215,12 +4344,24 @@
 /* 16 bit GOT offset.  */
   BFD_RELOC_390_GOT16,
 
+/* PC relative 12 bit shifted by 1.  */
+  BFD_RELOC_390_PC12DBL,
+
+/* 12 bit PC rel. PLT shifted by 1.  */
+  BFD_RELOC_390_PLT12DBL,
+
 /* PC relative 16 bit shifted by 1.  */
   BFD_RELOC_390_PC16DBL,
 
 /* 16 bit PC rel. PLT shifted by 1.  */
   BFD_RELOC_390_PLT16DBL,
 
+/* PC relative 24 bit shifted by 1.  */
+  BFD_RELOC_390_PC24DBL,
+
+/* 24 bit PC rel. PLT shifted by 1.  */
+  BFD_RELOC_390_PLT24DBL,
+
 /* PC relative 32 bit shifted by 1.  */
   BFD_RELOC_390_PC32DBL,
 
@@ -4293,6 +4434,8 @@
   BFD_RELOC_390_GOT20,
   BFD_RELOC_390_GOTPLT20,
   BFD_RELOC_390_TLS_GOTIE20,
+
+/* STT_GNU_IFUNC relocation.  */
   BFD_RELOC_390_IRELATIVE,
 
 /* Score relocations
@@ -4783,6 +4926,7 @@
   BFD_RELOC_H8_DIR24A8,
   BFD_RELOC_H8_DIR24R8,
   BFD_RELOC_H8_DIR32A16,
+  BFD_RELOC_H8_DISP32A16,
 
 /* Sony Xstormy16 Relocations.  */
   BFD_RELOC_XSTORMY16_REL_12,
@@ -4831,6 +4975,57 @@
   BFD_RELOC_MSP430_16_BYTE,
   BFD_RELOC_MSP430_2X_PCREL,
   BFD_RELOC_MSP430_RL_PCREL,
+  BFD_RELOC_MSP430_ABS8,
+  BFD_RELOC_MSP430X_PCR20_EXT_SRC,
+  BFD_RELOC_MSP430X_PCR20_EXT_DST,
+  BFD_RELOC_MSP430X_PCR20_EXT_ODST,
+  BFD_RELOC_MSP430X_ABS20_EXT_SRC,
+  BFD_RELOC_MSP430X_ABS20_EXT_DST,
+  BFD_RELOC_MSP430X_ABS20_EXT_ODST,
+  BFD_RELOC_MSP430X_ABS20_ADR_SRC,
+  BFD_RELOC_MSP430X_ABS20_ADR_DST,
+  BFD_RELOC_MSP430X_PCR16,
+  BFD_RELOC_MSP430X_PCR20_CALL,
+  BFD_RELOC_MSP430X_ABS16,
+  BFD_RELOC_MSP430_ABS_HI16,
+  BFD_RELOC_MSP430_PREL31,
+  BFD_RELOC_MSP430_SYM_DIFF,
+
+/* Relocations used by the Altera Nios II core.  */
+  BFD_RELOC_NIOS2_S16,
+  BFD_RELOC_NIOS2_U16,
+  BFD_RELOC_NIOS2_CALL26,
+  BFD_RELOC_NIOS2_IMM5,
+  BFD_RELOC_NIOS2_CACHE_OPX,
+  BFD_RELOC_NIOS2_IMM6,
+  BFD_RELOC_NIOS2_IMM8,
+  BFD_RELOC_NIOS2_HI16,
+  BFD_RELOC_NIOS2_LO16,
+  BFD_RELOC_NIOS2_HIADJ16,
+  BFD_RELOC_NIOS2_GPREL,
+  BFD_RELOC_NIOS2_UJMP,
+  BFD_RELOC_NIOS2_CJMP,
+  BFD_RELOC_NIOS2_CALLR,
+  BFD_RELOC_NIOS2_ALIGN,
+  BFD_RELOC_NIOS2_GOT16,
+  BFD_RELOC_NIOS2_CALL16,
+  BFD_RELOC_NIOS2_GOTOFF_LO,
+  BFD_RELOC_NIOS2_GOTOFF_HA,
+  BFD_RELOC_NIOS2_PCREL_LO,
+  BFD_RELOC_NIOS2_PCREL_HA,
+  BFD_RELOC_NIOS2_TLS_GD16,
+  BFD_RELOC_NIOS2_TLS_LDM16,
+  BFD_RELOC_NIOS2_TLS_LDO16,
+  BFD_RELOC_NIOS2_TLS_IE16,
+  BFD_RELOC_NIOS2_TLS_LE16,
+  BFD_RELOC_NIOS2_TLS_DTPMOD,
+  BFD_RELOC_NIOS2_TLS_DTPREL,
+  BFD_RELOC_NIOS2_TLS_TPREL,
+  BFD_RELOC_NIOS2_COPY,
+  BFD_RELOC_NIOS2_GLOB_DAT,
+  BFD_RELOC_NIOS2_JUMP_SLOT,
+  BFD_RELOC_NIOS2_RELATIVE,
+  BFD_RELOC_NIOS2_GOTOFF,
 
 /* IQ2000 Relocations.  */
   BFD_RELOC_IQ2000_OFFSET_16,
@@ -4985,52 +5180,52 @@
 /* Same as BFD_RELOC_32_PCREL but with an implicit -4 addend.  */
   BFD_RELOC_MACH_O_X86_64_PCREL32_4,
 
-/* This is a 32 bit reloc for the microblaze that stores the 
+/* This is a 32 bit reloc for the microblaze that stores the
 low 16 bits of a value  */
   BFD_RELOC_MICROBLAZE_32_LO,
 
-/* This is a 32 bit pc-relative reloc for the microblaze that 
+/* This is a 32 bit pc-relative reloc for the microblaze that
 stores the low 16 bits of a value  */
   BFD_RELOC_MICROBLAZE_32_LO_PCREL,
 
-/* This is a 32 bit reloc for the microblaze that stores a 
+/* This is a 32 bit reloc for the microblaze that stores a
 value relative to the read-only small data area anchor  */
   BFD_RELOC_MICROBLAZE_32_ROSDA,
 
-/* This is a 32 bit reloc for the microblaze that stores a 
+/* This is a 32 bit reloc for the microblaze that stores a
 value relative to the read-write small data area anchor  */
   BFD_RELOC_MICROBLAZE_32_RWSDA,
 
-/* This is a 32 bit reloc for the microblaze to handle 
+/* This is a 32 bit reloc for the microblaze to handle
 expressions of the form "Symbol Op Symbol"  */
   BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
 
-/* This is a 64 bit reloc that stores the 32 bit pc relative 
-value in two words (with an imm instruction).  No relocation is 
+/* This is a 64 bit reloc that stores the 32 bit pc relative
+value in two words (with an imm instruction).  No relocation is
 done here - only used for relaxing  */
   BFD_RELOC_MICROBLAZE_64_NONE,
 
-/* This is a 64 bit reloc that stores the 32 bit pc relative 
+/* This is a 64 bit reloc that stores the 32 bit pc relative
 value in two words (with an imm instruction).  The relocation is
 PC-relative GOT offset  */
   BFD_RELOC_MICROBLAZE_64_GOTPC,
 
-/* This is a 64 bit reloc that stores the 32 bit pc relative 
+/* This is a 64 bit reloc that stores the 32 bit pc relative
 value in two words (with an imm instruction).  The relocation is
 GOT offset  */
   BFD_RELOC_MICROBLAZE_64_GOT,
 
-/* This is a 64 bit reloc that stores the 32 bit pc relative 
+/* This is a 64 bit reloc that stores the 32 bit pc relative
 value in two words (with an imm instruction).  The relocation is
 PC-relative offset into PLT  */
   BFD_RELOC_MICROBLAZE_64_PLT,
 
-/* This is a 64 bit reloc that stores the 32 bit GOT relative 
+/* This is a 64 bit reloc that stores the 32 bit GOT relative
 value in two words (with an imm instruction).  The relocation is
 relative offset from _GLOBAL_OFFSET_TABLE_  */
   BFD_RELOC_MICROBLAZE_64_GOTOFF,
 
-/* This is a 32 bit reloc that stores the 32 bit GOT relative 
+/* This is a 32 bit reloc that stores the 32 bit GOT relative
 value in a word.  The relocation is relative offset from  */
   BFD_RELOC_MICROBLAZE_32_GOTOFF,
 
@@ -5038,6 +5233,325 @@
 the dynamic object into the runtime process image.  */
   BFD_RELOC_MICROBLAZE_COPY,
 
+/* Unused Reloc  */
+  BFD_RELOC_MICROBLAZE_64_TLS,
+
+/* This is a 64 bit reloc that stores the 32 bit GOT relative value
+of the GOT TLS GD info entry in two words (with an imm instruction). The
+relocation is GOT offset.  */
+  BFD_RELOC_MICROBLAZE_64_TLSGD,
+
+/* This is a 64 bit reloc that stores the 32 bit GOT relative value
+of the GOT TLS LD info entry in two words (with an imm instruction). The
+relocation is GOT offset.  */
+  BFD_RELOC_MICROBLAZE_64_TLSLD,
+
+/* This is a 32 bit reloc that stores the Module ID to GOT(n).  */
+  BFD_RELOC_MICROBLAZE_32_TLSDTPMOD,
+
+/* This is a 32 bit reloc that stores TLS offset to GOT(n+1).  */
+  BFD_RELOC_MICROBLAZE_32_TLSDTPREL,
+
+/* This is a 32 bit reloc for storing TLS offset to two words (uses imm
+instruction)  */
+  BFD_RELOC_MICROBLAZE_64_TLSDTPREL,
+
+/* This is a 64 bit reloc that stores 32-bit thread pointer relative offset
+to two words (uses imm instruction).  */
+  BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL,
+
+/* This is a 64 bit reloc that stores 32-bit thread pointer relative offset
+to two words (uses imm instruction).  */
+  BFD_RELOC_MICROBLAZE_64_TLSTPREL,
+
+/* AArch64 pseudo relocation code to mark the start of the AArch64
+relocation enumerators.  N.B. the order of the enumerators is
+important as several tables in the AArch64 bfd backend are indexed
+by these enumerators; make sure they are all synced.  */
+  BFD_RELOC_AARCH64_RELOC_START,
+
+/* AArch64 null relocation code.  */
+  BFD_RELOC_AARCH64_NONE,
+
+/* Basic absolute relocations of N bits.  These are equivalent to
+BFD_RELOC_N and they were added to assist the indexing of the howto
+table.  */
+  BFD_RELOC_AARCH64_64,
+  BFD_RELOC_AARCH64_32,
+  BFD_RELOC_AARCH64_16,
+
+/* PC-relative relocations.  These are equivalent to BFD_RELOC_N_PCREL
+and they were added to assist the indexing of the howto table.  */
+  BFD_RELOC_AARCH64_64_PCREL,
+  BFD_RELOC_AARCH64_32_PCREL,
+  BFD_RELOC_AARCH64_16_PCREL,
+
+/* AArch64 MOV[NZK] instruction with most significant bits 0 to 15
+of an unsigned address/value.  */
+  BFD_RELOC_AARCH64_MOVW_G0,
+
+/* AArch64 MOV[NZK] instruction with less significant bits 0 to 15 of
+an address/value.  No overflow checking.  */
+  BFD_RELOC_AARCH64_MOVW_G0_NC,
+
+/* AArch64 MOV[NZK] instruction with most significant bits 16 to 31
+of an unsigned address/value.  */
+  BFD_RELOC_AARCH64_MOVW_G1,
+
+/* AArch64 MOV[NZK] instruction with less significant bits 16 to 31
+of an address/value.  No overflow checking.  */
+  BFD_RELOC_AARCH64_MOVW_G1_NC,
+
+/* AArch64 MOV[NZK] instruction with most significant bits 32 to 47
+of an unsigned address/value.  */
+  BFD_RELOC_AARCH64_MOVW_G2,
+
+/* AArch64 MOV[NZK] instruction with less significant bits 32 to 47
+of an address/value.  No overflow checking.  */
+  BFD_RELOC_AARCH64_MOVW_G2_NC,
+
+/* AArch64 MOV[NZK] instruction with most signficant bits 48 to 64
+of a signed or unsigned address/value.  */
+  BFD_RELOC_AARCH64_MOVW_G3,
+
+/* AArch64 MOV[NZ] instruction with most significant bits 0 to 15
+of a signed value.  Changes instruction to MOVZ or MOVN depending on the
+value's sign.  */
+  BFD_RELOC_AARCH64_MOVW_G0_S,
+
+/* AArch64 MOV[NZ] instruction with most significant bits 16 to 31
+of a signed value.  Changes instruction to MOVZ or MOVN depending on the
+value's sign.  */
+  BFD_RELOC_AARCH64_MOVW_G1_S,
+
+/* AArch64 MOV[NZ] instruction with most significant bits 32 to 47
+of a signed value.  Changes instruction to MOVZ or MOVN depending on the
+value's sign.  */
+  BFD_RELOC_AARCH64_MOVW_G2_S,
+
+/* AArch64 Load Literal instruction, holding a 19 bit pc-relative word
+offset.  The lowest two bits must be zero and are not stored in the
+instruction, giving a 21 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_LD_LO19_PCREL,
+
+/* AArch64 ADR instruction, holding a simple 21 bit pc-relative byte offset.  */
+  BFD_RELOC_AARCH64_ADR_LO21_PCREL,
+
+/* AArch64 ADRP instruction, with bits 12 to 32 of a pc-relative page
+offset, giving a 4KB aligned page base address.  */
+  BFD_RELOC_AARCH64_ADR_HI21_PCREL,
+
+/* AArch64 ADRP instruction, with bits 12 to 32 of a pc-relative page
+offset, giving a 4KB aligned page base address, but with no overflow
+checking.  */
+  BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL,
+
+/* AArch64 ADD immediate instruction, holding bits 0 to 11 of the address.
+Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_ADD_LO12,
+
+/* AArch64 8-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST8_LO12,
+
+/* AArch64 14 bit pc-relative test bit and branch.
+The lowest two bits must be zero and are not stored in the instruction,
+giving a 16 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_TSTBR14,
+
+/* AArch64 19 bit pc-relative conditional branch and compare & branch.
+The lowest two bits must be zero and are not stored in the instruction,
+giving a 21 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_BRANCH19,
+
+/* AArch64 26 bit pc-relative unconditional branch.
+The lowest two bits must be zero and are not stored in the instruction,
+giving a 28 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_JUMP26,
+
+/* AArch64 26 bit pc-relative unconditional branch and link.
+The lowest two bits must be zero and are not stored in the instruction,
+giving a 28 bit signed byte offset.  */
+  BFD_RELOC_AARCH64_CALL26,
+
+/* AArch64 16-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST16_LO12,
+
+/* AArch64 32-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST32_LO12,
+
+/* AArch64 64-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST64_LO12,
+
+/* AArch64 128-bit load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST128_LO12,
+
+/* AArch64 Load Literal instruction, holding a 19 bit PC relative word
+offset of the global offset table entry for a symbol.  The lowest two
+bits must be zero and are not stored in the instruction, giving a 21
+bit signed byte offset.  This relocation type requires signed overflow
+checking.  */
+  BFD_RELOC_AARCH64_GOT_LD_PREL19,
+
+/* Get to the page base of the global offset table entry for a symbol as
+part of an ADRP instruction using a 21 bit PC relative value.Used in
+conjunction with BFD_RELOC_AARCH64_LD64_GOT_LO12_NC.  */
+  BFD_RELOC_AARCH64_ADR_GOT_PAGE,
+
+/* Unsigned 12 bit byte offset for 64 bit load/store from the page of
+the GOT entry for this symbol.  Used in conjunction with
+BFD_RELOC_AARCH64_ADR_GOTPAGE.  Valid in LP64 ABI only.  */
+  BFD_RELOC_AARCH64_LD64_GOT_LO12_NC,
+
+/* Unsigned 12 bit byte offset for 32 bit load/store from the page of
+the GOT entry for this symbol.  Used in conjunction with
+BFD_RELOC_AARCH64_ADR_GOTPAGE.  Valid in ILP32 ABI only.  */
+  BFD_RELOC_AARCH64_LD32_GOT_LO12_NC,
+
+/* Get to the page base of the global offset table entry for a symbols
+tls_index structure as part of an adrp instruction using a 21 bit PC
+relative value.  Used in conjunction with
+BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC.  */
+  BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21,
+
+/* Unsigned 12 bit byte offset to global offset table entry for a symbols
+tls_index structure.  Used in conjunction with
+BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21.  */
+  BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC,
+
+/* AArch64 TLS INITIAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12,
+
+/* AArch64 TLS LOCAL EXEC relocation.  */
+  BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_LD_PREL19,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_OFF_G1,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_LDR,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_ADD,
+
+/* AArch64 TLS DESC relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC_CALL,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_COPY,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_GLOB_DAT,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_JUMP_SLOT,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_RELATIVE,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_TLS_DTPMOD,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_TLS_DTPREL,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_TLS_TPREL,
+
+/* AArch64 TLS relocation.  */
+  BFD_RELOC_AARCH64_TLSDESC,
+
+/* AArch64 support for STT_GNU_IFUNC.  */
+  BFD_RELOC_AARCH64_IRELATIVE,
+
+/* AArch64 pseudo relocation code to mark the end of the AArch64
+relocation enumerators that have direct mapping to ELF reloc codes.
+There are a few more enumerators after this one; those are mainly
+used by the AArch64 assembler for the internal fixup or to select
+one of the above enumerators.  */
+  BFD_RELOC_AARCH64_RELOC_END,
+
+/* AArch64 pseudo relocation code to be used internally by the AArch64
+assembler and not (currently) written to any object files.  */
+  BFD_RELOC_AARCH64_GAS_INTERNAL_FIXUP,
+
+/* AArch64 unspecified load/store instruction, holding bits 0 to 11 of the
+address.  Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL.  */
+  BFD_RELOC_AARCH64_LDST_LO12,
+
+/* AArch64 pseudo relocation code to be used internally by the AArch64
+assembler and not (currently) written to any object files.  */
+  BFD_RELOC_AARCH64_LD_GOT_LO12_NC,
+
+/* AArch64 pseudo relocation code to be used internally by the AArch64
+assembler and not (currently) written to any object files.  */
+  BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC,
+
+/* AArch64 pseudo relocation code to be used internally by the AArch64
+assembler and not (currently) written to any object files.  */
+  BFD_RELOC_AARCH64_TLSDESC_LD_LO12_NC,
+
 /* Tilera TILEPro Relocations.  */
   BFD_RELOC_TILEPRO_COPY,
   BFD_RELOC_TILEPRO_GLOB_DAT,
@@ -5177,10 +5691,18 @@
   BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PCREL,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_GOT,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_GOT,
+  BFD_RELOC_TILEGX_IMM16_X0_HW0_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW0_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X0_HW1_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW1_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X0_HW2_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW2_PLT_PCREL,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_GOT,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_GOT,
   BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_GOT,
   BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_GOT,
+  BFD_RELOC_TILEGX_IMM16_X0_HW3_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW3_PLT_PCREL,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_GD,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_GD,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE,
@@ -5195,6 +5717,12 @@
   BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_GD,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_IE,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_IE,
+  BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL,
+  BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL,
   BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_IE,
   BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_IE,
   BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_IE,
@@ -5722,6 +6250,7 @@
   bfd_error_no_armap,
   bfd_error_no_more_archived_files,
   bfd_error_malformed_archive,
+  bfd_error_missing_dso,
   bfd_error_file_not_recognized,
   bfd_error_file_ambiguously_recognized,
   bfd_error_no_contents,
@@ -5808,6 +6337,11 @@
        BFD_SEND (abfd, _bfd_find_nearest_line, \
                  (abfd, sec, syms, off, file, func, line))
 
+#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
+                                            line, disc) \
+       BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \
+                 (abfd, sec, syms, off, file, func, line, disc))
+
 #define bfd_find_line(abfd, syms, sym, file, line) \
        BFD_SEND (abfd, _bfd_find_line, \
                  (abfd, syms, sym, file, line))
@@ -5895,24 +6429,6 @@
 
 bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
 
-struct bfd_preserve
-{
-  void *marker;
-  void *tdata;
-  flagword flags;
-  const struct bfd_arch_info *arch_info;
-  struct bfd_section *sections;
-  struct bfd_section *section_last;
-  unsigned int section_count;
-  struct bfd_hash_table section_htab;
-};
-
-bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-
-void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-
-void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-
 bfd_vma bfd_emul_get_maxpagesize (const char *);
 
 void bfd_emul_set_maxpagesize (const char *, bfd_vma);
@@ -6189,6 +6705,7 @@
   NAME##_bfd_is_target_special_symbol, \
   NAME##_get_lineno, \
   NAME##_find_nearest_line, \
+  _bfd_generic_find_nearest_line_discriminator, \
   _bfd_generic_find_line, \
   NAME##_find_inliner_info, \
   NAME##_bfd_make_debug_symbol, \
@@ -6212,6 +6729,9 @@
   bfd_boolean (*_bfd_find_nearest_line)
     (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
      const char **, const char **, unsigned int *);
+  bfd_boolean (*_bfd_find_nearest_line_discriminator)
+    (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
+     const char **, const char **, unsigned int *, unsigned int *);
   bfd_boolean (*_bfd_find_line)
     (bfd *, struct bfd_symbol **, struct bfd_symbol *,
      const char **, unsigned int *);
@@ -6435,6 +6955,9 @@
 bfd_boolean bfd_get_full_section_contents
    (bfd *abfd, asection *section, bfd_byte **ptr);
 
+void bfd_cache_section_contents
+   (asection *sec, void *contents);
+
 bfd_boolean bfd_is_section_compressed
    (bfd *abfd, asection *section);
 
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 640b420..8d0580c 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1,7 +1,5 @@
 /* Generic BFD library interface and support routines.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -22,6 +20,9 @@
    MA 02110-1301, USA.  */
 
 /*
+INODE
+typedef bfd, Error reporting, BFD front end, BFD front end
+
 SECTION
 	<<typedef bfd>>
 
@@ -340,6 +341,9 @@
    where it is needed.  The typedef's used are defined in bfd.h */
 
 /*
+INODE
+Error reporting, Miscellaneous, typedef bfd, BFD front end
+
 SECTION
 	Error reporting
 
@@ -374,6 +378,7 @@
 .  bfd_error_no_armap,
 .  bfd_error_no_more_archived_files,
 .  bfd_error_malformed_archive,
+.  bfd_error_missing_dso,
 .  bfd_error_file_not_recognized,
 .  bfd_error_file_ambiguously_recognized,
 .  bfd_error_no_contents,
@@ -406,6 +411,7 @@
   N_("Archive has no index; run ranlib to add one"),
   N_("No more archived files"),
   N_("Malformed archive"),
+  N_("DSO missing from command line"),
   N_("File format not recognized"),
   N_("File format is ambiguous"),
   N_("Section has no contents"),
@@ -727,7 +733,9 @@
   vfprintf (stderr, new_fmt, ap);
   va_end (ap);
 
-  putc ('\n', stderr);
+  /* On AIX, putc is implemented as a macro that triggers a -Wunused-value
+     warning, so use the fputc function to avoid it.  */
+  fputc ('\n', stderr);
   fflush (stderr);
 }
 
@@ -881,6 +889,9 @@
 }
 
 /*
+INODE
+Miscellaneous, Memory Usage, Error reporting, BFD front end
+
 SECTION
 	Miscellaneous
 
@@ -1424,6 +1435,11 @@
 .       BFD_SEND (abfd, _bfd_find_nearest_line, \
 .                 (abfd, sec, syms, off, file, func, line))
 .
+.#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
+.                                            line, disc) \
+.       BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \
+.                 (abfd, sec, syms, off, file, func, line, disc))
+.
 .#define bfd_find_line(abfd, syms, sym, file, line) \
 .       BFD_SEND (abfd, _bfd_find_line, \
 .                 (abfd, syms, sym, file, line))
@@ -1575,7 +1591,7 @@
   if (count > 0)
     memcpy (m->sections, secs, count * sizeof (asection *));
 
-  for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
+  for (pm = &elf_seg_map (abfd); *pm != NULL; pm = &(*pm)->next)
     ;
   *pm = m;
 
@@ -1682,128 +1698,6 @@
 }
 
 /*
-CODE_FRAGMENT
-
-.struct bfd_preserve
-.{
-.  void *marker;
-.  void *tdata;
-.  flagword flags;
-.  const struct bfd_arch_info *arch_info;
-.  struct bfd_section *sections;
-.  struct bfd_section *section_last;
-.  unsigned int section_count;
-.  struct bfd_hash_table section_htab;
-.};
-.
-*/
-
-/*
-FUNCTION
-	bfd_preserve_save
-
-SYNOPSIS
-	bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
-	When testing an object for compatibility with a particular
-	target back-end, the back-end object_p function needs to set
-	up certain fields in the bfd on successfully recognizing the
-	object.  This typically happens in a piecemeal fashion, with
-	failures possible at many points.  On failure, the bfd is
-	supposed to be restored to its initial state, which is
-	virtually impossible.  However, restoring a subset of the bfd
-	state works in practice.  This function stores the subset and
-	reinitializes the bfd.
-
-*/
-
-bfd_boolean
-bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve)
-{
-  preserve->tdata = abfd->tdata.any;
-  preserve->arch_info = abfd->arch_info;
-  preserve->flags = abfd->flags;
-  preserve->sections = abfd->sections;
-  preserve->section_last = abfd->section_last;
-  preserve->section_count = abfd->section_count;
-  preserve->section_htab = abfd->section_htab;
-
-  if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc,
-			     sizeof (struct section_hash_entry)))
-    return FALSE;
-
-  abfd->tdata.any = NULL;
-  abfd->arch_info = &bfd_default_arch_struct;
-  abfd->flags &= BFD_FLAGS_SAVED;
-  abfd->sections = NULL;
-  abfd->section_last = NULL;
-  abfd->section_count = 0;
-
-  return TRUE;
-}
-
-/*
-FUNCTION
-	bfd_preserve_restore
-
-SYNOPSIS
-	void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
-	This function restores bfd state saved by bfd_preserve_save.
-	If MARKER is non-NULL in struct bfd_preserve then that block
-	and all subsequently bfd_alloc'd memory is freed.
-
-*/
-
-void
-bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve)
-{
-  bfd_hash_table_free (&abfd->section_htab);
-
-  abfd->tdata.any = preserve->tdata;
-  abfd->arch_info = preserve->arch_info;
-  abfd->flags = preserve->flags;
-  abfd->section_htab = preserve->section_htab;
-  abfd->sections = preserve->sections;
-  abfd->section_last = preserve->section_last;
-  abfd->section_count = preserve->section_count;
-
-  /* bfd_release frees all memory more recently bfd_alloc'd than
-     its arg, as well as its arg.  */
-  if (preserve->marker != NULL)
-    {
-      bfd_release (abfd, preserve->marker);
-      preserve->marker = NULL;
-    }
-}
-
-/*
-FUNCTION
-	bfd_preserve_finish
-
-SYNOPSIS
-	void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-
-DESCRIPTION
-	This function should be called when the bfd state saved by
-	bfd_preserve_save is no longer needed.  ie. when the back-end
-	object_p function returns with success.
-
-*/
-
-void
-bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
-{
-  /* It would be nice to be able to free more memory here, eg. old
-     tdata, but that's not possible since these blocks are sitting
-     inside bfd_alloc'd memory.  The section hash is on a separate
-     objalloc.  */
-  bfd_hash_table_free (&preserve->section_htab);
-}
-
-/*
 FUNCTION
 	bfd_emul_get_maxpagesize
 
diff --git a/bfd/bfd.m4 b/bfd/bfd.m4
index 394c41a..7f86aab 100644
--- a/bfd/bfd.m4
+++ b/bfd/bfd.m4
@@ -1,5 +1,21 @@
 dnl This file was derived from acinclude.m4.
-
+dnl
+dnl   Copyright 2012 Free Software Foundation
+dnl
+dnl This file is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; see the file COPYING3.  If not see
+dnl <http://www.gnu.org/licenses/>.
+dnl
 
 dnl Check for existence of a type $1 in sys/procfs.h
 
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 43a7684..363402e 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -1,8 +1,6 @@
 /* Low-level I/O routines for BFDs.
 
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
-   Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
 
    Written by Cygnus Support.
 
@@ -89,7 +87,7 @@
 #ifdef VMS
   char *vms_attr;
 
-  /* On VMS, fopen allows file attributes as optionnal arguments.
+  /* On VMS, fopen allows file attributes as optional arguments.
      We need to use them but we'd better to use the common prototype.
      In fopen-vms.h, they are separated from the mode with a comma.
      Split here.  */
@@ -586,7 +584,7 @@
   free (bim);
   abfd->iostream = NULL;
 
-  return TRUE;
+  return 0;
 }
 
 static int
diff --git a/bfd/cache.c b/bfd/cache.c
index 574d8b2..4d46936 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -31,7 +31,7 @@
 	regard to the underlying operating system's file descriptor
 	limit (often as low as 20 open files).  The module in
 	<<cache.c>> maintains a least recently used list of
-	<<BFD_CACHE_MAX_OPEN>> files, and exports the name
+	<<bfd_cache_max_open>> files, and exports the name
 	<<bfd_cache_lookup>>, which runs around and makes sure that
 	the required BFD is open. If not, then it chooses a file to
 	close, closes it and opens the one wanted, returning its file
@@ -67,9 +67,35 @@
 };
 
 /* The maximum number of files which the cache will keep open at
-   one time.  */
+   one time.  When needed call bfd_cache_max_open to initialize.  */
 
-#define BFD_CACHE_MAX_OPEN 10
+static int max_open_files = 0;
+
+/* Set max_open_files, if not already set, to 12.5% of the allowed open
+   file descriptors, but at least 10, and return the value.  */
+static int
+bfd_cache_max_open (void)
+{
+  if (max_open_files == 0)
+    {
+      int max;
+#ifdef HAVE_GETRLIMIT
+      struct rlimit rlim;
+      if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
+	  && rlim.rlim_cur != RLIM_INFINITY)
+	max = rlim.rlim_cur / 8;
+      else
+#endif /* HAVE_GETRLIMIT */
+#ifdef _SC_OPEN_MAX
+	max = sysconf (_SC_OPEN_MAX) / 8;
+#else
+	max = 10;
+#endif /* _SC_OPEN_MAX */
+      max_open_files = max < 10 ? 10 : max;
+    }
+
+  return max_open_files;
+}
 
 /* The number of BFD files we have open.  */
 
@@ -187,7 +213,7 @@
 /* Called when the macro <<bfd_cache_lookup>> fails to find a
    quick answer.  Find a file descriptor for @var{abfd}.  If
    necessary, it open it.  If there are already more than
-   <<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
+   <<bfd_cache_max_open>> files open, it tries to close one first, to
    avoid running out of file descriptors.  It will return NULL
    if it is unable to (re)open the @var{abfd}.  */
 
@@ -362,7 +388,7 @@
 static int
 cache_bclose (struct bfd *abfd)
 {
-  return bfd_cache_close (abfd);
+  return bfd_cache_close (abfd) - 1;
 }
 
 static int
@@ -437,7 +463,7 @@
         {
           *map_addr = ret;
           *map_len = pg_len;
-          ret += offset & pagesize_m1;
+          ret = (char *) ret + (offset & pagesize_m1);
         }
     }
 #endif
@@ -466,7 +492,7 @@
 bfd_cache_init (bfd *abfd)
 {
   BFD_ASSERT (abfd->iostream != NULL);
-  if (open_files >= BFD_CACHE_MAX_OPEN)
+  if (open_files >= bfd_cache_max_open ())
     {
       if (! close_one ())
 	return FALSE;
@@ -553,7 +579,7 @@
 {
   abfd->cacheable = TRUE;	/* Allow it to be closed later.  */
 
-  if (open_files >= BFD_CACHE_MAX_OPEN)
+  if (open_files >= bfd_cache_max_open ())
     {
       if (! close_one ())
 	return NULL;
diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c
index 7155a63..5d0454c 100644
--- a/bfd/cisco-core.c
+++ b/bfd/cisco-core.c
@@ -303,13 +303,13 @@
   return (target);
 }
 
-char *
+static char *
 cisco_core_file_failing_command (bfd *abfd ATTRIBUTE_UNUSED)
 {
   return NULL;
 }
 
-int
+static int
 cisco_core_file_failing_signal (bfd *abfd ATTRIBUTE_UNUSED)
 {
   return abfd->tdata.cisco_core_data->sig;
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 62e5c9c..028e703 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -1510,14 +1510,14 @@
 	     input_bfd);
 	  bfd_set_error (bfd_error_bad_value);
 	  continue;
-	  
+
 	case ALPHA_R_GPRELLOW:
 	  (*_bfd_error_handler)
 	    (_("%B: unsupported relocation: ALPHA_R_GPRELLOW"),
 	     input_bfd);
 	  bfd_set_error (bfd_error_bad_value);
 	  continue;
-	  
+
 	default:
 	  (*_bfd_error_handler)
 	    (_("%B: unknown relocation type %d"),
@@ -2242,7 +2242,7 @@
     (unsigned (*) (bfd *,void *,void *)) bfd_void, /* reloc_out */
     alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
     alpha_ecoff_swap_scnhdr_out,
-    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, 
+    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE,
     ECOFF_NO_LONG_SECTION_NAMES, 4, FALSE, 2,
     alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
     alpha_ecoff_swap_scnhdr_in, NULL,
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index 4cdf1ac..efcf522 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -918,7 +918,7 @@
   struct coff_arm_link_hash_table * ret;
   bfd_size_type amt = sizeof (struct coff_arm_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -931,10 +931,6 @@
       return NULL;
     }
 
-  ret->thumb_glue_size   = 0;
-  ret->arm_glue_size     = 0;
-  ret->bfd_of_glue_owner = NULL;
-
   return & ret->root.root;
 }
 
diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c
index 0f1de57..1e34275 100644
--- a/bfd/coff-h8300.c
+++ b/bfd/coff-h8300.c
@@ -173,7 +173,7 @@
   struct h8300_coff_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct h8300_coff_link_hash_table);
 
-  ret = (struct h8300_coff_link_hash_table *) bfd_malloc (amt);
+  ret = (struct h8300_coff_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
   if (!_bfd_link_hash_table_init (&ret->root.root, abfd,
@@ -184,11 +184,6 @@
       return NULL;
     }
 
-  /* Initialize our data.  */
-  ret->vectors_sec = NULL;
-  ret->funcvec_hash_table = NULL;
-
-  /* OK.  Everything's initialized, return the base pointer.  */
   return &ret->root.root;
 }
 
diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c
index 1fae964..9b64599 100644
--- a/bfd/coff-h8500.c
+++ b/bfd/coff-h8500.c
@@ -222,7 +222,7 @@
 	v = (v & 0x00ffffff) | (o & 0xff00000);
 	bfd_put_32 (in_abfd, (bfd_vma) v, data  + *dst_ptr -1);
 	(*dst_ptr) += 3;
-	(*src_ptr) += 3;;
+	(*src_ptr) += 3;
       }
       break;
     case R_H8500_IMM32:
@@ -230,7 +230,7 @@
 	int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 	bfd_put_32 (in_abfd, (bfd_vma) v, data  + *dst_ptr);
 	(*dst_ptr) += 4;
-	(*src_ptr) += 4;;
+	(*src_ptr) += 4;
       }
       break;
 
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index f69f502..af92b40 100644
--- a/bfd/coff-i386.c
+++ b/bfd/coff-i386.c
@@ -607,6 +607,9 @@
 
 #include "coffcode.h"
 
+#define _bfd_generic_find_nearest_line_discriminator \
+	coff_find_nearest_line_discriminator
+
 const bfd_target
 #ifdef TARGET_SYM
   TARGET_SYM =
@@ -625,13 +628,13 @@
 
   (HAS_RELOC | EXEC_P |		/* object flags */
    HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS ),
 
   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
 #ifdef COFF_WITH_PE
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY
+   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING
 #endif
-   | SEC_CODE | SEC_DATA),
+   | SEC_CODE | SEC_DATA | SEC_EXCLUDE ),
 
 #ifdef TARGET_UNDERSCORE
   TARGET_UNDERSCORE,		/* leading underscore */
diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c
index 9eb39a5..79b4a7e 100644
--- a/bfd/coff-i860.c
+++ b/bfd/coff-i860.c
@@ -131,7 +131,7 @@
   return bfd_reloc_continue;
 }
 
-/* This is just a temporary measure until we teach bfd to generate 
+/* This is just a temporary measure until we teach bfd to generate
    these relocations.  */
 
 static bfd_reloc_status_type
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index cdcdde2..ec4d1a5 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -45,7 +45,7 @@
 mips_reflo_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type
-mips_gprel_reloc 
+mips_gprel_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 
 
@@ -1255,7 +1255,7 @@
     (unsigned (*) (bfd *,void *,void *)) bfd_void, /* reloc_out */
     mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
     mips_ecoff_swap_scnhdr_out,
-    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, 
+    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE,
     ECOFF_NO_LONG_SECTION_NAMES, 4, FALSE, 2,
     mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
     mips_ecoff_swap_scnhdr_in, NULL,
diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c
index fa04933..eb1aa81 100644
--- a/bfd/coff-ppc.c
+++ b/bfd/coff-ppc.c
@@ -301,13 +301,13 @@
 
 static bfd_reloc_status_type ppc_refhi_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc_pair_reloc 
+static bfd_reloc_status_type ppc_pair_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc_toc16_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc_section_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type ppc_secrel_reloc 
+static bfd_reloc_status_type ppc_secrel_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
 static bfd_reloc_status_type ppc_imglue_reloc
   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
@@ -316,7 +316,7 @@
    get us started, so those I'll make sure work. Those marked FIXME are either
    completely unverified or have a specific unknown marked in the comment.  */
 
-/* Relocation entries for Windows/NT on PowerPC.                             
+/* Relocation entries for Windows/NT on PowerPC.
 
    From the document "" we find the following listed as used relocs:
 
@@ -1200,7 +1200,7 @@
 	  {
 	    /* To solve this, we need to know whether or not the symbol
 	       appearing on the call instruction is a glue function or not.
-	       A glue function must announce itself via a IMGLUE reloc, and 
+	       A glue function must announce itself via a IMGLUE reloc, and
 	       the reloc contains the required toc restore instruction.  */
 	    DUMP_RELOC2 (howto->name, rel);
 
@@ -2480,10 +2480,11 @@
    HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
 
 #ifndef COFF_WITH_PE
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
+   | SEC_RELOC),		/* section flags */
 #else
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
+   | SEC_RELOC | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
 #endif
 
   0,				/* leading char */
@@ -2540,10 +2541,11 @@
    HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
 
 #ifndef COFF_WITH_PE
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
+   | SEC_RELOC),		/* section flags */
 #else
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
+   | SEC_RELOC | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
 #endif
 
   0,				/* leading char */
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 2a968bf..0386e9a 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -24,6 +24,7 @@
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
+#include "libiberty.h"
 #include "bfd.h"
 #include "bfdlink.h"
 #include "libbfd.h"
@@ -449,6 +450,23 @@
                                             line_ptr);
 }
 
+static bfd_boolean
+xcoff_find_nearest_line_discriminator (bfd *abfd,
+                                      asection *section,
+                                      asymbol **symbols,
+                                      bfd_vma offset,
+                                      const char **filename_ptr,
+                                      const char **functionname_ptr,
+                                      unsigned int *line_ptr,
+                                      unsigned int *discriminator)
+{
+  *discriminator = 0;
+  return coff_find_nearest_line_with_names (abfd, xcoff_debug_sections,
+                                            section, symbols, offset,
+                                            filename_ptr, functionname_ptr,
+                                            line_ptr);
+}
+
 
 void
 _bfd_xcoff_swap_sym_in (bfd *abfd, void * ext1, void * in1)
@@ -713,7 +731,7 @@
 
 reloc_howto_type xcoff_howto_table[] =
 {
-  /* Standard 32 bit relocation.  */
+  /* 0x00: Standard 32 bit relocation.  */
   HOWTO (R_POS,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -728,7 +746,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* 32 bit relocation, but store negative value.  */
+  /* 0x01: 32 bit relocation, but store negative value.  */
   HOWTO (R_NEG,			/* type */
 	 0,			/* rightshift */
 	 -2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -743,7 +761,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* 32 bit PC relative relocation.  */
+  /* 0x02: 32 bit PC relative relocation.  */
   HOWTO (R_REL,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -758,7 +776,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* 16 bit TOC relative relocation.  */
+  /* 0x03: 16 bit TOC relative relocation.  */
   HOWTO (R_TOC,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -773,7 +791,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* I don't really know what this is.  */
+  /* 0x04: I don't really know what this is.  */
   HOWTO (R_RTB,			/* type */
 	 1,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -788,7 +806,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* External TOC relative symbol.  */
+  /* 0x05: External TOC relative symbol.  */
   HOWTO (R_GL,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -803,7 +821,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Local TOC relative symbol.	 */
+  /* 0x06: Local TOC relative symbol.	 */
   HOWTO (R_TCL,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -820,7 +838,7 @@
 
   EMPTY_HOWTO (7),
 
-  /* Non modifiable absolute branch.  */
+  /* 0x08: Non modifiable absolute branch.  */
   HOWTO (R_BA,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -837,7 +855,7 @@
 
   EMPTY_HOWTO (9),
 
-  /* Non modifiable relative branch.  */
+  /* 0x0a: Non modifiable relative branch.  */
   HOWTO (R_BR,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -854,7 +872,7 @@
 
   EMPTY_HOWTO (0xb),
 
-  /* Indirect load.  */
+  /* 0x0c: Indirect load.  */
   HOWTO (R_RL,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -869,7 +887,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Load address.  */
+  /* 0x0d: Load address.  */
   HOWTO (R_RLA,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -886,7 +904,7 @@
 
   EMPTY_HOWTO (0xe),
 
-  /* Non-relocating reference.  Bitsize is 1 so that r_rsize is 0.  */
+  /* 0x0f: Non-relocating reference.  Bitsize is 1 so that r_rsize is 0.  */
   HOWTO (R_REF,			/* type */
 	 0,			/* rightshift */
 	 0,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -904,7 +922,7 @@
   EMPTY_HOWTO (0x10),
   EMPTY_HOWTO (0x11),
 
-  /* TOC relative indirect load.  */
+  /* 0x12: TOC relative indirect load.  */
   HOWTO (R_TRL,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -919,7 +937,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* TOC relative load address.  */
+  /* 0x13: TOC relative load address.  */
   HOWTO (R_TRLA,		/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -934,7 +952,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable relative branch.  */
+  /* 0x14: Modifiable relative branch.  */
   HOWTO (R_RRTBI,		 /* type */
 	 1,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -949,7 +967,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable absolute branch.  */
+  /* 0x15: Modifiable absolute branch.  */
   HOWTO (R_RRTBA,		 /* type */
 	 1,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -964,7 +982,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable call absolute indirect.  */
+  /* 0x16: Modifiable call absolute indirect.  */
   HOWTO (R_CAI,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -979,7 +997,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable call relative.  */
+  /* 0x17: Modifiable call relative.  */
   HOWTO (R_CREL,		/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -994,7 +1012,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch absolute.  */
+  /* 0x18: Modifiable branch absolute.  */
   HOWTO (R_RBA,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1009,7 +1027,7 @@
 	 0x03fffffc,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch absolute.  */
+  /* 0x19: Modifiable branch absolute.  */
   HOWTO (R_RBAC,		/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1024,7 +1042,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch relative.  */
+  /* 0x1a: Modifiable branch relative.  */
   HOWTO (R_RBR,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1039,7 +1057,7 @@
 	 0x03fffffc,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch absolute.  */
+  /* 0x1b: Modifiable branch absolute.  */
   HOWTO (R_RBRC,		/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1054,7 +1072,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* 16 bit Non modifiable absolute branch.  */
+  /* 0x1c: 16 bit Non modifiable absolute branch.  */
   HOWTO (R_BA,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1069,22 +1087,22 @@
 	 0xfffc,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch relative.  */
+  /* 0x1d: Modifiable branch relative.  */
   HOWTO (R_RBR,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
 	 16,			/* bitsize */
-	 FALSE,			/* pc_relative */
+	 TRUE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
 	 0,			/* special_function */
 	 "R_RBR_16",		/* name */
 	 TRUE,			/* partial_inplace */
-	 0xffff,		/* src_mask */
-	 0xffff,		/* dst_mask */
+	 0xfffc,		/* src_mask */
+	 0xfffc,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch relative.  */
+  /* 0x1e: Modifiable branch relative.  */
   HOWTO (R_RBA,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1098,7 +1116,6 @@
 	 0xffff,		/* src_mask */
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
-
 };
 
 void
@@ -1146,6 +1163,11 @@
       return &xcoff_howto_table[8];
     case BFD_RELOC_PPC_TOC16:
       return &xcoff_howto_table[3];
+    case BFD_RELOC_16:
+      /* Note that this relocation is only internally used by gas.  */
+      return &xcoff_howto_table[0xc];
+    case BFD_RELOC_PPC_B16:
+      return &xcoff_howto_table[0x1d];
     case BFD_RELOC_32:
     case BFD_RELOC_CTOR:
       return &xcoff_howto_table[0];
@@ -1496,7 +1518,7 @@
   struct areltdata *ret;
   bfd_size_type amt = sizeof (struct areltdata);
 
-  ret = (struct areltdata *) bfd_alloc (abfd, amt);
+  ret = (struct areltdata *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -2113,7 +2135,7 @@
       total_namlen += strlen (normalize_filename (sub)) + 1;
       if (sub->arelt_data == NULL)
 	{
-	  sub->arelt_data = bfd_zalloc (sub, sizeof (struct areltdata));
+	  sub->arelt_data = bfd_zmalloc (sizeof (struct areltdata));
 	  if (sub->arelt_data == NULL)
 	    return FALSE;
 	}
@@ -2329,7 +2351,7 @@
       if (current_bfd->arelt_data == NULL)
 	{
 	  size = sizeof (struct areltdata);
-	  current_bfd->arelt_data = bfd_zalloc (current_bfd, size);
+	  current_bfd->arelt_data = bfd_zmalloc (size);
 	  if (current_bfd->arelt_data == NULL)
 	    return FALSE;
 	}
@@ -2548,6 +2570,60 @@
   else
     size += SMALL_AOUTSZ;
   size += abfd->section_count * SCNHSZ;
+
+  if (info->strip != strip_all)
+    {
+      /* There can be additional sections just for dealing with overflow in
+	 reloc and lineno counts. But the numbers of relocs and lineno aren't
+	 known when bfd_sizeof_headers is called, so we compute them by
+	 summing the numbers from input sections.  */
+      struct nbr_reloc_lineno
+      {
+	unsigned int reloc_count;
+	unsigned int lineno_count;
+      };
+      struct nbr_reloc_lineno *n_rl;
+      bfd *sub;
+      int max_index;
+      asection *s;
+
+      /* Although the number of sections is known, the maximum value of
+	 section->index isn't (because some sections may have been removed).
+	 Don't try to renumber sections, just compute the upper bound.  */
+      max_index = 0;
+      for (s = abfd->sections; s != NULL; s = s->next)
+	if (s->index > max_index)
+	  max_index = s->index;
+
+      /* Allocate the per section counters. It could be possible to use a
+	 preallocated array as the number of sections is limited on XCOFF,
+	 but this creates a maintainance issue.  */
+      n_rl = bfd_zmalloc ((max_index + 1) * sizeof (*n_rl));
+      if (n_rl == NULL)
+	return -1;
+
+      /* Sum.  */
+      for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+	for (s = sub->sections; s != NULL; s = s->next)
+	  {
+	    struct nbr_reloc_lineno *e = &n_rl[s->output_section->index];
+	    e->reloc_count += s->reloc_count;
+	    e->lineno_count += s->lineno_count;
+	  }
+
+      /* Add the size of a section for each section with an overflow.  */
+      for (s = abfd->sections; s != NULL; s = s->next)
+	{
+	  struct nbr_reloc_lineno *e = &n_rl[s->index];
+
+	  if (e->reloc_count >= 0xffff
+	      || (e->lineno_count >= 0xffff && info->strip != strip_debugger))
+	    size += SCNHSZ;
+	}
+
+      free (n_rl);
+    }
+
   return size;
 }
 
@@ -3537,14 +3613,14 @@
 
   /* .sv64 = x_smclas == 17
      This is an invalid csect for 32 bit apps.  */
-  static const char *names[19] =
-  {
-    ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
-    ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0",
-    ".td", NULL, ".sv3264"
-  };
-
-  if ((19 >= aux->x_csect.x_smclas)
+  static const char * const names[] =
+    {
+      ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo", /* 0 - 7 */
+      ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0", /* 8 - 15 */
+      ".td", NULL, ".sv3264", NULL, ".tl", ".ul", ".te"
+    };
+  
+  if ((aux->x_csect.x_smclas < ARRAY_SIZE (names))
       && (NULL != names[aux->x_csect.x_smclas]))
     {
       return_value = bfd_make_section_anyway
@@ -4076,7 +4152,7 @@
     },
 
     /* Generic */
-    bfd_true,
+    _bfd_archive_close_and_cleanup,
     bfd_true,
     coff_new_section_hook,
     _bfd_generic_get_section_contents,
@@ -4118,6 +4194,7 @@
     coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     xcoff_find_nearest_line,
+    xcoff_find_nearest_line_discriminator,
     _bfd_generic_find_line,
     coff_find_inliner_info,
     coff_bfd_make_debug_symbol,
@@ -4331,7 +4408,7 @@
     },
 
     /* Generic */
-    bfd_true,
+    _bfd_archive_close_and_cleanup,
     bfd_true,
     coff_new_section_hook,
     _bfd_generic_get_section_contents,
@@ -4373,6 +4450,7 @@
     coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     xcoff_find_nearest_line,
+    _bfd_generic_find_nearest_line_discriminator,
     _bfd_generic_find_line,
     coff_find_inliner_info,
     coff_bfd_make_debug_symbol,
diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c
index 5814faf..c59894a 100644
--- a/bfd/coff-tic4x.c
+++ b/bfd/coff-tic4x.c
@@ -261,19 +261,31 @@
 
 
 /* TI COFF v0, DOS tools (little-endian headers).  */
-CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff0_vec, "coff0-tic4x", HAS_LOAD_PAGE, 0, '_', NULL, & ticoff0_swap_table);
+CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff0_vec, "coff0-tic4x",
+			      HAS_LOAD_PAGE, SEC_CODE | SEC_READONLY, '_',
+			      NULL, &ticoff0_swap_table);
 
 /* TI COFF v0, SPARC tools (big-endian headers).  */
-CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff0_beh_vec, "coff0-beh-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff0_vec, & ticoff0_swap_table);
+CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff0_beh_vec, "coff0-beh-tic4x",
+			      HAS_LOAD_PAGE, SEC_CODE | SEC_READONLY, '_',
+			      &tic4x_coff0_vec, &ticoff0_swap_table);
 
 /* TI COFF v1, DOS tools (little-endian headers).  */
-CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff1_vec, "coff1-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff0_beh_vec, & ticoff1_swap_table);
+CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff1_vec, "coff1-tic4x",
+			      HAS_LOAD_PAGE, SEC_CODE | SEC_READONLY, '_',
+			      &tic4x_coff0_beh_vec, &ticoff1_swap_table);
 
 /* TI COFF v1, SPARC tools (big-endian headers).  */
-CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff1_beh_vec, "coff1-beh-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff1_vec, & ticoff1_swap_table);
+CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff1_beh_vec, "coff1-beh-tic4x",
+			      HAS_LOAD_PAGE, SEC_CODE | SEC_READONLY, '_',
+			      &tic4x_coff1_vec, &ticoff1_swap_table);
 
 /* TI COFF v2, TI DOS tools output (little-endian headers).  */
-CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff2_vec, "coff2-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff1_beh_vec, COFF_SWAP_TABLE);
+CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff2_vec, "coff2-tic4x",
+			      HAS_LOAD_PAGE, SEC_CODE | SEC_READONLY, '_',
+			      &tic4x_coff1_beh_vec, COFF_SWAP_TABLE);
 
 /* TI COFF v2, TI SPARC tools output (big-endian headers).  */
-CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff2_beh_vec, "coff2-beh-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff2_vec, COFF_SWAP_TABLE);
+CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff2_beh_vec, "coff2-beh-tic4x",
+			      HAS_LOAD_PAGE, SEC_CODE | SEC_READONLY, '_',
+			      &tic4x_coff2_vec, COFF_SWAP_TABLE);
diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c
index 9afba42..8efdc20 100644
--- a/bfd/coff-tic54x.c
+++ b/bfd/coff-tic54x.c
@@ -323,15 +323,6 @@
 
 #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
 
-/* Clear the r_reserved field in relocs.  */
-#define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
-  do \
-    { \
-      dst->r_reserved[0] = 0; \
-      dst->r_reserved[1] = 0; \
-    } \
-  while (0)
-
 /* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
    coff_bad_format_hook uses BADMAG, so set that for COFF2.  The COFF1
    and COFF0 vectors use custom _bad_format_hook procs instead of setting
diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c
index 4bd96fc..c8fa5c0 100644
--- a/bfd/coff-tic80.c
+++ b/bfd/coff-tic80.c
@@ -32,7 +32,7 @@
 /* Newlib-based hosts define _CONST as a STDC-safe alias for const,
   but to the tic80 toolchain it means something altogether different.
   Since sysdep.h will have pulled in stdio.h and hence _ansi.h which
-  contains this definition, we must undef it before including the 
+  contains this definition, we must undef it before including the
   tic80-specific definition. */
 #undef _CONST
 #endif /* _CONST */
@@ -700,15 +700,6 @@
   return TRUE;
 }
 
-/* Clear the r_reserved field in relocs.  */
-#define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
-  do \
-    { \
-      dst->r_reserved[0] = 0; \
-      dst->r_reserved[1] = 0; \
-    } \
-  while (0)
-
 #define TIC80COFF 1		/* Customize coffcode.h */
 #undef C_AUTOARG		/* Clashes with TIc80's C_UEXT */
 #undef C_LASTENT		/* Clashes with TIc80's C_STATLAB */
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 4f00b78..946880e 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -18,7 +18,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.
-   
+
    Written by Kai Tietz, OneVision Software GmbH&CoKg.  */
 
 #ifndef COFF_WITH_pex64
@@ -731,6 +731,9 @@
 #define amd64coff_object_p coff_object_p
 #endif
 
+#define _bfd_generic_find_nearest_line_discriminator \
+	coff_find_nearest_line_discriminator
+
 const bfd_target
 #ifdef TARGET_SYM
   TARGET_SYM =
@@ -749,13 +752,13 @@
 
   (HAS_RELOC | EXEC_P |		/* Object flags.  */
    HAS_LINENO | HAS_DEBUG |
-   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS),
 
   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags.  */
 #if defined(COFF_WITH_PE)
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY
+   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING
 #endif
-   | SEC_CODE | SEC_DATA),
+   | SEC_CODE | SEC_DATA | SEC_EXCLUDE ),
 
 #ifdef TARGET_UNDERSCORE
   TARGET_UNDERSCORE,		/* Leading underscore.  */
diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c
index 05008cd..6af3e19 100644
--- a/bfd/coff-z80.c
+++ b/bfd/coff-z80.c
@@ -4,7 +4,7 @@
 
    This file is part of BFD, the Binary File Descriptor library.
 
-   This program is free software; you can redistribute it and/or modify 
+   This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
@@ -50,12 +50,12 @@
        FALSE);
 
 static reloc_howto_type r_jr =
-HOWTO (R_JR, 0, 0, 8, TRUE, 0, 
+HOWTO (R_JR, 0, 0, 8, TRUE, 0,
        complain_overflow_signed, 0, "r_jr", FALSE, 0, 0xFF,
        FALSE);
 
 static reloc_howto_type r_off8 =
-HOWTO (R_OFF8, 0, 0, 8, FALSE, 0, 
+HOWTO (R_OFF8, 0, 0, 8, FALSE, 0,
        complain_overflow_signed, 0,"r_off8", FALSE, 0, 0xff,
        FALSE);
 
@@ -284,6 +284,6 @@
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
 CREATE_LITTLE_COFF_TARGET_VEC (z80coff_vec, "coff-z80", 0,
-			       SEC_CODE | SEC_DATA, '\0', NULL, 
+			       SEC_CODE | SEC_DATA, '\0', NULL,
 			       COFF_SWAP_TABLE)
 
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 031385d..6c92e26 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -1373,7 +1373,7 @@
 
 reloc_howto_type xcoff64_howto_table[] =
 {
-  /* Standard 64 bit relocation.  */
+  /* 0x00: Standard 64 bit relocation.  */
   HOWTO (R_POS,			/* type */
 	 0,			/* rightshift */
 	 4,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1388,7 +1388,7 @@
 	 MINUS_ONE,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* 64 bit relocation, but store negative value.  */
+  /* 0x01: 64 bit relocation, but store negative value.  */
   HOWTO (R_NEG,			/* type */
 	 0,			/* rightshift */
 	 -4,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1403,7 +1403,7 @@
 	 MINUS_ONE,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* 32 bit PC relative relocation.  */
+  /* 0x02: 32 bit PC relative relocation.  */
   HOWTO (R_REL,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1418,7 +1418,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* 16 bit TOC relative relocation.  */
+  /* 0x03: 16 bit TOC relative relocation.  */
   HOWTO (R_TOC,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1433,7 +1433,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* I don't really know what this is.	*/
+  /* 0x04: I don't really know what this is.	*/
   HOWTO (R_RTB,			/* type */
 	 1,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1448,7 +1448,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* External TOC relative symbol.  */
+  /* 0x05: External TOC relative symbol.  */
   HOWTO (R_GL,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1463,7 +1463,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Local TOC relative symbol.	 */
+  /* 0x06: Local TOC relative symbol.	 */
   HOWTO (R_TCL,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1480,7 +1480,7 @@
 
   EMPTY_HOWTO (7),
 
-  /* Non modifiable absolute branch.  */
+  /* 0x08: Non modifiable absolute branch.  */
   HOWTO (R_BA,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1497,7 +1497,7 @@
 
   EMPTY_HOWTO (9),
 
-  /* Non modifiable relative branch.  */
+  /* 0x0a: Non modifiable relative branch.  */
   HOWTO (R_BR,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1514,7 +1514,7 @@
 
   EMPTY_HOWTO (0xb),
 
-  /* Indirect load.  */
+  /* 0x0c: Indirect load.  */
   HOWTO (R_RL,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1529,7 +1529,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Load address.  */
+  /* 0x0d: Load address.  */
   HOWTO (R_RLA,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1546,7 +1546,7 @@
 
   EMPTY_HOWTO (0xe),
 
-  /* Non-relocating reference.  Bitsize is 1 so that r_rsize is 0.  */
+  /* 0x0f: Non-relocating reference.  Bitsize is 1 so that r_rsize is 0.  */
   HOWTO (R_REF,			/* type */
 	 0,			/* rightshift */
 	 0,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1564,7 +1564,7 @@
   EMPTY_HOWTO (0x10),
   EMPTY_HOWTO (0x11),
 
-  /* TOC relative indirect load.  */
+  /* 0x12: TOC relative indirect load.  */
   HOWTO (R_TRL,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1579,7 +1579,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* TOC relative load address.	 */
+  /* 0x13: TOC relative load address.	 */
   HOWTO (R_TRLA,		/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1594,7 +1594,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable relative branch.  */
+  /* 0x14: Modifiable relative branch.  */
   HOWTO (R_RRTBI,		/* type */
 	 1,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1609,7 +1609,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable absolute branch.  */
+  /* 0x15: Modifiable absolute branch.  */
   HOWTO (R_RRTBA,		/* type */
 	 1,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1624,7 +1624,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable call absolute indirect.	 */
+  /* 0x16: Modifiable call absolute indirect.	 */
   HOWTO (R_CAI,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1639,7 +1639,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable call relative.	*/
+  /* 0x17: Modifiable call relative.	*/
   HOWTO (R_CREL,		/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1654,7 +1654,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch absolute.  */
+  /* 0x18: Modifiable branch absolute.  */
   HOWTO (R_RBA,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1669,7 +1669,7 @@
 	 0x03fffffc,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch absolute.  */
+  /* 0x19: Modifiable branch absolute.  */
   HOWTO (R_RBAC,		/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1684,7 +1684,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch relative.  */
+  /* 0x1a: Modifiable branch relative.  */
   HOWTO (R_RBR,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1699,7 +1699,7 @@
 	 0x03fffffc,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch absolute.  */
+  /* 0x1b: Modifiable branch absolute.  */
   HOWTO (R_RBRC,		/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1714,6 +1714,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
+  /* 0x1c: Standard 32 bit relocation.  */
   HOWTO (R_POS,			/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1728,7 +1729,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* 16 bit Non modifiable absolute branch.  */
+  /* 0x1d: 16 bit Non modifiable absolute branch.  */
   HOWTO (R_BA,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1743,22 +1744,22 @@
 	 0xfffc,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch relative.  */
+  /* 0x1e: Modifiable branch relative.  */
   HOWTO (R_RBR,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
 	 16,			/* bitsize */
-	 FALSE,			/* pc_relative */
+	 TRUE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
 	 0,			/* special_function */
 	 "R_RBR_16",		/* name */
 	 TRUE,			/* partial_inplace */
-	 0xffff,		/* src_mask */
-	 0xffff,		/* dst_mask */
+	 0xfffc,		/* src_mask */
+	 0xfffc,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* Modifiable branch absolute.  */
+  /* 0x1f: Modifiable branch absolute.  */
   HOWTO (R_RBA,			/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1826,6 +1827,11 @@
       return &xcoff64_howto_table[8];
     case BFD_RELOC_PPC_TOC16:
       return &xcoff64_howto_table[3];
+    case BFD_RELOC_16:
+      /* Note that this relocation is only internally used by gas.  */
+      return &xcoff64_howto_table[0xc];
+    case BFD_RELOC_PPC_B16:
+      return &xcoff64_howto_table[0x1e];
     case BFD_RELOC_32:
     case BFD_RELOC_CTOR:
       return &xcoff64_howto_table[0x1c];
@@ -2668,7 +2674,7 @@
     },
 
     /* Generic */
-    bfd_true,
+    _bfd_archive_close_and_cleanup,
     bfd_true,
     coff_new_section_hook,
     _bfd_generic_get_section_contents,
@@ -2710,6 +2716,7 @@
     coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     coff_find_nearest_line,
+    _bfd_generic_find_nearest_line_discriminator,
     _bfd_generic_find_line,
     coff_find_inliner_info,
     coff_bfd_make_debug_symbol,
@@ -2925,7 +2932,7 @@
     },
 
     /* Generic */
-    bfd_true,
+    _bfd_archive_close_and_cleanup,
     bfd_true,
     coff_new_section_hook,
     _bfd_generic_get_section_contents,
@@ -2967,6 +2974,7 @@
     coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     coff_find_nearest_line,
+    _bfd_generic_find_nearest_line_discriminator,
     _bfd_generic_find_line,
     coff_find_inliner_info,
     coff_bfd_make_debug_symbol,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 62eeb20..542b5b7 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1,7 +1,5 @@
 /* Support for the generic parts of most COFF variants, for BFD.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -119,11 +117,11 @@
 
 	The Microsoft PE variants of the Coff object file format add
 	an extension to support the use of long section names.  This
-	extension is defined in section 4 of the Microsoft PE/COFF 
+	extension is defined in section 4 of the Microsoft PE/COFF
 	specification (rev 8.1).  If a section name is too long to fit
 	into the section header's @code{s_name} field, it is instead
 	placed into the string table, and the @code{s_name} field is
-	filled with a slash ("/") followed by the ASCII decimal 
+	filled with a slash ("/") followed by the ASCII decimal
 	representation of the offset of the full name relative to the
 	string table base.
 
@@ -140,11 +138,11 @@
 	expecting the MS standard format may become confused; @file{PEview} is
 	one known example.
 
-	The functionality is supported in BFD by code implemented under 
+	The functionality is supported in BFD by code implemented under
 	the control of the macro @code{COFF_LONG_SECTION_NAMES}.  If not
 	defined, the format does not support long section names in any way.
-	If defined, it is used to initialise a flag, 
-	@code{_bfd_coff_long_section_names}, and a hook function pointer, 
+	If defined, it is used to initialise a flag,
+	@code{_bfd_coff_long_section_names}, and a hook function pointer,
 	@code{_bfd_coff_set_long_section_names}, in the Coff backend data
 	structure.  The flag controls the generation of long section names
 	in output BFDs at runtime; if it is false, as it will be by default
@@ -153,7 +151,7 @@
 	points to a function that allows the value of the flag to be altered
 	at runtime, on formats that support long section names at all; on
 	other formats it points to a stub that returns an error indication.
-	
+
 	With input BFDs, the flag is set according to whether any long section
 	names are detected while reading the section headers.  For a completely
 	new BFD, the flag is set to the default for the target format.  This
@@ -372,6 +370,7 @@
 #define STRING_SIZE_SIZE 4
 
 #define DOT_DEBUG	".debug"
+#define DOT_ZDEBUG	".zdebug"
 #define GNU_LINKONCE_WI ".gnu.linkonce.wi."
 #define GNU_LINKONCE_WT ".gnu.linkonce.wt."
 #define DOT_RELOC	".reloc"
@@ -545,7 +544,8 @@
       styp_flags = STYP_LIT;
 #endif /* _LIT */
     }
-  else if (CONST_STRNEQ (sec_name, DOT_DEBUG))
+  else if (CONST_STRNEQ (sec_name, DOT_DEBUG)
+           || CONST_STRNEQ (sec_name, DOT_ZDEBUG))
     {
       /* Handle the XCOFF debug section and DWARF2 debug sections.  */
       if (!sec_name[6])
@@ -652,6 +652,7 @@
   bfd_boolean is_dbg = FALSE;
 
   if (CONST_STRNEQ (sec_name, DOT_DEBUG)
+      || CONST_STRNEQ (sec_name, DOT_ZDEBUG)
 #ifdef COFF_LONG_SECTION_NAMES
       || CONST_STRNEQ (sec_name, GNU_LINKONCE_WI)
       || CONST_STRNEQ (sec_name, GNU_LINKONCE_WT)
@@ -704,7 +705,7 @@
        & (SEC_LINK_DUPLICATES_DISCARD | SEC_LINK_DUPLICATES_SAME_CONTENTS
           | SEC_LINK_DUPLICATES_SAME_SIZE)) != 0)
     styp_flags |= IMAGE_SCN_LNK_COMDAT;
-  
+
   /* skip LINKER_CREATED */
 
   if ((sec_flags & SEC_COFF_NOREAD) == 0)
@@ -794,6 +795,12 @@
   else if (styp_flags & STYP_PAD)
     sec_flags = 0;
 #ifdef RS6000COFF_C
+  else if (styp_flags & STYP_EXCEPT)
+    sec_flags |= SEC_LOAD;
+  else if (styp_flags & STYP_LOADER)
+    sec_flags |= SEC_LOAD;
+  else if (styp_flags & STYP_TYPCHK)
+    sec_flags |= SEC_LOAD;
   else if (styp_flags & STYP_DWARF)
     sec_flags |= SEC_DEBUGGING;
 #endif
@@ -821,6 +828,7 @@
 	sec_flags |= SEC_ALLOC;
     }
   else if (CONST_STRNEQ (name, DOT_DEBUG)
+	   || CONST_STRNEQ (name, DOT_ZDEBUG)
 #ifdef _COMMENT
 	   || strcmp (name, _COMMENT) == 0
 #endif
@@ -1158,6 +1166,7 @@
   bfd_boolean is_dbg = FALSE;
 
   if (CONST_STRNEQ (name, DOT_DEBUG)
+      || CONST_STRNEQ (name, DOT_ZDEBUG)
 #ifdef COFF_LONG_SECTION_NAMES
       || CONST_STRNEQ (name, GNU_LINKONCE_WI)
       || CONST_STRNEQ (name, GNU_LINKONCE_WT)
@@ -1380,7 +1389,7 @@
 .  bfd_boolean _bfd_coff_long_section_names;
 .  bfd_boolean (*_bfd_coff_set_long_section_names)
 .    (bfd *, int);
-.  
+.
 .  unsigned int _bfd_coff_default_section_alignment_power;
 .  bfd_boolean _bfd_coff_force_symnames_in_strings;
 .  unsigned int _bfd_coff_debug_string_prefix_length;
@@ -3354,36 +3363,38 @@
 	     padding the previous section up if necessary.  */
 	  old_sofar = sofar;
 
+	  sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+
 #ifdef RS6000COFF_C
-	  /* AIX loader checks the text section alignment of (vma - filepos)
-	     So even though the filepos may be aligned wrt the o_algntext, for
-	     AIX executables, this check fails. This shows up when a native
-	     AIX executable is stripped with gnu strip because the default vma
-	     of native is 0x10000150 but default for gnu is 0x10000140.  Gnu
-	     stripped gnu excutable passes this check because the filepos is
-	     0x0140.  This problem also show up with 64 bit shared objects. The
-	     data section must also be aligned.  */
+	  /* Make sure the file offset and the vma of .text/.data are at the
+	     same page offset, so that the file can be mmap'ed without being
+	     relocated.  Failing that, AIX is able to load and execute the
+	     program, but it will be silently relocated (possible as
+	     executables are PIE).  But the relocation is slightly costly and
+	     complexify the use of addr2line or gdb.  So better to avoid it,
+	     like does the native linker.  Usually gnu ld makes sure that
+	     the vma of .text is the file offset so this issue shouldn't
+	     appear unless you are stripping such an executable.
+
+	     AIX loader checks the text section alignment of (vma - filepos),
+	     and the native linker doesn't try to align the text sections.
+	     For example:
+
+	     0 .text         000054cc  10000128  10000128  00000128  2**5
+                             CONTENTS, ALLOC, LOAD, CODE
+	  */
+
 	  if (!strcmp (current->name, _TEXT)
 	      || !strcmp (current->name, _DATA))
 	    {
-	      bfd_vma pad;
-	      bfd_vma align;
+	      bfd_vma align = 4096;
+	      bfd_vma sofar_off = sofar % align;
+	      bfd_vma vma_off = current->vma % align;
 
-	      sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
-
-	      align = 1 << current->alignment_power;
-	      pad = abs (current->vma - sofar) % align;
-
-	      if (pad)
-		{
-		  pad = align - pad;
-		  sofar += pad;
-		}
-	    }
-	  else
-#else
-	    {
-	      sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+	      if (vma_off > sofar_off)
+		sofar += vma_off - sofar_off;
+	      else if (vma_off < sofar_off)
+		sofar += align + vma_off - sofar_off;
 	    }
 #endif
 	  if (previous != NULL)
@@ -3442,7 +3453,7 @@
 	 incremented in coff_set_section_contents.  This is right for
 	 SVR3.2.  */
       if (strcmp (current->name, _LIB) == 0)
-	bfd_set_section_vma (abfd, current, 0);
+	(void) bfd_set_section_vma (abfd, current, 0);
 #endif
 
 #ifdef ALIGN_SECTIONS_IN_FILE
@@ -3944,7 +3955,7 @@
 	  bfd_size_type amt;
 
 	  internal_f.f_nscns++;
-	  strncpy (&(scnhdr.s_name[0]), current->name, 8);
+	  memcpy (scnhdr.s_name, ".ovrflo", 8);
 	  scnhdr.s_paddr = current->reloc_count;
 	  scnhdr.s_vaddr = current->lineno_count;
 	  scnhdr.s_size = 0;
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index c0505c6..07a527d 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -91,7 +91,7 @@
              don't know the length of the string table.  */
 	  strings += strindex;
 	  name = (char *) bfd_alloc (abfd,
-                                     (bfd_size_type) strlen (strings) + 1);
+                                     (bfd_size_type) strlen (strings) + 1 + 1);
 	  if (name == NULL)
 	    return FALSE;
 	  strcpy (name, strings);
@@ -102,7 +102,7 @@
     {
       /* Assorted wastage to null-terminate the name, thanks AT&T! */
       name = (char *) bfd_alloc (abfd,
-                                 (bfd_size_type) sizeof (hdr->s_name) + 1);
+                                 (bfd_size_type) sizeof (hdr->s_name) + 1 + 1);
       if (name == NULL)
 	return FALSE;
       strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
@@ -146,13 +146,87 @@
   if (hdr->s_scnptr != 0)
     return_section->flags |= SEC_HAS_CONTENTS;
 
+  /* Compress/decompress DWARF debug sections with names: .debug_* and
+     .zdebug_*, after the section flags is set.  */
+  if ((flags & SEC_DEBUGGING)
+      && ((name[1] == 'd' && name[6] == '_')
+	  || (name[1] == 'z' && name[7] == '_')))
+    {
+      enum { nothing, compress, decompress } action = nothing;
+      char *new_name = NULL;
+
+      if (bfd_is_section_compressed (abfd, return_section))
+	{
+	  /* Compressed section.  Check if we should decompress.  */
+	  if ((abfd->flags & BFD_DECOMPRESS))
+	    action = decompress;
+	}
+      else if (!bfd_is_section_compressed (abfd, return_section))
+	{
+	  /* Normal section.  Check if we should compress.  */
+	  if ((abfd->flags & BFD_COMPRESS) && return_section->size != 0)
+	    action = compress;
+	}
+
+      switch (action)
+	{
+	case nothing:
+	  break;
+	case compress:
+	  if (!bfd_init_section_compress_status (abfd, return_section))
+	    {
+	      (*_bfd_error_handler)
+		(_("%B: unable to initialize compress status for section %s"),
+		 abfd, name);
+	      return FALSE;
+	    }
+	  if (name[1] != 'z')
+	    {
+	      unsigned int len = strlen (name);
+
+	      new_name = bfd_alloc (abfd, len + 2);
+	      if (new_name == NULL)
+		return FALSE;
+	      new_name[0] = '.';
+	      new_name[1] = 'z';
+	      memcpy (new_name + 2, name + 1, len);
+	    }
+	  break;
+	case decompress:
+	  if (!bfd_init_section_decompress_status (abfd, return_section))
+	    {
+	      (*_bfd_error_handler)
+		(_("%B: unable to initialize decompress status for section %s"),
+		 abfd, name);
+	      return FALSE;
+	    }
+	  if (name[1] == 'z')
+	    {
+	      unsigned int len = strlen (name);
+
+	      new_name = bfd_alloc (abfd, len);
+	      if (new_name == NULL)
+		return FALSE;
+	      new_name[0] = '.';
+	      memcpy (new_name + 1, name + 2, len - 1);
+	    }
+	  break;
+	}
+      if (new_name != NULL)
+	bfd_rename_section (abfd, return_section, new_name);
+    }
+
   return result;
 }
 
 /* Read in a COFF object and make it into a BFD.  This is used by
    ECOFF as well.  */
-
-static const bfd_target *
+const bfd_target *
+coff_real_object_p (bfd *,
+                    unsigned,
+                    struct internal_filehdr *,
+                    struct internal_aouthdr *);
+const bfd_target *
 coff_real_object_p (bfd *abfd,
 		    unsigned nscns,
 		    struct internal_filehdr *internal_f,
@@ -577,7 +651,7 @@
 		    struct internal_syment *syment)
 {
   /* Normalize the symbol flags.  */
-  if (coff_symbol_ptr->symbol.section 
+  if (coff_symbol_ptr->symbol.section
       && bfd_is_com_section (coff_symbol_ptr->symbol.section))
     {
       /* A common symbol is undefined with a value.  */
@@ -1449,7 +1523,7 @@
   /* Otherwise patch up.  */
 #define N_TMASK coff_data  (abfd)->local_n_tmask
 #define N_BTSHFT coff_data (abfd)->local_n_btshft
-  
+
   if ((ISFCN (type) || ISTAG (n_sclass) || n_sclass == C_BLOCK
        || n_sclass == C_FCN)
       && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
@@ -1872,7 +1946,7 @@
   new_symbol->lineno = NULL;
   new_symbol->done_lineno = FALSE;
   new_symbol->symbol.the_bfd = abfd;
-  
+
   return & new_symbol->symbol;
 }
 
@@ -2153,7 +2227,7 @@
   if (_bfd_dwarf2_find_nearest_line (abfd, debug_sections,
                                      section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr, 0,
+				     line_ptr, NULL, 0,
 				     &coff_data(abfd)->dwarf2_find_line_info))
     return TRUE;
 
@@ -2349,6 +2423,24 @@
 }
 
 bfd_boolean
+coff_find_nearest_line_discriminator (bfd *abfd,
+				      asection *section,
+				      asymbol **symbols,
+				      bfd_vma offset,
+				      const char **filename_ptr,
+				      const char **functionname_ptr,
+				      unsigned int *line_ptr,
+				      unsigned int *discriminator)
+{
+  *discriminator = 0;
+  return coff_find_nearest_line_with_names (abfd, dwarf_debug_sections,
+                                            section, symbols, offset,
+                                            filename_ptr, functionname_ptr,
+                                            line_ptr);
+}
+
+
+bfd_boolean
 coff_find_inliner_info (bfd *abfd,
 			const char **filename_ptr,
 			const char **functionname_ptr,
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index dd3e4b1..948b4cd 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -605,7 +605,7 @@
 	{
 	  bfd_size_type string_offset = 0;
 	  asection *stab;
-	  
+
 	  for (stab = abfd->sections; stab; stab = stab->next)
 	    if (CONST_STRNEQ (stab->name, ".stab")
 		&& (!stab->name[5]
@@ -614,7 +614,7 @@
 	      struct coff_link_hash_table *table;
 	      struct coff_section_tdata *secdata
 		= coff_section_data (abfd, stab);
-	      
+
 	      if (secdata == NULL)
 		{
 		  amt = sizeof (struct coff_section_tdata);
@@ -1159,7 +1159,7 @@
 		 elsewhere. */
 	      struct internal_reloc incount;
 	      bfd_byte *excount = (bfd_byte *)bfd_malloc (relsz);
-	      
+
 	      memset (&incount, 0, sizeof (incount));
 	      incount.r_vaddr = o->reloc_count + 1;
 	      bfd_coff_swap_reloc_out (abfd, &incount, excount);
@@ -1424,7 +1424,8 @@
       struct internal_reloc *	irel;
       struct internal_reloc *	irelend;
 
-      if ((a->flags & SEC_RELOC) == 0 || a->reloc_count  < 1)
+      if ((a->flags & SEC_RELOC) == 0 || a->reloc_count  < 1
+	  || a->linker_mark == 0)
 	continue;
       /* Don't mark relocs in excluded sections.  */
       if (a->output_section == bfd_abs_section_ptr)
@@ -2426,10 +2427,9 @@
 	contents = secdata->contents;
       else
 	{
-	  bfd_size_type x = o->rawsize ? o->rawsize : o->size;
-	  if (! bfd_get_section_contents (input_bfd, o, flaginfo->contents, 0, x))
-	    return FALSE;
 	  contents = flaginfo->contents;
+	  if (! bfd_get_full_section_contents (input_bfd, o, &contents))
+	    return FALSE;
 	}
 
       if ((o->flags & SEC_RELOC) != 0)
@@ -2447,7 +2447,8 @@
 			       ? (flaginfo->section_info[target_index].relocs
 				  + o->output_section->reloc_count)
 			       : flaginfo->internal_relocs)));
-	  if (internal_relocs == NULL)
+	  if (internal_relocs == NULL
+	      && o->reloc_count > 0)
 	    return FALSE;
 
 	  /* Run through the relocs looking for relocs against symbols
diff --git a/bfd/compress.c b/bfd/compress.c
index 52c884c..46c2bcb 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -45,19 +45,20 @@
   strm.next_in = (Bytef*) compressed_buffer + 12;
   strm.avail_out = uncompressed_size;
 
+  BFD_ASSERT (Z_OK == 0);
   rc = inflateInit (&strm);
-  while (strm.avail_in > 0)
+  while (strm.avail_in > 0 && strm.avail_out > 0)
     {
       if (rc != Z_OK)
-	return FALSE;
+	break;
       strm.next_out = ((Bytef*) uncompressed_buffer
                        + (uncompressed_size - strm.avail_out));
       rc = inflate (&strm, Z_FINISH);
       if (rc != Z_STREAM_END)
-	return FALSE;
+	break;
       rc = inflateReset (&strm);
     }
-  rc = inflateEnd (&strm);
+  rc |= inflateEnd (&strm);
   return rc == Z_OK && strm.avail_out == 0;
 }
 #endif
@@ -79,7 +80,7 @@
 	field was allocated using bfd_malloc() or equivalent.  If zlib
 	is not installed on this machine, the input is unmodified.
 
-	Return @code{TRUE} if the full section contents is compressed 
+	Return @code{TRUE} if the full section contents is compressed
 	successfully.
 */
 
@@ -148,7 +149,7 @@
 DESCRIPTION
 	Read all data from @var{section} in BFD @var{abfd}, decompress
 	if needed, and store in @var{*ptr}.  If @var{*ptr} is NULL,
-	return @var{*ptr} with memory malloc'd by this function.  
+	return @var{*ptr} with memory malloc'd by this function.
 
 	Return @code{TRUE} if the full section contents is retrieved
 	successfully.
@@ -161,11 +162,9 @@
   bfd_byte *p = *ptr;
 #ifdef HAVE_ZLIB_H
   bfd_boolean ret;
-  bfd_size_type compressed_size;
-  bfd_size_type uncompressed_size;
-  bfd_size_type rawsize;
+  bfd_size_type save_size;
+  bfd_size_type save_rawsize;
   bfd_byte *compressed_buffer;
-  bfd_byte *uncompressed_buffer;
 #endif
 
   if (abfd->direction != write_direction && sec->rawsize != 0)
@@ -199,45 +198,44 @@
       return FALSE;
 #else
       /* Read in the full compressed section contents.  */
-      uncompressed_size = sec->size;
-      compressed_size = sec->compressed_size;
-      compressed_buffer = (bfd_byte *) bfd_malloc (compressed_size);
+      compressed_buffer = (bfd_byte *) bfd_malloc (sec->compressed_size);
       if (compressed_buffer == NULL)
 	return FALSE;
-      rawsize = sec->rawsize;
+      save_rawsize = sec->rawsize;
+      save_size = sec->size;
       /* Clear rawsize, set size to compressed size and set compress_status
 	 to COMPRESS_SECTION_NONE.  If the compressed size is bigger than
 	 the uncompressed size, bfd_get_section_contents will fail.  */
       sec->rawsize = 0;
-      sec->size = compressed_size;
+      sec->size = sec->compressed_size;
       sec->compress_status = COMPRESS_SECTION_NONE;
       ret = bfd_get_section_contents (abfd, sec, compressed_buffer,
-				      0, compressed_size);
+				      0, sec->compressed_size);
       /* Restore rawsize and size.  */
-      sec->rawsize = rawsize;
-      sec->size = uncompressed_size;
+      sec->rawsize = save_rawsize;
+      sec->size = save_size;
       sec->compress_status = DECOMPRESS_SECTION_SIZED;
       if (!ret)
 	goto fail_compressed;
 
-      uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
-      if (uncompressed_buffer == NULL)
+      if (p == NULL)
+	p = (bfd_byte *) bfd_malloc (sz);
+      if (p == NULL)
 	goto fail_compressed;
 
-      if (!decompress_contents (compressed_buffer, compressed_size,
-				uncompressed_buffer, uncompressed_size))
+      if (!decompress_contents (compressed_buffer, sec->compressed_size, p, sz))
 	{
 	  bfd_set_error (bfd_error_bad_value);
-	  free (uncompressed_buffer);
+	  if (p != *ptr)
+	    free (p);
 	fail_compressed:
 	  free (compressed_buffer);
 	  return FALSE;
 	}
 
       free (compressed_buffer);
-      sec->contents = uncompressed_buffer;
-      sec->compress_status = COMPRESS_SECTION_DONE;
-      /* Fall thru */
+      *ptr = p;
+      return TRUE;
 #endif
 
     case COMPRESS_SECTION_DONE:
@@ -258,6 +256,29 @@
 
 /*
 FUNCTION
+	bfd_cache_section_contents
+
+SYNOPSIS
+	void bfd_cache_section_contents
+	  (asection *sec, void *contents);
+
+DESCRIPTION
+	Stash @var(contents) so any following reads of @var(sec) do
+	not need to decompress again.
+*/
+
+void
+bfd_cache_section_contents (asection *sec, void *contents)
+{
+  if (sec->compress_status == DECOMPRESS_SECTION_SIZED)
+    sec->compress_status = COMPRESS_SECTION_DONE;
+  sec->contents = contents;
+  sec->flags |= SEC_IN_MEMORY;
+}
+
+
+/*
+FUNCTION
 	bfd_is_section_compressed
 
 SYNOPSIS
@@ -272,11 +293,20 @@
 bfd_is_section_compressed (bfd *abfd, sec_ptr sec)
 {
   bfd_byte compressed_buffer [12];
+  unsigned int saved = sec->compress_status;
+  bfd_boolean compressed;
+
+  /* Don't decompress the section.  */
+  sec->compress_status = COMPRESS_SECTION_NONE;
 
   /* Read the zlib header.  In this case, it should be "ZLIB" followed
      by the uncompressed section size, 8 bytes in big-endian order.  */
-  return (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)
-	  && CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"));
+  compressed = (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)
+		&& CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"));
+
+  /* Restore compress_status.  */
+  sec->compress_status = saved;
+  return compressed;
 }
 
 /*
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 783d1f3..5324d39 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -1,4 +1,21 @@
 # config.bfd
+#
+#   Copyright 2012, 2013 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
 # Convert a canonical host type into a BFD host type.
 # Set shell variable targ to canonical target name, and run
 # using ``. config.bfd''.
@@ -69,6 +86,7 @@
 
 targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 case "${targ_cpu}" in
+aarch64*)	 targ_archs="bfd_aarch64_arch bfd_arm_arch";;
 alpha*)		 targ_archs=bfd_alpha_arch ;;
 am34*|am33_2.0*) targ_archs=bfd_mn10300_arch ;;
 arm*)		 targ_archs=bfd_arm_arch ;;
@@ -91,6 +109,7 @@
 m88*)		 targ_archs=bfd_m88k_arch ;;
 microblaze*)	 targ_archs=bfd_microblaze_arch ;;
 mips*)		 targ_archs=bfd_mips_arch ;;
+nios2*)          targ_archs=bfd_nios2_arch ;;
 or32*)		 targ_archs=bfd_or32_arch ;;
 pdp11*)		 targ_archs=bfd_pdp11_arch ;;
 pj*)		 targ_archs="bfd_pj_arch bfd_i386_arch";;
@@ -102,7 +121,7 @@
 spu*)            targ_archs=bfd_spu_arch ;;
 tilegx*)	 targ_archs=bfd_tilegx_arch ;;
 tilepro*)	 targ_archs=bfd_tilepro_arch ;;
-v850*)		 targ_archs=bfd_v850_arch ;;
+v850*)		 targ_archs="bfd_v850_arch bfd_v850_rh850_arch" ;;
 x86_64*)	 targ_archs=bfd_i386_arch ;;
 xtensa*)	 targ_archs=bfd_xtensa_arch ;;
 xgate)		 targ_archs=bfd_xgate_arch ;;
@@ -143,6 +162,26 @@
 
 # START OF targmatch.h
 #ifdef BFD64
+  aarch64-*-elf)
+    targ_defvec=bfd_elf64_littleaarch64_vec
+    targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
+    want64=true
+    ;;
+  aarch64_be-*-elf)
+    targ_defvec=bfd_elf64_bigaarch64_vec
+    targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec"
+    want64=true
+    ;;
+  aarch64-*-linux*)
+    targ_defvec=bfd_elf64_littleaarch64_vec
+    targ_selvecs="bfd_elf64_bigaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
+    want64=true
+    ;;
+  aarch64_be-*-linux*)
+    targ_defvec=bfd_elf64_bigaarch64_vec
+    targ_selvecs="bfd_elf64_littleaarch64_vec bfd_elf32_littleaarch64_vec bfd_elf32_bigaarch64_vec bfd_elf32_bigarm_vec bfd_elf32_littlearm_vec"
+    want64=true
+    ;;
   alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
     targ_defvec=bfd_elf64_alpha_freebsd_vec
     targ_selvecs="bfd_elf64_alpha_vec ecoffalpha_little_vec"
@@ -163,7 +202,7 @@
     targ_selvecs=nlm32_alpha_vec
     want64=true
     ;;
-  alpha*-*-linuxecoff*)
+  alpha*-*-linux*ecoff*)
     targ_defvec=ecoffalpha_little_vec
     targ_selvecs=bfd_elf64_alpha_vec
     want64=true
@@ -340,7 +379,7 @@
     targ_underscore=yes
     ;;
 
-  cr16-*-elf*)
+  cr16-*-elf* | cr16*-*-uclinux*)
     targ_defvec=bfd_elf32_cr16_vec
     targ_underscore=yes
     ;;
@@ -397,8 +436,9 @@
     targ_selvecs=bfd_elf32_frv_vec
     ;;
 
-  moxie-*-elf | moxie-*-rtems | moxie-*-uclinux)
-    targ_defvec=bfd_elf32_moxie_vec
+  moxie-*-elf | moxie-*-rtems* | moxie-*-uclinux)
+    targ_defvec=bfd_elf32_bigmoxie_vec
+    targ_selvecs=bfd_elf32_littlemoxie_vec
     ;;
 
   h8300*-*-rtemscoff*)
@@ -582,7 +622,7 @@
   i[3-7]86-*-linux-*)
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs="i386linux_vec i386pei_vec"
-    targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf32_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
+    targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf32_x86_64_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
     ;;
   i[3-7]86-*-nacl*)
     targ_defvec=bfd_elf32_i386_nacl_vec
@@ -604,7 +644,7 @@
     ;;
   x86_64-*-elf*)
     targ_defvec=bfd_elf64_x86_64_vec
-    targ_selvecs="bfd_elf32_i386_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec i386coff_vec"
+    targ_selvecs="bfd_elf32_i386_vec bfd_elf32_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
     want64=true
     ;;
   x86_64-*-dragonfly*)
@@ -633,12 +673,16 @@
     targ_archs="$targ_archs bfd_arm_arch"
     want64=true
     ;;
-  x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep)
+  x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin)
     targ_defvec=x86_64pe_vec
     targ_selvecs="x86_64pe_vec x86_64pei_vec bfd_elf64_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec i386pe_vec i386pei_vec bfd_elf32_i386_vec"
     want64=true
     targ_underscore=no
     ;;
+  x86_64-*-rdos*)
+    targ_defvec=bfd_elf64_x86_64_vec
+    want64=true
+    ;;
 #endif
   i[3-7]86-*-lynxos*)
     targ_defvec=bfd_elf32_i386_vec
@@ -894,14 +938,26 @@
     targ_selvecs=bfd_elf32_mep_little_vec
     ;;
 
+  metag-*-*)
+    targ_defvec=bfd_elf32_metag_vec
+    targ_underscore=yes
+    ;;
+
+  microblazeel*-*)
+    targ_defvec=bfd_elf32_microblazeel_vec
+    targ_selvecs=bfd_elf32_microblaze_vec
+    ;;
+
   microblaze*-*)
     targ_defvec=bfd_elf32_microblaze_vec
+    targ_selvecs=bfd_elf32_microblazeel_vec
     ;;
 
   mips*-big-*)
     targ_defvec=ecoff_big_vec
     targ_selvecs=ecoff_little_vec
     ;;
+#ifdef BFD64
   mips*el-*-netbsd*)
     targ_defvec=bfd_elf32_tradlittlemips_vec
     targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_little_vec ecoff_big_vec"
@@ -910,6 +966,7 @@
     targ_defvec=bfd_elf32_tradbigmips_vec
     targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
     ;;
+#endif
   mips*-dec-* | mips*el-*-ecoff*)
     targ_defvec=ecoff_little_vec
     targ_selvecs=ecoff_big_vec
@@ -922,13 +979,20 @@
   mips*-*-irix6*)
     targ_defvec=bfd_elf32_nbigmips_vec
     targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
-    want64=true
     ;;
-#endif
+  mips64*-ps2-elf*)
+    targ_defvec=bfd_elf32_nlittlemips_vec
+    targ_selvecs="bfd_elf32_nlittlemips_vec bfd_elf32_nbigmips_vec bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+    ;;
+  mips*-ps2-elf*)
+    targ_defvec=bfd_elf32_littlemips_vec
+    targ_selvecs="bfd_elf32_bigmips_vec bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
+    ;;
   mips*-*-irix5*)
     targ_defvec=bfd_elf32_bigmips_vec
     targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
     ;;
+#endif
   mips*-sgi-* | mips*-*-bsd*)
     targ_defvec=ecoff_big_vec
     targ_selvecs=ecoff_little_vec
@@ -937,10 +1001,12 @@
     targ_defvec=ecoff_biglittle_vec
     targ_selvecs="ecoff_little_vec ecoff_big_vec"
     ;;
+#ifdef BFD64
   mips*-*-sysv4*)
     targ_defvec=bfd_elf32_tradbigmips_vec
     targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
     ;;
+#endif
   mips*-*-sysv* | mips*-*-riscos*)
     targ_defvec=ecoff_big_vec
     targ_selvecs=ecoff_little_vec
@@ -949,23 +1015,18 @@
   mips*el-*-vxworks*)
     targ_defvec=bfd_elf32_littlemips_vxworks_vec
     targ_selvecs="bfd_elf32_littlemips_vec bfd_elf32_bigmips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
-    want64=true
     ;;
   mips*-*-vxworks*)
     targ_defvec=bfd_elf32_bigmips_vxworks_vec
     targ_selvecs="bfd_elf32_bigmips_vec bfd_elf32_littlemips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
-    want64=true
     ;;
-#endif
   mips*el-sde-elf*)
     targ_defvec=bfd_elf32_tradlittlemips_vec
     targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
-    want64=true
     ;;
-  mips*-sde-elf*)
+  mips*-sde-elf* | mips*-mti-elf*)
     targ_defvec=bfd_elf32_tradbigmips_vec
     targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
-    want64=true
     ;;
   mips*el-*-elf* | mips*el-*-vxworks* | mips*-*-chorus*)
     targ_defvec=bfd_elf32_littlemips_vec
@@ -979,13 +1040,10 @@
     targ_defvec=bfd_elf32_bigmips_vec
     targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
     ;;
-#ifdef BFD64
   mips64*-*-openbsd*)
     targ_defvec=bfd_elf64_tradbigmips_vec
     targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
-    want64=true
     ;;
-#endif
   mips*el-*-openbsd*)
     targ_defvec=bfd_elf32_littlemips_vec
     targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
@@ -994,36 +1052,28 @@
     targ_defvec=bfd_elf32_bigmips_vec
     targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec"
     ;;
-#ifdef BFD64
   mips64*el-*-linux*)
     targ_defvec=bfd_elf32_ntradlittlemips_vec
     targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
-    want64=true
     ;;
   mips64*-*-linux*)
     targ_defvec=bfd_elf32_ntradbigmips_vec
     targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
-    want64=true
     ;;
-#endif
   mips*el-*-linux*)
     targ_defvec=bfd_elf32_tradlittlemips_vec
     targ_selvecs="bfd_elf32_tradbigmips_vec ecoff_little_vec ecoff_big_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec"
-    want64=true
     ;;
   mips*-*-linux*)
     targ_defvec=bfd_elf32_tradbigmips_vec
     targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec"
-    want64=true
     ;;
-#ifdef BFD64
   mips64*el-*-freebsd* | mips64*el-*-kfreebsd*-gnu)
     # FreeBSD vectors
     targ_defvec=bfd_elf32_ntradlittlemips_freebsd_vec
     targ_selvecs="bfd_elf32_ntradbigmips_freebsd_vec bfd_elf32_tradlittlemips_freebsd_vec bfd_elf32_tradbigmips_freebsd_vec bfd_elf64_tradlittlemips_freebsd_vec bfd_elf64_tradbigmips_freebsd_vec"
     # Generic vectors
     targ_selvecs="${targ_selvecs} bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
-    want64=true
     ;;
   mips64*-*-freebsd* | mips64*-*-kfreebsd*-gnu)
     # FreeBSD vectors
@@ -1031,16 +1081,13 @@
     targ_selvecs="bfd_elf32_ntradlittlemips_freebsd_vec bfd_elf32_tradbigmips_freebsd_vec bfd_elf32_tradlittlemips_freebsd_vec bfd_elf64_tradbigmips_freebsd_vec bfd_elf64_tradlittlemips_freebsd_vec"
     # Generic vectors
     targ_selvecs="${targ_selvecs} bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
-    want64=true
     ;;
-#endif
   mips*el-*-freebsd* | mips*el-*-kfreebsd*-gnu)
     # FreeBSD vectors
     targ_defvec=bfd_elf32_tradlittlemips_freebsd_vec
     targ_selvecs="bfd_elf32_tradbigmips_freebsd_vec bfd_elf32_ntradlittlemips_freebsd_vec bfd_elf64_tradlittlemips_freebsd_vec bfd_elf32_ntradbigmips_freebsd_vec bfd_elf64_tradbigmips_freebsd_vec"
     # Generic vectors
     targ_selvecs="${targ_selvecs} bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec"
-    want64=true
     ;;
   mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
     # FreeBSD vectors
@@ -1048,9 +1095,7 @@
     targ_selvecs="bfd_elf32_tradlittlemips_freebsd_vec bfd_elf32_ntradbigmips_freebsd_vec bfd_elf64_tradbigmips_freebsd_vec bfd_elf32_ntradlittlemips_freebsd_vec bfd_elf64_tradlittlemips_freebsd_vec"
     # Generic vectors
     targ_selvecs="${targ_selvecs} bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradlittlemips_vec"
-    want64=true
     ;;
-#ifdef BFD64
   mmix-*-*)
     targ_defvec=bfd_elf64_mmix_vec
     targ_selvecs=bfd_mmo_vec
@@ -1072,6 +1117,7 @@
 
   msp430-*-*)
     targ_defvec=bfd_elf32_msp430_vec
+    targ_selvecs=bfd_elf32_msp430_ti_vec
     ;;
 
   ns32k-pc532-mach* | ns32k-pc532-ux*)
@@ -1083,6 +1129,21 @@
     targ_underscore=yes
     ;;
 
+  nios2eb-*-*)
+    targ_defvec=bfd_elf32_bignios2_vec
+    targ_selvecs=bfd_elf32_littlenios2_vec
+    ;;
+
+  nios2el-*-*)
+    targ_defvec=bfd_elf32_littlenios2_vec
+    targ_selvecs=bfd_elf32_bignios2_vec
+    ;;
+
+  nios2-*-*)
+    targ_defvec=bfd_elf32_littlenios2_vec
+    targ_selvecs=bfd_elf32_bignios2_vec
+    ;;
+
   openrisc-*-elf)
     targ_defvec=bfd_elf32_openrisc_vec
     ;;
@@ -1165,7 +1226,8 @@
     targ_selvecs="bfd_elf64_powerpcle_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
     want64=true
     ;;
-  powerpc64le-*-elf* | powerpcle-*-elf64*)
+  powerpc64le-*-elf* | powerpcle-*-elf64* | powerpc64le-*-linux* | \
+  powerpc64le-*-*bsd*)
     targ_defvec=bfd_elf64_powerpcle_vec
     targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpcle_vec bfd_elf32_powerpc_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
     want64=true
@@ -1543,6 +1605,7 @@
 
   v850*-*-*)
     targ_defvec=bfd_elf32_v850_vec
+    targ_selvecs="bfd_elf32_v850_rh850_vec"
     ;;
 
   vax-*-netbsdelf*)
@@ -1631,6 +1694,13 @@
     ;;
 esac
 
+# All MIPS ELF targets need a 64-bit bfd_vma.
+case "${targ_defvec} ${targ_selvecs}" in
+  *elf*mips*)
+    want64=true
+    ;;
+esac
+
 case "${host64}${want64}" in
   *true*)
     targ_selvecs="${targ_selvecs} ${targ64_selvecs}"
diff --git a/bfd/config.in b/bfd/config.in
index 20b619d..65fb044 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -2,7 +2,7 @@
 
 /* Check that config.h is #included before system headers
     (this works only for glibc, but that should be enough).  */
-#if defined(__GLIBC__) && !defined(__CONFIG_H__)
+#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
 #  error config.h must be #included before system headers
 #endif
 #define __CONFIG_H__ 1
@@ -112,6 +112,9 @@
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
+/* Define to 1 if you have the `getrlimit' function. */
+#undef HAVE_GETRLIMIT
+
 /* Define to 1 if you have the `getuid' function. */
 #undef HAVE_GETUID
 
@@ -234,6 +237,9 @@
 /* Define to 1 if you have the <sys/procfs.h> header file. */
 #undef HAVE_SYS_PROCFS_H
 
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
diff --git a/bfd/configure b/bfd/configure
index 75e580d..bdda6dc 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64.
+# Generated by GNU Autoconf 2.64 for bfd 2.24.51.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
@@ -554,12 +554,12 @@
 MAKEFLAGS=
 
 # Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-PACKAGE_URL=
+PACKAGE_NAME='bfd'
+PACKAGE_TARNAME='bfd'
+PACKAGE_VERSION='2.24.51'
+PACKAGE_STRING='bfd 2.24.51'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
 
 ac_unique_file="libbfd.c"
 # Factoring default headers for most tests.
@@ -606,6 +606,7 @@
 tdefaults
 bfd_ufile_ptr
 bfd_file_ptr
+lt_cv_dlopen_libs
 supports_plugins
 bfd_default_target_size
 bfd_machines
@@ -847,7 +848,7 @@
 localstatedir='${prefix}/var'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
 infodir='${datarootdir}/info'
 htmldir='${docdir}'
 dvidir='${docdir}'
@@ -1348,7 +1349,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
+\`configure' configures bfd 2.24.51 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1396,7 +1397,7 @@
   --infodir=DIR           info documentation [DATAROOTDIR/info]
   --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
-  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/bfd]
   --htmldir=DIR           html documentation [DOCDIR]
   --dvidir=DIR            dvi documentation [DOCDIR]
   --pdfdir=DIR            pdf documentation [DOCDIR]
@@ -1418,7 +1419,9 @@
 fi
 
 if test -n "$ac_init_help"; then
-
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of bfd 2.24.51:";;
+   esac
   cat <<\_ACEOF
 
 Optional Features:
@@ -1538,7 +1541,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-configure
+bfd configure 2.24.51
 generated by GNU Autoconf 2.64
 
 Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2180,7 +2183,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by $as_me, which was
+It was created by bfd $as_me 2.24.51, which was
 generated by GNU Autoconf 2.64.  Invocation command line was
 
   $ $0 $@
@@ -3987,8 +3990,8 @@
 
 
 # Define the identity of the package.
- PACKAGE=bfd
- VERSION=2.22.52
+ PACKAGE='bfd'
+ VERSION='2.24.51'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -7203,7 +7206,7 @@
   rm -rf conftest*
   ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
@@ -7219,9 +7222,19 @@
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
 	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
+	    case `/usr/bin/file conftest.o` in
+	      *x86-64*)
+		LD="${LD-ld} -m elf32_x86_64"
+		;;
+	      *)
+		LD="${LD-ld} -m elf_i386"
+		;;
+	    esac
 	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
+	  powerpc64le-*linux*)
+	    LD="${LD-ld} -m elf32lppclinux"
+	    ;;
+	  powerpc64-*linux*)
 	    LD="${LD-ld} -m elf32ppclinux"
 	    ;;
 	  s390x-*linux*)
@@ -7240,7 +7253,10 @@
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
+	  powerpcle-*linux*)
+	    LD="${LD-ld} -m elf64lppc"
+	    ;;
+	  powerpc-*linux*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -8458,6 +8474,7 @@
 	# AIX 5 now supports IA64 processor
 	lt_prog_compiler_static='-Bstatic'
       fi
+      lt_prog_compiler_pic='-fPIC'
       ;;
 
     amigaos*)
@@ -9639,7 +9656,7 @@
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
       hardcode_minus_L=yes
@@ -10552,7 +10569,7 @@
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -10570,7 +10587,7 @@
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -11404,7 +11421,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11407 "configure"
+#line 11424 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11510,7 +11527,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11513 "configure"
+#line 11530 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12897,7 +12914,7 @@
 
 done
 
-for ac_header in fcntl.h sys/file.h sys/time.h sys/stat.h
+for ac_header in fcntl.h sys/file.h sys/time.h sys/stat.h sys/resource.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -13572,12 +13589,14 @@
 fi
 done
 
-for ac_func in strtoull
+for ac_func in strtoull getrlimit
 do :
-  ac_fn_c_check_func "$LINENO" "strtoull" "ac_cv_func_strtoull"
-if test "x$ac_cv_func_strtoull" = x""yes; then :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_STRTOULL 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -13916,6 +13935,10 @@
   i[3-7]86-*-linux-*)
 	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/i386linux.h"'
+	case "$enable_targets"-"$want64" in
+	*x86_64-*linux*|*-true)
+	  CORE_HEADER='"hosts/x86-64linux.h"'
+	esac
 	;;
   i[3-7]86-*-isc*)	COREFILE=trad-core.lo ;;
   i[3-7]86-*-aix*)	COREFILE=aix386-core.lo ;;
@@ -15212,6 +15235,8 @@
     bfd_elf32_bigmips_vec) 	tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_bigmips_vxworks_vec)
 			 	tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+    bfd_elf32_bigmoxie_vec)	tb="$tb elf32-moxie.lo elf32.lo $elf" ;;
+    bfd_elf32_bignios2_vec)	tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
     bfd_elf32_cr16_vec)		tb="$tb elf32-cr16.lo elf32.lo $elf" ;;
     bfd_elf32_cr16c_vec)	tb="$tb elf32-cr16c.lo elf32.lo $elf" ;;
     bfd_elf32_cris_vec)		tb="$tb elf32-cris.lo elf32.lo $elf" ;;
@@ -15223,7 +15248,6 @@
     bfd_elf32_fr30_vec)		tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
     bfd_elf32_frv_vec)		tb="$tb elf32-frv.lo elf32.lo $elf" ;;
     bfd_elf32_frvfdpic_vec)	tb="$tb elf32-frv.lo elf32.lo $elf" ;;
-    bfd_elf32_moxie_vec)	tb="$tb elf32-moxie.lo elf32.lo $elf" ;;
     bfd_elf32_h8300_vec)	tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
     bfd_elf32_hppa_linux_vec)	tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_hppa_nbsd_vec)	tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
@@ -15254,6 +15278,8 @@
     bfd_elf32_littlemips_vec) 	tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_littlemips_vxworks_vec)
 			 	tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+    bfd_elf32_littlemoxie_vec)	tb="$tb elf32-moxie.lo elf32.lo $elf" ;;
+    bfd_elf32_littlenios2_vec)	tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
     bfd_elf32_m32c_vec)         tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
     bfd_elf32_m32r_vec)		tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
     bfd_elf32_m32rle_vec)       tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
@@ -15267,11 +15293,14 @@
     bfd_elf32_mcore_little_vec)	tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
     bfd_elf32_mep_vec)		tb="$tb elf32-mep.lo elf32.lo $elf" ;;
     bfd_elf32_mep_little_vec)	tb="$tb elf32-mep.lo elf32.lo $elf" ;;
+    bfd_elf32_metag_vec)	tb="$tb elf32-metag.lo elf32.lo $elf" ;;
+    bfd_elf32_microblazeel_vec)	tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
     bfd_elf32_microblaze_vec)	tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
     bfd_elf32_mn10200_vec)	tb="$tb elf-m10200.lo elf32.lo $elf" ;;
     bfd_elf32_mn10300_vec)	tb="$tb elf-m10300.lo elf32.lo $elf" ;;
     bfd_elf32_mt_vec)           tb="$tb elf32-mt.lo elf32.lo $elf" ;;
     bfd_elf32_msp430_vec)	tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
+    bfd_elf32_msp430_ti_vec)	tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
     bfd_elf32_nbigmips_vec)	tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf32_nlittlemips_vec)	tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf32_ntradbigmips_vec | bfd_elf32_ntradbigmips_freebsd_vec)
@@ -15332,6 +15361,7 @@
 				tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_us_cris_vec)	tb="$tb elf32-cris.lo elf32.lo $elf" ;;
     bfd_elf32_v850_vec)		tb="$tb elf32-v850.lo elf32.lo $elf" ;;
+    bfd_elf32_v850_rh850_vec)	tb="$tb elf32-v850.lo elf32.lo $elf" ;;
     bfd_elf32_vax_vec)		tb="$tb elf32-vax.lo elf32.lo $elf" ;;
     bfd_elf32_xstormy16_vec)	tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
     bfd_elf32_xc16x_vec)		tb="$tb elf32-xc16x.lo elf32.lo $elf" ;;
@@ -15340,6 +15370,8 @@
     bfd_elf32_xtensa_be_vec)	tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
     bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_alpha_vec)	tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
+    bfd_elf64_bigaarch64_vec)	tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
+    bfd_elf32_bigaarch64_vec)	tb="$tb elf32-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
     bfd_elf64_big_generic_vec) 	tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_bigmips_vec) 	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf64_hppa_linux_vec)	tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
@@ -15348,6 +15380,8 @@
     bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elfxx-ia64.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_ia64_little_vec)	tb="$tb elf64-ia64.lo elfxx-ia64.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_ia64_vms_vec)	tb="$tb elf64-ia64-vms.lo elf64-ia64.lo elfxx-ia64.lo elf64.lo vms-lib.lo vms-misc.lo $elf"; target_size=64 ;;
+    bfd_elf64_littleaarch64_vec)tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
+    bfd_elf32_littleaarch64_vec)tb="$tb elf32-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
     bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_littlemips_vec) 	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf64_mmix_vec) 	tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
@@ -15620,6 +15654,7 @@
 fi
 
 
+
 # Determine the host dependant file_ptr a.k.a. off_t type.  In order
 # prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and
 # fseeko, long.  This assumes that sizeof off_t is .ge. sizeof long.
@@ -16446,7 +16481,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by $as_me, which was
+This file was extended by bfd $as_me 2.24.51, which was
 generated by GNU Autoconf 2.64.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16510,7 +16545,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-config.status
+bfd config.status 2.24.51
 configured by $0, generated by GNU Autoconf 2.64,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/bfd/configure.com b/bfd/configure.com
index a19dadd..e1c3242 100644
--- a/bfd/configure.com
+++ b/bfd/configure.com
@@ -7,6 +7,22 @@
 $! Written by Klaus K"ampf (kkaempf@rmi.de)
 $! Rewritten by Tristan Gingold (gingold@adacore.com)
 $!
+$!   Copyright 2012 Free Software Foundation
+$!
+$! This file is free software; you can redistribute it and/or modify
+$! it under the terms of the GNU General Public License as published by
+$! the Free Software Foundation; either version 3 of the License, or
+$! (at your option) any later version.
+$! 
+$! This program is distributed in the hope that it will be useful,
+$! but WITHOUT ANY WARRANTY; without even the implied warranty of
+$! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+$! GNU General Public License for more details.
+$! 
+$! You should have received a copy of the GNU General Public License
+$! along with this program; see the file COPYING3.  If not see
+$! <http://www.gnu.org/licenses/>.
+$!
 $ arch=F$GETSYI("ARCH_NAME")
 $ arch=F$EDIT(arch,"LOWERCASE")
 $if arch .eqs. "alpha" then target = "alpha"
@@ -28,26 +44,10 @@
 !
 !
    set (success,off);
-   vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
-   rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
-   match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
-   IF match_pos <> 0 THEN;
-     POSITION(BEGINNING_OF(match_pos));
-     ERASE(match_pos);
-     vers := CURRENT_LINE-")";
-   ELSE;
-     vers := "unknown";
-   ENDIF;
 
    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
    rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
 
-   match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
-   IF match_pos <> 0 THEN;
-      POSITION(BEGINNING_OF(match_pos));
-      ERASE(match_pos);
-      COPY_TEXT(vers);
-   ENDIF;
    match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
    IF match_pos <> 0 THEN;
       POSITION(BEGINNING_OF(match_pos));
@@ -82,27 +82,25 @@
    IF match_pos <> 0 THEN;
       POSITION(BEGINNING_OF(match_pos));
       ERASE(match_pos);
-      COPY_TEXT('__DECC');
-      SPLIT_LINE;
-      COPY_TEXT('#include <ints.h>');
+      COPY_TEXT('1');
    ENDIF;
    match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
    IF match_pos <> 0 THEN;
       POSITION(BEGINNING_OF(match_pos));
       ERASE(match_pos);
-      COPY_TEXT('int64');
+      COPY_TEXT('__int64');
    ENDIF;
    match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
    IF match_pos <> 0 THEN;
       POSITION(BEGINNING_OF(match_pos));
       ERASE(match_pos);
-      COPY_TEXT('uint64');
+      COPY_TEXT('unsigned __int64');
    ENDIF;
    match_pos := SEARCH_QUIETLY('@BFD_HOSTPTR_T@', FORWARD, EXACT, rang);
    IF match_pos <> 0 THEN;
       POSITION(BEGINNING_OF(match_pos));
       ERASE(match_pos);
-      COPY_TEXT('uint64');
+      COPY_TEXT('unsigned __int64');
    ENDIF;
    match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
    IF match_pos <> 0 THEN;
@@ -142,26 +140,10 @@
 !
 !
    set (success,off);
-   vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
-   rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
-   match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
-   IF match_pos <> 0 THEN;
-     POSITION(BEGINNING_OF(match_pos));
-     ERASE(match_pos);
-     vers := CURRENT_LINE-")";
-   ELSE;
-     vers := "unknown";
-   ENDIF;
 
    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
    rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
 
-   match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
-   IF match_pos <> 0 THEN;
-      POSITION(BEGINNING_OF(match_pos));
-      ERASE(match_pos);
-      COPY_TEXT(vers);
-   ENDIF;
    match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
    IF match_pos <> 0 THEN;
       POSITION(BEGINNING_OF(match_pos));
@@ -213,11 +195,11 @@
    set (success,off);
    vfile := CREATE_BUFFER("vfile", "configure.in");
    rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
-   match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
+   match_pos := SEARCH_QUIETLY('AC_INIT([bfd], [', FORWARD, EXACT, rang);
    IF match_pos <> 0 THEN;
      POSITION(BEGINNING_OF(match_pos));
      ERASE(match_pos);
-     vers := CURRENT_LINE-")";
+     vers := CURRENT_LINE-"])";
    ELSE;
      vers := "unknown";
    ENDIF;
@@ -324,6 +306,20 @@
 #define HAVE_UNISTD_H 1
 /* Disable NLS  */
 #undef ENABLE_NLS
+/* Name of package */
+#define PACKAGE "bfd"
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "bfd"
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "bfd"
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "bfd"
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "(package version)"
 $!
 $ write sys$output "Copy sysdep.h"
 $ copy [.hosts]alphavms.h sysdep.h
@@ -365,9 +361,6 @@
    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
    QUIT
 $  EOD
-$ write sys$output "Generate elf64-ia64.c from elfxx-ia64.c"
-$ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
-        []elfXX-ia64.c /output=[]elf64-ia64.c
 $ write sys$output "Generate elf64-target.h from elfxx-target.h"
 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
         []elfXX-target.h /output=[]elf64-target.h
diff --git a/bfd/configure.host b/bfd/configure.host
index 7c63de5..7868c24 100644
--- a/bfd/configure.host
+++ b/bfd/configure.host
@@ -1,3 +1,20 @@
+#
+#   Copyright 2012 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
 # This file is a shell script that overrides some of the tools and
 # flags used on a host specific basis.
 
diff --git a/bfd/configure.in b/bfd/configure.in
index 5922961..748c293 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -1,14 +1,30 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
+dnl   Copyright 2012-2013 Free Software Foundation
+dnl
+dnl This file is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; see the file COPYING3.  If not see
+dnl <http://www.gnu.org/licenses/>.
+dnl
 
 AC_PREREQ(2.59)
-AC_INIT
+AC_INIT([bfd], [2.24.51])
 AC_CONFIG_SRCDIR([libbfd.c])
 
 AC_CANONICAL_TARGET
 AC_ISC_POSIX
 
-AM_INIT_AUTOMAKE(bfd, 2.22.52)
+AM_INIT_AUTOMAKE
 
 dnl These must be called before LT_INIT, because it may want
 dnl to call AC_CHECK_PROG.
@@ -121,7 +137,7 @@
 AH_VERBATIM([00_CONFIG_H_CHECK],
 [/* Check that config.h is #included before system headers
     (this works only for glibc, but that should be enough).  */
-#if defined(__GLIBC__) && !defined(__CONFIG_H__)
+#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
 #  error config.h must be #included before system headers
 #endif
 #define __CONFIG_H__ 1])
@@ -195,7 +211,7 @@
 BFD_CC_FOR_BUILD
 
 AC_CHECK_HEADERS(alloca.h stddef.h string.h strings.h stdlib.h time.h unistd.h)
-AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h sys/stat.h)
+AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h sys/stat.h sys/resource.h)
 GCC_HEADER_STDINT(bfd_stdint.h)
 AC_HEADER_TIME
 AC_HEADER_DIRENT
@@ -204,7 +220,7 @@
 
 ACX_HEADER_STRING
 AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno)
-AC_CHECK_FUNCS(strtoull)
+AC_CHECK_FUNCS(strtoull getrlimit)
 
 AC_CHECK_DECLS(basename)
 AC_CHECK_DECLS(ftello)
@@ -331,6 +347,10 @@
 changequote([,])dnl
 	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/i386linux.h"'
+	case "$enable_targets"-"$want64" in
+	*x86_64-*linux*|*-true)
+	  CORE_HEADER='"hosts/x86-64linux.h"'
+	esac
 	;;
 changequote(,)dnl
   i[3-7]86-*-isc*)	COREFILE=trad-core.lo ;;
@@ -704,6 +724,8 @@
     bfd_elf32_bigmips_vec) 	tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_bigmips_vxworks_vec)
 			 	tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+    bfd_elf32_bigmoxie_vec)	tb="$tb elf32-moxie.lo elf32.lo $elf" ;;
+    bfd_elf32_bignios2_vec)	tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
     bfd_elf32_cr16_vec)		tb="$tb elf32-cr16.lo elf32.lo $elf" ;;
     bfd_elf32_cr16c_vec)	tb="$tb elf32-cr16c.lo elf32.lo $elf" ;;
     bfd_elf32_cris_vec)		tb="$tb elf32-cris.lo elf32.lo $elf" ;;
@@ -715,7 +737,6 @@
     bfd_elf32_fr30_vec)		tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
     bfd_elf32_frv_vec)		tb="$tb elf32-frv.lo elf32.lo $elf" ;;
     bfd_elf32_frvfdpic_vec)	tb="$tb elf32-frv.lo elf32.lo $elf" ;;
-    bfd_elf32_moxie_vec)	tb="$tb elf32-moxie.lo elf32.lo $elf" ;;
     bfd_elf32_h8300_vec)	tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
     bfd_elf32_hppa_linux_vec)	tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_hppa_nbsd_vec)	tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
@@ -746,6 +767,8 @@
     bfd_elf32_littlemips_vec) 	tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_littlemips_vxworks_vec)
 			 	tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
+    bfd_elf32_littlemoxie_vec)	tb="$tb elf32-moxie.lo elf32.lo $elf" ;;
+    bfd_elf32_littlenios2_vec)	tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
     bfd_elf32_m32c_vec)         tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
     bfd_elf32_m32r_vec)		tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
     bfd_elf32_m32rle_vec)       tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
@@ -759,11 +782,14 @@
     bfd_elf32_mcore_little_vec)	tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
     bfd_elf32_mep_vec)		tb="$tb elf32-mep.lo elf32.lo $elf" ;;
     bfd_elf32_mep_little_vec)	tb="$tb elf32-mep.lo elf32.lo $elf" ;;
+    bfd_elf32_metag_vec)	tb="$tb elf32-metag.lo elf32.lo $elf" ;;
+    bfd_elf32_microblazeel_vec)	tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
     bfd_elf32_microblaze_vec)	tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
     bfd_elf32_mn10200_vec)	tb="$tb elf-m10200.lo elf32.lo $elf" ;;
     bfd_elf32_mn10300_vec)	tb="$tb elf-m10300.lo elf32.lo $elf" ;;
     bfd_elf32_mt_vec)           tb="$tb elf32-mt.lo elf32.lo $elf" ;;
     bfd_elf32_msp430_vec)	tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
+    bfd_elf32_msp430_ti_vec)	tb="$tb elf32-msp430.lo elf32.lo $elf" ;;
     bfd_elf32_nbigmips_vec)	tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf32_nlittlemips_vec)	tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf32_ntradbigmips_vec | bfd_elf32_ntradbigmips_freebsd_vec)
@@ -824,6 +850,7 @@
 				tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_us_cris_vec)	tb="$tb elf32-cris.lo elf32.lo $elf" ;;
     bfd_elf32_v850_vec)		tb="$tb elf32-v850.lo elf32.lo $elf" ;;
+    bfd_elf32_v850_rh850_vec)	tb="$tb elf32-v850.lo elf32.lo $elf" ;;
     bfd_elf32_vax_vec)		tb="$tb elf32-vax.lo elf32.lo $elf" ;;
     bfd_elf32_xstormy16_vec)	tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
     bfd_elf32_xc16x_vec)		tb="$tb elf32-xc16x.lo elf32.lo $elf" ;;
@@ -832,6 +859,8 @@
     bfd_elf32_xtensa_be_vec)	tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
     bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_alpha_vec)	tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
+    bfd_elf64_bigaarch64_vec)	tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
+    bfd_elf32_bigaarch64_vec)	tb="$tb elf32-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
     bfd_elf64_big_generic_vec) 	tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_bigmips_vec) 	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf64_hppa_linux_vec)	tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
@@ -840,6 +869,8 @@
     bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elfxx-ia64.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_ia64_little_vec)	tb="$tb elf64-ia64.lo elfxx-ia64.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_ia64_vms_vec)	tb="$tb elf64-ia64-vms.lo elf64-ia64.lo elfxx-ia64.lo elf64.lo vms-lib.lo vms-misc.lo $elf"; target_size=64 ;;    
+    bfd_elf64_littleaarch64_vec)tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
+    bfd_elf32_littleaarch64_vec)tb="$tb elf32-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
     bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_littlemips_vec) 	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf64_mmix_vec) 	tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
@@ -1097,6 +1128,7 @@
   supports_plugins=0
 fi
 AC_SUBST(supports_plugins)
+AC_SUBST(lt_cv_dlopen_libs)
 
 # Determine the host dependant file_ptr a.k.a. off_t type.  In order
 # prefer: off64_t - if ftello64 and fseeko64, off_t - if ftello and
diff --git a/bfd/corefile.c b/bfd/corefile.c
index bba0d1c..8d62938 100644
--- a/bfd/corefile.c
+++ b/bfd/corefile.c
@@ -169,7 +169,7 @@
      of the const char * returned by bfd_core_file_failing_command to a
      non-const char *.  In this case, the assignement does not lead to
      breaking the const, as we're only reading the string.  */
-     
+
   core = (char *) bfd_core_file_failing_command (core_bfd);
   if (core == NULL)
     return TRUE;
@@ -185,7 +185,7 @@
   last_slash = strrchr (exec, '/');
   if (last_slash != NULL)
     exec = last_slash + 1;
-  
+
   return filename_cmp (exec, core) == 0;
 }
 
diff --git a/bfd/cpu-aarch64.c b/bfd/cpu-aarch64.c
new file mode 100644
index 0000000..9ec18a0
--- /dev/null
+++ b/bfd/cpu-aarch64.c
@@ -0,0 +1,127 @@
+/* BFD support for AArch64.
+   Copyright 2009, 2010, 2011, 2012  Free Software Foundation, Inc.
+   Contributed by ARM Ltd.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; see the file COPYING3. If not,
+   see <http://www.gnu.org/licenses/>.  */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "libiberty.h"
+
+/* This routine is provided two arch_infos and works out which Aarch64
+   machine which would be compatible with both and returns a pointer
+   to its info structure.  */
+
+static const bfd_arch_info_type *
+compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b)
+{
+  /* If a & b are for different architecture we can do nothing.  */
+  if (a->arch != b->arch)
+    return NULL;
+
+  /* If a & b are for the same machine then all is well.  */
+  if (a->mach == b->mach)
+    return a;
+
+  /* Don't allow mixing ilp32 with lp64.  */
+  if ((a->mach & bfd_mach_aarch64_ilp32) != (b->mach & bfd_mach_aarch64_ilp32))
+    return NULL;
+
+  /* Otherwise if either a or b is the 'default' machine
+     then it can be polymorphed into the other.  */
+  if (a->the_default)
+    return b;
+
+  if (b->the_default)
+    return a;
+
+  /* So far all newer cores are
+     supersets of previous cores.  */
+  if (a->mach < b->mach)
+    return b;
+  else if (a->mach > b->mach)
+    return a;
+
+  /* Never reached!  */
+  return NULL;
+}
+
+static struct
+{
+  unsigned int mach;
+  char *name;
+}
+processors[] =
+{
+  /* These two are example CPUs supported in GCC, once we have real
+     CPUs they will be removed.  */
+  { bfd_mach_aarch64, "example-1" },
+  { bfd_mach_aarch64, "example-2" }
+};
+
+static bfd_boolean
+scan (const struct bfd_arch_info *info, const char *string)
+{
+  int i;
+
+  /* First test for an exact match.  */
+  if (strcasecmp (string, info->printable_name) == 0)
+    return TRUE;
+
+  /* Next check for a processor name instead of an Architecture name.  */
+  for (i = sizeof (processors) / sizeof (processors[0]); i--;)
+    {
+      if (strcasecmp (string, processors[i].name) == 0)
+	break;
+    }
+
+  if (i != -1 && info->mach == processors[i].mach)
+    return TRUE;
+
+  /* Finally check for the default architecture.  */
+  if (strcasecmp (string, "aarch64") == 0)
+    return info->the_default;
+
+  return FALSE;
+}
+
+#define N(NUMBER, PRINT, DEFAULT, NEXT)				\
+  { 64, 64, 8, bfd_arch_aarch64, NUMBER,			\
+    "aarch64", PRINT, 4, DEFAULT, compatible, scan,		\
+    bfd_arch_default_fill, NEXT }
+
+static const bfd_arch_info_type bfd_aarch64_arch_ilp32 =
+  N (bfd_mach_aarch64_ilp32, "aarch64:ilp32", FALSE, NULL);
+
+const bfd_arch_info_type bfd_aarch64_arch =
+  N (0, "aarch64", TRUE, &bfd_aarch64_arch_ilp32);
+
+bfd_boolean
+bfd_is_aarch64_special_symbol_name (const char *name, int type)
+{
+  if (!name || name[0] != '$')
+    return FALSE;
+  if (name[1] == 'x' || name[1] == 'd')
+    type &= BFD_AARCH64_SPECIAL_SYM_TYPE_MAP;
+  else if (name[1] == 'm' || name[1] == 'f' || name[1] == 'p')
+    type &= BFD_AARCH64_SPECIAL_SYM_TYPE_TAG;
+  else
+    return FALSE;
+
+  return (type != 0 && (name[2] == 0 || name[2] == '.'));
+}
diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c
index 21a8d0f..4f18336 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -252,10 +252,10 @@
 	return FALSE;
     }
   else
-    { 
+    {
       if (namesz != ((strlen (expected_name) + 1 + 3) & ~3))
 	return FALSE;
-      
+
       if (strcmp (descr, expected_name) != 0)
 	return FALSE;
 
diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c
index 37ccee1..8083538 100644
--- a/bfd/cpu-avr.c
+++ b/bfd/cpu-avr.c
@@ -54,7 +54,7 @@
 
       if (a->mach <= b->mach)
        return b;
-       
+
       if (a->mach >= b->mach)
        return a;
     }
@@ -63,7 +63,7 @@
     return a;
   if (a->mach == bfd_mach_avr25 && b->mach == bfd_mach_avr2)
     return b;
-    
+
   if (a->mach == bfd_mach_avr3 && b->mach == bfd_mach_avr31)
     return a;
   if (a->mach == bfd_mach_avr31 && b->mach == bfd_mach_avr3)
@@ -112,7 +112,7 @@
   N (16, bfd_mach_avr25, "avr:25", FALSE, & arch_info_struct[3]),
 
   /* Classic, > 8K, <= 64K.  */
-  /* TODO:  addr_bits should be 16, but set to 22 for some following 
+  /* TODO:  addr_bits should be 16, but set to 22 for some following
      version of GCC (from 4.3) for backward compatibility.  */
   N (22, bfd_mach_avr3, "avr:3", FALSE, & arch_info_struct[4]),
 
@@ -126,37 +126,37 @@
   N (16, bfd_mach_avr4, "avr:4", FALSE, & arch_info_struct[7]),
 
   /* Enhanced, > 8K, <= 64K.  */
-  /* TODO:  addr_bits should be 16, but set to 22 for some following 
+  /* TODO:  addr_bits should be 16, but set to 22 for some following
      version of GCC (from 4.3) for backward compatibility.  */
   N (22, bfd_mach_avr5, "avr:5", FALSE, & arch_info_struct[8]),
-  
+
   /* Enhanced, == 128K.  */
   N (22, bfd_mach_avr51, "avr:51", FALSE, & arch_info_struct[9]),
 
   /* 3-Byte PC.  */
   N (22, bfd_mach_avr6, "avr:6", FALSE, & arch_info_struct[10]),
-  
+
   /* Xmega 1 */
   N (24, bfd_mach_avrxmega1, "avr:101", FALSE, & arch_info_struct[11]),
 
   /* Xmega 2 */
   N (24, bfd_mach_avrxmega2, "avr:102", FALSE, & arch_info_struct[12]),
-  
+
   /* Xmega 3 */
   N (24, bfd_mach_avrxmega3, "avr:103", FALSE, & arch_info_struct[13]),
-  
+
   /* Xmega 4 */
   N (24, bfd_mach_avrxmega4, "avr:104", FALSE, & arch_info_struct[14]),
-  
+
   /* Xmega 5 */
   N (24, bfd_mach_avrxmega5, "avr:105", FALSE, & arch_info_struct[15]),
-  
+
   /* Xmega 6 */
   N (24, bfd_mach_avrxmega6, "avr:106", FALSE, & arch_info_struct[16]),
-  
+
   /* Xmega 7 */
   N (24, bfd_mach_avrxmega7, "avr:107", FALSE, NULL)
-  
+
 };
 
 const bfd_arch_info_type bfd_avr_arch =
diff --git a/bfd/cpu-bfin.c b/bfd/cpu-bfin.c
index ec515ea..e2e7f89 100644
--- a/bfd/cpu-bfin.c
+++ b/bfd/cpu-bfin.c
@@ -34,7 +34,7 @@
     "bfin",        	/* Arch printable name.  */
     4,                	/* Section align power.  */
     TRUE,             	/* The one and only.  */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan,
     bfd_arch_default_fill,
     0,
diff --git a/bfd/cpu-cr16.c b/bfd/cpu-cr16.c
index bcaaf60..3e54eaa 100644
--- a/bfd/cpu-cr16.c
+++ b/bfd/cpu-cr16.c
@@ -34,7 +34,7 @@
     "cr16",           /* Printable name.  */
     1,                /* Unsigned int section alignment power.  */
     TRUE,             /* The one and only.  */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan,
     bfd_arch_default_fill,
     0,
diff --git a/bfd/cpu-cr16c.c b/bfd/cpu-cr16c.c
index 7653f2c..943edfd 100644
--- a/bfd/cpu-cr16c.c
+++ b/bfd/cpu-cr16c.c
@@ -33,7 +33,7 @@
     "cr16c",
     1,
     TRUE, 	/* The one and only.  */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan,
     bfd_arch_default_fill,
     0,
diff --git a/bfd/cpu-crx.c b/bfd/cpu-crx.c
index 8edd2ca..631c5fa 100644
--- a/bfd/cpu-crx.c
+++ b/bfd/cpu-crx.c
@@ -34,7 +34,7 @@
     "crx", 	/* Printable name.  */
     1,      	/* Unsigned int section alignment power.  */
     TRUE, 	/* The one and only.  */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan,
     bfd_arch_default_fill,
     0,
diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c
index e667a03..5f33856 100644
--- a/bfd/cpu-h8300.c
+++ b/bfd/cpu-h8300.c
@@ -83,7 +83,7 @@
 
 	  return (info->mach == bfd_mach_h8300sx);
 	}
-      
+
       return (info->mach == bfd_mach_h8300s);
     }
   else
diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c
index 4cb59ed..2a6bb97 100644
--- a/bfd/cpu-i386.c
+++ b/bfd/cpu-i386.c
@@ -1,6 +1,6 @@
 /* BFD support for the Intel 386 architecture.
    Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2005,
-   2007, 2009, 2010, 2011
+   2007, 2009, 2010, 2011, 2013
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -50,7 +50,7 @@
 		    bfd_boolean long_nop)
 {
   /* nop */
-  static const char nop_1[] = { 0x90 };	
+  static const char nop_1[] = { 0x90 };
   /* xchg %ax,%ax */
   static const char nop_2[] = { 0x66, 0x90 };
   /* nopl (%[re]ax) */
@@ -119,6 +119,71 @@
   return bfd_arch_i386_fill (count, code, TRUE);
 }
 
+/* Fill the buffer with zero, or one-byte nop instructions if CODE is TRUE.  */
+
+static void *
+bfd_arch_i386_onebyte_nop_fill (bfd_size_type count,
+				bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
+				bfd_boolean code)
+{
+  void *fill = bfd_malloc (count);
+  if (fill != NULL)
+    memset (fill, code ? 0x90 : 0, count);
+  return fill;
+}
+
+
+static const bfd_arch_info_type bfd_x64_32_nacl_arch =
+{
+  64, /* 64 bits in a word */
+  64, /* 64 bits in an address */
+  8,  /* 8 bits in a byte */
+  bfd_arch_i386,
+  bfd_mach_x64_32_nacl,
+  "i386",
+  "i386:x64-32:nacl",
+  3,
+  FALSE,
+  bfd_i386_compatible,
+  bfd_default_scan,
+  bfd_arch_i386_onebyte_nop_fill,
+  NULL
+};
+
+static const bfd_arch_info_type bfd_x86_64_nacl_arch =
+{
+  64, /* 64 bits in a word */
+  64, /* 64 bits in an address */
+  8,  /* 8 bits in a byte */
+  bfd_arch_i386,
+  bfd_mach_x86_64_nacl,
+  "i386",
+  "i386:x86-64:nacl",
+  3,
+  FALSE,
+  bfd_i386_compatible,
+  bfd_default_scan,
+  bfd_arch_i386_onebyte_nop_fill,
+  &bfd_x64_32_nacl_arch
+};
+
+const bfd_arch_info_type bfd_i386_nacl_arch =
+{
+  32,	/* 32 bits in a word */
+  32,	/* 32 bits in an address */
+  8,	/* 8 bits in a byte */
+  bfd_arch_i386,
+  bfd_mach_i386_i386_nacl,
+  "i386",
+  "i386:nacl",
+  3,
+  TRUE,
+  bfd_i386_compatible,
+  bfd_default_scan,
+  bfd_arch_i386_onebyte_nop_fill,
+  &bfd_x86_64_nacl_arch
+};
+
 static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax =
 {
   64, /* 64 bits in a word */
@@ -133,7 +198,7 @@
   bfd_i386_compatible,
   bfd_default_scan,
   bfd_arch_i386_long_nop_fill,
-  0
+  &bfd_i386_nacl_arch
 };
 
 static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
diff --git a/bfd/cpu-ia64-opc.c b/bfd/cpu-ia64-opc.c
index b797e44..dcc318e 100644
--- a/bfd/cpu-ia64-opc.c
+++ b/bfd/cpu-ia64-opc.c
@@ -380,6 +380,46 @@
 }
 
 static const char*
+ins_cnt6a (const struct ia64_operand *self, ia64_insn value,
+	    ia64_insn *code)
+{
+  if (value < 1 || value > 64)
+    return "value must be between 1 and 64";
+  return ins_immu (self, value - 1, code);
+}
+
+static const char*
+ext_cnt6a (const struct ia64_operand *self, ia64_insn code,
+	    ia64_insn *valuep)
+{
+  const char *result;
+
+  result = ext_immu (self, code, valuep);
+  if (result)
+    return result;
+
+  *valuep = *valuep + 1;
+  return 0;
+}
+
+static const char*
+ins_strd5b (const struct ia64_operand *self, ia64_insn value,
+	    ia64_insn *code)
+{
+  if (  value & 0x3f )
+    return "value must be a multiple of 64";
+  return ins_imms_scaled (self, value, code, 6);
+}
+
+static const char*
+ext_strd5b (const struct ia64_operand *self, ia64_insn code,
+	    ia64_insn *valuep)
+{
+  return ext_imms_scaled (self, code, valuep, 6);
+}
+
+
+static const char*
 ins_inc3 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
 {
   BFD_HOST_64_BIT val = value;
@@ -480,6 +520,8 @@
       "a general register" },
     { REG, ins_reg,   ext_reg,	 "r", {{ 2, 20}}, 0,		/* R3_2 */
       "a general register r0-r3" },
+    { REG, ins_reg,   ext_reg,	 "dahr", {{ 3, 23}}, 0,		/* DAHR */
+      "a dahr register dahr0-7" },
 
     /* memory operands: */
     { IND, ins_reg,   ext_reg,	"",      {{7, 20}}, 0,		/* MR3 */
@@ -504,6 +546,8 @@
       "a pmc register" },
     { IND, ins_reg,   ext_reg,	"pmd",   {{7, 20}}, 0,		/* PMD_R3 */
       "a pmd register" },
+    { IND, ins_reg,   ext_reg,	"dahr",  {{7, 20}}, 0,		/* DAHR_R3 */
+      "a dahr register" },
     { IND, ins_reg,   ext_reg,	"rr",    {{7, 20}}, 0,		/* RR_R3 */
       "an rr register" },
 
@@ -568,9 +612,15 @@
     { ABS, ins_imms,  ext_imms, 0,				/* IMM14 */
       {{ 7, 13}, { 6, 27}, { 1, 36}}, SDEC,
       "a 14-bit integer (-8192-8191)" },
+    { ABS, ins_immu,  ext_immu,  0,				/* IMMU16 */
+      {{4,  6}, {11, 12}, { 1, 36}}, UDEC,
+      "a 16-bit unsigned" },
     { ABS, ins_imms1, ext_imms1, 0,				/* IMM17 */
       {{ 7,  6}, { 8, 24}, { 1, 36}}, 0,
       "a 17-bit integer (-65536-65535)" },
+    { ABS, ins_immu,  ext_immu,  0,				/* IMMU19 */
+      {{4,  6}, {14, 12}, { 1, 36}}, UDEC,
+      "a 19-bit unsigned" },
     { ABS, ins_immu,  ext_immu,  0, {{20,  6}, { 1, 36}}, 0,	/* IMMU21 */
       "a 21-bit unsigned" },
     { ABS, ins_imms,  ext_imms,  0,				/* IMM22 */
@@ -613,4 +663,8 @@
 
     { ABS, ins_const, ext_const, 0, {{0, 0}}, 0,		/* LDXMOV */
       "ldxmov target" },
+    { ABS, ins_cnt6a, ext_cnt6a, 0, {{6, 6}}, UDEC,		/* CNT6a */
+      "lfetch count" },
+    { ABS, ins_strd5b, ext_strd5b, 0, {{5, 13}}, SDEC,		/* STRD5b*/
+      "lfetch stride" },
   };
diff --git a/bfd/cpu-lm32.c b/bfd/cpu-lm32.c
index 5222a91..d0fd93a 100644
--- a/bfd/cpu-lm32.c
+++ b/bfd/cpu-lm32.c
@@ -23,12 +23,12 @@
 #include "bfd.h"
 #include "libbfd.h"
 
-const bfd_arch_info_type bfd_lm32_arch = 
+const bfd_arch_info_type bfd_lm32_arch =
 {
     32,                           /* Bits in word.  */
     32,                           /* Bits in address.  */
     8,                            /* Bits in byte.  */
-    bfd_arch_lm32,                /* Enum bfd_architecture.  */ 
+    bfd_arch_lm32,                /* Enum bfd_architecture.  */
     bfd_mach_lm32,                /* Machine number.  */
     "lm32",                       /* Architecture name.  */
     "lm32",                       /* Printable name.  */
diff --git a/bfd/cpu-m68k.c b/bfd/cpu-m68k.c
index 009ff04..4c7b845 100644
--- a/bfd/cpu-m68k.c
+++ b/bfd/cpu-m68k.c
@@ -111,7 +111,7 @@
 
 /* Table indexed by bfd_mach_arch number indicating which
    architectural features are supported.  */
-static const unsigned m68k_arch_features[] = 
+static const unsigned m68k_arch_features[] =
 {
   0,
   m68000|m68881|m68851,
@@ -186,7 +186,7 @@
        ix++)
     {
       unsigned this_extra, this_missing;
-      
+
       if (m68k_arch_features[ix] == features)
 	return ix;
       this_extra = bit_count (m68k_arch_features[ix] & ~features);
@@ -195,7 +195,7 @@
 	  extra = this_extra;
 	  superset = ix;
 	}
-      
+
       this_missing = bit_count (features & ~m68k_arch_features[ix]);
       if (this_missing < missing)
 	{
@@ -220,7 +220,7 @@
     return b;
   if (!b->mach)
     return a;
-  
+
   if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
     /* Merge m68k machine. */
     return a->mach > b->mach ? a : b;
diff --git a/bfd/cpu-metag.c b/bfd/cpu-metag.c
new file mode 100644
index 0000000..a8dbfaa
--- /dev/null
+++ b/bfd/cpu-metag.c
@@ -0,0 +1,41 @@
+/* BFD support for the Imagination Technologies Meta processor.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   Contributed by Imagination Technologies Ltd.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+const bfd_arch_info_type bfd_metag_arch =
+{
+  32,				/* Bits per word.  */
+  32,				/* Bits per address.  */
+  8,				/* Bits per byte.  */
+  bfd_arch_metag,		/* Architecture.  */
+  bfd_mach_metag,		/* Machine.  */
+  "metag",			/* Architecture name.  */
+  "metag",			/* Printable name.  */
+  4,				/* Section align power.  */
+  TRUE,				/* The default ?  */
+  bfd_default_compatible,	/* Architecture comparison fn.  */
+  bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
+  NULL				/* Next in list.  */
+};
diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c
index c55cbf0..59a7c16 100644
--- a/bfd/cpu-mips.c
+++ b/bfd/cpu-mips.c
@@ -1,6 +1,7 @@
 /* bfd back-end for mips support
    Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
-   2002, 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2002, 2003, 2004, 2005, 2007, 2008, 2009, 2013
+   Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -75,6 +76,7 @@
   I_mips5000,
   I_mips5400,
   I_mips5500,
+  I_mips5900,
   I_mips6000,
   I_mips7000,
   I_mips8000,
@@ -118,6 +120,7 @@
   N (64, 64, bfd_mach_mips5000, "mips:5000",      FALSE, NN(I_mips5000)),
   N (64, 64, bfd_mach_mips5400, "mips:5400",      FALSE, NN(I_mips5400)),
   N (64, 64, bfd_mach_mips5500, "mips:5500",      FALSE, NN(I_mips5500)),
+  N (64, 32, bfd_mach_mips5900, "mips:5900",      FALSE, NN(I_mips5900)),
   N (32, 32, bfd_mach_mips6000, "mips:6000",      FALSE, NN(I_mips6000)),
   N (64, 64, bfd_mach_mips7000, "mips:7000",      FALSE, NN(I_mips7000)),
   N (64, 64, bfd_mach_mips8000, "mips:8000",      FALSE, NN(I_mips8000)),
diff --git a/bfd/cpu-moxie.c b/bfd/cpu-moxie.c
index f514fe7..103a56a 100644
--- a/bfd/cpu-moxie.c
+++ b/bfd/cpu-moxie.c
@@ -34,7 +34,7 @@
     "moxie",          /* Printable name.  */
     2,                /* Unsigned int section alignment power.  */
     TRUE,             /* The one and only.  */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan,
     bfd_arch_default_fill,
     0,
diff --git a/bfd/cpu-msp430.c b/bfd/cpu-msp430.c
index bcaa4e7..d15ba55 100644
--- a/bfd/cpu-msp430.c
+++ b/bfd/cpu-msp430.c
@@ -1,6 +1,5 @@
 /* BFD library support routines for the MSP architecture.
-   Copyright (C) 2002, 2003, 2005, 2007, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 2002-2013 Free Software Foundation, Inc.
    Contributed by Dmitry Diky <diwil@mail.ru>
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -62,49 +61,76 @@
 static const bfd_arch_info_type arch_info_struct[] =
 {
   /* msp430x11x.  */
-  N (16, bfd_mach_msp11, "msp:11", FALSE, & arch_info_struct[1]),
+  N (16, bfd_mach_msp11, "MSP430", FALSE, & arch_info_struct[1]),
 
   /* msp430x11x1.  */
-  N (16, bfd_mach_msp110, "msp:110", FALSE, & arch_info_struct[2]),
+  N (16, bfd_mach_msp110, "MSP430x11x1", FALSE, & arch_info_struct[2]),
 
   /* msp430x12x.  */
-  N (16, bfd_mach_msp12, "msp:12", FALSE, & arch_info_struct[3]),
+  N (16, bfd_mach_msp12, "MSP430x12", FALSE, & arch_info_struct[3]),
 
   /* msp430x13x.  */
-  N (16, bfd_mach_msp13, "msp:13", FALSE, & arch_info_struct[4]),
+  N (16, bfd_mach_msp13, "MSP430x13", FALSE, & arch_info_struct[4]),
 
   /* msp430x14x.  */
-  N (16, bfd_mach_msp14, "msp:14", FALSE, & arch_info_struct[5]),
+  N (16, bfd_mach_msp14, "MSP430x14", FALSE, & arch_info_struct[5]),
 
   /* msp430x15x.  */
-  N (16, bfd_mach_msp15, "msp:15", FALSE, & arch_info_struct[6]),
-  
+  N (16, bfd_mach_msp15, "MSP430x15", FALSE, & arch_info_struct[6]),
+
   /* msp430x16x.  */
-  N (16, bfd_mach_msp16, "msp:16", FALSE, & arch_info_struct[7]),
+  N (16, bfd_mach_msp16, "MSP430x16", FALSE, & arch_info_struct[7]),
+
+  /* msp430x20x.  */
+  N (16, bfd_mach_msp20, "MSP430x20", FALSE, & arch_info_struct[8]),
 
   /* msp430x21x.  */
-  N (16, bfd_mach_msp21, "msp:21", FALSE, & arch_info_struct[8]),
+  N (16, bfd_mach_msp21, "MSP430x21", FALSE, & arch_info_struct[9]),
+
+  /* msp430x22x.  */
+  N (16, bfd_mach_msp22, "MSP430x22", FALSE, & arch_info_struct[10]),
+
+  /* msp430x23x.  */
+  N (16, bfd_mach_msp23, "MSP430x23", FALSE, & arch_info_struct[11]),
+
+  /* msp430x24x.  */
+  N (16, bfd_mach_msp24, "MSP430x24", FALSE, & arch_info_struct[12]),
+
+  /* msp430x26x.  */
+  N (16, bfd_mach_msp26, "MSP430x26", FALSE, & arch_info_struct[13]),
 
   /* msp430x31x.  */
-  N (16, bfd_mach_msp31, "msp:31", FALSE, & arch_info_struct[9]), 
+  N (16, bfd_mach_msp31, "MSP430x31", FALSE, & arch_info_struct[14]),
 
   /* msp430x32x.  */
-  N (16, bfd_mach_msp32, "msp:32", FALSE, & arch_info_struct[10]), 
+  N (16, bfd_mach_msp32, "MSP430x32", FALSE, & arch_info_struct[15]),
 
   /* msp430x33x.  */
-  N (16, bfd_mach_msp33, "msp:33", FALSE, & arch_info_struct[11]),
-  
+  N (16, bfd_mach_msp33, "MSP430x33", FALSE, & arch_info_struct[16]),
+
   /* msp430x41x.  */
-  N (16, bfd_mach_msp41, "msp:41", FALSE, & arch_info_struct[12]),
+  N (16, bfd_mach_msp41, "MSP430x41", FALSE, & arch_info_struct[17]),
 
   /* msp430x42x.  */
-  N (16, bfd_mach_msp42, "msp:42", FALSE, & arch_info_struct[13]),
+  N (16, bfd_mach_msp42, "MSP430x42", FALSE, & arch_info_struct[18]),
 
   /* msp430x43x.  */
-  N (16, bfd_mach_msp43, "msp:43", FALSE, & arch_info_struct[14]),
+  N (16, bfd_mach_msp43, "MSP430x43", FALSE, & arch_info_struct[19]),
 
   /* msp430x44x.  */
-  N (16, bfd_mach_msp43, "msp:44", FALSE, NULL)
+  N (16, bfd_mach_msp43, "MSP430x44", FALSE, & arch_info_struct[20]),
+
+  /* msp430x46x.  */
+  N (16, bfd_mach_msp46, "MSP430x46", FALSE, & arch_info_struct[21]),
+
+  /* msp430x47x.  */
+  N (16, bfd_mach_msp47, "MSP430x47", FALSE, & arch_info_struct[22]),
+
+  /* msp430x54x.  */
+  N (16, bfd_mach_msp54, "MSP430x54", FALSE, & arch_info_struct[23]),
+
+  N (32, bfd_mach_msp430x, "MSP430X", FALSE, NULL)
+
 };
 
 const bfd_arch_info_type bfd_msp430_arch =
diff --git a/bfd/cpu-nios2.c b/bfd/cpu-nios2.c
new file mode 100644
index 0000000..fa4c859
--- /dev/null
+++ b/bfd/cpu-nios2.c
@@ -0,0 +1,44 @@
+/* BFD support for the Altera Nios II processor.
+   Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+   Contributed by Nigel Gray (ngray@altera.com).
+   Contributed by Mentor Graphics, Inc.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT)		\
+  {							\
+    BITS_WORD, /*  bits in a word */			\
+    BITS_ADDR, /* bits in an address */			\
+    8,	/* 8 bits in a byte */				\
+    bfd_arch_nios2,					\
+    NUMBER,						\
+    "nios2",						\
+    PRINT,						\
+    3,							\
+    DEFAULT,						\
+    bfd_default_compatible,				\
+    bfd_default_scan,					\
+    bfd_arch_default_fill,			       	\
+    NEXT						\
+  }
+
+const bfd_arch_info_type bfd_nios2_arch = N (32, 32, 0, "nios2", TRUE, NULL);
diff --git a/bfd/cpu-s390.c b/bfd/cpu-s390.c
index 1a581e4..1cd3af1 100644
--- a/bfd/cpu-s390.c
+++ b/bfd/cpu-s390.c
@@ -33,7 +33,11 @@
     "s390",
     "s390:64-bit",
     3, /* section alignment power */
+#if BFD_DEFAULT_TARGET_SIZE == 64
     TRUE, /* the default */
+#else
+    FALSE, /* the default */
+#endif
     bfd_default_compatible,
     bfd_default_scan,
     bfd_arch_default_fill,
@@ -50,7 +54,11 @@
     "s390",
     "s390:31-bit",
     3, /* section alignment power */
+#if BFD_DEFAULT_TARGET_SIZE == 64
+    FALSE, /* the default */
+#else
     TRUE, /* the default */
+#endif
     bfd_default_compatible,
     bfd_default_scan,
     bfd_arch_default_fill,
diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c
index 6fe6c15..6ca7840 100644
--- a/bfd/cpu-sh.c
+++ b/bfd/cpu-sh.c
@@ -388,7 +388,7 @@
   { bfd_mach_sh2a_nofpu_or_sh3_nommu,               arch_sh2a_nofpu_or_sh3_nommu,         arch_sh2a_nofpu_or_sh3_nommu_up },
   { bfd_mach_sh2a_or_sh4,     arch_sh2a_or_sh4,     arch_sh2a_or_sh4_up },
   { bfd_mach_sh2a_or_sh3e,    arch_sh2a_or_sh3e,    arch_sh2a_or_sh3e_up },
-  
+
   { bfd_mach_sh3,             arch_sh3,             arch_sh3_up },
   { bfd_mach_sh3_nommu,       arch_sh3_nommu,       arch_sh3_nommu_up },
   { bfd_mach_sh3_dsp,         arch_sh3_dsp,         arch_sh3_dsp_up },
@@ -541,6 +541,6 @@
 
   bfd_default_set_arch_mach (obfd, bfd_arch_sh,
 			     sh_get_bfd_mach_from_arch_set (merged_arch));
-  
+
   return TRUE;
 }
diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c
index d124220..c2f52f1 100644
--- a/bfd/cpu-v850.c
+++ b/bfd/cpu-v850.c
@@ -1,6 +1,5 @@
 /* BFD support for the NEC V850 processor
-   Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007,
-   2010  Free Software Foundation, Inc.
+   Copyright 1996-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -25,16 +24,18 @@
 #include "safe-ctype.h"
 
 #define N(number, print, default, next)  \
-{  32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \
+{  32, 32, 8, bfd_arch_v850, number, "v850", print " (using old gcc ABI)", 2, default, \
    bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next }
 
 #define NEXT NULL
 
 static const bfd_arch_info_type arch_info_struct[] =
 {
-  N (bfd_mach_v850e2v3, "v850e2v3", 	FALSE, & arch_info_struct[1]),
-  N (bfd_mach_v850e2,   "v850e2", 	FALSE, & arch_info_struct[2]),
-  N (bfd_mach_v850e1,   "v850e1",  	FALSE, & arch_info_struct[3]),
+  N (bfd_mach_v850e3v5, "v850e3v5", 	FALSE, & arch_info_struct[1]),
+  N (bfd_mach_v850e3v5, "v850e2v4", 	FALSE, & arch_info_struct[2]),
+  N (bfd_mach_v850e2v3, "v850e2v3", 	FALSE, & arch_info_struct[3]),
+  N (bfd_mach_v850e2,   "v850e2", 	FALSE, & arch_info_struct[4]),
+  N (bfd_mach_v850e1,   "v850e1",  	FALSE, & arch_info_struct[5]),
   N (bfd_mach_v850e,    "v850e",   	FALSE, NULL)
 };
 
diff --git a/bfd/cpu-v850_rh850.c b/bfd/cpu-v850_rh850.c
new file mode 100644
index 0000000..9402f23
--- /dev/null
+++ b/bfd/cpu-v850_rh850.c
@@ -0,0 +1,41 @@
+/* BFD support for the NEC V850 processor with the RH850 ABI.
+   Copyright 2012-2013  Free Software Foundation, Inc.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "safe-ctype.h"
+
+#define R(number, print, default, next)  \
+{  32, 32, 8, bfd_arch_v850_rh850, number, "v850", print, 2, default, \
+   bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next }
+
+static const bfd_arch_info_type arch_info_struct[] =
+{
+  R (bfd_mach_v850e3v5, "v850e3v5", 	FALSE, & arch_info_struct[1]),
+  R (bfd_mach_v850e3v5, "v850e2v4", 	FALSE, & arch_info_struct[2]),
+  R (bfd_mach_v850e2v3, "v850e2v3", 	FALSE, & arch_info_struct[3]),
+  R (bfd_mach_v850e2,   "v850e2", 	FALSE, & arch_info_struct[4]),
+  R (bfd_mach_v850e1,   "v850e1",  	FALSE, & arch_info_struct[5]),
+  R (bfd_mach_v850e,    "v850e",   	FALSE, NULL)
+};
+
+const bfd_arch_info_type bfd_v850_rh850_arch =
+  R (bfd_mach_v850,     "v850-rh850",   TRUE,  & arch_info_struct[0]);
diff --git a/bfd/cpu-xc16x.c b/bfd/cpu-xc16x.c
index 3d28659..3c74232 100644
--- a/bfd/cpu-xc16x.c
+++ b/bfd/cpu-xc16x.c
@@ -1,6 +1,6 @@
 /* BFD support for the Infineon XC16X Microcontroller.
    Copyright 2006, 2007 Free Software Foundation, Inc.
-   Contributed by KPIT Cummins Infosystems 
+   Contributed by KPIT Cummins Infosystems
 
    This file is part of BFD, the Binary File Descriptor library.
    Contributed by Anil Paranjpe(anilp1@kpitcummins.com)
diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog
index 37a7e38..08c2780 100644
--- a/bfd/doc/ChangeLog
+++ b/bfd/doc/ChangeLog
@@ -1,3 +1,32 @@
+2013-10-14  Nick Clifton  <nickc@redhat.com>
+
+	* chew.c (perform): Free next.
+
+2013-04-15  Alan Modra  <amodra@gmail.com>
+
+	* Makefile.am ($(MKDOC)): Append $(EXEEXT_FOR_BUILD) to temp file.
+	* Makefile.in: Regenerate.
+
+2013-04-09  Mingjie Xing  <mingjie.xing@gmail.com>
+
+	* bfd.texinfo (typedef bfd, Error reporting, Miscellaneous):
+	Add menu items.
+
+2013-01-07  Patrice Dumas  <pertusus@free.fr>
+
+	* bfd.texinfo: Replace @ with @@ when it is part of the text.
+
+2012-12-17  Nick Clifton  <nickc@redhat.com>
+
+	* Makefile.am: Add copyright notice.
+	* bfdsumm.texi: Likewise.
+	* makefile.vms: Likewise.
+	* Makefile.in: Regenerate.
+
+2012-11-08  Alan Modra  <amodra@gmail.com>
+
+	* Makefile.in: Regenerate.
+
 2012-02-27  Alan Modra  <amodra@gmail.com>
 
 	* chew.c (print_stack_level, main): Use %ld to print stack delta.
@@ -238,6 +267,12 @@
 
 For older changes see ChangeLog-9103
 
+Copyright (C) 2004-2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 mode: change-log
 left-margin: 8
diff --git a/bfd/doc/ChangeLog-9103 b/bfd/doc/ChangeLog-9103
index 3636ed8..0b5d836 100644
--- a/bfd/doc/ChangeLog-9103
+++ b/bfd/doc/ChangeLog-9103
@@ -589,6 +589,12 @@
 	  and mandir now keyed off datadir by default.
 
 
+Copyright (C) 1991-2003 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
 Local Variables:
 version-control: never
 End:
diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am
index 7476ee5..670d69a 100644
--- a/bfd/doc/Makefile.am
+++ b/bfd/doc/Makefile.am
@@ -1,4 +1,21 @@
 ## Process this file with automake to generate Makefile.in
+#
+#   Copyright 2012 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
 
 AUTOMAKE_OPTIONS = 1.9 cygnus
 
@@ -60,9 +77,9 @@
 	-I$(srcdir)/../../intl -I../../intl
 
 $(MKDOC): $(srcdir)/chew.c
-	$(CC_FOR_BUILD) -o chew.$$$$ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
-	  $(H_CFLAGS) $(AM_CPPFLAGS) $(srcdir)/chew.c; \
-	$(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
+	$(CC_FOR_BUILD) -o chw$$$$$(EXEEXT_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
+	  $(LDFLAGS_FOR_BUILD) $(H_CFLAGS) $(AM_CPPFLAGS) $(srcdir)/chew.c; \
+	$(SHELL) $(srcdir)/../../move-if-change chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC)
 
 protos: libbfd.h libcoff.h bfd.h
 
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 68e17f7..5156ba7 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -14,6 +14,24 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
+
+#
+#   Copyright 2012 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -247,6 +265,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_cv_dlopen_libs = @lt_cv_dlopen_libs@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -757,9 +776,9 @@
 
 
 $(MKDOC): $(srcdir)/chew.c
-	$(CC_FOR_BUILD) -o chew.$$$$ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
-	  $(H_CFLAGS) $(AM_CPPFLAGS) $(srcdir)/chew.c; \
-	$(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
+	$(CC_FOR_BUILD) -o chw$$$$$(EXEEXT_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
+	  $(LDFLAGS_FOR_BUILD) $(H_CFLAGS) $(AM_CPPFLAGS) $(srcdir)/chew.c; \
+	$(SHELL) $(srcdir)/../../move-if-change chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC)
 
 protos: libbfd.h libcoff.h bfd.h
 
diff --git a/bfd/doc/aoutx.texi b/bfd/doc/aoutx.texi
deleted file mode 100644
index 7cf9787..0000000
--- a/bfd/doc/aoutx.texi
+++ /dev/null
@@ -1,213 +0,0 @@
-@section a.out backends
-
-
-@strong{Description}@*
-BFD supports a number of different flavours of a.out format,
-though the major differences are only the sizes of the
-structures on disk, and the shape of the relocation
-information.
-
-The support is split into a basic support file @file{aoutx.h}
-and other files which derive functions from the base. One
-derivation file is @file{aoutf1.h} (for a.out flavour 1), and
-adds to the basic a.out functions support for sun3, sun4, 386
-and 29k a.out files, to create a target jump vector for a
-specific target.
-
-This information is further split out into more specific files
-for each machine, including @file{sunos.c} for sun3 and sun4,
-@file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a
-demonstration of a 64 bit a.out format.
-
-The base file @file{aoutx.h} defines general mechanisms for
-reading and writing records to and from disk and various
-other methods which BFD requires. It is included by
-@file{aout32.c} and @file{aout64.c} to form the names
-@code{aout_32_swap_exec_header_in}, @code{aout_64_swap_exec_header_in}, etc.
-
-As an example, this is what goes on to make the back end for a
-sun4, from @file{aout32.c}:
-
-@example
-       #define ARCH_SIZE 32
-       #include "aoutx.h"
-@end example
-
-Which exports names:
-
-@example
-       ...
-       aout_32_canonicalize_reloc
-       aout_32_find_nearest_line
-       aout_32_get_lineno
-       aout_32_get_reloc_upper_bound
-       ...
-@end example
-
-from @file{sunos.c}:
-
-@example
-       #define TARGET_NAME "a.out-sunos-big"
-       #define VECNAME    sunos_big_vec
-       #include "aoutf1.h"
-@end example
-
-requires all the names from @file{aout32.c}, and produces the jump vector
-
-@example
-       sunos_big_vec
-@end example
-
-The file @file{host-aout.c} is a special case.  It is for a large set
-of hosts that use ``more or less standard'' a.out files, and
-for which cross-debugging is not interesting.  It uses the
-standard 32-bit a.out support routines, but determines the
-file offsets and addresses of the text, data, and BSS
-sections, the machine architecture and machine type, and the
-entry point address, in a host-dependent manner.  Once these
-values have been determined, generic code is used to handle
-the  object file.
-
-When porting it to run on a new system, you must supply:
-
-@example
-        HOST_PAGE_SIZE
-        HOST_SEGMENT_SIZE
-        HOST_MACHINE_ARCH       (optional)
-        HOST_MACHINE_MACHINE    (optional)
-        HOST_TEXT_START_ADDR
-        HOST_STACK_END_ADDR
-@end example
-
-in the file @file{../include/sys/h-@var{XXX}.h} (for your host).  These
-values, plus the structures and macros defined in @file{a.out.h} on
-your host system, will produce a BFD target that will access
-ordinary a.out files on your host. To configure a new machine
-to use @file{host-aout.c}, specify:
-
-@example
-       TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
-       TDEPFILES= host-aout.o trad-core.o
-@end example
-
-in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
-to use the
-@file{@var{XXX}.mt} file (by setting "@code{bfd_target=XXX}") when your
-configuration is selected.
-
-@subsection Relocations
-
-
-@strong{Description}@*
-The file @file{aoutx.h} provides for both the @emph{standard}
-and @emph{extended} forms of a.out relocation records.
-
-The standard records contain only an
-address, a symbol index, and a type field. The extended records
-(used on 29ks and sparcs) also have a full integer for an
-addend.
-
-@subsection Internal entry points
-
-
-@strong{Description}@*
-@file{aoutx.h} exports several routines for accessing the
-contents of an a.out file, which are gathered and exported in
-turn by various format specific files (eg sunos.c).
-
-@findex aout_@var{size}_swap_exec_header_in
-@subsubsection @code{aout_@var{size}_swap_exec_header_in}
-@strong{Synopsis}
-@example
-void aout_@var{size}_swap_exec_header_in,
-   (bfd *abfd,
-    struct external_exec *bytes,
-    struct internal_exec *execp);
-@end example
-@strong{Description}@*
-Swap the information in an executable header @var{raw_bytes} taken
-from a raw byte stream memory image into the internal exec header
-structure @var{execp}.
-
-@findex aout_@var{size}_swap_exec_header_out
-@subsubsection @code{aout_@var{size}_swap_exec_header_out}
-@strong{Synopsis}
-@example
-void aout_@var{size}_swap_exec_header_out
-   (bfd *abfd,
-    struct internal_exec *execp,
-    struct external_exec *raw_bytes);
-@end example
-@strong{Description}@*
-Swap the information in an internal exec header structure
-@var{execp} into the buffer @var{raw_bytes} ready for writing to disk.
-
-@findex aout_@var{size}_some_aout_object_p
-@subsubsection @code{aout_@var{size}_some_aout_object_p}
-@strong{Synopsis}
-@example
-const bfd_target *aout_@var{size}_some_aout_object_p
-   (bfd *abfd,
-    struct internal_exec *execp,
-    const bfd_target *(*callback_to_real_object_p) (bfd *));
-@end example
-@strong{Description}@*
-Some a.out variant thinks that the file open in @var{abfd}
-checking is an a.out file.  Do some more checking, and set up
-for access if it really is.  Call back to the calling
-environment's "finish up" function just before returning, to
-handle any last-minute setup.
-
-@findex aout_@var{size}_mkobject
-@subsubsection @code{aout_@var{size}_mkobject}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
-@end example
-@strong{Description}@*
-Initialize BFD @var{abfd} for use with a.out files.
-
-@findex aout_@var{size}_machine_type
-@subsubsection @code{aout_@var{size}_machine_type}
-@strong{Synopsis}
-@example
-enum machine_type  aout_@var{size}_machine_type
-   (enum bfd_architecture arch,
-    unsigned long machine,
-    bfd_boolean *unknown);
-@end example
-@strong{Description}@*
-Keep track of machine architecture and machine type for
-a.out's. Return the @code{machine_type} for a particular
-architecture and machine, or @code{M_UNKNOWN} if that exact architecture
-and machine can't be represented in a.out format.
-
-If the architecture is understood, machine type 0 (default)
-is always understood.
-
-@findex aout_@var{size}_set_arch_mach
-@subsubsection @code{aout_@var{size}_set_arch_mach}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_set_arch_mach,
-   (bfd *,
-    enum bfd_architecture arch,
-    unsigned long machine);
-@end example
-@strong{Description}@*
-Set the architecture and the machine of the BFD @var{abfd} to the
-values @var{arch} and @var{machine}.  Verify that @var{abfd}'s format
-can support the architecture required.
-
-@findex aout_@var{size}_new_section_hook
-@subsubsection @code{aout_@var{size}_new_section_hook}
-@strong{Synopsis}
-@example
-bfd_boolean aout_@var{size}_new_section_hook,
-   (bfd *abfd,
-    asection *newsect);
-@end example
-@strong{Description}@*
-Called by the BFD in response to a @code{bfd_make_section}
-request.
-
diff --git a/bfd/doc/archive.texi b/bfd/doc/archive.texi
deleted file mode 100644
index 3d0a97d..0000000
--- a/bfd/doc/archive.texi
+++ /dev/null
@@ -1,99 +0,0 @@
-@section Archives
-
-
-@strong{Description}@*
-An archive (or library) is just another BFD.  It has a symbol
-table, although there's not much a user program will do with it.
-
-The big difference between an archive BFD and an ordinary BFD
-is that the archive doesn't have sections.  Instead it has a
-chain of BFDs that are considered its contents.  These BFDs can
-be manipulated like any other.  The BFDs contained in an
-archive opened for reading will all be opened for reading.  You
-may put either input or output BFDs into an archive opened for
-output; they will be handled correctly when the archive is closed.
-
-Use @code{bfd_openr_next_archived_file} to step through
-the contents of an archive opened for input.  You don't
-have to read the entire archive if you don't want
-to!  Read it until you find what you want.
-
-Archive contents of output BFDs are chained through the
-@code{next} pointer in a BFD.  The first one is findable through
-the @code{archive_head} slot of the archive.  Set it with
-@code{bfd_set_archive_head} (q.v.).  A given BFD may be in only one
-open output archive at a time.
-
-As expected, the BFD archive code is more general than the
-archive code of any given environment.  BFD archives may
-contain files of different formats (e.g., a.out and coff) and
-even different architectures.  You may even place archives
-recursively into archives!
-
-This can cause unexpected confusion, since some archive
-formats are more expressive than others.  For instance, Intel
-COFF archives can preserve long filenames; SunOS a.out archives
-cannot.  If you move a file from the first to the second
-format and back again, the filename may be truncated.
-Likewise, different a.out environments have different
-conventions as to how they truncate filenames, whether they
-preserve directory names in filenames, etc.  When
-interoperating with native tools, be sure your files are
-homogeneous.
-
-Beware: most of these formats do not react well to the
-presence of spaces in filenames.  We do the best we can, but
-can't always handle this case due to restrictions in the format of
-archives.  Many Unix utilities are braindead in regards to
-spaces and such in filenames anyway, so this shouldn't be much
-of a restriction.
-
-Archives are supported in BFD in @code{archive.c}.
-
-@subsection Archive functions
-
-
-@findex bfd_get_next_mapent
-@subsubsection @code{bfd_get_next_mapent}
-@strong{Synopsis}
-@example
-symindex bfd_get_next_mapent
-   (bfd *abfd, symindex previous, carsym **sym);
-@end example
-@strong{Description}@*
-Step through archive @var{abfd}'s symbol table (if it
-has one).  Successively update @var{sym} with the next symbol's
-information, returning that symbol's (internal) index into the
-symbol table.
-
-Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to get
-the first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've already
-got the last one.
-
-A @code{carsym} is a canonical archive symbol.  The only
-user-visible element is its name, a null-terminated string.
-
-@findex bfd_set_archive_head
-@subsubsection @code{bfd_set_archive_head}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
-@end example
-@strong{Description}@*
-Set the head of the chain of
-BFDs contained in the archive @var{output} to @var{new_head}.
-
-@findex bfd_openr_next_archived_file
-@subsubsection @code{bfd_openr_next_archived_file}
-@strong{Synopsis}
-@example
-bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
-@end example
-@strong{Description}@*
-Provided a BFD, @var{archive}, containing an archive and NULL, open
-an input BFD on the first contained element and returns that.
-Subsequent calls should pass
-the archive and the previous return value to return a created
-BFD to the next contained element. NULL is returned when there
-are no more.
-
diff --git a/bfd/doc/archures.texi b/bfd/doc/archures.texi
deleted file mode 100644
index 726ba0a..0000000
--- a/bfd/doc/archures.texi
+++ /dev/null
@@ -1,683 +0,0 @@
-@section Architectures
-BFD keeps one atom in a BFD describing the
-architecture of the data attached to the BFD: a pointer to a
-@code{bfd_arch_info_type}.
-
-Pointers to structures can be requested independently of a BFD
-so that an architecture's information can be interrogated
-without access to an open BFD.
-
-The architecture information is provided by each architecture package.
-The set of default architectures is selected by the macro
-@code{SELECT_ARCHITECTURES}.  This is normally set up in the
-@file{config/@var{target}.mt} file of your choice.  If the name is not
-defined, then all the architectures supported are included.
-
-When BFD starts up, all the architectures are called with an
-initialize method.  It is up to the architecture back end to
-insert as many items into the list of architectures as it wants to;
-generally this would be one for each machine and one for the
-default case (an item with a machine field of 0).
-
-BFD's idea of an architecture is implemented in @file{archures.c}.
-
-@subsection bfd_architecture
-
-
-@strong{Description}@*
-This enum gives the object file's CPU architecture, in a
-global sense---i.e., what processor family does it belong to?
-Another field indicates which processor within
-the family is in use.  The machine gives a number which
-distinguishes different versions of the architecture,
-containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
-and 68020 and 68030 for Motorola 68020 and 68030.
-@example
-enum bfd_architecture
-@{
-  bfd_arch_unknown,   /* File arch not known.  */
-  bfd_arch_obscure,   /* Arch known, not one of these.  */
-  bfd_arch_m68k,      /* Motorola 68xxx */
-#define bfd_mach_m68000 1
-#define bfd_mach_m68008 2
-#define bfd_mach_m68010 3
-#define bfd_mach_m68020 4
-#define bfd_mach_m68030 5
-#define bfd_mach_m68040 6
-#define bfd_mach_m68060 7
-#define bfd_mach_cpu32  8
-#define bfd_mach_fido   9
-#define bfd_mach_mcf_isa_a_nodiv 10
-#define bfd_mach_mcf_isa_a 11
-#define bfd_mach_mcf_isa_a_mac 12
-#define bfd_mach_mcf_isa_a_emac 13
-#define bfd_mach_mcf_isa_aplus 14
-#define bfd_mach_mcf_isa_aplus_mac 15
-#define bfd_mach_mcf_isa_aplus_emac 16
-#define bfd_mach_mcf_isa_b_nousp 17
-#define bfd_mach_mcf_isa_b_nousp_mac 18
-#define bfd_mach_mcf_isa_b_nousp_emac 19
-#define bfd_mach_mcf_isa_b 20
-#define bfd_mach_mcf_isa_b_mac 21
-#define bfd_mach_mcf_isa_b_emac 22
-#define bfd_mach_mcf_isa_b_float 23
-#define bfd_mach_mcf_isa_b_float_mac 24
-#define bfd_mach_mcf_isa_b_float_emac 25
-#define bfd_mach_mcf_isa_c 26
-#define bfd_mach_mcf_isa_c_mac 27
-#define bfd_mach_mcf_isa_c_emac 28
-#define bfd_mach_mcf_isa_c_nodiv 29
-#define bfd_mach_mcf_isa_c_nodiv_mac 30
-#define bfd_mach_mcf_isa_c_nodiv_emac 31
-  bfd_arch_vax,       /* DEC Vax */
-  bfd_arch_i960,      /* Intel 960 */
-    /* The order of the following is important.
-       lower number indicates a machine type that
-       only accepts a subset of the instructions
-       available to machines with higher numbers.
-       The exception is the "ca", which is
-       incompatible with all other machines except
-       "core".  */
-
-#define bfd_mach_i960_core      1
-#define bfd_mach_i960_ka_sa     2
-#define bfd_mach_i960_kb_sb     3
-#define bfd_mach_i960_mc        4
-#define bfd_mach_i960_xa        5
-#define bfd_mach_i960_ca        6
-#define bfd_mach_i960_jx        7
-#define bfd_mach_i960_hx        8
-
-  bfd_arch_or32,      /* OpenRISC 32 */
-
-  bfd_arch_sparc,     /* SPARC */
-#define bfd_mach_sparc                 1
-/* The difference between v8plus and v9 is that v9 is a true 64 bit env.  */
-#define bfd_mach_sparc_sparclet        2
-#define bfd_mach_sparc_sparclite       3
-#define bfd_mach_sparc_v8plus          4
-#define bfd_mach_sparc_v8plusa         5 /* with ultrasparc add'ns.  */
-#define bfd_mach_sparc_sparclite_le    6
-#define bfd_mach_sparc_v9              7
-#define bfd_mach_sparc_v9a             8 /* with ultrasparc add'ns.  */
-#define bfd_mach_sparc_v8plusb         9 /* with cheetah add'ns.  */
-#define bfd_mach_sparc_v9b             10 /* with cheetah add'ns.  */
-/* Nonzero if MACH has the v9 instruction set.  */
-#define bfd_mach_sparc_v9_p(mach) \
-  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
-   && (mach) != bfd_mach_sparc_sparclite_le)
-/* Nonzero if MACH is a 64 bit sparc architecture.  */
-#define bfd_mach_sparc_64bit_p(mach) \
-  ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
-  bfd_arch_spu,       /* PowerPC SPU */
-#define bfd_mach_spu           256 
-  bfd_arch_mips,      /* MIPS Rxxxx */
-#define bfd_mach_mips3000              3000
-#define bfd_mach_mips3900              3900
-#define bfd_mach_mips4000              4000
-#define bfd_mach_mips4010              4010
-#define bfd_mach_mips4100              4100
-#define bfd_mach_mips4111              4111
-#define bfd_mach_mips4120              4120
-#define bfd_mach_mips4300              4300
-#define bfd_mach_mips4400              4400
-#define bfd_mach_mips4600              4600
-#define bfd_mach_mips4650              4650
-#define bfd_mach_mips5000              5000
-#define bfd_mach_mips5400              5400
-#define bfd_mach_mips5500              5500
-#define bfd_mach_mips6000              6000
-#define bfd_mach_mips7000              7000
-#define bfd_mach_mips8000              8000
-#define bfd_mach_mips9000              9000
-#define bfd_mach_mips10000             10000
-#define bfd_mach_mips12000             12000
-#define bfd_mach_mips14000             14000
-#define bfd_mach_mips16000             16000
-#define bfd_mach_mips16                16
-#define bfd_mach_mips5                 5
-#define bfd_mach_mips_loongson_2e      3001
-#define bfd_mach_mips_loongson_2f      3002
-#define bfd_mach_mips_loongson_3a      3003
-#define bfd_mach_mips_sb1              12310201 /* octal 'SB', 01 */
-#define bfd_mach_mips_octeon           6501
-#define bfd_mach_mips_octeonp          6601
-#define bfd_mach_mips_octeon2          6502
-#define bfd_mach_mips_xlr              887682   /* decimal 'XLR'  */
-#define bfd_mach_mipsisa32             32
-#define bfd_mach_mipsisa32r2           33
-#define bfd_mach_mipsisa64             64
-#define bfd_mach_mipsisa64r2           65
-#define bfd_mach_mips_micromips        96
-  bfd_arch_i386,      /* Intel 386 */
-#define bfd_mach_i386_intel_syntax     (1 << 0)
-#define bfd_mach_i386_i8086            (1 << 1)
-#define bfd_mach_i386_i386             (1 << 2)
-#define bfd_mach_x86_64                (1 << 3)
-#define bfd_mach_x64_32                (1 << 4)
-#define bfd_mach_i386_i386_intel_syntax (bfd_mach_i386_i386 | bfd_mach_i386_intel_syntax)
-#define bfd_mach_x86_64_intel_syntax   (bfd_mach_x86_64 | bfd_mach_i386_intel_syntax)
-#define bfd_mach_x64_32_intel_syntax   (bfd_mach_x64_32 | bfd_mach_i386_intel_syntax)
-  bfd_arch_l1om,   /* Intel L1OM */
-#define bfd_mach_l1om                  (1 << 5)
-#define bfd_mach_l1om_intel_syntax     (bfd_mach_l1om | bfd_mach_i386_intel_syntax)
-  bfd_arch_k1om,   /* Intel K1OM */
-#define bfd_mach_k1om                  (1 << 6)
-#define bfd_mach_k1om_intel_syntax     (bfd_mach_k1om | bfd_mach_i386_intel_syntax)
-  bfd_arch_we32k,     /* AT&T WE32xxx */
-  bfd_arch_tahoe,     /* CCI/Harris Tahoe */
-  bfd_arch_i860,      /* Intel 860 */
-  bfd_arch_i370,      /* IBM 360/370 Mainframes */
-  bfd_arch_romp,      /* IBM ROMP PC/RT */
-  bfd_arch_convex,    /* Convex */
-  bfd_arch_m88k,      /* Motorola 88xxx */
-  bfd_arch_m98k,      /* Motorola 98xxx */
-  bfd_arch_pyramid,   /* Pyramid Technology */
-  bfd_arch_h8300,     /* Renesas H8/300 (formerly Hitachi H8/300) */
-#define bfd_mach_h8300    1
-#define bfd_mach_h8300h   2
-#define bfd_mach_h8300s   3
-#define bfd_mach_h8300hn  4
-#define bfd_mach_h8300sn  5
-#define bfd_mach_h8300sx  6
-#define bfd_mach_h8300sxn 7
-  bfd_arch_pdp11,     /* DEC PDP-11 */
-  bfd_arch_plugin,
-  bfd_arch_powerpc,   /* PowerPC */
-#define bfd_mach_ppc           32
-#define bfd_mach_ppc64         64
-#define bfd_mach_ppc_403       403
-#define bfd_mach_ppc_403gc     4030
-#define bfd_mach_ppc_405       405
-#define bfd_mach_ppc_505       505
-#define bfd_mach_ppc_601       601
-#define bfd_mach_ppc_602       602
-#define bfd_mach_ppc_603       603
-#define bfd_mach_ppc_ec603e    6031
-#define bfd_mach_ppc_604       604
-#define bfd_mach_ppc_620       620
-#define bfd_mach_ppc_630       630
-#define bfd_mach_ppc_750       750
-#define bfd_mach_ppc_860       860
-#define bfd_mach_ppc_a35       35
-#define bfd_mach_ppc_rs64ii    642
-#define bfd_mach_ppc_rs64iii   643
-#define bfd_mach_ppc_7400      7400
-#define bfd_mach_ppc_e500      500
-#define bfd_mach_ppc_e500mc    5001
-#define bfd_mach_ppc_e500mc64  5005
-#define bfd_mach_ppc_e5500     5006
-#define bfd_mach_ppc_e6500     5007
-#define bfd_mach_ppc_titan     83
-#define bfd_mach_ppc_vle       84
-  bfd_arch_rs6000,    /* IBM RS/6000 */
-#define bfd_mach_rs6k          6000
-#define bfd_mach_rs6k_rs1      6001
-#define bfd_mach_rs6k_rsc      6003
-#define bfd_mach_rs6k_rs2      6002
-  bfd_arch_hppa,      /* HP PA RISC */
-#define bfd_mach_hppa10        10
-#define bfd_mach_hppa11        11
-#define bfd_mach_hppa20        20
-#define bfd_mach_hppa20w       25
-  bfd_arch_d10v,      /* Mitsubishi D10V */
-#define bfd_mach_d10v          1
-#define bfd_mach_d10v_ts2      2
-#define bfd_mach_d10v_ts3      3
-  bfd_arch_d30v,      /* Mitsubishi D30V */
-  bfd_arch_dlx,       /* DLX */
-  bfd_arch_m68hc11,   /* Motorola 68HC11 */
-  bfd_arch_m68hc12,   /* Motorola 68HC12 */
-#define bfd_mach_m6812_default 0
-#define bfd_mach_m6812         1
-#define bfd_mach_m6812s        2
-  bfd_arch_m9s12x,   /* Freescale S12X */
-  bfd_arch_m9s12xg,  /* Freescale XGATE */
-  bfd_arch_z8k,       /* Zilog Z8000 */
-#define bfd_mach_z8001         1
-#define bfd_mach_z8002         2
-  bfd_arch_h8500,     /* Renesas H8/500 (formerly Hitachi H8/500) */
-  bfd_arch_sh,        /* Renesas / SuperH SH (formerly Hitachi SH) */
-#define bfd_mach_sh            1
-#define bfd_mach_sh2        0x20
-#define bfd_mach_sh_dsp     0x2d
-#define bfd_mach_sh2a       0x2a
-#define bfd_mach_sh2a_nofpu 0x2b
-#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
-#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
-#define bfd_mach_sh2a_or_sh4  0x2a3
-#define bfd_mach_sh2a_or_sh3e 0x2a4
-#define bfd_mach_sh2e       0x2e
-#define bfd_mach_sh3        0x30
-#define bfd_mach_sh3_nommu  0x31
-#define bfd_mach_sh3_dsp    0x3d
-#define bfd_mach_sh3e       0x3e
-#define bfd_mach_sh4        0x40
-#define bfd_mach_sh4_nofpu  0x41
-#define bfd_mach_sh4_nommu_nofpu  0x42
-#define bfd_mach_sh4a       0x4a
-#define bfd_mach_sh4a_nofpu 0x4b
-#define bfd_mach_sh4al_dsp  0x4d
-#define bfd_mach_sh5        0x50
-  bfd_arch_alpha,     /* Dec Alpha */
-#define bfd_mach_alpha_ev4  0x10
-#define bfd_mach_alpha_ev5  0x20
-#define bfd_mach_alpha_ev6  0x30
-  bfd_arch_arm,       /* Advanced Risc Machines ARM.  */
-#define bfd_mach_arm_unknown   0
-#define bfd_mach_arm_2         1
-#define bfd_mach_arm_2a        2
-#define bfd_mach_arm_3         3
-#define bfd_mach_arm_3M        4
-#define bfd_mach_arm_4         5
-#define bfd_mach_arm_4T        6
-#define bfd_mach_arm_5         7
-#define bfd_mach_arm_5T        8
-#define bfd_mach_arm_5TE       9
-#define bfd_mach_arm_XScale    10
-#define bfd_mach_arm_ep9312    11
-#define bfd_mach_arm_iWMMXt    12
-#define bfd_mach_arm_iWMMXt2   13
-  bfd_arch_ns32k,     /* National Semiconductors ns32000 */
-  bfd_arch_w65,       /* WDC 65816 */
-  bfd_arch_tic30,     /* Texas Instruments TMS320C30 */
-  bfd_arch_tic4x,     /* Texas Instruments TMS320C3X/4X */
-#define bfd_mach_tic3x         30
-#define bfd_mach_tic4x         40
-  bfd_arch_tic54x,    /* Texas Instruments TMS320C54X */
-  bfd_arch_tic6x,     /* Texas Instruments TMS320C6X */
-  bfd_arch_tic80,     /* TI TMS320c80 (MVP) */
-  bfd_arch_v850,      /* NEC V850 */
-#define bfd_mach_v850          1
-#define bfd_mach_v850e         'E'
-#define bfd_mach_v850e1        '1'
-#define bfd_mach_v850e2        0x4532
-#define bfd_mach_v850e2v3      0x45325633
-  bfd_arch_arc,       /* ARC Cores */
-#define bfd_mach_arc_5         5
-#define bfd_mach_arc_6         6
-#define bfd_mach_arc_7         7
-#define bfd_mach_arc_8         8
- bfd_arch_m32c,     /* Renesas M16C/M32C.  */
-#define bfd_mach_m16c        0x75
-#define bfd_mach_m32c        0x78
-  bfd_arch_m32r,      /* Renesas M32R (formerly Mitsubishi M32R/D) */
-#define bfd_mach_m32r          1 /* For backwards compatibility.  */
-#define bfd_mach_m32rx         'x'
-#define bfd_mach_m32r2         '2'
-  bfd_arch_mn10200,   /* Matsushita MN10200 */
-  bfd_arch_mn10300,   /* Matsushita MN10300 */
-#define bfd_mach_mn10300               300
-#define bfd_mach_am33          330
-#define bfd_mach_am33_2        332
-  bfd_arch_fr30,
-#define bfd_mach_fr30          0x46523330
-  bfd_arch_frv,
-#define bfd_mach_frv           1
-#define bfd_mach_frvsimple     2
-#define bfd_mach_fr300         300
-#define bfd_mach_fr400         400
-#define bfd_mach_fr450         450
-#define bfd_mach_frvtomcat     499     /* fr500 prototype */
-#define bfd_mach_fr500         500
-#define bfd_mach_fr550         550
-  bfd_arch_moxie,       /* The moxie processor */
-#define bfd_mach_moxie         1
-  bfd_arch_mcore,
-  bfd_arch_mep,
-#define bfd_mach_mep           1
-#define bfd_mach_mep_h1        0x6831
-#define bfd_mach_mep_c5        0x6335
-  bfd_arch_ia64,      /* HP/Intel ia64 */
-#define bfd_mach_ia64_elf64    64
-#define bfd_mach_ia64_elf32    32
-  bfd_arch_ip2k,      /* Ubicom IP2K microcontrollers. */
-#define bfd_mach_ip2022        1
-#define bfd_mach_ip2022ext     2
- bfd_arch_iq2000,     /* Vitesse IQ2000.  */
-#define bfd_mach_iq2000        1
-#define bfd_mach_iq10          2
-  bfd_arch_epiphany,   /* Adapteva EPIPHANY */
-#define bfd_mach_epiphany16    1
-#define bfd_mach_epiphany32    2
-  bfd_arch_mt,
-#define bfd_mach_ms1           1
-#define bfd_mach_mrisc2        2
-#define bfd_mach_ms2           3
-  bfd_arch_pj,
-  bfd_arch_avr,       /* Atmel AVR microcontrollers.  */
-#define bfd_mach_avr1          1
-#define bfd_mach_avr2          2
-#define bfd_mach_avr25         25
-#define bfd_mach_avr3          3
-#define bfd_mach_avr31         31
-#define bfd_mach_avr35         35
-#define bfd_mach_avr4          4
-#define bfd_mach_avr5          5
-#define bfd_mach_avr51         51
-#define bfd_mach_avr6          6
-#define bfd_mach_avrxmega1 101
-#define bfd_mach_avrxmega2 102
-#define bfd_mach_avrxmega3 103
-#define bfd_mach_avrxmega4 104
-#define bfd_mach_avrxmega5 105
-#define bfd_mach_avrxmega6 106
-#define bfd_mach_avrxmega7 107
-  bfd_arch_bfin,        /* ADI Blackfin */
-#define bfd_mach_bfin          1
-  bfd_arch_cr16,       /* National Semiconductor CompactRISC (ie CR16). */
-#define bfd_mach_cr16          1
-  bfd_arch_cr16c,       /* National Semiconductor CompactRISC. */
-#define bfd_mach_cr16c         1
-  bfd_arch_crx,       /*  National Semiconductor CRX.  */
-#define bfd_mach_crx           1
-  bfd_arch_cris,      /* Axis CRIS */
-#define bfd_mach_cris_v0_v10   255
-#define bfd_mach_cris_v32      32
-#define bfd_mach_cris_v10_v32  1032
-  bfd_arch_rl78,
-#define bfd_mach_rl78  0x75
-  bfd_arch_rx,        /* Renesas RX.  */
-#define bfd_mach_rx            0x75
-  bfd_arch_s390,      /* IBM s390 */
-#define bfd_mach_s390_31       31
-#define bfd_mach_s390_64       64
-  bfd_arch_score,     /* Sunplus score */ 
-#define bfd_mach_score3         3
-#define bfd_mach_score7         7
-  bfd_arch_openrisc,  /* OpenRISC */
-  bfd_arch_mmix,      /* Donald Knuth's educational processor.  */
-  bfd_arch_xstormy16,
-#define bfd_mach_xstormy16     1
-  bfd_arch_msp430,    /* Texas Instruments MSP430 architecture.  */
-#define bfd_mach_msp11          11
-#define bfd_mach_msp110         110
-#define bfd_mach_msp12          12
-#define bfd_mach_msp13          13
-#define bfd_mach_msp14          14
-#define bfd_mach_msp15          15
-#define bfd_mach_msp16          16
-#define bfd_mach_msp21          21
-#define bfd_mach_msp31          31
-#define bfd_mach_msp32          32
-#define bfd_mach_msp33          33
-#define bfd_mach_msp41          41
-#define bfd_mach_msp42          42
-#define bfd_mach_msp43          43
-#define bfd_mach_msp44          44
-  bfd_arch_xc16x,     /* Infineon's XC16X Series.               */
-#define bfd_mach_xc16x         1
-#define bfd_mach_xc16xl        2
-#define bfd_mach_xc16xs        3
-  bfd_arch_xgate,   /* Freescale XGATE */
-#define bfd_mach_xgate         1
-  bfd_arch_xtensa,    /* Tensilica's Xtensa cores.  */
-#define bfd_mach_xtensa        1
-  bfd_arch_z80,
-#define bfd_mach_z80strict      1 /* No undocumented opcodes.  */
-#define bfd_mach_z80            3 /* With ixl, ixh, iyl, and iyh.  */
-#define bfd_mach_z80full        7 /* All undocumented instructions.  */
-#define bfd_mach_r800           11 /* R800: successor with multiplication.  */
-  bfd_arch_lm32,      /* Lattice Mico32 */
-#define bfd_mach_lm32      1
-  bfd_arch_microblaze,/* Xilinx MicroBlaze. */
-  bfd_arch_tilepro,   /* Tilera TILEPro */
-  bfd_arch_tilegx, /* Tilera TILE-Gx */
-#define bfd_mach_tilepro   1
-#define bfd_mach_tilegx    1
-#define bfd_mach_tilegx32  2
-  bfd_arch_last
-  @};
-@end example
-
-@subsection bfd_arch_info
-
-
-@strong{Description}@*
-This structure contains information on architectures for use
-within BFD.
-@example
-
-typedef struct bfd_arch_info
-@{
-  int bits_per_word;
-  int bits_per_address;
-  int bits_per_byte;
-  enum bfd_architecture arch;
-  unsigned long mach;
-  const char *arch_name;
-  const char *printable_name;
-  unsigned int section_align_power;
-  /* TRUE if this is the default machine for the architecture.
-     The default arch should be the first entry for an arch so that
-     all the entries for that arch can be accessed via @code{next}.  */
-  bfd_boolean the_default;
-  const struct bfd_arch_info * (*compatible)
-    (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
-
-  bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
-
-  /* Allocate via bfd_malloc and return a fill buffer of size COUNT.  If
-     IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If CODE is
-     TRUE, the buffer contains code.  */
-  void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian,
-                 bfd_boolean code);
-
-  const struct bfd_arch_info *next;
-@}
-bfd_arch_info_type;
-
-@end example
-
-@findex bfd_printable_name
-@subsubsection @code{bfd_printable_name}
-@strong{Synopsis}
-@example
-const char *bfd_printable_name (bfd *abfd);
-@end example
-@strong{Description}@*
-Return a printable string representing the architecture and machine
-from the pointer to the architecture info structure.
-
-@findex bfd_scan_arch
-@subsubsection @code{bfd_scan_arch}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_scan_arch (const char *string);
-@end example
-@strong{Description}@*
-Figure out if BFD supports any cpu which could be described with
-the name @var{string}.  Return a pointer to an @code{arch_info}
-structure if a machine is found, otherwise NULL.
-
-@findex bfd_arch_list
-@subsubsection @code{bfd_arch_list}
-@strong{Synopsis}
-@example
-const char **bfd_arch_list (void);
-@end example
-@strong{Description}@*
-Return a freshly malloced NULL-terminated vector of the names
-of all the valid BFD architectures.  Do not modify the names.
-
-@findex bfd_arch_get_compatible
-@subsubsection @code{bfd_arch_get_compatible}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_arch_get_compatible
-   (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
-@end example
-@strong{Description}@*
-Determine whether two BFDs' architectures and machine types
-are compatible.  Calculates the lowest common denominator
-between the two architectures and machine types implied by
-the BFDs and returns a pointer to an @code{arch_info} structure
-describing the compatible machine.
-
-@findex bfd_default_arch_struct
-@subsubsection @code{bfd_default_arch_struct}
-@strong{Description}@*
-The @code{bfd_default_arch_struct} is an item of
-@code{bfd_arch_info_type} which has been initialized to a fairly
-generic state.  A BFD starts life by pointing to this
-structure, until the correct back end has determined the real
-architecture of the file.
-@example
-extern const bfd_arch_info_type bfd_default_arch_struct;
-@end example
-
-@findex bfd_set_arch_info
-@subsubsection @code{bfd_set_arch_info}
-@strong{Synopsis}
-@example
-void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
-@end example
-@strong{Description}@*
-Set the architecture info of @var{abfd} to @var{arg}.
-
-@findex bfd_default_set_arch_mach
-@subsubsection @code{bfd_default_set_arch_mach}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_default_set_arch_mach
-   (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
-@end example
-@strong{Description}@*
-Set the architecture and machine type in BFD @var{abfd}
-to @var{arch} and @var{mach}.  Find the correct
-pointer to a structure and insert it into the @code{arch_info}
-pointer.
-
-@findex bfd_get_arch
-@subsubsection @code{bfd_get_arch}
-@strong{Synopsis}
-@example
-enum bfd_architecture bfd_get_arch (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the enumerated type which describes the BFD @var{abfd}'s
-architecture.
-
-@findex bfd_get_mach
-@subsubsection @code{bfd_get_mach}
-@strong{Synopsis}
-@example
-unsigned long bfd_get_mach (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the long type which describes the BFD @var{abfd}'s
-machine.
-
-@findex bfd_arch_bits_per_byte
-@subsubsection @code{bfd_arch_bits_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_bits_per_byte (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of bits in one of the BFD @var{abfd}'s
-architecture's bytes.
-
-@findex bfd_arch_bits_per_address
-@subsubsection @code{bfd_arch_bits_per_address}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_bits_per_address (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of bits in one of the BFD @var{abfd}'s
-architecture's addresses.
-
-@findex bfd_default_compatible
-@subsubsection @code{bfd_default_compatible}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_default_compatible
-   (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
-@end example
-@strong{Description}@*
-The default function for testing for compatibility.
-
-@findex bfd_default_scan
-@subsubsection @code{bfd_default_scan}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_default_scan
-   (const struct bfd_arch_info *info, const char *string);
-@end example
-@strong{Description}@*
-The default function for working out whether this is an
-architecture hit and a machine hit.
-
-@findex bfd_get_arch_info
-@subsubsection @code{bfd_get_arch_info}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the architecture info struct in @var{abfd}.
-
-@findex bfd_lookup_arch
-@subsubsection @code{bfd_lookup_arch}
-@strong{Synopsis}
-@example
-const bfd_arch_info_type *bfd_lookup_arch
-   (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-Look for the architecture info structure which matches the
-arguments @var{arch} and @var{machine}. A machine of 0 matches the
-machine/architecture structure which marks itself as the
-default.
-
-@findex bfd_printable_arch_mach
-@subsubsection @code{bfd_printable_arch_mach}
-@strong{Synopsis}
-@example
-const char *bfd_printable_arch_mach
-   (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-Return a printable string representing the architecture and
-machine type.
-
-This routine is depreciated.
-
-@findex bfd_octets_per_byte
-@subsubsection @code{bfd_octets_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_octets_per_byte (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the number of octets (8-bit quantities) per target byte
-(minimum addressable unit).  In most cases, this will be one, but some
-DSP targets have 16, 32, or even 48 bits per byte.
-
-@findex bfd_arch_mach_octets_per_byte
-@subsubsection @code{bfd_arch_mach_octets_per_byte}
-@strong{Synopsis}
-@example
-unsigned int bfd_arch_mach_octets_per_byte
-   (enum bfd_architecture arch, unsigned long machine);
-@end example
-@strong{Description}@*
-See bfd_octets_per_byte.
-
-This routine is provided for those cases where a bfd * is not
-available
-
-@findex bfd_arch_default_fill
-@subsubsection @code{bfd_arch_default_fill}
-@strong{Synopsis}
-@example
-void *bfd_arch_default_fill (bfd_size_type count,
-    bfd_boolean is_bigendian,
-    bfd_boolean code);
-@end example
-@strong{Description}@*
-Allocate via bfd_malloc and return a fill buffer of size COUNT.
-If IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If
-CODE is TRUE, the buffer contains code.
-
diff --git a/bfd/doc/bfd.info b/bfd/doc/bfd.info
index f38bee1..9c2fcd6 100644
--- a/bfd/doc/bfd.info
+++ b/bfd/doc/bfd.info
Binary files differ
diff --git a/bfd/doc/bfd.texinfo b/bfd/doc/bfd.texinfo
index 45ffa73..ec709c1 100644
--- a/bfd/doc/bfd.texinfo
+++ b/bfd/doc/bfd.texinfo
@@ -1,8 +1,6 @@
 \input texinfo.tex
 @setfilename bfd.info
-@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000,
-@c 2001, 2002, 2003, 2006, 2007, 2008, 2009
-@c Free Software Foundation, Inc.
+@c Copyright 1988-2013 Free Software Foundation, Inc.
 @c 
 @synindex fn cp
 
@@ -16,7 +14,7 @@
 @copying
 This file documents the BFD library.
 
-Copyright @copyright{} 1991, 2000, 2001, 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright @copyright{} 1991 - 2013 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -64,7 +62,7 @@
 @end tex
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 2001, 2003, 2006, 2008 Free Software Foundation, Inc.
+Copyright @copyright{} 1991 - 2013 Free Software Foundation, Inc.
 
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.3
@@ -196,10 +194,11 @@
 
 @node BFD front end, BFD back ends, Overview, Top
 @chapter BFD Front End
-@include bfdt.texi
-@include bfdio.texi
 
 @menu
+* typedef bfd::
+* Error reporting::
+* Miscellaneous::
 * Memory Usage::
 * Initialization::
 * Sections::
@@ -217,7 +216,10 @@
 * Hash Tables::
 @end menu
 
-@node Memory Usage, Initialization, BFD front end, BFD front end
+@include bfdt.texi
+@include bfdio.texi
+
+@node Memory Usage, Initialization, Miscellaneous, BFD front end
 @section Memory Usage
 BFD keeps all of its internal structures in obstacks. There is one obstack
 per open BFD file, into which the current state is stored. When a BFD is
@@ -322,7 +324,7 @@
 @printindex cp
 
 @tex
-% I think something like @colophon should be in texinfo.  In the
+% I think something like @@colophon should be in texinfo.  In the
 % meantime:
 \long\def\colophon{\hbox to0pt{}\vfill
 \centerline{The body of this manual is set in}
@@ -333,7 +335,7 @@
 \centerline{{\sl\fontname\tensl\/}}
 \centerline{are used for emphasis.}\vfill}
 \page\colophon
-% Blame: doc@cygnus.com, 28mar91.
+% Blame: doc@@cygnus.com, 28mar91.
 @end tex
 
 @bye
diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi
index 1e03aeb..afc9df6 100644
--- a/bfd/doc/bfdint.texi
+++ b/bfd/doc/bfdint.texi
@@ -1,6 +1,6 @@
 \input texinfo
 @c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-@c 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2009
+@c 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2009, 2013
 @c Free Software Foundation, Inc.
 @setfilename bfdint.info
 
@@ -945,7 +945,7 @@
 you configure with the @samp{--enable-maintainer-mode} option.  Some
 files live in the object directory---the directory from which you run
 configure---and some live in the source directory.  All files that live
-in the source directory are checked into the CVS repository.
+in the source directory are checked into the git repository.
 
 @table @file
 @item bfd.h
diff --git a/bfd/doc/bfdio.texi b/bfd/doc/bfdio.texi
deleted file mode 100644
index ff8275f..0000000
--- a/bfd/doc/bfdio.texi
+++ /dev/null
@@ -1,95 +0,0 @@
-@findex struct bfd_iovec
-@subsubsection @code{struct bfd_iovec}
-@strong{Description}@*
-The @code{struct bfd_iovec} contains the internal file I/O class.
-Each @code{BFD} has an instance of this class and all file I/O is
-routed through it (it is assumed that the instance implements
-all methods listed below).
-@example
-struct bfd_iovec
-@{
-  /* To avoid problems with macros, a "b" rather than "f"
-     prefix is prepended to each method name.  */
-  /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
-     bytes starting at PTR.  Return the number of bytes actually
-     transfered (a read past end-of-file returns less than NBYTES),
-     or -1 (setting @code{bfd_error}) if an error occurs.  */
-  file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
-  file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
-                      file_ptr nbytes);
-  /* Return the current IOSTREAM file offset, or -1 (setting @code{bfd_error}
-     if an error occurs.  */
-  file_ptr (*btell) (struct bfd *abfd);
-  /* For the following, on successful completion a value of 0 is returned.
-     Otherwise, a value of -1 is returned (and  @code{bfd_error} is set).  */
-  int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
-  int (*bclose) (struct bfd *abfd);
-  int (*bflush) (struct bfd *abfd);
-  int (*bstat) (struct bfd *abfd, struct stat *sb);
-  /* Mmap a part of the files. ADDR, LEN, PROT, FLAGS and OFFSET are the usual
-     mmap parameter, except that LEN and OFFSET do not need to be page
-     aligned.  Returns (void *)-1 on failure, mmapped address on success.
-     Also write in MAP_ADDR the address of the page aligned buffer and in
-     MAP_LEN the size mapped (a page multiple).  Use unmap with MAP_ADDR and
-     MAP_LEN to unmap.  */
-  void *(*bmmap) (struct bfd *abfd, void *addr, bfd_size_type len,
-                  int prot, int flags, file_ptr offset,
-                  void **map_addr, bfd_size_type *map_len);
-@};
-extern const struct bfd_iovec _bfd_memory_iovec;
-@end example
-
-@findex bfd_get_mtime
-@subsubsection @code{bfd_get_mtime}
-@strong{Synopsis}
-@example
-long bfd_get_mtime (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the file modification time (as read from the file system, or
-from the archive header for archive members).
-
-@findex bfd_get_size
-@subsubsection @code{bfd_get_size}
-@strong{Synopsis}
-@example
-file_ptr bfd_get_size (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the file size (as read from file system) for the file
-associated with BFD @var{abfd}.
-
-The initial motivation for, and use of, this routine is not
-so we can get the exact size of the object the BFD applies to, since
-that might not be generally possible (archive members for example).
-It would be ideal if someone could eventually modify
-it so that such results were guaranteed.
-
-Instead, we want to ask questions like "is this NNN byte sized
-object I'm about to try read from file offset YYY reasonable?"
-As as example of where we might do this, some object formats
-use string tables for which the first @code{sizeof (long)} bytes of the
-table contain the size of the table itself, including the size bytes.
-If an application tries to read what it thinks is one of these
-string tables, without some way to validate the size, and for
-some reason the size is wrong (byte swapping error, wrong location
-for the string table, etc.), the only clue is likely to be a read
-error when it tries to read the table, or a "virtual memory
-exhausted" error when it tries to allocate 15 bazillon bytes
-of space for the 15 bazillon byte table it is about to read.
-This function at least allows us to answer the question, "is the
-size reasonable?".
-
-@findex bfd_mmap
-@subsubsection @code{bfd_mmap}
-@strong{Synopsis}
-@example
-void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
-    int prot, int flags, file_ptr offset,
-    void **map_addr, bfd_size_type *map_len);
-@end example
-@strong{Description}@*
-Return mmap()ed region of the file, if possible and implemented.
-LEN and OFFSET do not need to be page aligned.  The page aligned
-address and length are written to MAP_ADDR and MAP_LEN.
-
diff --git a/bfd/doc/bfdsumm.texi b/bfd/doc/bfdsumm.texi
index 77a5f09..0cd0252 100644
--- a/bfd/doc/bfdsumm.texi
+++ b/bfd/doc/bfdsumm.texi
@@ -1,4 +1,7 @@
 @c This summary of BFD is shared by the BFD and LD docs.
+@c Copyright 2012
+@c Free Software Foundation, Inc.
+
 When an object file is opened, BFD subroutines automatically determine
 the format of the input object file.  They then build a descriptor in
 memory with pointers to routines that will be used to access elements of
diff --git a/bfd/doc/bfdt.texi b/bfd/doc/bfdt.texi
deleted file mode 100644
index ad9f3e2..0000000
--- a/bfd/doc/bfdt.texi
+++ /dev/null
@@ -1,933 +0,0 @@
-@section @code{typedef bfd}
-A BFD has type @code{bfd}; objects of this type are the
-cornerstone of any application using BFD. Using BFD
-consists of making references though the BFD and to data in the BFD.
-
-Here is the structure that defines the type @code{bfd}.  It
-contains the major data about the file and pointers
-to the rest of the data.
-
-
-@example
-
-enum bfd_direction
-  @{
-    no_direction = 0,
-    read_direction = 1,
-    write_direction = 2,
-    both_direction = 3
-  @};
-
-struct bfd
-@{
-  /* A unique identifier of the BFD  */
-  unsigned int id;
-
-  /* The filename the application opened the BFD with.  */
-  const char *filename;
-
-  /* A pointer to the target jump table.  */
-  const struct bfd_target *xvec;
-
-  /* The IOSTREAM, and corresponding IO vector that provide access
-     to the file backing the BFD.  */
-  void *iostream;
-  const struct bfd_iovec *iovec;
-
-  /* The caching routines use these to maintain a
-     least-recently-used list of BFDs.  */
-  struct bfd *lru_prev, *lru_next;
-
-  /* When a file is closed by the caching routines, BFD retains
-     state information on the file here...  */
-  ufile_ptr where;
-
-  /* File modified time, if mtime_set is TRUE.  */
-  long mtime;
-
-  /* Reserved for an unimplemented file locking extension.  */
-  int ifd;
-
-  /* The format which belongs to the BFD. (object, core, etc.)  */
-  bfd_format format;
-
-  /* The direction with which the BFD was opened.  */
-  enum bfd_direction direction;
-
-  /* Format_specific flags.  */
-  flagword flags;
-
-  /* Values that may appear in the flags field of a BFD.  These also
-     appear in the object_flags field of the bfd_target structure, where
-     they indicate the set of flags used by that backend (not all flags
-     are meaningful for all object file formats) (FIXME: at the moment,
-     the object_flags values have mostly just been copied from backend
-     to another, and are not necessarily correct).  */
-
-#define BFD_NO_FLAGS   0x00
-
-  /* BFD contains relocation entries.  */
-#define HAS_RELOC      0x01
-
-  /* BFD is directly executable.  */
-#define EXEC_P         0x02
-
-  /* BFD has line number information (basically used for F_LNNO in a
-     COFF header).  */
-#define HAS_LINENO     0x04
-
-  /* BFD has debugging information.  */
-#define HAS_DEBUG      0x08
-
-  /* BFD has symbols.  */
-#define HAS_SYMS       0x10
-
-  /* BFD has local symbols (basically used for F_LSYMS in a COFF
-     header).  */
-#define HAS_LOCALS     0x20
-
-  /* BFD is a dynamic object.  */
-#define DYNAMIC        0x40
-
-  /* Text section is write protected (if D_PAGED is not set, this is
-     like an a.out NMAGIC file) (the linker sets this by default, but
-     clears it for -r or -N).  */
-#define WP_TEXT        0x80
-
-  /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
-     linker sets this by default, but clears it for -r or -n or -N).  */
-#define D_PAGED        0x100
-
-  /* BFD is relaxable (this means that bfd_relax_section may be able to
-     do something) (sometimes bfd_relax_section can do something even if
-     this is not set).  */
-#define BFD_IS_RELAXABLE 0x200
-
-  /* This may be set before writing out a BFD to request using a
-     traditional format.  For example, this is used to request that when
-     writing out an a.out object the symbols not be hashed to eliminate
-     duplicates.  */
-#define BFD_TRADITIONAL_FORMAT 0x400
-
-  /* This flag indicates that the BFD contents are actually cached
-     in memory.  If this is set, iostream points to a bfd_in_memory
-     struct.  */
-#define BFD_IN_MEMORY 0x800
-
-  /* The sections in this BFD specify a memory page.  */
-#define HAS_LOAD_PAGE 0x1000
-
-  /* This BFD has been created by the linker and doesn't correspond
-     to any input file.  */
-#define BFD_LINKER_CREATED 0x2000
-
-  /* This may be set before writing out a BFD to request that it
-     be written using values for UIDs, GIDs, timestamps, etc. that
-     will be consistent from run to run.  */
-#define BFD_DETERMINISTIC_OUTPUT 0x4000
-
-  /* Compress sections in this BFD.  */
-#define BFD_COMPRESS 0x8000
-
-  /* Decompress sections in this BFD.  */
-#define BFD_DECOMPRESS 0x10000
-
-  /* BFD is a dummy, for plugins.  */
-#define BFD_PLUGIN 0x20000
-
-  /* Flags bits to be saved in bfd_preserve_save.  */
-#define BFD_FLAGS_SAVED \
-  (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN)
-
-  /* Flags bits which are for BFD use only.  */
-#define BFD_FLAGS_FOR_BFD_USE_MASK \
-  (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \
-   | BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT)
-
-  /* Currently my_archive is tested before adding origin to
-     anything. I believe that this can become always an add of
-     origin, with origin set to 0 for non archive files.  */
-  ufile_ptr origin;
-
-  /* The origin in the archive of the proxy entry.  This will
-     normally be the same as origin, except for thin archives,
-     when it will contain the current offset of the proxy in the
-     thin archive rather than the offset of the bfd in its actual
-     container.  */
-  ufile_ptr proxy_origin;
-
-  /* A hash table for section names.  */
-  struct bfd_hash_table section_htab;
-
-  /* Pointer to linked list of sections.  */
-  struct bfd_section *sections;
-
-  /* The last section on the section list.  */
-  struct bfd_section *section_last;
-
-  /* The number of sections.  */
-  unsigned int section_count;
-
-  /* Stuff only useful for object files:
-     The start address.  */
-  bfd_vma start_address;
-
-  /* Used for input and output.  */
-  unsigned int symcount;
-
-  /* Symbol table for output BFD (with symcount entries).
-     Also used by the linker to cache input BFD symbols.  */
-  struct bfd_symbol  **outsymbols;
-
-  /* Used for slurped dynamic symbol tables.  */
-  unsigned int dynsymcount;
-
-  /* Pointer to structure which contains architecture information.  */
-  const struct bfd_arch_info *arch_info;
-
-  /* Stuff only useful for archives.  */
-  void *arelt_data;
-  struct bfd *my_archive;      /* The containing archive BFD.  */
-  struct bfd *archive_next;    /* The next BFD in the archive.  */
-  struct bfd *archive_head;    /* The first BFD in the archive.  */
-  struct bfd *nested_archives; /* List of nested archive in a flattened
-                                  thin archive.  */
-
-  /* A chain of BFD structures involved in a link.  */
-  struct bfd *link_next;
-
-  /* A field used by _bfd_generic_link_add_archive_symbols.  This will
-     be used only for archive elements.  */
-  int archive_pass;
-
-  /* Used by the back end to hold private data.  */
-  union
-    @{
-      struct aout_data_struct *aout_data;
-      struct artdata *aout_ar_data;
-      struct _oasys_data *oasys_obj_data;
-      struct _oasys_ar_data *oasys_ar_data;
-      struct coff_tdata *coff_obj_data;
-      struct pe_tdata *pe_obj_data;
-      struct xcoff_tdata *xcoff_obj_data;
-      struct ecoff_tdata *ecoff_obj_data;
-      struct ieee_data_struct *ieee_data;
-      struct ieee_ar_data_struct *ieee_ar_data;
-      struct srec_data_struct *srec_data;
-      struct verilog_data_struct *verilog_data;
-      struct ihex_data_struct *ihex_data;
-      struct tekhex_data_struct *tekhex_data;
-      struct elf_obj_tdata *elf_obj_data;
-      struct nlm_obj_tdata *nlm_obj_data;
-      struct bout_data_struct *bout_data;
-      struct mmo_data_struct *mmo_data;
-      struct sun_core_struct *sun_core_data;
-      struct sco5_core_struct *sco5_core_data;
-      struct trad_core_struct *trad_core_data;
-      struct som_data_struct *som_data;
-      struct hpux_core_struct *hpux_core_data;
-      struct hppabsd_core_struct *hppabsd_core_data;
-      struct sgi_core_struct *sgi_core_data;
-      struct lynx_core_struct *lynx_core_data;
-      struct osf_core_struct *osf_core_data;
-      struct cisco_core_struct *cisco_core_data;
-      struct versados_data_struct *versados_data;
-      struct netbsd_core_struct *netbsd_core_data;
-      struct mach_o_data_struct *mach_o_data;
-      struct mach_o_fat_data_struct *mach_o_fat_data;
-      struct plugin_data_struct *plugin_data;
-      struct bfd_pef_data_struct *pef_data;
-      struct bfd_pef_xlib_data_struct *pef_xlib_data;
-      struct bfd_sym_data_struct *sym_data;
-      void *any;
-    @}
-  tdata;
-
-  /* Used by the application to hold private data.  */
-  void *usrdata;
-
-  /* Where all the allocated stuff under this BFD goes.  This is a
-     struct objalloc *, but we use void * to avoid requiring the inclusion
-     of objalloc.h.  */
-  void *memory;
-
-  /* Is the file descriptor being cached?  That is, can it be closed as
-     needed, and re-opened when accessed later?  */
-  unsigned int cacheable : 1;
-
-  /* Marks whether there was a default target specified when the
-     BFD was opened. This is used to select which matching algorithm
-     to use to choose the back end.  */
-  unsigned int target_defaulted : 1;
-
-  /* ... and here: (``once'' means at least once).  */
-  unsigned int opened_once : 1;
-
-  /* Set if we have a locally maintained mtime value, rather than
-     getting it from the file each time.  */
-  unsigned int mtime_set : 1;
-
-  /* Flag set if symbols from this BFD should not be exported.  */
-  unsigned int no_export : 1;
-
-  /* Remember when output has begun, to stop strange things
-     from happening.  */
-  unsigned int output_has_begun : 1;
-
-  /* Have archive map.  */
-  unsigned int has_armap : 1;
-
-  /* Set if this is a thin archive.  */
-  unsigned int is_thin_archive : 1;
-
-  /* Set if only required symbols should be added in the link hash table for
-     this object.  Used by VMS linkers.  */
-  unsigned int selective_search : 1;
-@};
-
-@end example
-@section Error reporting
-Most BFD functions return nonzero on success (check their
-individual documentation for precise semantics).  On an error,
-they call @code{bfd_set_error} to set an error condition that callers
-can check by calling @code{bfd_get_error}.
-If that returns @code{bfd_error_system_call}, then check
-@code{errno}.
-
-The easiest way to report a BFD error to the user is to
-use @code{bfd_perror}.
-
-@subsection Type @code{bfd_error_type}
-The values returned by @code{bfd_get_error} are defined by the
-enumerated type @code{bfd_error_type}.
-
-
-@example
-
-typedef enum bfd_error
-@{
-  bfd_error_no_error = 0,
-  bfd_error_system_call,
-  bfd_error_invalid_target,
-  bfd_error_wrong_format,
-  bfd_error_wrong_object_format,
-  bfd_error_invalid_operation,
-  bfd_error_no_memory,
-  bfd_error_no_symbols,
-  bfd_error_no_armap,
-  bfd_error_no_more_archived_files,
-  bfd_error_malformed_archive,
-  bfd_error_file_not_recognized,
-  bfd_error_file_ambiguously_recognized,
-  bfd_error_no_contents,
-  bfd_error_nonrepresentable_section,
-  bfd_error_no_debug_section,
-  bfd_error_bad_value,
-  bfd_error_file_truncated,
-  bfd_error_file_too_big,
-  bfd_error_on_input,
-  bfd_error_invalid_error_code
-@}
-bfd_error_type;
-
-@end example
-@findex bfd_get_error
-@subsubsection @code{bfd_get_error}
-@strong{Synopsis}
-@example
-bfd_error_type bfd_get_error (void);
-@end example
-@strong{Description}@*
-Return the current BFD error condition.
-
-@findex bfd_set_error
-@subsubsection @code{bfd_set_error}
-@strong{Synopsis}
-@example
-void bfd_set_error (bfd_error_type error_tag, ...);
-@end example
-@strong{Description}@*
-Set the BFD error condition to be @var{error_tag}.
-If @var{error_tag} is bfd_error_on_input, then this function
-takes two more parameters, the input bfd where the error
-occurred, and the bfd_error_type error.
-
-@findex bfd_errmsg
-@subsubsection @code{bfd_errmsg}
-@strong{Synopsis}
-@example
-const char *bfd_errmsg (bfd_error_type error_tag);
-@end example
-@strong{Description}@*
-Return a string describing the error @var{error_tag}, or
-the system error if @var{error_tag} is @code{bfd_error_system_call}.
-
-@findex bfd_perror
-@subsubsection @code{bfd_perror}
-@strong{Synopsis}
-@example
-void bfd_perror (const char *message);
-@end example
-@strong{Description}@*
-Print to the standard error stream a string describing the
-last BFD error that occurred, or the last system error if
-the last BFD error was a system call failure.  If @var{message}
-is non-NULL and non-empty, the error string printed is preceded
-by @var{message}, a colon, and a space.  It is followed by a newline.
-
-@subsection BFD error handler
-Some BFD functions want to print messages describing the
-problem.  They call a BFD error handler function.  This
-function may be overridden by the program.
-
-The BFD error handler acts like printf.
-
-
-@example
-
-typedef void (*bfd_error_handler_type) (const char *, ...);
-
-@end example
-@findex bfd_set_error_handler
-@subsubsection @code{bfd_set_error_handler}
-@strong{Synopsis}
-@example
-bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-@end example
-@strong{Description}@*
-Set the BFD error handler function.  Returns the previous
-function.
-
-@findex bfd_set_error_program_name
-@subsubsection @code{bfd_set_error_program_name}
-@strong{Synopsis}
-@example
-void bfd_set_error_program_name (const char *);
-@end example
-@strong{Description}@*
-Set the program name to use when printing a BFD error.  This
-is printed before the error message followed by a colon and
-space.  The string must not be changed after it is passed to
-this function.
-
-@findex bfd_get_error_handler
-@subsubsection @code{bfd_get_error_handler}
-@strong{Synopsis}
-@example
-bfd_error_handler_type bfd_get_error_handler (void);
-@end example
-@strong{Description}@*
-Return the BFD error handler function.
-
-@subsection BFD assert handler
-If BFD finds an internal inconsistency, the bfd assert
-handler is called with information on the BFD version, BFD
-source file and line.  If this happens, most programs linked
-against BFD are expected to want to exit with an error, or mark
-the current BFD operation as failed, so it is recommended to
-override the default handler, which just calls
-_bfd_error_handler and continues.
-
-
-@example
-
-typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg,
-                                         const char *bfd_version,
-                                         const char *bfd_file,
-                                         int bfd_line);
-
-@end example
-@findex bfd_set_assert_handler
-@subsubsection @code{bfd_set_assert_handler}
-@strong{Synopsis}
-@example
-bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type);
-@end example
-@strong{Description}@*
-Set the BFD assert handler function.  Returns the previous
-function.
-
-@findex bfd_get_assert_handler
-@subsubsection @code{bfd_get_assert_handler}
-@strong{Synopsis}
-@example
-bfd_assert_handler_type bfd_get_assert_handler (void);
-@end example
-@strong{Description}@*
-Return the BFD assert handler function.
-
-@section Miscellaneous
-
-
-@subsection Miscellaneous functions
-
-
-@findex bfd_get_reloc_upper_bound
-@subsubsection @code{bfd_get_reloc_upper_bound}
-@strong{Synopsis}
-@example
-long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
-@end example
-@strong{Description}@*
-Return the number of bytes required to store the
-relocation information associated with section @var{sect}
-attached to bfd @var{abfd}.  If an error occurs, return -1.
-
-@findex bfd_canonicalize_reloc
-@subsubsection @code{bfd_canonicalize_reloc}
-@strong{Synopsis}
-@example
-long bfd_canonicalize_reloc
-   (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
-@end example
-@strong{Description}@*
-Call the back end associated with the open BFD
-@var{abfd} and translate the external form of the relocation
-information attached to @var{sec} into the internal canonical
-form.  Place the table into memory at @var{loc}, which has
-been preallocated, usually by a call to
-@code{bfd_get_reloc_upper_bound}.  Returns the number of relocs, or
--1 on error.
-
-The @var{syms} table is also needed for horrible internal magic
-reasons.
-
-@findex bfd_set_reloc
-@subsubsection @code{bfd_set_reloc}
-@strong{Synopsis}
-@example
-void bfd_set_reloc
-   (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
-@end example
-@strong{Description}@*
-Set the relocation pointer and count within
-section @var{sec} to the values @var{rel} and @var{count}.
-The argument @var{abfd} is ignored.
-
-@findex bfd_set_file_flags
-@subsubsection @code{bfd_set_file_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
-@end example
-@strong{Description}@*
-Set the flag word in the BFD @var{abfd} to the value @var{flags}.
-
-Possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_wrong_format} - The target bfd was not of object format.
-@item
-@code{bfd_error_invalid_operation} - The target bfd was open for reading.
-@item
-@code{bfd_error_invalid_operation} -
-The flag word contained a bit which was not applicable to the
-type of file.  E.g., an attempt was made to set the @code{D_PAGED} bit
-on a BFD format which does not support demand paging.
-@end itemize
-
-@findex bfd_get_arch_size
-@subsubsection @code{bfd_get_arch_size}
-@strong{Synopsis}
-@example
-int bfd_get_arch_size (bfd *abfd);
-@end example
-@strong{Description}@*
-Returns the architecture address size, in bits, as determined
-by the object file's format.  For ELF, this information is
-included in the header.
-
-@strong{Returns}@*
-Returns the arch size in bits if known, @code{-1} otherwise.
-
-@findex bfd_get_sign_extend_vma
-@subsubsection @code{bfd_get_sign_extend_vma}
-@strong{Synopsis}
-@example
-int bfd_get_sign_extend_vma (bfd *abfd);
-@end example
-@strong{Description}@*
-Indicates if the target architecture "naturally" sign extends
-an address.  Some architectures implicitly sign extend address
-values when they are converted to types larger than the size
-of an address.  For instance, bfd_get_start_address() will
-return an address sign extended to fill a bfd_vma when this is
-the case.
-
-@strong{Returns}@*
-Returns @code{1} if the target architecture is known to sign
-extend addresses, @code{0} if the target architecture is known to
-not sign extend addresses, and @code{-1} otherwise.
-
-@findex bfd_set_start_address
-@subsubsection @code{bfd_set_start_address}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
-@end example
-@strong{Description}@*
-Make @var{vma} the entry point of output BFD @var{abfd}.
-
-@strong{Returns}@*
-Returns @code{TRUE} on success, @code{FALSE} otherwise.
-
-@findex bfd_get_gp_size
-@subsubsection @code{bfd_get_gp_size}
-@strong{Synopsis}
-@example
-unsigned int bfd_get_gp_size (bfd *abfd);
-@end example
-@strong{Description}@*
-Return the maximum size of objects to be optimized using the GP
-register under MIPS ECOFF.  This is typically set by the @code{-G}
-argument to the compiler, assembler or linker.
-
-@findex bfd_set_gp_size
-@subsubsection @code{bfd_set_gp_size}
-@strong{Synopsis}
-@example
-void bfd_set_gp_size (bfd *abfd, unsigned int i);
-@end example
-@strong{Description}@*
-Set the maximum size of objects to be optimized using the GP
-register under ECOFF or MIPS ELF.  This is typically set by
-the @code{-G} argument to the compiler, assembler or linker.
-
-@findex bfd_scan_vma
-@subsubsection @code{bfd_scan_vma}
-@strong{Synopsis}
-@example
-bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
-@end example
-@strong{Description}@*
-Convert, like @code{strtoul}, a numerical expression
-@var{string} into a @code{bfd_vma} integer, and return that integer.
-(Though without as many bells and whistles as @code{strtoul}.)
-The expression is assumed to be unsigned (i.e., positive).
-If given a @var{base}, it is used as the base for conversion.
-A base of 0 causes the function to interpret the string
-in hex if a leading "0x" or "0X" is found, otherwise
-in octal if a leading zero is found, otherwise in decimal.
-
-If the value would overflow, the maximum @code{bfd_vma} value is
-returned.
-
-@findex bfd_copy_private_header_data
-@subsubsection @code{bfd_copy_private_header_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Copy private BFD header information from the BFD @var{ibfd} to the
-the BFD @var{obfd}.  This copies information that may require
-sections to exist, but does not require symbol tables.  Return
-@code{true} on success, @code{false} on error.
-Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_copy_private_header_data(ibfd, obfd) \
-     BFD_SEND (obfd, _bfd_copy_private_header_data, \
-               (ibfd, obfd))
-@end example
-
-@findex bfd_copy_private_bfd_data
-@subsubsection @code{bfd_copy_private_bfd_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Copy private BFD information from the BFD @var{ibfd} to the
-the BFD @var{obfd}.  Return @code{TRUE} on success, @code{FALSE} on error.
-Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
-     BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
-               (ibfd, obfd))
-@end example
-
-@findex bfd_merge_private_bfd_data
-@subsubsection @code{bfd_merge_private_bfd_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
-@end example
-@strong{Description}@*
-Merge private BFD information from the BFD @var{ibfd} to the
-the output file BFD @var{obfd} when linking.  Return @code{TRUE}
-on success, @code{FALSE} on error.  Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_merge_private_bfd_data(ibfd, obfd) \
-     BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
-               (ibfd, obfd))
-@end example
-
-@findex bfd_set_private_flags
-@subsubsection @code{bfd_set_private_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
-@end example
-@strong{Description}@*
-Set private BFD flag information in the BFD @var{abfd}.
-Return @code{TRUE} on success, @code{FALSE} on error.  Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{obfd}.
-@end itemize
-@example
-#define bfd_set_private_flags(abfd, flags) \
-     BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-@end example
-
-@findex Other functions
-@subsubsection @code{Other functions}
-@strong{Description}@*
-The following functions exist but have not yet been documented.
-@example
-#define bfd_sizeof_headers(abfd, info) \
-       BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
-       BFD_SEND (abfd, _bfd_find_nearest_line, \
-                 (abfd, sec, syms, off, file, func, line))
-
-#define bfd_find_line(abfd, syms, sym, file, line) \
-       BFD_SEND (abfd, _bfd_find_line, \
-                 (abfd, syms, sym, file, line))
-
-#define bfd_find_inliner_info(abfd, file, func, line) \
-       BFD_SEND (abfd, _bfd_find_inliner_info, \
-                 (abfd, file, func, line))
-
-#define bfd_debug_info_start(abfd) \
-       BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
-       BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
-       BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-#define bfd_stat_arch_elt(abfd, stat) \
-       BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
-       BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
-       BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
-       BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_gc_sections(abfd, link_info) \
-       BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-
-#define bfd_lookup_section_flags(link_info, flag_info, section) \
-       BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section))
-
-#define bfd_merge_sections(abfd, link_info) \
-       BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
-
-#define bfd_is_group_section(abfd, sec) \
-       BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
-
-#define bfd_discard_group(abfd, sec) \
-       BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-
-#define bfd_link_hash_table_create(abfd) \
-       BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_hash_table_free(abfd, hash) \
-       BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
-
-#define bfd_link_add_symbols(abfd, info) \
-       BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_link_just_syms(abfd, sec, info) \
-       BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-
-#define bfd_final_link(abfd, info) \
-       BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
-       BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
-       BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
-       BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
-       BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
-       BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
-                                                   dyncount, dynsyms, ret))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
-       BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
-       BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
-  (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
-   bfd_boolean, asymbol **);
-
-@end example
-
-@findex bfd_alt_mach_code
-@subsubsection @code{bfd_alt_mach_code}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
-@end example
-@strong{Description}@*
-When more than one machine code number is available for the
-same machine type, this function can be used to switch between
-the preferred one (alternative == 0) and any others.  Currently,
-only ELF supports this feature, with up to two alternate
-machine codes.
-
-
-@example
-struct bfd_preserve
-@{
-  void *marker;
-  void *tdata;
-  flagword flags;
-  const struct bfd_arch_info *arch_info;
-  struct bfd_section *sections;
-  struct bfd_section *section_last;
-  unsigned int section_count;
-  struct bfd_hash_table section_htab;
-@};
-
-@end example
-@findex bfd_preserve_save
-@subsubsection @code{bfd_preserve_save}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
-@end example
-@strong{Description}@*
-When testing an object for compatibility with a particular
-target back-end, the back-end object_p function needs to set
-up certain fields in the bfd on successfully recognizing the
-object.  This typically happens in a piecemeal fashion, with
-failures possible at many points.  On failure, the bfd is
-supposed to be restored to its initial state, which is
-virtually impossible.  However, restoring a subset of the bfd
-state works in practice.  This function stores the subset and
-reinitializes the bfd.
-
-@findex bfd_preserve_restore
-@subsubsection @code{bfd_preserve_restore}
-@strong{Synopsis}
-@example
-void bfd_preserve_restore (bfd *, struct bfd_preserve *);
-@end example
-@strong{Description}@*
-This function restores bfd state saved by bfd_preserve_save.
-If MARKER is non-NULL in struct bfd_preserve then that block
-and all subsequently bfd_alloc'd memory is freed.
-
-@findex bfd_preserve_finish
-@subsubsection @code{bfd_preserve_finish}
-@strong{Synopsis}
-@example
-void bfd_preserve_finish (bfd *, struct bfd_preserve *);
-@end example
-@strong{Description}@*
-This function should be called when the bfd state saved by
-bfd_preserve_save is no longer needed.  ie. when the back-end
-object_p function returns with success.
-
-@findex bfd_emul_get_maxpagesize
-@subsubsection @code{bfd_emul_get_maxpagesize}
-@strong{Synopsis}
-@example
-bfd_vma bfd_emul_get_maxpagesize (const char *);
-@end example
-@strong{Description}@*
-Returns the maximum page size, in bytes, as determined by
-emulation.
-
-@strong{Returns}@*
-Returns the maximum page size in bytes for ELF, 0 otherwise.
-
-@findex bfd_emul_set_maxpagesize
-@subsubsection @code{bfd_emul_set_maxpagesize}
-@strong{Synopsis}
-@example
-void bfd_emul_set_maxpagesize (const char *, bfd_vma);
-@end example
-@strong{Description}@*
-For ELF, set the maximum page size for the emulation.  It is
-a no-op for other formats.
-
-@findex bfd_emul_get_commonpagesize
-@subsubsection @code{bfd_emul_get_commonpagesize}
-@strong{Synopsis}
-@example
-bfd_vma bfd_emul_get_commonpagesize (const char *);
-@end example
-@strong{Description}@*
-Returns the common page size, in bytes, as determined by
-emulation.
-
-@strong{Returns}@*
-Returns the common page size in bytes for ELF, 0 otherwise.
-
-@findex bfd_emul_set_commonpagesize
-@subsubsection @code{bfd_emul_set_commonpagesize}
-@strong{Synopsis}
-@example
-void bfd_emul_set_commonpagesize (const char *, bfd_vma);
-@end example
-@strong{Description}@*
-For ELF, set the common page size for the emulation.  It is
-a no-op for other formats.
-
-@findex bfd_demangle
-@subsubsection @code{bfd_demangle}
-@strong{Synopsis}
-@example
-char *bfd_demangle (bfd *, const char *, int);
-@end example
-@strong{Description}@*
-Wrapper around cplus_demangle.  Strips leading underscores and
-other such chars that would otherwise confuse the demangler.
-If passed a g++ v3 ABI mangled name, returns a buffer allocated
-with malloc holding the demangled name.  Returns NULL otherwise
-and on memory alloc failure.
-
diff --git a/bfd/doc/bfdver.texi b/bfd/doc/bfdver.texi
deleted file mode 100644
index 41a451b..0000000
--- a/bfd/doc/bfdver.texi
+++ /dev/null
@@ -1,4 +0,0 @@
-@set VERSION 2.22.52
-@set VERSION_PACKAGE (GNU Binutils) 
-@set UPDATED November 2012
-@set BUGURL @uref{http://www.sourceware.org/bugzilla/}
diff --git a/bfd/doc/bfdwin.texi b/bfd/doc/bfdwin.texi
deleted file mode 100644
index b1fd7d5..0000000
--- a/bfd/doc/bfdwin.texi
+++ /dev/null
@@ -1,2 +0,0 @@
-@findex 
-@subsubsection @code{}
diff --git a/bfd/doc/cache.texi b/bfd/doc/cache.texi
deleted file mode 100644
index 5820a2a..0000000
--- a/bfd/doc/cache.texi
+++ /dev/null
@@ -1,65 +0,0 @@
-@section File caching
-The file caching mechanism is embedded within BFD and allows
-the application to open as many BFDs as it wants without
-regard to the underlying operating system's file descriptor
-limit (often as low as 20 open files).  The module in
-@code{cache.c} maintains a least recently used list of
-@code{BFD_CACHE_MAX_OPEN} files, and exports the name
-@code{bfd_cache_lookup}, which runs around and makes sure that
-the required BFD is open. If not, then it chooses a file to
-close, closes it and opens the one wanted, returning its file
-handle.
-
-@subsection Caching functions
-
-
-@findex bfd_cache_init
-@subsubsection @code{bfd_cache_init}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_cache_init (bfd *abfd);
-@end example
-@strong{Description}@*
-Add a newly opened BFD to the cache.
-
-@findex bfd_cache_close
-@subsubsection @code{bfd_cache_close}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_cache_close (bfd *abfd);
-@end example
-@strong{Description}@*
-Remove the BFD @var{abfd} from the cache. If the attached file is open,
-then close it too.
-
-@strong{Returns}@*
-@code{FALSE} is returned if closing the file fails, @code{TRUE} is
-returned if all is well.
-
-@findex bfd_cache_close_all
-@subsubsection @code{bfd_cache_close_all}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_cache_close_all (void);
-@end example
-@strong{Description}@*
-Remove all BFDs from the cache. If the attached file is open,
-then close it too.
-
-@strong{Returns}@*
-@code{FALSE} is returned if closing one of the file fails, @code{TRUE} is
-returned if all is well.
-
-@findex bfd_open_file
-@subsubsection @code{bfd_open_file}
-@strong{Synopsis}
-@example
-FILE* bfd_open_file (bfd *abfd);
-@end example
-@strong{Description}@*
-Call the OS to open a file for @var{abfd}.  Return the @code{FILE *}
-(possibly @code{NULL}) that results from this operation.  Set up the
-BFD so that future accesses know the file is open. If the @code{FILE *}
-returned is @code{NULL}, then it won't have been put in the
-cache, so it won't have to be removed from it.
-
diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c
index f949e1f..b019837 100644
--- a/bfd/doc/chew.c
+++ b/bfd/doc/chew.c
@@ -1256,7 +1256,7 @@
 		fprintf (stderr, "warning, %s is not recognised\n", next);
 	      skip_past_newline ();
 	    }
-
+	  free (next);
 	}
       else
 	skip_past_newline ();
diff --git a/bfd/doc/coffcode.texi b/bfd/doc/coffcode.texi
deleted file mode 100644
index e487d84..0000000
--- a/bfd/doc/coffcode.texi
+++ /dev/null
@@ -1,685 +0,0 @@
-@section coff backends
-BFD supports a number of different flavours of coff format.
-The major differences between formats are the sizes and
-alignments of fields in structures on disk, and the occasional
-extra field.
-
-Coff in all its varieties is implemented with a few common
-files and a number of implementation specific files. For
-example, The 88k bcs coff format is implemented in the file
-@file{coff-m88k.c}. This file @code{#include}s
-@file{coff/m88k.h} which defines the external structure of the
-coff format for the 88k, and @file{coff/internal.h} which
-defines the internal structure. @file{coff-m88k.c} also
-defines the relocations used by the 88k format
-@xref{Relocations}.
-
-The Intel i960 processor version of coff is implemented in
-@file{coff-i960.c}. This file has the same structure as
-@file{coff-m88k.c}, except that it includes @file{coff/i960.h}
-rather than @file{coff-m88k.h}.
-
-@subsection Porting to a new version of coff
-The recommended method is to select from the existing
-implementations the version of coff which is most like the one
-you want to use.  For example, we'll say that i386 coff is
-the one you select, and that your coff flavour is called foo.
-Copy @file{i386coff.c} to @file{foocoff.c}, copy
-@file{../include/coff/i386.h} to @file{../include/coff/foo.h},
-and add the lines to @file{targets.c} and @file{Makefile.in}
-so that your new back end is used. Alter the shapes of the
-structures in @file{../include/coff/foo.h} so that they match
-what you need. You will probably also have to add
-@code{#ifdef}s to the code in @file{coff/internal.h} and
-@file{coffcode.h} if your version of coff is too wild.
-
-You can verify that your new BFD backend works quite simply by
-building @file{objdump} from the @file{binutils} directory,
-and making sure that its version of what's going on and your
-host system's idea (assuming it has the pretty standard coff
-dump utility, usually called @code{att-dump} or just
-@code{dump}) are the same.  Then clean up your code, and send
-what you've done to Cygnus. Then your stuff will be in the
-next release, and you won't have to keep integrating it.
-
-@subsection How the coff backend works
-
-
-@subsubsection File layout
-The Coff backend is split into generic routines that are
-applicable to any Coff target and routines that are specific
-to a particular target.  The target-specific routines are
-further split into ones which are basically the same for all
-Coff targets except that they use the external symbol format
-or use different values for certain constants.
-
-The generic routines are in @file{coffgen.c}.  These routines
-work for any Coff target.  They use some hooks into the target
-specific code; the hooks are in a @code{bfd_coff_backend_data}
-structure, one of which exists for each target.
-
-The essentially similar target-specific routines are in
-@file{coffcode.h}.  This header file includes executable C code.
-The various Coff targets first include the appropriate Coff
-header file, make any special defines that are needed, and
-then include @file{coffcode.h}.
-
-Some of the Coff targets then also have additional routines in
-the target source file itself.
-
-For example, @file{coff-i960.c} includes
-@file{coff/internal.h} and @file{coff/i960.h}.  It then
-defines a few constants, such as @code{I960}, and includes
-@file{coffcode.h}.  Since the i960 has complex relocation
-types, @file{coff-i960.c} also includes some code to
-manipulate the i960 relocs.  This code is not in
-@file{coffcode.h} because it would not be used by any other
-target.
-
-@subsubsection Coff long section names
-In the standard Coff object format, section names are limited to
-the eight bytes available in the @code{s_name} field of the
-@code{SCNHDR} section header structure.  The format requires the
-field to be NUL-padded, but not necessarily NUL-terminated, so
-the longest section names permitted are a full eight characters.
-
-The Microsoft PE variants of the Coff object file format add
-an extension to support the use of long section names.  This
-extension is defined in section 4 of the Microsoft PE/COFF 
-specification (rev 8.1).  If a section name is too long to fit
-into the section header's @code{s_name} field, it is instead
-placed into the string table, and the @code{s_name} field is
-filled with a slash ("/") followed by the ASCII decimal 
-representation of the offset of the full name relative to the
-string table base.
-
-Note that this implies that the extension can only be used in object
-files, as executables do not contain a string table.  The standard
-specifies that long section names from objects emitted into executable
-images are to be truncated.
-
-However, as a GNU extension, BFD can generate executable images
-that contain a string table and long section names.  This
-would appear to be technically valid, as the standard only says
-that Coff debugging information is deprecated, not forbidden,
-and in practice it works, although some tools that parse PE files
-expecting the MS standard format may become confused; @file{PEview} is
-one known example.
-
-The functionality is supported in BFD by code implemented under 
-the control of the macro @code{COFF_LONG_SECTION_NAMES}.  If not
-defined, the format does not support long section names in any way.
-If defined, it is used to initialise a flag, 
-@code{_bfd_coff_long_section_names}, and a hook function pointer, 
-@code{_bfd_coff_set_long_section_names}, in the Coff backend data
-structure.  The flag controls the generation of long section names
-in output BFDs at runtime; if it is false, as it will be by default
-when generating an executable image, long section names are truncated;
-if true, the long section names extension is employed.  The hook
-points to a function that allows the value of the flag to be altered
-at runtime, on formats that support long section names at all; on
-other formats it points to a stub that returns an error indication.
-With input BFDs, the flag is set according to whether any long section
-names are detected while reading the section headers.  For a completely
-new BFD, the flag is set to the default for the target format.  This
-information can be used by a client of the BFD library when deciding
-what output format to generate, and means that a BFD that is opened
-for read and subsequently converted to a writeable BFD and modified
-in-place will retain whatever format it had on input.
-
-If @code{COFF_LONG_SECTION_NAMES} is simply defined (blank), or is
-defined to the value "1", then long section names are enabled by
-default; if it is defined to the value zero, they are disabled by
-default (but still accepted in input BFDs).  The header @file{coffcode.h}
-defines a macro, @code{COFF_DEFAULT_LONG_SECTION_NAMES}, which is
-used in the backends to initialise the backend data structure fields
-appropriately; see the comments for further detail.
-
-@subsubsection Bit twiddling
-Each flavour of coff supported in BFD has its own header file
-describing the external layout of the structures. There is also
-an internal description of the coff layout, in
-@file{coff/internal.h}. A major function of the
-coff backend is swapping the bytes and twiddling the bits to
-translate the external form of the structures into the normal
-internal form. This is all performed in the
-@code{bfd_swap}_@i{thing}_@i{direction} routines. Some
-elements are different sizes between different versions of
-coff; it is the duty of the coff version specific include file
-to override the definitions of various packing routines in
-@file{coffcode.h}. E.g., the size of line number entry in coff is
-sometimes 16 bits, and sometimes 32 bits. @code{#define}ing
-@code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the
-correct one. No doubt, some day someone will find a version of
-coff which has a varying field size not catered to at the
-moment. To port BFD, that person will have to add more @code{#defines}.
-Three of the bit twiddling routines are exported to
-@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in}
-and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol
-table on its own, but uses BFD to fix things up.  More of the
-bit twiddlers are exported for @code{gas};
-@code{coff_swap_aux_out}, @code{coff_swap_sym_out},
-@code{coff_swap_lineno_out}, @code{coff_swap_reloc_out},
-@code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out},
-@code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track
-of all the symbol table and reloc drudgery itself, thereby
-saving the internal BFD overhead, but uses BFD to swap things
-on the way out, making cross ports much safer.  Doing so also
-allows BFD (and thus the linker) to use the same header files
-as @code{gas}, which makes one avenue to disaster disappear.
-
-@subsubsection Symbol reading
-The simple canonical form for symbols used by BFD is not rich
-enough to keep all the information available in a coff symbol
-table. The back end gets around this problem by keeping the original
-symbol table around, "behind the scenes".
-
-When a symbol table is requested (through a call to
-@code{bfd_canonicalize_symtab}), a request gets through to
-@code{coff_get_normalized_symtab}. This reads the symbol table from
-the coff file and swaps all the structures inside into the
-internal form. It also fixes up all the pointers in the table
-(represented in the file by offsets from the first symbol in
-the table) into physical pointers to elements in the new
-internal table. This involves some work since the meanings of
-fields change depending upon context: a field that is a
-pointer to another structure in the symbol table at one moment
-may be the size in bytes of a structure at the next.  Another
-pass is made over the table. All symbols which mark file names
-(@code{C_FILE} symbols) are modified so that the internal
-string points to the value in the auxent (the real filename)
-rather than the normal text associated with the symbol
-(@code{".file"}).
-
-At this time the symbol names are moved around. Coff stores
-all symbols less than nine characters long physically
-within the symbol table; longer strings are kept at the end of
-the file in the string table. This pass moves all strings
-into memory and replaces them with pointers to the strings.
-
-The symbol table is massaged once again, this time to create
-the canonical table used by the BFD application. Each symbol
-is inspected in turn, and a decision made (using the
-@code{sclass} field) about the various flags to set in the
-@code{asymbol}.  @xref{Symbols}. The generated canonical table
-shares strings with the hidden internal symbol table.
-
-Any linenumbers are read from the coff file too, and attached
-to the symbols which own the functions the linenumbers belong to.
-
-@subsubsection Symbol writing
-Writing a symbol to a coff file which didn't come from a coff
-file will lose any debugging information. The @code{asymbol}
-structure remembers the BFD from which the symbol was taken, and on
-output the back end makes sure that the same destination target as
-source target is present.
-
-When the symbols have come from a coff file then all the
-debugging information is preserved.
-
-Symbol tables are provided for writing to the back end in a
-vector of pointers to pointers. This allows applications like
-the linker to accumulate and output large symbol tables
-without having to do too much byte copying.
-
-This function runs through the provided symbol table and
-patches each symbol marked as a file place holder
-(@code{C_FILE}) to point to the next file place holder in the
-list. It also marks each @code{offset} field in the list with
-the offset from the first symbol of the current symbol.
-
-Another function of this procedure is to turn the canonical
-value form of BFD into the form used by coff. Internally, BFD
-expects symbol values to be offsets from a section base; so a
-symbol physically at 0x120, but in a section starting at
-0x100, would have the value 0x20. Coff expects symbols to
-contain their final value, so symbols have their values
-changed at this point to reflect their sum with their owning
-section.  This transformation uses the
-@code{output_section} field of the @code{asymbol}'s
-@code{asection} @xref{Sections}.
-
-@itemize @bullet
-
-@item
-@code{coff_mangle_symbols}
-@end itemize
-This routine runs though the provided symbol table and uses
-the offsets generated by the previous pass and the pointers
-generated when the symbol table was read in to create the
-structured hierarchy required by coff. It changes each pointer
-to a symbol into the index into the symbol table of the asymbol.
-
-@itemize @bullet
-
-@item
-@code{coff_write_symbols}
-@end itemize
-This routine runs through the symbol table and patches up the
-symbols from their internal form into the coff way, calls the
-bit twiddlers, and writes out the table to the file.
-
-@findex coff_symbol_type
-@subsubsection @code{coff_symbol_type}
-@strong{Description}@*
-The hidden information for an @code{asymbol} is described in a
-@code{combined_entry_type}:
-
-
-@example
-
-typedef struct coff_ptr_struct
-@{
-  /* Remembers the offset from the first symbol in the file for
-     this symbol. Generated by coff_renumber_symbols. */
-  unsigned int offset;
-
-  /* Should the value of this symbol be renumbered.  Used for
-     XCOFF C_BSTAT symbols.  Set by coff_slurp_symbol_table.  */
-  unsigned int fix_value : 1;
-
-  /* Should the tag field of this symbol be renumbered.
-     Created by coff_pointerize_aux. */
-  unsigned int fix_tag : 1;
-
-  /* Should the endidx field of this symbol be renumbered.
-     Created by coff_pointerize_aux. */
-  unsigned int fix_end : 1;
-
-  /* Should the x_csect.x_scnlen field be renumbered.
-     Created by coff_pointerize_aux. */
-  unsigned int fix_scnlen : 1;
-
-  /* Fix up an XCOFF C_BINCL/C_EINCL symbol.  The value is the
-     index into the line number entries.  Set by coff_slurp_symbol_table.  */
-  unsigned int fix_line : 1;
-
-  /* The container for the symbol structure as read and translated
-     from the file. */
-  union
-  @{
-    union internal_auxent auxent;
-    struct internal_syment syment;
-  @} u;
-@} combined_entry_type;
-
-
-/* Each canonical asymbol really looks like this: */
-
-typedef struct coff_symbol_struct
-@{
-  /* The actual symbol which the rest of BFD works with */
-  asymbol symbol;
-
-  /* A pointer to the hidden information for this symbol */
-  combined_entry_type *native;
-
-  /* A pointer to the linenumber information for this symbol */
-  struct lineno_cache_entry *lineno;
-
-  /* Have the line numbers been relocated yet ? */
-  bfd_boolean done_lineno;
-@} coff_symbol_type;
-@end example
-@findex bfd_coff_backend_data
-@subsubsection @code{bfd_coff_backend_data}
-
-@example
-/* COFF symbol classifications.  */
-
-enum coff_symbol_classification
-@{
-  /* Global symbol.  */
-  COFF_SYMBOL_GLOBAL,
-  /* Common symbol.  */
-  COFF_SYMBOL_COMMON,
-  /* Undefined symbol.  */
-  COFF_SYMBOL_UNDEFINED,
-  /* Local symbol.  */
-  COFF_SYMBOL_LOCAL,
-  /* PE section symbol.  */
-  COFF_SYMBOL_PE_SECTION
-@};
-
-@end example
-Special entry points for gdb to swap in coff symbol table parts:
-@example
-typedef struct
-@{
-  void (*_bfd_coff_swap_aux_in)
-    (bfd *, void *, int, int, int, int, void *);
-
-  void (*_bfd_coff_swap_sym_in)
-    (bfd *, void *, void *);
-
-  void (*_bfd_coff_swap_lineno_in)
-    (bfd *, void *, void *);
-
-  unsigned int (*_bfd_coff_swap_aux_out)
-    (bfd *, void *, int, int, int, int, void *);
-
-  unsigned int (*_bfd_coff_swap_sym_out)
-    (bfd *, void *, void *);
-
-  unsigned int (*_bfd_coff_swap_lineno_out)
-    (bfd *, void *, void *);
-
-  unsigned int (*_bfd_coff_swap_reloc_out)
-    (bfd *, void *, void *);
-
-  unsigned int (*_bfd_coff_swap_filehdr_out)
-    (bfd *, void *, void *);
-
-  unsigned int (*_bfd_coff_swap_aouthdr_out)
-    (bfd *, void *, void *);
-
-  unsigned int (*_bfd_coff_swap_scnhdr_out)
-    (bfd *, void *, void *);
-
-  unsigned int _bfd_filhsz;
-  unsigned int _bfd_aoutsz;
-  unsigned int _bfd_scnhsz;
-  unsigned int _bfd_symesz;
-  unsigned int _bfd_auxesz;
-  unsigned int _bfd_relsz;
-  unsigned int _bfd_linesz;
-  unsigned int _bfd_filnmlen;
-  bfd_boolean _bfd_coff_long_filenames;
-
-  bfd_boolean _bfd_coff_long_section_names;
-  bfd_boolean (*_bfd_coff_set_long_section_names)
-    (bfd *, int);
-  
-  unsigned int _bfd_coff_default_section_alignment_power;
-  bfd_boolean _bfd_coff_force_symnames_in_strings;
-  unsigned int _bfd_coff_debug_string_prefix_length;
-
-  void (*_bfd_coff_swap_filehdr_in)
-    (bfd *, void *, void *);
-
-  void (*_bfd_coff_swap_aouthdr_in)
-    (bfd *, void *, void *);
-
-  void (*_bfd_coff_swap_scnhdr_in)
-    (bfd *, void *, void *);
-
-  void (*_bfd_coff_swap_reloc_in)
-    (bfd *abfd, void *, void *);
-
-  bfd_boolean (*_bfd_coff_bad_format_hook)
-    (bfd *, void *);
-
-  bfd_boolean (*_bfd_coff_set_arch_mach_hook)
-    (bfd *, void *);
-
-  void * (*_bfd_coff_mkobject_hook)
-    (bfd *, void *, void *);
-
-  bfd_boolean (*_bfd_styp_to_sec_flags_hook)
-    (bfd *, void *, const char *, asection *, flagword *);
-
-  void (*_bfd_set_alignment_hook)
-    (bfd *, asection *, void *);
-
-  bfd_boolean (*_bfd_coff_slurp_symbol_table)
-    (bfd *);
-
-  bfd_boolean (*_bfd_coff_symname_in_debug)
-    (bfd *, struct internal_syment *);
-
-  bfd_boolean (*_bfd_coff_pointerize_aux_hook)
-    (bfd *, combined_entry_type *, combined_entry_type *,
-            unsigned int, combined_entry_type *);
-
-  bfd_boolean (*_bfd_coff_print_aux)
-    (bfd *, FILE *, combined_entry_type *, combined_entry_type *,
-            combined_entry_type *, unsigned int);
-
-  void (*_bfd_coff_reloc16_extra_cases)
-    (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
-           bfd_byte *, unsigned int *, unsigned int *);
-
-  int (*_bfd_coff_reloc16_estimate)
-    (bfd *, asection *, arelent *, unsigned int,
-            struct bfd_link_info *);
-
-  enum coff_symbol_classification (*_bfd_coff_classify_symbol)
-    (bfd *, struct internal_syment *);
-
-  bfd_boolean (*_bfd_coff_compute_section_file_positions)
-    (bfd *);
-
-  bfd_boolean (*_bfd_coff_start_final_link)
-    (bfd *, struct bfd_link_info *);
-
-  bfd_boolean (*_bfd_coff_relocate_section)
-    (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
-            struct internal_reloc *, struct internal_syment *, asection **);
-
-  reloc_howto_type *(*_bfd_coff_rtype_to_howto)
-    (bfd *, asection *, struct internal_reloc *,
-            struct coff_link_hash_entry *, struct internal_syment *,
-            bfd_vma *);
-
-  bfd_boolean (*_bfd_coff_adjust_symndx)
-    (bfd *, struct bfd_link_info *, bfd *, asection *,
-            struct internal_reloc *, bfd_boolean *);
-
-  bfd_boolean (*_bfd_coff_link_add_one_symbol)
-    (struct bfd_link_info *, bfd *, const char *, flagword,
-            asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
-            struct bfd_link_hash_entry **);
-
-  bfd_boolean (*_bfd_coff_link_output_has_begun)
-    (bfd *, struct coff_final_link_info *);
-
-  bfd_boolean (*_bfd_coff_final_link_postscript)
-    (bfd *, struct coff_final_link_info *);
-
-  bfd_boolean (*_bfd_coff_print_pdata)
-    (bfd *, void *);
-
-@} bfd_coff_backend_data;
-
-#define coff_backend_info(abfd) \
-  ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
-
-#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
-  ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
-
-#define bfd_coff_swap_sym_in(a,e,i) \
-  ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
-
-#define bfd_coff_swap_lineno_in(a,e,i) \
-  ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
-
-#define bfd_coff_swap_reloc_out(abfd, i, o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
-
-#define bfd_coff_swap_lineno_out(abfd, i, o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
-
-#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
-  ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
-
-#define bfd_coff_swap_sym_out(abfd, i,o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
-
-#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
-
-#define bfd_coff_swap_filehdr_out(abfd, i,o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
-
-#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
-
-#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
-#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
-#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
-#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
-#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
-#define bfd_coff_relsz(abfd)  (coff_backend_info (abfd)->_bfd_relsz)
-#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
-#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
-#define bfd_coff_long_filenames(abfd) \
-  (coff_backend_info (abfd)->_bfd_coff_long_filenames)
-#define bfd_coff_long_section_names(abfd) \
-  (coff_backend_info (abfd)->_bfd_coff_long_section_names)
-#define bfd_coff_set_long_section_names(abfd, enable) \
-  ((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable))
-#define bfd_coff_default_section_alignment_power(abfd) \
-  (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
-#define bfd_coff_swap_filehdr_in(abfd, i,o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
-
-#define bfd_coff_swap_reloc_in(abfd, i, o) \
-  ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
-
-#define bfd_coff_bad_format_hook(abfd, filehdr) \
-  ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
-
-#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
-  ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
-#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
-  ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\
-   (abfd, filehdr, aouthdr))
-
-#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
-  ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
-   (abfd, scnhdr, name, section, flags_ptr))
-
-#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
-  ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
-
-#define bfd_coff_slurp_symbol_table(abfd)\
-  ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
-
-#define bfd_coff_symname_in_debug(abfd, sym)\
-  ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
-
-#define bfd_coff_force_symnames_in_strings(abfd)\
-  (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
-
-#define bfd_coff_debug_string_prefix_length(abfd)\
-  (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
-
-#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
-  ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
-   (abfd, file, base, symbol, aux, indaux))
-
-#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
-                                     reloc, data, src_ptr, dst_ptr)\
-  ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
-   (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
-
-#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
-  ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
-   (abfd, section, reloc, shrink, link_info))
-
-#define bfd_coff_classify_symbol(abfd, sym)\
-  ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
-   (abfd, sym))
-
-#define bfd_coff_compute_section_file_positions(abfd)\
-  ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
-   (abfd))
-
-#define bfd_coff_start_final_link(obfd, info)\
-  ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
-   (obfd, info))
-#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
-  ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
-   (obfd, info, ibfd, o, con, rel, isyms, secs))
-#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
-  ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
-   (abfd, sec, rel, h, sym, addendp))
-#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
-  ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
-   (obfd, info, ibfd, sec, rel, adjustedp))
-#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
-                                     value, string, cp, coll, hashp)\
-  ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
-   (info, abfd, name, flags, section, value, string, cp, coll, hashp))
-
-#define bfd_coff_link_output_has_begun(a,p) \
-  ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
-#define bfd_coff_final_link_postscript(a,p) \
-  ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
-
-#define bfd_coff_have_print_pdata(a) \
-  (coff_backend_info (a)->_bfd_coff_print_pdata)
-#define bfd_coff_print_pdata(a,p) \
-  ((coff_backend_info (a)->_bfd_coff_print_pdata) (a, p))
-
-/* Macro: Returns true if the bfd is a PE executable as opposed to a
-   PE object file.  */
-#define bfd_pei_p(abfd) \
-  (CONST_STRNEQ ((abfd)->xvec->name, "pei-"))
-@end example
-@subsubsection Writing relocations
-To write relocations, the back end steps though the
-canonical relocation table and create an
-@code{internal_reloc}. The symbol index to use is removed from
-the @code{offset} field in the symbol table supplied.  The
-address comes directly from the sum of the section base
-address and the relocation offset; the type is dug directly
-from the howto field.  Then the @code{internal_reloc} is
-swapped into the shape of an @code{external_reloc} and written
-out to disk.
-
-@subsubsection Reading linenumbers
-Creating the linenumber table is done by reading in the entire
-coff linenumber table, and creating another table for internal use.
-
-A coff linenumber table is structured so that each function
-is marked as having a line number of 0. Each line within the
-function is an offset from the first line in the function. The
-base of the line number information for the table is stored in
-the symbol associated with the function.
-
-Note: The PE format uses line number 0 for a flag indicating a
-new source file.
-
-The information is copied from the external to the internal
-table, and each symbol which marks a function is marked by
-pointing its...
-
-How does this work ?
-
-@subsubsection Reading relocations
-Coff relocations are easily transformed into the internal BFD form
-(@code{arelent}).
-
-Reading a coff relocation table is done in the following stages:
-
-@itemize @bullet
-
-@item
-Read the entire coff relocation table into memory.
-
-@item
-Process each relocation in turn; first swap it from the
-external to the internal form.
-
-@item
-Turn the symbol referenced in the relocation's symbol index
-into a pointer into the canonical symbol table.
-This table is the same as the one returned by a call to
-@code{bfd_canonicalize_symtab}. The back end will call that
-routine and save the result if a canonicalization hasn't been done.
-
-@item
-The reloc index is turned into a pointer to a howto
-structure, in a back end specific way. For instance, the 386
-and 960 use the @code{r_type} to directly produce an index
-into a howto table vector; the 88k subtracts a number from the
-@code{r_type} field and creates an addend field.
-@end itemize
-
diff --git a/bfd/doc/core.texi b/bfd/doc/core.texi
deleted file mode 100644
index cd98c4a..0000000
--- a/bfd/doc/core.texi
+++ /dev/null
@@ -1,70 +0,0 @@
-@section Core files
-
-
-@subsection Core file functions
-
-
-@strong{Description}@*
-These are functions pertaining to core files.
-
-@findex bfd_core_file_failing_command
-@subsubsection @code{bfd_core_file_failing_command}
-@strong{Synopsis}
-@example
-const char *bfd_core_file_failing_command (bfd *abfd);
-@end example
-@strong{Description}@*
-Return a read-only string explaining which program was running
-when it failed and produced the core file @var{abfd}.
-
-@findex bfd_core_file_failing_signal
-@subsubsection @code{bfd_core_file_failing_signal}
-@strong{Synopsis}
-@example
-int bfd_core_file_failing_signal (bfd *abfd);
-@end example
-@strong{Description}@*
-Returns the signal number which caused the core dump which
-generated the file the BFD @var{abfd} is attached to.
-
-@findex bfd_core_file_pid
-@subsubsection @code{bfd_core_file_pid}
-@strong{Synopsis}
-@example
-int bfd_core_file_pid (bfd *abfd);
-@end example
-@strong{Description}@*
-Returns the PID of the process the core dump the BFD
-@var{abfd} is attached to was generated from.
-
-@findex core_file_matches_executable_p
-@subsubsection @code{core_file_matches_executable_p}
-@strong{Synopsis}
-@example
-bfd_boolean core_file_matches_executable_p
-   (bfd *core_bfd, bfd *exec_bfd);
-@end example
-@strong{Description}@*
-Return @code{TRUE} if the core file attached to @var{core_bfd}
-was generated by a run of the executable file attached to
-@var{exec_bfd}, @code{FALSE} otherwise.
-
-@findex generic_core_file_matches_executable_p
-@subsubsection @code{generic_core_file_matches_executable_p}
-@strong{Synopsis}
-@example
-bfd_boolean generic_core_file_matches_executable_p
-   (bfd *core_bfd, bfd *exec_bfd);
-@end example
-@strong{Description}@*
-Return TRUE if the core file attached to @var{core_bfd}
-was generated by a run of the executable file attached
-to @var{exec_bfd}.  The match is based on executable
-basenames only.
-
-Note: When not able to determine the core file failing
-command or the executable name, we still return TRUE even
-though we're not sure that core file and executable match.
-This is to avoid generating a false warning in situations
-where we really don't know whether they match or not.
-
diff --git a/bfd/doc/elf.texi b/bfd/doc/elf.texi
deleted file mode 100644
index 4053386..0000000
--- a/bfd/doc/elf.texi
+++ /dev/null
@@ -1,9 +0,0 @@
-@section ELF backends
-BFD support for ELF formats is being worked on.
-Currently, the best supported back ends are for sparc and i386
-(running svr4 or Solaris 2).
-
-Documentation of the internals of the support code still needs
-to be written.  The code is changing quickly enough that we
-haven't bothered yet.
-
diff --git a/bfd/doc/elfcode.texi b/bfd/doc/elfcode.texi
deleted file mode 100644
index e69de29..0000000
--- a/bfd/doc/elfcode.texi
+++ /dev/null
diff --git a/bfd/doc/format.texi b/bfd/doc/format.texi
deleted file mode 100644
index 9674acf..0000000
--- a/bfd/doc/format.texi
+++ /dev/null
@@ -1,112 +0,0 @@
-@section File formats
-A format is a BFD concept of high level file contents type. The
-formats supported by BFD are:
-
-@itemize @bullet
-
-@item
-@code{bfd_object}
-@end itemize
-The BFD may contain data, symbols, relocations and debug info.
-
-@itemize @bullet
-
-@item
-@code{bfd_archive}
-@end itemize
-The BFD contains other BFDs and an optional index.
-
-@itemize @bullet
-
-@item
-@code{bfd_core}
-@end itemize
-The BFD contains the result of an executable core dump.
-
-@subsection File format functions
-
-
-@findex bfd_check_format
-@subsubsection @code{bfd_check_format}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
-@end example
-@strong{Description}@*
-Verify if the file attached to the BFD @var{abfd} is compatible
-with the format @var{format} (i.e., one of @code{bfd_object},
-@code{bfd_archive} or @code{bfd_core}).
-
-If the BFD has been set to a specific target before the
-call, only the named target and format combination is
-checked. If the target has not been set, or has been set to
-@code{default}, then all the known target backends is
-interrogated to determine a match.  If the default target
-matches, it is used.  If not, exactly one target must recognize
-the file, or an error results.
-
-The function returns @code{TRUE} on success, otherwise @code{FALSE}
-with one of the following error codes:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-if @code{format} is not one of @code{bfd_object}, @code{bfd_archive} or
-@code{bfd_core}.
-
-@item
-@code{bfd_error_system_call} -
-if an error occured during a read - even some file mismatches
-can cause bfd_error_system_calls.
-
-@item
-@code{file_not_recognised} -
-none of the backends recognised the file format.
-
-@item
-@code{bfd_error_file_ambiguously_recognized} -
-more than one backend recognised the file format.
-@end itemize
-
-@findex bfd_check_format_matches
-@subsubsection @code{bfd_check_format_matches}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_check_format_matches
-   (bfd *abfd, bfd_format format, char ***matching);
-@end example
-@strong{Description}@*
-Like @code{bfd_check_format}, except when it returns FALSE with
-@code{bfd_errno} set to @code{bfd_error_file_ambiguously_recognized}.  In that
-case, if @var{matching} is not NULL, it will be filled in with
-a NULL-terminated list of the names of the formats that matched,
-allocated with @code{malloc}.
-Then the user may choose a format and try again.
-
-When done with the list that @var{matching} points to, the caller
-should free it.
-
-@findex bfd_set_format
-@subsubsection @code{bfd_set_format}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
-@end example
-@strong{Description}@*
-This function sets the file format of the BFD @var{abfd} to the
-format @var{format}. If the target set in the BFD does not
-support the format requested, the format is invalid, or the BFD
-is not open for writing, then an error occurs.
-
-@findex bfd_format_string
-@subsubsection @code{bfd_format_string}
-@strong{Synopsis}
-@example
-const char *bfd_format_string (bfd_format format);
-@end example
-@strong{Description}@*
-Return a pointer to a const string
-@code{invalid}, @code{object}, @code{archive}, @code{core}, or @code{unknown},
-depending upon the value of @var{format}.
-
diff --git a/bfd/doc/hash.texi b/bfd/doc/hash.texi
deleted file mode 100644
index 88d9585..0000000
--- a/bfd/doc/hash.texi
+++ /dev/null
@@ -1,247 +0,0 @@
-@section Hash Tables
-@cindex Hash tables
-BFD provides a simple set of hash table functions.  Routines
-are provided to initialize a hash table, to free a hash table,
-to look up a string in a hash table and optionally create an
-entry for it, and to traverse a hash table.  There is
-currently no routine to delete an string from a hash table.
-
-The basic hash table does not permit any data to be stored
-with a string.  However, a hash table is designed to present a
-base class from which other types of hash tables may be
-derived.  These derived types may store additional information
-with the string.  Hash tables were implemented in this way,
-rather than simply providing a data pointer in a hash table
-entry, because they were designed for use by the linker back
-ends.  The linker may create thousands of hash table entries,
-and the overhead of allocating private data and storing and
-following pointers becomes noticeable.
-
-The basic hash table code is in @code{hash.c}.
-
-@menu
-* Creating and Freeing a Hash Table::
-* Looking Up or Entering a String::
-* Traversing a Hash Table::
-* Deriving a New Hash Table Type::
-@end menu
-
-@node Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables
-@subsection Creating and freeing a hash table
-@findex bfd_hash_table_init
-@findex bfd_hash_table_init_n
-To create a hash table, create an instance of a @code{struct
-bfd_hash_table} (defined in @code{bfd.h}) and call
-@code{bfd_hash_table_init} (if you know approximately how many
-entries you will need, the function @code{bfd_hash_table_init_n},
-which takes a @var{size} argument, may be used).
-@code{bfd_hash_table_init} returns @code{FALSE} if some sort of
-error occurs.
-
-@findex bfd_hash_newfunc
-The function @code{bfd_hash_table_init} take as an argument a
-function to use to create new entries.  For a basic hash
-table, use the function @code{bfd_hash_newfunc}.  @xref{Deriving
-a New Hash Table Type}, for why you would want to use a
-different value for this argument.
-
-@findex bfd_hash_allocate
-@code{bfd_hash_table_init} will create an objalloc which will be
-used to allocate new entries.  You may allocate memory on this
-objalloc using @code{bfd_hash_allocate}.
-
-@findex bfd_hash_table_free
-Use @code{bfd_hash_table_free} to free up all the memory that has
-been allocated for a hash table.  This will not free up the
-@code{struct bfd_hash_table} itself, which you must provide.
-
-@findex bfd_hash_set_default_size
-Use @code{bfd_hash_set_default_size} to set the default size of
-hash table to use.
-
-@node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables
-@subsection Looking up or entering a string
-@findex bfd_hash_lookup
-The function @code{bfd_hash_lookup} is used both to look up a
-string in the hash table and to create a new entry.
-
-If the @var{create} argument is @code{FALSE}, @code{bfd_hash_lookup}
-will look up a string.  If the string is found, it will
-returns a pointer to a @code{struct bfd_hash_entry}.  If the
-string is not found in the table @code{bfd_hash_lookup} will
-return @code{NULL}.  You should not modify any of the fields in
-the returns @code{struct bfd_hash_entry}.
-
-If the @var{create} argument is @code{TRUE}, the string will be
-entered into the hash table if it is not already there.
-Either way a pointer to a @code{struct bfd_hash_entry} will be
-returned, either to the existing structure or to a newly
-created one.  In this case, a @code{NULL} return means that an
-error occurred.
-
-If the @var{create} argument is @code{TRUE}, and a new entry is
-created, the @var{copy} argument is used to decide whether to
-copy the string onto the hash table objalloc or not.  If
-@var{copy} is passed as @code{FALSE}, you must be careful not to
-deallocate or modify the string as long as the hash table
-exists.
-
-@node Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables
-@subsection Traversing a hash table
-@findex bfd_hash_traverse
-The function @code{bfd_hash_traverse} may be used to traverse a
-hash table, calling a function on each element.  The traversal
-is done in a random order.
-
-@code{bfd_hash_traverse} takes as arguments a function and a
-generic @code{void *} pointer.  The function is called with a
-hash table entry (a @code{struct bfd_hash_entry *}) and the
-generic pointer passed to @code{bfd_hash_traverse}.  The function
-must return a @code{boolean} value, which indicates whether to
-continue traversing the hash table.  If the function returns
-@code{FALSE}, @code{bfd_hash_traverse} will stop the traversal and
-return immediately.
-
-@node Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables
-@subsection Deriving a new hash table type
-Many uses of hash tables want to store additional information
-which each entry in the hash table.  Some also find it
-convenient to store additional information with the hash table
-itself.  This may be done using a derived hash table.
-
-Since C is not an object oriented language, creating a derived
-hash table requires sticking together some boilerplate
-routines with a few differences specific to the type of hash
-table you want to create.
-
-An example of a derived hash table is the linker hash table.
-The structures for this are defined in @code{bfdlink.h}.  The
-functions are in @code{linker.c}.
-
-You may also derive a hash table from an already derived hash
-table.  For example, the a.out linker backend code uses a hash
-table derived from the linker hash table.
-
-@menu
-* Define the Derived Structures::
-* Write the Derived Creation Routine::
-* Write Other Derived Routines::
-@end menu
-
-@node Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type
-@subsubsection Define the derived structures
-You must define a structure for an entry in the hash table,
-and a structure for the hash table itself.
-
-The first field in the structure for an entry in the hash
-table must be of the type used for an entry in the hash table
-you are deriving from.  If you are deriving from a basic hash
-table this is @code{struct bfd_hash_entry}, which is defined in
-@code{bfd.h}.  The first field in the structure for the hash
-table itself must be of the type of the hash table you are
-deriving from itself.  If you are deriving from a basic hash
-table, this is @code{struct bfd_hash_table}.
-
-For example, the linker hash table defines @code{struct
-bfd_link_hash_entry} (in @code{bfdlink.h}).  The first field,
-@code{root}, is of type @code{struct bfd_hash_entry}.  Similarly,
-the first field in @code{struct bfd_link_hash_table}, @code{table},
-is of type @code{struct bfd_hash_table}.
-
-@node Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type
-@subsubsection Write the derived creation routine
-You must write a routine which will create and initialize an
-entry in the hash table.  This routine is passed as the
-function argument to @code{bfd_hash_table_init}.
-
-In order to permit other hash tables to be derived from the
-hash table you are creating, this routine must be written in a
-standard way.
-
-The first argument to the creation routine is a pointer to a
-hash table entry.  This may be @code{NULL}, in which case the
-routine should allocate the right amount of space.  Otherwise
-the space has already been allocated by a hash table type
-derived from this one.
-
-After allocating space, the creation routine must call the
-creation routine of the hash table type it is derived from,
-passing in a pointer to the space it just allocated.  This
-will initialize any fields used by the base hash table.
-
-Finally the creation routine must initialize any local fields
-for the new hash table type.
-
-Here is a boilerplate example of a creation routine.
-@var{function_name} is the name of the routine.
-@var{entry_type} is the type of an entry in the hash table you
-are creating.  @var{base_newfunc} is the name of the creation
-routine of the hash table type your hash table is derived
-from.
-
-
-@example
-struct bfd_hash_entry *
-@var{function_name} (struct bfd_hash_entry *entry,
-                     struct bfd_hash_table *table,
-                     const char *string)
-@{
-  struct @var{entry_type} *ret = (@var{entry_type} *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
-    derived class.  */
-  if (ret == NULL)
-    @{
-      ret = bfd_hash_allocate (table, sizeof (* ret));
-      if (ret == NULL)
-        return NULL;
-    @}
-
- /* Call the allocation method of the base class.  */
-  ret = ((@var{entry_type} *)
-        @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string));
-
- /* Initialize the local fields here.  */
-
-  return (struct bfd_hash_entry *) ret;
-@}
-@end example
-@strong{Description}@*
-The creation routine for the linker hash table, which is in
-@code{linker.c}, looks just like this example.
-@var{function_name} is @code{_bfd_link_hash_newfunc}.
-@var{entry_type} is @code{struct bfd_link_hash_entry}.
-@var{base_newfunc} is @code{bfd_hash_newfunc}, the creation
-routine for a basic hash table.
-
-@code{_bfd_link_hash_newfunc} also initializes the local fields
-in a linker hash table entry: @code{type}, @code{written} and
-@code{next}.
-
-@node Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type
-@subsubsection Write other derived routines
-You will want to write other routines for your new hash table,
-as well.
-
-You will want an initialization routine which calls the
-initialization routine of the hash table you are deriving from
-and initializes any other local fields.  For the linker hash
-table, this is @code{_bfd_link_hash_table_init} in @code{linker.c}.
-
-You will want a lookup routine which calls the lookup routine
-of the hash table you are deriving from and casts the result.
-The linker hash table uses @code{bfd_link_hash_lookup} in
-@code{linker.c} (this actually takes an additional argument which
-it uses to decide how to return the looked up value).
-
-You may want a traversal routine.  This should just call the
-traversal routine of the hash table you are deriving from with
-appropriate casts.  The linker hash table uses
-@code{bfd_link_hash_traverse} in @code{linker.c}.
-
-These routines may simply be defined as macros.  For example,
-the a.out backend linker hash table, which is derived from the
-linker hash table, uses macros for the lookup and traversal
-routines.  These are @code{aout_link_hash_lookup} and
-@code{aout_link_hash_traverse} in aoutx.h.
-
diff --git a/bfd/doc/init.texi b/bfd/doc/init.texi
deleted file mode 100644
index ab735f8..0000000
--- a/bfd/doc/init.texi
+++ /dev/null
@@ -1,16 +0,0 @@
-@section Initialization
-
-
-@subsection Initialization functions
-These are the functions that handle initializing a BFD.
-
-@findex bfd_init
-@subsubsection @code{bfd_init}
-@strong{Synopsis}
-@example
-void bfd_init (void);
-@end example
-@strong{Description}@*
-This routine must be called before any other BFD function to
-initialize magical internal data structures.
-
diff --git a/bfd/doc/libbfd.texi b/bfd/doc/libbfd.texi
deleted file mode 100644
index b0b0300..0000000
--- a/bfd/doc/libbfd.texi
+++ /dev/null
@@ -1,179 +0,0 @@
-@section Implementation details
-
-
-@subsection Internal functions
-
-
-@strong{Description}@*
-These routines are used within BFD.
-They are not intended for export, but are documented here for
-completeness.
-
-@findex bfd_write_bigendian_4byte_int
-@subsubsection @code{bfd_write_bigendian_4byte_int}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
-@end example
-@strong{Description}@*
-Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
-endian order regardless of what else is going on.  This is useful in
-archives.
-
-@findex bfd_put_size
-@subsubsection @code{bfd_put_size}
-@findex bfd_get_size
-@subsubsection @code{bfd_get_size}
-@strong{Description}@*
-These macros as used for reading and writing raw data in
-sections; each access (except for bytes) is vectored through
-the target format of the BFD and mangled accordingly. The
-mangling performs any necessary endian translations and
-removes alignment restrictions.  Note that types accepted and
-returned by these macros are identical so they can be swapped
-around in macros---for example, @file{libaout.h} defines @code{GET_WORD}
-to either @code{bfd_get_32} or @code{bfd_get_64}.
-
-In the put routines, @var{val} must be a @code{bfd_vma}.  If we are on a
-system without prototypes, the caller is responsible for making
-sure that is true, with a cast if necessary.  We don't cast
-them in the macro definitions because that would prevent @code{lint}
-or @code{gcc -Wall} from detecting sins such as passing a pointer.
-To detect calling these with less than a @code{bfd_vma}, use
-@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s.
-@example
-
-/* Byte swapping macros for user section data.  */
-
-#define bfd_put_8(abfd, val, ptr) \
-  ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
-#define bfd_put_signed_8 \
-  bfd_put_8
-#define bfd_get_8(abfd, ptr) \
-  (*(const unsigned char *) (ptr) & 0xff)
-#define bfd_get_signed_8(abfd, ptr) \
-  (((*(const unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
-
-#define bfd_put_16(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
-#define bfd_put_signed_16 \
-  bfd_put_16
-#define bfd_get_16(abfd, ptr) \
-  BFD_SEND (abfd, bfd_getx16, (ptr))
-#define bfd_get_signed_16(abfd, ptr) \
-  BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
-
-#define bfd_put_32(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
-#define bfd_put_signed_32 \
-  bfd_put_32
-#define bfd_get_32(abfd, ptr) \
-  BFD_SEND (abfd, bfd_getx32, (ptr))
-#define bfd_get_signed_32(abfd, ptr) \
-  BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
-
-#define bfd_put_64(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
-#define bfd_put_signed_64 \
-  bfd_put_64
-#define bfd_get_64(abfd, ptr) \
-  BFD_SEND (abfd, bfd_getx64, (ptr))
-#define bfd_get_signed_64(abfd, ptr) \
-  BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
-
-#define bfd_get(bits, abfd, ptr)                       \
-  ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr)       \
-   : (bits) == 16 ? bfd_get_16 (abfd, ptr)             \
-   : (bits) == 32 ? bfd_get_32 (abfd, ptr)             \
-   : (bits) == 64 ? bfd_get_64 (abfd, ptr)             \
-   : (abort (), (bfd_vma) - 1))
-
-#define bfd_put(bits, abfd, val, ptr)                  \
-  ((bits) == 8 ? bfd_put_8  (abfd, val, ptr)           \
-   : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)                \
-   : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)                \
-   : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)                \
-   : (abort (), (void) 0))
-
-@end example
-
-@findex bfd_h_put_size
-@subsubsection @code{bfd_h_put_size}
-@strong{Description}@*
-These macros have the same function as their @code{bfd_get_x}
-brethren, except that they are used for removing information
-for the header records of object files. Believe it or not,
-some object files keep their header records in big endian
-order and their data in little endian order.
-@example
-
-/* Byte swapping macros for file header data.  */
-
-#define bfd_h_put_8(abfd, val, ptr) \
-  bfd_put_8 (abfd, val, ptr)
-#define bfd_h_put_signed_8(abfd, val, ptr) \
-  bfd_put_8 (abfd, val, ptr)
-#define bfd_h_get_8(abfd, ptr) \
-  bfd_get_8 (abfd, ptr)
-#define bfd_h_get_signed_8(abfd, ptr) \
-  bfd_get_signed_8 (abfd, ptr)
-
-#define bfd_h_put_16(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
-#define bfd_h_put_signed_16 \
-  bfd_h_put_16
-#define bfd_h_get_16(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx16, (ptr))
-#define bfd_h_get_signed_16(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
-
-#define bfd_h_put_32(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
-#define bfd_h_put_signed_32 \
-  bfd_h_put_32
-#define bfd_h_get_32(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx32, (ptr))
-#define bfd_h_get_signed_32(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
-
-#define bfd_h_put_64(abfd, val, ptr) \
-  BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
-#define bfd_h_put_signed_64 \
-  bfd_h_put_64
-#define bfd_h_get_64(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx64, (ptr))
-#define bfd_h_get_signed_64(abfd, ptr) \
-  BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
-
-/* Aliases for the above, which should eventually go away.  */
-
-#define H_PUT_64  bfd_h_put_64
-#define H_PUT_32  bfd_h_put_32
-#define H_PUT_16  bfd_h_put_16
-#define H_PUT_8   bfd_h_put_8
-#define H_PUT_S64 bfd_h_put_signed_64
-#define H_PUT_S32 bfd_h_put_signed_32
-#define H_PUT_S16 bfd_h_put_signed_16
-#define H_PUT_S8  bfd_h_put_signed_8
-#define H_GET_64  bfd_h_get_64
-#define H_GET_32  bfd_h_get_32
-#define H_GET_16  bfd_h_get_16
-#define H_GET_8   bfd_h_get_8
-#define H_GET_S64 bfd_h_get_signed_64
-#define H_GET_S32 bfd_h_get_signed_32
-#define H_GET_S16 bfd_h_get_signed_16
-#define H_GET_S8  bfd_h_get_signed_8
-
-
-@end example
-
-@findex bfd_log2
-@subsubsection @code{bfd_log2}
-@strong{Synopsis}
-@example
-unsigned int bfd_log2 (bfd_vma x);
-@end example
-@strong{Description}@*
-Return the log base 2 of the value supplied, rounded up.  E.g., an
-@var{x} of 1025 returns 11.  A @var{x} of 0 returns 0.
-
diff --git a/bfd/doc/linker.texi b/bfd/doc/linker.texi
deleted file mode 100644
index eae1662..0000000
--- a/bfd/doc/linker.texi
+++ /dev/null
@@ -1,432 +0,0 @@
-@section Linker Functions
-@cindex Linker
-The linker uses three special entry points in the BFD target
-vector.  It is not necessary to write special routines for
-these entry points when creating a new BFD back end, since
-generic versions are provided.  However, writing them can
-speed up linking and make it use significantly less runtime
-memory.
-
-The first routine creates a hash table used by the other
-routines.  The second routine adds the symbols from an object
-file to the hash table.  The third routine takes all the
-object files and links them together to create the output
-file.  These routines are designed so that the linker proper
-does not need to know anything about the symbols in the object
-files that it is linking.  The linker merely arranges the
-sections as directed by the linker script and lets BFD handle
-the details of symbols and relocs.
-
-The second routine and third routines are passed a pointer to
-a @code{struct bfd_link_info} structure (defined in
-@code{bfdlink.h}) which holds information relevant to the link,
-including the linker hash table (which was created by the
-first routine) and a set of callback functions to the linker
-proper.
-
-The generic linker routines are in @code{linker.c}, and use the
-header file @code{genlink.h}.  As of this writing, the only back
-ends which have implemented versions of these routines are
-a.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}).  The a.out
-routines are used as examples throughout this section.
-
-@menu
-* Creating a Linker Hash Table::
-* Adding Symbols to the Hash Table::
-* Performing the Final Link::
-@end menu
-
-@node Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions
-@subsection Creating a linker hash table
-@cindex _bfd_link_hash_table_create in target vector
-@cindex target vector (_bfd_link_hash_table_create)
-The linker routines must create a hash table, which must be
-derived from @code{struct bfd_link_hash_table} described in
-@code{bfdlink.c}.  @xref{Hash Tables}, for information on how to
-create a derived hash table.  This entry point is called using
-the target vector of the linker output file.
-
-The @code{_bfd_link_hash_table_create} entry point must allocate
-and initialize an instance of the desired hash table.  If the
-back end does not require any additional information to be
-stored with the entries in the hash table, the entry point may
-simply create a @code{struct bfd_link_hash_table}.  Most likely,
-however, some additional information will be needed.
-
-For example, with each entry in the hash table the a.out
-linker keeps the index the symbol has in the final output file
-(this index number is used so that when doing a relocatable
-link the symbol index used in the output file can be quickly
-filled in when copying over a reloc).  The a.out linker code
-defines the required structures and functions for a hash table
-derived from @code{struct bfd_link_hash_table}.  The a.out linker
-hash table is created by the function
-@code{NAME(aout,link_hash_table_create)}; it simply allocates
-space for the hash table, initializes it, and returns a
-pointer to it.
-
-When writing the linker routines for a new back end, you will
-generally not know exactly which fields will be required until
-you have finished.  You should simply create a new hash table
-which defines no additional fields, and then simply add fields
-as they become necessary.
-
-@node Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions
-@subsection Adding symbols to the hash table
-@cindex _bfd_link_add_symbols in target vector
-@cindex target vector (_bfd_link_add_symbols)
-The linker proper will call the @code{_bfd_link_add_symbols}
-entry point for each object file or archive which is to be
-linked (typically these are the files named on the command
-line, but some may also come from the linker script).  The
-entry point is responsible for examining the file.  For an
-object file, BFD must add any relevant symbol information to
-the hash table.  For an archive, BFD must determine which
-elements of the archive should be used and adding them to the
-link.
-
-The a.out version of this entry point is
-@code{NAME(aout,link_add_symbols)}.
-
-@menu
-* Differing file formats::
-* Adding symbols from an object file::
-* Adding symbols from an archive::
-@end menu
-
-@node Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table
-@subsubsection Differing file formats
-Normally all the files involved in a link will be of the same
-format, but it is also possible to link together different
-format object files, and the back end must support that.  The
-@code{_bfd_link_add_symbols} entry point is called via the target
-vector of the file to be added.  This has an important
-consequence: the function may not assume that the hash table
-is the type created by the corresponding
-@code{_bfd_link_hash_table_create} vector.  All the
-@code{_bfd_link_add_symbols} function can assume about the hash
-table is that it is derived from @code{struct
-bfd_link_hash_table}.
-
-Sometimes the @code{_bfd_link_add_symbols} function must store
-some information in the hash table entry to be used by the
-@code{_bfd_final_link} function.  In such a case the output bfd
-xvec must be checked to make sure that the hash table was
-created by an object file of the same format.
-
-The @code{_bfd_final_link} routine must be prepared to handle a
-hash entry without any extra information added by the
-@code{_bfd_link_add_symbols} function.  A hash entry without
-extra information will also occur when the linker script
-directs the linker to create a symbol.  Note that, regardless
-of how a hash table entry is added, all the fields will be
-initialized to some sort of null value by the hash table entry
-initialization function.
-
-See @code{ecoff_link_add_externals} for an example of how to
-check the output bfd before saving information (in this
-case, the ECOFF external symbol debugging information) in a
-hash table entry.
-
-@node Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table
-@subsubsection Adding symbols from an object file
-When the @code{_bfd_link_add_symbols} routine is passed an object
-file, it must add all externally visible symbols in that
-object file to the hash table.  The actual work of adding the
-symbol to the hash table is normally handled by the function
-@code{_bfd_generic_link_add_one_symbol}.  The
-@code{_bfd_link_add_symbols} routine is responsible for reading
-all the symbols from the object file and passing the correct
-information to @code{_bfd_generic_link_add_one_symbol}.
-
-The @code{_bfd_link_add_symbols} routine should not use
-@code{bfd_canonicalize_symtab} to read the symbols.  The point of
-providing this routine is to avoid the overhead of converting
-the symbols into generic @code{asymbol} structures.
-
-@findex _bfd_generic_link_add_one_symbol
-@code{_bfd_generic_link_add_one_symbol} handles the details of
-combining common symbols, warning about multiple definitions,
-and so forth.  It takes arguments which describe the symbol to
-add, notably symbol flags, a section, and an offset.  The
-symbol flags include such things as @code{BSF_WEAK} or
-@code{BSF_INDIRECT}.  The section is a section in the object
-file, or something like @code{bfd_und_section_ptr} for an undefined
-symbol or @code{bfd_com_section_ptr} for a common symbol.
-
-If the @code{_bfd_final_link} routine is also going to need to
-read the symbol information, the @code{_bfd_link_add_symbols}
-routine should save it somewhere attached to the object file
-BFD.  However, the information should only be saved if the
-@code{keep_memory} field of the @code{info} argument is TRUE, so
-that the @code{-no-keep-memory} linker switch is effective.
-
-The a.out function which adds symbols from an object file is
-@code{aout_link_add_object_symbols}, and most of the interesting
-work is in @code{aout_link_add_symbols}.  The latter saves
-pointers to the hash tables entries created by
-@code{_bfd_generic_link_add_one_symbol} indexed by symbol number,
-so that the @code{_bfd_final_link} routine does not have to call
-the hash table lookup routine to locate the entry.
-
-@node Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table
-@subsubsection Adding symbols from an archive
-When the @code{_bfd_link_add_symbols} routine is passed an
-archive, it must look through the symbols defined by the
-archive and decide which elements of the archive should be
-included in the link.  For each such element it must call the
-@code{add_archive_element} linker callback, and it must add the
-symbols from the object file to the linker hash table.  (The
-callback may in fact indicate that a replacement BFD should be
-used, in which case the symbols from that BFD should be added
-to the linker hash table instead.)
-
-@findex _bfd_generic_link_add_archive_symbols
-In most cases the work of looking through the symbols in the
-archive should be done by the
-@code{_bfd_generic_link_add_archive_symbols} function.  This
-function builds a hash table from the archive symbol table and
-looks through the list of undefined symbols to see which
-elements should be included.
-@code{_bfd_generic_link_add_archive_symbols} is passed a function
-to call to make the final decision about adding an archive
-element to the link and to do the actual work of adding the
-symbols to the linker hash table.
-
-The function passed to
-@code{_bfd_generic_link_add_archive_symbols} must read the
-symbols of the archive element and decide whether the archive
-element should be included in the link.  If the element is to
-be included, the @code{add_archive_element} linker callback
-routine must be called with the element as an argument, and
-the element's symbols must be added to the linker hash table
-just as though the element had itself been passed to the
-@code{_bfd_link_add_symbols} function.  The @code{add_archive_element}
-callback has the option to indicate that it would like to
-replace the element archive with a substitute BFD, in which
-case it is the symbols of that substitute BFD that must be
-added to the linker hash table instead.
-
-When the a.out @code{_bfd_link_add_symbols} function receives an
-archive, it calls @code{_bfd_generic_link_add_archive_symbols}
-passing @code{aout_link_check_archive_element} as the function
-argument. @code{aout_link_check_archive_element} calls
-@code{aout_link_check_ar_symbols}.  If the latter decides to add
-the element (an element is only added if it provides a real,
-non-common, definition for a previously undefined or common
-symbol) it calls the @code{add_archive_element} callback and then
-@code{aout_link_check_archive_element} calls
-@code{aout_link_add_symbols} to actually add the symbols to the
-linker hash table - possibly those of a substitute BFD, if the
-@code{add_archive_element} callback avails itself of that option.
-
-The ECOFF back end is unusual in that it does not normally
-call @code{_bfd_generic_link_add_archive_symbols}, because ECOFF
-archives already contain a hash table of symbols.  The ECOFF
-back end searches the archive itself to avoid the overhead of
-creating a new hash table.
-
-@node Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions
-@subsection Performing the final link
-@cindex _bfd_link_final_link in target vector
-@cindex target vector (_bfd_final_link)
-When all the input files have been processed, the linker calls
-the @code{_bfd_final_link} entry point of the output BFD.  This
-routine is responsible for producing the final output file,
-which has several aspects.  It must relocate the contents of
-the input sections and copy the data into the output sections.
-It must build an output symbol table including any local
-symbols from the input files and the global symbols from the
-hash table.  When producing relocatable output, it must
-modify the input relocs and write them into the output file.
-There may also be object format dependent work to be done.
-
-The linker will also call the @code{write_object_contents} entry
-point when the BFD is closed.  The two entry points must work
-together in order to produce the correct output file.
-
-The details of how this works are inevitably dependent upon
-the specific object file format.  The a.out
-@code{_bfd_final_link} routine is @code{NAME(aout,final_link)}.
-
-@menu
-* Information provided by the linker::
-* Relocating the section contents::
-* Writing the symbol table::
-@end menu
-
-@node Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link
-@subsubsection Information provided by the linker
-Before the linker calls the @code{_bfd_final_link} entry point,
-it sets up some data structures for the function to use.
-
-The @code{input_bfds} field of the @code{bfd_link_info} structure
-will point to a list of all the input files included in the
-link.  These files are linked through the @code{link_next} field
-of the @code{bfd} structure.
-
-Each section in the output file will have a list of
-@code{link_order} structures attached to the @code{map_head.link_order}
-field (the @code{link_order} structure is defined in
-@code{bfdlink.h}).  These structures describe how to create the
-contents of the output section in terms of the contents of
-various input sections, fill constants, and, eventually, other
-types of information.  They also describe relocs that must be
-created by the BFD backend, but do not correspond to any input
-file; this is used to support -Ur, which builds constructors
-while generating a relocatable object file.
-
-@node Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link
-@subsubsection Relocating the section contents
-The @code{_bfd_final_link} function should look through the
-@code{link_order} structures attached to each section of the
-output file.  Each @code{link_order} structure should either be
-handled specially, or it should be passed to the function
-@code{_bfd_default_link_order} which will do the right thing
-(@code{_bfd_default_link_order} is defined in @code{linker.c}).
-
-For efficiency, a @code{link_order} of type
-@code{bfd_indirect_link_order} whose associated section belongs
-to a BFD of the same format as the output BFD must be handled
-specially.  This type of @code{link_order} describes part of an
-output section in terms of a section belonging to one of the
-input files.  The @code{_bfd_final_link} function should read the
-contents of the section and any associated relocs, apply the
-relocs to the section contents, and write out the modified
-section contents.  If performing a relocatable link, the
-relocs themselves must also be modified and written out.
-
-@findex _bfd_relocate_contents
-@findex _bfd_final_link_relocate
-The functions @code{_bfd_relocate_contents} and
-@code{_bfd_final_link_relocate} provide some general support for
-performing the actual relocations, notably overflow checking.
-Their arguments include information about the symbol the
-relocation is against and a @code{reloc_howto_type} argument
-which describes the relocation to perform.  These functions
-are defined in @code{reloc.c}.
-
-The a.out function which handles reading, relocating, and
-writing section contents is @code{aout_link_input_section}.  The
-actual relocation is done in @code{aout_link_input_section_std}
-and @code{aout_link_input_section_ext}.
-
-@node Writing the symbol table, , Relocating the section contents, Performing the Final Link
-@subsubsection Writing the symbol table
-The @code{_bfd_final_link} function must gather all the symbols
-in the input files and write them out.  It must also write out
-all the symbols in the global hash table.  This must be
-controlled by the @code{strip} and @code{discard} fields of the
-@code{bfd_link_info} structure.
-
-The local symbols of the input files will not have been
-entered into the linker hash table.  The @code{_bfd_final_link}
-routine must consider each input file and include the symbols
-in the output file.  It may be convenient to do this when
-looking through the @code{link_order} structures, or it may be
-done by stepping through the @code{input_bfds} list.
-
-The @code{_bfd_final_link} routine must also traverse the global
-hash table to gather all the externally visible symbols.  It
-is possible that most of the externally visible symbols may be
-written out when considering the symbols of each input file,
-but it is still necessary to traverse the hash table since the
-linker script may have defined some symbols that are not in
-any of the input files.
-
-The @code{strip} field of the @code{bfd_link_info} structure
-controls which symbols are written out.  The possible values
-are listed in @code{bfdlink.h}.  If the value is @code{strip_some},
-then the @code{keep_hash} field of the @code{bfd_link_info}
-structure is a hash table of symbols to keep; each symbol
-should be looked up in this hash table, and only symbols which
-are present should be included in the output file.
-
-If the @code{strip} field of the @code{bfd_link_info} structure
-permits local symbols to be written out, the @code{discard} field
-is used to further controls which local symbols are included
-in the output file.  If the value is @code{discard_l}, then all
-local symbols which begin with a certain prefix are discarded;
-this is controlled by the @code{bfd_is_local_label_name} entry point.
-
-The a.out backend handles symbols by calling
-@code{aout_link_write_symbols} on each input BFD and then
-traversing the global hash table with the function
-@code{aout_link_write_other_symbol}.  It builds a string table
-while writing out the symbols, which is written to the output
-file at the end of @code{NAME(aout,final_link)}.
-
-@findex bfd_link_split_section
-@subsubsection @code{bfd_link_split_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
-@end example
-@strong{Description}@*
-Return nonzero if @var{sec} should be split during a
-reloceatable or final link.
-@example
-#define bfd_link_split_section(abfd, sec) \
-       BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
-@end example
-
-@findex bfd_section_already_linked
-@subsubsection @code{bfd_section_already_linked}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_section_already_linked (bfd *abfd,
-    asection *sec,
-    struct bfd_link_info *info);
-@end example
-@strong{Description}@*
-Check if @var{data} has been already linked during a reloceatable
-or final link.  Return TRUE if it has.
-@example
-#define bfd_section_already_linked(abfd, sec, info) \
-       BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
-
-@end example
-
-@findex bfd_generic_define_common_symbol
-@subsubsection @code{bfd_generic_define_common_symbol}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_define_common_symbol
-   (bfd *output_bfd, struct bfd_link_info *info,
-    struct bfd_link_hash_entry *h);
-@end example
-@strong{Description}@*
-Convert common symbol @var{h} into a defined symbol.
-Return TRUE on success and FALSE on failure.
-@example
-#define bfd_define_common_symbol(output_bfd, info, h) \
-       BFD_SEND (output_bfd, _bfd_define_common_symbol, (output_bfd, info, h))
-
-@end example
-
-@findex bfd_find_version_for_sym 
-@subsubsection @code{bfd_find_version_for_sym }
-@strong{Synopsis}
-@example
-struct bfd_elf_version_tree * bfd_find_version_for_sym
-   (struct bfd_elf_version_tree *verdefs,
-    const char *sym_name, bfd_boolean *hide);
-@end example
-@strong{Description}@*
-Search an elf version script tree for symbol versioning
-info and export / don't-export status for a given symbol.
-Return non-NULL on success and NULL on failure; also sets
-the output @samp{hide} boolean parameter.
-
-@findex bfd_hide_sym_by_version
-@subsubsection @code{bfd_hide_sym_by_version}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_hide_sym_by_version
-   (struct bfd_elf_version_tree *verdefs, const char *sym_name);
-@end example
-@strong{Description}@*
-Search an elf version script tree for symbol versioning
-info for a given symbol.  Return TRUE if the symbol is hidden.
-
diff --git a/bfd/doc/makefile.vms b/bfd/doc/makefile.vms
index a0857c0..267af6b 100644
--- a/bfd/doc/makefile.vms
+++ b/bfd/doc/makefile.vms
@@ -1,3 +1,20 @@
+#   Copyright 2012 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
+
 CFLAGS = /noopt/include=([],[-],[-.-.include])
 LDFLAGS = /nomap
 LDLIBS = ,sys$$library:vaxcrtl.olb/lib
diff --git a/bfd/doc/mmo.texi b/bfd/doc/mmo.texi
deleted file mode 100644
index b0d726a..0000000
--- a/bfd/doc/mmo.texi
+++ /dev/null
@@ -1,365 +0,0 @@
-@section mmo backend
-The mmo object format is used exclusively together with Professor
-Donald E.@: Knuth's educational 64-bit processor MMIX.  The simulator
-@command{mmix} which is available at
-@url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz}
-understands this format.  That package also includes a combined
-assembler and linker called @command{mmixal}.  The mmo format has
-no advantages feature-wise compared to e.g. ELF.  It is a simple
-non-relocatable object format with no support for archives or
-debugging information, except for symbol value information and
-line numbers (which is not yet implemented in BFD).  See
-@url{http://www-cs-faculty.stanford.edu/~knuth/mmix.html} for more
-information about MMIX.  The ELF format is used for intermediate
-object files in the BFD implementation.
-
-@c We want to xref the symbol table node.  A feature in "chew"
-@c requires that "commands" do not contain spaces in the
-@c arguments.  Hence the hyphen in "Symbol-table".
-@menu
-* File layout::
-* Symbol-table::
-* mmo section mapping::
-@end menu
-
-@node File layout, Symbol-table, mmo, mmo
-@subsection File layout
-The mmo file contents is not partitioned into named sections as
-with e.g.@: ELF.  Memory areas is formed by specifying the
-location of the data that follows.  Only the memory area
-@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} is executable, so
-it is used for code (and constants) and the area
-@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} is used for
-writable data.  @xref{mmo section mapping}.
-
-There is provision for specifying ``special data'' of 65536
-different types.  We use type 80 (decimal), arbitrarily chosen the
-same as the ELF @code{e_machine} number for MMIX, filling it with
-section information normally found in ELF objects. @xref{mmo
-section mapping}.
-
-Contents is entered as 32-bit words, xor:ed over previous
-contents, always zero-initialized.  A word that starts with the
-byte @samp{0x98} forms a command called a @samp{lopcode}, where
-the next byte distinguished between the thirteen lopcodes.  The
-two remaining bytes, called the @samp{Y} and @samp{Z} fields, or
-the @samp{YZ} field (a 16-bit big-endian number), are used for
-various purposes different for each lopcode.  As documented in
-@url{http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz},
-the lopcodes are:
-
-@table @code
-@item lop_quote
-0x98000001.  The next word is contents, regardless of whether it
-starts with 0x98 or not.
-
-@item lop_loc
-0x9801YYZZ, where @samp{Z} is 1 or 2.  This is a location
-directive, setting the location for the next data to the next
-32-bit word (for @math{Z = 1}) or 64-bit word (for @math{Z = 2}),
-plus @math{Y * 2^56}.  Normally @samp{Y} is 0 for the text segment
-and 2 for the data segment.
-
-@item lop_skip
-0x9802YYZZ.  Increase the current location by @samp{YZ} bytes.
-
-@item lop_fixo
-0x9803YYZZ, where @samp{Z} is 1 or 2.  Store the current location
-as 64 bits into the location pointed to by the next 32-bit
-(@math{Z = 1}) or 64-bit (@math{Z = 2}) word, plus @math{Y *
-2^56}.
-
-@item lop_fixr
-0x9804YYZZ.  @samp{YZ} is stored into the current location plus
-@math{2 - 4 * YZ}.
-
-@item lop_fixrx
-0x980500ZZ.  @samp{Z} is 16 or 24.  A value @samp{L} derived from
-the following 32-bit word are used in a manner similar to
-@samp{YZ} in lop_fixr: it is xor:ed into the current location
-minus @math{4 * L}.  The first byte of the word is 0 or 1.  If it
-is 1, then @math{L = (@var{lowest 24 bits of word}) - 2^Z}, if 0,
-then @math{L = (@var{lowest 24 bits of word})}.
-
-@item lop_file
-0x9806YYZZ.  @samp{Y} is the file number, @samp{Z} is count of
-32-bit words.  Set the file number to @samp{Y} and the line
-counter to 0.  The next @math{Z * 4} bytes contain the file name,
-padded with zeros if the count is not a multiple of four.  The
-same @samp{Y} may occur multiple times, but @samp{Z} must be 0 for
-all but the first occurrence.
-
-@item lop_line
-0x9807YYZZ.  @samp{YZ} is the line number.  Together with
-lop_file, it forms the source location for the next 32-bit word.
-Note that for each non-lopcode 32-bit word, line numbers are
-assumed incremented by one.
-
-@item lop_spec
-0x9808YYZZ.  @samp{YZ} is the type number.  Data until the next
-lopcode other than lop_quote forms special data of type @samp{YZ}.
-@xref{mmo section mapping}.
-
-Other types than 80, (or type 80 with a content that does not
-parse) is stored in sections named @code{.MMIX.spec_data.@var{n}}
-where @var{n} is the @samp{YZ}-type.  The flags for such a
-sections say not to allocate or load the data.  The vma is 0.
-Contents of multiple occurrences of special data @var{n} is
-concatenated to the data of the previous lop_spec @var{n}s.  The
-location in data or code at which the lop_spec occurred is lost.
-
-@item lop_pre
-0x980901ZZ.  The first lopcode in a file.  The @samp{Z} field forms the
-length of header information in 32-bit words, where the first word
-tells the time in seconds since @samp{00:00:00 GMT Jan 1 1970}.
-
-@item lop_post
-0x980a00ZZ.  @math{Z > 32}.  This lopcode follows after all
-content-generating lopcodes in a program.  The @samp{Z} field
-denotes the value of @samp{rG} at the beginning of the program.
-The following @math{256 - Z} big-endian 64-bit words are loaded
-into global registers @samp{$G} @dots{} @samp{$255}.
-
-@item lop_stab
-0x980b0000.  The next-to-last lopcode in a program.  Must follow
-immediately after the lop_post lopcode and its data.  After this
-lopcode follows all symbols in a compressed format
-(@pxref{Symbol-table}).
-
-@item lop_end
-0x980cYYZZ.  The last lopcode in a program.  It must follow the
-lop_stab lopcode and its data.  The @samp{YZ} field contains the
-number of 32-bit words of symbol table information after the
-preceding lop_stab lopcode.
-@end table
-
-Note that the lopcode "fixups"; @code{lop_fixr}, @code{lop_fixrx} and
-@code{lop_fixo} are not generated by BFD, but are handled.  They are
-generated by @code{mmixal}.
-
-This trivial one-label, one-instruction file:
-
-@example
- :Main TRAP 1,2,3
-@end example
-
-can be represented this way in mmo:
-
-@example
- 0x98090101 - lop_pre, one 32-bit word with timestamp.
- <timestamp>
- 0x98010002 - lop_loc, text segment, using a 64-bit address.
-              Note that mmixal does not emit this for the file above.
- 0x00000000 - Address, high 32 bits.
- 0x00000000 - Address, low 32 bits.
- 0x98060002 - lop_file, 2 32-bit words for file-name.
- 0x74657374 - "test"
- 0x2e730000 - ".s\0\0"
- 0x98070001 - lop_line, line 1.
- 0x00010203 - TRAP 1,2,3
- 0x980a00ff - lop_post, setting $255 to 0.
- 0x00000000
- 0x00000000
- 0x980b0000 - lop_stab for ":Main" = 0, serial 1.
- 0x203a4040   @xref{Symbol-table}.
- 0x10404020
- 0x4d206120
- 0x69016e00
- 0x81000000
- 0x980c0005 - lop_end; symbol table contained five 32-bit words.
-@end example
-@node Symbol-table, mmo section mapping, File layout, mmo
-@subsection Symbol table format
-From mmixal.w (or really, the generated mmixal.tex) in
-@url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz}):
-``Symbols are stored and retrieved by means of a @samp{ternary
-search trie}, following ideas of Bentley and Sedgewick. (See
-ACM--SIAM Symp.@: on Discrete Algorithms @samp{8} (1997), 360--369;
-R.@:Sedgewick, @samp{Algorithms in C} (Reading, Mass.@:
-Addison--Wesley, 1998), @samp{15.4}.)  Each trie node stores a
-character, and there are branches to subtries for the cases where
-a given character is less than, equal to, or greater than the
-character in the trie.  There also is a pointer to a symbol table
-entry if a symbol ends at the current node.''
-
-So it's a tree encoded as a stream of bytes.  The stream of bytes
-acts on a single virtual global symbol, adding and removing
-characters and signalling complete symbol points.  Here, we read
-the stream and create symbols at the completion points.
-
-First, there's a control byte @code{m}.  If any of the listed bits
-in @code{m} is nonzero, we execute what stands at the right, in
-the listed order:
-
-@example
- (MMO3_LEFT)
- 0x40 - Traverse left trie.
-        (Read a new command byte and recurse.)
-
- (MMO3_SYMBITS)
- 0x2f - Read the next byte as a character and store it in the
-        current character position; increment character position.
-        Test the bits of @code{m}:
-
-        (MMO3_WCHAR)
-        0x80 - The character is 16-bit (so read another byte,
-               merge into current character.
-
-        (MMO3_TYPEBITS)
-        0xf  - We have a complete symbol; parse the type, value
-               and serial number and do what should be done
-               with a symbol.  The type and length information
-               is in j = (m & 0xf).
-
-               (MMO3_REGQUAL_BITS)
-               j == 0xf: A register variable.  The following
-                         byte tells which register.
-               j <= 8:   An absolute symbol.  Read j bytes as the
-                         big-endian number the symbol equals.
-                         A j = 2 with two zero bytes denotes an
-                         unknown symbol.
-               j > 8:    As with j <= 8, but add (0x20 << 56)
-                         to the value in the following j - 8
-                         bytes.
-
-               Then comes the serial number, as a variant of
-               uleb128, but better named ubeb128:
-               Read bytes and shift the previous value left 7
-               (multiply by 128).  Add in the new byte, repeat
-               until a byte has bit 7 set.  The serial number
-               is the computed value minus 128.
-
-        (MMO3_MIDDLE)
-        0x20 - Traverse middle trie.  (Read a new command byte
-               and recurse.)  Decrement character position.
-
- (MMO3_RIGHT)
- 0x10 - Traverse right trie.  (Read a new command byte and
-        recurse.)
-@end example
-
-Let's look again at the @code{lop_stab} for the trivial file
-(@pxref{File layout}).
-
-@example
- 0x980b0000 - lop_stab for ":Main" = 0, serial 1.
- 0x203a4040
- 0x10404020
- 0x4d206120
- 0x69016e00
- 0x81000000
-@end example
-
-This forms the trivial trie (note that the path between ``:'' and
-``M'' is redundant):
-
-@example
- 203a     ":"
- 40       /
- 40      /
- 10      \
- 40      /
- 40     /
- 204d  "M"
- 2061  "a"
- 2069  "i"
- 016e  "n" is the last character in a full symbol, and
-       with a value represented in one byte.
- 00    The value is 0.
- 81    The serial number is 1.
-@end example
-
-@node mmo section mapping, , Symbol-table, mmo
-@subsection mmo section mapping
-The implementation in BFD uses special data type 80 (decimal) to
-encapsulate and describe named sections, containing e.g.@: debug
-information.  If needed, any datum in the encapsulation will be
-quoted using lop_quote.  First comes a 32-bit word holding the
-number of 32-bit words containing the zero-terminated zero-padded
-segment name.  After the name there's a 32-bit word holding flags
-describing the section type.  Then comes a 64-bit big-endian word
-with the section length (in bytes), then another with the section
-start address.  Depending on the type of section, the contents
-might follow, zero-padded to 32-bit boundary.  For a loadable
-section (such as data or code), the contents might follow at some
-later point, not necessarily immediately, as a lop_loc with the
-same start address as in the section description, followed by the
-contents.  This in effect forms a descriptor that must be emitted
-before the actual contents.  Sections described this way must not
-overlap.
-
-For areas that don't have such descriptors, synthetic sections are
-formed by BFD.  Consecutive contents in the two memory areas
-@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} and
-@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} are entered in
-sections named @code{.text} and @code{.data} respectively.  If an area
-is not otherwise described, but would together with a neighboring
-lower area be less than @samp{0x40000000} bytes long, it is joined
-with the lower area and the gap is zero-filled.  For other cases,
-a new section is formed, named @code{.MMIX.sec.@var{n}}.  Here,
-@var{n} is a number, a running count through the mmo file,
-starting at 0.
-
-A loadable section specified as:
-
-@example
- .section secname,"ax"
- TETRA 1,2,3,4,-1,-2009
- BYTE 80
-@end example
-
-and linked to address @samp{0x4}, is represented by the sequence:
-
-@example
- 0x98080050 - lop_spec 80
- 0x00000002 - two 32-bit words for the section name
- 0x7365636e - "secn"
- 0x616d6500 - "ame\0"
- 0x00000033 - flags CODE, READONLY, LOAD, ALLOC
- 0x00000000 - high 32 bits of section length
- 0x0000001c - section length is 28 bytes; 6 * 4 + 1 + alignment to 32 bits
- 0x00000000 - high 32 bits of section address
- 0x00000004 - section address is 4
- 0x98010002 - 64 bits with address of following data
- 0x00000000 - high 32 bits of address
- 0x00000004 - low 32 bits: data starts at address 4
- 0x00000001 - 1
- 0x00000002 - 2
- 0x00000003 - 3
- 0x00000004 - 4
- 0xffffffff - -1
- 0xfffff827 - -2009
- 0x50000000 - 80 as a byte, padded with zeros.
-@end example
-
-Note that the lop_spec wrapping does not include the section
-contents.  Compare this to a non-loaded section specified as:
-
-@example
- .section thirdsec
- TETRA 200001,100002
- BYTE 38,40
-@end example
-
-This, when linked to address @samp{0x200000000000001c}, is
-represented by:
-
-@example
- 0x98080050 - lop_spec 80
- 0x00000002 - two 32-bit words for the section name
- 0x7365636e - "thir"
- 0x616d6500 - "dsec"
- 0x00000010 - flag READONLY
- 0x00000000 - high 32 bits of section length
- 0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits
- 0x20000000 - high 32 bits of address
- 0x0000001c - low 32 bits of address 0x200000000000001c
- 0x00030d41 - 200001
- 0x000186a2 - 100002
- 0x26280000 - 38, 40 as bytes, padded with zeros
-@end example
-
-For the latter example, the section contents must not be
-loaded in memory, and is therefore specified as part of the
-special data.  The address is usually unimportant but might
-provide information for e.g.@: the DWARF 2 debugging format.
diff --git a/bfd/doc/opncls.texi b/bfd/doc/opncls.texi
deleted file mode 100644
index 1562ea5..0000000
--- a/bfd/doc/opncls.texi
+++ /dev/null
@@ -1,381 +0,0 @@
-
-@example
-/* Set to N to open the next N BFDs using an alternate id space.  */
-extern unsigned int bfd_use_reserved_id;
-@end example
-@section Opening and closing BFDs
-
-
-@subsection Functions for opening and closing
-
-
-@findex bfd_fopen
-@subsubsection @code{bfd_fopen}
-@strong{Synopsis}
-@example
-bfd *bfd_fopen (const char *filename, const char *target,
-    const char *mode, int fd);
-@end example
-@strong{Description}@*
-Open the file @var{filename} with the target @var{target}.
-Return a pointer to the created BFD.  If @var{fd} is not -1,
-then @code{fdopen} is used to open the file; otherwise, @code{fopen}
-is used.  @var{mode} is passed directly to @code{fopen} or
-@code{fdopen}. 
-
-Calls @code{bfd_find_target}, so @var{target} is interpreted as by
-that function.
-
-The new BFD is marked as cacheable iff @var{fd} is -1.
-
-If @code{NULL} is returned then an error has occured.   Possible errors
-are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or
-@code{system_call} error.
-
-On error, @var{fd} is always closed.
-
-@findex bfd_openr
-@subsubsection @code{bfd_openr}
-@strong{Synopsis}
-@example
-bfd *bfd_openr (const char *filename, const char *target);
-@end example
-@strong{Description}@*
-Open the file @var{filename} (using @code{fopen}) with the target
-@var{target}.  Return a pointer to the created BFD.
-
-Calls @code{bfd_find_target}, so @var{target} is interpreted as by
-that function.
-
-If @code{NULL} is returned then an error has occured.   Possible errors
-are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or
-@code{system_call} error.
-
-@findex bfd_fdopenr
-@subsubsection @code{bfd_fdopenr}
-@strong{Synopsis}
-@example
-bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
-@end example
-@strong{Description}@*
-@code{bfd_fdopenr} is to @code{bfd_fopenr} much like @code{fdopen} is to
-@code{fopen}.  It opens a BFD on a file already described by the
-@var{fd} supplied.
-
-When the file is later @code{bfd_close}d, the file descriptor will
-be closed.  If the caller desires that this file descriptor be
-cached by BFD (opened as needed, closed as needed to free
-descriptors for other opens), with the supplied @var{fd} used as
-an initial file descriptor (but subject to closure at any time),
-call bfd_set_cacheable(bfd, 1) on the returned BFD.  The default
-is to assume no caching; the file descriptor will remain open
-until @code{bfd_close}, and will not be affected by BFD operations
-on other files.
-
-Possible errors are @code{bfd_error_no_memory},
-@code{bfd_error_invalid_target} and @code{bfd_error_system_call}.
-
-On error, @var{fd} is closed.
-
-@findex bfd_openstreamr
-@subsubsection @code{bfd_openstreamr}
-@strong{Synopsis}
-@example
-bfd *bfd_openstreamr (const char *, const char *, void *);
-@end example
-@strong{Description}@*
-Open a BFD for read access on an existing stdio stream.  When
-the BFD is passed to @code{bfd_close}, the stream will be closed.
-
-@findex bfd_openr_iovec
-@subsubsection @code{bfd_openr_iovec}
-@strong{Synopsis}
-@example
-bfd *bfd_openr_iovec (const char *filename, const char *target,
-    void *(*open_func) (struct bfd *nbfd,
-    void *open_closure),
-    void *open_closure,
-    file_ptr (*pread_func) (struct bfd *nbfd,
-    void *stream,
-    void *buf,
-    file_ptr nbytes,
-    file_ptr offset),
-    int (*close_func) (struct bfd *nbfd,
-    void *stream),
-    int (*stat_func) (struct bfd *abfd,
-    void *stream,
-    struct stat *sb));
-@end example
-@strong{Description}@*
-Create and return a BFD backed by a read-only @var{stream}.
-The @var{stream} is created using @var{open_func}, accessed using
-@var{pread_func} and destroyed using @var{close_func}.
-
-Calls @code{bfd_find_target}, so @var{target} is interpreted as by
-that function.
-
-Calls @var{open_func} (which can call @code{bfd_zalloc} and
-@code{bfd_get_filename}) to obtain the read-only stream backing
-the BFD.  @var{open_func} either succeeds returning the
-non-@code{NULL} @var{stream}, or fails returning @code{NULL}
-(setting @code{bfd_error}).
-
-Calls @var{pread_func} to request @var{nbytes} of data from
-@var{stream} starting at @var{offset} (e.g., via a call to
-@code{bfd_read}).  @var{pread_func} either succeeds returning the
-number of bytes read (which can be less than @var{nbytes} when
-end-of-file), or fails returning -1 (setting @code{bfd_error}).
-
-Calls @var{close_func} when the BFD is later closed using
-@code{bfd_close}.  @var{close_func} either succeeds returning 0, or
-fails returning -1 (setting @code{bfd_error}).
-
-Calls @var{stat_func} to fill in a stat structure for bfd_stat,
-bfd_get_size, and bfd_get_mtime calls.  @var{stat_func} returns 0
-on success, or returns -1 on failure (setting @code{bfd_error}).
-
-If @code{bfd_openr_iovec} returns @code{NULL} then an error has
-occurred.  Possible errors are @code{bfd_error_no_memory},
-@code{bfd_error_invalid_target} and @code{bfd_error_system_call}.
-
-@findex bfd_openw
-@subsubsection @code{bfd_openw}
-@strong{Synopsis}
-@example
-bfd *bfd_openw (const char *filename, const char *target);
-@end example
-@strong{Description}@*
-Create a BFD, associated with file @var{filename}, using the
-file format @var{target}, and return a pointer to it.
-
-Possible errors are @code{bfd_error_system_call}, @code{bfd_error_no_memory},
-@code{bfd_error_invalid_target}.
-
-@findex bfd_close
-@subsubsection @code{bfd_close}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_close (bfd *abfd);
-@end example
-@strong{Description}@*
-Close a BFD. If the BFD was open for writing, then pending
-operations are completed and the file written out and closed.
-If the created file is executable, then @code{chmod} is called
-to mark it as such.
-
-All memory attached to the BFD is released.
-
-The file descriptor associated with the BFD is closed (even
-if it was passed in to BFD by @code{bfd_fdopenr}).
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_close_all_done
-@subsubsection @code{bfd_close_all_done}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_close_all_done (bfd *);
-@end example
-@strong{Description}@*
-Close a BFD.  Differs from @code{bfd_close} since it does not
-complete any pending operations.  This routine would be used
-if the application had just used BFD for swapping and didn't
-want to use any of the writing code.
-
-If the created file is executable, then @code{chmod} is called
-to mark it as such.
-
-All memory attached to the BFD is released.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_create
-@subsubsection @code{bfd_create}
-@strong{Synopsis}
-@example
-bfd *bfd_create (const char *filename, bfd *templ);
-@end example
-@strong{Description}@*
-Create a new BFD in the manner of @code{bfd_openw}, but without
-opening a file. The new BFD takes the target from the target
-used by @var{templ}. The format is always set to @code{bfd_object}.
-
-@findex bfd_make_writable
-@subsubsection @code{bfd_make_writable}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_make_writable (bfd *abfd);
-@end example
-@strong{Description}@*
-Takes a BFD as created by @code{bfd_create} and converts it
-into one like as returned by @code{bfd_openw}.  It does this
-by converting the BFD to BFD_IN_MEMORY.  It's assumed that
-you will call @code{bfd_make_readable} on this bfd later.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_make_readable
-@subsubsection @code{bfd_make_readable}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_make_readable (bfd *abfd);
-@end example
-@strong{Description}@*
-Takes a BFD as created by @code{bfd_create} and
-@code{bfd_make_writable} and converts it into one like as
-returned by @code{bfd_openr}.  It does this by writing the
-contents out to the memory buffer, then reversing the
-direction.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok, otherwise @code{FALSE}.
-
-@findex bfd_alloc
-@subsubsection @code{bfd_alloc}
-@strong{Synopsis}
-@example
-void *bfd_alloc (bfd *abfd, bfd_size_type wanted);
-@end example
-@strong{Description}@*
-Allocate a block of @var{wanted} bytes of memory attached to
-@code{abfd} and return a pointer to it.
-
-@findex bfd_alloc2
-@subsubsection @code{bfd_alloc2}
-@strong{Synopsis}
-@example
-void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
-@end example
-@strong{Description}@*
-Allocate a block of @var{nmemb} elements of @var{size} bytes each
-of memory attached to @code{abfd} and return a pointer to it.
-
-@findex bfd_zalloc
-@subsubsection @code{bfd_zalloc}
-@strong{Synopsis}
-@example
-void *bfd_zalloc (bfd *abfd, bfd_size_type wanted);
-@end example
-@strong{Description}@*
-Allocate a block of @var{wanted} bytes of zeroed memory
-attached to @code{abfd} and return a pointer to it.
-
-@findex bfd_zalloc2
-@subsubsection @code{bfd_zalloc2}
-@strong{Synopsis}
-@example
-void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
-@end example
-@strong{Description}@*
-Allocate a block of @var{nmemb} elements of @var{size} bytes each
-of zeroed memory attached to @code{abfd} and return a pointer to it.
-
-@findex bfd_calc_gnu_debuglink_crc32
-@subsubsection @code{bfd_calc_gnu_debuglink_crc32}
-@strong{Synopsis}
-@example
-unsigned long bfd_calc_gnu_debuglink_crc32
-   (unsigned long crc, const unsigned char *buf, bfd_size_type len);
-@end example
-@strong{Description}@*
-Computes a CRC value as used in the .gnu_debuglink section.
-Advances the previously computed @var{crc} value by computing
-and adding in the crc32 for @var{len} bytes of @var{buf}.
-
-@strong{Returns}@*
-Return the updated CRC32 value.
-
-@findex get_debug_link_info
-@subsubsection @code{get_debug_link_info}
-@strong{Synopsis}
-@example
-char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out);
-@end example
-@strong{Description}@*
-fetch the filename and CRC32 value for any separate debuginfo
-associated with @var{abfd}. Return NULL if no such info found,
-otherwise return filename and update @var{crc32_out}.
-
-@findex separate_debug_file_exists
-@subsubsection @code{separate_debug_file_exists}
-@strong{Synopsis}
-@example
-bfd_boolean separate_debug_file_exists
-   (char *name, unsigned long crc32);
-@end example
-@strong{Description}@*
-Checks to see if @var{name} is a file and if its contents
-match @var{crc32}.
-
-@findex find_separate_debug_file
-@subsubsection @code{find_separate_debug_file}
-@strong{Synopsis}
-@example
-char *find_separate_debug_file (bfd *abfd);
-@end example
-@strong{Description}@*
-Searches @var{abfd} for a reference to separate debugging
-information, scans various locations in the filesystem, including
-the file tree rooted at @var{debug_file_directory}, and returns a
-filename of such debugging information if the file is found and has
-matching CRC32.  Returns NULL if no reference to debugging file
-exists, or file cannot be found.
-
-@findex bfd_follow_gnu_debuglink
-@subsubsection @code{bfd_follow_gnu_debuglink}
-@strong{Synopsis}
-@example
-char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
-@end example
-@strong{Description}@*
-Takes a BFD and searches it for a .gnu_debuglink section.  If this
-section is found, it examines the section for the name and checksum
-of a '.debug' file containing auxiliary debugging information.  It
-then searches the filesystem for this .debug file in some standard
-locations, including the directory tree rooted at @var{dir}, and if
-found returns the full filename.
-
-If @var{dir} is NULL, it will search a default path configured into
-libbfd at build time.  [XXX this feature is not currently
-implemented].
-
-@strong{Returns}@*
-@code{NULL} on any errors or failure to locate the .debug file,
-otherwise a pointer to a heap-allocated string containing the
-filename.  The caller is responsible for freeing this string.
-
-@findex bfd_create_gnu_debuglink_section
-@subsubsection @code{bfd_create_gnu_debuglink_section}
-@strong{Synopsis}
-@example
-struct bfd_section *bfd_create_gnu_debuglink_section
-   (bfd *abfd, const char *filename);
-@end example
-@strong{Description}@*
-Takes a @var{BFD} and adds a .gnu_debuglink section to it.  The section is sized
-to be big enough to contain a link to the specified @var{filename}.
-
-@strong{Returns}@*
-A pointer to the new section is returned if all is ok.  Otherwise @code{NULL} is
-returned and bfd_error is set.
-
-@findex bfd_fill_in_gnu_debuglink_section
-@subsubsection @code{bfd_fill_in_gnu_debuglink_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_fill_in_gnu_debuglink_section
-   (bfd *abfd, struct bfd_section *sect, const char *filename);
-@end example
-@strong{Description}@*
-Takes a @var{BFD} and containing a .gnu_debuglink section @var{SECT}
-and fills in the contents of the section to contain a link to the
-specified @var{filename}.  The filename should be relative to the
-current directory.
-
-@strong{Returns}@*
-@code{TRUE} is returned if all is ok.  Otherwise @code{FALSE} is returned
-and bfd_error is set.
-
diff --git a/bfd/doc/reloc.texi b/bfd/doc/reloc.texi
deleted file mode 100644
index b1f9bb9..0000000
--- a/bfd/doc/reloc.texi
+++ /dev/null
@@ -1,3398 +0,0 @@
-@section Relocations
-BFD maintains relocations in much the same way it maintains
-symbols: they are left alone until required, then read in
-en-masse and translated into an internal form.  A common
-routine @code{bfd_perform_relocation} acts upon the
-canonical form to do the fixup.
-
-Relocations are maintained on a per section basis,
-while symbols are maintained on a per BFD basis.
-
-All that a back end has to do to fit the BFD interface is to create
-a @code{struct reloc_cache_entry} for each relocation
-in a particular section, and fill in the right bits of the structures.
-
-@menu
-* typedef arelent::
-* howto manager::
-@end menu
-
-
-@node typedef arelent, howto manager, Relocations, Relocations
-@subsection typedef arelent
-This is the structure of a relocation entry:
-
-
-@example
-
-typedef enum bfd_reloc_status
-@{
-  /* No errors detected.  */
-  bfd_reloc_ok,
-
-  /* The relocation was performed, but there was an overflow.  */
-  bfd_reloc_overflow,
-
-  /* The address to relocate was not within the section supplied.  */
-  bfd_reloc_outofrange,
-
-  /* Used by special functions.  */
-  bfd_reloc_continue,
-
-  /* Unsupported relocation size requested.  */
-  bfd_reloc_notsupported,
-
-  /* Unused.  */
-  bfd_reloc_other,
-
-  /* The symbol to relocate against was undefined.  */
-  bfd_reloc_undefined,
-
-  /* The relocation was performed, but may not be ok - presently
-     generated only when linking i960 coff files with i960 b.out
-     symbols.  If this type is returned, the error_message argument
-     to bfd_perform_relocation will be set.  */
-  bfd_reloc_dangerous
- @}
- bfd_reloc_status_type;
-
-
-typedef struct reloc_cache_entry
-@{
-  /* A pointer into the canonical table of pointers.  */
-  struct bfd_symbol **sym_ptr_ptr;
-
-  /* offset in section.  */
-  bfd_size_type address;
-
-  /* addend for relocation value.  */
-  bfd_vma addend;
-
-  /* Pointer to how to perform the required relocation.  */
-  reloc_howto_type *howto;
-
-@}
-arelent;
-
-@end example
-@strong{Description}@*
-Here is a description of each of the fields within an @code{arelent}:
-
-@itemize @bullet
-
-@item
-@code{sym_ptr_ptr}
-@end itemize
-The symbol table pointer points to a pointer to the symbol
-associated with the relocation request.  It is the pointer
-into the table returned by the back end's
-@code{canonicalize_symtab} action. @xref{Symbols}. The symbol is
-referenced through a pointer to a pointer so that tools like
-the linker can fix up all the symbols of the same name by
-modifying only one pointer. The relocation routine looks in
-the symbol and uses the base of the section the symbol is
-attached to and the value of the symbol as the initial
-relocation offset. If the symbol pointer is zero, then the
-section provided is looked up.
-
-@itemize @bullet
-
-@item
-@code{address}
-@end itemize
-The @code{address} field gives the offset in bytes from the base of
-the section data which owns the relocation record to the first
-byte of relocatable information. The actual data relocated
-will be relative to this point; for example, a relocation
-type which modifies the bottom two bytes of a four byte word
-would not touch the first byte pointed to in a big endian
-world.
-
-@itemize @bullet
-
-@item
-@code{addend}
-@end itemize
-The @code{addend} is a value provided by the back end to be added (!)
-to the relocation offset. Its interpretation is dependent upon
-the howto. For example, on the 68k the code:
-
-@example
-        char foo[];
-        main()
-                @{
-                return foo[0x12345678];
-                @}
-@end example
-
-Could be compiled into:
-
-@example
-        linkw fp,#-4
-        moveb @@#12345678,d0
-        extbl d0
-        unlk fp
-        rts
-@end example
-
-This could create a reloc pointing to @code{foo}, but leave the
-offset in the data, something like:
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset   type      value
-00000006 32        _foo
-
-00000000 4e56 fffc          ; linkw fp,#-4
-00000004 1039 1234 5678     ; moveb @@#12345678,d0
-0000000a 49c0               ; extbl d0
-0000000c 4e5e               ; unlk fp
-0000000e 4e75               ; rts
-@end example
-
-Using coff and an 88k, some instructions don't have enough
-space in them to represent the full address range, and
-pointers have to be loaded in two parts. So you'd get something like:
-
-@example
-        or.u     r13,r0,hi16(_foo+0x12345678)
-        ld.b     r2,r13,lo16(_foo+0x12345678)
-        jmp      r1
-@end example
-
-This should create two relocs, both pointing to @code{_foo}, and with
-0x12340000 in their addend field. The data would consist of:
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset   type      value
-00000002 HVRT16    _foo+0x12340000
-00000006 LVRT16    _foo+0x12340000
-
-00000000 5da05678           ; or.u r13,r0,0x5678
-00000004 1c4d5678           ; ld.b r2,r13,0x5678
-00000008 f400c001           ; jmp r1
-@end example
-
-The relocation routine digs out the value from the data, adds
-it to the addend to get the original offset, and then adds the
-value of @code{_foo}. Note that all 32 bits have to be kept around
-somewhere, to cope with carry from bit 15 to bit 16.
-
-One further example is the sparc and the a.out format. The
-sparc has a similar problem to the 88k, in that some
-instructions don't have room for an entire offset, but on the
-sparc the parts are created in odd sized lumps. The designers of
-the a.out format chose to not use the data within the section
-for storing part of the offset; all the offset is kept within
-the reloc. Anything in the data should be ignored.
-
-@example
-        save %sp,-112,%sp
-        sethi %hi(_foo+0x12345678),%g2
-        ldsb [%g2+%lo(_foo+0x12345678)],%i0
-        ret
-        restore
-@end example
-
-Both relocs contain a pointer to @code{foo}, and the offsets
-contain junk.
-
-@example
-RELOCATION RECORDS FOR [.text]:
-offset   type      value
-00000004 HI22      _foo+0x12345678
-00000008 LO10      _foo+0x12345678
-
-00000000 9de3bf90     ; save %sp,-112,%sp
-00000004 05000000     ; sethi %hi(_foo+0),%g2
-00000008 f048a000     ; ldsb [%g2+%lo(_foo+0)],%i0
-0000000c 81c7e008     ; ret
-00000010 81e80000     ; restore
-@end example
-
-@itemize @bullet
-
-@item
-@code{howto}
-@end itemize
-The @code{howto} field can be imagined as a
-relocation instruction. It is a pointer to a structure which
-contains information on what to do with all of the other
-information in the reloc record and data section. A back end
-would normally have a relocation instruction set and turn
-relocations into pointers to the correct structure on input -
-but it would be possible to create each howto field on demand.
-
-@subsubsection @code{enum complain_overflow}
-Indicates what sort of overflow checking should be done when
-performing a relocation.
-
-
-@example
-
-enum complain_overflow
-@{
-  /* Do not complain on overflow.  */
-  complain_overflow_dont,
-
-  /* Complain if the value overflows when considered as a signed
-     number one bit larger than the field.  ie. A bitfield of N bits
-     is allowed to represent -2**n to 2**n-1.  */
-  complain_overflow_bitfield,
-
-  /* Complain if the value overflows when considered as a signed
-     number.  */
-  complain_overflow_signed,
-
-  /* Complain if the value overflows when considered as an
-     unsigned number.  */
-  complain_overflow_unsigned
-@};
-@end example
-@subsubsection @code{reloc_howto_type}
-The @code{reloc_howto_type} is a structure which contains all the
-information that libbfd needs to know to tie up a back end's data.
-
-
-@example
-struct bfd_symbol;             /* Forward declaration.  */
-
-struct reloc_howto_struct
-@{
-  /*  The type field has mainly a documentary use - the back end can
-      do what it wants with it, though normally the back end's
-      external idea of what a reloc number is stored
-      in this field.  For example, a PC relative word relocation
-      in a coff environment has the type 023 - because that's
-      what the outside world calls a R_PCRWORD reloc.  */
-  unsigned int type;
-
-  /*  The value the final relocation is shifted right by.  This drops
-      unwanted data from the relocation.  */
-  unsigned int rightshift;
-
-  /*  The size of the item to be relocated.  This is *not* a
-      power-of-two measure.  To get the number of bytes operated
-      on by a type of relocation, use bfd_get_reloc_size.  */
-  int size;
-
-  /*  The number of bits in the item to be relocated.  This is used
-      when doing overflow checking.  */
-  unsigned int bitsize;
-
-  /*  The relocation is relative to the field being relocated.  */
-  bfd_boolean pc_relative;
-
-  /*  The bit position of the reloc value in the destination.
-      The relocated value is left shifted by this amount.  */
-  unsigned int bitpos;
-
-  /* What type of overflow error should be checked for when
-     relocating.  */
-  enum complain_overflow complain_on_overflow;
-
-  /* If this field is non null, then the supplied function is
-     called rather than the normal function.  This allows really
-     strange relocation methods to be accommodated (e.g., i960 callj
-     instructions).  */
-  bfd_reloc_status_type (*special_function)
-    (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
-     bfd *, char **);
-
-  /* The textual name of the relocation type.  */
-  char *name;
-
-  /* Some formats record a relocation addend in the section contents
-     rather than with the relocation.  For ELF formats this is the
-     distinction between USE_REL and USE_RELA (though the code checks
-     for USE_REL == 1/0).  The value of this field is TRUE if the
-     addend is recorded with the section contents; when performing a
-     partial link (ld -r) the section contents (the data) will be
-     modified.  The value of this field is FALSE if addends are
-     recorded with the relocation (in arelent.addend); when performing
-     a partial link the relocation will be modified.
-     All relocations for all ELF USE_RELA targets should set this field
-     to FALSE (values of TRUE should be looked on with suspicion).
-     However, the converse is not true: not all relocations of all ELF
-     USE_REL targets set this field to TRUE.  Why this is so is peculiar
-     to each particular target.  For relocs that aren't used in partial
-     links (e.g. GOT stuff) it doesn't matter what this is set to.  */
-  bfd_boolean partial_inplace;
-
-  /* src_mask selects the part of the instruction (or data) to be used
-     in the relocation sum.  If the target relocations don't have an
-     addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
-     dst_mask to extract the addend from the section contents.  If
-     relocations do have an addend in the reloc, eg. ELF USE_RELA, this
-     field should be zero.  Non-zero values for ELF USE_RELA targets are
-     bogus as in those cases the value in the dst_mask part of the
-     section contents should be treated as garbage.  */
-  bfd_vma src_mask;
-
-  /* dst_mask selects which parts of the instruction (or data) are
-     replaced with a relocated value.  */
-  bfd_vma dst_mask;
-
-  /* When some formats create PC relative instructions, they leave
-     the value of the pc of the place being relocated in the offset
-     slot of the instruction, so that a PC relative relocation can
-     be made just by adding in an ordinary offset (e.g., sun3 a.out).
-     Some formats leave the displacement part of an instruction
-     empty (e.g., m88k bcs); this flag signals the fact.  */
-  bfd_boolean pcrel_offset;
-@};
-
-@end example
-@findex The HOWTO Macro
-@subsubsection @code{The HOWTO Macro}
-@strong{Description}@*
-The HOWTO define is horrible and will go away.
-@example
-#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
-  @{ (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC @}
-@end example
-
-@strong{Description}@*
-And will be replaced with the totally magic way. But for the
-moment, we are compatible, so do it this way.
-@example
-#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
-  HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
-         NAME, FALSE, 0, 0, IN)
-
-@end example
-
-@strong{Description}@*
-This is used to fill in an empty howto entry in an array.
-@example
-#define EMPTY_HOWTO(C) \
-  HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
-         NULL, FALSE, 0, 0, FALSE)
-
-@end example
-
-@strong{Description}@*
-Helper routine to turn a symbol into a relocation value.
-@example
-#define HOWTO_PREPARE(relocation, symbol)               \
-  @{                                                     \
-    if (symbol != NULL)                                 \
-      @{                                                 \
-        if (bfd_is_com_section (symbol->section))       \
-          @{                                             \
-            relocation = 0;                             \
-          @}                                             \
-        else                                            \
-          @{                                             \
-            relocation = symbol->value;                 \
-          @}                                             \
-      @}                                                 \
-  @}
-
-@end example
-
-@findex bfd_get_reloc_size
-@subsubsection @code{bfd_get_reloc_size}
-@strong{Synopsis}
-@example
-unsigned int bfd_get_reloc_size (reloc_howto_type *);
-@end example
-@strong{Description}@*
-For a reloc_howto_type that operates on a fixed number of bytes,
-this returns the number of bytes operated on.
-
-@findex arelent_chain
-@subsubsection @code{arelent_chain}
-@strong{Description}@*
-How relocs are tied together in an @code{asection}:
-@example
-typedef struct relent_chain
-@{
-  arelent relent;
-  struct relent_chain *next;
-@}
-arelent_chain;
-
-@end example
-
-@findex bfd_check_overflow
-@subsubsection @code{bfd_check_overflow}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_check_overflow
-   (enum complain_overflow how,
-    unsigned int bitsize,
-    unsigned int rightshift,
-    unsigned int addrsize,
-    bfd_vma relocation);
-@end example
-@strong{Description}@*
-Perform overflow checking on @var{relocation} which has
-@var{bitsize} significant bits and will be shifted right by
-@var{rightshift} bits, on a machine with addresses containing
-@var{addrsize} significant bits.  The result is either of
-@code{bfd_reloc_ok} or @code{bfd_reloc_overflow}.
-
-@findex bfd_perform_relocation
-@subsubsection @code{bfd_perform_relocation}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_perform_relocation
-   (bfd *abfd,
-    arelent *reloc_entry,
-    void *data,
-    asection *input_section,
-    bfd *output_bfd,
-    char **error_message);
-@end example
-@strong{Description}@*
-If @var{output_bfd} is supplied to this function, the
-generated image will be relocatable; the relocations are
-copied to the output file after they have been changed to
-reflect the new state of the world. There are two ways of
-reflecting the results of partial linkage in an output file:
-by modifying the output data in place, and by modifying the
-relocation record.  Some native formats (e.g., basic a.out and
-basic coff) have no way of specifying an addend in the
-relocation type, so the addend has to go in the output data.
-This is no big deal since in these formats the output data
-slot will always be big enough for the addend. Complex reloc
-types with addends were invented to solve just this problem.
-The @var{error_message} argument is set to an error message if
-this return @code{bfd_reloc_dangerous}.
-
-@findex bfd_install_relocation
-@subsubsection @code{bfd_install_relocation}
-@strong{Synopsis}
-@example
-bfd_reloc_status_type bfd_install_relocation
-   (bfd *abfd,
-    arelent *reloc_entry,
-    void *data, bfd_vma data_start,
-    asection *input_section,
-    char **error_message);
-@end example
-@strong{Description}@*
-This looks remarkably like @code{bfd_perform_relocation}, except it
-does not expect that the section contents have been filled in.
-I.e., it's suitable for use when creating, rather than applying
-a relocation.
-
-For now, this function should be considered reserved for the
-assembler.
-
-
-@node howto manager,  , typedef arelent, Relocations
-@subsection The howto manager
-When an application wants to create a relocation, but doesn't
-know what the target machine might call it, it can find out by
-using this bit of code.
-
-@findex bfd_reloc_code_type
-@subsubsection @code{bfd_reloc_code_type}
-@strong{Description}@*
-The insides of a reloc code.  The idea is that, eventually, there
-will be one enumerator for every type of relocation we ever do.
-Pass one of these values to @code{bfd_reloc_type_lookup}, and it'll
-return a howto pointer.
-
-This does mean that the application must determine the correct
-enumerator value; you can't get a howto pointer from a random set
-of attributes.
-
-Here are the possible values for @code{enum bfd_reloc_code_real}:
-
-@deffn {} BFD_RELOC_64
-@deffnx {} BFD_RELOC_32
-@deffnx {} BFD_RELOC_26
-@deffnx {} BFD_RELOC_24
-@deffnx {} BFD_RELOC_16
-@deffnx {} BFD_RELOC_14
-@deffnx {} BFD_RELOC_8
-Basic absolute relocations of N bits.
-@end deffn
-@deffn {} BFD_RELOC_64_PCREL
-@deffnx {} BFD_RELOC_32_PCREL
-@deffnx {} BFD_RELOC_24_PCREL
-@deffnx {} BFD_RELOC_16_PCREL
-@deffnx {} BFD_RELOC_12_PCREL
-@deffnx {} BFD_RELOC_8_PCREL
-PC-relative relocations.  Sometimes these are relative to the address
-of the relocation itself; sometimes they are relative to the start of
-the section containing the relocation.  It depends on the specific target.
-
-The 24-bit relocation is used in some Intel 960 configurations.
-@end deffn
-@deffn {} BFD_RELOC_32_SECREL
-Section relative relocations.  Some targets need this for DWARF2.
-@end deffn
-@deffn {} BFD_RELOC_32_GOT_PCREL
-@deffnx {} BFD_RELOC_16_GOT_PCREL
-@deffnx {} BFD_RELOC_8_GOT_PCREL
-@deffnx {} BFD_RELOC_32_GOTOFF
-@deffnx {} BFD_RELOC_16_GOTOFF
-@deffnx {} BFD_RELOC_LO16_GOTOFF
-@deffnx {} BFD_RELOC_HI16_GOTOFF
-@deffnx {} BFD_RELOC_HI16_S_GOTOFF
-@deffnx {} BFD_RELOC_8_GOTOFF
-@deffnx {} BFD_RELOC_64_PLT_PCREL
-@deffnx {} BFD_RELOC_32_PLT_PCREL
-@deffnx {} BFD_RELOC_24_PLT_PCREL
-@deffnx {} BFD_RELOC_16_PLT_PCREL
-@deffnx {} BFD_RELOC_8_PLT_PCREL
-@deffnx {} BFD_RELOC_64_PLTOFF
-@deffnx {} BFD_RELOC_32_PLTOFF
-@deffnx {} BFD_RELOC_16_PLTOFF
-@deffnx {} BFD_RELOC_LO16_PLTOFF
-@deffnx {} BFD_RELOC_HI16_PLTOFF
-@deffnx {} BFD_RELOC_HI16_S_PLTOFF
-@deffnx {} BFD_RELOC_8_PLTOFF
-For ELF.
-@end deffn
-@deffn {} BFD_RELOC_68K_GLOB_DAT
-@deffnx {} BFD_RELOC_68K_JMP_SLOT
-@deffnx {} BFD_RELOC_68K_RELATIVE
-@deffnx {} BFD_RELOC_68K_TLS_GD32
-@deffnx {} BFD_RELOC_68K_TLS_GD16
-@deffnx {} BFD_RELOC_68K_TLS_GD8
-@deffnx {} BFD_RELOC_68K_TLS_LDM32
-@deffnx {} BFD_RELOC_68K_TLS_LDM16
-@deffnx {} BFD_RELOC_68K_TLS_LDM8
-@deffnx {} BFD_RELOC_68K_TLS_LDO32
-@deffnx {} BFD_RELOC_68K_TLS_LDO16
-@deffnx {} BFD_RELOC_68K_TLS_LDO8
-@deffnx {} BFD_RELOC_68K_TLS_IE32
-@deffnx {} BFD_RELOC_68K_TLS_IE16
-@deffnx {} BFD_RELOC_68K_TLS_IE8
-@deffnx {} BFD_RELOC_68K_TLS_LE32
-@deffnx {} BFD_RELOC_68K_TLS_LE16
-@deffnx {} BFD_RELOC_68K_TLS_LE8
-Relocations used by 68K ELF.
-@end deffn
-@deffn {} BFD_RELOC_32_BASEREL
-@deffnx {} BFD_RELOC_16_BASEREL
-@deffnx {} BFD_RELOC_LO16_BASEREL
-@deffnx {} BFD_RELOC_HI16_BASEREL
-@deffnx {} BFD_RELOC_HI16_S_BASEREL
-@deffnx {} BFD_RELOC_8_BASEREL
-@deffnx {} BFD_RELOC_RVA
-Linkage-table relative.
-@end deffn
-@deffn {} BFD_RELOC_8_FFnn
-Absolute 8-bit relocation, but used to form an address like 0xFFnn.
-@end deffn
-@deffn {} BFD_RELOC_32_PCREL_S2
-@deffnx {} BFD_RELOC_16_PCREL_S2
-@deffnx {} BFD_RELOC_23_PCREL_S2
-These PC-relative relocations are stored as word displacements --
-i.e., byte displacements shifted right two bits.  The 30-bit word
-displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
-SPARC.  (SPARC tools generally refer to this as <<WDISP30>>.)  The
-signed 16-bit displacement is used on the MIPS, and the 23-bit
-displacement is used on the Alpha.
-@end deffn
-@deffn {} BFD_RELOC_HI22
-@deffnx {} BFD_RELOC_LO10
-High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
-the target word.  These are used on the SPARC.
-@end deffn
-@deffn {} BFD_RELOC_GPREL16
-@deffnx {} BFD_RELOC_GPREL32
-For systems that allocate a Global Pointer register, these are
-displacements off that register.  These relocation types are
-handled specially, because the value the register will have is
-decided relatively late.
-@end deffn
-@deffn {} BFD_RELOC_I960_CALLJ
-Reloc types used for i960/b.out.
-@end deffn
-@deffn {} BFD_RELOC_NONE
-@deffnx {} BFD_RELOC_SPARC_WDISP22
-@deffnx {} BFD_RELOC_SPARC22
-@deffnx {} BFD_RELOC_SPARC13
-@deffnx {} BFD_RELOC_SPARC_GOT10
-@deffnx {} BFD_RELOC_SPARC_GOT13
-@deffnx {} BFD_RELOC_SPARC_GOT22
-@deffnx {} BFD_RELOC_SPARC_PC10
-@deffnx {} BFD_RELOC_SPARC_PC22
-@deffnx {} BFD_RELOC_SPARC_WPLT30
-@deffnx {} BFD_RELOC_SPARC_COPY
-@deffnx {} BFD_RELOC_SPARC_GLOB_DAT
-@deffnx {} BFD_RELOC_SPARC_JMP_SLOT
-@deffnx {} BFD_RELOC_SPARC_RELATIVE
-@deffnx {} BFD_RELOC_SPARC_UA16
-@deffnx {} BFD_RELOC_SPARC_UA32
-@deffnx {} BFD_RELOC_SPARC_UA64
-@deffnx {} BFD_RELOC_SPARC_GOTDATA_HIX22
-@deffnx {} BFD_RELOC_SPARC_GOTDATA_LOX10
-@deffnx {} BFD_RELOC_SPARC_GOTDATA_OP_HIX22
-@deffnx {} BFD_RELOC_SPARC_GOTDATA_OP_LOX10
-@deffnx {} BFD_RELOC_SPARC_GOTDATA_OP
-@deffnx {} BFD_RELOC_SPARC_JMP_IREL
-@deffnx {} BFD_RELOC_SPARC_IRELATIVE
-SPARC ELF relocations.  There is probably some overlap with other
-relocation types already defined.
-@end deffn
-@deffn {} BFD_RELOC_SPARC_BASE13
-@deffnx {} BFD_RELOC_SPARC_BASE22
-I think these are specific to SPARC a.out (e.g., Sun 4).
-@end deffn
-@deffn {} BFD_RELOC_SPARC_64
-@deffnx {} BFD_RELOC_SPARC_10
-@deffnx {} BFD_RELOC_SPARC_11
-@deffnx {} BFD_RELOC_SPARC_OLO10
-@deffnx {} BFD_RELOC_SPARC_HH22
-@deffnx {} BFD_RELOC_SPARC_HM10
-@deffnx {} BFD_RELOC_SPARC_LM22
-@deffnx {} BFD_RELOC_SPARC_PC_HH22
-@deffnx {} BFD_RELOC_SPARC_PC_HM10
-@deffnx {} BFD_RELOC_SPARC_PC_LM22
-@deffnx {} BFD_RELOC_SPARC_WDISP16
-@deffnx {} BFD_RELOC_SPARC_WDISP19
-@deffnx {} BFD_RELOC_SPARC_7
-@deffnx {} BFD_RELOC_SPARC_6
-@deffnx {} BFD_RELOC_SPARC_5
-@deffnx {} BFD_RELOC_SPARC_DISP64
-@deffnx {} BFD_RELOC_SPARC_PLT32
-@deffnx {} BFD_RELOC_SPARC_PLT64
-@deffnx {} BFD_RELOC_SPARC_HIX22
-@deffnx {} BFD_RELOC_SPARC_LOX10
-@deffnx {} BFD_RELOC_SPARC_H44
-@deffnx {} BFD_RELOC_SPARC_M44
-@deffnx {} BFD_RELOC_SPARC_L44
-@deffnx {} BFD_RELOC_SPARC_REGISTER
-@deffnx {} BFD_RELOC_SPARC_H34
-@deffnx {} BFD_RELOC_SPARC_SIZE32
-@deffnx {} BFD_RELOC_SPARC_SIZE64
-@deffnx {} BFD_RELOC_SPARC_WDISP10
-SPARC64 relocations
-@end deffn
-@deffn {} BFD_RELOC_SPARC_REV32
-SPARC little endian relocation
-@end deffn
-@deffn {} BFD_RELOC_SPARC_TLS_GD_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_GD_CALL
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_LDM_CALL
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_HIX22
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_LOX10
-@deffnx {} BFD_RELOC_SPARC_TLS_LDO_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_HI22
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LO10
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LD
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_LDX
-@deffnx {} BFD_RELOC_SPARC_TLS_IE_ADD
-@deffnx {} BFD_RELOC_SPARC_TLS_LE_HIX22
-@deffnx {} BFD_RELOC_SPARC_TLS_LE_LOX10
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD64
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF64
-@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF32
-@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF64
-SPARC TLS relocations
-@end deffn
-@deffn {} BFD_RELOC_SPU_IMM7
-@deffnx {} BFD_RELOC_SPU_IMM8
-@deffnx {} BFD_RELOC_SPU_IMM10
-@deffnx {} BFD_RELOC_SPU_IMM10W
-@deffnx {} BFD_RELOC_SPU_IMM16
-@deffnx {} BFD_RELOC_SPU_IMM16W
-@deffnx {} BFD_RELOC_SPU_IMM18
-@deffnx {} BFD_RELOC_SPU_PCREL9a
-@deffnx {} BFD_RELOC_SPU_PCREL9b
-@deffnx {} BFD_RELOC_SPU_PCREL16
-@deffnx {} BFD_RELOC_SPU_LO16
-@deffnx {} BFD_RELOC_SPU_HI16
-@deffnx {} BFD_RELOC_SPU_PPU32
-@deffnx {} BFD_RELOC_SPU_PPU64
-@deffnx {} BFD_RELOC_SPU_ADD_PIC
-SPU Relocations.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP_HI16
-Alpha ECOFF and ELF relocations.  Some of these treat the symbol or
-"addend" in some special way.
-For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
-writing; when reading, it will be the absolute section symbol.  The
-addend is the displacement in bytes of the "lda" instruction from
-the "ldah" instruction (which is at the address of this reloc).
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP_LO16
-For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
-with GPDISP_HI16 relocs.  The addend is ignored when writing the
-relocations out, and is filled in with the file's GP value on
-reading, for convenience.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPDISP
-The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
-relocation except that there is no accompanying GPDISP_LO16
-relocation.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_LITERAL
-@deffnx {} BFD_RELOC_ALPHA_ELF_LITERAL
-@deffnx {} BFD_RELOC_ALPHA_LITUSE
-The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
-the assembler turns it into a LDQ instruction to load the address of
-the symbol, and then fills in a register in the real instruction.
-
-The LITERAL reloc, at the LDQ instruction, refers to the .lita
-section symbol.  The addend is ignored when writing, but is filled
-in with the file's GP value on reading, for convenience, as with the
-GPDISP_LO16 reloc.
-
-The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
-It should refer to the symbol to be referenced, as with 16_GOTOFF,
-but it generates output not based on the position within the .got
-section, but relative to the GP value chosen for the file during the
-final link stage.
-
-The LITUSE reloc, on the instruction using the loaded address, gives
-information to the linker that it might be able to use to optimize
-away some literal section references.  The symbol is ignored (read
-as the absolute section symbol), and the "addend" indicates the type
-of instruction using the register:
-1 - "memory" fmt insn
-2 - byte-manipulation (byte offset reg)
-3 - jsr (target of branch)
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_HINT
-The HINT relocation indicates a value that should be filled into the
-"hint" field of a jmp/jsr/ret instruction, for possible branch-
-prediction logic which may be provided on some processors.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_LINKAGE
-The LINKAGE relocation outputs a linkage pair in the object file,
-which is filled by the linker.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_CODEADDR
-The CODEADDR relocation outputs a STO_CA in the object file,
-which is filled by the linker.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_GPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_GPREL_LO16
-The GPREL_HI/LO relocations together form a 32-bit offset from the
-GP register.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_BRSGP
-Like BFD_RELOC_23_PCREL_S2, except that the source and target must
-share a common GP, and the target address is adjusted for
-STO_ALPHA_STD_GPLOAD.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_NOP
-The NOP relocation outputs a NOP if the longword displacement
-between two procedure entry points is < 2^21.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_BSR
-The BSR relocation outputs a BSR if the longword displacement
-between two procedure entry points is < 2^21.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_LDA
-The LDA relocation outputs a LDA if the longword displacement
-between two procedure entry points is < 2^16.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_BOH
-The BOH relocation outputs a BSR if the longword displacement
-between two procedure entry points is < 2^21, or else a hint.
-@end deffn
-@deffn {} BFD_RELOC_ALPHA_TLSGD
-@deffnx {} BFD_RELOC_ALPHA_TLSLDM
-@deffnx {} BFD_RELOC_ALPHA_DTPMOD64
-@deffnx {} BFD_RELOC_ALPHA_GOTDTPREL16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL64
-@deffnx {} BFD_RELOC_ALPHA_DTPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL_LO16
-@deffnx {} BFD_RELOC_ALPHA_DTPREL16
-@deffnx {} BFD_RELOC_ALPHA_GOTTPREL16
-@deffnx {} BFD_RELOC_ALPHA_TPREL64
-@deffnx {} BFD_RELOC_ALPHA_TPREL_HI16
-@deffnx {} BFD_RELOC_ALPHA_TPREL_LO16
-@deffnx {} BFD_RELOC_ALPHA_TPREL16
-Alpha thread-local storage relocations.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_JMP
-@deffnx {} BFD_RELOC_MICROMIPS_JMP
-The MIPS jump instruction.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_JMP
-The MIPS16 jump instruction.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_GPREL
-MIPS16 GP relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_HI16
-High 16 bits of 32-bit value; simple reloc.
-@end deffn
-@deffn {} BFD_RELOC_HI16_S
-High 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result.  If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added.
-@end deffn
-@deffn {} BFD_RELOC_LO16
-Low 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_HI16_PCREL
-High 16 bits of 32-bit pc-relative value
-@end deffn
-@deffn {} BFD_RELOC_HI16_S_PCREL
-High 16 bits of 32-bit pc-relative value, adjusted
-@end deffn
-@deffn {} BFD_RELOC_LO16_PCREL
-Low 16 bits of pc-relative value
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_GOT16
-@deffnx {} BFD_RELOC_MIPS16_CALL16
-Equivalent of BFD_RELOC_MIPS_*, but with the MIPS16 layout of
-16-bit immediate fields
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_HI16
-MIPS16 high 16 bits of 32-bit value.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_HI16_S
-MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign
-extended and added to form the final result.  If the low 16
-bits form a negative number, we need to add one to the high value
-to compensate for the borrow when the low bits are added.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_LO16
-MIPS16 low 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_MIPS16_TLS_GD
-@deffnx {} BFD_RELOC_MIPS16_TLS_LDM
-@deffnx {} BFD_RELOC_MIPS16_TLS_DTPREL_HI16
-@deffnx {} BFD_RELOC_MIPS16_TLS_DTPREL_LO16
-@deffnx {} BFD_RELOC_MIPS16_TLS_GOTTPREL
-@deffnx {} BFD_RELOC_MIPS16_TLS_TPREL_HI16
-@deffnx {} BFD_RELOC_MIPS16_TLS_TPREL_LO16
-MIPS16 TLS relocations
-@end deffn
-@deffn {} BFD_RELOC_MIPS_LITERAL
-@deffnx {} BFD_RELOC_MICROMIPS_LITERAL
-Relocation against a MIPS literal section.
-@end deffn
-@deffn {} BFD_RELOC_MICROMIPS_7_PCREL_S1
-@deffnx {} BFD_RELOC_MICROMIPS_10_PCREL_S1
-@deffnx {} BFD_RELOC_MICROMIPS_16_PCREL_S1
-microMIPS PC-relative relocations.
-@end deffn
-@deffn {} BFD_RELOC_MICROMIPS_GPREL16
-@deffnx {} BFD_RELOC_MICROMIPS_HI16
-@deffnx {} BFD_RELOC_MICROMIPS_HI16_S
-@deffnx {} BFD_RELOC_MICROMIPS_LO16
-microMIPS versions of generic BFD relocs.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_GOT16
-@deffnx {} BFD_RELOC_MICROMIPS_GOT16
-@deffnx {} BFD_RELOC_MIPS_CALL16
-@deffnx {} BFD_RELOC_MICROMIPS_CALL16
-@deffnx {} BFD_RELOC_MIPS_GOT_HI16
-@deffnx {} BFD_RELOC_MICROMIPS_GOT_HI16
-@deffnx {} BFD_RELOC_MIPS_GOT_LO16
-@deffnx {} BFD_RELOC_MICROMIPS_GOT_LO16
-@deffnx {} BFD_RELOC_MIPS_CALL_HI16
-@deffnx {} BFD_RELOC_MICROMIPS_CALL_HI16
-@deffnx {} BFD_RELOC_MIPS_CALL_LO16
-@deffnx {} BFD_RELOC_MICROMIPS_CALL_LO16
-@deffnx {} BFD_RELOC_MIPS_SUB
-@deffnx {} BFD_RELOC_MICROMIPS_SUB
-@deffnx {} BFD_RELOC_MIPS_GOT_PAGE
-@deffnx {} BFD_RELOC_MICROMIPS_GOT_PAGE
-@deffnx {} BFD_RELOC_MIPS_GOT_OFST
-@deffnx {} BFD_RELOC_MICROMIPS_GOT_OFST
-@deffnx {} BFD_RELOC_MIPS_GOT_DISP
-@deffnx {} BFD_RELOC_MICROMIPS_GOT_DISP
-@deffnx {} BFD_RELOC_MIPS_SHIFT5
-@deffnx {} BFD_RELOC_MIPS_SHIFT6
-@deffnx {} BFD_RELOC_MIPS_INSERT_A
-@deffnx {} BFD_RELOC_MIPS_INSERT_B
-@deffnx {} BFD_RELOC_MIPS_DELETE
-@deffnx {} BFD_RELOC_MIPS_HIGHEST
-@deffnx {} BFD_RELOC_MICROMIPS_HIGHEST
-@deffnx {} BFD_RELOC_MIPS_HIGHER
-@deffnx {} BFD_RELOC_MICROMIPS_HIGHER
-@deffnx {} BFD_RELOC_MIPS_SCN_DISP
-@deffnx {} BFD_RELOC_MICROMIPS_SCN_DISP
-@deffnx {} BFD_RELOC_MIPS_REL16
-@deffnx {} BFD_RELOC_MIPS_RELGOT
-@deffnx {} BFD_RELOC_MIPS_JALR
-@deffnx {} BFD_RELOC_MICROMIPS_JALR
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL32
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD64
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL64
-@deffnx {} BFD_RELOC_MIPS_TLS_GD
-@deffnx {} BFD_RELOC_MICROMIPS_TLS_GD
-@deffnx {} BFD_RELOC_MIPS_TLS_LDM
-@deffnx {} BFD_RELOC_MICROMIPS_TLS_LDM
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_HI16
-@deffnx {} BFD_RELOC_MICROMIPS_TLS_DTPREL_HI16
-@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_LO16
-@deffnx {} BFD_RELOC_MICROMIPS_TLS_DTPREL_LO16
-@deffnx {} BFD_RELOC_MIPS_TLS_GOTTPREL
-@deffnx {} BFD_RELOC_MICROMIPS_TLS_GOTTPREL
-@deffnx {} BFD_RELOC_MIPS_TLS_TPREL32
-@deffnx {} BFD_RELOC_MIPS_TLS_TPREL64
-@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_HI16
-@deffnx {} BFD_RELOC_MICROMIPS_TLS_TPREL_HI16
-@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_LO16
-@deffnx {} BFD_RELOC_MICROMIPS_TLS_TPREL_LO16
-MIPS ELF relocations.
-@end deffn
-@deffn {} BFD_RELOC_MIPS_COPY
-@deffnx {} BFD_RELOC_MIPS_JUMP_SLOT
-MIPS ELF relocations (VxWorks and PLT extensions).
-@end deffn
-@deffn {} BFD_RELOC_MOXIE_10_PCREL
-Moxie ELF relocations.
-@end deffn
-@deffn {} BFD_RELOC_FRV_LABEL16
-@deffnx {} BFD_RELOC_FRV_LABEL24
-@deffnx {} BFD_RELOC_FRV_LO16
-@deffnx {} BFD_RELOC_FRV_HI16
-@deffnx {} BFD_RELOC_FRV_GPREL12
-@deffnx {} BFD_RELOC_FRV_GPRELU12
-@deffnx {} BFD_RELOC_FRV_GPREL32
-@deffnx {} BFD_RELOC_FRV_GPRELHI
-@deffnx {} BFD_RELOC_FRV_GPRELLO
-@deffnx {} BFD_RELOC_FRV_GOT12
-@deffnx {} BFD_RELOC_FRV_GOTHI
-@deffnx {} BFD_RELOC_FRV_GOTLO
-@deffnx {} BFD_RELOC_FRV_FUNCDESC
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOT12
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTHI
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTLO
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_VALUE
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFF12
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFHI
-@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFLO
-@deffnx {} BFD_RELOC_FRV_GOTOFF12
-@deffnx {} BFD_RELOC_FRV_GOTOFFHI
-@deffnx {} BFD_RELOC_FRV_GOTOFFLO
-@deffnx {} BFD_RELOC_FRV_GETTLSOFF
-@deffnx {} BFD_RELOC_FRV_TLSDESC_VALUE
-@deffnx {} BFD_RELOC_FRV_GOTTLSDESC12
-@deffnx {} BFD_RELOC_FRV_GOTTLSDESCHI
-@deffnx {} BFD_RELOC_FRV_GOTTLSDESCLO
-@deffnx {} BFD_RELOC_FRV_TLSMOFF12
-@deffnx {} BFD_RELOC_FRV_TLSMOFFHI
-@deffnx {} BFD_RELOC_FRV_TLSMOFFLO
-@deffnx {} BFD_RELOC_FRV_GOTTLSOFF12
-@deffnx {} BFD_RELOC_FRV_GOTTLSOFFHI
-@deffnx {} BFD_RELOC_FRV_GOTTLSOFFLO
-@deffnx {} BFD_RELOC_FRV_TLSOFF
-@deffnx {} BFD_RELOC_FRV_TLSDESC_RELAX
-@deffnx {} BFD_RELOC_FRV_GETTLSOFF_RELAX
-@deffnx {} BFD_RELOC_FRV_TLSOFF_RELAX
-@deffnx {} BFD_RELOC_FRV_TLSMOFF
-Fujitsu Frv Relocations.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOTOFF24
-This is a 24bit GOT-relative reloc for the mn10300.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT32
-This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT24
-This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GOT16
-This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
-in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_COPY
-Copy symbol at runtime.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_GLOB_DAT
-Create GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_JMP_SLOT
-Create PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_RELATIVE
-Adjust by program base.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_SYM_DIFF
-Together with another reloc targeted at the same location,
-allows for a value that is the difference of two symbols
-in the same section.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_ALIGN
-The addend of this reloc is an alignment power that must
-be honoured at the offset's location, regardless of linker
-relaxation.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_TLS_GD
-@deffnx {} BFD_RELOC_MN10300_TLS_LD
-@deffnx {} BFD_RELOC_MN10300_TLS_LDO
-@deffnx {} BFD_RELOC_MN10300_TLS_GOTIE
-@deffnx {} BFD_RELOC_MN10300_TLS_IE
-@deffnx {} BFD_RELOC_MN10300_TLS_LE
-@deffnx {} BFD_RELOC_MN10300_TLS_DTPMOD
-@deffnx {} BFD_RELOC_MN10300_TLS_DTPOFF
-@deffnx {} BFD_RELOC_MN10300_TLS_TPOFF
-Various TLS-related relocations.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_32_PCREL
-This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.
-@end deffn
-@deffn {} BFD_RELOC_MN10300_16_PCREL
-This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
-instruction.
-@end deffn
-@deffn {} BFD_RELOC_386_GOT32
-@deffnx {} BFD_RELOC_386_PLT32
-@deffnx {} BFD_RELOC_386_COPY
-@deffnx {} BFD_RELOC_386_GLOB_DAT
-@deffnx {} BFD_RELOC_386_JUMP_SLOT
-@deffnx {} BFD_RELOC_386_RELATIVE
-@deffnx {} BFD_RELOC_386_GOTOFF
-@deffnx {} BFD_RELOC_386_GOTPC
-@deffnx {} BFD_RELOC_386_TLS_TPOFF
-@deffnx {} BFD_RELOC_386_TLS_IE
-@deffnx {} BFD_RELOC_386_TLS_GOTIE
-@deffnx {} BFD_RELOC_386_TLS_LE
-@deffnx {} BFD_RELOC_386_TLS_GD
-@deffnx {} BFD_RELOC_386_TLS_LDM
-@deffnx {} BFD_RELOC_386_TLS_LDO_32
-@deffnx {} BFD_RELOC_386_TLS_IE_32
-@deffnx {} BFD_RELOC_386_TLS_LE_32
-@deffnx {} BFD_RELOC_386_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_386_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_386_TLS_TPOFF32
-@deffnx {} BFD_RELOC_386_TLS_GOTDESC
-@deffnx {} BFD_RELOC_386_TLS_DESC_CALL
-@deffnx {} BFD_RELOC_386_TLS_DESC
-@deffnx {} BFD_RELOC_386_IRELATIVE
-i386/elf relocations
-@end deffn
-@deffn {} BFD_RELOC_X86_64_GOT32
-@deffnx {} BFD_RELOC_X86_64_PLT32
-@deffnx {} BFD_RELOC_X86_64_COPY
-@deffnx {} BFD_RELOC_X86_64_GLOB_DAT
-@deffnx {} BFD_RELOC_X86_64_JUMP_SLOT
-@deffnx {} BFD_RELOC_X86_64_RELATIVE
-@deffnx {} BFD_RELOC_X86_64_GOTPCREL
-@deffnx {} BFD_RELOC_X86_64_32S
-@deffnx {} BFD_RELOC_X86_64_DTPMOD64
-@deffnx {} BFD_RELOC_X86_64_DTPOFF64
-@deffnx {} BFD_RELOC_X86_64_TPOFF64
-@deffnx {} BFD_RELOC_X86_64_TLSGD
-@deffnx {} BFD_RELOC_X86_64_TLSLD
-@deffnx {} BFD_RELOC_X86_64_DTPOFF32
-@deffnx {} BFD_RELOC_X86_64_GOTTPOFF
-@deffnx {} BFD_RELOC_X86_64_TPOFF32
-@deffnx {} BFD_RELOC_X86_64_GOTOFF64
-@deffnx {} BFD_RELOC_X86_64_GOTPC32
-@deffnx {} BFD_RELOC_X86_64_GOT64
-@deffnx {} BFD_RELOC_X86_64_GOTPCREL64
-@deffnx {} BFD_RELOC_X86_64_GOTPC64
-@deffnx {} BFD_RELOC_X86_64_GOTPLT64
-@deffnx {} BFD_RELOC_X86_64_PLTOFF64
-@deffnx {} BFD_RELOC_X86_64_GOTPC32_TLSDESC
-@deffnx {} BFD_RELOC_X86_64_TLSDESC_CALL
-@deffnx {} BFD_RELOC_X86_64_TLSDESC
-@deffnx {} BFD_RELOC_X86_64_IRELATIVE
-x86-64/elf relocations
-@end deffn
-@deffn {} BFD_RELOC_NS32K_IMM_8
-@deffnx {} BFD_RELOC_NS32K_IMM_16
-@deffnx {} BFD_RELOC_NS32K_IMM_32
-@deffnx {} BFD_RELOC_NS32K_IMM_8_PCREL
-@deffnx {} BFD_RELOC_NS32K_IMM_16_PCREL
-@deffnx {} BFD_RELOC_NS32K_IMM_32_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_8
-@deffnx {} BFD_RELOC_NS32K_DISP_16
-@deffnx {} BFD_RELOC_NS32K_DISP_32
-@deffnx {} BFD_RELOC_NS32K_DISP_8_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_16_PCREL
-@deffnx {} BFD_RELOC_NS32K_DISP_32_PCREL
-ns32k relocations
-@end deffn
-@deffn {} BFD_RELOC_PDP11_DISP_8_PCREL
-@deffnx {} BFD_RELOC_PDP11_DISP_6_PCREL
-PDP11 relocations
-@end deffn
-@deffn {} BFD_RELOC_PJ_CODE_HI16
-@deffnx {} BFD_RELOC_PJ_CODE_LO16
-@deffnx {} BFD_RELOC_PJ_CODE_DIR16
-@deffnx {} BFD_RELOC_PJ_CODE_DIR32
-@deffnx {} BFD_RELOC_PJ_CODE_REL16
-@deffnx {} BFD_RELOC_PJ_CODE_REL32
-Picojava relocs.  Not all of these appear in object files.
-@end deffn
-@deffn {} BFD_RELOC_PPC_B26
-@deffnx {} BFD_RELOC_PPC_BA26
-@deffnx {} BFD_RELOC_PPC_TOC16
-@deffnx {} BFD_RELOC_PPC_B16
-@deffnx {} BFD_RELOC_PPC_B16_BRTAKEN
-@deffnx {} BFD_RELOC_PPC_B16_BRNTAKEN
-@deffnx {} BFD_RELOC_PPC_BA16
-@deffnx {} BFD_RELOC_PPC_BA16_BRTAKEN
-@deffnx {} BFD_RELOC_PPC_BA16_BRNTAKEN
-@deffnx {} BFD_RELOC_PPC_COPY
-@deffnx {} BFD_RELOC_PPC_GLOB_DAT
-@deffnx {} BFD_RELOC_PPC_JMP_SLOT
-@deffnx {} BFD_RELOC_PPC_RELATIVE
-@deffnx {} BFD_RELOC_PPC_LOCAL24PC
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR32
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_LO
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HI
-@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HA
-@deffnx {} BFD_RELOC_PPC_EMB_SDAI16
-@deffnx {} BFD_RELOC_PPC_EMB_SDA2I16
-@deffnx {} BFD_RELOC_PPC_EMB_SDA2REL
-@deffnx {} BFD_RELOC_PPC_EMB_SDA21
-@deffnx {} BFD_RELOC_PPC_EMB_MRKREF
-@deffnx {} BFD_RELOC_PPC_EMB_RELSEC16
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_LO
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_HI
-@deffnx {} BFD_RELOC_PPC_EMB_RELST_HA
-@deffnx {} BFD_RELOC_PPC_EMB_BIT_FLD
-@deffnx {} BFD_RELOC_PPC_EMB_RELSDA
-@deffnx {} BFD_RELOC_PPC_VLE_REL8
-@deffnx {} BFD_RELOC_PPC_VLE_REL15
-@deffnx {} BFD_RELOC_PPC_VLE_REL24
-@deffnx {} BFD_RELOC_PPC_VLE_LO16A
-@deffnx {} BFD_RELOC_PPC_VLE_LO16D
-@deffnx {} BFD_RELOC_PPC_VLE_HI16A
-@deffnx {} BFD_RELOC_PPC_VLE_HI16D
-@deffnx {} BFD_RELOC_PPC_VLE_HA16A
-@deffnx {} BFD_RELOC_PPC_VLE_HA16D
-@deffnx {} BFD_RELOC_PPC_VLE_SDA21
-@deffnx {} BFD_RELOC_PPC_VLE_SDA21_LO
-@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_LO16A
-@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_LO16D
-@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_HI16A
-@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_HI16D
-@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_HA16A
-@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_HA16D
-@deffnx {} BFD_RELOC_PPC64_HIGHER
-@deffnx {} BFD_RELOC_PPC64_HIGHER_S
-@deffnx {} BFD_RELOC_PPC64_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_HIGHEST_S
-@deffnx {} BFD_RELOC_PPC64_TOC16_LO
-@deffnx {} BFD_RELOC_PPC64_TOC16_HI
-@deffnx {} BFD_RELOC_PPC64_TOC16_HA
-@deffnx {} BFD_RELOC_PPC64_TOC
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HI
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HA
-@deffnx {} BFD_RELOC_PPC64_ADDR16_DS
-@deffnx {} BFD_RELOC_PPC64_ADDR16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_GOT16_DS
-@deffnx {} BFD_RELOC_PPC64_GOT16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_PLT16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_SECTOFF_DS
-@deffnx {} BFD_RELOC_PPC64_SECTOFF_LO_DS
-@deffnx {} BFD_RELOC_PPC64_TOC16_DS
-@deffnx {} BFD_RELOC_PPC64_TOC16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_DS
-@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO_DS
-Power(rs6000) and PowerPC relocations.
-@end deffn
-@deffn {} BFD_RELOC_PPC_TLS
-@deffnx {} BFD_RELOC_PPC_TLSGD
-@deffnx {} BFD_RELOC_PPC_TLSLD
-@deffnx {} BFD_RELOC_PPC_DTPMOD
-@deffnx {} BFD_RELOC_PPC_TPREL16
-@deffnx {} BFD_RELOC_PPC_TPREL16_LO
-@deffnx {} BFD_RELOC_PPC_TPREL16_HI
-@deffnx {} BFD_RELOC_PPC_TPREL16_HA
-@deffnx {} BFD_RELOC_PPC_TPREL
-@deffnx {} BFD_RELOC_PPC_DTPREL16
-@deffnx {} BFD_RELOC_PPC_DTPREL16_LO
-@deffnx {} BFD_RELOC_PPC_DTPREL16_HI
-@deffnx {} BFD_RELOC_PPC_DTPREL16_HA
-@deffnx {} BFD_RELOC_PPC_DTPREL
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HA
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_LO
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HI
-@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HA
-@deffnx {} BFD_RELOC_PPC64_TPREL16_DS
-@deffnx {} BFD_RELOC_PPC64_TPREL16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHER
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHERA
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHESTA
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_DS
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_LO_DS
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHER
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHERA
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHEST
-@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHESTA
-PowerPC and PowerPC64 thread-local storage relocations.
-@end deffn
-@deffn {} BFD_RELOC_I370_D12
-IBM 370/390 relocations
-@end deffn
-@deffn {} BFD_RELOC_CTOR
-The type of reloc used to build a constructor table - at the moment
-probably a 32 bit wide absolute relocation, but the target can choose.
-It generally does map to one of the other relocation types.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_BRANCH
-ARM 26 bit pc-relative branch.  The lowest two bits must be zero and are
-not stored in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_BLX
-ARM 26 bit pc-relative branch.  The lowest bit must be zero and is
-not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
-field in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_THUMB_PCREL_BLX
-Thumb 22 bit pc-relative branch.  The lowest bit must be zero and is
-not stored in the instruction.  The 2nd lowest bit comes from a 1 bit
-field in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_CALL
-ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PCREL_JUMP
-ARM 26-bit pc-relative branch for B or conditional BL instruction.
-@end deffn
-@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH7
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH9
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH20
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23
-@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH25
-Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches.
-The lowest bit must be zero and is not stored in the instruction.
-Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an
-"nn" one smaller in all cases.  Note further that BRANCH23
-corresponds to R_ARM_THM_CALL.
-@end deffn
-@deffn {} BFD_RELOC_ARM_OFFSET_IMM
-12-bit immediate offset, used in ARM-format ldr and str instructions.
-@end deffn
-@deffn {} BFD_RELOC_ARM_THUMB_OFFSET
-5-bit immediate offset, used in Thumb-format ldr and str instructions.
-@end deffn
-@deffn {} BFD_RELOC_ARM_TARGET1
-Pc-relative or absolute relocation depending on target.  Used for
-entries in .init_array sections.
-@end deffn
-@deffn {} BFD_RELOC_ARM_ROSEGREL32
-Read-only segment base relative address.
-@end deffn
-@deffn {} BFD_RELOC_ARM_SBREL32
-Data segment base relative address.
-@end deffn
-@deffn {} BFD_RELOC_ARM_TARGET2
-This reloc is used for references to RTTI data from exception handling
-tables.  The actual definition depends on the target.  It may be a
-pc-relative or some form of GOT-indirect relocation.
-@end deffn
-@deffn {} BFD_RELOC_ARM_PREL31
-31-bit PC relative address.
-@end deffn
-@deffn {} BFD_RELOC_ARM_MOVW
-@deffnx {} BFD_RELOC_ARM_MOVT
-@deffnx {} BFD_RELOC_ARM_MOVW_PCREL
-@deffnx {} BFD_RELOC_ARM_MOVT_PCREL
-@deffnx {} BFD_RELOC_ARM_THUMB_MOVW
-@deffnx {} BFD_RELOC_ARM_THUMB_MOVT
-@deffnx {} BFD_RELOC_ARM_THUMB_MOVW_PCREL
-@deffnx {} BFD_RELOC_ARM_THUMB_MOVT_PCREL
-Low and High halfword relocations for MOVW and MOVT instructions.
-@end deffn
-@deffn {} BFD_RELOC_ARM_JUMP_SLOT
-@deffnx {} BFD_RELOC_ARM_GLOB_DAT
-@deffnx {} BFD_RELOC_ARM_GOT32
-@deffnx {} BFD_RELOC_ARM_PLT32
-@deffnx {} BFD_RELOC_ARM_RELATIVE
-@deffnx {} BFD_RELOC_ARM_GOTOFF
-@deffnx {} BFD_RELOC_ARM_GOTPC
-@deffnx {} BFD_RELOC_ARM_GOT_PREL
-Relocations for setting up GOTs and PLTs for shared libraries.
-@end deffn
-@deffn {} BFD_RELOC_ARM_TLS_GD32
-@deffnx {} BFD_RELOC_ARM_TLS_LDO32
-@deffnx {} BFD_RELOC_ARM_TLS_LDM32
-@deffnx {} BFD_RELOC_ARM_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_ARM_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_ARM_TLS_TPOFF32
-@deffnx {} BFD_RELOC_ARM_TLS_IE32
-@deffnx {} BFD_RELOC_ARM_TLS_LE32
-@deffnx {} BFD_RELOC_ARM_TLS_GOTDESC
-@deffnx {} BFD_RELOC_ARM_TLS_CALL
-@deffnx {} BFD_RELOC_ARM_THM_TLS_CALL
-@deffnx {} BFD_RELOC_ARM_TLS_DESCSEQ
-@deffnx {} BFD_RELOC_ARM_THM_TLS_DESCSEQ
-@deffnx {} BFD_RELOC_ARM_TLS_DESC
-ARM thread-local storage relocations.
-@end deffn
-@deffn {} BFD_RELOC_ARM_ALU_PC_G0_NC
-@deffnx {} BFD_RELOC_ARM_ALU_PC_G0
-@deffnx {} BFD_RELOC_ARM_ALU_PC_G1_NC
-@deffnx {} BFD_RELOC_ARM_ALU_PC_G1
-@deffnx {} BFD_RELOC_ARM_ALU_PC_G2
-@deffnx {} BFD_RELOC_ARM_LDR_PC_G0
-@deffnx {} BFD_RELOC_ARM_LDR_PC_G1
-@deffnx {} BFD_RELOC_ARM_LDR_PC_G2
-@deffnx {} BFD_RELOC_ARM_LDRS_PC_G0
-@deffnx {} BFD_RELOC_ARM_LDRS_PC_G1
-@deffnx {} BFD_RELOC_ARM_LDRS_PC_G2
-@deffnx {} BFD_RELOC_ARM_LDC_PC_G0
-@deffnx {} BFD_RELOC_ARM_LDC_PC_G1
-@deffnx {} BFD_RELOC_ARM_LDC_PC_G2
-@deffnx {} BFD_RELOC_ARM_ALU_SB_G0_NC
-@deffnx {} BFD_RELOC_ARM_ALU_SB_G0
-@deffnx {} BFD_RELOC_ARM_ALU_SB_G1_NC
-@deffnx {} BFD_RELOC_ARM_ALU_SB_G1
-@deffnx {} BFD_RELOC_ARM_ALU_SB_G2
-@deffnx {} BFD_RELOC_ARM_LDR_SB_G0
-@deffnx {} BFD_RELOC_ARM_LDR_SB_G1
-@deffnx {} BFD_RELOC_ARM_LDR_SB_G2
-@deffnx {} BFD_RELOC_ARM_LDRS_SB_G0
-@deffnx {} BFD_RELOC_ARM_LDRS_SB_G1
-@deffnx {} BFD_RELOC_ARM_LDRS_SB_G2
-@deffnx {} BFD_RELOC_ARM_LDC_SB_G0
-@deffnx {} BFD_RELOC_ARM_LDC_SB_G1
-@deffnx {} BFD_RELOC_ARM_LDC_SB_G2
-ARM group relocations.
-@end deffn
-@deffn {} BFD_RELOC_ARM_V4BX
-Annotation of BX instructions.
-@end deffn
-@deffn {} BFD_RELOC_ARM_IRELATIVE
-ARM support for STT_GNU_IFUNC.
-@end deffn
-@deffn {} BFD_RELOC_ARM_IMMEDIATE
-@deffnx {} BFD_RELOC_ARM_ADRL_IMMEDIATE
-@deffnx {} BFD_RELOC_ARM_T32_IMMEDIATE
-@deffnx {} BFD_RELOC_ARM_T32_ADD_IMM
-@deffnx {} BFD_RELOC_ARM_T32_IMM12
-@deffnx {} BFD_RELOC_ARM_T32_ADD_PC12
-@deffnx {} BFD_RELOC_ARM_SHIFT_IMM
-@deffnx {} BFD_RELOC_ARM_SMC
-@deffnx {} BFD_RELOC_ARM_HVC
-@deffnx {} BFD_RELOC_ARM_SWI
-@deffnx {} BFD_RELOC_ARM_MULTI
-@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM
-@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM_S2
-@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM
-@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM_S2
-@deffnx {} BFD_RELOC_ARM_ADR_IMM
-@deffnx {} BFD_RELOC_ARM_LDR_IMM
-@deffnx {} BFD_RELOC_ARM_LITERAL
-@deffnx {} BFD_RELOC_ARM_IN_POOL
-@deffnx {} BFD_RELOC_ARM_OFFSET_IMM8
-@deffnx {} BFD_RELOC_ARM_T32_OFFSET_U8
-@deffnx {} BFD_RELOC_ARM_T32_OFFSET_IMM
-@deffnx {} BFD_RELOC_ARM_HWLITERAL
-@deffnx {} BFD_RELOC_ARM_THUMB_ADD
-@deffnx {} BFD_RELOC_ARM_THUMB_IMM
-@deffnx {} BFD_RELOC_ARM_THUMB_SHIFT
-These relocs are only used within the ARM assembler.  They are not
-(at present) written to any object files.
-@end deffn
-@deffn {} BFD_RELOC_SH_PCDISP8BY2
-@deffnx {} BFD_RELOC_SH_PCDISP12BY2
-@deffnx {} BFD_RELOC_SH_IMM3
-@deffnx {} BFD_RELOC_SH_IMM3U
-@deffnx {} BFD_RELOC_SH_DISP12
-@deffnx {} BFD_RELOC_SH_DISP12BY2
-@deffnx {} BFD_RELOC_SH_DISP12BY4
-@deffnx {} BFD_RELOC_SH_DISP12BY8
-@deffnx {} BFD_RELOC_SH_DISP20
-@deffnx {} BFD_RELOC_SH_DISP20BY8
-@deffnx {} BFD_RELOC_SH_IMM4
-@deffnx {} BFD_RELOC_SH_IMM4BY2
-@deffnx {} BFD_RELOC_SH_IMM4BY4
-@deffnx {} BFD_RELOC_SH_IMM8
-@deffnx {} BFD_RELOC_SH_IMM8BY2
-@deffnx {} BFD_RELOC_SH_IMM8BY4
-@deffnx {} BFD_RELOC_SH_PCRELIMM8BY2
-@deffnx {} BFD_RELOC_SH_PCRELIMM8BY4
-@deffnx {} BFD_RELOC_SH_SWITCH16
-@deffnx {} BFD_RELOC_SH_SWITCH32
-@deffnx {} BFD_RELOC_SH_USES
-@deffnx {} BFD_RELOC_SH_COUNT
-@deffnx {} BFD_RELOC_SH_ALIGN
-@deffnx {} BFD_RELOC_SH_CODE
-@deffnx {} BFD_RELOC_SH_DATA
-@deffnx {} BFD_RELOC_SH_LABEL
-@deffnx {} BFD_RELOC_SH_LOOP_START
-@deffnx {} BFD_RELOC_SH_LOOP_END
-@deffnx {} BFD_RELOC_SH_COPY
-@deffnx {} BFD_RELOC_SH_GLOB_DAT
-@deffnx {} BFD_RELOC_SH_JMP_SLOT
-@deffnx {} BFD_RELOC_SH_RELATIVE
-@deffnx {} BFD_RELOC_SH_GOTPC
-@deffnx {} BFD_RELOC_SH_GOT_LOW16
-@deffnx {} BFD_RELOC_SH_GOT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOT_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOT_HI16
-@deffnx {} BFD_RELOC_SH_GOTPLT_LOW16
-@deffnx {} BFD_RELOC_SH_GOTPLT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTPLT_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTPLT_HI16
-@deffnx {} BFD_RELOC_SH_PLT_LOW16
-@deffnx {} BFD_RELOC_SH_PLT_MEDLOW16
-@deffnx {} BFD_RELOC_SH_PLT_MEDHI16
-@deffnx {} BFD_RELOC_SH_PLT_HI16
-@deffnx {} BFD_RELOC_SH_GOTOFF_LOW16
-@deffnx {} BFD_RELOC_SH_GOTOFF_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTOFF_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTOFF_HI16
-@deffnx {} BFD_RELOC_SH_GOTPC_LOW16
-@deffnx {} BFD_RELOC_SH_GOTPC_MEDLOW16
-@deffnx {} BFD_RELOC_SH_GOTPC_MEDHI16
-@deffnx {} BFD_RELOC_SH_GOTPC_HI16
-@deffnx {} BFD_RELOC_SH_COPY64
-@deffnx {} BFD_RELOC_SH_GLOB_DAT64
-@deffnx {} BFD_RELOC_SH_JMP_SLOT64
-@deffnx {} BFD_RELOC_SH_RELATIVE64
-@deffnx {} BFD_RELOC_SH_GOT10BY4
-@deffnx {} BFD_RELOC_SH_GOT10BY8
-@deffnx {} BFD_RELOC_SH_GOTPLT10BY4
-@deffnx {} BFD_RELOC_SH_GOTPLT10BY8
-@deffnx {} BFD_RELOC_SH_GOTPLT32
-@deffnx {} BFD_RELOC_SH_SHMEDIA_CODE
-@deffnx {} BFD_RELOC_SH_IMMU5
-@deffnx {} BFD_RELOC_SH_IMMS6
-@deffnx {} BFD_RELOC_SH_IMMS6BY32
-@deffnx {} BFD_RELOC_SH_IMMU6
-@deffnx {} BFD_RELOC_SH_IMMS10
-@deffnx {} BFD_RELOC_SH_IMMS10BY2
-@deffnx {} BFD_RELOC_SH_IMMS10BY4
-@deffnx {} BFD_RELOC_SH_IMMS10BY8
-@deffnx {} BFD_RELOC_SH_IMMS16
-@deffnx {} BFD_RELOC_SH_IMMU16
-@deffnx {} BFD_RELOC_SH_IMM_LOW16
-@deffnx {} BFD_RELOC_SH_IMM_LOW16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16
-@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_MEDHI16
-@deffnx {} BFD_RELOC_SH_IMM_MEDHI16_PCREL
-@deffnx {} BFD_RELOC_SH_IMM_HI16
-@deffnx {} BFD_RELOC_SH_IMM_HI16_PCREL
-@deffnx {} BFD_RELOC_SH_PT_16
-@deffnx {} BFD_RELOC_SH_TLS_GD_32
-@deffnx {} BFD_RELOC_SH_TLS_LD_32
-@deffnx {} BFD_RELOC_SH_TLS_LDO_32
-@deffnx {} BFD_RELOC_SH_TLS_IE_32
-@deffnx {} BFD_RELOC_SH_TLS_LE_32
-@deffnx {} BFD_RELOC_SH_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_SH_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_SH_TLS_TPOFF32
-@deffnx {} BFD_RELOC_SH_GOT20
-@deffnx {} BFD_RELOC_SH_GOTOFF20
-@deffnx {} BFD_RELOC_SH_GOTFUNCDESC
-@deffnx {} BFD_RELOC_SH_GOTFUNCDESC20
-@deffnx {} BFD_RELOC_SH_GOTOFFFUNCDESC
-@deffnx {} BFD_RELOC_SH_GOTOFFFUNCDESC20
-@deffnx {} BFD_RELOC_SH_FUNCDESC
-Renesas / SuperH SH relocs.  Not all of these appear in object files.
-@end deffn
-@deffn {} BFD_RELOC_ARC_B22_PCREL
-ARC Cores relocs.
-ARC 22 bit pc-relative branch.  The lowest two bits must be zero and are
-not stored in the instruction.  The high 20 bits are installed in bits 26
-through 7 of the instruction.
-@end deffn
-@deffn {} BFD_RELOC_ARC_B26
-ARC 26 bit absolute branch.  The lowest two bits must be zero and are not
-stored in the instruction.  The high 24 bits are installed in bits 23
-through 0.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_16_IMM
-ADI Blackfin 16 bit immediate absolute reloc.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_16_HIGH
-ADI Blackfin 16 bit immediate absolute reloc higher 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_4_PCREL
-ADI Blackfin 'a' part of LSETUP.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_5_PCREL
-ADI Blackfin.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_16_LOW
-ADI Blackfin 16 bit immediate absolute reloc lower 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_10_PCREL
-ADI Blackfin.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_11_PCREL
-ADI Blackfin 'b' part of LSETUP.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP
-ADI Blackfin.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP_S
-ADI Blackfin Short jump, pcrel.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_24_PCREL_CALL_X
-ADI Blackfin Call.x not implemented.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_24_PCREL_JUMP_L
-ADI Blackfin Long Jump pcrel.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_GOT17M4
-@deffnx {} BFD_RELOC_BFIN_GOTHI
-@deffnx {} BFD_RELOC_BFIN_GOTLO
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOT17M4
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTHI
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTLO
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_VALUE
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI
-@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO
-@deffnx {} BFD_RELOC_BFIN_GOTOFF17M4
-@deffnx {} BFD_RELOC_BFIN_GOTOFFHI
-@deffnx {} BFD_RELOC_BFIN_GOTOFFLO
-ADI Blackfin FD-PIC relocations.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_GOT
-ADI Blackfin GOT relocation.
-@end deffn
-@deffn {} BFD_RELOC_BFIN_PLTPC
-ADI Blackfin PLTPC relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_PUSH
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_CONST
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_ADD
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_SUB
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_MULT
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_DIV
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_MOD
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_LSHIFT
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_RSHIFT
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_AND
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_OR
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_XOR
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_LAND
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_LOR
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_LEN
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_NEG
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_COMP
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_PAGE
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_HWPAGE
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_ARELOC_BFIN_ADDR
-ADI Blackfin arithmetic relocation.
-@end deffn
-@deffn {} BFD_RELOC_D10V_10_PCREL_R
-Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D10V_10_PCREL_L
-Mitsubishi D10V relocs.
-This is a 10-bit reloc with the right 2 bits
-assumed to be 0.  This is the same as the previous reloc
-except it is in the left container, i.e.,
-shifted left 15 bits.
-@end deffn
-@deffn {} BFD_RELOC_D10V_18
-This is an 18-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D10V_18_PCREL
-This is an 18-bit reloc with the right 2 bits
-assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_6
-Mitsubishi D30V relocs.
-This is a 6-bit absolute reloc.
-@end deffn
-@deffn {} BFD_RELOC_D30V_9_PCREL
-This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_9_PCREL_R
-This is a 6-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15
-This is a 12-bit absolute reloc with the
-right 3 bitsassumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15_PCREL
-This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_15_PCREL_R
-This is a 12-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21
-This is an 18-bit absolute reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21_PCREL
-This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_D30V_21_PCREL_R
-This is an 18-bit pc-relative reloc with
-the right 3 bits assumed to be 0. Same
-as the previous reloc but on the right side
-of the container.
-@end deffn
-@deffn {} BFD_RELOC_D30V_32
-This is a 32-bit absolute reloc.
-@end deffn
-@deffn {} BFD_RELOC_D30V_32_PCREL
-This is a 32-bit pc-relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_DLX_HI16_S
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_DLX_LO16
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_DLX_JMP26
-DLX relocs
-@end deffn
-@deffn {} BFD_RELOC_M32C_HI8
-@deffnx {} BFD_RELOC_M32C_RL_JUMP
-@deffnx {} BFD_RELOC_M32C_RL_1ADDR
-@deffnx {} BFD_RELOC_M32C_RL_2ADDR
-Renesas M16C/M32C Relocations.
-@end deffn
-@deffn {} BFD_RELOC_M32R_24
-Renesas M32R (formerly Mitsubishi M32R) relocs.
-This is a 24 bit absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M32R_10_PCREL
-This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_18_PCREL
-This is an 18-bit reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_26_PCREL
-This is a 26-bit reloc with the right 2 bits assumed to be 0.
-@end deffn
-@deffn {} BFD_RELOC_M32R_HI16_ULO
-This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as unsigned.
-@end deffn
-@deffn {} BFD_RELOC_M32R_HI16_SLO
-This is a 16-bit reloc containing the high 16 bits of an address
-used when the lower 16 bits are treated as signed.
-@end deffn
-@deffn {} BFD_RELOC_M32R_LO16
-This is a 16-bit reloc containing the lower 16 bits of an address.
-@end deffn
-@deffn {} BFD_RELOC_M32R_SDA16
-This is a 16-bit reloc containing the small data area offset for use in
-add3, load, and store instructions.
-@end deffn
-@deffn {} BFD_RELOC_M32R_GOT24
-@deffnx {} BFD_RELOC_M32R_26_PLTREL
-@deffnx {} BFD_RELOC_M32R_COPY
-@deffnx {} BFD_RELOC_M32R_GLOB_DAT
-@deffnx {} BFD_RELOC_M32R_JMP_SLOT
-@deffnx {} BFD_RELOC_M32R_RELATIVE
-@deffnx {} BFD_RELOC_M32R_GOTOFF
-@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_ULO
-@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_SLO
-@deffnx {} BFD_RELOC_M32R_GOTOFF_LO
-@deffnx {} BFD_RELOC_M32R_GOTPC24
-@deffnx {} BFD_RELOC_M32R_GOT16_HI_ULO
-@deffnx {} BFD_RELOC_M32R_GOT16_HI_SLO
-@deffnx {} BFD_RELOC_M32R_GOT16_LO
-@deffnx {} BFD_RELOC_M32R_GOTPC_HI_ULO
-@deffnx {} BFD_RELOC_M32R_GOTPC_HI_SLO
-@deffnx {} BFD_RELOC_M32R_GOTPC_LO
-For PIC.
-@end deffn
-@deffn {} BFD_RELOC_V850_9_PCREL
-This is a 9-bit reloc
-@end deffn
-@deffn {} BFD_RELOC_V850_22_PCREL
-This is a 22-bit reloc
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_16_16_OFFSET
-This is a 16 bit offset from the short data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_15_16_OFFSET
-This is a 16 bit offset (of which only 15 bits are used) from the
-short data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_16_16_OFFSET
-This is a 16 bit offset from the zero data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_15_16_OFFSET
-This is a 16 bit offset (of which only 15 bits are used) from the
-zero data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_6_8_OFFSET
-This is an 8 bit offset (of which only 6 bits are used) from the
-tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_7_8_OFFSET
-This is an 8bit offset (of which only 7 bits are used) from the tiny
-data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_7_7_OFFSET
-This is a 7 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_16_16_OFFSET
-This is a 16 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_4_5_OFFSET
-This is a 5 bit offset (of which only 4 bits are used) from the tiny
-data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_TDA_4_4_OFFSET
-This is a 4 bit offset from the tiny data area pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET
-This is a 16 bit offset from the short data area pointer, with the
-bits placed non-contiguously in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET
-This is a 16 bit offset from the zero data area pointer, with the
-bits placed non-contiguously in the instruction.
-@end deffn
-@deffn {} BFD_RELOC_V850_CALLT_6_7_OFFSET
-This is a 6 bit offset from the call table base pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_CALLT_16_16_OFFSET
-This is a 16 bit offset from the call table base pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_LONGCALL
-Used for relaxing indirect function calls.
-@end deffn
-@deffn {} BFD_RELOC_V850_LONGJUMP
-Used for relaxing indirect jumps.
-@end deffn
-@deffn {} BFD_RELOC_V850_ALIGN
-Used to maintain alignment whilst relaxing.
-@end deffn
-@deffn {} BFD_RELOC_V850_LO16_SPLIT_OFFSET
-This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu
-instructions.
-@end deffn
-@deffn {} BFD_RELOC_V850_16_PCREL
-This is a 16-bit reloc.
-@end deffn
-@deffn {} BFD_RELOC_V850_17_PCREL
-This is a 17-bit reloc.
-@end deffn
-@deffn {} BFD_RELOC_V850_23
-This is a 23-bit reloc.
-@end deffn
-@deffn {} BFD_RELOC_V850_32_PCREL
-This is a 32-bit reloc.
-@end deffn
-@deffn {} BFD_RELOC_V850_32_ABS
-This is a 32-bit reloc.
-@end deffn
-@deffn {} BFD_RELOC_V850_16_SPLIT_OFFSET
-This is a 16-bit reloc.
-@end deffn
-@deffn {} BFD_RELOC_V850_16_S1
-This is a 16-bit reloc.
-@end deffn
-@deffn {} BFD_RELOC_V850_LO16_S1
-Low 16 bits. 16 bit shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_V850_CALLT_15_16_OFFSET
-This is a 16 bit offset from the call table base pointer.
-@end deffn
-@deffn {} BFD_RELOC_V850_32_GOTPCREL
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_16_GOT
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_32_GOT
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_22_PLT_PCREL
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_32_PLT_PCREL
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_COPY
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_GLOB_DAT
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_JMP_SLOT
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_RELATIVE
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_16_GOTOFF
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_32_GOTOFF
-DSO relocations.
-@end deffn
-@deffn {} BFD_RELOC_V850_CODE
-start code.
-@end deffn
-@deffn {} BFD_RELOC_V850_DATA
-start data in text.
-@end deffn
-@deffn {} BFD_RELOC_TIC30_LDP
-This is a 8bit DP reloc for the tms320c30, where the most
-significant 8 bits of a 24 bit word are placed into the least
-significant 8 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_PARTLS7
-This is a 7bit reloc for the tms320c54x, where the least
-significant 7 bits of a 16 bit word are placed into the least
-significant 7 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_PARTMS9
-This is a 9bit DP reloc for the tms320c54x, where the most
-significant 9 bits of a 16 bit word are placed into the least
-significant 9 bits of the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_23
-This is an extended address 23-bit reloc for the tms320c54x.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_16_OF_23
-This is a 16-bit reloc for the tms320c54x, where the least
-significant 16 bits of a 23-bit extended address are placed into
-the opcode.
-@end deffn
-@deffn {} BFD_RELOC_TIC54X_MS7_OF_23
-This is a reloc for the tms320c54x, where the most
-significant 7 bits of a 23-bit extended address are placed into
-the opcode.
-@end deffn
-@deffn {} BFD_RELOC_C6000_PCR_S21
-@deffnx {} BFD_RELOC_C6000_PCR_S12
-@deffnx {} BFD_RELOC_C6000_PCR_S10
-@deffnx {} BFD_RELOC_C6000_PCR_S7
-@deffnx {} BFD_RELOC_C6000_ABS_S16
-@deffnx {} BFD_RELOC_C6000_ABS_L16
-@deffnx {} BFD_RELOC_C6000_ABS_H16
-@deffnx {} BFD_RELOC_C6000_SBR_U15_B
-@deffnx {} BFD_RELOC_C6000_SBR_U15_H
-@deffnx {} BFD_RELOC_C6000_SBR_U15_W
-@deffnx {} BFD_RELOC_C6000_SBR_S16
-@deffnx {} BFD_RELOC_C6000_SBR_L16_B
-@deffnx {} BFD_RELOC_C6000_SBR_L16_H
-@deffnx {} BFD_RELOC_C6000_SBR_L16_W
-@deffnx {} BFD_RELOC_C6000_SBR_H16_B
-@deffnx {} BFD_RELOC_C6000_SBR_H16_H
-@deffnx {} BFD_RELOC_C6000_SBR_H16_W
-@deffnx {} BFD_RELOC_C6000_SBR_GOT_U15_W
-@deffnx {} BFD_RELOC_C6000_SBR_GOT_L16_W
-@deffnx {} BFD_RELOC_C6000_SBR_GOT_H16_W
-@deffnx {} BFD_RELOC_C6000_DSBT_INDEX
-@deffnx {} BFD_RELOC_C6000_PREL31
-@deffnx {} BFD_RELOC_C6000_COPY
-@deffnx {} BFD_RELOC_C6000_JUMP_SLOT
-@deffnx {} BFD_RELOC_C6000_EHTYPE
-@deffnx {} BFD_RELOC_C6000_PCR_H16
-@deffnx {} BFD_RELOC_C6000_PCR_L16
-@deffnx {} BFD_RELOC_C6000_ALIGN
-@deffnx {} BFD_RELOC_C6000_FPHEAD
-@deffnx {} BFD_RELOC_C6000_NOCMP
-TMS320C6000 relocations.
-@end deffn
-@deffn {} BFD_RELOC_FR30_48
-This is a 48 bit reloc for the FR30 that stores 32 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_20
-This is a 32 bit reloc for the FR30 that stores 20 bits split up into
-two sections.
-@end deffn
-@deffn {} BFD_RELOC_FR30_6_IN_4
-This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
-4 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_8_IN_8
-This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_9_IN_8
-This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_10_IN_8
-This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
-into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_9_PCREL
-This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
-short offset into 8 bits.
-@end deffn
-@deffn {} BFD_RELOC_FR30_12_PCREL
-This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
-short offset into 11 bits.
-@end deffn
-@deffn {} BFD_RELOC_MCORE_PCREL_IMM8BY4
-@deffnx {} BFD_RELOC_MCORE_PCREL_IMM11BY2
-@deffnx {} BFD_RELOC_MCORE_PCREL_IMM4BY2
-@deffnx {} BFD_RELOC_MCORE_PCREL_32
-@deffnx {} BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2
-@deffnx {} BFD_RELOC_MCORE_RVA
-Motorola Mcore relocations.
-@end deffn
-@deffn {} BFD_RELOC_MEP_8
-@deffnx {} BFD_RELOC_MEP_16
-@deffnx {} BFD_RELOC_MEP_32
-@deffnx {} BFD_RELOC_MEP_PCREL8A2
-@deffnx {} BFD_RELOC_MEP_PCREL12A2
-@deffnx {} BFD_RELOC_MEP_PCREL17A2
-@deffnx {} BFD_RELOC_MEP_PCREL24A2
-@deffnx {} BFD_RELOC_MEP_PCABS24A2
-@deffnx {} BFD_RELOC_MEP_LOW16
-@deffnx {} BFD_RELOC_MEP_HI16U
-@deffnx {} BFD_RELOC_MEP_HI16S
-@deffnx {} BFD_RELOC_MEP_GPREL
-@deffnx {} BFD_RELOC_MEP_TPREL
-@deffnx {} BFD_RELOC_MEP_TPREL7
-@deffnx {} BFD_RELOC_MEP_TPREL7A2
-@deffnx {} BFD_RELOC_MEP_TPREL7A4
-@deffnx {} BFD_RELOC_MEP_UIMM24
-@deffnx {} BFD_RELOC_MEP_ADDR24A4
-@deffnx {} BFD_RELOC_MEP_GNU_VTINHERIT
-@deffnx {} BFD_RELOC_MEP_GNU_VTENTRY
-Toshiba Media Processor Relocations.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_GETA
-@deffnx {} BFD_RELOC_MMIX_GETA_1
-@deffnx {} BFD_RELOC_MMIX_GETA_2
-@deffnx {} BFD_RELOC_MMIX_GETA_3
-These are relocations for the GETA instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_CBRANCH
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_J
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_1
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_2
-@deffnx {} BFD_RELOC_MMIX_CBRANCH_3
-These are relocations for a conditional branch instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_PUSHJ
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_1
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_2
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_3
-@deffnx {} BFD_RELOC_MMIX_PUSHJ_STUBBABLE
-These are relocations for the PUSHJ instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_JMP
-@deffnx {} BFD_RELOC_MMIX_JMP_1
-@deffnx {} BFD_RELOC_MMIX_JMP_2
-@deffnx {} BFD_RELOC_MMIX_JMP_3
-These are relocations for the JMP instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_ADDR19
-This is a relocation for a relative address as in a GETA instruction or
-a branch.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_ADDR27
-This is a relocation for a relative address as in a JMP instruction.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_REG_OR_BYTE
-This is a relocation for an instruction field that may be a general
-register or a value 0..255.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_REG
-This is a relocation for an instruction field that may be a general
-register.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_BASE_PLUS_OFFSET
-This is a relocation for two instruction fields holding a register and
-an offset, the equivalent of the relocation.
-@end deffn
-@deffn {} BFD_RELOC_MMIX_LOCAL
-This relocation is an assertion that the expression is not allocated as
-a global register.  It does not modify contents.
-@end deffn
-@deffn {} BFD_RELOC_AVR_7_PCREL
-This is a 16 bit reloc for the AVR that stores 8 bit pc relative
-short offset into 7 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_13_PCREL
-This is a 16 bit reloc for the AVR that stores 13 bit pc relative
-short offset into 12 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_16_PM
-This is a 16 bit reloc for the AVR that stores 17 bit value (usually
-program memory address) into 16 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-data memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of data memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of program memory address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_MS8_LDI
-This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of 32 bit value) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually data memory address) into 8 bit immediate value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of data memory address) into 8 bit immediate value of
-SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(most high 8 bit of program memory address) into 8 bit immediate value
-of LDI or SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_MS8_LDI_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb
-of 32 bit value) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (usually
-command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_GS
-This is a 16 bit reloc for the AVR that stores 8 bit value 
-(command address) into 8 bit immediate value of LDI insn. If the address
-is beyond the 128k boundary, the linker inserts a jump stub for this reloc
-in the lower 128k.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_GS
-This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
-of command address) into 8 bit immediate value of LDI insn.  If the address
-is beyond the 128k boundary, the linker inserts a jump stub for this reloc
-below 128k.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_PM
-This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
-of command address) into 8 bit immediate value of LDI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LO8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(usually command address) into 8 bit immediate value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HI8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 8 bit of 16 bit command address) into 8 bit immediate value
-of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_HH8_LDI_PM_NEG
-This is a 16 bit reloc for the AVR that stores negated 8 bit value
-(high 6 bit of 22 bit command address) into 8 bit immediate
-value of SUBI insn.
-@end deffn
-@deffn {} BFD_RELOC_AVR_CALL
-This is a 32 bit reloc for the AVR that stores 23 bit value
-into 22 bits.
-@end deffn
-@deffn {} BFD_RELOC_AVR_LDI
-This is a 16 bit reloc for the AVR that stores all needed bits
-for absolute addressing with ldi with overflow check to linktime
-@end deffn
-@deffn {} BFD_RELOC_AVR_6
-This is a 6 bit reloc for the AVR that stores offset for ldd/std
-instructions
-@end deffn
-@deffn {} BFD_RELOC_AVR_6_ADIW
-This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw
-instructions
-@end deffn
-@deffn {} BFD_RELOC_AVR_8_LO
-This is a 8 bit reloc for the AVR that stores bits 0..7 of a symbol
-in .byte lo8(symbol)
-@end deffn
-@deffn {} BFD_RELOC_AVR_8_HI
-This is a 8 bit reloc for the AVR that stores bits 8..15 of a symbol
-in .byte hi8(symbol)
-@end deffn
-@deffn {} BFD_RELOC_AVR_8_HLO
-This is a 8 bit reloc for the AVR that stores bits 16..23 of a symbol
-in .byte hlo8(symbol)
-@end deffn
-@deffn {} BFD_RELOC_RL78_NEG8
-@deffnx {} BFD_RELOC_RL78_NEG16
-@deffnx {} BFD_RELOC_RL78_NEG24
-@deffnx {} BFD_RELOC_RL78_NEG32
-@deffnx {} BFD_RELOC_RL78_16_OP
-@deffnx {} BFD_RELOC_RL78_24_OP
-@deffnx {} BFD_RELOC_RL78_32_OP
-@deffnx {} BFD_RELOC_RL78_8U
-@deffnx {} BFD_RELOC_RL78_16U
-@deffnx {} BFD_RELOC_RL78_24U
-@deffnx {} BFD_RELOC_RL78_DIR3U_PCREL
-@deffnx {} BFD_RELOC_RL78_DIFF
-@deffnx {} BFD_RELOC_RL78_GPRELB
-@deffnx {} BFD_RELOC_RL78_GPRELW
-@deffnx {} BFD_RELOC_RL78_GPRELL
-@deffnx {} BFD_RELOC_RL78_SYM
-@deffnx {} BFD_RELOC_RL78_OP_SUBTRACT
-@deffnx {} BFD_RELOC_RL78_OP_NEG
-@deffnx {} BFD_RELOC_RL78_OP_AND
-@deffnx {} BFD_RELOC_RL78_OP_SHRA
-@deffnx {} BFD_RELOC_RL78_ABS8
-@deffnx {} BFD_RELOC_RL78_ABS16
-@deffnx {} BFD_RELOC_RL78_ABS16_REV
-@deffnx {} BFD_RELOC_RL78_ABS32
-@deffnx {} BFD_RELOC_RL78_ABS32_REV
-@deffnx {} BFD_RELOC_RL78_ABS16U
-@deffnx {} BFD_RELOC_RL78_ABS16UW
-@deffnx {} BFD_RELOC_RL78_ABS16UL
-@deffnx {} BFD_RELOC_RL78_RELAX
-@deffnx {} BFD_RELOC_RL78_HI16
-@deffnx {} BFD_RELOC_RL78_HI8
-@deffnx {} BFD_RELOC_RL78_LO16
-Renesas RL78 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_RX_NEG8
-@deffnx {} BFD_RELOC_RX_NEG16
-@deffnx {} BFD_RELOC_RX_NEG24
-@deffnx {} BFD_RELOC_RX_NEG32
-@deffnx {} BFD_RELOC_RX_16_OP
-@deffnx {} BFD_RELOC_RX_24_OP
-@deffnx {} BFD_RELOC_RX_32_OP
-@deffnx {} BFD_RELOC_RX_8U
-@deffnx {} BFD_RELOC_RX_16U
-@deffnx {} BFD_RELOC_RX_24U
-@deffnx {} BFD_RELOC_RX_DIR3U_PCREL
-@deffnx {} BFD_RELOC_RX_DIFF
-@deffnx {} BFD_RELOC_RX_GPRELB
-@deffnx {} BFD_RELOC_RX_GPRELW
-@deffnx {} BFD_RELOC_RX_GPRELL
-@deffnx {} BFD_RELOC_RX_SYM
-@deffnx {} BFD_RELOC_RX_OP_SUBTRACT
-@deffnx {} BFD_RELOC_RX_OP_NEG
-@deffnx {} BFD_RELOC_RX_ABS8
-@deffnx {} BFD_RELOC_RX_ABS16
-@deffnx {} BFD_RELOC_RX_ABS16_REV
-@deffnx {} BFD_RELOC_RX_ABS32
-@deffnx {} BFD_RELOC_RX_ABS32_REV
-@deffnx {} BFD_RELOC_RX_ABS16U
-@deffnx {} BFD_RELOC_RX_ABS16UW
-@deffnx {} BFD_RELOC_RX_ABS16UL
-@deffnx {} BFD_RELOC_RX_RELAX
-Renesas RX Relocations.
-@end deffn
-@deffn {} BFD_RELOC_390_12
-Direct 12 bit.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT12
-12 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT32
-32 bit PC relative PLT address.
-@end deffn
-@deffn {} BFD_RELOC_390_COPY
-Copy symbol at runtime.
-@end deffn
-@deffn {} BFD_RELOC_390_GLOB_DAT
-Create GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_JMP_SLOT
-Create PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_RELATIVE
-Adjust by program base.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPC
-32 bit PC relative offset to GOT.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT16
-16 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PC16DBL
-PC relative 16 bit shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT16DBL
-16 bit PC rel. PLT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PC32DBL
-PC relative 32 bit shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT32DBL
-32 bit PC rel. PLT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPCDBL
-32 bit PC rel. GOT shifted by 1.
-@end deffn
-@deffn {} BFD_RELOC_390_GOT64
-64 bit GOT offset.
-@end deffn
-@deffn {} BFD_RELOC_390_PLT64
-64 bit PC relative PLT address.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTENT
-32 bit rel. offset to GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTOFF64
-64 bit offset to GOT.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT12
-12-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT16
-16-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT32
-32-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLT64
-64-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_GOTPLTENT
-32-bit rel. offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF16
-16-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF32
-32-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_PLTOFF64
-64-bit rel. offset from the GOT to a PLT entry.
-@end deffn
-@deffn {} BFD_RELOC_390_TLS_LOAD
-@deffnx {} BFD_RELOC_390_TLS_GDCALL
-@deffnx {} BFD_RELOC_390_TLS_LDCALL
-@deffnx {} BFD_RELOC_390_TLS_GD32
-@deffnx {} BFD_RELOC_390_TLS_GD64
-@deffnx {} BFD_RELOC_390_TLS_GOTIE12
-@deffnx {} BFD_RELOC_390_TLS_GOTIE32
-@deffnx {} BFD_RELOC_390_TLS_GOTIE64
-@deffnx {} BFD_RELOC_390_TLS_LDM32
-@deffnx {} BFD_RELOC_390_TLS_LDM64
-@deffnx {} BFD_RELOC_390_TLS_IE32
-@deffnx {} BFD_RELOC_390_TLS_IE64
-@deffnx {} BFD_RELOC_390_TLS_IEENT
-@deffnx {} BFD_RELOC_390_TLS_LE32
-@deffnx {} BFD_RELOC_390_TLS_LE64
-@deffnx {} BFD_RELOC_390_TLS_LDO32
-@deffnx {} BFD_RELOC_390_TLS_LDO64
-@deffnx {} BFD_RELOC_390_TLS_DTPMOD
-@deffnx {} BFD_RELOC_390_TLS_DTPOFF
-@deffnx {} BFD_RELOC_390_TLS_TPOFF
-s390 tls relocations.
-@end deffn
-@deffn {} BFD_RELOC_390_20
-@deffnx {} BFD_RELOC_390_GOT20
-@deffnx {} BFD_RELOC_390_GOTPLT20
-@deffnx {} BFD_RELOC_390_TLS_GOTIE20
-Long displacement extension.
-@end deffn
-@deffn {} BFD_RELOC_390_IRELATIVE
-STT_GNU_IFUNC relocation.
-@end deffn
-@deffn {} BFD_RELOC_SCORE_GPREL15
-Score relocations
-Low 16 bit for load/store
-@end deffn
-@deffn {} BFD_RELOC_SCORE_DUMMY2
-@deffnx {} BFD_RELOC_SCORE_JMP
-This is a 24-bit reloc with the right 1 bit assumed to be 0
-@end deffn
-@deffn {} BFD_RELOC_SCORE_BRANCH
-This is a 19-bit reloc with the right 1 bit assumed to be 0
-@end deffn
-@deffn {} BFD_RELOC_SCORE_IMM30
-This is a 32-bit reloc for 48-bit instructions.
-@end deffn
-@deffn {} BFD_RELOC_SCORE_IMM32
-This is a 32-bit reloc for 48-bit instructions.
-@end deffn
-@deffn {} BFD_RELOC_SCORE16_JMP
-This is a 11-bit reloc with the right 1 bit assumed to be 0
-@end deffn
-@deffn {} BFD_RELOC_SCORE16_BRANCH
-This is a 8-bit reloc with the right 1 bit assumed to be 0
-@end deffn
-@deffn {} BFD_RELOC_SCORE_BCMP
-This is a 9-bit reloc with the right 1 bit assumed to be 0
-@end deffn
-@deffn {} BFD_RELOC_SCORE_GOT15
-@deffnx {} BFD_RELOC_SCORE_GOT_LO16
-@deffnx {} BFD_RELOC_SCORE_CALL15
-@deffnx {} BFD_RELOC_SCORE_DUMMY_HI16
-Undocumented Score relocs
-@end deffn
-@deffn {} BFD_RELOC_IP2K_FR9
-Scenix IP2K - 9-bit register number / data address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_BANK
-Scenix IP2K - 4-bit register/data bank number
-@end deffn
-@deffn {} BFD_RELOC_IP2K_ADDR16CJP
-Scenix IP2K - low 13 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_PAGE3
-Scenix IP2K - high 3 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_LO8DATA
-@deffnx {} BFD_RELOC_IP2K_HI8DATA
-@deffnx {} BFD_RELOC_IP2K_EX8DATA
-Scenix IP2K - ext/low/high 8 bits of data address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_LO8INSN
-@deffnx {} BFD_RELOC_IP2K_HI8INSN
-Scenix IP2K - low/high 8 bits of instruction word address
-@end deffn
-@deffn {} BFD_RELOC_IP2K_PC_SKIP
-Scenix IP2K - even/odd PC modifier to modify snb pcl.0
-@end deffn
-@deffn {} BFD_RELOC_IP2K_TEXT
-Scenix IP2K - 16 bit word address in text section.
-@end deffn
-@deffn {} BFD_RELOC_IP2K_FR_OFFSET
-Scenix IP2K - 7-bit sp or dp offset
-@end deffn
-@deffn {} BFD_RELOC_VPE4KMATH_DATA
-@deffnx {} BFD_RELOC_VPE4KMATH_INSN
-Scenix VPE4K coprocessor - data/insn-space addressing
-@end deffn
-@deffn {} BFD_RELOC_VTABLE_INHERIT
-@deffnx {} BFD_RELOC_VTABLE_ENTRY
-These two relocations are used by the linker to determine which of
-the entries in a C++ virtual function table are actually used.  When
-the --gc-sections option is given, the linker will zero out the entries
-that are not used, so that the code for those functions need not be
-included in the output.
-
-VTABLE_INHERIT is a zero-space relocation used to describe to the
-linker the inheritance tree of a C++ virtual function table.  The
-relocation's symbol should be the parent class' vtable, and the
-relocation should be located at the child vtable.
-
-VTABLE_ENTRY is a zero-space relocation that describes the use of a
-virtual function table entry.  The reloc's symbol should refer to the
-table of the class mentioned in the code.  Off of that base, an offset
-describes the entry that is being used.  For Rela hosts, this offset
-is stored in the reloc's addend.  For Rel hosts, we are forced to put
-this offset in the reloc's section offset.
-@end deffn
-@deffn {} BFD_RELOC_IA64_IMM14
-@deffnx {} BFD_RELOC_IA64_IMM22
-@deffnx {} BFD_RELOC_IA64_IMM64
-@deffnx {} BFD_RELOC_IA64_DIR32MSB
-@deffnx {} BFD_RELOC_IA64_DIR32LSB
-@deffnx {} BFD_RELOC_IA64_DIR64MSB
-@deffnx {} BFD_RELOC_IA64_DIR64LSB
-@deffnx {} BFD_RELOC_IA64_GPREL22
-@deffnx {} BFD_RELOC_IA64_GPREL64I
-@deffnx {} BFD_RELOC_IA64_GPREL32MSB
-@deffnx {} BFD_RELOC_IA64_GPREL32LSB
-@deffnx {} BFD_RELOC_IA64_GPREL64MSB
-@deffnx {} BFD_RELOC_IA64_GPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF22
-@deffnx {} BFD_RELOC_IA64_LTOFF64I
-@deffnx {} BFD_RELOC_IA64_PLTOFF22
-@deffnx {} BFD_RELOC_IA64_PLTOFF64I
-@deffnx {} BFD_RELOC_IA64_PLTOFF64MSB
-@deffnx {} BFD_RELOC_IA64_PLTOFF64LSB
-@deffnx {} BFD_RELOC_IA64_FPTR64I
-@deffnx {} BFD_RELOC_IA64_FPTR32MSB
-@deffnx {} BFD_RELOC_IA64_FPTR32LSB
-@deffnx {} BFD_RELOC_IA64_FPTR64MSB
-@deffnx {} BFD_RELOC_IA64_FPTR64LSB
-@deffnx {} BFD_RELOC_IA64_PCREL21B
-@deffnx {} BFD_RELOC_IA64_PCREL21BI
-@deffnx {} BFD_RELOC_IA64_PCREL21M
-@deffnx {} BFD_RELOC_IA64_PCREL21F
-@deffnx {} BFD_RELOC_IA64_PCREL22
-@deffnx {} BFD_RELOC_IA64_PCREL60B
-@deffnx {} BFD_RELOC_IA64_PCREL64I
-@deffnx {} BFD_RELOC_IA64_PCREL32MSB
-@deffnx {} BFD_RELOC_IA64_PCREL32LSB
-@deffnx {} BFD_RELOC_IA64_PCREL64MSB
-@deffnx {} BFD_RELOC_IA64_PCREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR22
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64I
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32MSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64MSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64LSB
-@deffnx {} BFD_RELOC_IA64_SEGREL32MSB
-@deffnx {} BFD_RELOC_IA64_SEGREL32LSB
-@deffnx {} BFD_RELOC_IA64_SEGREL64MSB
-@deffnx {} BFD_RELOC_IA64_SEGREL64LSB
-@deffnx {} BFD_RELOC_IA64_SECREL32MSB
-@deffnx {} BFD_RELOC_IA64_SECREL32LSB
-@deffnx {} BFD_RELOC_IA64_SECREL64MSB
-@deffnx {} BFD_RELOC_IA64_SECREL64LSB
-@deffnx {} BFD_RELOC_IA64_REL32MSB
-@deffnx {} BFD_RELOC_IA64_REL32LSB
-@deffnx {} BFD_RELOC_IA64_REL64MSB
-@deffnx {} BFD_RELOC_IA64_REL64LSB
-@deffnx {} BFD_RELOC_IA64_LTV32MSB
-@deffnx {} BFD_RELOC_IA64_LTV32LSB
-@deffnx {} BFD_RELOC_IA64_LTV64MSB
-@deffnx {} BFD_RELOC_IA64_LTV64LSB
-@deffnx {} BFD_RELOC_IA64_IPLTMSB
-@deffnx {} BFD_RELOC_IA64_IPLTLSB
-@deffnx {} BFD_RELOC_IA64_COPY
-@deffnx {} BFD_RELOC_IA64_LTOFF22X
-@deffnx {} BFD_RELOC_IA64_LDXMOV
-@deffnx {} BFD_RELOC_IA64_TPREL14
-@deffnx {} BFD_RELOC_IA64_TPREL22
-@deffnx {} BFD_RELOC_IA64_TPREL64I
-@deffnx {} BFD_RELOC_IA64_TPREL64MSB
-@deffnx {} BFD_RELOC_IA64_TPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_TPREL22
-@deffnx {} BFD_RELOC_IA64_DTPMOD64MSB
-@deffnx {} BFD_RELOC_IA64_DTPMOD64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_DTPMOD22
-@deffnx {} BFD_RELOC_IA64_DTPREL14
-@deffnx {} BFD_RELOC_IA64_DTPREL22
-@deffnx {} BFD_RELOC_IA64_DTPREL64I
-@deffnx {} BFD_RELOC_IA64_DTPREL32MSB
-@deffnx {} BFD_RELOC_IA64_DTPREL32LSB
-@deffnx {} BFD_RELOC_IA64_DTPREL64MSB
-@deffnx {} BFD_RELOC_IA64_DTPREL64LSB
-@deffnx {} BFD_RELOC_IA64_LTOFF_DTPREL22
-Intel IA64 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_HI8
-Motorola 68HC11 reloc.
-This is the 8 bit high part of an absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_LO8
-Motorola 68HC11 reloc.
-This is the 8 bit low part of an absolute address.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_3B
-Motorola 68HC11 reloc.
-This is the 3 bit of a value.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_RL_JUMP
-Motorola 68HC11 reloc.
-This reloc marks the beginning of a jump/call instruction.
-It is used for linker relaxation to correctly identify beginning
-of instruction and change some branches to use PC-relative
-addressing mode.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_RL_GROUP
-Motorola 68HC11 reloc.
-This reloc marks a group of several instructions that gcc generates
-and for which the linker relaxation pass can modify and/or remove
-some of them.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_LO16
-Motorola 68HC11 reloc.
-This is the 16-bit lower part of an address.  It is used for 'call'
-instruction to specify the symbol address without any special
-transformation (due to memory bank window).
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_PAGE
-Motorola 68HC11 reloc.
-This is a 8-bit reloc that specifies the page number of an address.
-It is used by 'call' instruction to specify the page number of
-the symbol.
-@end deffn
-@deffn {} BFD_RELOC_M68HC11_24
-Motorola 68HC11 reloc.
-This is a 24-bit reloc that represents the address with a 16-bit
-value and a 8-bit page number.  The symbol address is transformed
-to follow the 16K memory bank of 68HC12 (seen as mapped in the window).
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_5B
-Motorola 68HC12 reloc.
-This is the 5 bits of a value.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_RL_JUMP
-Freescale XGATE reloc.
-This reloc marks the beginning of a bra/jal instruction.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_RL_GROUP
-Freescale XGATE reloc.
-This reloc marks a group of several instructions that gcc generates
-and for which the linker relaxation pass can modify and/or remove
-some of them.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_LO16
-Freescale XGATE reloc.
-This is the 16-bit lower part of an address.  It is used for the '16-bit'
-instructions.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_GPAGE
-Freescale XGATE reloc.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_24
-Freescale XGATE reloc.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_PCREL_9
-Freescale XGATE reloc.
-This is a 9-bit pc-relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_PCREL_10
-Freescale XGATE reloc.
-This is a 10-bit pc-relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_IMM8_LO
-Freescale XGATE reloc.
-This is the 16-bit lower part of an address.  It is used for the '16-bit'
-instructions.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_IMM8_HI
-Freescale XGATE reloc.
-This is the 16-bit higher part of an address.  It is used for the '16-bit'
-instructions.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_IMM3
-Freescale XGATE reloc.
-This is a 3-bit pc-relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_IMM4
-Freescale XGATE reloc.
-This is a 4-bit pc-relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_XGATE_IMM5
-Freescale XGATE reloc.
-This is a 5-bit pc-relative reloc.
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_9B
-Motorola 68HC12 reloc.
-This is the 9 bits of a value.
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_16B
-Motorola 68HC12 reloc.
-This is the 16 bits of a value.
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_9_PCREL
-Motorola 68HC12/XGATE reloc.
-This is a PCREL9 branch.
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_10_PCREL
-Motorola 68HC12/XGATE reloc.
-This is a PCREL10 branch.
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_LO8XG
-Motorola 68HC12/XGATE reloc.
-This is the 8 bit low part of an absolute address and immediately precedes
-a matching HI8XG part.
-@end deffn
-@deffn {} BFD_RELOC_M68HC12_HI8XG
-Motorola 68HC12/XGATE reloc.
-This is the 8 bit high part of an absolute address and immediately follows
-a matching LO8XG part.
-@end deffn
-@deffn {} BFD_RELOC_16C_NUM08
-@deffnx {} BFD_RELOC_16C_NUM08_C
-@deffnx {} BFD_RELOC_16C_NUM16
-@deffnx {} BFD_RELOC_16C_NUM16_C
-@deffnx {} BFD_RELOC_16C_NUM32
-@deffnx {} BFD_RELOC_16C_NUM32_C
-@deffnx {} BFD_RELOC_16C_DISP04
-@deffnx {} BFD_RELOC_16C_DISP04_C
-@deffnx {} BFD_RELOC_16C_DISP08
-@deffnx {} BFD_RELOC_16C_DISP08_C
-@deffnx {} BFD_RELOC_16C_DISP16
-@deffnx {} BFD_RELOC_16C_DISP16_C
-@deffnx {} BFD_RELOC_16C_DISP24
-@deffnx {} BFD_RELOC_16C_DISP24_C
-@deffnx {} BFD_RELOC_16C_DISP24a
-@deffnx {} BFD_RELOC_16C_DISP24a_C
-@deffnx {} BFD_RELOC_16C_REG04
-@deffnx {} BFD_RELOC_16C_REG04_C
-@deffnx {} BFD_RELOC_16C_REG04a
-@deffnx {} BFD_RELOC_16C_REG04a_C
-@deffnx {} BFD_RELOC_16C_REG14
-@deffnx {} BFD_RELOC_16C_REG14_C
-@deffnx {} BFD_RELOC_16C_REG16
-@deffnx {} BFD_RELOC_16C_REG16_C
-@deffnx {} BFD_RELOC_16C_REG20
-@deffnx {} BFD_RELOC_16C_REG20_C
-@deffnx {} BFD_RELOC_16C_ABS20
-@deffnx {} BFD_RELOC_16C_ABS20_C
-@deffnx {} BFD_RELOC_16C_ABS24
-@deffnx {} BFD_RELOC_16C_ABS24_C
-@deffnx {} BFD_RELOC_16C_IMM04
-@deffnx {} BFD_RELOC_16C_IMM04_C
-@deffnx {} BFD_RELOC_16C_IMM16
-@deffnx {} BFD_RELOC_16C_IMM16_C
-@deffnx {} BFD_RELOC_16C_IMM20
-@deffnx {} BFD_RELOC_16C_IMM20_C
-@deffnx {} BFD_RELOC_16C_IMM24
-@deffnx {} BFD_RELOC_16C_IMM24_C
-@deffnx {} BFD_RELOC_16C_IMM32
-@deffnx {} BFD_RELOC_16C_IMM32_C
-NS CR16C Relocations.
-@end deffn
-@deffn {} BFD_RELOC_CR16_NUM8
-@deffnx {} BFD_RELOC_CR16_NUM16
-@deffnx {} BFD_RELOC_CR16_NUM32
-@deffnx {} BFD_RELOC_CR16_NUM32a
-@deffnx {} BFD_RELOC_CR16_REGREL0
-@deffnx {} BFD_RELOC_CR16_REGREL4
-@deffnx {} BFD_RELOC_CR16_REGREL4a
-@deffnx {} BFD_RELOC_CR16_REGREL14
-@deffnx {} BFD_RELOC_CR16_REGREL14a
-@deffnx {} BFD_RELOC_CR16_REGREL16
-@deffnx {} BFD_RELOC_CR16_REGREL20
-@deffnx {} BFD_RELOC_CR16_REGREL20a
-@deffnx {} BFD_RELOC_CR16_ABS20
-@deffnx {} BFD_RELOC_CR16_ABS24
-@deffnx {} BFD_RELOC_CR16_IMM4
-@deffnx {} BFD_RELOC_CR16_IMM8
-@deffnx {} BFD_RELOC_CR16_IMM16
-@deffnx {} BFD_RELOC_CR16_IMM20
-@deffnx {} BFD_RELOC_CR16_IMM24
-@deffnx {} BFD_RELOC_CR16_IMM32
-@deffnx {} BFD_RELOC_CR16_IMM32a
-@deffnx {} BFD_RELOC_CR16_DISP4
-@deffnx {} BFD_RELOC_CR16_DISP8
-@deffnx {} BFD_RELOC_CR16_DISP16
-@deffnx {} BFD_RELOC_CR16_DISP20
-@deffnx {} BFD_RELOC_CR16_DISP24
-@deffnx {} BFD_RELOC_CR16_DISP24a
-@deffnx {} BFD_RELOC_CR16_SWITCH8
-@deffnx {} BFD_RELOC_CR16_SWITCH16
-@deffnx {} BFD_RELOC_CR16_SWITCH32
-@deffnx {} BFD_RELOC_CR16_GOT_REGREL20
-@deffnx {} BFD_RELOC_CR16_GOTC_REGREL20
-@deffnx {} BFD_RELOC_CR16_GLOB_DAT
-NS CR16 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_CRX_REL4
-@deffnx {} BFD_RELOC_CRX_REL8
-@deffnx {} BFD_RELOC_CRX_REL8_CMP
-@deffnx {} BFD_RELOC_CRX_REL16
-@deffnx {} BFD_RELOC_CRX_REL24
-@deffnx {} BFD_RELOC_CRX_REL32
-@deffnx {} BFD_RELOC_CRX_REGREL12
-@deffnx {} BFD_RELOC_CRX_REGREL22
-@deffnx {} BFD_RELOC_CRX_REGREL28
-@deffnx {} BFD_RELOC_CRX_REGREL32
-@deffnx {} BFD_RELOC_CRX_ABS16
-@deffnx {} BFD_RELOC_CRX_ABS32
-@deffnx {} BFD_RELOC_CRX_NUM8
-@deffnx {} BFD_RELOC_CRX_NUM16
-@deffnx {} BFD_RELOC_CRX_NUM32
-@deffnx {} BFD_RELOC_CRX_IMM16
-@deffnx {} BFD_RELOC_CRX_IMM32
-@deffnx {} BFD_RELOC_CRX_SWITCH8
-@deffnx {} BFD_RELOC_CRX_SWITCH16
-@deffnx {} BFD_RELOC_CRX_SWITCH32
-NS CRX Relocations.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_BDISP8
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_5
-@deffnx {} BFD_RELOC_CRIS_SIGNED_6
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_6
-@deffnx {} BFD_RELOC_CRIS_SIGNED_8
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_8
-@deffnx {} BFD_RELOC_CRIS_SIGNED_16
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_16
-@deffnx {} BFD_RELOC_CRIS_LAPCQ_OFFSET
-@deffnx {} BFD_RELOC_CRIS_UNSIGNED_4
-These relocs are only used within the CRIS assembler.  They are not
-(at present) written to any object files.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_COPY
-@deffnx {} BFD_RELOC_CRIS_GLOB_DAT
-@deffnx {} BFD_RELOC_CRIS_JUMP_SLOT
-@deffnx {} BFD_RELOC_CRIS_RELATIVE
-Relocs used in ELF shared libraries for CRIS.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOT
-32-bit offset to symbol-entry within GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_16_GOT
-16-bit offset to symbol-entry within GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOTPLT
-32-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_16_GOTPLT
-16-bit offset to symbol-entry within GOT, with PLT handling.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOTREL
-32-bit offset to symbol, relative to GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_PLT_GOTREL
-32-bit offset to symbol with PLT entry, relative to GOT.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_PLT_PCREL
-32-bit offset to symbol with PLT entry, relative to this relocation.
-@end deffn
-@deffn {} BFD_RELOC_CRIS_32_GOT_GD
-@deffnx {} BFD_RELOC_CRIS_16_GOT_GD
-@deffnx {} BFD_RELOC_CRIS_32_GD
-@deffnx {} BFD_RELOC_CRIS_DTP
-@deffnx {} BFD_RELOC_CRIS_32_DTPREL
-@deffnx {} BFD_RELOC_CRIS_16_DTPREL
-@deffnx {} BFD_RELOC_CRIS_32_GOT_TPREL
-@deffnx {} BFD_RELOC_CRIS_16_GOT_TPREL
-@deffnx {} BFD_RELOC_CRIS_32_TPREL
-@deffnx {} BFD_RELOC_CRIS_16_TPREL
-@deffnx {} BFD_RELOC_CRIS_DTPMOD
-@deffnx {} BFD_RELOC_CRIS_32_IE
-Relocs used in TLS code for CRIS.
-@end deffn
-@deffn {} BFD_RELOC_860_COPY
-@deffnx {} BFD_RELOC_860_GLOB_DAT
-@deffnx {} BFD_RELOC_860_JUMP_SLOT
-@deffnx {} BFD_RELOC_860_RELATIVE
-@deffnx {} BFD_RELOC_860_PC26
-@deffnx {} BFD_RELOC_860_PLT26
-@deffnx {} BFD_RELOC_860_PC16
-@deffnx {} BFD_RELOC_860_LOW0
-@deffnx {} BFD_RELOC_860_SPLIT0
-@deffnx {} BFD_RELOC_860_LOW1
-@deffnx {} BFD_RELOC_860_SPLIT1
-@deffnx {} BFD_RELOC_860_LOW2
-@deffnx {} BFD_RELOC_860_SPLIT2
-@deffnx {} BFD_RELOC_860_LOW3
-@deffnx {} BFD_RELOC_860_LOGOT0
-@deffnx {} BFD_RELOC_860_SPGOT0
-@deffnx {} BFD_RELOC_860_LOGOT1
-@deffnx {} BFD_RELOC_860_SPGOT1
-@deffnx {} BFD_RELOC_860_LOGOTOFF0
-@deffnx {} BFD_RELOC_860_SPGOTOFF0
-@deffnx {} BFD_RELOC_860_LOGOTOFF1
-@deffnx {} BFD_RELOC_860_SPGOTOFF1
-@deffnx {} BFD_RELOC_860_LOGOTOFF2
-@deffnx {} BFD_RELOC_860_LOGOTOFF3
-@deffnx {} BFD_RELOC_860_LOPC
-@deffnx {} BFD_RELOC_860_HIGHADJ
-@deffnx {} BFD_RELOC_860_HAGOT
-@deffnx {} BFD_RELOC_860_HAGOTOFF
-@deffnx {} BFD_RELOC_860_HAPC
-@deffnx {} BFD_RELOC_860_HIGH
-@deffnx {} BFD_RELOC_860_HIGOT
-@deffnx {} BFD_RELOC_860_HIGOTOFF
-Intel i860 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_OPENRISC_ABS_26
-@deffnx {} BFD_RELOC_OPENRISC_REL_26
-OpenRISC Relocations.
-@end deffn
-@deffn {} BFD_RELOC_H8_DIR16A8
-@deffnx {} BFD_RELOC_H8_DIR16R8
-@deffnx {} BFD_RELOC_H8_DIR24A8
-@deffnx {} BFD_RELOC_H8_DIR24R8
-@deffnx {} BFD_RELOC_H8_DIR32A16
-H8 elf Relocations.
-@end deffn
-@deffn {} BFD_RELOC_XSTORMY16_REL_12
-@deffnx {} BFD_RELOC_XSTORMY16_12
-@deffnx {} BFD_RELOC_XSTORMY16_24
-@deffnx {} BFD_RELOC_XSTORMY16_FPTR16
-Sony Xstormy16 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_RELC
-Self-describing complex relocations.
-@end deffn
-@deffn {} BFD_RELOC_XC16X_PAG
-@deffnx {} BFD_RELOC_XC16X_POF
-@deffnx {} BFD_RELOC_XC16X_SEG
-@deffnx {} BFD_RELOC_XC16X_SOF
-Infineon Relocations.
-@end deffn
-@deffn {} BFD_RELOC_VAX_GLOB_DAT
-@deffnx {} BFD_RELOC_VAX_JMP_SLOT
-@deffnx {} BFD_RELOC_VAX_RELATIVE
-Relocations used by VAX ELF.
-@end deffn
-@deffn {} BFD_RELOC_MT_PC16
-Morpho MT - 16 bit immediate relocation.
-@end deffn
-@deffn {} BFD_RELOC_MT_HI16
-Morpho MT - Hi 16 bits of an address.
-@end deffn
-@deffn {} BFD_RELOC_MT_LO16
-Morpho MT - Low 16 bits of an address.
-@end deffn
-@deffn {} BFD_RELOC_MT_GNU_VTINHERIT
-Morpho MT - Used to tell the linker which vtable entries are used.
-@end deffn
-@deffn {} BFD_RELOC_MT_GNU_VTENTRY
-Morpho MT - Used to tell the linker which vtable entries are used.
-@end deffn
-@deffn {} BFD_RELOC_MT_PCINSN8
-Morpho MT - 8 bit immediate relocation.
-@end deffn
-@deffn {} BFD_RELOC_MSP430_10_PCREL
-@deffnx {} BFD_RELOC_MSP430_16_PCREL
-@deffnx {} BFD_RELOC_MSP430_16
-@deffnx {} BFD_RELOC_MSP430_16_PCREL_BYTE
-@deffnx {} BFD_RELOC_MSP430_16_BYTE
-@deffnx {} BFD_RELOC_MSP430_2X_PCREL
-@deffnx {} BFD_RELOC_MSP430_RL_PCREL
-msp430 specific relocation codes
-@end deffn
-@deffn {} BFD_RELOC_IQ2000_OFFSET_16
-@deffnx {} BFD_RELOC_IQ2000_OFFSET_21
-@deffnx {} BFD_RELOC_IQ2000_UHI16
-IQ2000 Relocations.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_RTLD
-Special Xtensa relocation used only by PLT entries in ELF shared
-objects to indicate that the runtime linker should set the value
-to one of its own internal functions or data structures.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_GLOB_DAT
-@deffnx {} BFD_RELOC_XTENSA_JMP_SLOT
-@deffnx {} BFD_RELOC_XTENSA_RELATIVE
-Xtensa relocations for ELF shared objects.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_PLT
-Xtensa relocation used in ELF object files for symbols that may require
-PLT entries.  Otherwise, this is just a generic 32-bit relocation.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_DIFF8
-@deffnx {} BFD_RELOC_XTENSA_DIFF16
-@deffnx {} BFD_RELOC_XTENSA_DIFF32
-Xtensa relocations to mark the difference of two local symbols.
-These are only needed to support linker relaxation and can be ignored
-when not relaxing.  The field is set to the value of the difference
-assuming no relaxation.  The relocation encodes the position of the
-first symbol so the linker can determine whether to adjust the field
-value.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_SLOT0_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT1_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT2_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT3_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT4_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT5_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT6_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT7_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT8_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT9_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT10_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT11_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT12_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT13_OP
-@deffnx {} BFD_RELOC_XTENSA_SLOT14_OP
-Generic Xtensa relocations for instruction operands.  Only the slot
-number is encoded in the relocation.  The relocation applies to the
-last PC-relative immediate operand, or if there are no PC-relative
-immediates, to the last immediate operand.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_SLOT0_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT1_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT2_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT3_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT4_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT5_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT6_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT7_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT8_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT9_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT10_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT11_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT12_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT13_ALT
-@deffnx {} BFD_RELOC_XTENSA_SLOT14_ALT
-Alternate Xtensa relocations.  Only the slot is encoded in the
-relocation.  The meaning of these relocations is opcode-specific.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_OP0
-@deffnx {} BFD_RELOC_XTENSA_OP1
-@deffnx {} BFD_RELOC_XTENSA_OP2
-Xtensa relocations for backward compatibility.  These have all been
-replaced by BFD_RELOC_XTENSA_SLOT0_OP.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_ASM_EXPAND
-Xtensa relocation to mark that the assembler expanded the
-instructions from an original target.  The expansion size is
-encoded in the reloc size.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_ASM_SIMPLIFY
-Xtensa relocation to mark that the linker should simplify
-assembler-expanded instructions.  This is commonly used
-internally by the linker after analysis of a
-BFD_RELOC_XTENSA_ASM_EXPAND.
-@end deffn
-@deffn {} BFD_RELOC_XTENSA_TLSDESC_FN
-@deffnx {} BFD_RELOC_XTENSA_TLSDESC_ARG
-@deffnx {} BFD_RELOC_XTENSA_TLS_DTPOFF
-@deffnx {} BFD_RELOC_XTENSA_TLS_TPOFF
-@deffnx {} BFD_RELOC_XTENSA_TLS_FUNC
-@deffnx {} BFD_RELOC_XTENSA_TLS_ARG
-@deffnx {} BFD_RELOC_XTENSA_TLS_CALL
-Xtensa TLS relocations.
-@end deffn
-@deffn {} BFD_RELOC_Z80_DISP8
-8 bit signed offset in (ix+d) or (iy+d).
-@end deffn
-@deffn {} BFD_RELOC_Z8K_DISP7
-DJNZ offset.
-@end deffn
-@deffn {} BFD_RELOC_Z8K_CALLR
-CALR offset.
-@end deffn
-@deffn {} BFD_RELOC_Z8K_IMM4L
-4 bit value.
-@end deffn
-@deffn {} BFD_RELOC_LM32_CALL
-@deffnx {} BFD_RELOC_LM32_BRANCH
-@deffnx {} BFD_RELOC_LM32_16_GOT
-@deffnx {} BFD_RELOC_LM32_GOTOFF_HI16
-@deffnx {} BFD_RELOC_LM32_GOTOFF_LO16
-@deffnx {} BFD_RELOC_LM32_COPY
-@deffnx {} BFD_RELOC_LM32_GLOB_DAT
-@deffnx {} BFD_RELOC_LM32_JMP_SLOT
-@deffnx {} BFD_RELOC_LM32_RELATIVE
-Lattice Mico32 relocations.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_SECTDIFF
-Difference between two section addreses.  Must be followed by a
-BFD_RELOC_MACH_O_PAIR.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_LOCAL_SECTDIFF
-Like BFD_RELOC_MACH_O_SECTDIFF but with a local symbol.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_PAIR
-Pair of relocation.  Contains the first symbol.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_X86_64_BRANCH32
-@deffnx {} BFD_RELOC_MACH_O_X86_64_BRANCH8
-PCREL relocations.  They are marked as branch to create PLT entry if
-required.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_X86_64_GOT
-Used when referencing a GOT entry.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_X86_64_GOT_LOAD
-Used when loading a GOT entry with movq.  It is specially marked so that
-the linker could optimize the movq to a leaq if possible.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_X86_64_SUBTRACTOR32
-Symbol will be substracted.  Must be followed by a BFD_RELOC_64.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_X86_64_SUBTRACTOR64
-Symbol will be substracted.  Must be followed by a BFD_RELOC_64.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_X86_64_PCREL32_1
-Same as BFD_RELOC_32_PCREL but with an implicit -1 addend.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_X86_64_PCREL32_2
-Same as BFD_RELOC_32_PCREL but with an implicit -2 addend.
-@end deffn
-@deffn {} BFD_RELOC_MACH_O_X86_64_PCREL32_4
-Same as BFD_RELOC_32_PCREL but with an implicit -4 addend.
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_32_LO
-This is a 32 bit reloc for the microblaze that stores the 
-low 16 bits of a value
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_32_LO_PCREL
-This is a 32 bit pc-relative reloc for the microblaze that 
-stores the low 16 bits of a value
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_32_ROSDA
-This is a 32 bit reloc for the microblaze that stores a 
-value relative to the read-only small data area anchor
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_32_RWSDA
-This is a 32 bit reloc for the microblaze that stores a 
-value relative to the read-write small data area anchor
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM
-This is a 32 bit reloc for the microblaze to handle 
-expressions of the form "Symbol Op Symbol"
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_64_NONE
-This is a 64 bit reloc that stores the 32 bit pc relative 
-value in two words (with an imm instruction).  No relocation is 
-done here - only used for relaxing
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_64_GOTPC
-This is a 64 bit reloc that stores the 32 bit pc relative 
-value in two words (with an imm instruction).  The relocation is
-PC-relative GOT offset
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_64_GOT
-This is a 64 bit reloc that stores the 32 bit pc relative 
-value in two words (with an imm instruction).  The relocation is
-GOT offset
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_64_PLT
-This is a 64 bit reloc that stores the 32 bit pc relative 
-value in two words (with an imm instruction).  The relocation is
-PC-relative offset into PLT
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_64_GOTOFF
-This is a 64 bit reloc that stores the 32 bit GOT relative 
-value in two words (with an imm instruction).  The relocation is
-relative offset from _GLOBAL_OFFSET_TABLE_
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_32_GOTOFF
-This is a 32 bit reloc that stores the 32 bit GOT relative 
-value in a word.  The relocation is relative offset from
-@end deffn
-@deffn {} BFD_RELOC_MICROBLAZE_COPY
-This is used to tell the dynamic linker to copy the value out of
-the dynamic object into the runtime process image.
-@end deffn
-@deffn {} BFD_RELOC_TILEPRO_COPY
-@deffnx {} BFD_RELOC_TILEPRO_GLOB_DAT
-@deffnx {} BFD_RELOC_TILEPRO_JMP_SLOT
-@deffnx {} BFD_RELOC_TILEPRO_RELATIVE
-@deffnx {} BFD_RELOC_TILEPRO_BROFF_X1
-@deffnx {} BFD_RELOC_TILEPRO_JOFFLONG_X1
-@deffnx {} BFD_RELOC_TILEPRO_JOFFLONG_X1_PLT
-@deffnx {} BFD_RELOC_TILEPRO_IMM8_X0
-@deffnx {} BFD_RELOC_TILEPRO_IMM8_Y0
-@deffnx {} BFD_RELOC_TILEPRO_IMM8_X1
-@deffnx {} BFD_RELOC_TILEPRO_IMM8_Y1
-@deffnx {} BFD_RELOC_TILEPRO_DEST_IMM8_X1
-@deffnx {} BFD_RELOC_TILEPRO_MT_IMM15_X1
-@deffnx {} BFD_RELOC_TILEPRO_MF_IMM15_X1
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_HA
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_HA
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_PCREL
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_PCREL
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_LO_PCREL
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_LO_PCREL
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_HI_PCREL
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_HI_PCREL
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_HA_PCREL
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_HA_PCREL
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_GOT
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_GOT
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_GOT_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_GOT_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_GOT_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_GOT_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_GOT_HA
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_GOT_HA
-@deffnx {} BFD_RELOC_TILEPRO_MMSTART_X0
-@deffnx {} BFD_RELOC_TILEPRO_MMEND_X0
-@deffnx {} BFD_RELOC_TILEPRO_MMSTART_X1
-@deffnx {} BFD_RELOC_TILEPRO_MMEND_X1
-@deffnx {} BFD_RELOC_TILEPRO_SHAMT_X0
-@deffnx {} BFD_RELOC_TILEPRO_SHAMT_X1
-@deffnx {} BFD_RELOC_TILEPRO_SHAMT_Y0
-@deffnx {} BFD_RELOC_TILEPRO_SHAMT_Y1
-@deffnx {} BFD_RELOC_TILEPRO_TLS_GD_CALL
-@deffnx {} BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD
-@deffnx {} BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD
-@deffnx {} BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD
-@deffnx {} BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD
-@deffnx {} BFD_RELOC_TILEPRO_TLS_IE_LOAD
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HA
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HA
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HA
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HA
-@deffnx {} BFD_RELOC_TILEPRO_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_TILEPRO_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_TILEPRO_TLS_TPOFF32
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_LO
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HI
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA
-@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA
-Tilera TILEPro Relocations.
-@end deffn
-@deffn {} BFD_RELOC_TILEGX_HW0
-@deffnx {} BFD_RELOC_TILEGX_HW1
-@deffnx {} BFD_RELOC_TILEGX_HW2
-@deffnx {} BFD_RELOC_TILEGX_HW3
-@deffnx {} BFD_RELOC_TILEGX_HW0_LAST
-@deffnx {} BFD_RELOC_TILEGX_HW1_LAST
-@deffnx {} BFD_RELOC_TILEGX_HW2_LAST
-@deffnx {} BFD_RELOC_TILEGX_COPY
-@deffnx {} BFD_RELOC_TILEGX_GLOB_DAT
-@deffnx {} BFD_RELOC_TILEGX_JMP_SLOT
-@deffnx {} BFD_RELOC_TILEGX_RELATIVE
-@deffnx {} BFD_RELOC_TILEGX_BROFF_X1
-@deffnx {} BFD_RELOC_TILEGX_JUMPOFF_X1
-@deffnx {} BFD_RELOC_TILEGX_JUMPOFF_X1_PLT
-@deffnx {} BFD_RELOC_TILEGX_IMM8_X0
-@deffnx {} BFD_RELOC_TILEGX_IMM8_Y0
-@deffnx {} BFD_RELOC_TILEGX_IMM8_X1
-@deffnx {} BFD_RELOC_TILEGX_IMM8_Y1
-@deffnx {} BFD_RELOC_TILEGX_DEST_IMM8_X1
-@deffnx {} BFD_RELOC_TILEGX_MT_IMM14_X1
-@deffnx {} BFD_RELOC_TILEGX_MF_IMM14_X1
-@deffnx {} BFD_RELOC_TILEGX_MMSTART_X0
-@deffnx {} BFD_RELOC_TILEGX_MMEND_X0
-@deffnx {} BFD_RELOC_TILEGX_SHAMT_X0
-@deffnx {} BFD_RELOC_TILEGX_SHAMT_X1
-@deffnx {} BFD_RELOC_TILEGX_SHAMT_Y0
-@deffnx {} BFD_RELOC_TILEGX_SHAMT_Y1
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW3
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW3
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW3_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW3_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PCREL
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_GOT
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_GOT
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_GOT
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_GOT
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_GOT
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_GOT
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_GD
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_GD
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_LE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_IE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_IE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
-@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
-@deffnx {} BFD_RELOC_TILEGX_TLS_DTPMOD64
-@deffnx {} BFD_RELOC_TILEGX_TLS_DTPOFF64
-@deffnx {} BFD_RELOC_TILEGX_TLS_TPOFF64
-@deffnx {} BFD_RELOC_TILEGX_TLS_DTPMOD32
-@deffnx {} BFD_RELOC_TILEGX_TLS_DTPOFF32
-@deffnx {} BFD_RELOC_TILEGX_TLS_TPOFF32
-@deffnx {} BFD_RELOC_TILEGX_TLS_GD_CALL
-@deffnx {} BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD
-@deffnx {} BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD
-@deffnx {} BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD
-@deffnx {} BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD
-@deffnx {} BFD_RELOC_TILEGX_TLS_IE_LOAD
-@deffnx {} BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD
-@deffnx {} BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD
-@deffnx {} BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD
-@deffnx {} BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD
-Tilera TILE-Gx Relocations.
-@end deffn
-@deffn {} BFD_RELOC_EPIPHANY_SIMM8
-Adapteva EPIPHANY - 8 bit signed pc-relative displacement
-@end deffn
-@deffn {} BFD_RELOC_EPIPHANY_SIMM24
-Adapteva EPIPHANY - 24 bit signed pc-relative displacement
-@end deffn
-@deffn {} BFD_RELOC_EPIPHANY_HIGH
-Adapteva EPIPHANY - 16 most-significant bits of absolute address
-@end deffn
-@deffn {} BFD_RELOC_EPIPHANY_LOW
-Adapteva EPIPHANY - 16 least-significant bits of absolute address
-@end deffn
-@deffn {} BFD_RELOC_EPIPHANY_SIMM11
-Adapteva EPIPHANY - 11 bit signed number - add/sub immediate
-@end deffn
-@deffn {} BFD_RELOC_EPIPHANY_IMM11
-Adapteva EPIPHANY - 11 bit sign-magnitude number (ld/st displacement)
-@end deffn
-@deffn {} BFD_RELOC_EPIPHANY_IMM8
-Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction.
-@end deffn
-
-@example
-
-typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
-@end example
-@findex bfd_reloc_type_lookup
-@subsubsection @code{bfd_reloc_type_lookup}
-@strong{Synopsis}
-@example
-reloc_howto_type *bfd_reloc_type_lookup
-   (bfd *abfd, bfd_reloc_code_real_type code);
-reloc_howto_type *bfd_reloc_name_lookup
-   (bfd *abfd, const char *reloc_name);
-@end example
-@strong{Description}@*
-Return a pointer to a howto structure which, when
-invoked, will perform the relocation @var{code} on data from the
-architecture noted.
-
-@findex bfd_default_reloc_type_lookup
-@subsubsection @code{bfd_default_reloc_type_lookup}
-@strong{Synopsis}
-@example
-reloc_howto_type *bfd_default_reloc_type_lookup
-   (bfd *abfd, bfd_reloc_code_real_type  code);
-@end example
-@strong{Description}@*
-Provides a default relocation lookup routine for any architecture.
-
-@findex bfd_get_reloc_code_name
-@subsubsection @code{bfd_get_reloc_code_name}
-@strong{Synopsis}
-@example
-const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
-@end example
-@strong{Description}@*
-Provides a printable name for the supplied relocation code.
-Useful mainly for printing error messages.
-
-@findex bfd_generic_relax_section
-@subsubsection @code{bfd_generic_relax_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_relax_section
-   (bfd *abfd,
-    asection *section,
-    struct bfd_link_info *,
-    bfd_boolean *);
-@end example
-@strong{Description}@*
-Provides default handling for relaxing for back ends which
-don't do relaxing.
-
-@findex bfd_generic_gc_sections
-@subsubsection @code{bfd_generic_gc_sections}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_gc_sections
-   (bfd *, struct bfd_link_info *);
-@end example
-@strong{Description}@*
-Provides default handling for relaxing for back ends which
-don't do section gc -- i.e., does nothing.
-
-@findex bfd_generic_lookup_section_flags
-@subsubsection @code{bfd_generic_lookup_section_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_lookup_section_flags
-   (struct bfd_link_info *, struct flag_info *, asection *);
-@end example
-@strong{Description}@*
-Provides default handling for section flags lookup
--- i.e., does nothing.
-Returns FALSE if the section should be omitted, otherwise TRUE.
-
-@findex bfd_generic_merge_sections
-@subsubsection @code{bfd_generic_merge_sections}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_merge_sections
-   (bfd *, struct bfd_link_info *);
-@end example
-@strong{Description}@*
-Provides default handling for SEC_MERGE section merging for back ends
-which don't have SEC_MERGE support -- i.e., does nothing.
-
-@findex bfd_generic_get_relocated_section_contents
-@subsubsection @code{bfd_generic_get_relocated_section_contents}
-@strong{Synopsis}
-@example
-bfd_byte *bfd_generic_get_relocated_section_contents
-   (bfd *abfd,
-    struct bfd_link_info *link_info,
-    struct bfd_link_order *link_order,
-    bfd_byte *data,
-    bfd_boolean relocatable,
-    asymbol **symbols);
-@end example
-@strong{Description}@*
-Provides default handling of relocation effort for back ends
-which can't be bothered to do it efficiently.
-
diff --git a/bfd/doc/section.texi b/bfd/doc/section.texi
deleted file mode 100644
index cc6ee94..0000000
--- a/bfd/doc/section.texi
+++ /dev/null
@@ -1,1035 +0,0 @@
-@section Sections
-The raw data contained within a BFD is maintained through the
-section abstraction.  A single BFD may have any number of
-sections.  It keeps hold of them by pointing to the first;
-each one points to the next in the list.
-
-Sections are supported in BFD in @code{section.c}.
-
-@menu
-* Section Input::
-* Section Output::
-* typedef asection::
-* section prototypes::
-@end menu
-
-@node Section Input, Section Output, Sections, Sections
-@subsection Section input
-When a BFD is opened for reading, the section structures are
-created and attached to the BFD.
-
-Each section has a name which describes the section in the
-outside world---for example, @code{a.out} would contain at least
-three sections, called @code{.text}, @code{.data} and @code{.bss}.
-
-Names need not be unique; for example a COFF file may have several
-sections named @code{.data}.
-
-Sometimes a BFD will contain more than the ``natural'' number of
-sections. A back end may attach other sections containing
-constructor data, or an application may add a section (using
-@code{bfd_make_section}) to the sections attached to an already open
-BFD. For example, the linker creates an extra section
-@code{COMMON} for each input file's BFD to hold information about
-common storage.
-
-The raw data is not necessarily read in when
-the section descriptor is created. Some targets may leave the
-data in place until a @code{bfd_get_section_contents} call is
-made. Other back ends may read in all the data at once.  For
-example, an S-record file has to be read once to determine the
-size of the data. An IEEE-695 file doesn't contain raw data in
-sections, but data and relocation expressions intermixed, so
-the data area has to be parsed to get out the data and
-relocations.
-
-@node Section Output, typedef asection, Section Input, Sections
-@subsection Section output
-To write a new object style BFD, the various sections to be
-written have to be created. They are attached to the BFD in
-the same way as input sections; data is written to the
-sections using @code{bfd_set_section_contents}.
-
-Any program that creates or combines sections (e.g., the assembler
-and linker) must use the @code{asection} fields @code{output_section} and
-@code{output_offset} to indicate the file sections to which each
-section must be written.  (If the section is being created from
-scratch, @code{output_section} should probably point to the section
-itself and @code{output_offset} should probably be zero.)
-
-The data to be written comes from input sections attached
-(via @code{output_section} pointers) to
-the output sections.  The output section structure can be
-considered a filter for the input section: the output section
-determines the vma of the output data and the name, but the
-input section determines the offset into the output section of
-the data to be written.
-
-E.g., to create a section "O", starting at 0x100, 0x123 long,
-containing two subsections, "A" at offset 0x0 (i.e., at vma
-0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the @code{asection}
-structures would look like:
-
-@example
-   section name          "A"
-     output_offset   0x00
-     size            0x20
-     output_section ----------->  section name    "O"
-                             |    vma             0x100
-   section name          "B" |    size            0x123
-     output_offset   0x20    |
-     size            0x103   |
-     output_section  --------|
-@end example
-
-@subsection Link orders
-The data within a section is stored in a @dfn{link_order}.
-These are much like the fixups in @code{gas}.  The link_order
-abstraction allows a section to grow and shrink within itself.
-
-A link_order knows how big it is, and which is the next
-link_order and where the raw data for it is; it also points to
-a list of relocations which apply to it.
-
-The link_order is used by the linker to perform relaxing on
-final code.  The compiler creates code which is as big as
-necessary to make it work without relaxing, and the user can
-select whether to relax.  Sometimes relaxing takes a lot of
-time.  The linker runs around the relocations to see if any
-are attached to data which can be shrunk, if so it does it on
-a link_order by link_order basis.
-
-
-@node typedef asection, section prototypes, Section Output, Sections
-@subsection typedef asection
-Here is the section structure:
-
-
-@example
-
-typedef struct bfd_section
-@{
-  /* The name of the section; the name isn't a copy, the pointer is
-     the same as that passed to bfd_make_section.  */
-  const char *name;
-
-  /* A unique sequence number.  */
-  int id;
-
-  /* Which section in the bfd; 0..n-1 as sections are created in a bfd.  */
-  int index;
-
-  /* The next section in the list belonging to the BFD, or NULL.  */
-  struct bfd_section *next;
-
-  /* The previous section in the list belonging to the BFD, or NULL.  */
-  struct bfd_section *prev;
-
-  /* The field flags contains attributes of the section. Some
-     flags are read in from the object file, and some are
-     synthesized from other information.  */
-  flagword flags;
-
-#define SEC_NO_FLAGS   0x000
-
-  /* Tells the OS to allocate space for this section when loading.
-     This is clear for a section containing debug information only.  */
-#define SEC_ALLOC      0x001
-
-  /* Tells the OS to load the section from the file when loading.
-     This is clear for a .bss section.  */
-#define SEC_LOAD       0x002
-
-  /* The section contains data still to be relocated, so there is
-     some relocation information too.  */
-#define SEC_RELOC      0x004
-
-  /* A signal to the OS that the section contains read only data.  */
-#define SEC_READONLY   0x008
-
-  /* The section contains code only.  */
-#define SEC_CODE       0x010
-
-  /* The section contains data only.  */
-#define SEC_DATA       0x020
-
-  /* The section will reside in ROM.  */
-#define SEC_ROM        0x040
-
-  /* The section contains constructor information. This section
-     type is used by the linker to create lists of constructors and
-     destructors used by @code{g++}. When a back end sees a symbol
-     which should be used in a constructor list, it creates a new
-     section for the type of name (e.g., @code{__CTOR_LIST__}), attaches
-     the symbol to it, and builds a relocation. To build the lists
-     of constructors, all the linker has to do is catenate all the
-     sections called @code{__CTOR_LIST__} and relocate the data
-     contained within - exactly the operations it would peform on
-     standard data.  */
-#define SEC_CONSTRUCTOR 0x080
-
-  /* The section has contents - a data section could be
-     @code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be
-     @code{SEC_HAS_CONTENTS}  */
-#define SEC_HAS_CONTENTS 0x100
-
-  /* An instruction to the linker to not output the section
-     even if it has information which would normally be written.  */
-#define SEC_NEVER_LOAD 0x200
-
-  /* The section contains thread local data.  */
-#define SEC_THREAD_LOCAL 0x400
-
-  /* The section has GOT references.  This flag is only for the
-     linker, and is currently only used by the elf32-hppa back end.
-     It will be set if global offset table references were detected
-     in this section, which indicate to the linker that the section
-     contains PIC code, and must be handled specially when doing a
-     static link.  */
-#define SEC_HAS_GOT_REF 0x800
-
-  /* The section contains common symbols (symbols may be defined
-     multiple times, the value of a symbol is the amount of
-     space it requires, and the largest symbol value is the one
-     used).  Most targets have exactly one of these (which we
-     translate to bfd_com_section_ptr), but ECOFF has two.  */
-#define SEC_IS_COMMON 0x1000
-
-  /* The section contains only debugging information.  For
-     example, this is set for ELF .debug and .stab sections.
-     strip tests this flag to see if a section can be
-     discarded.  */
-#define SEC_DEBUGGING 0x2000
-
-  /* The contents of this section are held in memory pointed to
-     by the contents field.  This is checked by bfd_get_section_contents,
-     and the data is retrieved from memory if appropriate.  */
-#define SEC_IN_MEMORY 0x4000
-
-  /* The contents of this section are to be excluded by the
-     linker for executable and shared objects unless those
-     objects are to be further relocated.  */
-#define SEC_EXCLUDE 0x8000
-
-  /* The contents of this section are to be sorted based on the sum of
-     the symbol and addend values specified by the associated relocation
-     entries.  Entries without associated relocation entries will be
-     appended to the end of the section in an unspecified order.  */
-#define SEC_SORT_ENTRIES 0x10000
-
-  /* When linking, duplicate sections of the same name should be
-     discarded, rather than being combined into a single section as
-     is usually done.  This is similar to how common symbols are
-     handled.  See SEC_LINK_DUPLICATES below.  */
-#define SEC_LINK_ONCE 0x20000
-
-  /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
-     should handle duplicate sections.  */
-#define SEC_LINK_DUPLICATES 0xc0000
-
-  /* This value for SEC_LINK_DUPLICATES means that duplicate
-     sections with the same name should simply be discarded.  */
-#define SEC_LINK_DUPLICATES_DISCARD 0x0
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if there are any duplicate sections, although
-     it should still only link one copy.  */
-#define SEC_LINK_DUPLICATES_ONE_ONLY 0x40000
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if any duplicate sections are a different size.  */
-#define SEC_LINK_DUPLICATES_SAME_SIZE 0x80000
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if any duplicate sections contain different
-     contents.  */
-#define SEC_LINK_DUPLICATES_SAME_CONTENTS \
-  (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
-
-  /* This section was created by the linker as part of dynamic
-     relocation or other arcane processing.  It is skipped when
-     going through the first-pass output, trusting that someone
-     else up the line will take care of it later.  */
-#define SEC_LINKER_CREATED 0x100000
-
-  /* This section should not be subject to garbage collection.
-     Also set to inform the linker that this section should not be
-     listed in the link map as discarded.  */
-#define SEC_KEEP 0x200000
-
-  /* This section contains "short" data, and should be placed
-     "near" the GP.  */
-#define SEC_SMALL_DATA 0x400000
-
-  /* Attempt to merge identical entities in the section.
-     Entity size is given in the entsize field.  */
-#define SEC_MERGE 0x800000
-
-  /* If given with SEC_MERGE, entities to merge are zero terminated
-     strings where entsize specifies character size instead of fixed
-     size entries.  */
-#define SEC_STRINGS 0x1000000
-
-  /* This section contains data about section groups.  */
-#define SEC_GROUP 0x2000000
-
-  /* The section is a COFF shared library section.  This flag is
-     only for the linker.  If this type of section appears in
-     the input file, the linker must copy it to the output file
-     without changing the vma or size.  FIXME: Although this
-     was originally intended to be general, it really is COFF
-     specific (and the flag was renamed to indicate this).  It
-     might be cleaner to have some more general mechanism to
-     allow the back end to control what the linker does with
-     sections.  */
-#define SEC_COFF_SHARED_LIBRARY 0x4000000
-
-  /* This input section should be copied to output in reverse order
-     as an array of pointers.  This is for ELF linker internal use
-     only.  */
-#define SEC_ELF_REVERSE_COPY 0x4000000
-
-  /* This section contains data which may be shared with other
-     executables or shared objects. This is for COFF only.  */
-#define SEC_COFF_SHARED 0x8000000
-
-  /* When a section with this flag is being linked, then if the size of
-     the input section is less than a page, it should not cross a page
-     boundary.  If the size of the input section is one page or more,
-     it should be aligned on a page boundary.  This is for TI
-     TMS320C54X only.  */
-#define SEC_TIC54X_BLOCK 0x10000000
-
-  /* Conditionally link this section; do not link if there are no
-     references found to any symbol in the section.  This is for TI
-     TMS320C54X only.  */
-#define SEC_TIC54X_CLINK 0x20000000
-
-  /* Indicate that section has the no read flag set. This happens
-     when memory read flag isn't set. */
-#define SEC_COFF_NOREAD 0x40000000
-
-  /*  End of section flags.  */
-
-  /* Some internal packed boolean fields.  */
-
-  /* See the vma field.  */
-  unsigned int user_set_vma : 1;
-
-  /* A mark flag used by some of the linker backends.  */
-  unsigned int linker_mark : 1;
-
-  /* Another mark flag used by some of the linker backends.  Set for
-     output sections that have an input section.  */
-  unsigned int linker_has_input : 1;
-
-  /* Mark flag used by some linker backends for garbage collection.  */
-  unsigned int gc_mark : 1;
-
-  /* Section compression status.  */
-  unsigned int compress_status : 2;
-#define COMPRESS_SECTION_NONE    0
-#define COMPRESS_SECTION_DONE    1
-#define DECOMPRESS_SECTION_SIZED 2
-
-  /* The following flags are used by the ELF linker. */
-
-  /* Mark sections which have been allocated to segments.  */
-  unsigned int segment_mark : 1;
-
-  /* Type of sec_info information.  */
-  unsigned int sec_info_type:3;
-#define SEC_INFO_TYPE_NONE      0
-#define SEC_INFO_TYPE_STABS     1
-#define SEC_INFO_TYPE_MERGE     2
-#define SEC_INFO_TYPE_EH_FRAME  3
-#define SEC_INFO_TYPE_JUST_SYMS 4
-
-  /* Nonzero if this section uses RELA relocations, rather than REL.  */
-  unsigned int use_rela_p:1;
-
-  /* Bits used by various backends.  The generic code doesn't touch
-     these fields.  */
-
-  unsigned int sec_flg0:1;
-  unsigned int sec_flg1:1;
-  unsigned int sec_flg2:1;
-  unsigned int sec_flg3:1;
-  unsigned int sec_flg4:1;
-  unsigned int sec_flg5:1;
-
-  /* End of internal packed boolean fields.  */
-
-  /*  The virtual memory address of the section - where it will be
-      at run time.  The symbols are relocated against this.  The
-      user_set_vma flag is maintained by bfd; if it's not set, the
-      backend can assign addresses (for example, in @code{a.out}, where
-      the default address for @code{.data} is dependent on the specific
-      target and various flags).  */
-  bfd_vma vma;
-
-  /*  The load address of the section - where it would be in a
-      rom image; really only used for writing section header
-      information.  */
-  bfd_vma lma;
-
-  /* The size of the section in octets, as it will be output.
-     Contains a value even if the section has no contents (e.g., the
-     size of @code{.bss}).  */
-  bfd_size_type size;
-
-  /* For input sections, the original size on disk of the section, in
-     octets.  This field should be set for any section whose size is
-     changed by linker relaxation.  It is required for sections where
-     the linker relaxation scheme doesn't cache altered section and
-     reloc contents (stabs, eh_frame, SEC_MERGE, some coff relaxing
-     targets), and thus the original size needs to be kept to read the
-     section multiple times.  For output sections, rawsize holds the
-     section size calculated on a previous linker relaxation pass.  */
-  bfd_size_type rawsize;
-
-  /* The compressed size of the section in octets.  */
-  bfd_size_type compressed_size;
-
-  /* Relaxation table. */
-  struct relax_table *relax;
-
-  /* Count of used relaxation table entries. */
-  int relax_count;
-
-
-  /* If this section is going to be output, then this value is the
-     offset in *bytes* into the output section of the first byte in the
-     input section (byte ==> smallest addressable unit on the
-     target).  In most cases, if this was going to start at the
-     100th octet (8-bit quantity) in the output section, this value
-     would be 100.  However, if the target byte size is 16 bits
-     (bfd_octets_per_byte is "2"), this value would be 50.  */
-  bfd_vma output_offset;
-
-  /* The output section through which to map on output.  */
-  struct bfd_section *output_section;
-
-  /* The alignment requirement of the section, as an exponent of 2 -
-     e.g., 3 aligns to 2^3 (or 8).  */
-  unsigned int alignment_power;
-
-  /* If an input section, a pointer to a vector of relocation
-     records for the data in this section.  */
-  struct reloc_cache_entry *relocation;
-
-  /* If an output section, a pointer to a vector of pointers to
-     relocation records for the data in this section.  */
-  struct reloc_cache_entry **orelocation;
-
-  /* The number of relocation records in one of the above.  */
-  unsigned reloc_count;
-
-  /* Information below is back end specific - and not always used
-     or updated.  */
-
-  /* File position of section data.  */
-  file_ptr filepos;
-
-  /* File position of relocation info.  */
-  file_ptr rel_filepos;
-
-  /* File position of line data.  */
-  file_ptr line_filepos;
-
-  /* Pointer to data for applications.  */
-  void *userdata;
-
-  /* If the SEC_IN_MEMORY flag is set, this points to the actual
-     contents.  */
-  unsigned char *contents;
-
-  /* Attached line number information.  */
-  alent *lineno;
-
-  /* Number of line number records.  */
-  unsigned int lineno_count;
-
-  /* Entity size for merging purposes.  */
-  unsigned int entsize;
-
-  /* Points to the kept section if this section is a link-once section,
-     and is discarded.  */
-  struct bfd_section *kept_section;
-
-  /* When a section is being output, this value changes as more
-     linenumbers are written out.  */
-  file_ptr moving_line_filepos;
-
-  /* What the section number is in the target world.  */
-  int target_index;
-
-  void *used_by_bfd;
-
-  /* If this is a constructor section then here is a list of the
-     relocations created to relocate items within it.  */
-  struct relent_chain *constructor_chain;
-
-  /* The BFD which owns the section.  */
-  bfd *owner;
-
-  /* A symbol which points at this section only.  */
-  struct bfd_symbol *symbol;
-  struct bfd_symbol **symbol_ptr_ptr;
-
-  /* Early in the link process, map_head and map_tail are used to build
-     a list of input sections attached to an output section.  Later,
-     output sections use these fields for a list of bfd_link_order
-     structs.  */
-  union @{
-    struct bfd_link_order *link_order;
-    struct bfd_section *s;
-  @} map_head, map_tail;
-@} asection;
-
-/* Relax table contains information about instructions which can
-   be removed by relaxation -- replacing a long address with a 
-   short address.  */
-struct relax_table @{
-  /* Address where bytes may be deleted. */
-  bfd_vma addr;
-  
-  /* Number of bytes to be deleted.  */
-  int size;
-@};
-
-/* These sections are global, and are managed by BFD.  The application
-   and target back end are not permitted to change the values in
-   these sections.  */
-extern asection std_section[4];
-
-#define BFD_ABS_SECTION_NAME "*ABS*"
-#define BFD_UND_SECTION_NAME "*UND*"
-#define BFD_COM_SECTION_NAME "*COM*"
-#define BFD_IND_SECTION_NAME "*IND*"
-
-/* Pointer to the common section.  */
-#define bfd_com_section_ptr (&std_section[0])
-/* Pointer to the undefined section.  */
-#define bfd_und_section_ptr (&std_section[1])
-/* Pointer to the absolute section.  */
-#define bfd_abs_section_ptr (&std_section[2])
-/* Pointer to the indirect section.  */
-#define bfd_ind_section_ptr (&std_section[3])
-
-#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
-
-#define bfd_is_const_section(SEC)              \
- (   ((SEC) == bfd_abs_section_ptr)            \
-  || ((SEC) == bfd_und_section_ptr)            \
-  || ((SEC) == bfd_com_section_ptr)            \
-  || ((SEC) == bfd_ind_section_ptr))
-
-/* Macros to handle insertion and deletion of a bfd's sections.  These
-   only handle the list pointers, ie. do not adjust section_count,
-   target_index etc.  */
-#define bfd_section_list_remove(ABFD, S) \
-  do                                                   \
-    @{                                                  \
-      asection *_s = S;                                \
-      asection *_next = _s->next;                      \
-      asection *_prev = _s->prev;                      \
-      if (_prev)                                       \
-        _prev->next = _next;                           \
-      else                                             \
-        (ABFD)->sections = _next;                      \
-      if (_next)                                       \
-        _next->prev = _prev;                           \
-      else                                             \
-        (ABFD)->section_last = _prev;                  \
-    @}                                                  \
-  while (0)
-#define bfd_section_list_append(ABFD, S) \
-  do                                                   \
-    @{                                                  \
-      asection *_s = S;                                \
-      bfd *_abfd = ABFD;                               \
-      _s->next = NULL;                                 \
-      if (_abfd->section_last)                         \
-        @{                                              \
-          _s->prev = _abfd->section_last;              \
-          _abfd->section_last->next = _s;              \
-        @}                                              \
-      else                                             \
-        @{                                              \
-          _s->prev = NULL;                             \
-          _abfd->sections = _s;                        \
-        @}                                              \
-      _abfd->section_last = _s;                        \
-    @}                                                  \
-  while (0)
-#define bfd_section_list_prepend(ABFD, S) \
-  do                                                   \
-    @{                                                  \
-      asection *_s = S;                                \
-      bfd *_abfd = ABFD;                               \
-      _s->prev = NULL;                                 \
-      if (_abfd->sections)                             \
-        @{                                              \
-          _s->next = _abfd->sections;                  \
-          _abfd->sections->prev = _s;                  \
-        @}                                              \
-      else                                             \
-        @{                                              \
-          _s->next = NULL;                             \
-          _abfd->section_last = _s;                    \
-        @}                                              \
-      _abfd->sections = _s;                            \
-    @}                                                  \
-  while (0)
-#define bfd_section_list_insert_after(ABFD, A, S) \
-  do                                                   \
-    @{                                                  \
-      asection *_a = A;                                \
-      asection *_s = S;                                \
-      asection *_next = _a->next;                      \
-      _s->next = _next;                                \
-      _s->prev = _a;                                   \
-      _a->next = _s;                                   \
-      if (_next)                                       \
-        _next->prev = _s;                              \
-      else                                             \
-        (ABFD)->section_last = _s;                     \
-    @}                                                  \
-  while (0)
-#define bfd_section_list_insert_before(ABFD, B, S) \
-  do                                                   \
-    @{                                                  \
-      asection *_b = B;                                \
-      asection *_s = S;                                \
-      asection *_prev = _b->prev;                      \
-      _s->prev = _prev;                                \
-      _s->next = _b;                                   \
-      _b->prev = _s;                                   \
-      if (_prev)                                       \
-        _prev->next = _s;                              \
-      else                                             \
-        (ABFD)->sections = _s;                         \
-    @}                                                  \
-  while (0)
-#define bfd_section_removed_from_list(ABFD, S) \
-  ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
-
-#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX)                   \
-  /* name, id,  index, next, prev, flags, user_set_vma,            */  \
-  @{ NAME,  IDX, 0,     NULL, NULL, FLAGS, 0,                           \
-                                                                       \
-  /* linker_mark, linker_has_input, gc_mark, decompress_status,    */  \
-     0,           0,                1,       0,                        \
-                                                                       \
-  /* segment_mark, sec_info_type, use_rela_p,                      */  \
-     0,            0,             0,                                   \
-                                                                       \
-  /* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5,   */  \
-     0,        0,        0,        0,        0,        0,              \
-                                                                       \
-  /* vma, lma, size, rawsize, compressed_size, relax, relax_count, */  \
-     0,   0,   0,    0,       0,               0,     0,               \
-                                                                       \
-  /* output_offset, output_section, alignment_power,               */  \
-     0,             &SEC,           0,                                 \
-                                                                       \
-  /* relocation, orelocation, reloc_count, filepos, rel_filepos,   */  \
-     NULL,       NULL,        0,           0,       0,                 \
-                                                                       \
-  /* line_filepos, userdata, contents, lineno, lineno_count,       */  \
-     0,            NULL,     NULL,     NULL,   0,                      \
-                                                                       \
-  /* entsize, kept_section, moving_line_filepos,                    */ \
-     0,       NULL,          0,                                        \
-                                                                       \
-  /* target_index, used_by_bfd, constructor_chain, owner,          */  \
-     0,            NULL,        NULL,              NULL,               \
-                                                                       \
-  /* symbol,                    symbol_ptr_ptr,                    */  \
-     (struct bfd_symbol *) SYM, &SEC.symbol,                           \
-                                                                       \
-  /* map_head, map_tail                                            */  \
-     @{ NULL @}, @{ NULL @}                                                \
-    @}
-
-@end example
-
-@node section prototypes,  , typedef asection, Sections
-@subsection Section prototypes
-These are the functions exported by the section handling part of BFD.
-
-@findex bfd_section_list_clear
-@subsubsection @code{bfd_section_list_clear}
-@strong{Synopsis}
-@example
-void bfd_section_list_clear (bfd *);
-@end example
-@strong{Description}@*
-Clears the section list, and also resets the section count and
-hash table entries.
-
-@findex bfd_get_section_by_name
-@subsubsection @code{bfd_get_section_by_name}
-@strong{Synopsis}
-@example
-asection *bfd_get_section_by_name (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Return the most recently created section attached to @var{abfd}
-named @var{name}.  Return NULL if no such section exists.
-
-@findex bfd_get_next_section_by_name
-@subsubsection @code{bfd_get_next_section_by_name}
-@strong{Synopsis}
-@example
-asection *bfd_get_next_section_by_name (asection *sec);
-@end example
-@strong{Description}@*
-Given @var{sec} is a section returned by @code{bfd_get_section_by_name},
-return the next most recently created section attached to the same
-BFD with the same name.  Return NULL if no such section exists.
-
-@findex bfd_get_linker_section
-@subsubsection @code{bfd_get_linker_section}
-@strong{Synopsis}
-@example
-asection *bfd_get_linker_section (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Return the linker created section attached to @var{abfd}
-named @var{name}.  Return NULL if no such section exists.
-
-@findex bfd_get_section_by_name_if
-@subsubsection @code{bfd_get_section_by_name_if}
-@strong{Synopsis}
-@example
-asection *bfd_get_section_by_name_if
-   (bfd *abfd,
-    const char *name,
-    bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
-    void *obj);
-@end example
-@strong{Description}@*
-Call the provided function @var{func} for each section
-attached to the BFD @var{abfd} whose name matches @var{name},
-passing @var{obj} as an argument. The function will be called
-as if by
-
-@example
-       func (abfd, the_section, obj);
-@end example
-
-It returns the first section for which @var{func} returns true,
-otherwise @code{NULL}.
-
-@findex bfd_get_unique_section_name
-@subsubsection @code{bfd_get_unique_section_name}
-@strong{Synopsis}
-@example
-char *bfd_get_unique_section_name
-   (bfd *abfd, const char *templat, int *count);
-@end example
-@strong{Description}@*
-Invent a section name that is unique in @var{abfd} by tacking
-a dot and a digit suffix onto the original @var{templat}.  If
-@var{count} is non-NULL, then it specifies the first number
-tried as a suffix to generate a unique name.  The value
-pointed to by @var{count} will be incremented in this case.
-
-@findex bfd_make_section_old_way
-@subsubsection @code{bfd_make_section_old_way}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_old_way (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Create a new empty section called @var{name}
-and attach it to the end of the chain of sections for the
-BFD @var{abfd}. An attempt to create a section with a name which
-is already in use returns its pointer without changing the
-section chain.
-
-It has the funny name since this is the way it used to be
-before it was rewritten....
-
-Possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-If output has already started for this BFD.
-@item
-@code{bfd_error_no_memory} -
-If memory allocation fails.
-@end itemize
-
-@findex bfd_make_section_anyway_with_flags
-@subsubsection @code{bfd_make_section_anyway_with_flags}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_anyway_with_flags
-   (bfd *abfd, const char *name, flagword flags);
-@end example
-@strong{Description}@*
-Create a new empty section called @var{name} and attach it to the end of
-the chain of sections for @var{abfd}.  Create a new section even if there
-is already a section with that name.  Also set the attributes of the
-new section to the value @var{flags}.
-
-Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}.
-@item
-@code{bfd_error_no_memory} - If memory allocation fails.
-@end itemize
-
-@findex bfd_make_section_anyway
-@subsubsection @code{bfd_make_section_anyway}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_anyway (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Create a new empty section called @var{name} and attach it to the end of
-the chain of sections for @var{abfd}.  Create a new section even if there
-is already a section with that name.
-
-Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}.
-@item
-@code{bfd_error_no_memory} - If memory allocation fails.
-@end itemize
-
-@findex bfd_make_section_with_flags
-@subsubsection @code{bfd_make_section_with_flags}
-@strong{Synopsis}
-@example
-asection *bfd_make_section_with_flags
-   (bfd *, const char *name, flagword flags);
-@end example
-@strong{Description}@*
-Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
-bfd_set_error ()) without changing the section chain if there is already a
-section named @var{name}.  Also set the attributes of the new section to
-the value @var{flags}.  If there is an error, return @code{NULL} and set
-@code{bfd_error}.
-
-@findex bfd_make_section
-@subsubsection @code{bfd_make_section}
-@strong{Synopsis}
-@example
-asection *bfd_make_section (bfd *, const char *name);
-@end example
-@strong{Description}@*
-Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
-bfd_set_error ()) without changing the section chain if there is already a
-section named @var{name}.  If there is an error, return @code{NULL} and set
-@code{bfd_error}.
-
-@findex bfd_set_section_flags
-@subsubsection @code{bfd_set_section_flags}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_flags
-   (bfd *abfd, asection *sec, flagword flags);
-@end example
-@strong{Description}@*
-Set the attributes of the section @var{sec} in the BFD
-@var{abfd} to the value @var{flags}. Return @code{TRUE} on success,
-@code{FALSE} on error. Possible error returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-The section cannot have one or more of the attributes
-requested. For example, a .bss section in @code{a.out} may not
-have the @code{SEC_HAS_CONTENTS} field set.
-@end itemize
-
-@findex bfd_rename_section
-@subsubsection @code{bfd_rename_section}
-@strong{Synopsis}
-@example
-void bfd_rename_section
-   (bfd *abfd, asection *sec, const char *newname);
-@end example
-@strong{Description}@*
-Rename section @var{sec} in @var{abfd} to @var{newname}.
-
-@findex bfd_map_over_sections
-@subsubsection @code{bfd_map_over_sections}
-@strong{Synopsis}
-@example
-void bfd_map_over_sections
-   (bfd *abfd,
-    void (*func) (bfd *abfd, asection *sect, void *obj),
-    void *obj);
-@end example
-@strong{Description}@*
-Call the provided function @var{func} for each section
-attached to the BFD @var{abfd}, passing @var{obj} as an
-argument. The function will be called as if by
-
-@example
-       func (abfd, the_section, obj);
-@end example
-
-This is the preferred method for iterating over sections; an
-alternative would be to use a loop:
-
-@example
-          section *p;
-          for (p = abfd->sections; p != NULL; p = p->next)
-             func (abfd, p, ...)
-@end example
-
-@findex bfd_sections_find_if
-@subsubsection @code{bfd_sections_find_if}
-@strong{Synopsis}
-@example
-asection *bfd_sections_find_if
-   (bfd *abfd,
-    bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
-    void *obj);
-@end example
-@strong{Description}@*
-Call the provided function @var{operation} for each section
-attached to the BFD @var{abfd}, passing @var{obj} as an
-argument. The function will be called as if by
-
-@example
-       operation (abfd, the_section, obj);
-@end example
-
-It returns the first section for which @var{operation} returns true.
-
-@findex bfd_set_section_size
-@subsubsection @code{bfd_set_section_size}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_size
-   (bfd *abfd, asection *sec, bfd_size_type val);
-@end example
-@strong{Description}@*
-Set @var{sec} to the size @var{val}. If the operation is
-ok, then @code{TRUE} is returned, else @code{FALSE}.
-
-Possible error returns:
-@itemize @bullet
-
-@item
-@code{bfd_error_invalid_operation} -
-Writing has started to the BFD, so setting the size is invalid.
-@end itemize
-
-@findex bfd_set_section_contents
-@subsubsection @code{bfd_set_section_contents}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_section_contents
-   (bfd *abfd, asection *section, const void *data,
-    file_ptr offset, bfd_size_type count);
-@end example
-@strong{Description}@*
-Sets the contents of the section @var{section} in BFD
-@var{abfd} to the data starting in memory at @var{data}. The
-data is written to the output section starting at offset
-@var{offset} for @var{count} octets.
-
-Normally @code{TRUE} is returned, else @code{FALSE}. Possible error
-returns are:
-@itemize @bullet
-
-@item
-@code{bfd_error_no_contents} -
-The output section does not have the @code{SEC_HAS_CONTENTS}
-attribute, so nothing can be written to it.
-@item
-and some more too
-@end itemize
-This routine is front end to the back end function
-@code{_bfd_set_section_contents}.
-
-@findex bfd_get_section_contents
-@subsubsection @code{bfd_get_section_contents}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_get_section_contents
-   (bfd *abfd, asection *section, void *location, file_ptr offset,
-    bfd_size_type count);
-@end example
-@strong{Description}@*
-Read data from @var{section} in BFD @var{abfd}
-into memory starting at @var{location}. The data is read at an
-offset of @var{offset} from the start of the input section,
-and is read for @var{count} bytes.
-
-If the contents of a constructor with the @code{SEC_CONSTRUCTOR}
-flag set are requested or if the section does not have the
-@code{SEC_HAS_CONTENTS} flag set, then the @var{location} is filled
-with zeroes. If no errors occur, @code{TRUE} is returned, else
-@code{FALSE}.
-
-@findex bfd_malloc_and_get_section
-@subsubsection @code{bfd_malloc_and_get_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_malloc_and_get_section
-   (bfd *abfd, asection *section, bfd_byte **buf);
-@end example
-@strong{Description}@*
-Read all data from @var{section} in BFD @var{abfd}
-into a buffer, *@var{buf}, malloc'd by this function.
-
-@findex bfd_copy_private_section_data
-@subsubsection @code{bfd_copy_private_section_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_section_data
-   (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
-@end example
-@strong{Description}@*
-Copy private section information from @var{isec} in the BFD
-@var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
-Return @code{TRUE} on success, @code{FALSE} on error.  Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{osec}.
-@end itemize
-@example
-#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
-     BFD_SEND (obfd, _bfd_copy_private_section_data, \
-               (ibfd, isection, obfd, osection))
-@end example
-
-@findex bfd_generic_is_group_section
-@subsubsection @code{bfd_generic_is_group_section}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
-@end example
-@strong{Description}@*
-Returns TRUE if @var{sec} is a member of a group.
-
-@findex bfd_generic_discard_group
-@subsubsection @code{bfd_generic_discard_group}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
-@end example
-@strong{Description}@*
-Remove all members of @var{group} from the output.
-
diff --git a/bfd/doc/syms.texi b/bfd/doc/syms.texi
deleted file mode 100644
index 3d66380..0000000
--- a/bfd/doc/syms.texi
+++ /dev/null
@@ -1,480 +0,0 @@
-@section Symbols
-BFD tries to maintain as much symbol information as it can when
-it moves information from file to file. BFD passes information
-to applications though the @code{asymbol} structure. When the
-application requests the symbol table, BFD reads the table in
-the native form and translates parts of it into the internal
-format. To maintain more than the information passed to
-applications, some targets keep some information ``behind the
-scenes'' in a structure only the particular back end knows
-about. For example, the coff back end keeps the original
-symbol table structure as well as the canonical structure when
-a BFD is read in. On output, the coff back end can reconstruct
-the output symbol table so that no information is lost, even
-information unique to coff which BFD doesn't know or
-understand. If a coff symbol table were read, but were written
-through an a.out back end, all the coff specific information
-would be lost. The symbol table of a BFD
-is not necessarily read in until a canonicalize request is
-made. Then the BFD back end fills in a table provided by the
-application with pointers to the canonical information.  To
-output symbols, the application provides BFD with a table of
-pointers to pointers to @code{asymbol}s. This allows applications
-like the linker to output a symbol as it was read, since the ``behind
-the scenes'' information will be still available.
-@menu
-* Reading Symbols::
-* Writing Symbols::
-* Mini Symbols::
-* typedef asymbol::
-* symbol handling functions::
-@end menu
-
-@node Reading Symbols, Writing Symbols, Symbols, Symbols
-@subsection Reading symbols
-There are two stages to reading a symbol table from a BFD:
-allocating storage, and the actual reading process. This is an
-excerpt from an application which reads the symbol table:
-
-@example
-         long storage_needed;
-         asymbol **symbol_table;
-         long number_of_symbols;
-         long i;
-
-         storage_needed = bfd_get_symtab_upper_bound (abfd);
-
-         if (storage_needed < 0)
-           FAIL
-
-         if (storage_needed == 0)
-           return;
-         
-         symbol_table = xmalloc (storage_needed);
-           ...
-         number_of_symbols =
-            bfd_canonicalize_symtab (abfd, symbol_table);
-
-         if (number_of_symbols < 0)
-           FAIL
-
-         for (i = 0; i < number_of_symbols; i++)
-           process_symbol (symbol_table[i]);
-@end example
-
-All storage for the symbols themselves is in an objalloc
-connected to the BFD; it is freed when the BFD is closed.
-
-@node Writing Symbols, Mini Symbols, Reading Symbols, Symbols
-@subsection Writing symbols
-Writing of a symbol table is automatic when a BFD open for
-writing is closed. The application attaches a vector of
-pointers to pointers to symbols to the BFD being written, and
-fills in the symbol count. The close and cleanup code reads
-through the table provided and performs all the necessary
-operations. The BFD output code must always be provided with an
-``owned'' symbol: one which has come from another BFD, or one
-which has been created using @code{bfd_make_empty_symbol}.  Here is an
-example showing the creation of a symbol table with only one element:
-
-@example
-       #include "sysdep.h"
-       #include "bfd.h"
-       int main (void)
-       @{
-         bfd *abfd;
-         asymbol *ptrs[2];
-         asymbol *new;
-
-         abfd = bfd_openw ("foo","a.out-sunos-big");
-         bfd_set_format (abfd, bfd_object);
-         new = bfd_make_empty_symbol (abfd);
-         new->name = "dummy_symbol";
-         new->section = bfd_make_section_old_way (abfd, ".text");
-         new->flags = BSF_GLOBAL;
-         new->value = 0x12345;
-
-         ptrs[0] = new;
-         ptrs[1] = 0;
-
-         bfd_set_symtab (abfd, ptrs, 1);
-         bfd_close (abfd);
-         return 0;
-       @}
-
-       ./makesym
-       nm foo
-       00012345 A dummy_symbol
-@end example
-
-Many formats cannot represent arbitrary symbol information; for
-instance, the @code{a.out} object format does not allow an
-arbitrary number of sections. A symbol pointing to a section
-which is not one  of @code{.text}, @code{.data} or @code{.bss} cannot
-be described.
-
-@node Mini Symbols, typedef asymbol, Writing Symbols, Symbols
-@subsection Mini Symbols
-Mini symbols provide read-only access to the symbol table.
-They use less memory space, but require more time to access.
-They can be useful for tools like nm or objdump, which may
-have to handle symbol tables of extremely large executables.
-
-The @code{bfd_read_minisymbols} function will read the symbols
-into memory in an internal form.  It will return a @code{void *}
-pointer to a block of memory, a symbol count, and the size of
-each symbol.  The pointer is allocated using @code{malloc}, and
-should be freed by the caller when it is no longer needed.
-
-The function @code{bfd_minisymbol_to_symbol} will take a pointer
-to a minisymbol, and a pointer to a structure returned by
-@code{bfd_make_empty_symbol}, and return a @code{asymbol} structure.
-The return value may or may not be the same as the value from
-@code{bfd_make_empty_symbol} which was passed in.
-
-
-@node typedef asymbol, symbol handling functions, Mini Symbols, Symbols
-@subsection typedef asymbol
-An @code{asymbol} has the form:
-
-
-@example
-
-typedef struct bfd_symbol
-@{
-  /* A pointer to the BFD which owns the symbol. This information
-     is necessary so that a back end can work out what additional
-     information (invisible to the application writer) is carried
-     with the symbol.
-
-     This field is *almost* redundant, since you can use section->owner
-     instead, except that some symbols point to the global sections
-     bfd_@{abs,com,und@}_section.  This could be fixed by making
-     these globals be per-bfd (or per-target-flavor).  FIXME.  */
-  struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field.  */
-
-  /* The text of the symbol. The name is left alone, and not copied; the
-     application may not alter it.  */
-  const char *name;
-
-  /* The value of the symbol.  This really should be a union of a
-     numeric value with a pointer, since some flags indicate that
-     a pointer to another symbol is stored here.  */
-  symvalue value;
-
-  /* Attributes of a symbol.  */
-#define BSF_NO_FLAGS           0x00
-
-  /* The symbol has local scope; @code{static} in @code{C}. The value
-     is the offset into the section of the data.  */
-#define BSF_LOCAL              (1 << 0)
-
-  /* The symbol has global scope; initialized data in @code{C}. The
-     value is the offset into the section of the data.  */
-#define BSF_GLOBAL             (1 << 1)
-
-  /* The symbol has global scope and is exported. The value is
-     the offset into the section of the data.  */
-#define BSF_EXPORT     BSF_GLOBAL /* No real difference.  */
-
-  /* A normal C symbol would be one of:
-     @code{BSF_LOCAL}, @code{BSF_COMMON},  @code{BSF_UNDEFINED} or
-     @code{BSF_GLOBAL}.  */
-
-  /* The symbol is a debugging record. The value has an arbitrary
-     meaning, unless BSF_DEBUGGING_RELOC is also set.  */
-#define BSF_DEBUGGING          (1 << 2)
-
-  /* The symbol denotes a function entry point.  Used in ELF,
-     perhaps others someday.  */
-#define BSF_FUNCTION           (1 << 3)
-
-  /* Used by the linker.  */
-#define BSF_KEEP               (1 << 5)
-#define BSF_KEEP_G             (1 << 6)
-
-  /* A weak global symbol, overridable without warnings by
-     a regular global symbol of the same name.  */
-#define BSF_WEAK               (1 << 7)
-
-  /* This symbol was created to point to a section, e.g. ELF's
-     STT_SECTION symbols.  */
-#define BSF_SECTION_SYM        (1 << 8)
-
-  /* The symbol used to be a common symbol, but now it is
-     allocated.  */
-#define BSF_OLD_COMMON         (1 << 9)
-
-  /* In some files the type of a symbol sometimes alters its
-     location in an output file - ie in coff a @code{ISFCN} symbol
-     which is also @code{C_EXT} symbol appears where it was
-     declared and not at the end of a section.  This bit is set
-     by the target BFD part to convey this information.  */
-#define BSF_NOT_AT_END         (1 << 10)
-
-  /* Signal that the symbol is the label of constructor section.  */
-#define BSF_CONSTRUCTOR        (1 << 11)
-
-  /* Signal that the symbol is a warning symbol.  The name is a
-     warning.  The name of the next symbol is the one to warn about;
-     if a reference is made to a symbol with the same name as the next
-     symbol, a warning is issued by the linker.  */
-#define BSF_WARNING            (1 << 12)
-
-  /* Signal that the symbol is indirect.  This symbol is an indirect
-     pointer to the symbol with the same name as the next symbol.  */
-#define BSF_INDIRECT           (1 << 13)
-
-  /* BSF_FILE marks symbols that contain a file name.  This is used
-     for ELF STT_FILE symbols.  */
-#define BSF_FILE               (1 << 14)
-
-  /* Symbol is from dynamic linking information.  */
-#define BSF_DYNAMIC            (1 << 15)
-
-  /* The symbol denotes a data object.  Used in ELF, and perhaps
-     others someday.  */
-#define BSF_OBJECT             (1 << 16)
-
-  /* This symbol is a debugging symbol.  The value is the offset
-     into the section of the data.  BSF_DEBUGGING should be set
-     as well.  */
-#define BSF_DEBUGGING_RELOC    (1 << 17)
-
-  /* This symbol is thread local.  Used in ELF.  */
-#define BSF_THREAD_LOCAL       (1 << 18)
-
-  /* This symbol represents a complex relocation expression,
-     with the expression tree serialized in the symbol name.  */
-#define BSF_RELC               (1 << 19)
-
-  /* This symbol represents a signed complex relocation expression,
-     with the expression tree serialized in the symbol name.  */
-#define BSF_SRELC              (1 << 20)
-
-  /* This symbol was created by bfd_get_synthetic_symtab.  */
-#define BSF_SYNTHETIC          (1 << 21)
-
-  /* This symbol is an indirect code object.  Unrelated to BSF_INDIRECT.
-     The dynamic linker will compute the value of this symbol by
-     calling the function that it points to.  BSF_FUNCTION must
-     also be also set.  */
-#define BSF_GNU_INDIRECT_FUNCTION (1 << 22)
-  /* This symbol is a globally unique data object.  The dynamic linker
-     will make sure that in the entire process there is just one symbol
-     with this name and type in use.  BSF_OBJECT must also be set.  */
-#define BSF_GNU_UNIQUE         (1 << 23)
-
-  flagword flags;
-
-  /* A pointer to the section to which this symbol is
-     relative.  This will always be non NULL, there are special
-     sections for undefined and absolute symbols.  */
-  struct bfd_section *section;
-
-  /* Back end special data.  */
-  union
-    @{
-      void *p;
-      bfd_vma i;
-    @}
-  udata;
-@}
-asymbol;
-
-@end example
-
-@node symbol handling functions,  , typedef asymbol, Symbols
-@subsection Symbol handling functions
-
-
-@findex bfd_get_symtab_upper_bound
-@subsubsection @code{bfd_get_symtab_upper_bound}
-@strong{Description}@*
-Return the number of bytes required to store a vector of pointers
-to @code{asymbols} for all the symbols in the BFD @var{abfd},
-including a terminal NULL pointer. If there are no symbols in
-the BFD, then return 0.  If an error occurs, return -1.
-@example
-#define bfd_get_symtab_upper_bound(abfd) \
-     BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
-@end example
-
-@findex bfd_is_local_label
-@subsubsection @code{bfd_is_local_label}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
-@end example
-@strong{Description}@*
-Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is
-a compiler generated local label, else return FALSE.
-
-@findex bfd_is_local_label_name
-@subsubsection @code{bfd_is_local_label_name}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
-@end example
-@strong{Description}@*
-Return TRUE if a symbol with the name @var{name} in the BFD
-@var{abfd} is a compiler generated local label, else return
-FALSE.  This just checks whether the name has the form of a
-local label.
-@example
-#define bfd_is_local_label_name(abfd, name) \
-  BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-
-@end example
-
-@findex bfd_is_target_special_symbol
-@subsubsection @code{bfd_is_target_special_symbol}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
-@end example
-@strong{Description}@*
-Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something
-special to the particular target represented by the BFD.  Such symbols
-should normally not be mentioned to the user.
-@example
-#define bfd_is_target_special_symbol(abfd, sym) \
-  BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
-
-@end example
-
-@findex bfd_canonicalize_symtab
-@subsubsection @code{bfd_canonicalize_symtab}
-@strong{Description}@*
-Read the symbols from the BFD @var{abfd}, and fills in
-the vector @var{location} with pointers to the symbols and
-a trailing NULL.
-Return the actual number of symbol pointers, not
-including the NULL.
-@example
-#define bfd_canonicalize_symtab(abfd, location) \
-  BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-
-@end example
-
-@findex bfd_set_symtab
-@subsubsection @code{bfd_set_symtab}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_symtab
-   (bfd *abfd, asymbol **location, unsigned int count);
-@end example
-@strong{Description}@*
-Arrange that when the output BFD @var{abfd} is closed,
-the table @var{location} of @var{count} pointers to symbols
-will be written.
-
-@findex bfd_print_symbol_vandf
-@subsubsection @code{bfd_print_symbol_vandf}
-@strong{Synopsis}
-@example
-void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
-@end example
-@strong{Description}@*
-Print the value and flags of the @var{symbol} supplied to the
-stream @var{file}.
-
-@findex bfd_make_empty_symbol
-@subsubsection @code{bfd_make_empty_symbol}
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd}
-and return a pointer to it.
-
-This routine is necessary because each back end has private
-information surrounding the @code{asymbol}. Building your own
-@code{asymbol} and pointing to it will not create the private
-information, and will cause problems later on.
-@example
-#define bfd_make_empty_symbol(abfd) \
-  BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
-@end example
-
-@findex _bfd_generic_make_empty_symbol
-@subsubsection @code{_bfd_generic_make_empty_symbol}
-@strong{Synopsis}
-@example
-asymbol *_bfd_generic_make_empty_symbol (bfd *);
-@end example
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd}
-and return a pointer to it.  Used by core file routines,
-binary back-end and anywhere else where no private info
-is needed.
-
-@findex bfd_make_debug_symbol
-@subsubsection @code{bfd_make_debug_symbol}
-@strong{Description}@*
-Create a new @code{asymbol} structure for the BFD @var{abfd},
-to be used as a debugging symbol.  Further details of its use have
-yet to be worked out.
-@example
-#define bfd_make_debug_symbol(abfd,ptr,size) \
-  BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
-@end example
-
-@findex bfd_decode_symclass
-@subsubsection @code{bfd_decode_symclass}
-@strong{Description}@*
-Return a character corresponding to the symbol
-class of @var{symbol}, or '?' for an unknown class.
-
-@strong{Synopsis}
-@example
-int bfd_decode_symclass (asymbol *symbol);
-@end example
-@findex bfd_is_undefined_symclass
-@subsubsection @code{bfd_is_undefined_symclass}
-@strong{Description}@*
-Returns non-zero if the class symbol returned by
-bfd_decode_symclass represents an undefined symbol.
-Returns zero otherwise.
-
-@strong{Synopsis}
-@example
-bfd_boolean bfd_is_undefined_symclass (int symclass);
-@end example
-@findex bfd_symbol_info
-@subsubsection @code{bfd_symbol_info}
-@strong{Description}@*
-Fill in the basic info about symbol that nm needs.
-Additional info may be added by the back-ends after
-calling this function.
-
-@strong{Synopsis}
-@example
-void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-@end example
-@findex bfd_copy_private_symbol_data
-@subsubsection @code{bfd_copy_private_symbol_data}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_copy_private_symbol_data
-   (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
-@end example
-@strong{Description}@*
-Copy private symbol information from @var{isym} in the BFD
-@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}.
-Return @code{TRUE} on success, @code{FALSE} on error.  Possible error
-returns are:
-
-@itemize @bullet
-
-@item
-@code{bfd_error_no_memory} -
-Not enough memory exists to create private data for @var{osec}.
-@end itemize
-@example
-#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
-  BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
-            (ibfd, isymbol, obfd, osymbol))
-
-@end example
-
diff --git a/bfd/doc/targets.texi b/bfd/doc/targets.texi
deleted file mode 100644
index e56e560..0000000
--- a/bfd/doc/targets.texi
+++ /dev/null
@@ -1,617 +0,0 @@
-@section Targets
-
-
-@strong{Description}@*
-Each port of BFD to a different machine requires the creation
-of a target back end. All the back end provides to the root
-part of BFD is a structure containing pointers to functions
-which perform certain low level operations on files. BFD
-translates the applications's requests through a pointer into
-calls to the back end routines.
-
-When a file is opened with @code{bfd_openr}, its format and
-target are unknown. BFD uses various mechanisms to determine
-how to interpret the file. The operations performed are:
-
-@itemize @bullet
-
-@item
-Create a BFD by calling the internal routine
-@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the
-target string supplied to @code{bfd_openr} and the new BFD pointer.
-
-@item
-If a null target string was provided to @code{bfd_find_target},
-look up the environment variable @code{GNUTARGET} and use
-that as the target string.
-
-@item
-If the target string is still @code{NULL}, or the target string is
-@code{default}, then use the first item in the target vector
-as the target type, and set @code{target_defaulted} in the BFD to
-cause @code{bfd_check_format} to loop through all the targets.
-@xref{bfd_target}.  @xref{Formats}.
-
-@item
-Otherwise, inspect the elements in the target vector
-one by one, until a match on target name is found. When found,
-use it.
-
-@item
-Otherwise return the error @code{bfd_error_invalid_target} to
-@code{bfd_openr}.
-
-@item
-@code{bfd_openr} attempts to open the file using
-@code{bfd_open_file}, and returns the BFD.
-@end itemize
-Once the BFD has been opened and the target selected, the file
-format may be determined. This is done by calling
-@code{bfd_check_format} on the BFD with a suggested format.
-If @code{target_defaulted} has been set, each possible target
-type is tried to see if it recognizes the specified format.
-@code{bfd_check_format} returns @code{TRUE} when the caller guesses right.
-@menu
-* bfd_target::
-@end menu
-
-@node bfd_target,  , Targets, Targets
-
-@subsection bfd_target
-
-
-@strong{Description}@*
-This structure contains everything that BFD knows about a
-target. It includes things like its byte order, name, and which
-routines to call to do various operations.
-
-Every BFD points to a target structure with its @code{xvec}
-member.
-
-The macros below are used to dispatch to functions through the
-@code{bfd_target} vector. They are used in a number of macros further
-down in @file{bfd.h}, and are also used when calling various
-routines by hand inside the BFD implementation.  The @var{arglist}
-argument must be parenthesized; it contains all the arguments
-to the called function.
-
-They make the documentation (more) unpleasant to read, so if
-someone wants to fix this and not break the above, please do.
-@example
-#define BFD_SEND(bfd, message, arglist) \
-  ((*((bfd)->xvec->message)) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND
-#define BFD_SEND(bfd, message, arglist) \
-  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-    ((*((bfd)->xvec->message)) arglist) : \
-    (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-@end example
-For operations which index on the BFD format:
-@example
-#define BFD_SEND_FMT(bfd, message, arglist) \
-  (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
-
-#ifdef DEBUG_BFD_SEND
-#undef BFD_SEND_FMT
-#define BFD_SEND_FMT(bfd, message, arglist) \
-  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
-   (bfd_assert (__FILE__,__LINE__), NULL))
-#endif
-
-@end example
-This is the structure which defines the type of BFD this is.  The
-@code{xvec} member of the struct @code{bfd} itself points here.  Each
-module that implements access to a different target under BFD,
-defines one of these.
-
-FIXME, these names should be rationalised with the names of
-the entry points which call them. Too bad we can't have one
-macro to define them both!
-@example
-enum bfd_flavour
-@{
-  bfd_target_unknown_flavour,
-  bfd_target_aout_flavour,
-  bfd_target_coff_flavour,
-  bfd_target_ecoff_flavour,
-  bfd_target_xcoff_flavour,
-  bfd_target_elf_flavour,
-  bfd_target_ieee_flavour,
-  bfd_target_nlm_flavour,
-  bfd_target_oasys_flavour,
-  bfd_target_tekhex_flavour,
-  bfd_target_srec_flavour,
-  bfd_target_verilog_flavour,
-  bfd_target_ihex_flavour,
-  bfd_target_som_flavour,
-  bfd_target_os9k_flavour,
-  bfd_target_versados_flavour,
-  bfd_target_msdos_flavour,
-  bfd_target_ovax_flavour,
-  bfd_target_evax_flavour,
-  bfd_target_mmo_flavour,
-  bfd_target_mach_o_flavour,
-  bfd_target_pef_flavour,
-  bfd_target_pef_xlib_flavour,
-  bfd_target_sym_flavour
-@};
-
-enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @};
-
-/* Forward declaration.  */
-typedef struct bfd_link_info _bfd_link_info;
-
-/* Forward declaration.  */
-typedef struct flag_info flag_info;
-
-typedef struct bfd_target
-@{
-  /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  */
-  char *name;
-
- /* The "flavour" of a back end is a general indication about
-    the contents of a file.  */
-  enum bfd_flavour flavour;
-
-  /* The order of bytes within the data area of a file.  */
-  enum bfd_endian byteorder;
-
- /* The order of bytes within the header parts of a file.  */
-  enum bfd_endian header_byteorder;
-
-  /* A mask of all the flags which an executable may have set -
-     from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}.  */
-  flagword object_flags;
-
- /* A mask of all the flags which a section may have set - from
-    the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}.  */
-  flagword section_flags;
-
- /* The character normally found at the front of a symbol.
-    (if any), perhaps `_'.  */
-  char symbol_leading_char;
-
- /* The pad character for file names within an archive header.  */
-  char ar_pad_char;
-
-  /* The maximum number of characters in an archive header.  */
-  unsigned char ar_max_namelen;
-
-  /* How well this target matches, used to select between various
-     possible targets when more than one target matches.  */
-  unsigned char match_priority;
-
-  /* Entries for byte swapping for data. These are different from the
-     other entry points, since they don't take a BFD as the first argument.
-     Certain other handlers could do the same.  */
-  bfd_uint64_t   (*bfd_getx64) (const void *);
-  bfd_int64_t    (*bfd_getx_signed_64) (const void *);
-  void           (*bfd_putx64) (bfd_uint64_t, void *);
-  bfd_vma        (*bfd_getx32) (const void *);
-  bfd_signed_vma (*bfd_getx_signed_32) (const void *);
-  void           (*bfd_putx32) (bfd_vma, void *);
-  bfd_vma        (*bfd_getx16) (const void *);
-  bfd_signed_vma (*bfd_getx_signed_16) (const void *);
-  void           (*bfd_putx16) (bfd_vma, void *);
-
-  /* Byte swapping for the headers.  */
-  bfd_uint64_t   (*bfd_h_getx64) (const void *);
-  bfd_int64_t    (*bfd_h_getx_signed_64) (const void *);
-  void           (*bfd_h_putx64) (bfd_uint64_t, void *);
-  bfd_vma        (*bfd_h_getx32) (const void *);
-  bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
-  void           (*bfd_h_putx32) (bfd_vma, void *);
-  bfd_vma        (*bfd_h_getx16) (const void *);
-  bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
-  void           (*bfd_h_putx16) (bfd_vma, void *);
-
-  /* Format dependent routines: these are vectors of entry points
-     within the target vector structure, one for each format to check.  */
-
-  /* Check the format of a file being read.  Return a @code{bfd_target *} or zero.  */
-  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
-
-  /* Set the format of a file being written.  */
-  bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
-
-  /* Write cached information into a file being written, at @code{bfd_close}.  */
-  bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
-
-@end example
-The general target vector.  These vectors are initialized using the
-BFD_JUMP_TABLE macros.
-@example
-
-  /* Generic entry points.  */
-#define BFD_JUMP_TABLE_GENERIC(NAME) \
-  NAME##_close_and_cleanup, \
-  NAME##_bfd_free_cached_info, \
-  NAME##_new_section_hook, \
-  NAME##_get_section_contents, \
-  NAME##_get_section_contents_in_window
-
-  /* Called when the BFD is being closed to do any necessary cleanup.  */
-  bfd_boolean (*_close_and_cleanup) (bfd *);
-  /* Ask the BFD to free all cached information.  */
-  bfd_boolean (*_bfd_free_cached_info) (bfd *);
-  /* Called when a new section is created.  */
-  bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
-  /* Read the contents of a section.  */
-  bfd_boolean (*_bfd_get_section_contents)
-    (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
-  bfd_boolean (*_bfd_get_section_contents_in_window)
-    (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
-
-  /* Entry points to copy private data.  */
-#define BFD_JUMP_TABLE_COPY(NAME) \
-  NAME##_bfd_copy_private_bfd_data, \
-  NAME##_bfd_merge_private_bfd_data, \
-  _bfd_generic_init_private_section_data, \
-  NAME##_bfd_copy_private_section_data, \
-  NAME##_bfd_copy_private_symbol_data, \
-  NAME##_bfd_copy_private_header_data, \
-  NAME##_bfd_set_private_flags, \
-  NAME##_bfd_print_private_bfd_data
-
-  /* Called to copy BFD general private data from one object file
-     to another.  */
-  bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
-  /* Called to merge BFD general private data from one object file
-     to a common output file when linking.  */
-  bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
-  /* Called to initialize BFD private section data from one object file
-     to another.  */
-#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
-  BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
-  bfd_boolean (*_bfd_init_private_section_data)
-    (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
-  /* Called to copy BFD private section data from one object file
-     to another.  */
-  bfd_boolean (*_bfd_copy_private_section_data)
-    (bfd *, sec_ptr, bfd *, sec_ptr);
-  /* Called to copy BFD private symbol data from one symbol
-     to another.  */
-  bfd_boolean (*_bfd_copy_private_symbol_data)
-    (bfd *, asymbol *, bfd *, asymbol *);
-  /* Called to copy BFD private header data from one object file
-     to another.  */
-  bfd_boolean (*_bfd_copy_private_header_data)
-    (bfd *, bfd *);
-  /* Called to set private backend flags.  */
-  bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
-
-  /* Called to print private BFD data.  */
-  bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
-
-  /* Core file entry points.  */
-#define BFD_JUMP_TABLE_CORE(NAME) \
-  NAME##_core_file_failing_command, \
-  NAME##_core_file_failing_signal, \
-  NAME##_core_file_matches_executable_p, \
-  NAME##_core_file_pid
-
-  char *      (*_core_file_failing_command) (bfd *);
-  int         (*_core_file_failing_signal) (bfd *);
-  bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
-  int         (*_core_file_pid) (bfd *);
-
-  /* Archive entry points.  */
-#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
-  NAME##_slurp_armap, \
-  NAME##_slurp_extended_name_table, \
-  NAME##_construct_extended_name_table, \
-  NAME##_truncate_arname, \
-  NAME##_write_armap, \
-  NAME##_read_ar_hdr, \
-  NAME##_write_ar_hdr, \
-  NAME##_openr_next_archived_file, \
-  NAME##_get_elt_at_index, \
-  NAME##_generic_stat_arch_elt, \
-  NAME##_update_armap_timestamp
-
-  bfd_boolean (*_bfd_slurp_armap) (bfd *);
-  bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
-  bfd_boolean (*_bfd_construct_extended_name_table)
-    (bfd *, char **, bfd_size_type *, const char **);
-  void        (*_bfd_truncate_arname) (bfd *, const char *, char *);
-  bfd_boolean (*write_armap)
-    (bfd *, unsigned int, struct orl *, unsigned int, int);
-  void *      (*_bfd_read_ar_hdr_fn) (bfd *);
-  bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *);
-  bfd *       (*openr_next_archived_file) (bfd *, bfd *);
-#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
-  bfd *       (*_bfd_get_elt_at_index) (bfd *, symindex);
-  int         (*_bfd_stat_arch_elt) (bfd *, struct stat *);
-  bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
-
-  /* Entry points used for symbols.  */
-#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
-  NAME##_get_symtab_upper_bound, \
-  NAME##_canonicalize_symtab, \
-  NAME##_make_empty_symbol, \
-  NAME##_print_symbol, \
-  NAME##_get_symbol_info, \
-  NAME##_bfd_is_local_label_name, \
-  NAME##_bfd_is_target_special_symbol, \
-  NAME##_get_lineno, \
-  NAME##_find_nearest_line, \
-  _bfd_generic_find_line, \
-  NAME##_find_inliner_info, \
-  NAME##_bfd_make_debug_symbol, \
-  NAME##_read_minisymbols, \
-  NAME##_minisymbol_to_symbol
-
-  long        (*_bfd_get_symtab_upper_bound) (bfd *);
-  long        (*_bfd_canonicalize_symtab)
-    (bfd *, struct bfd_symbol **);
-  struct bfd_symbol *
-              (*_bfd_make_empty_symbol) (bfd *);
-  void        (*_bfd_print_symbol)
-    (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type);
-#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e))
-  void        (*_bfd_get_symbol_info)
-    (bfd *, struct bfd_symbol *, symbol_info *);
-#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
-  bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
-  bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
-  alent *     (*_get_lineno) (bfd *, struct bfd_symbol *);
-  bfd_boolean (*_bfd_find_nearest_line)
-    (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
-     const char **, const char **, unsigned int *);
-  bfd_boolean (*_bfd_find_line)
-    (bfd *, struct bfd_symbol **, struct bfd_symbol *,
-     const char **, unsigned int *);
-  bfd_boolean (*_bfd_find_inliner_info)
-    (bfd *, const char **, const char **, unsigned int *);
- /* Back-door to allow format-aware applications to create debug symbols
-    while using BFD for everything else.  Currently used by the assembler
-    when creating COFF files.  */
-  asymbol *   (*_bfd_make_debug_symbol)
-    (bfd *, void *, unsigned long size);
-#define bfd_read_minisymbols(b, d, m, s) \
-  BFD_SEND (b, _read_minisymbols, (b, d, m, s))
-  long        (*_read_minisymbols)
-    (bfd *, bfd_boolean, void **, unsigned int *);
-#define bfd_minisymbol_to_symbol(b, d, m, f) \
-  BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
-  asymbol *   (*_minisymbol_to_symbol)
-    (bfd *, bfd_boolean, const void *, asymbol *);
-
-  /* Routines for relocs.  */
-#define BFD_JUMP_TABLE_RELOCS(NAME) \
-  NAME##_get_reloc_upper_bound, \
-  NAME##_canonicalize_reloc, \
-  NAME##_bfd_reloc_type_lookup, \
-  NAME##_bfd_reloc_name_lookup
-
-  long        (*_get_reloc_upper_bound) (bfd *, sec_ptr);
-  long        (*_bfd_canonicalize_reloc)
-    (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
-  /* See documentation on reloc types.  */
-  reloc_howto_type *
-              (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
-  reloc_howto_type *
-              (*reloc_name_lookup) (bfd *, const char *);
-
-
-  /* Routines used when writing an object file.  */
-#define BFD_JUMP_TABLE_WRITE(NAME) \
-  NAME##_set_arch_mach, \
-  NAME##_set_section_contents
-
-  bfd_boolean (*_bfd_set_arch_mach)
-    (bfd *, enum bfd_architecture, unsigned long);
-  bfd_boolean (*_bfd_set_section_contents)
-    (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
-
-  /* Routines used by the linker.  */
-#define BFD_JUMP_TABLE_LINK(NAME) \
-  NAME##_sizeof_headers, \
-  NAME##_bfd_get_relocated_section_contents, \
-  NAME##_bfd_relax_section, \
-  NAME##_bfd_link_hash_table_create, \
-  NAME##_bfd_link_hash_table_free, \
-  NAME##_bfd_link_add_symbols, \
-  NAME##_bfd_link_just_syms, \
-  NAME##_bfd_copy_link_hash_symbol_type, \
-  NAME##_bfd_final_link, \
-  NAME##_bfd_link_split_section, \
-  NAME##_bfd_gc_sections, \
-  NAME##_bfd_lookup_section_flags, \
-  NAME##_bfd_merge_sections, \
-  NAME##_bfd_is_group_section, \
-  NAME##_bfd_discard_group, \
-  NAME##_section_already_linked, \
-  NAME##_bfd_define_common_symbol
-
-  int         (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
-  bfd_byte *  (*_bfd_get_relocated_section_contents)
-    (bfd *, struct bfd_link_info *, struct bfd_link_order *,
-     bfd_byte *, bfd_boolean, struct bfd_symbol **);
-
-  bfd_boolean (*_bfd_relax_section)
-    (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
-
-  /* Create a hash table for the linker.  Different backends store
-     different information in this table.  */
-  struct bfd_link_hash_table *
-              (*_bfd_link_hash_table_create) (bfd *);
-
-  /* Release the memory associated with the linker hash table.  */
-  void        (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
-
-  /* Add symbols from this object file into the hash table.  */
-  bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
-
-  /* Indicate that we are only retrieving symbol values from this section.  */
-  void        (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
-
-  /* Copy the symbol type of a linker hash table entry.  */
-#define bfd_copy_link_hash_symbol_type(b, t, f) \
-  BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
-  void (*_bfd_copy_link_hash_symbol_type)
-    (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
-
-  /* Do a link based on the link_order structures attached to each
-     section of the BFD.  */
-  bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
-
-  /* Should this section be split up into smaller pieces during linking.  */
-  bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
-
-  /* Remove sections that are not referenced from the output.  */
-  bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
-
-  /* Sets the bitmask of allowed and disallowed section flags.  */
-  bfd_boolean (*_bfd_lookup_section_flags) (struct bfd_link_info *,
-                                            struct flag_info *,
-                                            asection *);
-
-  /* Attempt to merge SEC_MERGE sections.  */
-  bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
-
-  /* Is this section a member of a group?  */
-  bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
-
-  /* Discard members of a group.  */
-  bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
-
-  /* Check if SEC has been already linked during a reloceatable or
-     final link.  */
-  bfd_boolean (*_section_already_linked) (bfd *, asection *,
-                                          struct bfd_link_info *);
-
-  /* Define a common symbol.  */
-  bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *,
-                                            struct bfd_link_hash_entry *);
-
-  /* Routines to handle dynamic symbols and relocs.  */
-#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
-  NAME##_get_dynamic_symtab_upper_bound, \
-  NAME##_canonicalize_dynamic_symtab, \
-  NAME##_get_synthetic_symtab, \
-  NAME##_get_dynamic_reloc_upper_bound, \
-  NAME##_canonicalize_dynamic_reloc
-
-  /* Get the amount of memory required to hold the dynamic symbols.  */
-  long        (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
-  /* Read in the dynamic symbols.  */
-  long        (*_bfd_canonicalize_dynamic_symtab)
-    (bfd *, struct bfd_symbol **);
-  /* Create synthetized symbols.  */
-  long        (*_bfd_get_synthetic_symtab)
-    (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
-     struct bfd_symbol **);
-  /* Get the amount of memory required to hold the dynamic relocs.  */
-  long        (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
-  /* Read in the dynamic relocs.  */
-  long        (*_bfd_canonicalize_dynamic_reloc)
-    (bfd *, arelent **, struct bfd_symbol **);
-
-@end example
-A pointer to an alternative bfd_target in case the current one is not
-satisfactory.  This can happen when the target cpu supports both big
-and little endian code, and target chosen by the linker has the wrong
-endianness.  The function open_output() in ld/ldlang.c uses this field
-to find an alternative output format that is suitable.
-@example
-  /* Opposite endian version of this target.  */
-  const struct bfd_target * alternative_target;
-
-  /* Data for use by back-end routines, which isn't
-     generic enough to belong in this structure.  */
-  const void *backend_data;
-
-@} bfd_target;
-
-@end example
-
-@findex bfd_set_default_target
-@subsubsection @code{bfd_set_default_target}
-@strong{Synopsis}
-@example
-bfd_boolean bfd_set_default_target (const char *name);
-@end example
-@strong{Description}@*
-Set the default target vector to use when recognizing a BFD.
-This takes the name of the target, which may be a BFD target
-name or a configuration triplet.
-
-@findex bfd_find_target
-@subsubsection @code{bfd_find_target}
-@strong{Synopsis}
-@example
-const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
-@end example
-@strong{Description}@*
-Return a pointer to the transfer vector for the object target
-named @var{target_name}.  If @var{target_name} is @code{NULL},
-choose the one in the environment variable @code{GNUTARGET}; if
-that is null or not defined, then choose the first entry in the
-target list.  Passing in the string "default" or setting the
-environment variable to "default" will cause the first entry in
-the target list to be returned, and "target_defaulted" will be
-set in the BFD if @var{abfd} isn't @code{NULL}.  This causes
-@code{bfd_check_format} to loop over all the targets to find the
-one that matches the file being read.
-
-@findex bfd_get_target_info
-@subsubsection @code{bfd_get_target_info}
-@strong{Synopsis}
-@example
-const bfd_target *bfd_get_target_info (const char *target_name,
-    bfd *abfd,
-    bfd_boolean *is_bigendian,
-    int *underscoring,
-    const char **def_target_arch);
-@end example
-@strong{Description}@*
-Return a pointer to the transfer vector for the object target
-named @var{target_name}.  If @var{target_name} is @code{NULL},
-choose the one in the environment variable @code{GNUTARGET}; if
-that is null or not defined, then choose the first entry in the
-target list.  Passing in the string "default" or setting the
-environment variable to "default" will cause the first entry in
-the target list to be returned, and "target_defaulted" will be
-set in the BFD if @var{abfd} isn't @code{NULL}.  This causes
-@code{bfd_check_format} to loop over all the targets to find the
-one that matches the file being read.
-If @var{is_bigendian} is not @code{NULL}, then set this value to target's
-endian mode. True for big-endian, FALSE for little-endian or for
-invalid target.
-If @var{underscoring} is not @code{NULL}, then set this value to target's
-underscoring mode. Zero for none-underscoring, -1 for invalid target,
-else the value of target vector's symbol underscoring.
-If @var{def_target_arch} is not @code{NULL}, then set it to the architecture
-string specified by the target_name.
-
-@findex bfd_target_list
-@subsubsection @code{bfd_target_list}
-@strong{Synopsis}
-@example
-const char ** bfd_target_list (void);
-@end example
-@strong{Description}@*
-Return a freshly malloced NULL-terminated
-vector of the names of all the valid BFD targets. Do not
-modify the names.
-
-@findex bfd_seach_for_target
-@subsubsection @code{bfd_seach_for_target}
-@strong{Synopsis}
-@example
-const bfd_target *bfd_search_for_target
-   (int (*search_func) (const bfd_target *, void *),
-    void *);
-@end example
-@strong{Description}@*
-Return a pointer to the first transfer vector in the list of
-transfer vectors maintained by BFD that produces a non-zero
-result when passed to the function @var{search_func}.  The
-parameter @var{data} is passed, unexamined, to the search
-function.
-
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index d31b849..4a904ea 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1,6 +1,5 @@
 /* DWARF 2 support.
-   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright 1994-2013 Free Software Foundation, Inc.
 
    Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
    (gavin@cygnus.com).
@@ -108,6 +107,16 @@
   asection *sec;
   bfd_byte *sec_info_ptr;
 
+  /* Support for alternate debug info sections created by the DWZ utility:
+     This includes a pointer to an alternate bfd which contains *extra*,
+     possibly duplicate debug sections, and pointers to the loaded
+     .debug_str and .debug_info sections from this bfd.  */
+  bfd *          alt_bfd_ptr;
+  bfd_byte *     alt_dwarf_str_buffer;
+  bfd_size_type  alt_dwarf_str_size;
+  bfd_byte *     alt_dwarf_info_buffer;
+  bfd_size_type  alt_dwarf_info_size;
+
   /* A pointer to the memory block allocated for info_ptr.  Neither
      info_ptr nor sec_info_ptr are guaranteed to stay pointing to the
      beginning of the malloc block.  This is used only to free the
@@ -173,6 +182,9 @@
 #define STASH_INFO_HASH_OFF        0
 #define STASH_INFO_HASH_ON         1
 #define STASH_INFO_HASH_DISABLED   2
+
+  /* True if we opened bfd_ptr.  */
+  bfd_boolean close_on_cleanup;
 };
 
 struct arange
@@ -287,6 +299,7 @@
   { ".debug_aranges",		".zdebug_aranges" },
   { ".debug_frame",		".zdebug_frame" },
   { ".debug_info",		".zdebug_info" },
+  { ".debug_info",		".zdebug_info" },
   { ".debug_line",		".zdebug_line" },
   { ".debug_loc",		".zdebug_loc" },
   { ".debug_macinfo",		".zdebug_macinfo" },
@@ -297,6 +310,7 @@
   { ".debug_static_func",	".zdebug_static_func" },
   { ".debug_static_vars",	".zdebug_static_vars" },
   { ".debug_str",		".zdebug_str", },
+  { ".debug_str",		".zdebug_str", },
   { ".debug_types",		".zdebug_types" },
   /* GNU DWARF 1 extensions */
   { ".debug_sfnames",		".zdebug_sfnames" },
@@ -309,12 +323,15 @@
   { NULL,			NULL },
 };
 
+/* NB/ Numbers in this enum must match up with indicies
+   into the dwarf_debug_sections[] array above.  */
 enum dwarf_debug_section_enum
 {
   debug_abbrev = 0,
   debug_aranges,
   debug_frame,
   debug_info,
+  debug_info_alt,
   debug_line,
   debug_loc,
   debug_macinfo,
@@ -325,6 +342,7 @@
   debug_static_func,
   debug_static_vars,
   debug_str,
+  debug_str_alt,
   debug_types,
   debug_sfnames,
   debug_srcinfo,
@@ -481,8 +499,8 @@
   asection *msec;
   const char *section_name = sec->uncompressed_name;
 
-  /* read_section is a noop if the section has already been read.  */
-  if (!*section_buffer)
+  /* The section may have already been read.  */
+  if (*section_buffer == NULL)
     {
       msec = bfd_get_section_by_name (abfd, section_name);
       if (! msec)
@@ -623,6 +641,104 @@
   return str;
 }
 
+/* Like read_indirect_string but uses a .debug_str located in
+   an alternate filepointed to by the .gnu_debuglink section.
+   Used to impement DW_FORM_GNU_strp_alt.  */
+
+static char *
+read_alt_indirect_string (struct comp_unit * unit,
+			  bfd_byte *         buf,
+			  unsigned int *     bytes_read_ptr)
+{
+  bfd_uint64_t offset;
+  struct dwarf2_debug *stash = unit->stash;
+  char *str;
+
+  if (unit->offset_size == 4)
+    offset = read_4_bytes (unit->abfd, buf);
+  else
+    offset = read_8_bytes (unit->abfd, buf);
+
+  *bytes_read_ptr = unit->offset_size;
+
+  if (stash->alt_bfd_ptr == NULL)
+    {
+      bfd *  debug_bfd;
+      char * debug_filename = bfd_follow_gnu_debugaltlink (unit->abfd, DEBUGDIR);
+
+      if (debug_filename == NULL)
+	return NULL;
+
+      if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL
+	  || ! bfd_check_format (debug_bfd, bfd_object))
+	{
+	  if (debug_bfd)
+	    bfd_close (debug_bfd);
+
+	  /* FIXME: Should we report our failure to follow the debuglink ?  */
+	  free (debug_filename);
+	  return NULL;
+	}
+      stash->alt_bfd_ptr = debug_bfd;
+    }
+  
+  if (! read_section (unit->stash->alt_bfd_ptr,
+		      stash->debug_sections + debug_str_alt,
+		      NULL, /* FIXME: Do we need to load alternate symbols ?  */
+		      offset,
+		      &stash->alt_dwarf_str_buffer,
+		      &stash->alt_dwarf_str_size))
+    return NULL;
+
+  str = (char *) stash->alt_dwarf_str_buffer + offset;
+  if (*str == '\0')
+    return NULL;
+
+  return str;
+}
+
+/* Resolve an alternate reference from UNIT at OFFSET.
+   Returns a pointer into the loaded alternate CU upon success
+   or NULL upon failure.  */
+
+static bfd_byte *
+read_alt_indirect_ref (struct comp_unit * unit,
+		       bfd_uint64_t       offset)
+{
+  struct dwarf2_debug *stash = unit->stash;
+
+  if (stash->alt_bfd_ptr == NULL)
+    {
+      bfd *  debug_bfd;
+      char * debug_filename = bfd_follow_gnu_debugaltlink (unit->abfd, DEBUGDIR);
+
+      if (debug_filename == NULL)
+	return FALSE;
+
+      if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL
+	  || ! bfd_check_format (debug_bfd, bfd_object))
+	{
+	  if (debug_bfd)
+	    bfd_close (debug_bfd);
+
+	  /* FIXME: Should we report our failure to follow the debuglink ?  */
+	  free (debug_filename);
+	  return NULL;
+	}
+      stash->alt_bfd_ptr = debug_bfd;
+    }
+  
+  if (! read_section (unit->stash->alt_bfd_ptr,
+		      stash->debug_sections + debug_info_alt,
+		      NULL, /* FIXME: Do we need to load alternate symbols ?  */
+		      offset,
+		      &stash->alt_dwarf_info_buffer,
+		      &stash->alt_dwarf_info_size))
+    return NULL;
+
+  return stash->alt_dwarf_info_buffer + offset;
+}
+
 static bfd_uint64_t
 read_address (struct comp_unit *unit, bfd_byte *buf)
 {
@@ -826,6 +942,7 @@
       attr->u.val = read_address (unit, info_ptr);
       info_ptr += unit->addr_size;
       break;
+    case DW_FORM_GNU_ref_alt:
     case DW_FORM_sec_offset:
       if (unit->offset_size == 4)
 	attr->u.val = read_4_bytes (unit->abfd, info_ptr);
@@ -875,6 +992,10 @@
       attr->u.str = read_indirect_string (unit, info_ptr, &bytes_read);
       info_ptr += bytes_read;
       break;
+    case DW_FORM_GNU_strp_alt:
+      attr->u.str = read_alt_indirect_string (unit, info_ptr, &bytes_read);
+      info_ptr += bytes_read;
+      break;
     case DW_FORM_exprloc:
     case DW_FORM_block:
       amt = sizeof (struct dwarf_block);
@@ -947,7 +1068,7 @@
       info_ptr = read_attribute_value (attr, form, unit, info_ptr);
       break;
     default:
-      (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %u."),
+      (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %#x."),
 			     form);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
@@ -980,6 +1101,7 @@
   char *filename;
   unsigned int line;
   unsigned int column;
+  unsigned int discriminator;
   unsigned char op_index;
   unsigned char end_sequence;		/* End of (sequential) code sequence.  */
 };
@@ -1080,6 +1202,7 @@
 	       char *filename,
 	       unsigned int line,
 	       unsigned int column,
+	       unsigned int discriminator,
 	       int end_sequence)
 {
   bfd_size_type amt = sizeof (struct line_info);
@@ -1095,6 +1218,7 @@
   info->op_index = op_index;
   info->line = line;
   info->column = column;
+  info->discriminator = discriminator;
   info->end_sequence = end_sequence;
 
   if (filename && filename[0])
@@ -1573,6 +1697,7 @@
       char * filename = table->num_files ? concat_filename (table, 1) : NULL;
       unsigned int line = 1;
       unsigned int column = 0;
+      unsigned int discriminator = 0;
       int is_stmt = lh.default_is_stmt;
       int end_sequence = 0;
       /* eraxxon@alumni.rice.edu: Against the DWARF2 specs, some
@@ -1607,8 +1732,9 @@
 	      line += lh.line_base + (adj_opcode % lh.line_range);
 	      /* Append row to matrix using current values.  */
 	      if (!add_line_info (table, address, op_index, filename,
-				  line, column, 0))
+				  line, column, discriminator, 0))
 		goto line_fail;
+              discriminator = 0;
 	      if (address < low_pc)
 		low_pc = address;
 	      if (address > high_pc)
@@ -1626,9 +1752,10 @@
 		{
 		case DW_LNE_end_sequence:
 		  end_sequence = 1;
-		  if (!add_line_info (table, address, op_index, filename,
-				      line, column, end_sequence))
+		  if (!add_line_info (table, address, op_index, filename, line,
+				      column, discriminator, end_sequence))
 		    goto line_fail;
+                  discriminator = 0;
 		  if (address < low_pc)
 		    low_pc = address;
 		  if (address > high_pc)
@@ -1668,7 +1795,8 @@
 		  table->num_files++;
 		  break;
 		case DW_LNE_set_discriminator:
-		  (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+		  discriminator =
+                      read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
 		  line_ptr += bytes_read;
 		  break;
 		case DW_LNE_HP_source_file_correlation:
@@ -1686,8 +1814,9 @@
 	      break;
 	    case DW_LNS_copy:
 	      if (!add_line_info (table, address, op_index,
-				  filename, line, column, 0))
+				  filename, line, column, discriminator, 0))
 		goto line_fail;
+              discriminator = 0;
 	      if (address < low_pc)
 		low_pc = address;
 	      if (address > high_pc)
@@ -1780,15 +1909,18 @@
   return NULL;
 }
 
-/* If ADDR is within TABLE set the output parameters and return TRUE,
-   otherwise return FALSE.  The output parameters, FILENAME_PTR and
-   LINENUMBER_PTR, are pointers to the objects to be filled in.  */
+/* If ADDR is within TABLE set the output parameters and return the
+   range of addresses covered by the entry used to fill them out.
+   Otherwise set * FILENAME_PTR to NULL and return 0.
+   The parameters FILENAME_PTR, LINENUMBER_PTR and DISCRIMINATOR_PTR
+   are pointers to the objects to be filled in.  */
 
-static bfd_boolean
+static bfd_vma
 lookup_address_in_line_info_table (struct line_info_table *table,
 				   bfd_vma addr,
 				   const char **filename_ptr,
-				   unsigned int *linenumber_ptr)
+				   unsigned int *linenumber_ptr,
+				   unsigned int *discriminator_ptr)
 {
   struct line_sequence *seq = NULL;
   struct line_info *each_line;
@@ -1823,12 +1955,14 @@
         {
           *filename_ptr = each_line->filename;
           *linenumber_ptr = each_line->line;
-          return TRUE;
+          if (discriminator_ptr)
+            *discriminator_ptr = each_line->discriminator;
+          return seq->last_line->address - seq->low_pc;
         }
     }
 
   *filename_ptr = NULL;
-  return FALSE;
+  return 0;
 }
 
 /* Read in the .debug_ranges section for future reference.  */
@@ -1844,10 +1978,10 @@
 
 /* Function table functions.  */
 
-/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return TRUE.
-   Note that we need to find the function that has the smallest
-   range that contains ADDR, to handle inlined functions without
-   depending upon them being ordered in TABLE by increasing range. */
+/* If ADDR is within UNIT's function tables, set FUNCTIONNAME_PTR, and return
+   TRUE.  Note that we need to find the function that has the smallest range
+   that contains ADDR, to handle inlined functions without depending upon
+   them being ordered in TABLE by increasing range.  */
 
 static bfd_boolean
 lookup_address_in_function_table (struct comp_unit *unit,
@@ -1982,7 +2116,7 @@
   struct abbrev_info *abbrev;
   bfd_uint64_t die_ref = attr_ptr->u.val;
   struct attribute attr;
-  char *name = 0;
+  char *name = NULL;
 
   /* DW_FORM_ref_addr can reference an entry in a different CU. It
      is an offset from the .debug_info section, not the current CU.  */
@@ -1995,8 +2129,20 @@
 
       info_ptr = unit->sec_info_ptr + die_ref;
     }
-  else 
+  else if (attr_ptr->form == DW_FORM_GNU_ref_alt)
+    {
+      info_ptr = read_alt_indirect_ref (unit, die_ref);
+      if (info_ptr == NULL)
+	{
+	  (*_bfd_error_handler)
+	    (_("Dwarf Error: Unable to read alt ref %u."), die_ref);
+	  bfd_set_error (bfd_error_bad_value);
+	  return name;
+	}
+    }
+  else
     info_ptr = unit->info_ptr_unit + die_ref;
+
   abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
   info_ptr += bytes_read;
 
@@ -2543,18 +2689,18 @@
    FUNCTIONNAME_PTR, and LINENUMBER_PTR, are pointers to the objects
    to be filled in.
 
-   Return TRUE if UNIT contains ADDR, and no errors were encountered;
-   FALSE otherwise.  */
+   Returns the range of addresses covered by the entry that was used
+   to fill in *LINENUMBER_PTR or 0 if it was not filled in.  */
 
-static bfd_boolean
+static bfd_vma
 comp_unit_find_nearest_line (struct comp_unit *unit,
 			     bfd_vma addr,
 			     const char **filename_ptr,
 			     const char **functionname_ptr,
 			     unsigned int *linenumber_ptr,
+			     unsigned int *discriminator_ptr,
 			     struct dwarf2_debug *stash)
 {
-  bfd_boolean line_p;
   bfd_boolean func_p;
   struct funcinfo *function;
 
@@ -2590,10 +2736,11 @@
 					     &function, functionname_ptr);
   if (func_p && (function->tag == DW_TAG_inlined_subroutine))
     stash->inliner_chain = function;
-  line_p = lookup_address_in_line_info_table (unit->line_table, addr,
-					      filename_ptr,
-					      linenumber_ptr);
-  return line_p || func_p;
+
+  return lookup_address_in_line_info_table (unit->line_table, addr,
+					    filename_ptr,
+					    linenumber_ptr,
+					    discriminator_ptr);
 }
 
 /* Check to see if line info is already decoded in a comp_unit.
@@ -3193,6 +3340,7 @@
   if (! stash)
     return FALSE;
   stash->debug_sections = debug_sections;
+  stash->syms = symbols;
 
   *pinfo = stash;
 
@@ -3222,7 +3370,9 @@
 	  free (debug_filename);
 	  return FALSE;
 	}
+      stash->close_on_cleanup = TRUE;
     }
+  stash->bfd_ptr = debug_bfd;
 
   /* There can be more than one DWARF2 info section in a BFD these
      days.  First handle the easy case when there's only one.  If
@@ -3280,9 +3430,6 @@
   stash->info_ptr_end = stash->info_ptr + total_size;
   stash->sec = find_debug_info (debug_bfd, debug_sections, NULL);
   stash->sec_info_ptr = stash->info_ptr;
-  stash->syms = symbols;
-  stash->bfd_ptr = debug_bfd;
-
   return TRUE;
 }
 
@@ -3308,6 +3455,7 @@
 	   const char **filename_ptr,
 	   const char **functionname_ptr,
 	   unsigned int *linenumber_ptr,
+	   unsigned int *discriminator_ptr,
 	   unsigned int addr_size,
 	   void **pinfo)
 {
@@ -3323,13 +3471,15 @@
   /* What address are we looking for?  */
   bfd_vma addr;
   struct comp_unit* each;
-  bfd_vma found = FALSE;
+  bfd_boolean found = FALSE;
   bfd_boolean do_line;
 
   *filename_ptr = NULL;
   if (functionname_ptr != NULL)
     *functionname_ptr = NULL;
   *linenumber_ptr = 0;
+  if (discriminator_ptr)
+    *discriminator_ptr = 0;
 
   if (! _bfd_dwarf2_slurp_debug_info (abfd, NULL,
 				      debug_sections, symbols, pinfo))
@@ -3411,17 +3561,56 @@
     }
   else
     {
+      bfd_vma min_range = (bfd_vma) -1;
+      const char * local_filename = NULL;
+      const char * local_functionname = NULL;
+      unsigned int local_linenumber = 0;
+      unsigned int local_discriminator = 0;
+
       for (each = stash->all_comp_units; each; each = each->next_unit)
 	{
+	  bfd_vma range = (bfd_vma) -1;
+
 	  found = ((each->arange.high == 0
 		    || comp_unit_contains_address (each, addr))
-		   && comp_unit_find_nearest_line (each, addr,
-						   filename_ptr,
-						   functionname_ptr,
-						   linenumber_ptr,
-						   stash));
+		   && (range = comp_unit_find_nearest_line (each, addr,
+							    & local_filename,
+							    & local_functionname,
+							    & local_linenumber,
+							    & local_discriminator,
+							    stash)) != 0);
 	  if (found)
-	    goto done;
+	    {
+	      /* PRs 15935 15994: Bogus debug information may have provided us
+		 with an erroneous match.  We attempt to counter this by
+		 selecting the match that has the smallest address range
+		 associated with it.  (We are assuming that corrupt debug info
+		 will tend to result in extra large address ranges rather than
+		 extra small ranges).
+
+		 This does mean that we scan through all of the CUs associated
+		 with the bfd each time this function is called.  But this does
+		 have the benefit of producing consistent results every time the
+		 function is called.  */
+	      if (range <= min_range)
+		{
+		  if (filename_ptr && local_filename)
+		    * filename_ptr = local_filename;
+		  if (functionname_ptr && local_functionname)
+		    * functionname_ptr = local_functionname;
+		  if (discriminator_ptr && local_discriminator)
+		    * discriminator_ptr = local_discriminator;
+		  if (local_linenumber)
+		    * linenumber_ptr = local_linenumber;
+		  min_range = range;
+		}
+	    }
+	}
+
+      if (* linenumber_ptr)
+	{
+	  found = TRUE;
+	  goto done;
 	}
     }
 
@@ -3488,10 +3677,10 @@
 	    stash->all_comp_units->prev_unit = each;
 	  else
 	    stash->last_comp_unit = each;
-	  
+
 	  each->next_unit = stash->all_comp_units;
 	  stash->all_comp_units = each;
-	  
+
 	  /* DW_AT_low_pc and DW_AT_high_pc are optional for
 	     compilation units.  If we don't have them (i.e.,
 	     unit->high == 0), we need to consult the line info table
@@ -3512,7 +3701,8 @@
 						     filename_ptr,
 						     functionname_ptr,
 						     linenumber_ptr,
-						     stash));
+						     discriminator_ptr,
+						     stash)) > 0;
 
 	  if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
 	      == stash->sec->size)
@@ -3546,12 +3736,13 @@
 			       const char **filename_ptr,
 			       const char **functionname_ptr,
 			       unsigned int *linenumber_ptr,
+                               unsigned int *discriminator_ptr,
 			       unsigned int addr_size,
 			       void **pinfo)
 {
   return find_line (abfd, debug_sections, section, offset, NULL, symbols,
-                    filename_ptr, functionname_ptr, linenumber_ptr, addr_size,
-		    pinfo);
+                    filename_ptr, functionname_ptr, linenumber_ptr,
+                    discriminator_ptr, addr_size, pinfo);
 }
 
 /* The DWARF2 version of find_line.
@@ -3563,11 +3754,13 @@
 		       asymbol *symbol,
 		       const char **filename_ptr,
 		       unsigned int *linenumber_ptr,
+                       unsigned int *discriminator_ptr,
 		       unsigned int addr_size,
 		       void **pinfo)
 {
   return find_line (abfd, dwarf_debug_sections, NULL, 0, symbol, symbols,
-                    filename_ptr, NULL, linenumber_ptr, addr_size, pinfo);
+                    filename_ptr, NULL, linenumber_ptr, discriminator_ptr,
+                    addr_size, pinfo);
 }
 
 bfd_boolean
@@ -3600,7 +3793,7 @@
 void
 _bfd_dwarf2_cleanup_debug_info (bfd *abfd, void **pinfo)
 {
-  struct dwarf2_debug *stash = (struct dwarf2_debug *) *pinfo;;
+  struct dwarf2_debug *stash = (struct dwarf2_debug *) *pinfo;
   struct comp_unit *each;
 
   if (abfd == NULL || stash == NULL)
@@ -3668,4 +3861,12 @@
     free (stash->dwarf_ranges_buffer);
   if (stash->info_ptr_memory)
     free (stash->info_ptr_memory);
+  if (stash->close_on_cleanup)
+    bfd_close (stash->bfd_ptr);
+  if (stash->alt_dwarf_str_buffer)
+    free (stash->alt_dwarf_str_buffer);
+  if (stash->alt_dwarf_info_buffer)
+    free (stash->alt_dwarf_info_buffer);
+  if (stash->alt_bfd_ptr)
+    bfd_close (stash->alt_bfd_ptr);
 }
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 3b65c0e..7bfb333 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -1,7 +1,5 @@
 /* Generic ECOFF (Extended-COFF) routines.
-   Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
 
@@ -1888,7 +1886,7 @@
   ret = (bfd_coff_filhsz (abfd)
 	 + bfd_coff_aoutsz (abfd)
 	 + c * bfd_coff_scnhsz (abfd));
-  return BFD_ALIGN (ret, 16);
+  return (int) BFD_ALIGN (ret, 16);
 }
 
 /* Get the contents of a section.  */
@@ -2904,7 +2902,7 @@
   if (mapdata == NULL)
     return FALSE;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, (void *) mapdata);
+  free (mapdata);
 
   raw_armap = (char *) bfd_alloc (abfd, parsed_size);
   if (raw_armap == NULL)
@@ -3563,9 +3561,9 @@
   void (* const swap_ext_in) (bfd *, void *, EXTR *)
     = backend->debug_swap.swap_ext_in;
   HDRR *symhdr;
-  bfd_size_type external_ext_size;
+  bfd_size_type external_ext_size = 0;
   void * external_ext = NULL;
-  bfd_size_type esize;
+  bfd_size_type esize = 0;
   char *ssext = NULL;
   char *ext_ptr;
   char *ext_end;
diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c
index 2ec2886..e48fcc8 100644
--- a/bfd/ecofflink.c
+++ b/bfd/ecofflink.c
@@ -1788,7 +1788,7 @@
 	     'lookup_line'.  */
 	  /* The address of the first PDR is the offset of that
 	     procedure relative to the beginning of file FDR.  */
-	  tab->base_addr = fdr_ptr->adr; 
+	  tab->base_addr = fdr_ptr->adr;
 	}
       else
 	{
@@ -1887,7 +1887,7 @@
   i = fdrtab_lookup (line_info, offset);
   if (i < 0)
     return FALSE;		/* no FDR, no fun...  */
-  
+
   /* eraxxon: 'fdrtab_lookup' doesn't give what we want, at least for Compaq's
      C++ compiler 6.2.  Consider three FDRs with starting addresses of x, y,
      and z, respectively, such that x < y < z.  Assume further that
@@ -2052,7 +2052,7 @@
 	 read stabs FDRs as ECOFF ones.  However, I don't think this will
 	 harm anything.  */
       i = 0;
-      
+
       /* Search FDR list starting at tab[i] for the PDR that best matches
          OFFSET.  Normally, the FDR list is only one entry long.  */
       best_fdr = NULL;
@@ -2097,7 +2097,7 @@
 
 	  if (!best_pdr || (min_dist >= 0 && min_dist < best_dist))
 	    {
-	      best_dist = (bfd_vma) min_dist;  
+	      best_dist = (bfd_vma) min_dist;
 	      best_fdr = fdr_ptr;
 	      best_pdr = pdr_hold;
 	    }
diff --git a/bfd/ecoffswap.h b/bfd/ecoffswap.h
index 3cf917c..3306e6b 100644
--- a/bfd/ecoffswap.h
+++ b/bfd/ecoffswap.h
@@ -451,7 +451,7 @@
 #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
   if (intern->iss == (signed long) 0xffffffff)
     intern->iss = -1;
-#endif  
+#endif
 
   /* Now the fun stuff...  */
   if (bfd_header_big_endian (abfd))
diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
index 4237af5..9a6ff6f 100644
--- a/bfd/elf-attrs.c
+++ b/bfd/elf-attrs.c
@@ -347,6 +347,10 @@
   int i;
   int vendor;
 
+  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+    return;
+
   for (vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; vendor++)
     {
       in_attr
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 889ce12..15dab94 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1,7 +1,5 @@
 /* BFD back-end data structures for ELF files.
-   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 1992-2013 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -191,8 +189,8 @@
      FIXME: There is no real need for this field if def_dynamic is never
      cleared and all places that test def_dynamic also test def_regular.  */
   unsigned int dynamic_def : 1;
-  /* Symbol is weak in all shared objects.  */
-  unsigned int dynamic_weak : 1;
+  /* Symbol has a non-weak reference from a shared object.  */
+  unsigned int ref_dynamic_nonweak : 1;
   /* Symbol is referenced with a relocation where C/C++ pointer equality
      matters.  */
   unsigned int pointer_equality_needed : 1;
@@ -402,7 +400,8 @@
    one line.  */
 enum elf_target_id
 {
-  ALPHA_ELF_DATA = 1,
+  AARCH64_ELF_DATA = 1,
+  ALPHA_ELF_DATA,
   ARM_ELF_DATA,
   AVR_ELF_DATA,
   BFIN_ELF_DATA,
@@ -416,9 +415,11 @@
   M32R_ELF_DATA,
   M68HC11_ELF_DATA,
   M68K_ELF_DATA,
+  METAG_ELF_DATA,
   MICROBLAZE_ELF_DATA,
   MIPS_ELF_DATA,
   MN10300_ELF_DATA,
+  NIOS2_ELF_DATA,
   PPC32_ELF_DATA,
   PPC64_ELF_DATA,
   S390_ELF_DATA,
@@ -497,6 +498,9 @@
   /* The _PROCEDURE_LINKAGE_TABLE_ symbol.  */
   struct elf_link_hash_entry *hplt;
 
+  /* The _DYNAMIC symbol.  */
+  struct elf_link_hash_entry *hdynamic;
+
   /* A pointer to information used to merge SEC_MERGE sections.  */
   void *merge_info;
 
@@ -637,7 +641,8 @@
   reloc_class_normal,
   reloc_class_relative,
   reloc_class_plt,
-  reloc_class_copy
+  reloc_class_copy,
+  reloc_class_ifunc
 };
 
 struct elf_reloc_cookie
@@ -876,12 +881,12 @@
   bfd_boolean (*check_directives)
     (bfd *abfd, struct bfd_link_info *info);
 
-  /* The AS_NEEDED_CLEANUP function is called once per --as-needed
-     input file that was not needed by the add_symbols phase of the
-     ELF backend linker.  The function must undo any target specific
-     changes in the symbol hash table.  */
-  bfd_boolean (*as_needed_cleanup)
-    (bfd *abfd, struct bfd_link_info *info);
+  /* The NOTICE_AS_NEEDED function is called as the linker is about to
+     handle an as-needed lib (ACT = notice_as_needed), and after the
+     linker has decided to keep the lib (ACT = notice_needed) or when
+     the lib is not needed (ACT = notice_not_needed).  */
+  bfd_boolean (*notice_as_needed)
+    (bfd *abfd, struct bfd_link_info *info, enum notice_asneeded_action act);
 
   /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
      linker for every symbol which is defined by a dynamic object and
@@ -1124,7 +1129,7 @@
 
   /* This function returns class of a reloc type.  */
   enum elf_reloc_type_class (*elf_backend_reloc_type_class)
-    (const Elf_Internal_Rela *);
+  (const struct bfd_link_info *, const asection *, const Elf_Internal_Rela *);
 
   /* This function, if defined, removes information about discarded functions
      from other sections which mention them.  */
@@ -1203,19 +1208,10 @@
   asection *(*common_section) (asection *);
 
   /* Return TRUE if we can merge 2 definitions.  */
-  bfd_boolean (*merge_symbol) (struct bfd_link_info *,
-			       struct elf_link_hash_entry **,
-			       struct elf_link_hash_entry *,
-			       Elf_Internal_Sym *, asection **,
-			       bfd_vma *, unsigned int *,
-			       bfd_boolean *, bfd_boolean *,
-			       bfd_boolean *, bfd_boolean *,
-			       bfd_boolean *, bfd_boolean *,
-			       bfd_boolean *, bfd_boolean *,
-			       bfd *, asection **,
-			       bfd_boolean *, bfd_boolean *,
-			       bfd_boolean *, bfd_boolean *,
-			       bfd *, asection **);
+  bfd_boolean (*merge_symbol) (struct elf_link_hash_entry *,
+			       const Elf_Internal_Sym *, asection **,
+			       bfd_boolean, bfd_boolean,
+			       bfd *, const asection *);
 
   /* Return TRUE if symbol should be hashed in the `.gnu.hash' section.  */
   bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *);
@@ -1281,6 +1277,9 @@
   /* This is non-zero if static TLS segments require a special alignment.  */
   unsigned static_tls_alignment;
 
+  /* Alignment for the PT_GNU_STACK segment. */
+  unsigned stack_align;
+
   /* This is TRUE if the linker should act like collect and gather
      global constructors and destructors by name.  This is TRUE for
      MIPS ELF because the Irix 5 tools can not handle the .init
@@ -1503,6 +1502,64 @@
   bfd_byte data[1];
 };
 
+/* NT_GNU_BUILD_ID note type info for input BFDs.  */
+struct elf_build_id
+{
+  size_t size;
+  bfd_byte data[1];
+};
+
+/* tdata information grabbed from an elf core file.  */
+struct core_elf_obj_tdata
+{
+  int signal;
+  int pid;
+  int lwpid;
+  char* program;
+  char* command;
+};
+
+/* Extra tdata information held for output ELF BFDs.  */
+struct output_elf_obj_tdata
+{
+  struct elf_segment_map *seg_map;
+  struct elf_strtab_hash *strtab_ptr;
+
+  /* STT_SECTION symbols for each section */
+  asymbol **section_syms;
+
+  /* Used to determine if PT_GNU_EH_FRAME segment header should be
+     created.  */
+  asection *eh_frame_hdr;
+
+  /* NT_GNU_BUILD_ID note type info.  */
+  struct
+  {
+    bfd_boolean (*after_write_object_contents) (bfd *);
+    const char *style;
+    asection *sec;
+  } build_id;
+
+  /* Records the result of `get_program_header_size'.  */
+  bfd_size_type program_header_size;
+
+  /* Used when laying out sections.  */
+  file_ptr next_file_pos;
+
+  int num_section_syms;
+  unsigned int shstrtab_section, strtab_section;
+
+  /* Segment flags for the PT_GNU_STACK segment.  */
+  unsigned int stack_flags;
+
+  /* This is set to TRUE if the object was created by the backend
+     linker.  */
+  bfd_boolean linker;
+
+  /* Used to determine if the e_flags field has been initialized */
+  bfd_boolean flags_init;
+};
+
 /* Some private data is stashed away for future use using the tdata pointer
    in the bfd structure.  */
 
@@ -1511,13 +1568,6 @@
   Elf_Internal_Ehdr elf_header[1];	/* Actual data, but ref like ptr */
   Elf_Internal_Shdr **elf_sect_ptr;
   Elf_Internal_Phdr *phdr;
-  struct elf_segment_map *segment_map;
-  struct elf_strtab_hash *strtab_ptr;
-  int num_locals;
-  int num_globals;
-  unsigned int num_elf_sections;	/* elf_sect_ptr size */
-  int num_section_syms;
-  asymbol **section_syms;		/* STT_SECTION symbols for each section */
   Elf_Internal_Shdr symtab_hdr;
   Elf_Internal_Shdr shstrtab_hdr;
   Elf_Internal_Shdr strtab_hdr;
@@ -1527,20 +1577,9 @@
   Elf_Internal_Shdr dynverref_hdr;
   Elf_Internal_Shdr dynverdef_hdr;
   Elf_Internal_Shdr symtab_shndx_hdr;
-  unsigned int symtab_section, shstrtab_section;
-  unsigned int strtab_section, dynsymtab_section;
-  unsigned int symtab_shndx_section;
-  unsigned int dynversym_section, dynverdef_section, dynverref_section;
-  file_ptr next_file_pos;
   bfd_vma gp;				/* The gp value */
   unsigned int gp_size;			/* The gp size */
-
-  /* Information grabbed from an elf core file.  */
-  int core_signal;
-  int core_pid;
-  int core_lwpid;
-  char* core_program;
-  char* core_command;
+  unsigned int num_elf_sections;	/* elf_sect_ptr size */
 
   /* A mapping from external symbols to entries in the linker hash
      table, used when linking.  This is indexed by the symbol index
@@ -1571,36 +1610,17 @@
      are used by a dynamic object.  */
   const char *dt_audit;
 
-  /* Records the result of `get_program_header_size'.  */
-  bfd_size_type program_header_size;
-
   /* Used by find_nearest_line entry point.  */
   void *line_info;
 
-  /* Used by MIPS ELF find_nearest_line entry point.  The structure
-     could be included directly in this one, but there's no point to
-     wasting the memory just for the infrequently called
-     find_nearest_line.  */
-  struct mips_elf_find_line *find_line_info;
-
   /* A place to stash dwarf1 info for this bfd.  */
   struct dwarf1_debug *dwarf1_find_line_info;
 
   /* A place to stash dwarf2 info for this bfd.  */
   void *dwarf2_find_line_info;
 
-  /* An array of stub sections indexed by symbol number, used by the
-     MIPS ELF linker.  FIXME: We should figure out some way to only
-     include this field for a MIPS ELF target.  */
-  asection **local_stubs;
-  asection **local_call_stubs;
-
-  /* Used to determine if PT_GNU_EH_FRAME segment header should be
-     created.  */
-  asection *eh_frame_hdr;
-
-  Elf_Internal_Shdr **group_sect_ptr;
-  int num_group;
+  /* Stash away info for yet another find line/function variant.  */
+  void *elf_find_function_cache;
 
   /* Number of symbol version definitions we are about to emit.  */
   unsigned int cverdefs;
@@ -1608,34 +1628,44 @@
   /* Number of symbol version references we are about to emit.  */
   unsigned int cverrefs;
 
-  /* Segment flags for the PT_GNU_STACK segment.  */
-  unsigned int stack_flags;
-
   /* Symbol version definitions in external objects.  */
   Elf_Internal_Verdef *verdef;
 
   /* Symbol version references to external objects.  */
   Elf_Internal_Verneed *verref;
 
-  /* The Irix 5 support uses two virtual sections, which represent
-     text/data symbols defined in dynamic objects.  */
-  asymbol *elf_data_symbol;
-  asymbol *elf_text_symbol;
-  asection *elf_data_section;
-  asection *elf_text_section;
-
   /* A pointer to the .eh_frame section.  */
   asection *eh_frame_section;
 
+  /* Symbol buffer.  */
+  void *symbuf;
+
+  obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES];
+  obj_attribute_list *other_obj_attributes[2];
+
+  /* NT_GNU_BUILD_ID note type.  */
+  struct elf_build_id *build_id;
+
+  /* Linked-list containing information about every Systemtap section
+     found in the object file.  Each section corresponds to one entry
+     in the list.  */
+  struct sdt_note *sdt_note_head;
+
+  Elf_Internal_Shdr **group_sect_ptr;
+  int num_group;
+
+  unsigned int symtab_section, symtab_shndx_section, dynsymtab_section;
+  unsigned int dynversym_section, dynverdef_section, dynverref_section;
+
+  /* An identifier used to distinguish different target
+     specific extensions to this structure.  */
+  enum elf_target_id object_id;
+
   /* Whether a dyanmic object was specified normally on the linker
      command line, or was specified when --as-needed was in effect,
      or was found via a DT_NEEDED entry.  */
   enum dynamic_lib_link_class dyn_lib_class;
 
-  /* This is set to TRUE if the object was created by the backend
-     linker.  */
-  bfd_boolean linker;
-
   /* Irix 5 often screws up the symbol table, sorting local symbols
      after global symbols.  This flag is set if the symbol table in
      this BFD appears to be screwed up.  If it is, we ignore the
@@ -1643,48 +1673,35 @@
      symbols.  */
   bfd_boolean bad_symtab;
 
-  /* Used to determine if the e_flags field has been initialized */
-  bfd_boolean flags_init;
-
-  /* Symbol buffer.  */
-  void *symbuf;
-
-  obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES];
-  obj_attribute_list *other_obj_attributes[2];
-
-  /* Called at the end of _bfd_elf_write_object_contents if not NULL.  */
-  bfd_boolean (*after_write_object_contents) (bfd *);
-  void *after_write_object_contents_info;
-
-  /* NT_GNU_BUILD_ID note type.  */
-  bfd_size_type build_id_size;
-  bfd_byte *build_id;
-
-  /* Linked-list containing information about every Systemtap section
-     found in the object file.  Each section corresponds to one entry
-     in the list.  */
-  struct sdt_note *sdt_note_head;
-
   /* True if the bfd contains symbols that have the STT_GNU_IFUNC
      symbol type or STB_GNU_UNIQUE binding.  Used to set the osabi
      field in the ELF header structure.  */
   bfd_boolean has_gnu_symbols;
 
-  /* An identifier used to distinguish different target
-     specific extensions to this structure.  */
-  enum elf_target_id object_id;
+  /* Information grabbed from an elf core file.  */
+  struct core_elf_obj_tdata *core;
+
+  /* More information held for output ELF BFDs.  */
+  struct output_elf_obj_tdata *o;
 };
 
 #define elf_tdata(bfd)		((bfd) -> tdata.elf_obj_data)
 
 #define elf_object_id(bfd)	(elf_tdata(bfd) -> object_id)
-#define elf_program_header_size(bfd) (elf_tdata(bfd) -> program_header_size)
+#define elf_program_header_size(bfd) (elf_tdata(bfd) -> o->program_header_size)
 #define elf_elfheader(bfd)	(elf_tdata(bfd) -> elf_header)
 #define elf_elfsections(bfd)	(elf_tdata(bfd) -> elf_sect_ptr)
 #define elf_numsections(bfd)	(elf_tdata(bfd) -> num_elf_sections)
-#define elf_shstrtab(bfd)	(elf_tdata(bfd) -> strtab_ptr)
+#define elf_seg_map(bfd)	(elf_tdata(bfd) -> o->seg_map)
+#define elf_next_file_pos(bfd)	(elf_tdata(bfd) -> o->next_file_pos)
+#define elf_eh_frame_hdr(bfd)	(elf_tdata(bfd) -> o->eh_frame_hdr)
+#define elf_linker(bfd)		(elf_tdata(bfd) -> o->linker)
+#define elf_stack_flags(bfd)	(elf_tdata(bfd) -> o->stack_flags)
+#define elf_shstrtab(bfd)	(elf_tdata(bfd) -> o->strtab_ptr)
 #define elf_onesymtab(bfd)	(elf_tdata(bfd) -> symtab_section)
 #define elf_symtab_shndx(bfd)	(elf_tdata(bfd) -> symtab_shndx_section)
+#define elf_strtab_sec(bfd)	(elf_tdata(bfd) -> o->strtab_section)
+#define elf_shstrtab_sec(bfd)	(elf_tdata(bfd) -> o->shstrtab_section)
 #define elf_symtab_hdr(bfd)	(elf_tdata(bfd) -> symtab_hdr)
 #define elf_dynsymtab(bfd)	(elf_tdata(bfd) -> dynsymtab_section)
 #define elf_dynversym(bfd)	(elf_tdata(bfd) -> dynversym_section)
@@ -1692,10 +1709,8 @@
 #define elf_dynverref(bfd)	(elf_tdata(bfd) -> dynverref_section)
 #define elf_eh_frame_section(bfd) \
 				(elf_tdata(bfd) -> eh_frame_section)
-#define elf_num_locals(bfd)	(elf_tdata(bfd) -> num_locals)
-#define elf_num_globals(bfd)	(elf_tdata(bfd) -> num_globals)
-#define elf_section_syms(bfd)	(elf_tdata(bfd) -> section_syms)
-#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
+#define elf_section_syms(bfd)	(elf_tdata(bfd) -> o->section_syms)
+#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> o->num_section_syms)
 #define core_prpsinfo(bfd)	(elf_tdata(bfd) -> prpsinfo)
 #define core_prstatus(bfd)	(elf_tdata(bfd) -> prstatus)
 #define elf_gp(bfd)		(elf_tdata(bfd) -> gp)
@@ -1708,7 +1723,7 @@
 #define elf_dt_audit(bfd)	(elf_tdata(bfd) -> dt_audit)
 #define elf_dyn_lib_class(bfd)	(elf_tdata(bfd) -> dyn_lib_class)
 #define elf_bad_symtab(bfd)	(elf_tdata(bfd) -> bad_symtab)
-#define elf_flags_init(bfd)	(elf_tdata(bfd) -> flags_init)
+#define elf_flags_init(bfd)	(elf_tdata(bfd) -> o->flags_init)
 #define elf_known_obj_attributes(bfd) (elf_tdata (bfd) -> known_obj_attributes)
 #define elf_other_obj_attributes(bfd) (elf_tdata (bfd) -> other_obj_attributes)
 #define elf_known_obj_attributes_proc(bfd) \
@@ -1763,7 +1778,8 @@
   (bfd *input_bfd, struct bfd_link_info *info, asection *eh_frame_section);
 
 extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
-  (const Elf_Internal_Rela *);
+  (const struct bfd_link_info *, const asection *,
+   const Elf_Internal_Rela *);
 extern bfd_vma _bfd_elf_rela_local_sym
   (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *);
 extern bfd_vma _bfd_elf_rel_local_sym
@@ -1792,6 +1808,8 @@
   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
 extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
   (bfd *);
+extern void _bfd_elf_link_hash_table_free
+  (struct bfd_link_hash_table *);
 extern void _bfd_elf_link_hash_copy_indirect
   (struct bfd_link_info *, struct elf_link_hash_entry *,
    struct elf_link_hash_entry *);
@@ -1876,9 +1894,16 @@
 extern bfd_boolean _bfd_elf_find_nearest_line
   (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
    unsigned int *);
+extern bfd_boolean _bfd_elf_find_nearest_line_discriminator
+  (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
+   unsigned int *, unsigned int *);
 extern bfd_boolean _bfd_elf_find_line
   (bfd *, asymbol **, asymbol *, const char **, unsigned int *);
+extern bfd_boolean _bfd_elf_find_line_discriminator
+  (bfd *, asymbol **, asymbol *, const char **, unsigned int *, unsigned int *);
 #define _bfd_generic_find_line _bfd_elf_find_line
+#define _bfd_generic_find_nearest_line_discriminator \
+        _bfd_elf_find_nearest_line_discriminator
 extern bfd_boolean _bfd_elf_find_inliner_info
   (bfd *, const char **, const char **, unsigned int *);
 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
@@ -1887,8 +1912,6 @@
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean _bfd_elf_new_section_hook
   (bfd *, asection *);
-extern bfd_boolean _bfd_elf_init_reloc_shdr
-  (bfd *, struct bfd_elf_section_reloc_data *, asection *, bfd_boolean);
 extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
   (const char *, const struct bfd_elf_special_section *, unsigned int);
 extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
@@ -1923,8 +1946,12 @@
   (struct elf_strtab_hash *, bfd_size_type);
 extern void _bfd_elf_strtab_delref
   (struct elf_strtab_hash *, bfd_size_type);
+extern unsigned int _bfd_elf_strtab_refcount
+  (struct elf_strtab_hash *, bfd_size_type);
 extern void _bfd_elf_strtab_clear_all_refs
-  (struct elf_strtab_hash *);
+  (struct elf_strtab_hash *tab);
+extern void _bfd_elf_strtab_restore_size
+  (struct elf_strtab_hash *, bfd_size_type);
 extern bfd_size_type _bfd_elf_strtab_size
   (struct elf_strtab_hash *);
 extern bfd_size_type _bfd_elf_strtab_offset
@@ -1957,12 +1984,6 @@
 extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
   (struct bfd_link_info *);
 
-extern bfd_boolean _bfd_elf_merge_symbol
-  (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
-   asection **, bfd_vma *, unsigned int *,
-   struct elf_link_hash_entry **, bfd_boolean *,
-   bfd_boolean *, bfd_boolean *, bfd_boolean *);
-
 extern bfd_boolean _bfd_elf_hash_symbol (struct elf_link_hash_entry *);
 
 extern long _bfd_elf_link_lookup_local_dynindx
@@ -2118,6 +2139,8 @@
 
 extern bfd_boolean _bfd_elf_relocs_compatible
   (const bfd_target *, const bfd_target *);
+extern bfd_boolean _bfd_elf_notice_as_needed
+  (bfd *, struct bfd_link_info *, enum notice_asneeded_action);
 
 extern struct elf_link_hash_entry *_bfd_elf_archive_symbol_lookup
   (bfd *, struct bfd_link_info *, const char *);
@@ -2253,13 +2276,57 @@
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_s390_system_call
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_s390_tdb
+  (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_arm_vfp
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_aarch_tls
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_aarch_hw_break
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_aarch_hw_watch
+  (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_lwpstatus
   (bfd *, char *, int *, long, int, const void *);
 extern char *elfcore_write_register_note
   (bfd *, char *, int *, const char *, const void *, int);
 
+/* Internal structure which holds information to be included in the
+   PRPSINFO section of Linux core files.
+
+   This is an "internal" structure in the sense that it should be used
+   to pass information to BFD (via the `elfcore_write_linux_prpsinfo'
+   function), so things like endianess shouldn't be an issue.  This
+   structure will eventually be converted in one of the
+   `elf_external_linux_*' structures and written out to an output bfd
+   by one of the functions declared below.  */
+
+struct elf_internal_linux_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long pr_flag;		/* Flags.  */
+    unsigned int pr_uid;
+    unsigned int pr_gid;
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    char pr_fname[16 + 1];		/* Filename of executable.  */
+    char pr_psargs[80 + 1];		/* Initial part of arg list.  */
+  };
+
+/* Linux/most 32-bit archs.  */
+extern char *elfcore_write_linux_prpsinfo32
+  (bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *);
+
+/* Linux/most 64-bit archs.  */
+extern char *elfcore_write_linux_prpsinfo64
+  (bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *);
+
+/* Linux/PPC32 uses different layout compared to most archs.  */
+extern char *elfcore_write_ppc_linux_prpsinfo32
+  (bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *);
+
 extern bfd *_bfd_elf32_bfd_from_remote_memory
   (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
    int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type));
@@ -2313,12 +2380,9 @@
 
 extern bfd_boolean _bfd_elf_create_ifunc_sections
   (bfd *, struct bfd_link_info *);
-extern asection * _bfd_elf_create_ifunc_dyn_reloc
-  (bfd *, struct bfd_link_info *, asection *sec, asection *sreloc,
-   struct elf_dyn_relocs **);
 extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs
   (struct bfd_link_info *, struct elf_link_hash_entry *,
-   struct elf_dyn_relocs **, unsigned int, unsigned int);
+   struct elf_dyn_relocs **, unsigned int, unsigned int, unsigned int);
 
 extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *);
 extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *);
@@ -2350,7 +2414,7 @@
 #define RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel,	\
 				r_symndx, symtab_hdr, sym_hashes,	\
 				h, sec, relocation,			\
-				unresolved_reloc, warned)		\
+				unresolved_reloc, warned, ignored)	\
   do									\
     {									\
       /* It seems this can happen with erroneous or unsupported		\
@@ -2365,6 +2429,7 @@
 	h = (struct elf_link_hash_entry *) h->root.u.i.link;		\
 									\
       warned = FALSE;							\
+      ignored = FALSE;							\
       unresolved_reloc = FALSE;						\
       relocation = 0;							\
       if (h->root.type == bfd_link_hash_defined				\
@@ -2387,7 +2452,7 @@
 	;								\
       else if (info->unresolved_syms_in_objects == RM_IGNORE		\
 	       && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)		\
-	;								\
+	ignored = TRUE;							\
       else if (!info->relocatable)					\
 	{								\
 	  bfd_boolean err;						\
@@ -2403,6 +2468,7 @@
 	}								\
       (void) unresolved_reloc;						\
       (void) warned;							\
+      (void) ignored;							\
     }									\
   while (0)
 
@@ -2432,16 +2498,16 @@
 	rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \
 									\
 	/* Avoid empty output section.  */				\
-	if (rel_hdr->sh_size > count * rel_hdr->sh_entsize)		\
+	if (rel_hdr->sh_size > rel_hdr->sh_entsize)			\
 	  {								\
-	    rel_hdr->sh_size -= count * rel_hdr->sh_entsize;		\
+	    rel_hdr->sh_size -= rel_hdr->sh_entsize;			\
 	    rel_hdr = _bfd_elf_single_rel_hdr (input_section);		\
-	    rel_hdr->sh_size -= count * rel_hdr->sh_entsize;		\
+	    rel_hdr->sh_size -= rel_hdr->sh_entsize;			\
 									\
 	    memmove (rel, rel + count,					\
 		     (relend - rel - count) * sizeof (*rel));		\
 									\
-	    input_section->reloc_count -= count;			\
+	    input_section->reloc_count--;				\
 	    relend -= count;						\
 	    rel--;							\
 	    continue;							\
@@ -2457,7 +2523,7 @@
     continue;								\
   }
 
-/* Will a symbol be bound to the the definition within the shared
+/* Will a symbol be bound to the definition within the shared
    library, if any.  A unique symbol can never be bound locally.  */
 #define SYMBOLIC_BIND(INFO, H) \
     (!(H)->unique_global \
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index a75d806..832a991 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1243,7 +1243,7 @@
   if (hdr_info->table)
     sec->size += 4 + hdr_info->fde_count * 8;
 
-  elf_tdata (abfd)->eh_frame_hdr = sec;
+  elf_eh_frame_hdr (abfd) = sec;
   return TRUE;
 }
 
@@ -1770,74 +1770,81 @@
   struct elf_link_hash_table *htab;
   struct eh_frame_hdr_info *hdr_info;
   asection *sec;
-  bfd_byte *contents;
-  asection *eh_frame_sec;
-  bfd_size_type size;
-  bfd_boolean retval;
-  bfd_vma encoded_eh_frame;
+  bfd_boolean retval = TRUE;
 
   htab = elf_hash_table (info);
   hdr_info = &htab->eh_info;
   sec = hdr_info->hdr_sec;
-  if (sec == NULL)
-    return TRUE;
 
-  size = EH_FRAME_HDR_SIZE;
-  if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
-    size += 4 + hdr_info->fde_count * 8;
-  contents = (bfd_byte *) bfd_malloc (size);
-  if (contents == NULL)
-    return FALSE;
-
-  eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame");
-  if (eh_frame_sec == NULL)
+  if (info->eh_frame_hdr && sec != NULL)
     {
-      free (contents);
-      return FALSE;
-    }
+      bfd_byte *contents;
+      asection *eh_frame_sec;
+      bfd_size_type size;
+      bfd_vma encoded_eh_frame;
 
-  memset (contents, 0, EH_FRAME_HDR_SIZE);
-  contents[0] = 1;				/* Version.  */
-  contents[1] = get_elf_backend_data (abfd)->elf_backend_encode_eh_address
-    (abfd, info, eh_frame_sec, 0, sec, 4,
-     &encoded_eh_frame);			/* .eh_frame offset.  */
+      size = EH_FRAME_HDR_SIZE;
+      if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
+	size += 4 + hdr_info->fde_count * 8;
+      contents = (bfd_byte *) bfd_malloc (size);
+      if (contents == NULL)
+	return FALSE;
 
-  if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
-    {
-      contents[2] = DW_EH_PE_udata4;		/* FDE count encoding.  */
-      contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* Search table enc.  */
-    }
-  else
-    {
-      contents[2] = DW_EH_PE_omit;
-      contents[3] = DW_EH_PE_omit;
-    }
-  bfd_put_32 (abfd, encoded_eh_frame, contents + 4);
-
-  if (contents[2] != DW_EH_PE_omit)
-    {
-      unsigned int i;
-
-      bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE);
-      qsort (hdr_info->array, hdr_info->fde_count, sizeof (*hdr_info->array),
-	     vma_compare);
-      for (i = 0; i < hdr_info->fde_count; i++)
+      eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame");
+      if (eh_frame_sec == NULL)
 	{
-	  bfd_put_32 (abfd,
-		      hdr_info->array[i].initial_loc
-		      - sec->output_section->vma,
-		      contents + EH_FRAME_HDR_SIZE + i * 8 + 4);
-	  bfd_put_32 (abfd,
-		      hdr_info->array[i].fde - sec->output_section->vma,
-		      contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
+	  free (contents);
+	  return FALSE;
 	}
-    }
 
-  /* FIXME: octets_per_byte.  */
-  retval = bfd_set_section_contents (abfd, sec->output_section,
-				     contents, (file_ptr) sec->output_offset,
-				     sec->size);
-  free (contents);
+      memset (contents, 0, EH_FRAME_HDR_SIZE);
+      /* Version.  */
+      contents[0] = 1;
+      /* .eh_frame offset.  */
+      contents[1] = get_elf_backend_data (abfd)->elf_backend_encode_eh_address
+	(abfd, info, eh_frame_sec, 0, sec, 4, &encoded_eh_frame);
+
+      if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
+	{
+	  /* FDE count encoding.  */
+	  contents[2] = DW_EH_PE_udata4;
+	  /* Search table encoding.  */
+	  contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4;
+	}
+      else
+	{
+	  contents[2] = DW_EH_PE_omit;
+	  contents[3] = DW_EH_PE_omit;
+	}
+      bfd_put_32 (abfd, encoded_eh_frame, contents + 4);
+
+      if (contents[2] != DW_EH_PE_omit)
+	{
+	  unsigned int i;
+
+	  bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE);
+	  qsort (hdr_info->array, hdr_info->fde_count,
+		 sizeof (*hdr_info->array), vma_compare);
+	  for (i = 0; i < hdr_info->fde_count; i++)
+	    {
+	      bfd_put_32 (abfd,
+			  hdr_info->array[i].initial_loc
+			  - sec->output_section->vma,
+			  contents + EH_FRAME_HDR_SIZE + i * 8 + 4);
+	      bfd_put_32 (abfd,
+			  hdr_info->array[i].fde - sec->output_section->vma,
+			  contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
+	    }
+	}
+
+      /* FIXME: octets_per_byte.  */
+      retval = bfd_set_section_contents (abfd, sec->output_section, contents,
+					 (file_ptr) sec->output_offset,
+					 sec->size);
+      free (contents);
+    }
+  if (hdr_info->array != NULL)
+    free (hdr_info->array);
   return retval;
 }
 
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index 3ba96c7..8d48e66 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -1,5 +1,5 @@
 /* ELF STT_GNU_IFUNC support.
-   Copyright 2009
+   Copyright 2009-2013
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -104,51 +104,6 @@
   return TRUE;
 }
 
-/* For a STT_GNU_IFUNC symbol, create a dynamic reloc section, SRELOC,
-   for the input section, SEC, and append this reloc to HEAD.  */
-
-asection *
-_bfd_elf_create_ifunc_dyn_reloc (bfd *abfd, struct bfd_link_info *info,
-				 asection *sec, asection *sreloc,
-				 struct elf_dyn_relocs **head)
-{
-  struct elf_dyn_relocs *p;
-  struct elf_link_hash_table *htab = elf_hash_table (info);
-
-  if (sreloc == NULL)
-    {
-      const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-
-      if (htab->dynobj == NULL)
-	htab->dynobj = abfd;
-
-      sreloc = _bfd_elf_make_dynamic_reloc_section (sec, htab->dynobj,
-						    bed->s->log_file_align,
-						    abfd,
-						    bed->rela_plts_and_copies_p); 
-      if (sreloc == NULL)
-	return NULL;
-    }
-		      
-  p = *head;
-  if (p == NULL || p->sec != sec)
-    {
-      bfd_size_type amt = sizeof *p;
-
-      p = ((struct elf_dyn_relocs *) bfd_alloc (htab->dynobj, amt));
-      if (p == NULL)
-	return NULL;
-      p->next = *head;
-      *head = p;
-      p->sec = sec;
-      p->count = 0;
-      p->pc_count = 0;
-    }
-  p->count += 1;
-
-  return sreloc;
-}
-
 /* Allocate space in .plt, .got and associated reloc sections for
    dynamic relocs against a STT_GNU_IFUNC symbol definition.  */
 
@@ -157,6 +112,7 @@
 				    struct elf_link_hash_entry *h,
 				    struct elf_dyn_relocs **head,
 				    unsigned int plt_entry_size,
+				    unsigned int plt_header_size,
 				    unsigned int got_entry_size)
 {
   asection *plt, *gotplt, *relplt;
@@ -175,7 +131,7 @@
 	  || info->export_dynamic)
       && h->pointer_equality_needed)
     {
-      info->callbacks->einfo 
+      info->callbacks->einfo
 	(_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
 	   "equality in `%B' can not be used when making an "
 	   "executable; recompile with -fPIE and relink with -pie\n"),
@@ -187,23 +143,20 @@
 
   htab = elf_hash_table (info);
 
+  /* When building shared library, we need to handle the case where it is
+     marked with regular reference, but not non-GOT reference since the
+     non-GOT reference bit may not be set here.  */
+  if (info->shared && !h->non_got_ref && h->ref_regular)
+    for (p = *head; p != NULL; p = p->next)
+      if (p->count)
+	{
+	  h->non_got_ref = 1;
+	  goto keep;
+	}
+
   /* Support garbage collection against STT_GNU_IFUNC symbols.  */
   if (h->plt.refcount <= 0 && h->got.refcount <= 0)
     {
-      /* When building shared library, we need to handle the case
-         where it is marked with regular reference, but not non-GOT
-	 reference.  It may happen if we didn't see STT_GNU_IFUNC
-	 symbol at the time when checking relocations.  */
-      if (info->shared
-	  && !h->non_got_ref
-	  && h->ref_regular)
-	for (p = *head; p != NULL; p = p->next)
-	  if (p->count)
-	    {
-	      h->non_got_ref = 1;
-	      goto keep;
-	    }
-
       h->got = htab->init_got_offset;
       h->plt = htab->init_plt_offset;
       *head = NULL;
@@ -241,7 +194,7 @@
       /* If this is the first .plt entry, make room for the special
 	 first entry.  */
       if (plt->size == 0)
-	plt->size += plt_entry_size;
+	plt->size += plt_header_size;
     }
   else
     {
@@ -251,7 +204,7 @@
     }
 
   /* Don't update value of STT_GNU_IFUNC symbol to PLT.  We need
-     the original value for R_*_IRELATIVE.  */  
+     the original value for R_*_IRELATIVE.  */
   h->plt.offset = plt->size;
 
   /* Make room for this entry in the .plt/.iplt section.  */
diff --git a/bfd/elf-linux-psinfo.h b/bfd/elf-linux-psinfo.h
new file mode 100644
index 0000000..c965284
--- /dev/null
+++ b/bfd/elf-linux-psinfo.h
@@ -0,0 +1,127 @@
+/* Definitions for PRPSINFO structures under ELF on GNU/Linux.
+   Copyright 2013 Free Software Foundation, Inc.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#ifndef ELF_LINUX_PSINFO_H
+#define ELF_LINUX_PSINFO_H
+
+/* The PRPSINFO structures defined below are used by most
+   architectures, although some of them define their own versions
+   (like e.g., PPC).  */
+
+/* External 32-bit structure for PRPSINFO.  This structure is
+   ABI-defined, thus we choose to use char arrays here in order to
+   avoid dealing with different types in different architectures.
+
+   This structure will ultimately be written in the corefile's note
+   section, as the PRPSINFO.  */
+
+struct elf_external_linux_prpsinfo32
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    char pr_flag[4];			/* Flags.  */
+    char pr_uid[2];
+    char pr_gid[2];
+    char pr_pid[4];
+    char pr_ppid[4];
+    char pr_pgrp[4];
+    char pr_sid[4];
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[80];			/* Initial part of arg list.  */
+  };
+
+/* Helper macro to swap (properly handling endianess) things from the
+   `elf_internal_linux_prpsinfo' structure to the
+   `elf_external_linux_prpsinfo32' structure.
+
+   Note that FROM should be a pointer, and TO should be the explicit
+   type.  */
+
+#define LINUX_PRPSINFO32_SWAP_FIELDS(abfd, from, to)			\
+  do									\
+    {									\
+      H_PUT_8 (abfd, from->pr_state, &to.pr_state);			\
+      H_PUT_8 (abfd, from->pr_sname, &to.pr_sname);			\
+      H_PUT_8 (abfd, from->pr_zomb, &to.pr_zomb);			\
+      H_PUT_8 (abfd, from->pr_nice, &to.pr_nice);			\
+      H_PUT_32 (abfd, from->pr_flag, to.pr_flag);			\
+      H_PUT_16 (abfd, from->pr_uid, to.pr_uid);				\
+      H_PUT_16 (abfd, from->pr_gid, to.pr_gid);				\
+      H_PUT_32 (abfd, from->pr_pid, to.pr_pid);				\
+      H_PUT_32 (abfd, from->pr_ppid, to.pr_ppid);			\
+      H_PUT_32 (abfd, from->pr_pgrp, to.pr_pgrp);			\
+      H_PUT_32 (abfd, from->pr_sid, to.pr_sid);				\
+      strncpy (to.pr_fname, from->pr_fname, sizeof (to.pr_fname));	\
+      strncpy (to.pr_psargs, from->pr_psargs, sizeof (to.pr_psargs));	\
+    } while (0)
+
+/* External 64-bit structure for PRPSINFO.  This structure is
+   ABI-defined, thus we choose to use char arrays here in order to
+   avoid dealing with different types in different architectures.
+
+   This structure will ultimately be written in the corefile's note
+   section, as the PRPSINFO.  */
+
+struct elf_external_linux_prpsinfo64
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    char pr_flag[8];			/* Flags.  */
+    char gap[4];
+    char pr_uid[4];
+    char pr_gid[4];
+    char pr_pid[4];
+    char pr_ppid[4];
+    char pr_pgrp[4];
+    char pr_sid[4];
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[80];			/* Initial part of arg list.  */
+  };
+
+/* Helper macro to swap (properly handling endianess) things from the
+   `elf_internal_linux_prpsinfo' structure to the
+   `elf_external_linux_prpsinfo64' structure.
+
+   Note that FROM should be a pointer, and TO should be the explicit
+   type.  */
+
+#define LINUX_PRPSINFO64_SWAP_FIELDS(abfd, from, to)			\
+  do									\
+    {									\
+      H_PUT_8 (abfd, from->pr_state, &to.pr_state);			\
+      H_PUT_8 (abfd, from->pr_sname, &to.pr_sname);			\
+      H_PUT_8 (abfd, from->pr_zomb, &to.pr_zomb);			\
+      H_PUT_8 (abfd, from->pr_nice, &to.pr_nice);			\
+      H_PUT_64 (abfd, from->pr_flag, to.pr_flag);			\
+      H_PUT_32 (abfd, from->pr_uid, to.pr_uid);				\
+      H_PUT_32 (abfd, from->pr_gid, to.pr_gid);				\
+      H_PUT_32 (abfd, from->pr_pid, to.pr_pid);				\
+      H_PUT_32 (abfd, from->pr_ppid, to.pr_ppid);			\
+      H_PUT_32 (abfd, from->pr_pgrp, to.pr_pgrp);			\
+      H_PUT_32 (abfd, from->pr_sid, to.pr_sid);				\
+      strncpy (to.pr_fname, from->pr_fname, sizeof (to.pr_fname));	\
+      strncpy (to.pr_psargs, from->pr_psargs, sizeof (to.pr_psargs));	\
+    } while (0)
+
+#endif
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index f427f97..a7553f3 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -373,12 +373,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 709ea16..bc3700d 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -604,7 +604,7 @@
 	 0xffffffff,		/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
-  
+
   HOWTO (R_MN10300_SYM_DIFF,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1084,6 +1084,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       r_type = ELF32_R_TYPE (rel->r_info);
@@ -1147,7 +1151,7 @@
 	  if (info->shared)
 	    info->flags |= DF_STATIC_TLS;
 	  /* Fall through */
-	  
+
 	case R_MN10300_TLS_GD:
 	case R_MN10300_GOT32:
 	case R_MN10300_GOT24:
@@ -2007,7 +2011,7 @@
       bfd_reloc_status_type r;
       int tls_r_type;
       bfd_boolean unresolved_reloc = FALSE;
-      bfd_boolean warned;
+      bfd_boolean warned, ignored;
       struct elf_link_hash_entry * hh;
 
       relocation = 0;
@@ -2030,7 +2034,7 @@
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   hh, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
       h = elf_mn10300_hash_entry (hh);
 
@@ -2425,7 +2429,7 @@
 	 serve to keep the section artifically inflated.  */
       if (ELF32_R_TYPE ((irelend - 1)->r_info) == (int) R_MN10300_ALIGN)
 	--irelend;
-      
+
       /* The deletion must stop at the next ALIGN reloc for an aligment
 	 power larger than, or not a multiple of, the number of bytes we
 	 are deleting.  */
@@ -4603,7 +4607,7 @@
   struct elf32_mn10300_link_hash_table *ret;
   bfd_size_type amt = sizeof (* ret);
 
-  ret = bfd_malloc (amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -4616,14 +4620,10 @@
       return NULL;
     }
 
-  ret->flags = 0;
-  ret->tls_ldm_got.refcount = 0;
   ret->tls_ldm_got.offset = -1;
-  ret->tls_ldm_got.got_allocated = 0;
-  ret->tls_ldm_got.rel_emitted = 0;
 
   amt = sizeof (struct elf_link_hash_table);
-  ret->static_hash_table = bfd_malloc (amt);
+  ret->static_hash_table = bfd_zmalloc (amt);
   if (ret->static_hash_table == NULL)
     {
       free (ret);
@@ -4650,9 +4650,9 @@
   struct elf32_mn10300_link_hash_table *ret
     = (struct elf32_mn10300_link_hash_table *) hash;
 
-  _bfd_generic_link_hash_table_free
+  _bfd_elf_link_hash_table_free
     ((struct bfd_link_hash_table *) ret->static_hash_table);
-  _bfd_generic_link_hash_table_free
+  _bfd_elf_link_hash_table_free
     ((struct bfd_link_hash_table *) ret);
 }
 
@@ -5395,7 +5395,7 @@
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
-  if (streq (h->root.root.string, "_DYNAMIC")
+  if (h == elf_hash_table (info)->hdynamic
       || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
 
@@ -5536,7 +5536,9 @@
    properly.  */
 
 static enum elf_reloc_type_class
-_bfd_mn10300_elf_reloc_type_class (const Elf_Internal_Rela *rela)
+_bfd_mn10300_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+				   const asection *rel_sec ATTRIBUTE_UNUSED,
+				   const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
diff --git a/bfd/elf-nacl.c b/bfd/elf-nacl.c
index 842e367..944aa34 100644
--- a/bfd/elf-nacl.c
+++ b/bfd/elf-nacl.c
@@ -1,5 +1,5 @@
 /* Native Client support for ELF
-   Copyright 2012 Free Software Foundation, Inc.
+   Copyright 2012, 2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -20,6 +20,7 @@
 
 #include "sysdep.h"
 #include "bfd.h"
+#include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf-nacl.h"
 #include "elf/common.h"
@@ -33,28 +34,32 @@
   else
     {
       /* The p_flags value has not been computed yet,
-         so we have to look through the sections.  */
+	 so we have to look through the sections.  */
       unsigned int i;
       for (i = 0; i < seg->count; ++i)
-        if (seg->sections[i]->flags & SEC_CODE)
-          return TRUE;
+	if (seg->sections[i]->flags & SEC_CODE)
+	  return TRUE;
     }
   return FALSE;
 }
 
+/* Determine if this segment is eligible to receive the file and program
+   headers.  It must be read-only and non-executable.
+   Its first section must start far enough past the page boundary to
+   allow space for the headers.  */
 static bfd_boolean
-segment_nonexecutable_and_has_contents (struct elf_segment_map *seg)
+segment_eligible_for_headers (struct elf_segment_map *seg,
+			      bfd_vma minpagesize, bfd_vma sizeof_headers)
 {
-  bfd_boolean any_contents = FALSE;
   unsigned int i;
+  if (seg->count == 0 || seg->sections[0]->lma % minpagesize < sizeof_headers)
+    return FALSE;
   for (i = 0; i < seg->count; ++i)
     {
-      if (seg->sections[i]->flags & SEC_CODE)
-        return FALSE;
-      if (seg->sections[i]->flags & SEC_HAS_CONTENTS)
-        any_contents = TRUE;
+      if ((seg->sections[i]->flags & (SEC_CODE|SEC_READONLY)) != SEC_READONLY)
+	return FALSE;
     }
-  return any_contents;
+  return TRUE;
 }
 
 
@@ -64,66 +69,154 @@
 bfd_boolean
 nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
 {
-  struct elf_segment_map **m = &elf_tdata (abfd)->segment_map;
+  const struct elf_backend_data *const bed = get_elf_backend_data (abfd);
+  struct elf_segment_map **m = &elf_seg_map (abfd);
   struct elf_segment_map **first_load = NULL;
   struct elf_segment_map **last_load = NULL;
   bfd_boolean moved_headers = FALSE;
+  int sizeof_headers;
 
   if (info != NULL && info->user_phdrs)
     /* The linker script used PHDRS explicitly, so don't change what the
        user asked for.  */
     return TRUE;
 
+  if (info != NULL)
+    /* We're doing linking, so evalute SIZEOF_HEADERS as in a linker script.  */
+    sizeof_headers = bfd_sizeof_headers (abfd, info);
+  else
+    {
+      /* We're not doing linking, so this is objcopy or suchlike.
+	 We just need to collect the size of the existing headers.  */
+      struct elf_segment_map *seg;
+      sizeof_headers = bed->s->sizeof_ehdr;
+      for (seg = *m; seg != NULL; seg = seg->next)
+	sizeof_headers += bed->s->sizeof_phdr;
+    }
+
   while (*m != NULL)
     {
       struct elf_segment_map *seg = *m;
 
       if (seg->p_type == PT_LOAD)
-        {
-          /* First, we're just finding the earliest PT_LOAD.
-             By the normal rules, this will be the lowest-addressed one.
-             We only have anything interesting to do if it's executable.  */
-          last_load = m;
-          if (first_load == NULL)
-            {
-              if (!segment_executable (*m))
-                return TRUE;
-              first_load = m;
-            }
-          /* Now that we've noted the first PT_LOAD, we're looking for
-             the first non-executable PT_LOAD with a nonempty p_filesz.  */
-          else if (!moved_headers
-                   && segment_nonexecutable_and_has_contents (seg))
-            {
-              /* This is the one we were looking for!
+	{
+	  bfd_boolean executable = segment_executable (seg);
 
-                 First, clear the flags on previous segments that
-                 say they include the file header and phdrs.  */
-              struct elf_segment_map *prevseg;
-              for (prevseg = *first_load;
-                   prevseg != seg;
-                   prevseg = prevseg->next)
-                if (prevseg->p_type == PT_LOAD)
-                  {
-                    prevseg->includes_filehdr = 0;
-                    prevseg->includes_phdrs = 0;
-                  }
+	  if (executable
+	      && seg->count > 0
+	      && seg->sections[0]->vma % bed->minpagesize == 0)
+	    {
+	      asection *lastsec = seg->sections[seg->count - 1];
+	      bfd_vma end = lastsec->vma + lastsec->size;
+	      if (end % bed->minpagesize != 0)
+		{
+		  /* This is an executable segment that starts on a page
+		     boundary but does not end on a page boundary.  Fill
+		     it out to a whole page with code fill (the tail of
+		     the segment will not be within any section).  Thus
+		     the entire code segment can be mapped from the file
+		     as whole pages and that mapping will contain only
+		     valid instructions.
 
-              /* This segment will include those headers instead.  */
-              seg->includes_filehdr = 1;
-              seg->includes_phdrs = 1;
+		     To accomplish this, we must fake out the code in
+		     assign_file_positions_for_load_sections (elf.c) so
+		     that it advances past the rest of the final page,
+		     rather than trying to put the next (unaligned, or
+		     unallocated) section.  We do this by appending a
+		     dummy section record to this element in the segment
+		     map.  No such output section ever actually exists,
+		     but this gets the layout logic to advance the file
+		     positions past this partial page.  Since we are
+		     lying to BFD like this, nothing will ever know to
+		     write the section contents.  So we do that by hand
+		     after the fact, in nacl_final_write_processing, below.  */
 
-              moved_headers = TRUE;
-            }
-        }
+		  struct elf_segment_map *newseg;
+		  asection *sec;
+		  struct bfd_elf_section_data *secdata;
 
+		  BFD_ASSERT (!seg->p_size_valid);
+
+		  secdata = bfd_zalloc (abfd, sizeof *secdata);
+		  if (secdata == NULL)
+		    return FALSE;
+
+		  sec = bfd_zalloc (abfd, sizeof *sec);
+		  if (sec == NULL)
+		    return FALSE;
+
+		  /* Fill in only the fields that actually affect the logic
+		     in assign_file_positions_for_load_sections.  */
+		  sec->vma = end;
+		  sec->lma = lastsec->lma + lastsec->size;
+		  sec->size = bed->minpagesize - (end % bed->minpagesize);
+		  sec->flags = (SEC_ALLOC | SEC_LOAD
+				| SEC_READONLY | SEC_CODE | SEC_LINKER_CREATED);
+		  sec->used_by_bfd = secdata;
+
+		  secdata->this_hdr.sh_type = SHT_PROGBITS;
+		  secdata->this_hdr.sh_flags = SHF_ALLOC | SHF_EXECINSTR;
+		  secdata->this_hdr.sh_addr = sec->vma;
+		  secdata->this_hdr.sh_size = sec->size;
+
+		  newseg = bfd_alloc (abfd,
+				      sizeof *newseg + ((seg->count + 1)
+							* sizeof (asection *)));
+		  if (newseg == NULL)
+		    return FALSE;
+		  memcpy (newseg, seg,
+			  sizeof *newseg + (seg->count * sizeof (asection *)));
+		  newseg->sections[newseg->count++] = sec;
+		  *m = seg = newseg;
+		}
+	    }
+
+	  /* First, we're just finding the earliest PT_LOAD.
+	     By the normal rules, this will be the lowest-addressed one.
+	     We only have anything interesting to do if it's executable.  */
+	  last_load = m;
+	  if (first_load == NULL)
+	    {
+	      if (!executable)
+		goto next;
+	      first_load = m;
+	    }
+	  /* Now that we've noted the first PT_LOAD, we're looking for
+	     the first non-executable PT_LOAD with a nonempty p_filesz.  */
+	  else if (!moved_headers
+		   && segment_eligible_for_headers (seg, bed->minpagesize,
+						    sizeof_headers))
+	    {
+	      /* This is the one we were looking for!
+
+		 First, clear the flags on previous segments that
+		 say they include the file header and phdrs.  */
+	      struct elf_segment_map *prevseg;
+	      for (prevseg = *first_load;
+		   prevseg != seg;
+		   prevseg = prevseg->next)
+		if (prevseg->p_type == PT_LOAD)
+		  {
+		    prevseg->includes_filehdr = 0;
+		    prevseg->includes_phdrs = 0;
+		  }
+
+	      /* This segment will include those headers instead.  */
+	      seg->includes_filehdr = 1;
+	      seg->includes_phdrs = 1;
+
+	      moved_headers = TRUE;
+	    }
+	}
+
+    next:
       m = &seg->next;
     }
 
   if (first_load != last_load && moved_headers)
     {
       /* Now swap the first and last PT_LOAD segments'
-         positions in segment_map.  */
+	 positions in segment_map.  */
       struct elf_segment_map *first = *first_load;
       struct elf_segment_map *last = *last_load;
       *first_load = first->next;
@@ -139,10 +232,9 @@
    proper order for the ELF rule that they must appear in ascending address
    order.  So find the two segments we swapped before, and swap them back.  */
 bfd_boolean
-nacl_modify_program_headers (bfd *abfd,
-                             struct bfd_link_info *info ATTRIBUTE_UNUSED)
+nacl_modify_program_headers (bfd *abfd, struct bfd_link_info *info)
 {
-  struct elf_segment_map **m = &elf_tdata (abfd)->segment_map;
+  struct elf_segment_map **m = &elf_seg_map (abfd);
   Elf_Internal_Phdr *phdr = elf_tdata (abfd)->phdr;
   Elf_Internal_Phdr *p = phdr;
 
@@ -155,7 +247,7 @@
   while (*m != NULL)
     {
       if ((*m)->p_type == PT_LOAD && (*m)->includes_filehdr)
-        break;
+	break;
 
       m = &(*m)->next;
       ++p;
@@ -169,47 +261,95 @@
       Elf_Internal_Phdr *next_load_phdr = NULL;
 
       /* Now move past that first one and find the PT_LOAD that should be
-         before it by address order.  */
+	 before it by address order.  */
 
       m = &(*m)->next;
       ++p;
 
-      while ((*m) != NULL)
-        {
-          if (p->p_type == PT_LOAD && p->p_vaddr < first_load_phdr->p_vaddr)
-            {
-              next_load_seg = m;
-              next_load_phdr = p;
-              break;
-            }
+      while (*m != NULL)
+	{
+	  if (p->p_type == PT_LOAD && p->p_vaddr < first_load_phdr->p_vaddr)
+	    {
+	      next_load_seg = m;
+	      next_load_phdr = p;
+	      break;
+	    }
 
-          m = &(*m)->next;
-          ++p;
-        }
+	  m = &(*m)->next;
+	  ++p;
+	}
 
       /* Swap their positions in the segment_map back to how they used to be.
-         The phdrs have already been set up by now, so we have to slide up
-         the earlier ones to insert the one that should be first.  */
+	 The phdrs have already been set up by now, so we have to slide up
+	 the earlier ones to insert the one that should be first.  */
       if (next_load_seg != NULL)
-        {
-          Elf_Internal_Phdr move_phdr;
-          struct elf_segment_map *first_seg = *first_load_seg;
-          struct elf_segment_map *next_seg = *next_load_seg;
-          struct elf_segment_map *first_next = first_seg->next;
-          struct elf_segment_map *next_next = next_seg->next;
+	{
+	  Elf_Internal_Phdr move_phdr;
+	  struct elf_segment_map *first_seg = *first_load_seg;
+	  struct elf_segment_map *next_seg = *next_load_seg;
+	  struct elf_segment_map *first_next = first_seg->next;
+	  struct elf_segment_map *next_next = next_seg->next;
 
-          first_seg->next = next_next;
-          *first_load_seg = next_seg;
+	  if (next_load_seg == &first_seg->next)
+	    {
+	      *first_load_seg = next_seg;
+	      next_seg->next = first_seg;
+	      first_seg->next = next_next;
+	    }
+	  else
+	    {
+	      *first_load_seg = first_next;
+	      *next_load_seg = next_next;
 
-          next_seg->next = first_next;
-          *next_load_seg = first_seg;
+	      first_seg->next = *next_load_seg;
+	      *next_load_seg = first_seg;
 
-          move_phdr = *next_load_phdr;
-          memmove (first_load_phdr + 1, first_load_phdr,
-                   (next_load_phdr - first_load_phdr) * sizeof move_phdr);
-          *first_load_phdr = move_phdr;
-        }
+	      next_seg->next = *first_load_seg;
+	      *first_load_seg = next_seg;
+	    }
+
+	  move_phdr = *next_load_phdr;
+	  memmove (first_load_phdr + 1, first_load_phdr,
+		   (next_load_phdr - first_load_phdr) * sizeof move_phdr);
+	  *first_load_phdr = move_phdr;
+	}
     }
 
   return TRUE;
 }
+
+void
+nacl_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
+{
+  struct elf_segment_map *seg;
+  for (seg = elf_seg_map (abfd); seg != NULL; seg = seg->next)
+    if (seg->p_type == PT_LOAD
+	&& seg->count > 1
+	&& seg->sections[seg->count - 1]->owner == NULL)
+      {
+	/* This is a fake section added in nacl_modify_segment_map, above.
+	   It's not a real BFD section, so nothing wrote its contents.
+	   Now write out its contents.  */
+
+	asection *sec = seg->sections[seg->count - 1];
+	char *fill;
+
+	BFD_ASSERT (sec->flags & SEC_LINKER_CREATED);
+	BFD_ASSERT (sec->flags & SEC_CODE);
+	BFD_ASSERT (sec->size > 0);
+
+	fill = abfd->arch_info->fill (sec->size, bfd_big_endian (abfd), TRUE);
+
+	if (fill == NULL
+	    || bfd_seek (abfd, sec->filepos, SEEK_SET) != 0
+	    || bfd_bwrite (fill, sec->size, abfd) != sec->size)
+	  {
+	    /* We don't have a proper way to report an error here.  So
+	       instead fudge things so that elf_write_shdrs_and_ehdr will
+	       fail.  */
+	    elf_elfheader (abfd)->e_shoff = (file_ptr) -1;
+	  }
+
+	free (fill);
+      }
+}
diff --git a/bfd/elf-nacl.h b/bfd/elf-nacl.h
index 417c7e3..87719ef 100644
--- a/bfd/elf-nacl.h
+++ b/bfd/elf-nacl.h
@@ -1,5 +1,5 @@
 /* Native Client support for ELF
-   Copyright 2012 Free Software Foundation, Inc.
+   Copyright 2012, 2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -22,3 +22,4 @@
 
 bfd_boolean nacl_modify_segment_map (bfd *, struct bfd_link_info *);
 bfd_boolean nacl_modify_program_headers (bfd *, struct bfd_link_info *);
+void nacl_final_write_processing (bfd *, bfd_boolean linker);
diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c
index 7d2fad4..61cedae 100644
--- a/bfd/elf-strtab.c
+++ b/bfd/elf-strtab.c
@@ -201,15 +201,41 @@
   --tab->array[idx]->refcount;
 }
 
+unsigned int
+_bfd_elf_strtab_refcount (struct elf_strtab_hash *tab, bfd_size_type idx)
+{
+  return tab->array[idx]->refcount;
+}
+
 void
 _bfd_elf_strtab_clear_all_refs (struct elf_strtab_hash *tab)
 {
   bfd_size_type idx;
 
-  for (idx = 1; idx < tab->size; ++idx)
+  for (idx = 1; idx < tab->size; idx++)
     tab->array[idx]->refcount = 0;
 }
 
+/* Downsizes strtab.  Entries from IDX up to the current size are
+   removed from the array.  */
+void
+_bfd_elf_strtab_restore_size (struct elf_strtab_hash *tab, bfd_size_type idx)
+{
+  bfd_size_type curr_size = tab->size;
+
+  BFD_ASSERT (tab->sec_size == 0);
+  BFD_ASSERT (idx <= curr_size);
+  tab->size = idx;
+  for (; idx < curr_size; ++idx)
+    {
+      /* We don't remove entries from the hash table, just set their
+	 REFCOUNT to zero.  Setting LEN zero will result in the size
+	 growing if the entry is added again.  See _bfd_elf_strtab_add.  */
+      tab->array[idx]->refcount = 0;
+      tab->array[idx]->len = 0;
+    }
+}
+
 bfd_size_type
 _bfd_elf_strtab_size (struct elf_strtab_hash *tab)
 {
diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c
index 11dfb10..bb9dbbb 100644
--- a/bfd/elf-vxworks.c
+++ b/bfd/elf-vxworks.c
@@ -195,7 +195,7 @@
 		{
 		  asection *sec = (*hash_ptr)->root.u.def.section;
 		  int this_idx = sec->output_section->target_index;
-		  
+
 		  irela[j].r_info
 		    = ELF32_R_INFO (this_idx, ELF32_R_TYPE (irela[j].r_info));
 		  irela[j].r_addend += (*hash_ptr)->root.u.def.value;
@@ -227,7 +227,7 @@
   if (!sec)
     return;
   d = elf_section_data (sec);
-  d->this_hdr.sh_link = elf_tdata (abfd)->symtab_section;
+  d->this_hdr.sh_link = elf_onesymtab (abfd);
   sec = bfd_get_section_by_name (abfd, ".plt");
   if (sec)
     d->this_hdr.sh_info = elf_section_data (sec)->this_idx;
@@ -262,34 +262,34 @@
 elf_vxworks_finish_dynamic_entry (bfd *output_bfd, Elf_Internal_Dyn *dyn)
 {
   asection *sec;
-  
+
   switch (dyn->d_tag)
     {
     default:
       return FALSE;
-      
+
     case DT_VX_WRS_TLS_DATA_START:
       sec = bfd_get_section_by_name (output_bfd, ".tls_data");
       dyn->d_un.d_ptr = sec->vma;
       break;
-      
+
     case DT_VX_WRS_TLS_DATA_SIZE:
       sec = bfd_get_section_by_name (output_bfd, ".tls_data");
       dyn->d_un.d_val = sec->size;
       break;
-      
+
     case DT_VX_WRS_TLS_DATA_ALIGN:
       sec = bfd_get_section_by_name (output_bfd, ".tls_data");
       dyn->d_un.d_val
 	= (bfd_size_type)1 << bfd_get_section_alignment (output_bfd,
 							 sec);
       break;
-      
+
     case DT_VX_WRS_TLS_VARS_START:
       sec = bfd_get_section_by_name (output_bfd, ".tls_vars");
       dyn->d_un.d_ptr = sec->vma;
       break;
-      
+
     case DT_VX_WRS_TLS_VARS_SIZE:
       sec = bfd_get_section_by_name (output_bfd, ".tls_vars");
       dyn->d_un.d_val = sec->size;
diff --git a/bfd/elf.c b/bfd/elf.c
index 48e5d68..8df38ee 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1,8 +1,6 @@
 /* ELF executable support for BFD.
 
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 1993-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -44,6 +42,7 @@
 #include "elf-bfd.h"
 #include "libiberty.h"
 #include "safe-ctype.h"
+#include "elf-linux-psinfo.h"
 
 #ifdef CORE_HEADER
 #include CORE_HEADER
@@ -244,7 +243,14 @@
     return FALSE;
 
   elf_object_id (abfd) = object_id;
-  elf_program_header_size (abfd) = (bfd_size_type) -1;
+  if (abfd->direction != read_direction)
+    {
+      struct output_elf_obj_tdata *o = bfd_zalloc (abfd, sizeof *o);
+      if (o == NULL)
+	return FALSE;
+      elf_tdata (abfd)->o = o;
+      elf_program_header_size (abfd) = (bfd_size_type) -1;
+    }
   return TRUE;
 }
 
@@ -261,7 +267,10 @@
 bfd_elf_mkcorefile (bfd *abfd)
 {
   /* I think this can be done just like an object file.  */
-  return abfd->xvec->_bfd_set_format[(int) bfd_object] (abfd);
+  if (!abfd->xvec->_bfd_set_format[(int) bfd_object] (abfd))
+    return FALSE;
+  elf_tdata (abfd)->core = bfd_zalloc (abfd, sizeof (*elf_tdata (abfd)->core));
+  return elf_tdata (abfd)->core != NULL;
 }
 
 static char *
@@ -545,9 +554,9 @@
       shnum = elf_numsections (abfd);
       num_group = 0;
 
-#define IS_VALID_GROUP_SECTION_HEADER(shdr)		\
+#define IS_VALID_GROUP_SECTION_HEADER(shdr, minsize)	\
 	(   (shdr)->sh_type == SHT_GROUP		\
-	 && (shdr)->sh_size >= (2 * GRP_ENTRY_SIZE)	\
+	 && (shdr)->sh_size >= minsize			\
 	 && (shdr)->sh_entsize == GRP_ENTRY_SIZE	\
 	 && ((shdr)->sh_size % GRP_ENTRY_SIZE) == 0)
 
@@ -555,7 +564,7 @@
 	{
 	  Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
 
-	  if (IS_VALID_GROUP_SECTION_HEADER (shdr))
+	  if (IS_VALID_GROUP_SECTION_HEADER (shdr, 2 * GRP_ENTRY_SIZE))
 	    num_group += 1;
 	}
 
@@ -581,7 +590,7 @@
 	    {
 	      Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
 
-	      if (IS_VALID_GROUP_SECTION_HEADER (shdr))
+	      if (IS_VALID_GROUP_SECTION_HEADER (shdr, 2 * GRP_ENTRY_SIZE))
 		{
 		  unsigned char *src;
 		  Elf_Internal_Group *dest;
@@ -880,45 +889,25 @@
     {
       /* The debugging sections appear to be recognized only by name,
 	 not any sort of flag.  Their SEC_ALLOC bits are cleared.  */
-      static const struct
-	{
-	  const char *name;
-	  int len;
-	} debug_sections [] =
-	{
-	  { STRING_COMMA_LEN ("debug") },	/* 'd' */
-	  { NULL,		 0  },	/* 'e' */
-	  { NULL,		 0  },	/* 'f' */
-	  { STRING_COMMA_LEN ("gnu.linkonce.wi.") },	/* 'g' */
-	  { NULL,		 0  },	/* 'h' */
-	  { NULL,		 0  },	/* 'i' */
-	  { NULL,		 0  },	/* 'j' */
-	  { NULL,		 0  },	/* 'k' */
-	  { STRING_COMMA_LEN ("line") },	/* 'l' */
-	  { NULL,		 0  },	/* 'm' */
-	  { NULL,		 0  },	/* 'n' */
-	  { NULL,		 0  },	/* 'o' */
-	  { NULL,		 0  },	/* 'p' */
-	  { NULL,		 0  },	/* 'q' */
-	  { NULL,		 0  },	/* 'r' */
-	  { STRING_COMMA_LEN ("stab") },	/* 's' */
-	  { NULL,		 0  },	/* 't' */
-	  { NULL,		 0  },	/* 'u' */
-	  { NULL,		 0  },	/* 'v' */
-	  { NULL,		 0  },	/* 'w' */
-	  { NULL,		 0  },	/* 'x' */
-	  { NULL,		 0  },	/* 'y' */
-	  { STRING_COMMA_LEN ("zdebug") }	/* 'z' */
-	};
-
       if (name [0] == '.')
 	{
-	  int i = name [1] - 'd';
-	  if (i >= 0
-	      && i < (int) ARRAY_SIZE (debug_sections)
-	      && debug_sections [i].name != NULL
-	      && strncmp (&name [1], debug_sections [i].name,
-			  debug_sections [i].len) == 0)
+	  const char *p;
+	  int n;
+	  if (name[1] == 'd')
+	    p = ".debug", n = 6;
+	  else if (name[1] == 'g' && name[2] == 'n')
+	    p = ".gnu.linkonce.wi.", n = 17;
+	  else if (name[1] == 'g' && name[2] == 'd')
+	    p = ".gdb_index", n = 11; /* yes we really do mean 11.  */
+	  else if (name[1] == 'l')
+	    p = ".line", n = 5;
+	  else if (name[1] == 's')
+	    p = ".stab", n = 5;
+	  else if (name[1] == 'z')
+	    p = ".zdebug", n = 7;
+	  else
+	    p = NULL, n = 0;
+	  if (p != NULL && strncmp (name, p, n) == 0)
 	    flags |= SEC_DEBUGGING;
 	}
     }
@@ -1454,9 +1443,9 @@
 	bfd_fprintf_vma (abfd, file, val);
 
 	/* If we have version information, print it.  */
-	if (elf_tdata (abfd)->dynversym_section != 0
-	    && (elf_tdata (abfd)->dynverdef_section != 0
-		|| elf_tdata (abfd)->dynverref_section != 0))
+	if (elf_dynversym (abfd) != 0
+	    && (elf_dynverdef (abfd) != 0
+		|| elf_dynverref (abfd) != 0))
 	  {
 	    unsigned int vernum;
 	    const char *version_string;
@@ -1929,7 +1918,7 @@
       return TRUE;
 
     case SHT_GROUP:
-      if (! IS_VALID_GROUP_SECTION_HEADER (hdr))
+      if (! IS_VALID_GROUP_SECTION_HEADER (hdr, GRP_ENTRY_SIZE))
 	return FALSE;
       if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
 	return FALSE;
@@ -2081,6 +2070,9 @@
 {
   { STRING_COMMA_LEN (".data"),         -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
   { STRING_COMMA_LEN (".data1"),         0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+  /* There are more DWARF sections than these, but they needn't be added here
+     unless you have to cope with broken compilers that don't emit section
+     attributes or you want to help the user writing assembler.  */
   { STRING_COMMA_LEN (".debug"),         0, SHT_PROGBITS, 0 },
   { STRING_COMMA_LEN (".debug_line"),    0, SHT_PROGBITS, 0 },
   { STRING_COMMA_LEN (".debug_info"),    0, SHT_PROGBITS, 0 },
@@ -2529,7 +2521,7 @@
    USE_RELA_P is TRUE, we use RELA relocations; otherwise, we use REL
    relocations.  */
 
-bfd_boolean
+static bfd_boolean
 _bfd_elf_init_reloc_shdr (bfd *abfd,
 			  struct bfd_elf_section_reloc_data *reldata,
 			  asection *asect,
@@ -2989,9 +2981,9 @@
 	d->rela.idx = 0;
     }
 
-  t->shstrtab_section = section_number++;
+  elf_shstrtab_sec (abfd) = section_number++;
   _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->shstrtab_hdr.sh_name);
-  elf_elfheader (abfd)->e_shstrndx = t->shstrtab_section;
+  elf_elfheader (abfd)->e_shstrndx = elf_shstrtab_sec (abfd);
 
   need_symtab = (bfd_get_symcount (abfd) > 0
 		|| (link_info == NULL
@@ -2999,18 +2991,18 @@
 			== HAS_RELOC)));
   if (need_symtab)
     {
-      t->symtab_section = section_number++;
+      elf_onesymtab (abfd) = section_number++;
       _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->symtab_hdr.sh_name);
       if (section_number > ((SHN_LORESERVE - 2) & 0xFFFF))
 	{
-	  t->symtab_shndx_section = section_number++;
+	  elf_symtab_shndx (abfd) = section_number++;
 	  t->symtab_shndx_hdr.sh_name
 	    = (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd),
 						  ".symtab_shndx", FALSE);
 	  if (t->symtab_shndx_hdr.sh_name == (unsigned int) -1)
 	    return FALSE;
 	}
-      t->strtab_section = section_number++;
+      elf_strtab_sec (abfd) = section_number++;
       _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->strtab_hdr.sh_name);
     }
 
@@ -3044,17 +3036,17 @@
 
   elf_elfsections (abfd) = i_shdrp;
 
-  i_shdrp[t->shstrtab_section] = &t->shstrtab_hdr;
+  i_shdrp[elf_shstrtab_sec (abfd)] = &t->shstrtab_hdr;
   if (need_symtab)
     {
-      i_shdrp[t->symtab_section] = &t->symtab_hdr;
+      i_shdrp[elf_onesymtab (abfd)] = &t->symtab_hdr;
       if (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF))
 	{
-	  i_shdrp[t->symtab_shndx_section] = &t->symtab_shndx_hdr;
-	  t->symtab_shndx_hdr.sh_link = t->symtab_section;
+	  i_shdrp[elf_symtab_shndx (abfd)] = &t->symtab_shndx_hdr;
+	  t->symtab_shndx_hdr.sh_link = elf_onesymtab (abfd);
 	}
-      i_shdrp[t->strtab_section] = &t->strtab_hdr;
-      t->symtab_hdr.sh_link = t->strtab_section;
+      i_shdrp[elf_strtab_sec (abfd)] = &t->strtab_hdr;
+      t->symtab_hdr.sh_link = elf_strtab_sec (abfd);
     }
 
   for (sec = abfd->sections; sec; sec = sec->next)
@@ -3077,12 +3069,12 @@
 	 the relocation entries apply.  */
       if (d->rel.idx != 0)
 	{
-	  d->rel.hdr->sh_link = t->symtab_section;
+	  d->rel.hdr->sh_link = elf_onesymtab (abfd);
 	  d->rel.hdr->sh_info = d->this_idx;
 	}
       if (d->rela.idx != 0)
 	{
-	  d->rela.hdr->sh_link = t->symtab_section;
+	  d->rela.hdr->sh_link = elf_onesymtab (abfd);
 	  d->rela.hdr->sh_info = d->this_idx;
 	}
 
@@ -3237,7 +3229,7 @@
 	  break;
 
 	case SHT_GROUP:
-	  d->this_hdr.sh_link = t->symtab_section;
+	  d->this_hdr.sh_link = elf_onesymtab (abfd);
 	}
     }
 
@@ -3264,13 +3256,21 @@
 }
 
 /* Don't output section symbols for sections that are not going to be
-   output, or that are duplicates.  */
+   output, that are duplicates or there is no BFD section.  */
 
 static bfd_boolean
 ignore_section_sym (bfd *abfd, asymbol *sym)
 {
-  return ((sym->flags & BSF_SECTION_SYM) != 0
-	  && !(sym->section->owner == abfd
+  elf_symbol_type *type_ptr;
+
+  if ((sym->flags & BSF_SECTION_SYM) == 0)
+    return FALSE;
+
+  type_ptr = elf_symbol_from (abfd, sym);
+  return ((type_ptr != NULL
+	   && type_ptr->internal_elf_sym.st_shndx != 0
+	   && bfd_is_abs_section (sym->section))
+	  || !(sym->section->owner == abfd
 	       || (sym->section->output_section->owner == abfd
 		   && sym->section->output_offset == 0)
 	       || bfd_is_abs_section (sym->section)));
@@ -3280,7 +3280,7 @@
    all local symbols to be at the head of the list.  */
 
 static bfd_boolean
-elf_map_symbols (bfd *abfd)
+elf_map_symbols (bfd *abfd, unsigned int *pnum_locals)
 {
   unsigned int symcount = bfd_get_symcount (abfd);
   asymbol **syms = bfd_get_outsymbols (abfd);
@@ -3396,8 +3396,7 @@
 
   bfd_set_symtab (abfd, new_syms, num_locals + num_globals);
 
-  elf_num_locals (abfd) = num_locals;
-  elf_num_globals (abfd) = num_globals;
+  *pnum_locals = num_locals;
   return TRUE;
 }
 
@@ -3508,7 +3507,7 @@
       file_ptr off;
       Elf_Internal_Shdr *hdr;
 
-      off = elf_tdata (abfd)->next_file_pos;
+      off = elf_next_file_pos (abfd);
 
       hdr = &elf_tdata (abfd)->symtab_hdr;
       off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
@@ -3520,7 +3519,7 @@
       hdr = &elf_tdata (abfd)->strtab_hdr;
       off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
 
-      elf_tdata (abfd)->next_file_pos = off;
+      elf_next_file_pos (abfd) = off;
 
       /* Now that we know where the .strtab section goes, write it
 	 out.  */
@@ -3571,13 +3570,13 @@
       ++segs;
     }
 
-  if (elf_tdata (abfd)->eh_frame_hdr)
+  if (elf_eh_frame_hdr (abfd))
     {
       /* We need a PT_GNU_EH_FRAME segment.  */
       ++segs;
     }
 
-  if (elf_tdata (abfd)->stack_flags)
+  if (elf_stack_flags (abfd))
     {
       /* We need a PT_GNU_STACK segment.  */
       ++segs;
@@ -3639,8 +3638,7 @@
   struct elf_segment_map *m;
   Elf_Internal_Phdr *p;
 
-  for (m = elf_tdata (abfd)->segment_map,
-	 p = elf_tdata (abfd)->phdr;
+  for (m = elf_seg_map (abfd), p = elf_tdata (abfd)->phdr;
        m != NULL;
        m = m->next, p++)
     {
@@ -3724,7 +3722,7 @@
      sections from the segment map.  We also remove excluded
      sections.  Finally, any PT_LOAD segment without sections is
      removed.  */
-  m = &elf_tdata (abfd)->segment_map;
+  m = &elf_seg_map (abfd);
   while (*m)
     {
       unsigned int i, new_count;
@@ -3768,7 +3766,7 @@
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
   bfd_boolean no_user_phdrs;
 
-  no_user_phdrs = elf_tdata (abfd)->segment_map == NULL;
+  no_user_phdrs = elf_seg_map (abfd) == NULL;
 
   if (info != NULL)
     info->user_phdrs = !no_user_phdrs;
@@ -3879,10 +3877,11 @@
 	 program headers we will need.  */
       if (count > 0)
 	{
-	  bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
+	  bfd_size_type phdr_size = elf_program_header_size (abfd);
 
 	  if (phdr_size == (bfd_size_type) -1)
 	    phdr_size = get_program_header_size (abfd, info);
+	  phdr_size += bed->s->sizeof_ehdr;
 	  if ((abfd->flags & D_PAGED) == 0
 	      || (sections[0]->lma & addr_mask) < phdr_size
 	      || ((sections[0]->lma & addr_mask) % maxpagesize
@@ -4123,7 +4122,7 @@
 
       /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
 	 segment.  */
-      eh_frame_hdr = elf_tdata (abfd)->eh_frame_hdr;
+      eh_frame_hdr = elf_eh_frame_hdr (abfd);
       if (eh_frame_hdr != NULL
 	  && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0)
 	{
@@ -4140,7 +4139,7 @@
 	  pm = &m->next;
 	}
 
-      if (elf_tdata (abfd)->stack_flags)
+      if (elf_stack_flags (abfd))
 	{
 	  amt = sizeof (struct elf_segment_map);
 	  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
@@ -4148,8 +4147,15 @@
 	    goto error_return;
 	  m->next = NULL;
 	  m->p_type = PT_GNU_STACK;
-	  m->p_flags = elf_tdata (abfd)->stack_flags;
+	  m->p_flags = elf_stack_flags (abfd);
+	  m->p_align = bed->stack_align;
 	  m->p_flags_valid = 1;
+	  m->p_align_valid = m->p_align != 0;
+	  if (info->stacksize > 0)
+	    {
+	      m->p_size = info->stacksize;
+	      m->p_size_valid = 1;
+	    }
 
 	  *pm = m;
 	  pm = &m->next;
@@ -4197,15 +4203,15 @@
 	}
 
       free (sections);
-      elf_tdata (abfd)->segment_map = mfirst;
+      elf_seg_map (abfd) = mfirst;
     }
 
   if (!elf_modify_segment_map (abfd, info, no_user_phdrs))
     return FALSE;
 
-  for (count = 0, m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+  for (count = 0, m = elf_seg_map (abfd); m != NULL; m = m->next)
     ++count;
-  elf_tdata (abfd)->program_header_size = count * bed->s->sizeof_phdr;
+  elf_program_header_size (abfd) = count * bed->s->sizeof_phdr;
 
   return TRUE;
 
@@ -4369,7 +4375,7 @@
     return FALSE;
 
   alloc = 0;
-  for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+  for (m = elf_seg_map (abfd); m != NULL; m = m->next)
     {
       ++alloc;
       if (m->header_size)
@@ -4390,32 +4396,32 @@
 
   elf_elfheader (abfd)->e_phnum = alloc;
 
-  if (elf_tdata (abfd)->program_header_size == (bfd_size_type) -1)
-    elf_tdata (abfd)->program_header_size = alloc * bed->s->sizeof_phdr;
+  if (elf_program_header_size (abfd) == (bfd_size_type) -1)
+    elf_program_header_size (abfd) = alloc * bed->s->sizeof_phdr;
   else
-    BFD_ASSERT (elf_tdata (abfd)->program_header_size
+    BFD_ASSERT (elf_program_header_size (abfd)
 		>= alloc * bed->s->sizeof_phdr);
 
   if (alloc == 0)
     {
-      elf_tdata (abfd)->next_file_pos = bed->s->sizeof_ehdr;
+      elf_next_file_pos (abfd) = bed->s->sizeof_ehdr;
       return TRUE;
     }
 
-  /* We're writing the size in elf_tdata (abfd)->program_header_size,
+  /* We're writing the size in elf_program_header_size (abfd),
      see assign_file_positions_except_relocs, so make sure we have
      that amount allocated, with trailing space cleared.
-     The variable alloc contains the computed need, while elf_tdata
-     (abfd)->program_header_size contains the size used for the
+     The variable alloc contains the computed need, while
+     elf_program_header_size (abfd) contains the size used for the
      layout.
      See ld/emultempl/elf-generic.em:gld${EMULATION_NAME}_map_segments
      where the layout is forced to according to a larger size in the
      last iterations for the testcase ld-elf/header.  */
-  BFD_ASSERT (elf_tdata (abfd)->program_header_size % bed->s->sizeof_phdr
+  BFD_ASSERT (elf_program_header_size (abfd) % bed->s->sizeof_phdr
 	      == 0);
   phdrs = (Elf_Internal_Phdr *)
      bfd_zalloc2 (abfd,
-                  (elf_tdata (abfd)->program_header_size / bed->s->sizeof_phdr),
+                  (elf_program_header_size (abfd) / bed->s->sizeof_phdr),
                   sizeof (Elf_Internal_Phdr));
   elf_tdata (abfd)->phdr = phdrs;
   if (phdrs == NULL)
@@ -4433,7 +4439,7 @@
     header_pad -= off;
   off += header_pad;
 
-  for (m = elf_tdata (abfd)->segment_map, p = phdrs, j = 0;
+  for (m = elf_seg_map (abfd), p = phdrs, j = 0;
        m != NULL;
        m = m->next, p++, j++)
     {
@@ -4814,7 +4820,7 @@
 	}
     }
 
-  elf_tdata (abfd)->next_file_pos = off;
+  elf_next_file_pos (abfd) = off;
   return TRUE;
 }
 
@@ -4840,10 +4846,9 @@
 
   i_shdrpp = elf_elfsections (abfd);
   num_sec = elf_numsections (abfd);
-  off = elf_tdata (abfd)->next_file_pos;
+  off = elf_next_file_pos (abfd);
   for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
     {
-      struct elf_obj_tdata *tdata = elf_tdata (abfd);
       Elf_Internal_Shdr *hdr;
 
       hdr = *hdrpp;
@@ -4873,9 +4878,9 @@
 	}
       else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
 		&& hdr->bfd_section == NULL)
-	       || hdr == i_shdrpp[tdata->symtab_section]
-	       || hdr == i_shdrpp[tdata->symtab_shndx_section]
-	       || hdr == i_shdrpp[tdata->strtab_section])
+	       || hdr == i_shdrpp[elf_onesymtab (abfd)]
+	       || hdr == i_shdrpp[elf_symtab_shndx (abfd)]
+	       || hdr == i_shdrpp[elf_strtab_sec (abfd)])
 	hdr->sh_offset = -1;
       else
 	off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
@@ -4890,9 +4895,7 @@
   phdrs_paddr = 0;
   hdrs_segment = NULL;
   phdrs = elf_tdata (abfd)->phdr;
-  for (m = elf_tdata (abfd)->segment_map, p = phdrs;
-       m != NULL;
-       m = m->next, p++)
+  for (m = elf_seg_map (abfd), p = phdrs; m != NULL; m = m->next, p++)
     {
       ++count;
       if (p->p_type != PT_LOAD)
@@ -4938,7 +4941,7 @@
 	    s = hdrs_segment->sections[0];
 	  else
 	    /* Use the first (i.e. lowest-addressed) section in any segment.  */
-	    for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+	    for (m = elf_seg_map (abfd); m != NULL; m = m->next)
 	      if (m->count != 0)
 		{
 		  s = m->sections[0];
@@ -4962,9 +4965,7 @@
 	}
     }
 
-  for (m = elf_tdata (abfd)->segment_map, p = phdrs;
-       m != NULL;
-       m = m->next, p++)
+  for (m = elf_seg_map (abfd), p = phdrs; m != NULL; m = m->next, p++)
     {
       if (p->p_type == PT_GNU_RELRO)
 	{
@@ -4975,7 +4976,7 @@
 	    {
 	      /* During linking the range of the RELRO segment is passed
 		 in link_info.  */
-	      for (lm = elf_tdata (abfd)->segment_map, lp = phdrs;
+	      for (lm = elf_seg_map (abfd), lp = phdrs;
 		   lm != NULL;
 		   lm = lm->next, lp++)
 		{
@@ -5031,6 +5032,11 @@
 	      p->p_type = PT_NULL;
 	    }
 	}
+      else if (p->p_type == PT_GNU_STACK)
+	{
+	  if (m->p_size_valid)
+	    p->p_memsz = m->p_size;
+	}
       else if (m->count != 0)
 	{
 	  if (p->p_type != PT_LOAD
@@ -5068,7 +5074,7 @@
 	}
     }
 
-  elf_tdata (abfd)->next_file_pos = off;
+  elf_next_file_pos (abfd) = off;
 
   return TRUE;
 }
@@ -5117,9 +5123,9 @@
 	  hdr = *hdrpp;
 	  if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
 	       && hdr->bfd_section == NULL)
-	      || i == tdata->symtab_section
-	      || i == tdata->symtab_shndx_section
-	      || i == tdata->strtab_section)
+	      || i == elf_onesymtab (abfd)
+	      || i == elf_symtab_shndx (abfd)
+	      || i == elf_strtab_sec (abfd))
 	    {
 	      hdr->sh_offset = -1;
 	    }
@@ -5147,12 +5153,12 @@
 	}
 
       /* Write out the program headers.  */
-      alloc = tdata->program_header_size / bed->s->sizeof_phdr;
+      alloc = elf_program_header_size (abfd) / bed->s->sizeof_phdr;
       if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0
 	  || bed->s->write_out_phdrs (abfd, tdata->phdr, alloc) != 0)
 	return FALSE;
 
-      off = tdata->next_file_pos;
+      off = elf_next_file_pos (abfd);
     }
 
   /* Place the section headers.  */
@@ -5160,7 +5166,7 @@
   i_ehdrp->e_shoff = off;
   off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize;
 
-  tdata->next_file_pos = off;
+  elf_next_file_pos (abfd) = off;
 
   return TRUE;
 }
@@ -5263,7 +5269,7 @@
   unsigned int i, num_sec;
   Elf_Internal_Shdr **shdrpp;
 
-  off = elf_tdata (abfd)->next_file_pos;
+  off = elf_next_file_pos (abfd);
 
   num_sec = elf_numsections (abfd);
   for (i = 1, shdrpp = elf_elfsections (abfd) + 1; i < num_sec; i++, shdrpp++)
@@ -5276,7 +5282,7 @@
 	off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE);
     }
 
-  elf_tdata (abfd)->next_file_pos = off;
+  elf_next_file_pos (abfd) = off;
 }
 
 bfd_boolean
@@ -5286,6 +5292,7 @@
   Elf_Internal_Shdr **i_shdrp;
   bfd_boolean failed;
   unsigned int count, num_sec;
+  struct elf_obj_tdata *t;
 
   if (! abfd->output_has_begun
       && ! _bfd_elf_compute_section_file_positions (abfd, NULL))
@@ -5317,21 +5324,21 @@
     }
 
   /* Write out the section header names.  */
+  t = elf_tdata (abfd);
   if (elf_shstrtab (abfd) != NULL
-      && (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0
+      && (bfd_seek (abfd, t->shstrtab_hdr.sh_offset, SEEK_SET) != 0
 	  || !_bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd))))
     return FALSE;
 
   if (bed->elf_backend_final_write_processing)
-    (*bed->elf_backend_final_write_processing) (abfd,
-						elf_tdata (abfd)->linker);
+    (*bed->elf_backend_final_write_processing) (abfd, elf_linker (abfd));
 
   if (!bed->s->write_shdrs_and_ehdr (abfd))
     return FALSE;
 
   /* This is last since write_shdrs_and_ehdr can touch i_shdrp[0].  */
-  if (elf_tdata (abfd)->after_write_object_contents)
-    return (*elf_tdata (abfd)->after_write_object_contents) (abfd);
+  if (t->o->build_id.after_write_object_contents != NULL)
+    return (*t->o->build_id.after_write_object_contents) (abfd);
 
   return TRUE;
 }
@@ -6040,7 +6047,7 @@
 		 and carry on looping.  */
 	      amt = sizeof (struct elf_segment_map);
 	      amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
-	      map = (struct elf_segment_map *) bfd_alloc (obfd, amt);
+	      map = (struct elf_segment_map *) bfd_zalloc (obfd, amt);
 	      if (map == NULL)
 		{
 		  free (sections);
@@ -6065,7 +6072,7 @@
       free (sections);
     }
 
-  elf_tdata (obfd)->segment_map = map_first;
+  elf_seg_map (obfd) = map_first;
 
   /* If we had to estimate the number of program headers that were
      going to be needed, then check our estimate now and adjust
@@ -6175,12 +6182,15 @@
       map->p_align_valid = 1;
       map->p_vaddr_offset = 0;
 
-      if (map->p_type == PT_GNU_RELRO)
+      if (map->p_type == PT_GNU_RELRO
+	  || map->p_type == PT_GNU_STACK)
 	{
 	  /* The PT_GNU_RELRO segment may contain the first a few
 	     bytes in the .got.plt section even if the whole .got.plt
 	     section isn't in the PT_GNU_RELRO segment.  We won't
-	     change the size of the PT_GNU_RELRO segment.  */
+	     change the size of the PT_GNU_RELRO segment.
+	     Similarly, PT_GNU_STACK size is significant on uclinux
+	     systems.    */
 	  map->p_size = segment->p_memsz;
 	  map->p_size_valid = 1;
 	}
@@ -6216,12 +6226,13 @@
 	      if (ELF_SECTION_IN_SEGMENT (this_hdr, segment))
 		{
 		  map->sections[isec++] = section->output_section;
-		  if (section->lma < lowest_section->lma)
-		    lowest_section = section;
 		  if ((section->flags & SEC_ALLOC) != 0)
 		    {
 		      bfd_vma seg_off;
 
+		      if (section->lma < lowest_section->lma)
+			lowest_section = section;
+
 		      /* Section lmas are set up from PT_LOAD header
 			 p_paddr in _bfd_elf_make_section_from_shdr.
 			 If this header has a p_paddr that disagrees
@@ -6256,7 +6267,7 @@
       pointer_to_map = &map->next;
     }
 
-  elf_tdata (obfd)->segment_map = map_first;
+  elf_seg_map (obfd) = map_first;
   return TRUE;
 }
 
@@ -6350,6 +6361,26 @@
     }
 
 rewrite:
+  if (ibfd->xvec == obfd->xvec)
+    {
+      /* When rewriting program header, set the output maxpagesize to
+	 the maximum alignment of input PT_LOAD segments.  */
+      Elf_Internal_Phdr *segment;
+      unsigned int i;
+      unsigned int num_segments = elf_elfheader (ibfd)->e_phnum;
+      bfd_vma maxpagesize = 0;
+
+      for (i = 0, segment = elf_tdata (ibfd)->phdr;
+	   i < num_segments;
+	   i++, segment++)
+	if (segment->p_type == PT_LOAD
+	    && maxpagesize < segment->p_align)
+	  maxpagesize = segment->p_align;
+
+      if (maxpagesize != get_elf_backend_data (obfd)->maxpagesize)
+	bfd_emul_set_maxpagesize (bfd_get_target (obfd), maxpagesize);
+    }
+
   return rewrite_elf_program_header (ibfd, obfd);
 }
 
@@ -6527,7 +6558,7 @@
      entry point, because the latter is called after the section
      contents have been set, which means that the program headers have
      already been worked out.  */
-  if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
+  if (elf_seg_map (obfd) == NULL && elf_tdata (ibfd)->phdr != NULL)
     {
       if (! copy_private_bfd_data (ibfd, obfd))
 	return FALSE;
@@ -6575,11 +6606,11 @@
 	shndx = MAP_ONESYMTAB;
       else if (shndx == elf_dynsymtab (ibfd))
 	shndx = MAP_DYNSYMTAB;
-      else if (shndx == elf_tdata (ibfd)->strtab_section)
+      else if (shndx == elf_strtab_sec (ibfd))
 	shndx = MAP_STRTAB;
-      else if (shndx == elf_tdata (ibfd)->shstrtab_section)
+      else if (shndx == elf_shstrtab_sec (ibfd))
 	shndx = MAP_SHSTRTAB;
-      else if (shndx == elf_tdata (ibfd)->symtab_shndx_section)
+      else if (shndx == elf_symtab_shndx (ibfd))
 	shndx = MAP_SYM_SHNDX;
       osym->internal_elf_sym.st_shndx = shndx;
     }
@@ -6604,10 +6635,11 @@
   bfd_byte *outbound_syms;
   bfd_byte *outbound_shndx;
   int idx;
+  unsigned int num_locals;
   bfd_size_type amt;
   bfd_boolean name_local_sections;
 
-  if (!elf_map_symbols (abfd))
+  if (!elf_map_symbols (abfd, &num_locals))
     return FALSE;
 
   /* Dump out the symtabs.  */
@@ -6621,7 +6653,7 @@
   symtab_hdr->sh_type = SHT_SYMTAB;
   symtab_hdr->sh_entsize = bed->s->sizeof_sym;
   symtab_hdr->sh_size = symtab_hdr->sh_entsize * (symcount + 1);
-  symtab_hdr->sh_info = elf_num_locals (abfd) + 1;
+  symtab_hdr->sh_info = num_locals + 1;
   symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align;
 
   symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
@@ -6755,15 +6787,16 @@
 		  shndx = elf_dynsymtab (abfd);
 		  break;
 		case MAP_STRTAB:
-		  shndx = elf_tdata (abfd)->strtab_section;
+		  shndx = elf_strtab_sec (abfd);
 		  break;
 		case MAP_SHSTRTAB:
-		  shndx = elf_tdata (abfd)->shstrtab_section;
+		  shndx = elf_shstrtab_sec (abfd);
 		  break;
 		case MAP_SYM_SHNDX:
-		  shndx = elf_tdata (abfd)->symtab_shndx_section;
+		  shndx = elf_symtab_shndx (abfd);
 		  break;
 		default:
+		  shndx = SHN_ABS;
 		  break;
 		}
 	    }
@@ -7356,7 +7389,7 @@
       Elf_Internal_Verdef *iverdef;
       Elf_Internal_Verdaux *iverdaux;
 
-      iverdef = &elf_tdata (abfd)->verdef[freeidx - 1];;
+      iverdef = &elf_tdata (abfd)->verdef[freeidx - 1];
 
       iverdef->vd_version = VER_DEF_CURRENT;
       iverdef->vd_flags = 0;
@@ -7474,18 +7507,29 @@
 		   const char **filename_ptr,
 		   const char **functionname_ptr)
 {
-  static asection *last_section;
-  static asymbol *func;
-  static const char *filename;
-  static bfd_size_type func_size;
+  struct elf_find_function_cache
+  {
+    asection *last_section;
+    asymbol *func;
+    const char *filename;
+    bfd_size_type func_size;
+  } *cache;
 
   if (symbols == NULL)
     return FALSE;
 
-  if (last_section != section
-      || func == NULL
-      || offset < func->value
-      || offset >= func->value + func_size)
+  cache = elf_tdata (abfd)->elf_find_function_cache;
+  if (cache == NULL)
+    {
+      cache = bfd_zalloc (abfd, sizeof (*cache));
+      elf_tdata (abfd)->elf_find_function_cache = cache;
+      if (cache == NULL)
+	return FALSE;
+    }
+  if (cache->last_section != section
+      || cache->func == NULL
+      || offset < cache->func->value
+      || offset >= cache->func->value + cache->func_size)
     {
       asymbol *file;
       bfd_vma low_func;
@@ -7501,13 +7545,13 @@
       enum { nothing_seen, symbol_seen, file_after_symbol_seen } state;
       const struct elf_backend_data *bed = get_elf_backend_data (abfd);
 
-      filename = NULL;
-      func = NULL;
       file = NULL;
       low_func = 0;
       state = nothing_seen;
-      func_size = 0;
-      last_section = section;
+      cache->filename = NULL;
+      cache->func = NULL;
+      cache->func_size = 0;
+      cache->last_section = section;
 
       for (p = symbols; *p != NULL; p++)
 	{
@@ -7528,29 +7572,29 @@
 	      && code_off <= offset
 	      && (code_off > low_func
 		  || (code_off == low_func
-		      && size > func_size)))
+		      && size > cache->func_size)))
 	    {
-	      func = sym;
-	      func_size = size;
+	      cache->func = sym;
+	      cache->func_size = size;
+	      cache->filename = NULL;
 	      low_func = code_off;
-	      filename = NULL;
 	      if (file != NULL
 		  && ((sym->flags & BSF_LOCAL) != 0
 		      || state != file_after_symbol_seen))
-		filename = bfd_asymbol_name (file);
+		cache->filename = bfd_asymbol_name (file);
 	    }
 	  if (state == nothing_seen)
 	    state = symbol_seen;
 	}
     }
 
-  if (func == NULL)
+  if (cache->func == NULL)
     return FALSE;
 
   if (filename_ptr)
-    *filename_ptr = filename;
+    *filename_ptr = cache->filename;
   if (functionname_ptr)
-    *functionname_ptr = bfd_asymbol_name (func);
+    *functionname_ptr = bfd_asymbol_name (cache->func);
 
   return TRUE;
 }
@@ -7567,6 +7611,23 @@
 			    const char **functionname_ptr,
 			    unsigned int *line_ptr)
 {
+  return _bfd_elf_find_nearest_line_discriminator (abfd, section, symbols,
+                                                   offset, filename_ptr,
+                                                   functionname_ptr,
+                                                   line_ptr,
+                                                   NULL);
+}
+
+bfd_boolean
+_bfd_elf_find_nearest_line_discriminator (bfd *abfd,
+                                          asection *section,
+                                          asymbol **symbols,
+                                          bfd_vma offset,
+                                          const char **filename_ptr,
+                                          const char **functionname_ptr,
+                                          unsigned int *line_ptr,
+                                          unsigned int *discriminator_ptr)
+{
   bfd_boolean found;
 
   if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
@@ -7584,7 +7645,7 @@
   if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections,
                                      section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr, 0,
+				     line_ptr, discriminator_ptr, 0,
 				     &elf_tdata (abfd)->dwarf2_find_line_info))
     {
       if (!*functionname_ptr)
@@ -7620,8 +7681,19 @@
 _bfd_elf_find_line (bfd *abfd, asymbol **symbols, asymbol *symbol,
 		    const char **filename_ptr, unsigned int *line_ptr)
 {
+  return _bfd_elf_find_line_discriminator (abfd, symbols, symbol,
+		                           filename_ptr, line_ptr,
+                                           NULL);
+}
+
+bfd_boolean
+_bfd_elf_find_line_discriminator (bfd *abfd, asymbol **symbols, asymbol *symbol,
+                                  const char **filename_ptr,
+                                  unsigned int *line_ptr,
+                                  unsigned int *discriminator_ptr)
+{
   return _bfd_dwarf2_find_line (abfd, symbols, symbol,
-				filename_ptr, line_ptr, 0,
+				filename_ptr, line_ptr, discriminator_ptr, 0,
 				&elf_tdata (abfd)->dwarf2_find_line_info);
 }
 
@@ -7652,21 +7724,21 @@
 
   if (!info->relocatable)
     {
-      bfd_size_type phdr_size = elf_tdata (abfd)->program_header_size;
+      bfd_size_type phdr_size = elf_program_header_size (abfd);
 
       if (phdr_size == (bfd_size_type) -1)
 	{
 	  struct elf_segment_map *m;
 
 	  phdr_size = 0;
-	  for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+	  for (m = elf_seg_map (abfd); m != NULL; m = m->next)
 	    phdr_size += bed->s->sizeof_phdr;
 
 	  if (phdr_size == 0)
 	    phdr_size = get_program_header_size (abfd, info);
 	}
 
-      elf_tdata (abfd)->program_header_size = phdr_size;
+      elf_program_header_size (abfd) = phdr_size;
       ret += phdr_size;
     }
 
@@ -7806,7 +7878,7 @@
   struct elf_obj_tdata *tdata = elf_tdata (abfd);
   if (bfd_get_format (abfd) == bfd_object && tdata != NULL)
     {
-      if (elf_shstrtab (abfd) != NULL)
+      if (elf_tdata (abfd)->o != NULL && elf_shstrtab (abfd) != NULL)
 	_bfd_elf_strtab_free (elf_shstrtab (abfd));
       _bfd_dwarf2_cleanup_debug_info (abfd, &tdata->dwarf2_find_line_info);
     }
@@ -7848,9 +7920,9 @@
 {
   int pid;
 
-  pid = elf_tdata (abfd)->core_lwpid;
+  pid = elf_tdata (abfd)->core->lwpid;
   if (pid == 0)
-    pid = elf_tdata (abfd)->core_pid;
+    pid = elf_tdata (abfd)->core->pid;
 
   return pid;
 }
@@ -7940,10 +8012,10 @@
 
       /* Do not overwrite the core signal if it
 	 has already been set by another thread.  */
-      if (elf_tdata (abfd)->core_signal == 0)
-	elf_tdata (abfd)->core_signal = prstat.pr_cursig;
-      if (elf_tdata (abfd)->core_pid == 0)
-	elf_tdata (abfd)->core_pid = prstat.pr_pid;
+      if (elf_tdata (abfd)->core->signal == 0)
+	elf_tdata (abfd)->core->signal = prstat.pr_cursig;
+      if (elf_tdata (abfd)->core->pid == 0)
+	elf_tdata (abfd)->core->pid = prstat.pr_pid;
 
       /* pr_who exists on:
 	 solaris 2.5+
@@ -7952,9 +8024,9 @@
 	 linux 2.[01]
 	 */
 #if defined (HAVE_PRSTATUS_T_PR_WHO)
-      elf_tdata (abfd)->core_lwpid = prstat.pr_who;
+      elf_tdata (abfd)->core->lwpid = prstat.pr_who;
 #else
-      elf_tdata (abfd)->core_lwpid = prstat.pr_pid;
+      elf_tdata (abfd)->core->lwpid = prstat.pr_pid;
 #endif
     }
 #if defined (HAVE_PRSTATUS32_T)
@@ -7969,10 +8041,10 @@
 
       /* Do not overwrite the core signal if it
 	 has already been set by another thread.  */
-      if (elf_tdata (abfd)->core_signal == 0)
-	elf_tdata (abfd)->core_signal = prstat.pr_cursig;
-      if (elf_tdata (abfd)->core_pid == 0)
-	elf_tdata (abfd)->core_pid = prstat.pr_pid;
+      if (elf_tdata (abfd)->core->signal == 0)
+	elf_tdata (abfd)->core->signal = prstat.pr_cursig;
+      if (elf_tdata (abfd)->core->pid == 0)
+	elf_tdata (abfd)->core->pid = prstat.pr_pid;
 
       /* pr_who exists on:
 	 solaris 2.5+
@@ -7981,9 +8053,9 @@
 	 linux 2.[01]
 	 */
 #if defined (HAVE_PRSTATUS32_T_PR_WHO)
-      elf_tdata (abfd)->core_lwpid = prstat.pr_who;
+      elf_tdata (abfd)->core->lwpid = prstat.pr_who;
 #else
-      elf_tdata (abfd)->core_lwpid = prstat.pr_pid;
+      elf_tdata (abfd)->core->lwpid = prstat.pr_pid;
 #endif
     }
 #endif /* HAVE_PRSTATUS32_T */
@@ -8101,11 +8173,35 @@
 }
 
 static bfd_boolean
+elfcore_grok_s390_tdb (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-s390-tdb", note);
+}
+
+static bfd_boolean
 elfcore_grok_arm_vfp (bfd *abfd, Elf_Internal_Note *note)
 {
   return elfcore_make_note_pseudosection (abfd, ".reg-arm-vfp", note);
 }
 
+static bfd_boolean
+elfcore_grok_aarch_tls (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-aarch-tls", note);
+}
+
+static bfd_boolean
+elfcore_grok_aarch_hw_break (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-aarch-hw-break", note);
+}
+
+static bfd_boolean
+elfcore_grok_aarch_hw_watch (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-aarch-hw-watch", note);
+}
+
 #if defined (HAVE_PRPSINFO_T)
 typedef prpsinfo_t   elfcore_psinfo_t;
 #if defined (HAVE_PRPSINFO32_T)		/* Sparc64 cross Sparc32 */
@@ -8157,13 +8253,13 @@
       memcpy (&psinfo, note->descdata, sizeof (psinfo));
 
 #if defined (HAVE_PSINFO_T_PR_PID) || defined (HAVE_PRPSINFO_T_PR_PID)
-      elf_tdata (abfd)->core_pid = psinfo.pr_pid;
+      elf_tdata (abfd)->core->pid = psinfo.pr_pid;
 #endif
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
 	= _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
 				sizeof (psinfo.pr_fname));
 
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, psinfo.pr_psargs,
 				sizeof (psinfo.pr_psargs));
     }
@@ -8176,13 +8272,13 @@
       memcpy (&psinfo, note->descdata, sizeof (psinfo));
 
 #if defined (HAVE_PSINFO32_T_PR_PID) || defined (HAVE_PRPSINFO32_T_PR_PID)
-      elf_tdata (abfd)->core_pid = psinfo.pr_pid;
+      elf_tdata (abfd)->core->pid = psinfo.pr_pid;
 #endif
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
 	= _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
 				sizeof (psinfo.pr_fname));
 
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, psinfo.pr_psargs,
 				sizeof (psinfo.pr_psargs));
     }
@@ -8200,7 +8296,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -8225,7 +8321,7 @@
 
       memcpy (&pstat, note->descdata, sizeof (pstat));
 
-      elf_tdata (abfd)->core_pid = pstat.pr_pid;
+      elf_tdata (abfd)->core->pid = pstat.pr_pid;
     }
 #if defined (HAVE_PSTATUS32_T)
   else if (note->descsz == sizeof (pstatus32_t))
@@ -8235,7 +8331,7 @@
 
       memcpy (&pstat, note->descdata, sizeof (pstat));
 
-      elf_tdata (abfd)->core_pid = pstat.pr_pid;
+      elf_tdata (abfd)->core->pid = pstat.pr_pid;
     }
 #endif
   /* Could grab some more details from the "representative"
@@ -8265,11 +8361,11 @@
 
   memcpy (&lwpstat, note->descdata, sizeof (lwpstat));
 
-  elf_tdata (abfd)->core_lwpid = lwpstat.pr_lwpid;
+  elf_tdata (abfd)->core->lwpid = lwpstat.pr_lwpid;
   /* Do not overwrite the core signal if it has already been set by
      another thread.  */
-  if (elf_tdata (abfd)->core_signal == 0)
-    elf_tdata (abfd)->core_signal = lwpstat.pr_cursig;
+  if (elf_tdata (abfd)->core->signal == 0)
+    elf_tdata (abfd)->core->signal = lwpstat.pr_cursig;
 
   /* Make a ".reg/999" section.  */
 
@@ -8352,11 +8448,11 @@
   switch (type)
     {
     case 1 /* NOTE_INFO_PROCESS */:
-      /* FIXME: need to add ->core_command.  */
+      /* FIXME: need to add ->core->command.  */
       /* process_info.pid */
-      elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 8);
+      elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 8);
       /* process_info.signal */
-      elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 12);
+      elf_tdata (abfd)->core->signal = bfd_get_32 (abfd, note->descdata + 12);
       break;
 
     case 2 /* NOTE_INFO_THREAD */:
@@ -8539,6 +8635,13 @@
       else
         return TRUE;
 
+    case NT_S390_TDB:
+      if (note->namesz == 6
+          && strcmp (note->namedata, "LINUX") == 0)
+        return elfcore_grok_s390_tdb (abfd, note);
+      else
+        return TRUE;
+
     case NT_ARM_VFP:
       if (note->namesz == 6
 	  && strcmp (note->namedata, "LINUX") == 0)
@@ -8546,6 +8649,27 @@
       else
 	return TRUE;
 
+    case NT_ARM_TLS:
+      if (note->namesz == 6
+	  && strcmp (note->namedata, "LINUX") == 0)
+	return elfcore_grok_aarch_tls (abfd, note);
+      else
+	return TRUE;
+
+    case NT_ARM_HW_BREAK:
+      if (note->namesz == 6
+	  && strcmp (note->namedata, "LINUX") == 0)
+	return elfcore_grok_aarch_hw_break (abfd, note);
+      else
+	return TRUE;
+
+    case NT_ARM_HW_WATCH:
+      if (note->namesz == 6
+	  && strcmp (note->namedata, "LINUX") == 0)
+	return elfcore_grok_aarch_hw_watch (abfd, note);
+      else
+	return TRUE;
+
     case NT_PRPSINFO:
     case NT_PSINFO:
       if (bed->elf_backend_grok_psinfo)
@@ -8570,18 +8694,32 @@
 
 	return TRUE;
       }
+
+    case NT_FILE:
+      return elfcore_make_note_pseudosection (abfd, ".note.linuxcore.file",
+					      note);
+
+    case NT_SIGINFO:
+      return elfcore_make_note_pseudosection (abfd, ".note.linuxcore.siginfo",
+					      note);
     }
 }
 
 static bfd_boolean
 elfobj_grok_gnu_build_id (bfd *abfd, Elf_Internal_Note *note)
 {
-  elf_tdata (abfd)->build_id_size = note->descsz;
-  elf_tdata (abfd)->build_id = (bfd_byte *) bfd_alloc (abfd, note->descsz);
-  if (elf_tdata (abfd)->build_id == NULL)
+  struct elf_obj_tdata *t;
+
+  if (note->descsz == 0)
     return FALSE;
 
-  memcpy (elf_tdata (abfd)->build_id, note->descdata, note->descsz);
+  t = elf_tdata (abfd);
+  t->build_id = bfd_alloc (abfd, sizeof (*t->build_id) - 1 + note->descsz);
+  if (t->build_id == NULL)
+    return FALSE;
+
+  t->build_id->size = note->descsz;
+  memcpy (t->build_id->data, note->descdata, note->descsz);
 
   return TRUE;
 }
@@ -8646,15 +8784,15 @@
 elfcore_grok_netbsd_procinfo (bfd *abfd, Elf_Internal_Note *note)
 {
   /* Signal number at offset 0x08. */
-  elf_tdata (abfd)->core_signal
+  elf_tdata (abfd)->core->signal
     = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x08);
 
   /* Process ID at offset 0x50. */
-  elf_tdata (abfd)->core_pid
+  elf_tdata (abfd)->core->pid
     = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x50);
 
   /* Command name at 0x7c (max 32 bytes, including nul). */
-  elf_tdata (abfd)->core_command
+  elf_tdata (abfd)->core->command
     = _bfd_elfcore_strndup (abfd, note->descdata + 0x7c, 31);
 
   return elfcore_make_note_pseudosection (abfd, ".note.netbsdcore.procinfo",
@@ -8667,7 +8805,7 @@
   int lwp;
 
   if (elfcore_netbsd_get_lwpid (note, &lwp))
-    elf_tdata (abfd)->core_lwpid = lwp;
+    elf_tdata (abfd)->core->lwpid = lwp;
 
   if (note->type == NT_NETBSDCORE_PROCINFO)
     {
@@ -8730,15 +8868,15 @@
 elfcore_grok_openbsd_procinfo (bfd *abfd, Elf_Internal_Note *note)
 {
   /* Signal number at offset 0x08. */
-  elf_tdata (abfd)->core_signal
+  elf_tdata (abfd)->core->signal
     = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x08);
 
   /* Process ID at offset 0x20. */
-  elf_tdata (abfd)->core_pid
+  elf_tdata (abfd)->core->pid
     = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x20);
 
   /* Command name at 0x48 (max 32 bytes, including nul). */
-  elf_tdata (abfd)->core_command
+  elf_tdata (abfd)->core->command
     = _bfd_elfcore_strndup (abfd, note->descdata + 0x48, 31);
 
   return TRUE;
@@ -8801,7 +8939,7 @@
   unsigned flags;
 
   /* nto_procfs_status 'pid' field is at offset 0.  */
-  elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, (bfd_byte *) ddata);
+  elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, (bfd_byte *) ddata);
 
   /* nto_procfs_status 'tid' field is at offset 4.  Pass it back.  */
   *tid = bfd_get_32 (abfd, (bfd_byte *) ddata + 4);
@@ -8812,15 +8950,15 @@
   /* nto_procfs_status 'what' field is at offset 14.  */
   if ((sig = bfd_get_16 (abfd, (bfd_byte *) ddata + 14)) > 0)
     {
-      elf_tdata (abfd)->core_signal = sig;
-      elf_tdata (abfd)->core_lwpid = *tid;
+      elf_tdata (abfd)->core->signal = sig;
+      elf_tdata (abfd)->core->lwpid = *tid;
     }
 
   /* _DEBUG_FLAG_CURTID (current thread) is 0x80.  Some cores
      do not come from signals so we make sure we set the current
      thread just in case.  */
   if (flags & 0x00000080)
-    elf_tdata (abfd)->core_lwpid = *tid;
+    elf_tdata (abfd)->core->lwpid = *tid;
 
   /* Make a ".qnx_core_status/%d" section.  */
   sprintf (buf, ".qnx_core_status/%ld", *tid);
@@ -8868,7 +9006,7 @@
   sect->alignment_power = 2;
 
   /* This is the current thread.  */
-  if (elf_tdata (abfd)->core_lwpid == tid)
+  if (elf_tdata (abfd)->core->lwpid == tid)
     return elfcore_maybe_make_sect (abfd, base, sect);
 
   return TRUE;
@@ -9055,6 +9193,34 @@
 }
 
 char *
+elfcore_write_linux_prpsinfo32
+  (bfd *abfd, char *buf, int *bufsiz,
+   const struct elf_internal_linux_prpsinfo *prpsinfo)
+{
+  struct elf_external_linux_prpsinfo32 data;
+
+  memset (&data, 0, sizeof (data));
+  LINUX_PRPSINFO32_SWAP_FIELDS (abfd, prpsinfo, data);
+
+  return elfcore_write_note (abfd, buf, bufsiz, "CORE", NT_PRPSINFO,
+			     &data, sizeof (data));
+}
+
+char *
+elfcore_write_linux_prpsinfo64
+  (bfd *abfd, char *buf, int *bufsiz,
+   const struct elf_internal_linux_prpsinfo *prpsinfo)
+{
+  struct elf_external_linux_prpsinfo64 data;
+
+  memset (&data, 0, sizeof (data));
+  LINUX_PRPSINFO64_SWAP_FIELDS (abfd, prpsinfo, data);
+
+  return elfcore_write_note (abfd, buf, bufsiz,
+			     "CORE", NT_PRPSINFO, &data, sizeof (data));
+}
+
+char *
 elfcore_write_prstatus (bfd *abfd,
 			char *buf,
 			int *bufsiz,
@@ -9330,6 +9496,18 @@
 }
 
 char *
+elfcore_write_s390_tdb (bfd *abfd,
+			char *buf,
+			int *bufsiz,
+			const void *s390_tdb,
+			int size)
+{
+  char *note_name = "LINUX";
+  return elfcore_write_note (abfd, buf, bufsiz,
+                             note_name, NT_S390_TDB, s390_tdb, size);
+}
+
+char *
 elfcore_write_arm_vfp (bfd *abfd,
 		       char *buf,
 		       int *bufsiz,
@@ -9342,6 +9520,42 @@
 }
 
 char *
+elfcore_write_aarch_tls (bfd *abfd,
+		       char *buf,
+		       int *bufsiz,
+		       const void *aarch_tls,
+		       int size)
+{
+  char *note_name = "LINUX";
+  return elfcore_write_note (abfd, buf, bufsiz,
+			     note_name, NT_ARM_TLS, aarch_tls, size);
+}
+
+char *
+elfcore_write_aarch_hw_break (bfd *abfd,
+			    char *buf,
+			    int *bufsiz,
+			    const void *aarch_hw_break,
+			    int size)
+{
+  char *note_name = "LINUX";
+  return elfcore_write_note (abfd, buf, bufsiz,
+			     note_name, NT_ARM_HW_BREAK, aarch_hw_break, size);
+}
+
+char *
+elfcore_write_aarch_hw_watch (bfd *abfd,
+			    char *buf,
+			    int *bufsiz,
+			    const void *aarch_hw_watch,
+			    int size)
+{
+  char *note_name = "LINUX";
+  return elfcore_write_note (abfd, buf, bufsiz,
+			     note_name, NT_ARM_HW_WATCH, aarch_hw_watch, size);
+}
+
+char *
 elfcore_write_register_note (bfd *abfd,
 			     char *buf,
 			     int *bufsiz,
@@ -9375,8 +9589,16 @@
     return elfcore_write_s390_last_break (abfd, buf, bufsiz, data, size);
   if (strcmp (section, ".reg-s390-system-call") == 0)
     return elfcore_write_s390_system_call (abfd, buf, bufsiz, data, size);
+  if (strcmp (section, ".reg-s390-tdb") == 0)
+    return elfcore_write_s390_tdb (abfd, buf, bufsiz, data, size);
   if (strcmp (section, ".reg-arm-vfp") == 0)
     return elfcore_write_arm_vfp (abfd, buf, bufsiz, data, size);
+  if (strcmp (section, ".reg-aarch-tls") == 0)
+    return elfcore_write_aarch_tls (abfd, buf, bufsiz, data, size);
+  if (strcmp (section, ".reg-aarch-hw-break") == 0)
+    return elfcore_write_aarch_hw_break (abfd, buf, bufsiz, data, size);
+  if (strcmp (section, ".reg-aarch-hw-watch") == 0)
+    return elfcore_write_aarch_hw_watch (abfd, buf, bufsiz, data, size);
   return NULL;
 }
 
@@ -9535,7 +9757,9 @@
 }
 
 enum elf_reloc_type_class
-_bfd_elf_reloc_type_class (const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED)
+_bfd_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			   const asection *rel_sec ATTRIBUTE_UNUSED,
+			   const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED)
 {
   return reloc_class_normal;
 }
diff --git a/bfd/elf32-am33lin.c b/bfd/elf32-am33lin.c
index dd2aed4..f23ef8e 100644
--- a/bfd/elf32-am33lin.c
+++ b/bfd/elf32-am33lin.c
@@ -53,10 +53,10 @@
       case 184:
       case 188:		/* Linux/am33 */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	/* pr_reg */
 	offset = 72;
@@ -79,9 +79,9 @@
 	return FALSE;
 
       case 124:		/* Linux/am33 elf_prpsinfo */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
     }
 
@@ -90,7 +90,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index bc1f195..70d6ac0 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -1,6 +1,5 @@
 /* 32-bit ELF support for ARM
-   Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-   2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+   Copyright 1998-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -63,6 +62,9 @@
 #define ARM_ELF_ABI_VERSION		0
 #define ARM_ELF_OS_ABI_VERSION		ELFOSABI_ARM
 
+/* The Adjusted Place, as defined by AAELF.  */
+#define Pa(X) ((X) & 0xfffffffc)
+
 static bfd_boolean elf32_arm_write_section (bfd *output_bfd,
 					    struct bfd_link_info *link_info,
 					    asection *sec,
@@ -324,160 +326,160 @@
   /* Dynamic TLS relocations.  */
 
   HOWTO (R_ARM_TLS_DTPMOD32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_TLS_DTPMOD32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_TLS_DTPMOD32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_TLS_DTPOFF32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_TLS_DTPOFF32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_TLS_DTPOFF32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_TLS_TPOFF32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_TLS_TPOFF32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_TLS_TPOFF32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   /* Relocs used in ARM Linux */
 
   HOWTO (R_ARM_COPY,		/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_COPY",		/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_COPY",		/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_GLOB_DAT,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_GLOB_DAT",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_GLOB_DAT",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_JUMP_SLOT,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_JUMP_SLOT",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_JUMP_SLOT",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_RELATIVE,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_RELATIVE",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_RELATIVE",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_GOTOFF32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_GOTOFF32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_GOTOFF32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_GOTPC,		/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         TRUE,			/* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_GOTPC",		/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         TRUE),			/* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_GOTPC",		/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
 
   HOWTO (R_ARM_GOT32,		/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,			/* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_GOT32",		/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),		/* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_GOT32",		/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
 
   HOWTO (R_ARM_PLT32,		/* type */
-         2,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         24,                    /* bitsize */
-         TRUE,			/* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_PLT32",		/* name */
-         FALSE,			/* partial_inplace */
-         0x00ffffff,		/* src_mask */
-         0x00ffffff,		/* dst_mask */
-         TRUE),			/* pcrel_offset */
+	 2,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 24,                    /* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_PLT32",		/* name */
+	 FALSE,			/* partial_inplace */
+	 0x00ffffff,		/* src_mask */
+	 0x00ffffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
 
   HOWTO (R_ARM_CALL,		/* type */
 	 2,			/* rightshift */
@@ -1484,33 +1486,33 @@
 
   /* GNU extension to record C++ vtable member usage */
   HOWTO (R_ARM_GNU_VTENTRY,     /* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         0,                     /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_dont, /* complain_on_overflow */
-         _bfd_elf_rel_vtable_reloc_fn,  /* special_function */
-         "R_ARM_GNU_VTENTRY",   /* name */
-         FALSE,                 /* partial_inplace */
-         0,                     /* src_mask */
-         0,                     /* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 0,                     /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_elf_rel_vtable_reloc_fn,  /* special_function */
+	 "R_ARM_GNU_VTENTRY",   /* name */
+	 FALSE,                 /* partial_inplace */
+	 0,                     /* src_mask */
+	 0,                     /* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   /* GNU extension to record C++ vtable hierarchy */
   HOWTO (R_ARM_GNU_VTINHERIT, /* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         0,                     /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_dont, /* complain_on_overflow */
-         NULL,                  /* special_function */
-         "R_ARM_GNU_VTINHERIT", /* name */
-         FALSE,                 /* partial_inplace */
-         0,                     /* src_mask */
-         0,                     /* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 0,                     /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 NULL,                  /* special_function */
+	 "R_ARM_GNU_VTINHERIT", /* name */
+	 FALSE,                 /* partial_inplace */
+	 0,                     /* src_mask */
+	 0,                     /* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_THM_JUMP11,	/* type */
 	 1,			/* rightshift */
@@ -1542,74 +1544,74 @@
 
   /* TLS relocations */
   HOWTO (R_ARM_TLS_GD32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         NULL,			/* special_function */
-         "R_ARM_TLS_GD32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 NULL,			/* special_function */
+	 "R_ARM_TLS_GD32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_TLS_LDM32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_TLS_LDM32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_TLS_LDM32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_TLS_LDO32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_TLS_LDO32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_TLS_LDO32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_TLS_IE32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                  /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         NULL,			/* special_function */
-         "R_ARM_TLS_IE32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                  /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 NULL,			/* special_function */
+	 "R_ARM_TLS_IE32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_TLS_LE32,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_TLS_LE32",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE),                /* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_TLS_LE32",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),                /* pcrel_offset */
 
   HOWTO (R_ARM_TLS_LDO12,	/* type */
 	 0,			/* rightshift */
@@ -1693,18 +1695,18 @@
 static reloc_howto_type elf32_arm_howto_table_2[1] =
 {
   HOWTO (R_ARM_IRELATIVE,	/* type */
-         0,                     /* rightshift */
-         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-         32,                    /* bitsize */
-         FALSE,                 /* pc_relative */
-         0,                     /* bitpos */
-         complain_overflow_bitfield,/* complain_on_overflow */
-         bfd_elf_generic_reloc, /* special_function */
-         "R_ARM_IRELATIVE",	/* name */
-         TRUE,			/* partial_inplace */
-         0xffffffff,		/* src_mask */
-         0xffffffff,		/* dst_mask */
-         FALSE)			/* pcrel_offset */
+	 0,                     /* rightshift */
+	 2,                     /* size (0 = byte, 1 = short, 2 = long) */
+	 32,                    /* bitsize */
+	 FALSE,                 /* pc_relative */
+	 0,                     /* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_ARM_IRELATIVE",	/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE)			/* pcrel_offset */
 };
 
 /* 249-255 extended, currently unused, relocations:  */
@@ -1942,10 +1944,10 @@
 
       case 148:		/* Linux/ARM 32-bit.  */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	/* pr_reg */
 	offset = 72;
@@ -1968,11 +1970,11 @@
 	return FALSE;
 
       case 124:		/* Linux/ARM elf_prpsinfo.  */
-	elf_tdata (abfd)->core_pid
+	elf_tdata (abfd)->core->pid
 	 = bfd_get_32 (abfd, note->descdata + 12);
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
     }
 
@@ -1980,7 +1982,7 @@
      onto the end of the args in some (at least one anyway)
      implementations, so strip it off if it exists.  */
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -2095,7 +2097,7 @@
   0xe081100f, /* 2:   add     r1, pc			*/
   0xe12fff12, /*      bx      r2			*/
   0x00000014, /* 3:   .word  _GLOBAL_OFFSET_TABLE_ - 1b - 8
-		   		+ dl_tlsdesc_lazy_resolver(GOT)   */
+				+ dl_tlsdesc_lazy_resolver(GOT)   */
   0x00000018, /* 4:   .word  _GLOBAL_OFFSET_TABLE_ - 2b - 8 */
 };
 
@@ -2209,21 +2211,21 @@
   0xe08cc00f,		/* add	ip, ip, pc			*/
   0xe52dc008,		/* str	ip, [sp, #-8]!			*/
   /* Second bundle: */
-  0xe7dfcf1f, 	/* bfc	ip, #30, #2			*/
-  0xe59cc000, 	/* ldr	ip, [ip]			*/
+  0xe3ccc103,		/* bic	ip, ip, #0xc0000000		*/
+  0xe59cc000,		/* ldr	ip, [ip]			*/
   0xe3ccc13f,		/* bic	ip, ip, #0xc000000f		*/
-  0xe12fff1c, 	/* bx	ip				*/
+  0xe12fff1c,		/* bx	ip				*/
   /* Third bundle: */
-  0xe320f000, 	/* nop					*/
-  0xe320f000, 	/* nop					*/
-  0xe320f000, 	/* nop					*/
+  0xe320f000,		/* nop					*/
+  0xe320f000,		/* nop					*/
+  0xe320f000,		/* nop					*/
   /* .Lplt_tail: */
   0xe50dc004,		/* str	ip, [sp, #-4]			*/
   /* Fourth bundle: */
-  0xe7dfcf1f,		/* bfc	ip, #30, #2			*/
-  0xe59cc000, 	/* ldr	ip, [ip]			*/
+  0xe3ccc103,		/* bic	ip, ip, #0xc0000000		*/
+  0xe59cc000,		/* ldr	ip, [ip]			*/
   0xe3ccc13f,		/* bic	ip, ip, #0xc000000f		*/
-  0xe12fff1c, 	/* bx	ip				*/
+  0xe12fff1c,		/* bx	ip				*/
 };
 #define ARM_NACL_PLT_TAIL_OFFSET	(11 * 4)
 
@@ -2413,6 +2415,33 @@
   DATA_WORD (0, R_ARM_REL32, -4),    /* dcd  R_ARM_REL32(X) */
 };
 
+/* NaCl ARM -> ARM long branch stub.  */
+static const insn_sequence elf32_arm_stub_long_branch_arm_nacl[] =
+{
+  ARM_INSN (0xe59fc00c),		/* ldr	ip, [pc, #12] */
+  ARM_INSN (0xe3ccc13f),		/* bic	ip, ip, #0xc000000f */
+  ARM_INSN (0xe12fff1c),                /* bx	ip */
+  ARM_INSN (0xe320f000),                /* nop */
+  ARM_INSN (0xe125be70),                /* bkpt	0x5be0 */
+  DATA_WORD (0, R_ARM_ABS32, 0),        /* dcd	R_ARM_ABS32(X) */
+  DATA_WORD (0, R_ARM_NONE, 0),         /* .word 0 */
+  DATA_WORD (0, R_ARM_NONE, 0),         /* .word 0 */
+};
+
+/* NaCl ARM -> ARM long branch stub, PIC.  */
+static const insn_sequence elf32_arm_stub_long_branch_arm_nacl_pic[] =
+{
+  ARM_INSN (0xe59fc00c),		/* ldr	ip, [pc, #12] */
+  ARM_INSN (0xe08cc00f),                /* add	ip, ip, pc */
+  ARM_INSN (0xe3ccc13f),		/* bic	ip, ip, #0xc000000f */
+  ARM_INSN (0xe12fff1c),                /* bx	ip */
+  ARM_INSN (0xe125be70),                /* bkpt	0x5be0 */
+  DATA_WORD (0, R_ARM_REL32, 8),        /* dcd	R_ARM_REL32(X+8) */
+  DATA_WORD (0, R_ARM_NONE, 0),         /* .word 0 */
+  DATA_WORD (0, R_ARM_NONE, 0),         /* .word 0 */
+};
+
+
 /* Cortex-A8 erratum-workaround stubs.  */
 
 /* Stub used for conditional branches (which may be beyond +/-1MB away, so we
@@ -2489,6 +2518,8 @@
   DEF_STUB(long_branch_thumb_only_pic) \
   DEF_STUB(long_branch_any_tls_pic) \
   DEF_STUB(long_branch_v4t_thumb_tls_pic) \
+  DEF_STUB(long_branch_arm_nacl) \
+  DEF_STUB(long_branch_arm_nacl_pic) \
   DEF_STUB(a8_veneer_b_cond) \
   DEF_STUB(a8_veneer_b) \
   DEF_STUB(a8_veneer_bl) \
@@ -2981,7 +3012,7 @@
   bfd *stub_bfd;
 
   /* Linker call-backs.  */
-  asection * (*add_stub_section) (const char *, asection *);
+  asection * (*add_stub_section) (const char *, asection *, unsigned int);
   void (*layout_sections_again) (void);
 
   /* Array to keep track of which stub sections have been created, and
@@ -3001,8 +3032,8 @@
 
 static struct bfd_hash_entry *
 elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry,
-                             struct bfd_hash_table * table,
-                             const char * string)
+			     struct bfd_hash_table * table,
+			     const char * string)
 {
   struct elf32_arm_link_hash_entry * ret =
     (struct elf32_arm_link_hash_entry *) entry;
@@ -3011,7 +3042,7 @@
      subclass.  */
   if (ret == NULL)
     ret = (struct elf32_arm_link_hash_entry *)
-        bfd_hash_allocate (table, sizeof (struct elf32_arm_link_hash_entry));
+	bfd_hash_allocate (table, sizeof (struct elf32_arm_link_hash_entry));
   if (ret == NULL)
     return (struct bfd_hash_entry *) ret;
 
@@ -3185,7 +3216,7 @@
   if (entry == NULL)
     {
       entry = (struct bfd_hash_entry *)
-          bfd_hash_allocate (table, sizeof (struct elf32_arm_stub_hash_entry));
+	  bfd_hash_allocate (table, sizeof (struct elf32_arm_stub_hash_entry));
       if (entry == NULL)
 	return entry;
     }
@@ -3414,7 +3445,7 @@
   struct elf32_arm_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table);
 
-  ret = (struct elf32_arm_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf32_arm_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -3427,27 +3458,7 @@
       return NULL;
     }
 
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->srelplt2 = NULL;
-  ret->dt_tlsdesc_plt = 0;
-  ret->dt_tlsdesc_got = 0;
-  ret->tls_trampoline = 0;
-  ret->next_tls_desc_index = 0;
-  ret->num_tls_desc = 0;
-  ret->thumb_glue_size = 0;
-  ret->arm_glue_size = 0;
-  ret->bx_glue_size = 0;
-  memset (ret->bx_glue_offset, 0, sizeof (ret->bx_glue_offset));
   ret->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
-  ret->vfp11_erratum_glue_size = 0;
-  ret->num_vfp11_fixes = 0;
-  ret->fix_cortex_a8 = 0;
-  ret->fix_arm1176 = 0;
-  ret->bfd_of_glue_owner = NULL;
-  ret->byteswap_code = 0;
-  ret->target1_is_rel = 0;
-  ret->target2_reloc = R_ARM_NONE;
 #ifdef FOUR_WORD_PLT
   ret->plt_header_size = 16;
   ret->plt_entry_size = 16;
@@ -3455,23 +3466,8 @@
   ret->plt_header_size = 20;
   ret->plt_entry_size = 12;
 #endif
-  ret->fix_v4bx = 0;
-  ret->use_blx = 0;
-  ret->vxworks_p = 0;
-  ret->symbian_p = 0;
-  ret->nacl_p = 0;
   ret->use_rel = 1;
-  ret->sym_cache.abfd = NULL;
   ret->obfd = abfd;
-  ret->tls_ldm_got.refcount = 0;
-  ret->stub_bfd = NULL;
-  ret->add_stub_section = NULL;
-  ret->layout_sections_again = NULL;
-  ret->stub_group = NULL;
-  ret->top_id = 0;
-  ret->bfd_count = 0;
-  ret->top_index = 0;
-  ret->input_list = NULL;
 
   if (!bfd_hash_table_init (&ret->stub_hash_table, stub_hash_newfunc,
 			    sizeof (struct elf32_arm_stub_hash_entry)))
@@ -3492,7 +3488,7 @@
     = (struct elf32_arm_link_hash_table *) hash;
 
   bfd_hash_table_free (&ret->stub_hash_table);
-  _bfd_generic_link_hash_table_free (hash);
+  _bfd_elf_link_hash_table_free (hash);
 }
 
 /* Determine if we're dealing with a Thumb only architecture.  */
@@ -3613,6 +3609,12 @@
 
   r_type = ELF32_R_TYPE (rel->r_info);
 
+  /* ST_BRANCH_TO_ARM is nonsense to thumb-only targets when we
+     are considering a function call relocation.  */
+  if (thumb_only && (r_type == R_ARM_THM_CALL || r_type == R_ARM_THM_JUMP24)
+      && branch_type == ST_BRANCH_TO_ARM)
+    branch_type = ST_BRANCH_TO_THUMB;
+
   /* For TLS call relocs, it is the caller's responsibility to provide
      the address of the appropriate trampoline.  */
   if (r_type != R_ARM_TLS_CALL
@@ -3657,11 +3659,11 @@
     {
       /* Handle cases where:
 	 - this call goes too far (different Thumb/Thumb2 max
-           distance)
+	   distance)
 	 - it's a Thumb->Arm call and blx is not available, or it's a
-           Thumb->Arm branch (not bl). A stub is needed in this case,
-           but only if this call is not through a PLT entry. Indeed,
-           PLT stubs handle mode switching already.
+	   Thumb->Arm branch (not bl). A stub is needed in this case,
+	   but only if this call is not through a PLT entry. Indeed,
+	   PLT stubs handle mode switching already.
       */
       if ((!thumb2
 	    && (branch_offset > THM_MAX_FWD_BRANCH_OFFSET
@@ -3805,9 +3807,13 @@
 		? (r_type == R_ARM_TLS_CALL
 		   /* TLS PIC Stub */
 		   ? arm_stub_long_branch_any_tls_pic
-		   : arm_stub_long_branch_any_arm_pic)
+		   : (globals->nacl_p
+		      ? arm_stub_long_branch_arm_nacl_pic
+		      : arm_stub_long_branch_any_arm_pic))
 		/* non-PIC stubs.  */
-		: arm_stub_long_branch_any_any;
+		: (globals->nacl_p
+		   ? arm_stub_long_branch_arm_nacl
+		   : arm_stub_long_branch_any_any);
 	    }
 	}
     }
@@ -3943,7 +3949,8 @@
 
 	  memcpy (s_name, link_sec->name, namelen);
 	  memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
-	  stub_sec = (*htab->add_stub_section) (s_name, link_sec);
+	  stub_sec = (*htab->add_stub_section) (s_name, link_sec,
+						htab->nacl_p ? 4 : 3);
 	  if (stub_sec == NULL)
 	    return NULL;
 	  htab->stub_group[link_sec->id].stub_sec = stub_sec;
@@ -4076,6 +4083,10 @@
     case arm_stub_a8_veneer_blx:
       return 4;
 
+    case arm_stub_long_branch_arm_nacl:
+    case arm_stub_long_branch_arm_nacl_pic:
+      return 16;
+
     default:
       abort ();  /* Should be unreachable.  */
     }
@@ -4085,7 +4096,7 @@
 arm_build_one_stub (struct bfd_hash_entry *gen_entry,
 		    void * in_arg)
 {
-#define MAXRELOCS 2
+#define MAXRELOCS 3
   struct elf32_arm_stub_hash_entry *stub_entry;
   struct elf32_arm_link_hash_table *globals;
   struct bfd_link_info *info;
@@ -4140,11 +4151,11 @@
 	    bfd_vma data = (bfd_vma) template_sequence[i].data;
 	    if (template_sequence[i].reloc_addend != 0)
 	      {
-                /* We've borrowed the reloc_addend field to mean we should
-                   insert a condition code into this (Thumb-1 branch)
-                   instruction.  See THUMB16_BCOND_INSN.  */
-                BFD_ASSERT ((data & 0xff00) == 0xd000);
-                data |= ((stub_entry->orig_insn >> 22) & 0xf) << 8;
+		/* We've borrowed the reloc_addend field to mean we should
+		   insert a condition code into this (Thumb-1 branch)
+		   instruction.  See THUMB16_BCOND_INSN.  */
+		BFD_ASSERT ((data & 0xff00) == 0xd000);
+		data |= ((stub_entry->orig_insn >> 22) & 0xf) << 8;
 	      }
 	    bfd_put_16 (stub_bfd, data, loc + size);
 	    size += 2;
@@ -4157,13 +4168,13 @@
 		      loc + size);
 	  bfd_put_16 (stub_bfd, template_sequence[i].data & 0xffff,
 		      loc + size + 2);
-          if (template_sequence[i].r_type != R_ARM_NONE)
-            {
-              stub_reloc_idx[nrelocs] = i;
-              stub_reloc_offset[nrelocs++] = size;
-            }
-          size += 4;
-          break;
+	  if (template_sequence[i].r_type != R_ARM_NONE)
+	    {
+	      stub_reloc_idx[nrelocs] = i;
+	      stub_reloc_offset[nrelocs++] = size;
+	    }
+	  size += 4;
+	  break;
 
 	case ARM_TYPE:
 	  bfd_put_32 (stub_bfd, template_sequence[i].data,
@@ -4221,7 +4232,7 @@
 
 	rel.r_offset = stub_entry->stub_offset + stub_reloc_offset[i];
 	rel.r_info = ELF32_R_INFO (0,
-                                   template_sequence[stub_reloc_idx[i]].r_type);
+				   template_sequence[stub_reloc_idx[i]].r_type);
 	rel.r_addend = template_sequence[stub_reloc_idx[i]].reloc_addend;
 
 	if (stub_entry->stub_type == arm_stub_a8_veneer_b_cond && i == 0)
@@ -4254,7 +4265,7 @@
 
 	rel.r_offset = stub_entry->stub_offset + stub_reloc_offset[i];
 	rel.r_info = ELF32_R_INFO (0,
-                                   template_sequence[stub_reloc_idx[i]].r_type);
+				   template_sequence[stub_reloc_idx[i]].r_type);
 	rel.r_addend = 0;
 
 	elf32_arm_final_link_relocate (elf32_arm_howto_from_type
@@ -4484,15 +4495,15 @@
 #define NEXT_SEC PREV_SEC
       head = NULL;
       while (tail != NULL)
-        {
-          /* Pop from tail.  */
-          asection *item = tail;
-          tail = PREV_SEC (item);
+	{
+	  /* Pop from tail.  */
+	  asection *item = tail;
+	  tail = PREV_SEC (item);
 
-          /* Push on head.  */
-          NEXT_SEC (item) = head;
-          head = item;
-        }
+	  /* Push on head.  */
+	  NEXT_SEC (item) = head;
+	  head = item;
+	}
 
       while (head != NULL)
 	{
@@ -4611,65 +4622,65 @@
       bfd_vma base_vma;
 
       if (elf_section_type (section) != SHT_PROGBITS
-          || (elf_section_flags (section) & SHF_EXECINSTR) == 0
-          || (section->flags & SEC_EXCLUDE) != 0
-          || (section->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
-          || (section->output_section == bfd_abs_section_ptr))
-        continue;
+	  || (elf_section_flags (section) & SHF_EXECINSTR) == 0
+	  || (section->flags & SEC_EXCLUDE) != 0
+	  || (section->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+	  || (section->output_section == bfd_abs_section_ptr))
+	continue;
 
       base_vma = section->output_section->vma + section->output_offset;
 
       if (elf_section_data (section)->this_hdr.contents != NULL)
-        contents = elf_section_data (section)->this_hdr.contents;
+	contents = elf_section_data (section)->this_hdr.contents;
       else if (! bfd_malloc_and_get_section (input_bfd, section, &contents))
-        return TRUE;
+	return TRUE;
 
       sec_data = elf32_arm_section_data (section);
 
       for (span = 0; span < sec_data->mapcount; span++)
-        {
-          unsigned int span_start = sec_data->map[span].vma;
-          unsigned int span_end = (span == sec_data->mapcount - 1)
-            ? section->size : sec_data->map[span + 1].vma;
-          unsigned int i;
-          char span_type = sec_data->map[span].type;
-          bfd_boolean last_was_32bit = FALSE, last_was_branch = FALSE;
+	{
+	  unsigned int span_start = sec_data->map[span].vma;
+	  unsigned int span_end = (span == sec_data->mapcount - 1)
+	    ? section->size : sec_data->map[span + 1].vma;
+	  unsigned int i;
+	  char span_type = sec_data->map[span].type;
+	  bfd_boolean last_was_32bit = FALSE, last_was_branch = FALSE;
 
-          if (span_type != 't')
-            continue;
+	  if (span_type != 't')
+	    continue;
 
-          /* Span is entirely within a single 4KB region: skip scanning.  */
-          if (((base_vma + span_start) & ~0xfff)
+	  /* Span is entirely within a single 4KB region: skip scanning.  */
+	  if (((base_vma + span_start) & ~0xfff)
 	      == ((base_vma + span_end) & ~0xfff))
-            continue;
+	    continue;
 
-          /* Scan for 32-bit Thumb-2 branches which span two 4K regions, where:
+	  /* Scan for 32-bit Thumb-2 branches which span two 4K regions, where:
 
-               * The opcode is BLX.W, BL.W, B.W, Bcc.W
-               * The branch target is in the same 4KB region as the
-                 first half of the branch.
-               * The instruction before the branch is a 32-bit
-                 length non-branch instruction.  */
-          for (i = span_start; i < span_end;)
-            {
-              unsigned int insn = bfd_getl16 (&contents[i]);
-              bfd_boolean insn_32bit = FALSE, is_blx = FALSE, is_b = FALSE;
+	       * The opcode is BLX.W, BL.W, B.W, Bcc.W
+	       * The branch target is in the same 4KB region as the
+		 first half of the branch.
+	       * The instruction before the branch is a 32-bit
+		 length non-branch instruction.  */
+	  for (i = span_start; i < span_end;)
+	    {
+	      unsigned int insn = bfd_getl16 (&contents[i]);
+	      bfd_boolean insn_32bit = FALSE, is_blx = FALSE, is_b = FALSE;
 	      bfd_boolean is_bl = FALSE, is_bcc = FALSE, is_32bit_branch;
 
-              if ((insn & 0xe000) == 0xe000 && (insn & 0x1800) != 0x0000)
-                insn_32bit = TRUE;
+	      if ((insn & 0xe000) == 0xe000 && (insn & 0x1800) != 0x0000)
+		insn_32bit = TRUE;
 
 	      if (insn_32bit)
-	        {
-                  /* Load the rest of the insn (in manual-friendly order).  */
-                  insn = (insn << 16) | bfd_getl16 (&contents[i + 2]);
+		{
+		  /* Load the rest of the insn (in manual-friendly order).  */
+		  insn = (insn << 16) | bfd_getl16 (&contents[i + 2]);
 
-        	  /* Encoding T4: B<c>.W.  */
-        	  is_b = (insn & 0xf800d000) == 0xf0009000;
-        	  /* Encoding T1: BL<c>.W.  */
-        	  is_bl = (insn & 0xf800d000) == 0xf000d000;
-        	  /* Encoding T2: BLX<c>.W.  */
-        	  is_blx = (insn & 0xf800d000) == 0xf000c000;
+		  /* Encoding T4: B<c>.W.  */
+		  is_b = (insn & 0xf800d000) == 0xf0009000;
+		  /* Encoding T1: BL<c>.W.  */
+		  is_bl = (insn & 0xf800d000) == 0xf000d000;
+		  /* Encoding T2: BLX<c>.W.  */
+		  is_blx = (insn & 0xf800d000) == 0xf000c000;
 		  /* Encoding T3: B<c>.W (not permitted in IT block).  */
 		  is_bcc = (insn & 0xf800d000) == 0xf0008000
 			   && (insn & 0x07f00000) != 0x03800000;
@@ -4677,25 +4688,25 @@
 
 	      is_32bit_branch = is_b || is_bl || is_blx || is_bcc;
 
-              if (((base_vma + i) & 0xfff) == 0xffe
+	      if (((base_vma + i) & 0xfff) == 0xffe
 		  && insn_32bit
 		  && is_32bit_branch
 		  && last_was_32bit
 		  && ! last_was_branch)
-                {
-                  bfd_signed_vma offset = 0;
-                  bfd_boolean force_target_arm = FALSE;
+		{
+		  bfd_signed_vma offset = 0;
+		  bfd_boolean force_target_arm = FALSE;
 		  bfd_boolean force_target_thumb = FALSE;
-                  bfd_vma target;
-                  enum elf32_arm_stub_type stub_type = arm_stub_none;
-                  struct a8_erratum_reloc key, *found;
-                  bfd_boolean use_plt = FALSE;
+		  bfd_vma target;
+		  enum elf32_arm_stub_type stub_type = arm_stub_none;
+		  struct a8_erratum_reloc key, *found;
+		  bfd_boolean use_plt = FALSE;
 
-                  key.from = base_vma + i;
-                  found = (struct a8_erratum_reloc *)
-                      bsearch (&key, a8_relocs, num_a8_relocs,
-                               sizeof (struct a8_erratum_reloc),
-                               &a8_reloc_compare);
+		  key.from = base_vma + i;
+		  found = (struct a8_erratum_reloc *)
+		      bsearch (&key, a8_relocs, num_a8_relocs,
+			       sizeof (struct a8_erratum_reloc),
+			       &a8_reloc_compare);
 
 		  if (found)
 		    {
@@ -4703,7 +4714,7 @@
 		      struct elf_link_hash_entry *entry;
 
 		      /* We don't care about the error returned from this
-		         function, only if there is glue or not.  */
+			 function, only if there is glue or not.  */
 		      entry = find_thumb_glue (info, found->sym_name,
 					       &error_message);
 
@@ -4725,7 +4736,7 @@
 			}
 		    }
 
-                  /* Check if we have an offending branch instruction.  */
+		  /* Check if we have an offending branch instruction.  */
 
 		  if (found && found->non_a8_stub)
 		    /* We've already made a stub for this instruction, e.g.
@@ -4733,46 +4744,46 @@
 		       stub will suffice to work around the A8 erratum (see
 		       setting of always_after_branch above).  */
 		    ;
-                  else if (is_bcc)
-                    {
-                      offset = (insn & 0x7ff) << 1;
-                      offset |= (insn & 0x3f0000) >> 4;
-                      offset |= (insn & 0x2000) ? 0x40000 : 0;
-                      offset |= (insn & 0x800) ? 0x80000 : 0;
-                      offset |= (insn & 0x4000000) ? 0x100000 : 0;
-                      if (offset & 0x100000)
-                        offset |= ~ ((bfd_signed_vma) 0xfffff);
-                      stub_type = arm_stub_a8_veneer_b_cond;
-                    }
-                  else if (is_b || is_bl || is_blx)
-                    {
-                      int s = (insn & 0x4000000) != 0;
-                      int j1 = (insn & 0x2000) != 0;
-                      int j2 = (insn & 0x800) != 0;
-                      int i1 = !(j1 ^ s);
-                      int i2 = !(j2 ^ s);
+		  else if (is_bcc)
+		    {
+		      offset = (insn & 0x7ff) << 1;
+		      offset |= (insn & 0x3f0000) >> 4;
+		      offset |= (insn & 0x2000) ? 0x40000 : 0;
+		      offset |= (insn & 0x800) ? 0x80000 : 0;
+		      offset |= (insn & 0x4000000) ? 0x100000 : 0;
+		      if (offset & 0x100000)
+			offset |= ~ ((bfd_signed_vma) 0xfffff);
+		      stub_type = arm_stub_a8_veneer_b_cond;
+		    }
+		  else if (is_b || is_bl || is_blx)
+		    {
+		      int s = (insn & 0x4000000) != 0;
+		      int j1 = (insn & 0x2000) != 0;
+		      int j2 = (insn & 0x800) != 0;
+		      int i1 = !(j1 ^ s);
+		      int i2 = !(j2 ^ s);
 
-                      offset = (insn & 0x7ff) << 1;
-                      offset |= (insn & 0x3ff0000) >> 4;
-                      offset |= i2 << 22;
-                      offset |= i1 << 23;
-                      offset |= s << 24;
-                      if (offset & 0x1000000)
-                        offset |= ~ ((bfd_signed_vma) 0xffffff);
+		      offset = (insn & 0x7ff) << 1;
+		      offset |= (insn & 0x3ff0000) >> 4;
+		      offset |= i2 << 22;
+		      offset |= i1 << 23;
+		      offset |= s << 24;
+		      if (offset & 0x1000000)
+			offset |= ~ ((bfd_signed_vma) 0xffffff);
 
-                      if (is_blx)
-                        offset &= ~ ((bfd_signed_vma) 3);
+		      if (is_blx)
+			offset &= ~ ((bfd_signed_vma) 3);
 
-                      stub_type = is_blx ? arm_stub_a8_veneer_blx :
-                        is_bl ? arm_stub_a8_veneer_bl : arm_stub_a8_veneer_b;
-                    }
+		      stub_type = is_blx ? arm_stub_a8_veneer_blx :
+			is_bl ? arm_stub_a8_veneer_bl : arm_stub_a8_veneer_b;
+		    }
 
-                  if (stub_type != arm_stub_none)
-                    {
-                      bfd_vma pc_for_insn = base_vma + i + 4;
+		  if (stub_type != arm_stub_none)
+		    {
+		      bfd_vma pc_for_insn = base_vma + i + 4;
 
 		      /* The original instruction is a BL, but the target is
-		         an ARM instruction.  If we were not making a stub,
+			 an ARM instruction.  If we were not making a stub,
 			 the BL would have been converted to a BLX.  Use the
 			 BLX stub instead in that case.  */
 		      if (htab->use_blx && force_target_arm
@@ -4793,43 +4804,43 @@
 			  is_bl = TRUE;
 			}
 
-                      if (is_blx)
-                        pc_for_insn &= ~ ((bfd_vma) 3);
+		      if (is_blx)
+			pc_for_insn &= ~ ((bfd_vma) 3);
 
-                      /* If we found a relocation, use the proper destination,
-		         not the offset in the (unrelocated) instruction.
+		      /* If we found a relocation, use the proper destination,
+			 not the offset in the (unrelocated) instruction.
 			 Note this is always done if we switched the stub type
 			 above.  */
-                      if (found)
-                        offset =
+		      if (found)
+			offset =
 			  (bfd_signed_vma) (found->destination - pc_for_insn);
 
-                      /* If the stub will use a Thumb-mode branch to a
-                         PLT target, redirect it to the preceding Thumb
-                         entry point.  */
-                      if (stub_type != arm_stub_a8_veneer_blx && use_plt)
-                        offset -= PLT_THUMB_STUB_SIZE;
+		      /* If the stub will use a Thumb-mode branch to a
+			 PLT target, redirect it to the preceding Thumb
+			 entry point.  */
+		      if (stub_type != arm_stub_a8_veneer_blx && use_plt)
+			offset -= PLT_THUMB_STUB_SIZE;
 
-                      target = pc_for_insn + offset;
+		      target = pc_for_insn + offset;
 
-                      /* The BLX stub is ARM-mode code.  Adjust the offset to
-		         take the different PC value (+8 instead of +4) into
+		      /* The BLX stub is ARM-mode code.  Adjust the offset to
+			 take the different PC value (+8 instead of +4) into
 			 account.  */
-                      if (stub_type == arm_stub_a8_veneer_blx)
-                        offset += 4;
+		      if (stub_type == arm_stub_a8_veneer_blx)
+			offset += 4;
 
-                      if (((base_vma + i) & ~0xfff) == (target & ~0xfff))
-                        {
-                          char *stub_name = NULL;
+		      if (((base_vma + i) & ~0xfff) == (target & ~0xfff))
+			{
+			  char *stub_name = NULL;
 
-                          if (num_a8_fixes == a8_fix_table_size)
-                            {
-                              a8_fix_table_size *= 2;
-                              a8_fixes = (struct a8_erratum_fix *)
-                                  bfd_realloc (a8_fixes,
-                                               sizeof (struct a8_erratum_fix)
-                                               * a8_fix_table_size);
-                            }
+			  if (num_a8_fixes == a8_fix_table_size)
+			    {
+			      a8_fix_table_size *= 2;
+			      a8_fixes = (struct a8_erratum_fix *)
+				  bfd_realloc (a8_fixes,
+					       sizeof (struct a8_erratum_fix)
+					       * a8_fix_table_size);
+			    }
 
 			  if (num_a8_fixes < prev_num_a8_fixes)
 			    {
@@ -4854,29 +4865,29 @@
 				sprintf (stub_name, "%x:%x", section->id, i);
 			    }
 
-                          a8_fixes[num_a8_fixes].input_bfd = input_bfd;
-                          a8_fixes[num_a8_fixes].section = section;
-                          a8_fixes[num_a8_fixes].offset = i;
-                          a8_fixes[num_a8_fixes].addend = offset;
-                          a8_fixes[num_a8_fixes].orig_insn = insn;
-                          a8_fixes[num_a8_fixes].stub_name = stub_name;
-                          a8_fixes[num_a8_fixes].stub_type = stub_type;
-                          a8_fixes[num_a8_fixes].branch_type =
+			  a8_fixes[num_a8_fixes].input_bfd = input_bfd;
+			  a8_fixes[num_a8_fixes].section = section;
+			  a8_fixes[num_a8_fixes].offset = i;
+			  a8_fixes[num_a8_fixes].addend = offset;
+			  a8_fixes[num_a8_fixes].orig_insn = insn;
+			  a8_fixes[num_a8_fixes].stub_name = stub_name;
+			  a8_fixes[num_a8_fixes].stub_type = stub_type;
+			  a8_fixes[num_a8_fixes].branch_type =
 			    is_blx ? ST_BRANCH_TO_ARM : ST_BRANCH_TO_THUMB;
 
-                          num_a8_fixes++;
-                        }
-                    }
-                }
+			  num_a8_fixes++;
+			}
+		    }
+		}
 
-              i += insn_32bit ? 4 : 2;
-              last_was_32bit = insn_32bit;
+	      i += insn_32bit ? 4 : 2;
+	      last_was_32bit = insn_32bit;
 	      last_was_branch = is_32bit_branch;
-            }
-        }
+	    }
+	}
 
       if (elf_section_data (section)->this_hdr.contents == NULL)
-        free (contents);
+	free (contents);
     }
 
   *a8_fixes_p = a8_fixes;
@@ -4897,7 +4908,8 @@
 		      bfd *stub_bfd,
 		      struct bfd_link_info *info,
 		      bfd_signed_vma group_size,
-		      asection * (*add_stub_section) (const char *, asection *),
+		      asection * (*add_stub_section) (const char *, asection *,
+						      unsigned int),
 		      void (*layout_sections_again) (void))
 {
   bfd_size_type stub_group_size;
@@ -4914,9 +4926,9 @@
   if (htab->fix_cortex_a8)
     {
       a8_fixes = (struct a8_erratum_fix *)
-          bfd_zmalloc (sizeof (struct a8_erratum_fix) * a8_fix_table_size);
+	  bfd_zmalloc (sizeof (struct a8_erratum_fix) * a8_fix_table_size);
       a8_relocs = (struct a8_erratum_reloc *)
-          bfd_zmalloc (sizeof (struct a8_erratum_reloc) * a8_reloc_table_size);
+	  bfd_zmalloc (sizeof (struct a8_erratum_reloc) * a8_reloc_table_size);
     }
 
   /* Propagate mach to stub bfd, because it may not have been
@@ -4984,6 +4996,9 @@
 	  asection *section;
 	  Elf_Internal_Sym *local_syms = NULL;
 
+	  if (!is_arm_elf (input_bfd))
+	    continue;
+
 	  num_a8_relocs = 0;
 
 	  /* We'll need the symbol table in a second.  */
@@ -5255,99 +5270,99 @@
 			  goto error_ret_free_internal;
 			}
 
-                      stub_entry->target_value = sym_value;
-                      stub_entry->target_section = sym_sec;
-                      stub_entry->stub_type = stub_type;
-                      stub_entry->h = hash;
-                      stub_entry->branch_type = branch_type;
+		      stub_entry->target_value = sym_value;
+		      stub_entry->target_section = sym_sec;
+		      stub_entry->stub_type = stub_type;
+		      stub_entry->h = hash;
+		      stub_entry->branch_type = branch_type;
 
-                      if (sym_name == NULL)
-                	sym_name = "unnamed";
-                      stub_entry->output_name = (char *)
-                          bfd_alloc (htab->stub_bfd,
-                                     sizeof (THUMB2ARM_GLUE_ENTRY_NAME)
-                                     + strlen (sym_name));
-                      if (stub_entry->output_name == NULL)
-                	{
-                          free (stub_name);
-                          goto error_ret_free_internal;
-                	}
+		      if (sym_name == NULL)
+			sym_name = "unnamed";
+		      stub_entry->output_name = (char *)
+			  bfd_alloc (htab->stub_bfd,
+				     sizeof (THUMB2ARM_GLUE_ENTRY_NAME)
+				     + strlen (sym_name));
+		      if (stub_entry->output_name == NULL)
+			{
+			  free (stub_name);
+			  goto error_ret_free_internal;
+			}
 
-                      /* For historical reasons, use the existing names for
-                	 ARM-to-Thumb and Thumb-to-ARM stubs.  */
-                      if ((r_type == (unsigned int) R_ARM_THM_CALL
+		      /* For historical reasons, use the existing names for
+			 ARM-to-Thumb and Thumb-to-ARM stubs.  */
+		      if ((r_type == (unsigned int) R_ARM_THM_CALL
 			   || r_type == (unsigned int) R_ARM_THM_JUMP24)
 			  && branch_type == ST_BRANCH_TO_ARM)
-                	sprintf (stub_entry->output_name,
-                        	 THUMB2ARM_GLUE_ENTRY_NAME, sym_name);
-                      else if ((r_type == (unsigned int) R_ARM_CALL
+			sprintf (stub_entry->output_name,
+				 THUMB2ARM_GLUE_ENTRY_NAME, sym_name);
+		      else if ((r_type == (unsigned int) R_ARM_CALL
 			       || r_type == (unsigned int) R_ARM_JUMP24)
 			       && branch_type == ST_BRANCH_TO_THUMB)
-                	sprintf (stub_entry->output_name,
-                        	 ARM2THUMB_GLUE_ENTRY_NAME, sym_name);
-                      else
-                	sprintf (stub_entry->output_name, STUB_ENTRY_NAME,
-                        	 sym_name);
+			sprintf (stub_entry->output_name,
+				 ARM2THUMB_GLUE_ENTRY_NAME, sym_name);
+		      else
+			sprintf (stub_entry->output_name, STUB_ENTRY_NAME,
+				 sym_name);
 
-                      stub_changed = TRUE;
-                    }
-                  while (0);
+		      stub_changed = TRUE;
+		    }
+		  while (0);
 
-                  /* Look for relocations which might trigger Cortex-A8
-                     erratum.  */
-                  if (htab->fix_cortex_a8
-                      && (r_type == (unsigned int) R_ARM_THM_JUMP24
-                          || r_type == (unsigned int) R_ARM_THM_JUMP19
-                          || r_type == (unsigned int) R_ARM_THM_CALL
-                          || r_type == (unsigned int) R_ARM_THM_XPC22))
-                    {
-                      bfd_vma from = section->output_section->vma
-                                     + section->output_offset
-                                     + irela->r_offset;
+		  /* Look for relocations which might trigger Cortex-A8
+		     erratum.  */
+		  if (htab->fix_cortex_a8
+		      && (r_type == (unsigned int) R_ARM_THM_JUMP24
+			  || r_type == (unsigned int) R_ARM_THM_JUMP19
+			  || r_type == (unsigned int) R_ARM_THM_CALL
+			  || r_type == (unsigned int) R_ARM_THM_XPC22))
+		    {
+		      bfd_vma from = section->output_section->vma
+				     + section->output_offset
+				     + irela->r_offset;
 
-                      if ((from & 0xfff) == 0xffe)
-                        {
-                          /* Found a candidate.  Note we haven't checked the
-                             destination is within 4K here: if we do so (and
-                             don't create an entry in a8_relocs) we can't tell
-                             that a branch should have been relocated when
-                             scanning later.  */
-                          if (num_a8_relocs == a8_reloc_table_size)
-                            {
-                              a8_reloc_table_size *= 2;
-                              a8_relocs = (struct a8_erratum_reloc *)
-                                  bfd_realloc (a8_relocs,
-                                               sizeof (struct a8_erratum_reloc)
-                                               * a8_reloc_table_size);
-                            }
+		      if ((from & 0xfff) == 0xffe)
+			{
+			  /* Found a candidate.  Note we haven't checked the
+			     destination is within 4K here: if we do so (and
+			     don't create an entry in a8_relocs) we can't tell
+			     that a branch should have been relocated when
+			     scanning later.  */
+			  if (num_a8_relocs == a8_reloc_table_size)
+			    {
+			      a8_reloc_table_size *= 2;
+			      a8_relocs = (struct a8_erratum_reloc *)
+				  bfd_realloc (a8_relocs,
+					       sizeof (struct a8_erratum_reloc)
+					       * a8_reloc_table_size);
+			    }
 
-                          a8_relocs[num_a8_relocs].from = from;
-                          a8_relocs[num_a8_relocs].destination = destination;
-                          a8_relocs[num_a8_relocs].r_type = r_type;
-                          a8_relocs[num_a8_relocs].branch_type = branch_type;
-                          a8_relocs[num_a8_relocs].sym_name = sym_name;
-                          a8_relocs[num_a8_relocs].non_a8_stub = created_stub;
-                          a8_relocs[num_a8_relocs].hash = hash;
+			  a8_relocs[num_a8_relocs].from = from;
+			  a8_relocs[num_a8_relocs].destination = destination;
+			  a8_relocs[num_a8_relocs].r_type = r_type;
+			  a8_relocs[num_a8_relocs].branch_type = branch_type;
+			  a8_relocs[num_a8_relocs].sym_name = sym_name;
+			  a8_relocs[num_a8_relocs].non_a8_stub = created_stub;
+			  a8_relocs[num_a8_relocs].hash = hash;
 
-                          num_a8_relocs++;
-                        }
-                    }
+			  num_a8_relocs++;
+			}
+		    }
 		}
 
-              /* We're done with the internal relocs, free them.  */
-              if (elf_section_data (section)->relocs == NULL)
-                free (internal_relocs);
-            }
+	      /* We're done with the internal relocs, free them.  */
+	      if (elf_section_data (section)->relocs == NULL)
+		free (internal_relocs);
+	    }
 
-          if (htab->fix_cortex_a8)
+	  if (htab->fix_cortex_a8)
 	    {
-              /* Sort relocs which might apply to Cortex-A8 erratum.  */
-              qsort (a8_relocs, num_a8_relocs,
+	      /* Sort relocs which might apply to Cortex-A8 erratum.  */
+	      qsort (a8_relocs, num_a8_relocs,
 		     sizeof (struct a8_erratum_reloc),
-                     &a8_reloc_compare);
+		     &a8_reloc_compare);
 
-              /* Scan for branches which might trigger Cortex-A8 erratum.  */
-              if (cortex_a8_erratum_scan (input_bfd, info, &a8_fixes,
+	      /* Scan for branches which might trigger Cortex-A8 erratum.  */
+	      if (cortex_a8_erratum_scan (input_bfd, info, &a8_fixes,
 					  &num_a8_fixes, &a8_fix_table_size,
 					  a8_relocs, num_a8_relocs,
 					  prev_num_a8_fixes, &stub_changed)
@@ -5357,7 +5372,7 @@
 	}
 
       if (prev_num_a8_fixes != num_a8_fixes)
-        stub_changed = TRUE;
+	stub_changed = TRUE;
 
       if (!stub_changed)
 	break;
@@ -5379,18 +5394,18 @@
 
       /* Add Cortex-A8 erratum veneers to stub section sizes too.  */
       if (htab->fix_cortex_a8)
-        for (i = 0; i < num_a8_fixes; i++)
-          {
+	for (i = 0; i < num_a8_fixes; i++)
+	  {
 	    stub_sec = elf32_arm_create_or_find_stub_sec (NULL,
 			 a8_fixes[i].section, htab);
 
 	    if (stub_sec == NULL)
 	      goto error_ret_free_local;
 
-            stub_sec->size
-              += find_stub_size_and_template (a8_fixes[i].stub_type, NULL,
-                                              NULL);
-          }
+	    stub_sec->size
+	      += find_stub_size_and_template (a8_fixes[i].stub_type, NULL,
+					      NULL);
+	  }
 
 
       /* Ask the linker to do its stuff.  */
@@ -5401,47 +5416,47 @@
   if (htab->fix_cortex_a8)
     {
       for (i = 0; i < num_a8_fixes; i++)
-        {
-          struct elf32_arm_stub_hash_entry *stub_entry;
-          char *stub_name = a8_fixes[i].stub_name;
-          asection *section = a8_fixes[i].section;
-          unsigned int section_id = a8_fixes[i].section->id;
-          asection *link_sec = htab->stub_group[section_id].link_sec;
-          asection *stub_sec = htab->stub_group[section_id].stub_sec;
-          const insn_sequence *template_sequence;
-          int template_size, size = 0;
+	{
+	  struct elf32_arm_stub_hash_entry *stub_entry;
+	  char *stub_name = a8_fixes[i].stub_name;
+	  asection *section = a8_fixes[i].section;
+	  unsigned int section_id = a8_fixes[i].section->id;
+	  asection *link_sec = htab->stub_group[section_id].link_sec;
+	  asection *stub_sec = htab->stub_group[section_id].stub_sec;
+	  const insn_sequence *template_sequence;
+	  int template_size, size = 0;
 
-          stub_entry = arm_stub_hash_lookup (&htab->stub_hash_table, stub_name,
-                                             TRUE, FALSE);
-          if (stub_entry == NULL)
-            {
-              (*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
-                                     section->owner,
-                                     stub_name);
-              return FALSE;
-            }
+	  stub_entry = arm_stub_hash_lookup (&htab->stub_hash_table, stub_name,
+					     TRUE, FALSE);
+	  if (stub_entry == NULL)
+	    {
+	      (*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
+				     section->owner,
+				     stub_name);
+	      return FALSE;
+	    }
 
-          stub_entry->stub_sec = stub_sec;
-          stub_entry->stub_offset = 0;
-          stub_entry->id_sec = link_sec;
-          stub_entry->stub_type = a8_fixes[i].stub_type;
-          stub_entry->target_section = a8_fixes[i].section;
-          stub_entry->target_value = a8_fixes[i].offset;
-          stub_entry->target_addend = a8_fixes[i].addend;
-          stub_entry->orig_insn = a8_fixes[i].orig_insn;
+	  stub_entry->stub_sec = stub_sec;
+	  stub_entry->stub_offset = 0;
+	  stub_entry->id_sec = link_sec;
+	  stub_entry->stub_type = a8_fixes[i].stub_type;
+	  stub_entry->target_section = a8_fixes[i].section;
+	  stub_entry->target_value = a8_fixes[i].offset;
+	  stub_entry->target_addend = a8_fixes[i].addend;
+	  stub_entry->orig_insn = a8_fixes[i].orig_insn;
 	  stub_entry->branch_type = a8_fixes[i].branch_type;
 
-          size = find_stub_size_and_template (a8_fixes[i].stub_type,
-                                              &template_sequence,
-                                              &template_size);
+	  size = find_stub_size_and_template (a8_fixes[i].stub_type,
+					      &template_sequence,
+					      &template_size);
 
-          stub_entry->stub_size = size;
-          stub_entry->stub_template = template_sequence;
-          stub_entry->stub_template_size = template_size;
-        }
+	  stub_entry->stub_size = size;
+	  stub_entry->stub_template = template_sequence;
+	  stub_entry->stub_template_size = template_size;
+	}
 
       /* Stash the Cortex-A8 erratum fix array for use later in
-         elf32_arm_write_section().  */
+	 elf32_arm_write_section().  */
       htab->a8_erratum_fixes = a8_fixes;
       htab->num_a8_erratum_fixes = num_a8_fixes;
     }
@@ -5521,7 +5536,7 @@
     return NULL;
 
   tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
-                                  + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
+				  + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
 
   BFD_ASSERT (tmp_name);
 
@@ -5557,7 +5572,7 @@
     return NULL;
 
   tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
-                                  + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
+				  + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
 
   BFD_ASSERT (tmp_name);
 
@@ -5624,12 +5639,12 @@
      nop                                ldr  r6, __func_addr
      .arm                               mov  lr, pc
      b func                             bx   r6
-                                        .arm
-		 		    ;; back_to_thumb
-                 		        ldmia r13! {r6, lr}
- 				        bx    lr
-                                    __func_addr:
-                                        .word        func  */
+					.arm
+				    ;; back_to_thumb
+					ldmia r13! {r6, lr}
+					bx    lr
+				    __func_addr:
+					.word        func  */
 
 #define THUMB2ARM_GLUE_SIZE 8
 static const insn16 t2a1_bx_pc_insn = 0x4778;
@@ -5726,7 +5741,7 @@
   BFD_ASSERT (s != NULL);
 
   tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
-                                  + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
+				  + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
 
   BFD_ASSERT (tmp_name);
 
@@ -5817,8 +5832,8 @@
   bh = NULL;
   val = globals->bx_glue_size;
   _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner,
-                                    tmp_name, BSF_FUNCTION | BSF_LOCAL, s, val,
-                                    NULL, TRUE, FALSE, &bh);
+				    tmp_name, BSF_FUNCTION | BSF_LOCAL, s, val,
+				    NULL, TRUE, FALSE, &bh);
 
   myh = (struct elf_link_hash_entry *) bh;
   myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
@@ -5841,7 +5856,7 @@
   if (sec_data->map == NULL)
     {
       sec_data->map = (elf32_arm_section_map *)
-          bfd_malloc (sizeof (elf32_arm_section_map));
+	  bfd_malloc (sizeof (elf32_arm_section_map));
       sec_data->mapcount = 0;
       sec_data->mapsize = 1;
     }
@@ -5852,8 +5867,8 @@
     {
       sec_data->mapsize *= 2;
       sec_data->map = (elf32_arm_section_map *)
-          bfd_realloc_or_free (sec_data->map, sec_data->mapsize
-                               * sizeof (elf32_arm_section_map));
+	  bfd_realloc_or_free (sec_data->map, sec_data->mapsize
+			       * sizeof (elf32_arm_section_map));
     }
 
   if (sec_data->map)
@@ -5869,10 +5884,10 @@
 
 static bfd_vma
 record_vfp11_erratum_veneer (struct bfd_link_info *link_info,
-                             elf32_vfp11_erratum_list *branch,
-                             bfd *branch_bfd,
-                             asection *branch_sec,
-                             unsigned int offset)
+			     elf32_vfp11_erratum_list *branch,
+			     bfd *branch_bfd,
+			     asection *branch_sec,
+			     unsigned int offset)
 {
   asection *s;
   struct elf32_arm_link_hash_table *hash_table;
@@ -5895,7 +5910,7 @@
   BFD_ASSERT (s != NULL);
 
   tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen
-                                  (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
+				  (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
 
   BFD_ASSERT (tmp_name);
 
@@ -5910,8 +5925,8 @@
   bh = NULL;
   val = hash_table->vfp11_erratum_glue_size;
   _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner,
-                                    tmp_name, BSF_FUNCTION | BSF_LOCAL, s, val,
-                                    NULL, TRUE, FALSE, &bh);
+				    tmp_name, BSF_FUNCTION | BSF_LOCAL, s, val,
+				    NULL, TRUE, FALSE, &bh);
 
   myh = (struct elf_link_hash_entry *) bh;
   myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
@@ -5958,20 +5973,20 @@
     {
       bh = NULL;
       /* FIXME: Creates an ARM symbol.  Thumb mode will need attention if it
-         ever requires this erratum fix.  */
+	 ever requires this erratum fix.  */
       _bfd_generic_link_add_one_symbol (link_info,
 					hash_table->bfd_of_glue_owner, "$a",
 					BSF_LOCAL, s, 0, NULL,
-                                        TRUE, FALSE, &bh);
+					TRUE, FALSE, &bh);
 
       myh = (struct elf_link_hash_entry *) bh;
       myh->type = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
       myh->forced_local = 1;
 
       /* The elf32_arm_init_maps function only cares about symbols from input
-         BFDs.  We must make a note of this generated mapping symbol
-         ourselves so that code byteswapping works properly in
-         elf32_arm_write_section.  */
+	 BFDs.  We must make a note of this generated mapping symbol
+	 ourselves so that code byteswapping works properly in
+	 elf32_arm_write_section.  */
       elf32_arm_section_map_add (s, 'a', 0);
     }
 
@@ -6204,8 +6219,8 @@
 	    {
 	    case R_ARM_PC24:
 	      /* This one is a call from arm code.  We need to look up
-	         the target of the call.  If it is a thumb target, we
-	         insert glue.  */
+		 the target of the call.  If it is a thumb target, we
+		 insert glue.  */
 	      if (h->target_internal == ST_BRANCH_TO_THUMB)
 		record_arm_to_thumb_glue (link_info, h);
 	      break;
@@ -6277,15 +6292,15 @@
       const char *name;
 
       if (sec != NULL
-          && ELF_ST_BIND (isym->st_info) == STB_LOCAL)
-        {
-          name = bfd_elf_string_from_elf_section (abfd,
-            hdr->sh_link, isym->st_name);
+	  && ELF_ST_BIND (isym->st_info) == STB_LOCAL)
+	{
+	  name = bfd_elf_string_from_elf_section (abfd,
+	    hdr->sh_link, isym->st_name);
 
-          if (bfd_is_arm_special_symbol_name (name,
+	  if (bfd_is_arm_special_symbol_name (name,
 					      BFD_ARM_SPECIAL_SYM_TYPE_MAP))
-            elf32_arm_section_map_add (sec, name[1], isym->st_value);
-        }
+	    elf32_arm_section_map_add (sec, name[1], isym->st_value);
+	}
     }
 }
 
@@ -6327,17 +6342,17 @@
   if (out_attr[Tag_CPU_arch].i >= TAG_CPU_ARCH_V7)
     {
       switch (globals->vfp11_fix)
-        {
-        case BFD_ARM_VFP11_FIX_DEFAULT:
-        case BFD_ARM_VFP11_FIX_NONE:
-          globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
-          break;
+	{
+	case BFD_ARM_VFP11_FIX_DEFAULT:
+	case BFD_ARM_VFP11_FIX_NONE:
+	  globals->vfp11_fix = BFD_ARM_VFP11_FIX_NONE;
+	  break;
 
-        default:
-          /* Give a warning, but do as the user requests anyway.  */
-          (*_bfd_error_handler) (_("%B: warning: selected VFP11 erratum "
-            "workaround is not necessary for target architecture"), obfd);
-        }
+	default:
+	  /* Give a warning, but do as the user requests anyway.  */
+	  (*_bfd_error_handler) (_("%B: warning: selected VFP11 erratum "
+	    "workaround is not necessary for target architecture"), obfd);
+	}
     }
   else if (globals->vfp11_fix == BFD_ARM_VFP11_FIX_DEFAULT)
     /* For earlier architectures, we might need the workaround, but do not
@@ -6369,7 +6384,7 @@
 
 static unsigned int
 bfd_arm_vfp11_regno (unsigned int insn, bfd_boolean is_double, unsigned int rx,
-                     unsigned int x)
+		     unsigned int x)
 {
   if (is_double)
     return (((insn >> rx) & 0xf) | (((insn >> x) & 1) << 4)) + 32;
@@ -6401,15 +6416,15 @@
       unsigned int reg = regs[i];
 
       if (reg < 32 && (wmask & (1 << reg)) != 0)
-        return TRUE;
+	return TRUE;
 
       reg -= 32;
 
       if (reg >= 16)
-        continue;
+	continue;
 
       if ((wmask & (3 << (reg * 2))) != 0)
-        return TRUE;
+	return TRUE;
     }
 
   return FALSE;
@@ -6425,7 +6440,7 @@
 
 static enum bfd_arm_vfp11_pipe
 bfd_arm_vfp11_insn_decode (unsigned int insn, unsigned int *destmask, int *regs,
-                           int *numregs)
+			   int *numregs)
 {
   enum bfd_arm_vfp11_pipe vpipe = VFP11_BAD;
   bfd_boolean is_double = ((insn & 0xf00) == 0xb00) ? 1 : 0;
@@ -6437,96 +6452,96 @@
       unsigned int fm = bfd_arm_vfp11_regno (insn, is_double, 0, 5);
 
       pqrs = ((insn & 0x00800000) >> 20)
-           | ((insn & 0x00300000) >> 19)
-           | ((insn & 0x00000040) >> 6);
+	   | ((insn & 0x00300000) >> 19)
+	   | ((insn & 0x00000040) >> 6);
 
       switch (pqrs)
-        {
-        case 0: /* fmac[sd].  */
-        case 1: /* fnmac[sd].  */
-        case 2: /* fmsc[sd].  */
-        case 3: /* fnmsc[sd].  */
-          vpipe = VFP11_FMAC;
-          bfd_arm_vfp11_write_mask (destmask, fd);
-          regs[0] = fd;
-          regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7);  /* Fn.  */
-          regs[2] = fm;
-          *numregs = 3;
-          break;
+	{
+	case 0: /* fmac[sd].  */
+	case 1: /* fnmac[sd].  */
+	case 2: /* fmsc[sd].  */
+	case 3: /* fnmsc[sd].  */
+	  vpipe = VFP11_FMAC;
+	  bfd_arm_vfp11_write_mask (destmask, fd);
+	  regs[0] = fd;
+	  regs[1] = bfd_arm_vfp11_regno (insn, is_double, 16, 7);  /* Fn.  */
+	  regs[2] = fm;
+	  *numregs = 3;
+	  break;
 
-        case 4: /* fmul[sd].  */
-        case 5: /* fnmul[sd].  */
-        case 6: /* fadd[sd].  */
-        case 7: /* fsub[sd].  */
-          vpipe = VFP11_FMAC;
-          goto vfp_binop;
+	case 4: /* fmul[sd].  */
+	case 5: /* fnmul[sd].  */
+	case 6: /* fadd[sd].  */
+	case 7: /* fsub[sd].  */
+	  vpipe = VFP11_FMAC;
+	  goto vfp_binop;
 
-        case 8: /* fdiv[sd].  */
-          vpipe = VFP11_DS;
-          vfp_binop:
-          bfd_arm_vfp11_write_mask (destmask, fd);
-          regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7);   /* Fn.  */
-          regs[1] = fm;
-          *numregs = 2;
-          break;
+	case 8: /* fdiv[sd].  */
+	  vpipe = VFP11_DS;
+	  vfp_binop:
+	  bfd_arm_vfp11_write_mask (destmask, fd);
+	  regs[0] = bfd_arm_vfp11_regno (insn, is_double, 16, 7);   /* Fn.  */
+	  regs[1] = fm;
+	  *numregs = 2;
+	  break;
 
-        case 15: /* extended opcode.  */
-          {
-            unsigned int extn = ((insn >> 15) & 0x1e)
-                              | ((insn >> 7) & 1);
+	case 15: /* extended opcode.  */
+	  {
+	    unsigned int extn = ((insn >> 15) & 0x1e)
+			      | ((insn >> 7) & 1);
 
-            switch (extn)
-              {
-              case 0: /* fcpy[sd].  */
-              case 1: /* fabs[sd].  */
-              case 2: /* fneg[sd].  */
-              case 8: /* fcmp[sd].  */
-              case 9: /* fcmpe[sd].  */
-              case 10: /* fcmpz[sd].  */
-              case 11: /* fcmpez[sd].  */
-              case 16: /* fuito[sd].  */
-              case 17: /* fsito[sd].  */
-              case 24: /* ftoui[sd].  */
-              case 25: /* ftouiz[sd].  */
-              case 26: /* ftosi[sd].  */
-              case 27: /* ftosiz[sd].  */
-                /* These instructions will not bounce due to underflow.  */
-                *numregs = 0;
-                vpipe = VFP11_FMAC;
-                break;
+	    switch (extn)
+	      {
+	      case 0: /* fcpy[sd].  */
+	      case 1: /* fabs[sd].  */
+	      case 2: /* fneg[sd].  */
+	      case 8: /* fcmp[sd].  */
+	      case 9: /* fcmpe[sd].  */
+	      case 10: /* fcmpz[sd].  */
+	      case 11: /* fcmpez[sd].  */
+	      case 16: /* fuito[sd].  */
+	      case 17: /* fsito[sd].  */
+	      case 24: /* ftoui[sd].  */
+	      case 25: /* ftouiz[sd].  */
+	      case 26: /* ftosi[sd].  */
+	      case 27: /* ftosiz[sd].  */
+		/* These instructions will not bounce due to underflow.  */
+		*numregs = 0;
+		vpipe = VFP11_FMAC;
+		break;
 
-              case 3: /* fsqrt[sd].  */
-                /* fsqrt cannot underflow, but it can (perhaps) overwrite
-                   registers to cause the erratum in previous instructions.  */
-                bfd_arm_vfp11_write_mask (destmask, fd);
-                vpipe = VFP11_DS;
-                break;
+	      case 3: /* fsqrt[sd].  */
+		/* fsqrt cannot underflow, but it can (perhaps) overwrite
+		   registers to cause the erratum in previous instructions.  */
+		bfd_arm_vfp11_write_mask (destmask, fd);
+		vpipe = VFP11_DS;
+		break;
 
-              case 15: /* fcvt{ds,sd}.  */
-                {
-                  int rnum = 0;
+	      case 15: /* fcvt{ds,sd}.  */
+		{
+		  int rnum = 0;
 
-                  bfd_arm_vfp11_write_mask (destmask, fd);
+		  bfd_arm_vfp11_write_mask (destmask, fd);
 
 		  /* Only FCVTSD can underflow.  */
-                  if ((insn & 0x100) != 0)
-                    regs[rnum++] = fm;
+		  if ((insn & 0x100) != 0)
+		    regs[rnum++] = fm;
 
-                  *numregs = rnum;
+		  *numregs = rnum;
 
-                  vpipe = VFP11_FMAC;
-                }
-                break;
+		  vpipe = VFP11_FMAC;
+		}
+		break;
 
-              default:
-                return VFP11_BAD;
-              }
-          }
-          break;
+	      default:
+		return VFP11_BAD;
+	      }
+	  }
+	  break;
 
-        default:
-          return VFP11_BAD;
-        }
+	default:
+	  return VFP11_BAD;
+	}
     }
   /* Two-register transfer.  */
   else if ((insn & 0x0fe00ed0) == 0x0c400a10)
@@ -6535,13 +6550,13 @@
 
       if ((insn & 0x100000) == 0)
 	{
-          if (is_double)
-            bfd_arm_vfp11_write_mask (destmask, fm);
-          else
-            {
-              bfd_arm_vfp11_write_mask (destmask, fm);
-              bfd_arm_vfp11_write_mask (destmask, fm + 1);
-            }
+	  if (is_double)
+	    bfd_arm_vfp11_write_mask (destmask, fm);
+	  else
+	    {
+	      bfd_arm_vfp11_write_mask (destmask, fm);
+	      bfd_arm_vfp11_write_mask (destmask, fm + 1);
+	    }
 	}
 
       vpipe = VFP11_LS;
@@ -6552,32 +6567,32 @@
       unsigned int puw = ((insn >> 21) & 0x1) | (((insn >> 23) & 3) << 1);
 
       switch (puw)
-        {
-        case 0: /* Two-reg transfer.  We should catch these above.  */
-          abort ();
+	{
+	case 0: /* Two-reg transfer.  We should catch these above.  */
+	  abort ();
 
-        case 2: /* fldm[sdx].  */
-        case 3:
-        case 5:
-          {
-            unsigned int i, offset = insn & 0xff;
+	case 2: /* fldm[sdx].  */
+	case 3:
+	case 5:
+	  {
+	    unsigned int i, offset = insn & 0xff;
 
-            if (is_double)
-              offset >>= 1;
+	    if (is_double)
+	      offset >>= 1;
 
-            for (i = fd; i < fd + offset; i++)
-              bfd_arm_vfp11_write_mask (destmask, i);
-          }
-          break;
+	    for (i = fd; i < fd + offset; i++)
+	      bfd_arm_vfp11_write_mask (destmask, i);
+	  }
+	  break;
 
-        case 4: /* fld[sd].  */
-        case 6:
-          bfd_arm_vfp11_write_mask (destmask, fd);
-          break;
+	case 4: /* fld[sd].  */
+	case 6:
+	  bfd_arm_vfp11_write_mask (destmask, fd);
+	  break;
 
-        default:
-          return VFP11_BAD;
-        }
+	default:
+	  return VFP11_BAD;
+	}
 
       vpipe = VFP11_LS;
     }
@@ -6588,18 +6603,18 @@
       unsigned int fn = bfd_arm_vfp11_regno (insn, is_double, 16, 7);
 
       switch (opcode)
-        {
-        case 0: /* fmsr/fmdlr.  */
-        case 1: /* fmdhr.  */
-          /* Mark fmdhr and fmdlr as writing to the whole of the DP
-             destination register.  I don't know if this is exactly right,
-             but it is the conservative choice.  */
-          bfd_arm_vfp11_write_mask (destmask, fn);
-          break;
+	{
+	case 0: /* fmsr/fmdlr.  */
+	case 1: /* fmdhr.  */
+	  /* Mark fmdhr and fmdlr as writing to the whole of the DP
+	     destination register.  I don't know if this is exactly right,
+	     but it is the conservative choice.  */
+	  bfd_arm_vfp11_write_mask (destmask, fn);
+	  break;
 
-        case 7: /* fmxr.  */
-          break;
-        }
+	case 7: /* fmxr.  */
+	  break;
+	}
 
       vpipe = VFP11_LS;
     }
@@ -6633,23 +6648,23 @@
      The states transition as follows:
 
        0 -> 1 (vector) or 0 -> 2 (scalar)
-           A VFP FMAC-pipeline instruction has been seen. Fill
-           regs[0]..regs[numregs-1] with its input operands. Remember this
-           instruction in 'first_fmac'.
+	   A VFP FMAC-pipeline instruction has been seen. Fill
+	   regs[0]..regs[numregs-1] with its input operands. Remember this
+	   instruction in 'first_fmac'.
 
        1 -> 2
-           Any instruction, except for a VFP instruction which overwrites
-           regs[*].
+	   Any instruction, except for a VFP instruction which overwrites
+	   regs[*].
 
        1 -> 3 [ -> 0 ]  or
        2 -> 3 [ -> 0 ]
-           A VFP instruction has been seen which overwrites any of regs[*].
-           We must make a veneer!  Reset state to 0 before examining next
-           instruction.
+	   A VFP instruction has been seen which overwrites any of regs[*].
+	   We must make a veneer!  Reset state to 0 before examining next
+	   instruction.
 
        2 -> 0
-           If we fail to match anything in state 2, reset to state 0 and reset
-           the instruction pointer to the instruction after 'first_fmac'.
+	   If we fail to match anything in state 2, reset to state 0 and reset
+	   the instruction pointer to the instruction after 'first_fmac'.
 
      If the VFP11 vector mode is in use, there must be at least two unrelated
      instructions between anti-dependent VFP11 instructions to properly avoid
@@ -6680,19 +6695,19 @@
       struct _arm_elf_section_data *sec_data;
 
       /* If we don't have executable progbits, we're not interested in this
-         section.  Also skip if section is to be excluded.  */
+	 section.  Also skip if section is to be excluded.  */
       if (elf_section_type (sec) != SHT_PROGBITS
-          || (elf_section_flags (sec) & SHF_EXECINSTR) == 0
-          || (sec->flags & SEC_EXCLUDE) != 0
+	  || (elf_section_flags (sec) & SHF_EXECINSTR) == 0
+	  || (sec->flags & SEC_EXCLUDE) != 0
 	  || sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS
 	  || sec->output_section == bfd_abs_section_ptr
-          || strcmp (sec->name, VFP11_ERRATUM_VENEER_SECTION_NAME) == 0)
-        continue;
+	  || strcmp (sec->name, VFP11_ERRATUM_VENEER_SECTION_NAME) == 0)
+	continue;
 
       sec_data = elf32_arm_section_data (sec);
 
       if (sec_data->mapcount == 0)
-        continue;
+	continue;
 
       if (elf_section_data (sec)->this_hdr.contents != NULL)
 	contents = elf_section_data (sec)->this_hdr.contents;
@@ -6703,122 +6718,122 @@
 	     elf32_arm_compare_mapping);
 
       for (span = 0; span < sec_data->mapcount; span++)
-        {
-          unsigned int span_start = sec_data->map[span].vma;
-          unsigned int span_end = (span == sec_data->mapcount - 1)
+	{
+	  unsigned int span_start = sec_data->map[span].vma;
+	  unsigned int span_end = (span == sec_data->mapcount - 1)
 				  ? sec->size : sec_data->map[span + 1].vma;
-          char span_type = sec_data->map[span].type;
+	  char span_type = sec_data->map[span].type;
 
-          /* FIXME: Only ARM mode is supported at present.  We may need to
-             support Thumb-2 mode also at some point.  */
-          if (span_type != 'a')
-            continue;
+	  /* FIXME: Only ARM mode is supported at present.  We may need to
+	     support Thumb-2 mode also at some point.  */
+	  if (span_type != 'a')
+	    continue;
 
-          for (i = span_start; i < span_end;)
-            {
-              unsigned int next_i = i + 4;
-              unsigned int insn = bfd_big_endian (abfd)
-                ? (contents[i] << 24)
-                  | (contents[i + 1] << 16)
-                  | (contents[i + 2] << 8)
-                  | contents[i + 3]
-                : (contents[i + 3] << 24)
-                  | (contents[i + 2] << 16)
-                  | (contents[i + 1] << 8)
-                  | contents[i];
-              unsigned int writemask = 0;
-              enum bfd_arm_vfp11_pipe vpipe;
+	  for (i = span_start; i < span_end;)
+	    {
+	      unsigned int next_i = i + 4;
+	      unsigned int insn = bfd_big_endian (abfd)
+		? (contents[i] << 24)
+		  | (contents[i + 1] << 16)
+		  | (contents[i + 2] << 8)
+		  | contents[i + 3]
+		: (contents[i + 3] << 24)
+		  | (contents[i + 2] << 16)
+		  | (contents[i + 1] << 8)
+		  | contents[i];
+	      unsigned int writemask = 0;
+	      enum bfd_arm_vfp11_pipe vpipe;
 
-              switch (state)
-                {
-                case 0:
-                  vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
-                                                    &numregs);
-                  /* I'm assuming the VFP11 erratum can trigger with denorm
-                     operands on either the FMAC or the DS pipeline. This might
-                     lead to slightly overenthusiastic veneer insertion.  */
-                  if (vpipe == VFP11_FMAC || vpipe == VFP11_DS)
-                    {
-                      state = use_vector ? 1 : 2;
-                      first_fmac = i;
-                      veneer_of_insn = insn;
-                    }
-                  break;
+	      switch (state)
+		{
+		case 0:
+		  vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask, regs,
+						    &numregs);
+		  /* I'm assuming the VFP11 erratum can trigger with denorm
+		     operands on either the FMAC or the DS pipeline. This might
+		     lead to slightly overenthusiastic veneer insertion.  */
+		  if (vpipe == VFP11_FMAC || vpipe == VFP11_DS)
+		    {
+		      state = use_vector ? 1 : 2;
+		      first_fmac = i;
+		      veneer_of_insn = insn;
+		    }
+		  break;
 
-                case 1:
-                  {
-                    int other_regs[3], other_numregs;
-                    vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
+		case 1:
+		  {
+		    int other_regs[3], other_numregs;
+		    vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
 						      other_regs,
-                                                      &other_numregs);
-                    if (vpipe != VFP11_BAD
-                        && bfd_arm_vfp11_antidependency (writemask, regs,
+						      &other_numregs);
+		    if (vpipe != VFP11_BAD
+			&& bfd_arm_vfp11_antidependency (writemask, regs,
 							 numregs))
-                      state = 3;
-                    else
-                      state = 2;
-                  }
-                  break;
+		      state = 3;
+		    else
+		      state = 2;
+		  }
+		  break;
 
-                case 2:
-                  {
-                    int other_regs[3], other_numregs;
-                    vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
+		case 2:
+		  {
+		    int other_regs[3], other_numregs;
+		    vpipe = bfd_arm_vfp11_insn_decode (insn, &writemask,
 						      other_regs,
-                                                      &other_numregs);
-                    if (vpipe != VFP11_BAD
-                        && bfd_arm_vfp11_antidependency (writemask, regs,
+						      &other_numregs);
+		    if (vpipe != VFP11_BAD
+			&& bfd_arm_vfp11_antidependency (writemask, regs,
 							 numregs))
-                      state = 3;
-                    else
-                      {
-                        state = 0;
-                        next_i = first_fmac + 4;
-                      }
-                  }
-                  break;
+		      state = 3;
+		    else
+		      {
+			state = 0;
+			next_i = first_fmac + 4;
+		      }
+		  }
+		  break;
 
-                case 3:
-                  abort ();  /* Should be unreachable.  */
-                }
+		case 3:
+		  abort ();  /* Should be unreachable.  */
+		}
 
-              if (state == 3)
-                {
-                  elf32_vfp11_erratum_list *newerr =(elf32_vfp11_erratum_list *)
-                      bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
+	      if (state == 3)
+		{
+		  elf32_vfp11_erratum_list *newerr =(elf32_vfp11_erratum_list *)
+		      bfd_zmalloc (sizeof (elf32_vfp11_erratum_list));
 
-                  elf32_arm_section_data (sec)->erratumcount += 1;
+		  elf32_arm_section_data (sec)->erratumcount += 1;
 
-                  newerr->u.b.vfp_insn = veneer_of_insn;
+		  newerr->u.b.vfp_insn = veneer_of_insn;
 
-                  switch (span_type)
-                    {
-                    case 'a':
-                      newerr->type = VFP11_ERRATUM_BRANCH_TO_ARM_VENEER;
-                      break;
+		  switch (span_type)
+		    {
+		    case 'a':
+		      newerr->type = VFP11_ERRATUM_BRANCH_TO_ARM_VENEER;
+		      break;
 
-                    default:
-                      abort ();
-                    }
+		    default:
+		      abort ();
+		    }
 
-                  record_vfp11_erratum_veneer (link_info, newerr, abfd, sec,
+		  record_vfp11_erratum_veneer (link_info, newerr, abfd, sec,
 					       first_fmac);
 
-                  newerr->vma = -1;
+		  newerr->vma = -1;
 
-                  newerr->next = sec_data->erratumlist;
-                  sec_data->erratumlist = newerr;
+		  newerr->next = sec_data->erratumlist;
+		  sec_data->erratumlist = newerr;
 
-                  state = 0;
-                }
+		  state = 0;
+		}
 
-              i = next_i;
-            }
-        }
+	      i = next_i;
+	    }
+	}
 
       if (contents != NULL
-          && elf_section_data (sec)->this_hdr.contents != contents)
-        free (contents);
+	  && elf_section_data (sec)->this_hdr.contents != contents)
+	free (contents);
       contents = NULL;
     }
 
@@ -6855,7 +6870,7 @@
     return;
 
   tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen
-                                  (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
+				  (VFP11_ERRATUM_VENEER_ENTRY_NAME) + 10);
 
   for (sec = abfd->sections; sec != NULL; sec = sec->next)
     {
@@ -6863,56 +6878,56 @@
       elf32_vfp11_erratum_list *errnode = sec_data->erratumlist;
 
       for (; errnode != NULL; errnode = errnode->next)
-        {
-          struct elf_link_hash_entry *myh;
-          bfd_vma vma;
+	{
+	  struct elf_link_hash_entry *myh;
+	  bfd_vma vma;
 
-          switch (errnode->type)
-            {
-            case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
-            case VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER:
-              /* Find veneer symbol.  */
-              sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME,
+	  switch (errnode->type)
+	    {
+	    case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
+	    case VFP11_ERRATUM_BRANCH_TO_THUMB_VENEER:
+	      /* Find veneer symbol.  */
+	      sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME,
 		       errnode->u.b.veneer->u.v.id);
 
-              myh = elf_link_hash_lookup
-                (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
+	      myh = elf_link_hash_lookup
+		(&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
 
-              if (myh == NULL)
-                (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
-                			 "`%s'"), abfd, tmp_name);
-
-              vma = myh->root.u.def.section->output_section->vma
-                    + myh->root.u.def.section->output_offset
-                    + myh->root.u.def.value;
-
-              errnode->u.b.veneer->vma = vma;
-              break;
-
-	    case VFP11_ERRATUM_ARM_VENEER:
-            case VFP11_ERRATUM_THUMB_VENEER:
-              /* Find return location.  */
-              sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r",
-                       errnode->u.v.id);
-
-              myh = elf_link_hash_lookup
-                (&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
-
-              if (myh == NULL)
-                (*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
+	      if (myh == NULL)
+		(*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
 					 "`%s'"), abfd, tmp_name);
 
-              vma = myh->root.u.def.section->output_section->vma
-                    + myh->root.u.def.section->output_offset
-                    + myh->root.u.def.value;
+	      vma = myh->root.u.def.section->output_section->vma
+		    + myh->root.u.def.section->output_offset
+		    + myh->root.u.def.value;
 
-              errnode->u.v.branch->vma = vma;
-              break;
+	      errnode->u.b.veneer->vma = vma;
+	      break;
 
-            default:
-              abort ();
-            }
-        }
+	    case VFP11_ERRATUM_ARM_VENEER:
+	    case VFP11_ERRATUM_THUMB_VENEER:
+	      /* Find return location.  */
+	      sprintf (tmp_name, VFP11_ERRATUM_VENEER_ENTRY_NAME "_r",
+		       errnode->u.v.id);
+
+	      myh = elf_link_hash_lookup
+		(&(globals)->root, tmp_name, FALSE, FALSE, TRUE);
+
+	      if (myh == NULL)
+		(*_bfd_error_handler) (_("%B: unable to find VFP11 veneer "
+					 "`%s'"), abfd, tmp_name);
+
+	      vma = myh->root.u.def.section->output_section->vma
+		    + myh->root.u.def.section->output_offset
+		    + myh->root.u.def.value;
+
+	      errnode->u.v.branch->vma = vma;
+	      break;
+
+	    default:
+	      abort ();
+	    }
+	}
     }
 
   free (tmp_name);
@@ -6926,9 +6941,9 @@
 				 struct bfd_link_info *link_info,
 				 int target1_is_rel,
 				 char * target2_type,
-                                 int fix_v4bx,
+				 int fix_v4bx,
 				 int use_blx,
-                                 bfd_arm_vfp11_fix vfp11_fix,
+				 bfd_arm_vfp11_fix vfp11_fix,
 				 int no_enum_warn, int no_wchar_warn,
 				 int pic_veneer, int fix_cortex_a8,
 				 int fix_arm1176)
@@ -7423,6 +7438,10 @@
       splt = htab->root.iplt;
       sgotplt = htab->root.igotplt;
 
+      /* NaCl uses a special first entry in .iplt too.  */
+      if (htab->nacl_p && splt->size == 0)
+	splt->size += htab->plt_header_size;
+
       /* Allocate room for an R_ARM_IRELATIVE relocation in .rel.iplt.  */
       elf32_arm_allocate_irelocs (info, htab->root.irelplt, 1);
     }
@@ -7474,9 +7493,11 @@
 
    ROOT_PLT points to the offset of the PLT entry from the start of its
    section (.iplt or .plt).  ARM_PLT points to the symbol's ARM-specific
-   bookkeeping information.  */
+   bookkeeping information.
 
-static void
+   Returns FALSE if there was a problem.  */
+
+static bfd_boolean
 elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
 			      union gotplt_union *root_plt,
 			      struct arm_plt_info *arm_plt,
@@ -7645,7 +7666,7 @@
 	     in the GOT.  The offset accounts for the value produced by
 	     adding to pc in the penultimate instruction of the PLT stub.  */
 	  got_displacement = (got_address
-                              - (plt_address + htab->plt_entry_size));
+			      - (plt_address + htab->plt_entry_size));
 
 	  /* NaCl does not support interworking at all.  */
 	  BFD_ASSERT (!elf32_arm_plt_needs_thumb_stub_p (info, arm_plt));
@@ -7666,6 +7687,16 @@
 			| (tail_displacement & 0x00ffffff),
 			ptr + 12);
 	}
+      else if (using_thumb_only (htab))
+	{
+	  /* PR ld/16017: Do not generate ARM instructions for
+	     the PLT if compiling for a thumb-only target.
+
+	     FIXME: We ought to be able to generate thumb PLT instructions...  */
+	  _bfd_error_handler (_("%B: Warning: thumb mode PLT generation not currently supported"),
+			      output_bfd);
+	  return FALSE;
+	}
       else
 	{
 	  /* Calculate the displacement between the PLT slot and the
@@ -7724,8 +7755,15 @@
 		  sgot->contents + got_offset);
     }
 
-  loc = srel->contents + plt_index * RELOC_SIZE (htab);
-  SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+  if (dynindx == -1)
+    elf32_arm_add_dynreloc (output_bfd, info, srel, &rel);
+  else
+    {
+      loc = srel->contents + plt_index * RELOC_SIZE (htab);
+      SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+    }
+
+  return TRUE;
 }
 
 /* Some relocations map to different relocations depending on the
@@ -7959,28 +7997,28 @@
 
       /* Calculate which part of the value to mask.  */
       if (residual == 0)
-        shift = 0;
+	shift = 0;
       else
-        {
-          int msb;
+	{
+	  int msb;
 
-          /* Determine the most significant bit in the residual and
-             align the resulting value to a 2-bit boundary.  */
-          for (msb = 30; msb >= 0; msb -= 2)
-            if (residual & (3 << msb))
-              break;
+	  /* Determine the most significant bit in the residual and
+	     align the resulting value to a 2-bit boundary.  */
+	  for (msb = 30; msb >= 0; msb -= 2)
+	    if (residual & (3 << msb))
+	      break;
 
-          /* The desired shift is now (msb - 6), or zero, whichever
-             is the greater.  */
-          shift = msb - 6;
-          if (shift < 0)
-            shift = 0;
-        }
+	  /* The desired shift is now (msb - 6), or zero, whichever
+	     is the greater.  */
+	  shift = msb - 6;
+	  if (shift < 0)
+	    shift = 0;
+	}
 
       /* Calculate g_n in 32-bit as well as encoded constant+rotation form.  */
       g_n = residual & (0xff << shift);
       encoded_g_n = (g_n >> shift)
-                    | ((g_n <= 0xff ? 0 : (32 - shift) / 2) << 8);
+		    | ((g_n <= 0xff ? 0 : (32 - shift) / 2) << 8);
 
       /* Calculate the residual for the next time around.  */
       residual &= ~g_n;
@@ -8105,6 +8143,14 @@
   else
     addend = signed_addend = rel->r_addend;
 
+  /* ST_BRANCH_TO_ARM is nonsense to thumb-only targets when we
+     are resolving a function call relocation.  */
+  if (using_thumb_only (globals)
+      && (r_type == R_ARM_THM_CALL
+	  || r_type == R_ARM_THM_JUMP24)
+      && branch_type == ST_BRANCH_TO_ARM)
+    branch_type = ST_BRANCH_TO_THUMB;
+
   /* Record the symbol information that should be used in dynamic
      relocations.  */
   dynreloc_st_type = st_type;
@@ -8133,9 +8179,11 @@
 	    plt_offset--;
 	  else
 	    {
-	      elf32_arm_populate_plt_entry (output_bfd, info, root_plt, arm_plt,
-					    -1, dynreloc_value);
-	      root_plt->offset |= 1;
+	      if (elf32_arm_populate_plt_entry (output_bfd, info, root_plt, arm_plt,
+						-1, dynreloc_value))
+		root_plt->offset |= 1;
+	      else
+		return bfd_reloc_notsupported;
 	    }
 
 	  /* Static relocations always resolve to the .iplt entry.  */
@@ -8192,7 +8240,7 @@
 	 branches in this object should go to it, except if the PLT is too
 	 far away, in which case a long branch stub should be inserted.  */
       if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32
-           && r_type != R_ARM_ABS32_NOI && r_type != R_ARM_REL32_NOI
+	   && r_type != R_ARM_ABS32_NOI && r_type != R_ARM_REL32_NOI
 	   && r_type != R_ARM_CALL
 	   && r_type != R_ARM_JUMP24
 	   && r_type != R_ARM_PLT32)
@@ -8223,7 +8271,8 @@
 			  ".tls_vars") == 0)
 	  && ((r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI)
 	      || !SYMBOL_CALLS_LOCAL (info, h))
-	  && (!strstr (input_section->name, STUB_SUFFIX))
+	  && !(input_bfd == globals->stub_bfd
+	       && strstr (input_section->name, STUB_SUFFIX))
 	  && (h == NULL
 	      || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 	      || h->root.type != bfd_link_hash_undefweak)
@@ -8608,36 +8657,36 @@
 	bfd_signed_vma relocation;
 
 	insn = (bfd_get_16 (input_bfd, hit_data) << 16)
-             | bfd_get_16 (input_bfd, hit_data + 2);
+	     | bfd_get_16 (input_bfd, hit_data + 2);
 
-        if (globals->use_rel)
-          {
-            signed_addend = (insn & 0xff) | ((insn & 0x7000) >> 4)
-                          | ((insn & (1 << 26)) >> 15);
-            if (insn & 0xf00000)
-              signed_addend = -signed_addend;
-          }
+	if (globals->use_rel)
+	  {
+	    signed_addend = (insn & 0xff) | ((insn & 0x7000) >> 4)
+			  | ((insn & (1 << 26)) >> 15);
+	    if (insn & 0xf00000)
+	      signed_addend = -signed_addend;
+	  }
 
 	relocation = value + signed_addend;
-	relocation -= (input_section->output_section->vma
-		       + input_section->output_offset
-		       + rel->r_offset);
+	relocation -= Pa (input_section->output_section->vma
+			  + input_section->output_offset
+			  + rel->r_offset);
 
-        value = abs (relocation);
+	value = abs (relocation);
 
-        if (value >= 0x1000)
-          return bfd_reloc_overflow;
+	if (value >= 0x1000)
+	  return bfd_reloc_overflow;
 
 	insn = (insn & 0xfb0f8f00) | (value & 0xff)
-             | ((value & 0x700) << 4)
-             | ((value & 0x800) << 15);
-        if (relocation < 0)
-          insn |= 0xa00000;
+	     | ((value & 0x700) << 4)
+	     | ((value & 0x800) << 15);
+	if (relocation < 0)
+	  insn |= 0xa00000;
 
 	bfd_put_16 (input_bfd, insn >> 16, hit_data);
 	bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2);
 
-        return bfd_reloc_ok;
+	return bfd_reloc_ok;
       }
 
     case R_ARM_THM_PC8:
@@ -8650,15 +8699,15 @@
 
 	insn = bfd_get_16 (input_bfd, hit_data);
 
-        if (globals->use_rel)
-	  addend = (insn & 0x00ff) << 2;
+	if (globals->use_rel)
+	  addend = ((((insn & 0x00ff) << 2) + 4) & 0x3ff) -4;
 
 	relocation = value + addend;
-	relocation -= (input_section->output_section->vma
-		       + input_section->output_offset
-		       + rel->r_offset);
+	relocation -= Pa (input_section->output_section->vma
+			  + input_section->output_offset
+			  + rel->r_offset);
 
-        value = abs (relocation);
+	value = abs (relocation);
 
 	/* We do not check for overflow of this reloc.  Although strictly
 	   speaking this is incorrect, it appears to be necessary in order
@@ -8671,7 +8720,7 @@
 
 	bfd_put_16 (input_bfd, insn, hit_data);
 
-        return bfd_reloc_ok;
+	return bfd_reloc_ok;
       }
 
     case R_ARM_THM_PC12:
@@ -8681,33 +8730,33 @@
 	bfd_signed_vma relocation;
 
 	insn = (bfd_get_16 (input_bfd, hit_data) << 16)
-             | bfd_get_16 (input_bfd, hit_data + 2);
+	     | bfd_get_16 (input_bfd, hit_data + 2);
 
-        if (globals->use_rel)
-          {
-            signed_addend = insn & 0xfff;
-            if (!(insn & (1 << 23)))
-              signed_addend = -signed_addend;
-          }
+	if (globals->use_rel)
+	  {
+	    signed_addend = insn & 0xfff;
+	    if (!(insn & (1 << 23)))
+	      signed_addend = -signed_addend;
+	  }
 
 	relocation = value + signed_addend;
-	relocation -= (input_section->output_section->vma
-		       + input_section->output_offset
-		       + rel->r_offset);
+	relocation -= Pa (input_section->output_section->vma
+			  + input_section->output_offset
+			  + rel->r_offset);
 
-        value = abs (relocation);
+	value = abs (relocation);
 
-        if (value >= 0x1000)
-          return bfd_reloc_overflow;
+	if (value >= 0x1000)
+	  return bfd_reloc_overflow;
 
 	insn = (insn & 0xff7ff000) | value;
-        if (relocation >= 0)
-          insn |= (1 << 23);
+	if (relocation >= 0)
+	  insn |= (1 << 23);
 
 	bfd_put_16 (input_bfd, insn >> 16, hit_data);
 	bfd_put_16 (input_bfd, insn & 0xffff, hit_data + 2);
 
-        return bfd_reloc_ok;
+	return bfd_reloc_ok;
       }
 
     case R_ARM_THM_XPC22:
@@ -8716,7 +8765,7 @@
       /* Thumb BL (branch long instruction).  */
       {
 	bfd_vma relocation;
-        bfd_vma reloc_sign;
+	bfd_vma reloc_sign;
 	bfd_boolean overflow = FALSE;
 	bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data);
 	bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2);
@@ -8748,20 +8797,20 @@
 	  }
 
 	/* Fetch the addend.  We use the Thumb-2 encoding (backwards compatible
-           with Thumb-1) involving the J1 and J2 bits.  */
+	   with Thumb-1) involving the J1 and J2 bits.  */
 	if (globals->use_rel)
 	  {
-            bfd_vma s = (upper_insn & (1 << 10)) >> 10;
-            bfd_vma upper = upper_insn & 0x3ff;
-            bfd_vma lower = lower_insn & 0x7ff;
+	    bfd_vma s = (upper_insn & (1 << 10)) >> 10;
+	    bfd_vma upper = upper_insn & 0x3ff;
+	    bfd_vma lower = lower_insn & 0x7ff;
 	    bfd_vma j1 = (lower_insn & (1 << 13)) >> 13;
 	    bfd_vma j2 = (lower_insn & (1 << 11)) >> 11;
-            bfd_vma i1 = j1 ^ s ? 0 : 1;
-            bfd_vma i2 = j2 ^ s ? 0 : 1;
+	    bfd_vma i1 = j1 ^ s ? 0 : 1;
+	    bfd_vma i2 = j2 ^ s ? 0 : 1;
 
-            addend = (i1 << 23) | (i2 << 22) | (upper << 12) | (lower << 1);
-            /* Sign extend.  */
-            addend = (addend | ((s ? 0 : 1) << 24)) - (1 << 24);
+	    addend = (i1 << 23) | (i2 << 22) | (upper << 12) | (lower << 1);
+	    /* Sign extend.  */
+	    addend = (addend | ((s ? 0 : 1) << 24)) - (1 << 24);
 
 	    signed_addend = addend;
 	  }
@@ -8918,14 +8967,14 @@
 	/* Put RELOCATION back into the insn.  Assumes two's complement.
 	   We use the Thumb-2 encoding, which is safe even if dealing with
 	   a Thumb-1 instruction by virtue of our overflow check above.  */
-        reloc_sign = (signed_check < 0) ? 1 : 0;
+	reloc_sign = (signed_check < 0) ? 1 : 0;
 	upper_insn = (upper_insn & ~(bfd_vma) 0x7ff)
-                     | ((relocation >> 12) & 0x3ff)
-                     | (reloc_sign << 10);
+		     | ((relocation >> 12) & 0x3ff)
+		     | (reloc_sign << 10);
 	lower_insn = (lower_insn & ~(bfd_vma) 0x2fff)
-                     | (((!((relocation >> 23) & 1)) ^ reloc_sign) << 13)
-                     | (((!((relocation >> 22) & 1)) ^ reloc_sign) << 11)
-                     | ((relocation >> 1) & 0x7ff);
+		     | (((!((relocation >> 23) & 1)) ^ reloc_sign) << 13)
+		     | (((!((relocation >> 22) & 1)) ^ reloc_sign) << 11)
+		     | ((relocation >> 1) & 0x7ff);
 
 	/* Put the relocated value back in the object file:  */
 	bfd_put_16 (input_bfd, upper_insn, hit_data);
@@ -8979,7 +9028,7 @@
 	/* ??? Should handle interworking?  GCC might someday try to
 	   use this for tail calls.  */
 
-      	relocation = value + signed_addend;
+	relocation = value + signed_addend;
 	relocation -= (input_section->output_section->vma
 		       + input_section->output_offset
 		       + rel->r_offset);
@@ -9094,11 +9143,11 @@
 
     case R_ARM_GOTOFF32:
       /* Relocation is relative to the start of the
-         global offset table.  */
+	 global offset table.  */
 
       BFD_ASSERT (sgot != NULL);
       if (sgot == NULL)
-        return bfd_reloc_notsupported;
+	return bfd_reloc_notsupported;
 
       /* If we are addressing a Thumb function, we need to adjust the
 	 address by one, so that attempts to call the function pointer will
@@ -9107,10 +9156,10 @@
 	value += 1;
 
       /* Note that sgot->output_offset is not involved in this
-         calculation.  We always want the start of .got.  If we
-         define _GLOBAL_OFFSET_TABLE in a different way, as is
-         permitted by the ABI, we might have to change this
-         calculation.  */
+	 calculation.  We always want the start of .got.  If we
+	 define _GLOBAL_OFFSET_TABLE in a different way, as is
+	 permitted by the ABI, we might have to change this
+	 calculation.  */
       value -= sgot->output_section->vma;
       return _bfd_final_link_relocate (howto, input_bfd, input_section,
 				       contents, rel->r_offset, value,
@@ -9121,7 +9170,7 @@
       BFD_ASSERT (sgot != NULL);
 
       if (sgot == NULL)
-        return bfd_reloc_notsupported;
+	return bfd_reloc_notsupported;
 
       *unresolved_reloc_p = FALSE;
       value = sgot->output_section->vma;
@@ -9132,7 +9181,7 @@
     case R_ARM_GOT32:
     case R_ARM_GOT_PREL:
       /* Relocation is to the entry for this symbol in the
-         global offset table.  */
+	 global offset table.  */
       if (sgot == NULL)
 	return bfd_reloc_notsupported;
 
@@ -9167,7 +9216,7 @@
 	    {
 	      Elf_Internal_Rela outrel;
 
-	      if (!SYMBOL_REFERENCES_LOCAL (info, h))
+	      if (h->dynindx != -1 && !SYMBOL_REFERENCES_LOCAL (info, h))
 		{
 		  /* If the symbol doesn't resolve locally in a static
 		     object, we have an undefined reference.  If the
@@ -9185,11 +9234,13 @@
 	      else
 		{
 		  if (dynreloc_st_type == STT_GNU_IFUNC)
- 		    outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
-		  else if (info->shared)
- 		    outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
- 		  else
- 		    outrel.r_info = 0;
+		    outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
+		  else if (info->shared &&
+			   (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+			    || h->root.type != bfd_link_hash_undefweak))
+		    outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
+		  else
+		    outrel.r_info = 0;
 		  outrel.r_addend = dynreloc_value;
 		}
 
@@ -9242,7 +9293,7 @@
 				     + sgot->output_offset
 				     + off);
 		  if (dynreloc_st_type == STT_GNU_IFUNC)
- 		    outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
+		    outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
 		  else
 		    outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
 		  elf32_arm_add_dynreloc (output_bfd, info, srelgot, &outrel);
@@ -9388,7 +9439,7 @@
 		BFD_ASSERT ((h && (h->root.type == bfd_link_hash_undefweak))
 			    || info->shared);
 		BFD_ASSERT (globals->sgotplt_jump_table_size + offplt + 8
-                            <= globals->root.sgotplt->size);
+			    <= globals->root.sgotplt->size);
 
 		outrel.r_addend = 0;
 		outrel.r_offset = (globals->root.sgotplt->output_section->vma
@@ -9401,7 +9452,7 @@
 		loc = sreloc->contents;
 		loc += globals->next_tls_desc_index++ * RELOC_SIZE (globals);
 		BFD_ASSERT (loc + RELOC_SIZE (globals)
-		   	   <= sreloc->contents + sreloc->size);
+			   <= sreloc->contents + sreloc->size);
 
 		SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc);
 
@@ -9409,7 +9460,7 @@
 		   the relocation index and the top bit set, or zero,
 		   if we're binding now.  For locals, it gets the
 		   symbol's offset in the tls section.  */
-	    	bfd_put_32 (output_bfd,
+		bfd_put_32 (output_bfd,
 			    !h ? value - elf_hash_table (info)->tls_sec->vma
 			    : info->flags & DF_BIND_NOW ? 0
 			    : 0x80000000 | ELF32_R_SYM (outrel.r_info),
@@ -9417,7 +9468,7 @@
 			    + globals->sgotplt_jump_table_size);
 
 		/* Second word in the relocation is always zero.  */
-	    	bfd_put_32 (output_bfd, 0,
+		bfd_put_32 (output_bfd, 0,
 			    globals->root.sgotplt->contents + offplt
 			    + globals->sgotplt_jump_table_size + 4);
 	      }
@@ -9733,13 +9784,13 @@
 		    + input_section->output_offset + rel->r_offset);
 
 	if (r_type == R_ARM_MOVW_BREL && value >= 0x10000)
-          return bfd_reloc_overflow;
+	  return bfd_reloc_overflow;
 
 	if (branch_type == ST_BRANCH_TO_THUMB)
 	  value |= 1;
 
 	if (r_type == R_ARM_MOVT_ABS || r_type == R_ARM_MOVT_PREL
-            || r_type == R_ARM_MOVT_BREL)
+	    || r_type == R_ARM_MOVT_BREL)
 	  value >>= 16;
 
 	insn &= 0xfff0f000;
@@ -9783,13 +9834,13 @@
 		    + input_section->output_offset + rel->r_offset);
 
 	if (r_type == R_ARM_THM_MOVW_BREL && value >= 0x10000)
-          return bfd_reloc_overflow;
+	  return bfd_reloc_overflow;
 
 	if (branch_type == ST_BRANCH_TO_THUMB)
 	  value |= 1;
 
 	if (r_type == R_ARM_THM_MOVT_ABS || r_type == R_ARM_THM_MOVT_PREL
-            || r_type == R_ARM_THM_MOVT_BREL)
+	    || r_type == R_ARM_THM_MOVT_BREL)
 	  value >>= 16;
 
 	insn &= 0xfbf08f00;
@@ -9815,129 +9866,127 @@
     case R_ARM_ALU_SB_G2:
       {
 	bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
-        bfd_vma pc = input_section->output_section->vma
+	bfd_vma pc = input_section->output_section->vma
 		     + input_section->output_offset + rel->r_offset;
-        /* sb should be the origin of the *segment* containing the symbol.
-           It is not clear how to obtain this OS-dependent value, so we
-           make an arbitrary choice of zero.  */
-        bfd_vma sb = 0;
-        bfd_vma residual;
-        bfd_vma g_n;
+	/* sb is the origin of the *segment* containing the symbol.  */
+	bfd_vma sb = sym_sec ? sym_sec->output_section->vma : 0;
+	bfd_vma residual;
+	bfd_vma g_n;
 	bfd_signed_vma signed_value;
-        int group = 0;
+	int group = 0;
 
-        /* Determine which group of bits to select.  */
-        switch (r_type)
-          {
-          case R_ARM_ALU_PC_G0_NC:
-          case R_ARM_ALU_PC_G0:
-          case R_ARM_ALU_SB_G0_NC:
-          case R_ARM_ALU_SB_G0:
-            group = 0;
-            break;
+	/* Determine which group of bits to select.  */
+	switch (r_type)
+	  {
+	  case R_ARM_ALU_PC_G0_NC:
+	  case R_ARM_ALU_PC_G0:
+	  case R_ARM_ALU_SB_G0_NC:
+	  case R_ARM_ALU_SB_G0:
+	    group = 0;
+	    break;
 
-          case R_ARM_ALU_PC_G1_NC:
-          case R_ARM_ALU_PC_G1:
-          case R_ARM_ALU_SB_G1_NC:
-          case R_ARM_ALU_SB_G1:
-            group = 1;
-            break;
+	  case R_ARM_ALU_PC_G1_NC:
+	  case R_ARM_ALU_PC_G1:
+	  case R_ARM_ALU_SB_G1_NC:
+	  case R_ARM_ALU_SB_G1:
+	    group = 1;
+	    break;
 
-          case R_ARM_ALU_PC_G2:
-          case R_ARM_ALU_SB_G2:
-            group = 2;
-            break;
+	  case R_ARM_ALU_PC_G2:
+	  case R_ARM_ALU_SB_G2:
+	    group = 2;
+	    break;
 
-          default:
-            abort ();
-          }
+	  default:
+	    abort ();
+	  }
 
-        /* If REL, extract the addend from the insn.  If RELA, it will
-           have already been fetched for us.  */
+	/* If REL, extract the addend from the insn.  If RELA, it will
+	   have already been fetched for us.  */
 	if (globals->use_rel)
-          {
-            int negative;
-            bfd_vma constant = insn & 0xff;
-            bfd_vma rotation = (insn & 0xf00) >> 8;
+	  {
+	    int negative;
+	    bfd_vma constant = insn & 0xff;
+	    bfd_vma rotation = (insn & 0xf00) >> 8;
 
-            if (rotation == 0)
-              signed_addend = constant;
-            else
-              {
-                /* Compensate for the fact that in the instruction, the
-                   rotation is stored in multiples of 2 bits.  */
-                rotation *= 2;
+	    if (rotation == 0)
+	      signed_addend = constant;
+	    else
+	      {
+		/* Compensate for the fact that in the instruction, the
+		   rotation is stored in multiples of 2 bits.  */
+		rotation *= 2;
 
-                /* Rotate "constant" right by "rotation" bits.  */
-                signed_addend = (constant >> rotation) |
-                                (constant << (8 * sizeof (bfd_vma) - rotation));
-              }
+		/* Rotate "constant" right by "rotation" bits.  */
+		signed_addend = (constant >> rotation) |
+				(constant << (8 * sizeof (bfd_vma) - rotation));
+	      }
 
-            /* Determine if the instruction is an ADD or a SUB.
-               (For REL, this determines the sign of the addend.)  */
-            negative = identify_add_or_sub (insn);
-            if (negative == 0)
-              {
-                (*_bfd_error_handler)
-                  (_("%B(%A+0x%lx): Only ADD or SUB instructions are allowed for ALU group relocations"),
-                  input_bfd, input_section,
-                  (long) rel->r_offset, howto->name);
-                return bfd_reloc_overflow;
-    	      }
+	    /* Determine if the instruction is an ADD or a SUB.
+	       (For REL, this determines the sign of the addend.)  */
+	    negative = identify_add_or_sub (insn);
+	    if (negative == 0)
+	      {
+		(*_bfd_error_handler)
+		  (_("%B(%A+0x%lx): Only ADD or SUB instructions are allowed for ALU group relocations"),
+		  input_bfd, input_section,
+		  (long) rel->r_offset, howto->name);
+		return bfd_reloc_overflow;
+	      }
 
-            signed_addend *= negative;
-          }
+	    signed_addend *= negative;
+	  }
 
 	/* Compute the value (X) to go in the place.  */
-        if (r_type == R_ARM_ALU_PC_G0_NC
-            || r_type == R_ARM_ALU_PC_G1_NC
-            || r_type == R_ARM_ALU_PC_G0
-            || r_type == R_ARM_ALU_PC_G1
-            || r_type == R_ARM_ALU_PC_G2)
-          /* PC relative.  */
-          signed_value = value - pc + signed_addend;
-        else
-          /* Section base relative.  */
-          signed_value = value - sb + signed_addend;
+	if (r_type == R_ARM_ALU_PC_G0_NC
+	    || r_type == R_ARM_ALU_PC_G1_NC
+	    || r_type == R_ARM_ALU_PC_G0
+	    || r_type == R_ARM_ALU_PC_G1
+	    || r_type == R_ARM_ALU_PC_G2)
+	  /* PC relative.  */
+	  signed_value = value - pc + signed_addend;
+	else
+	  /* Section base relative.  */
+	  signed_value = value - sb + signed_addend;
 
-        /* If the target symbol is a Thumb function, then set the
-           Thumb bit in the address.  */
+	/* If the target symbol is a Thumb function, then set the
+	   Thumb bit in the address.  */
 	if (branch_type == ST_BRANCH_TO_THUMB)
 	  signed_value |= 1;
 
-        /* Calculate the value of the relevant G_n, in encoded
-           constant-with-rotation format.  */
-        g_n = calculate_group_reloc_mask (abs (signed_value), group,
-                                          &residual);
+	/* Calculate the value of the relevant G_n, in encoded
+	   constant-with-rotation format.  */
+	g_n = calculate_group_reloc_mask (abs (signed_value), group,
+					  &residual);
 
-        /* Check for overflow if required.  */
-        if ((r_type == R_ARM_ALU_PC_G0
-             || r_type == R_ARM_ALU_PC_G1
-             || r_type == R_ARM_ALU_PC_G2
-             || r_type == R_ARM_ALU_SB_G0
-             || r_type == R_ARM_ALU_SB_G1
-             || r_type == R_ARM_ALU_SB_G2) && residual != 0)
-          {
-            (*_bfd_error_handler)
-              (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
-              input_bfd, input_section,
-              (long) rel->r_offset, abs (signed_value), howto->name);
-            return bfd_reloc_overflow;
-          }
+	/* Check for overflow if required.  */
+	if ((r_type == R_ARM_ALU_PC_G0
+	     || r_type == R_ARM_ALU_PC_G1
+	     || r_type == R_ARM_ALU_PC_G2
+	     || r_type == R_ARM_ALU_SB_G0
+	     || r_type == R_ARM_ALU_SB_G1
+	     || r_type == R_ARM_ALU_SB_G2) && residual != 0)
+	  {
+	    (*_bfd_error_handler)
+	      (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+	      input_bfd, input_section,
+	      (long) rel->r_offset, abs (signed_value), howto->name);
+	    return bfd_reloc_overflow;
+	  }
 
-        /* Mask out the value and the ADD/SUB part of the opcode; take care
-           not to destroy the S bit.  */
-        insn &= 0xff1ff000;
+	/* Mask out the value and the ADD/SUB part of the opcode; take care
+	   not to destroy the S bit.  */
+	insn &= 0xff1ff000;
 
-        /* Set the opcode according to whether the value to go in the
-           place is negative.  */
-        if (signed_value < 0)
-          insn |= 1 << 22;
-        else
-          insn |= 1 << 23;
+	/* Set the opcode according to whether the value to go in the
+	   place is negative.  */
+	if (signed_value < 0)
+	  insn |= 1 << 22;
+	else
+	  insn |= 1 << 23;
 
-        /* Encode the offset.  */
-        insn |= g_n;
+	/* Encode the offset.  */
+	insn |= g_n;
 
 	bfd_put_32 (input_bfd, insn, hit_data);
       }
@@ -9951,76 +10000,77 @@
     case R_ARM_LDR_SB_G2:
       {
 	bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
-        bfd_vma pc = input_section->output_section->vma
+	bfd_vma pc = input_section->output_section->vma
 		     + input_section->output_offset + rel->r_offset;
-        bfd_vma sb = 0; /* See note above.  */
-        bfd_vma residual;
+	/* sb is the origin of the *segment* containing the symbol.  */
+	bfd_vma sb = sym_sec ? sym_sec->output_section->vma : 0;
+	bfd_vma residual;
 	bfd_signed_vma signed_value;
-        int group = 0;
+	int group = 0;
 
-        /* Determine which groups of bits to calculate.  */
-        switch (r_type)
-          {
-          case R_ARM_LDR_PC_G0:
-          case R_ARM_LDR_SB_G0:
-            group = 0;
-            break;
+	/* Determine which groups of bits to calculate.  */
+	switch (r_type)
+	  {
+	  case R_ARM_LDR_PC_G0:
+	  case R_ARM_LDR_SB_G0:
+	    group = 0;
+	    break;
 
-          case R_ARM_LDR_PC_G1:
-          case R_ARM_LDR_SB_G1:
-            group = 1;
-            break;
+	  case R_ARM_LDR_PC_G1:
+	  case R_ARM_LDR_SB_G1:
+	    group = 1;
+	    break;
 
-          case R_ARM_LDR_PC_G2:
-          case R_ARM_LDR_SB_G2:
-            group = 2;
-            break;
+	  case R_ARM_LDR_PC_G2:
+	  case R_ARM_LDR_SB_G2:
+	    group = 2;
+	    break;
 
-          default:
-            abort ();
-          }
+	  default:
+	    abort ();
+	  }
 
-        /* If REL, extract the addend from the insn.  If RELA, it will
-           have already been fetched for us.  */
+	/* If REL, extract the addend from the insn.  If RELA, it will
+	   have already been fetched for us.  */
 	if (globals->use_rel)
-          {
-            int negative = (insn & (1 << 23)) ? 1 : -1;
-            signed_addend = negative * (insn & 0xfff);
-          }
+	  {
+	    int negative = (insn & (1 << 23)) ? 1 : -1;
+	    signed_addend = negative * (insn & 0xfff);
+	  }
 
 	/* Compute the value (X) to go in the place.  */
-        if (r_type == R_ARM_LDR_PC_G0
-            || r_type == R_ARM_LDR_PC_G1
-            || r_type == R_ARM_LDR_PC_G2)
-          /* PC relative.  */
-          signed_value = value - pc + signed_addend;
-        else
-          /* Section base relative.  */
-          signed_value = value - sb + signed_addend;
+	if (r_type == R_ARM_LDR_PC_G0
+	    || r_type == R_ARM_LDR_PC_G1
+	    || r_type == R_ARM_LDR_PC_G2)
+	  /* PC relative.  */
+	  signed_value = value - pc + signed_addend;
+	else
+	  /* Section base relative.  */
+	  signed_value = value - sb + signed_addend;
 
-        /* Calculate the value of the relevant G_{n-1} to obtain
-           the residual at that stage.  */
-        calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+	/* Calculate the value of the relevant G_{n-1} to obtain
+	   the residual at that stage.  */
+	calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
 
-        /* Check for overflow.  */
-        if (residual >= 0x1000)
-          {
-            (*_bfd_error_handler)
-              (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
-              input_bfd, input_section,
-              (long) rel->r_offset, abs (signed_value), howto->name);
-            return bfd_reloc_overflow;
-          }
+	/* Check for overflow.  */
+	if (residual >= 0x1000)
+	  {
+	    (*_bfd_error_handler)
+	      (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+	      input_bfd, input_section,
+	      (long) rel->r_offset, abs (signed_value), howto->name);
+	    return bfd_reloc_overflow;
+	  }
 
-        /* Mask out the value and U bit.  */
-        insn &= 0xff7ff000;
+	/* Mask out the value and U bit.  */
+	insn &= 0xff7ff000;
 
-        /* Set the U bit if the value to go in the place is non-negative.  */
-        if (signed_value >= 0)
-          insn |= 1 << 23;
+	/* Set the U bit if the value to go in the place is non-negative.  */
+	if (signed_value >= 0)
+	  insn |= 1 << 23;
 
-        /* Encode the offset.  */
-        insn |= residual;
+	/* Encode the offset.  */
+	insn |= residual;
 
 	bfd_put_32 (input_bfd, insn, hit_data);
       }
@@ -10034,76 +10084,77 @@
     case R_ARM_LDRS_SB_G2:
       {
 	bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
-        bfd_vma pc = input_section->output_section->vma
+	bfd_vma pc = input_section->output_section->vma
 		     + input_section->output_offset + rel->r_offset;
-        bfd_vma sb = 0; /* See note above.  */
-        bfd_vma residual;
+	/* sb is the origin of the *segment* containing the symbol.  */
+	bfd_vma sb = sym_sec ? sym_sec->output_section->vma : 0;
+	bfd_vma residual;
 	bfd_signed_vma signed_value;
-        int group = 0;
+	int group = 0;
 
-        /* Determine which groups of bits to calculate.  */
-        switch (r_type)
-          {
-          case R_ARM_LDRS_PC_G0:
-          case R_ARM_LDRS_SB_G0:
-            group = 0;
-            break;
+	/* Determine which groups of bits to calculate.  */
+	switch (r_type)
+	  {
+	  case R_ARM_LDRS_PC_G0:
+	  case R_ARM_LDRS_SB_G0:
+	    group = 0;
+	    break;
 
-          case R_ARM_LDRS_PC_G1:
-          case R_ARM_LDRS_SB_G1:
-            group = 1;
-            break;
+	  case R_ARM_LDRS_PC_G1:
+	  case R_ARM_LDRS_SB_G1:
+	    group = 1;
+	    break;
 
-          case R_ARM_LDRS_PC_G2:
-          case R_ARM_LDRS_SB_G2:
-            group = 2;
-            break;
+	  case R_ARM_LDRS_PC_G2:
+	  case R_ARM_LDRS_SB_G2:
+	    group = 2;
+	    break;
 
-          default:
-            abort ();
-          }
+	  default:
+	    abort ();
+	  }
 
-        /* If REL, extract the addend from the insn.  If RELA, it will
-           have already been fetched for us.  */
+	/* If REL, extract the addend from the insn.  If RELA, it will
+	   have already been fetched for us.  */
 	if (globals->use_rel)
-          {
-            int negative = (insn & (1 << 23)) ? 1 : -1;
-            signed_addend = negative * (((insn & 0xf00) >> 4) + (insn & 0xf));
-          }
+	  {
+	    int negative = (insn & (1 << 23)) ? 1 : -1;
+	    signed_addend = negative * (((insn & 0xf00) >> 4) + (insn & 0xf));
+	  }
 
 	/* Compute the value (X) to go in the place.  */
-        if (r_type == R_ARM_LDRS_PC_G0
-            || r_type == R_ARM_LDRS_PC_G1
-            || r_type == R_ARM_LDRS_PC_G2)
-          /* PC relative.  */
-          signed_value = value - pc + signed_addend;
-        else
-          /* Section base relative.  */
-          signed_value = value - sb + signed_addend;
+	if (r_type == R_ARM_LDRS_PC_G0
+	    || r_type == R_ARM_LDRS_PC_G1
+	    || r_type == R_ARM_LDRS_PC_G2)
+	  /* PC relative.  */
+	  signed_value = value - pc + signed_addend;
+	else
+	  /* Section base relative.  */
+	  signed_value = value - sb + signed_addend;
 
-        /* Calculate the value of the relevant G_{n-1} to obtain
-           the residual at that stage.  */
-        calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+	/* Calculate the value of the relevant G_{n-1} to obtain
+	   the residual at that stage.  */
+	calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
 
-        /* Check for overflow.  */
-        if (residual >= 0x100)
-          {
-            (*_bfd_error_handler)
-              (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
-              input_bfd, input_section,
-              (long) rel->r_offset, abs (signed_value), howto->name);
-            return bfd_reloc_overflow;
-          }
+	/* Check for overflow.  */
+	if (residual >= 0x100)
+	  {
+	    (*_bfd_error_handler)
+	      (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+	      input_bfd, input_section,
+	      (long) rel->r_offset, abs (signed_value), howto->name);
+	    return bfd_reloc_overflow;
+	  }
 
-        /* Mask out the value and U bit.  */
-        insn &= 0xff7ff0f0;
+	/* Mask out the value and U bit.  */
+	insn &= 0xff7ff0f0;
 
-        /* Set the U bit if the value to go in the place is non-negative.  */
-        if (signed_value >= 0)
-          insn |= 1 << 23;
+	/* Set the U bit if the value to go in the place is non-negative.  */
+	if (signed_value >= 0)
+	  insn |= 1 << 23;
 
-        /* Encode the offset.  */
-        insn |= ((residual & 0xf0) << 4) | (residual & 0xf);
+	/* Encode the offset.  */
+	insn |= ((residual & 0xf0) << 4) | (residual & 0xf);
 
 	bfd_put_32 (input_bfd, insn, hit_data);
       }
@@ -10117,78 +10168,79 @@
     case R_ARM_LDC_SB_G2:
       {
 	bfd_vma insn = bfd_get_32 (input_bfd, hit_data);
-        bfd_vma pc = input_section->output_section->vma
+	bfd_vma pc = input_section->output_section->vma
 		     + input_section->output_offset + rel->r_offset;
-        bfd_vma sb = 0; /* See note above.  */
-        bfd_vma residual;
+	/* sb is the origin of the *segment* containing the symbol.  */
+	bfd_vma sb = sym_sec ? sym_sec->output_section->vma : 0;
+	bfd_vma residual;
 	bfd_signed_vma signed_value;
-        int group = 0;
+	int group = 0;
 
-        /* Determine which groups of bits to calculate.  */
-        switch (r_type)
-          {
-          case R_ARM_LDC_PC_G0:
-          case R_ARM_LDC_SB_G0:
-            group = 0;
-            break;
+	/* Determine which groups of bits to calculate.  */
+	switch (r_type)
+	  {
+	  case R_ARM_LDC_PC_G0:
+	  case R_ARM_LDC_SB_G0:
+	    group = 0;
+	    break;
 
-          case R_ARM_LDC_PC_G1:
-          case R_ARM_LDC_SB_G1:
-            group = 1;
-            break;
+	  case R_ARM_LDC_PC_G1:
+	  case R_ARM_LDC_SB_G1:
+	    group = 1;
+	    break;
 
-          case R_ARM_LDC_PC_G2:
-          case R_ARM_LDC_SB_G2:
-            group = 2;
-            break;
+	  case R_ARM_LDC_PC_G2:
+	  case R_ARM_LDC_SB_G2:
+	    group = 2;
+	    break;
 
-          default:
-            abort ();
-          }
+	  default:
+	    abort ();
+	  }
 
-        /* If REL, extract the addend from the insn.  If RELA, it will
-           have already been fetched for us.  */
+	/* If REL, extract the addend from the insn.  If RELA, it will
+	   have already been fetched for us.  */
 	if (globals->use_rel)
-          {
-            int negative = (insn & (1 << 23)) ? 1 : -1;
-            signed_addend = negative * ((insn & 0xff) << 2);
-          }
+	  {
+	    int negative = (insn & (1 << 23)) ? 1 : -1;
+	    signed_addend = negative * ((insn & 0xff) << 2);
+	  }
 
 	/* Compute the value (X) to go in the place.  */
-        if (r_type == R_ARM_LDC_PC_G0
-            || r_type == R_ARM_LDC_PC_G1
-            || r_type == R_ARM_LDC_PC_G2)
-          /* PC relative.  */
-          signed_value = value - pc + signed_addend;
-        else
-          /* Section base relative.  */
-          signed_value = value - sb + signed_addend;
+	if (r_type == R_ARM_LDC_PC_G0
+	    || r_type == R_ARM_LDC_PC_G1
+	    || r_type == R_ARM_LDC_PC_G2)
+	  /* PC relative.  */
+	  signed_value = value - pc + signed_addend;
+	else
+	  /* Section base relative.  */
+	  signed_value = value - sb + signed_addend;
 
-        /* Calculate the value of the relevant G_{n-1} to obtain
-           the residual at that stage.  */
-        calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
+	/* Calculate the value of the relevant G_{n-1} to obtain
+	   the residual at that stage.  */
+	calculate_group_reloc_mask (abs (signed_value), group - 1, &residual);
 
-        /* Check for overflow.  (The absolute value to go in the place must be
-           divisible by four and, after having been divided by four, must
-           fit in eight bits.)  */
-        if ((residual & 0x3) != 0 || residual >= 0x400)
-          {
-            (*_bfd_error_handler)
-              (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
-              input_bfd, input_section,
-              (long) rel->r_offset, abs (signed_value), howto->name);
-            return bfd_reloc_overflow;
-          }
+	/* Check for overflow.  (The absolute value to go in the place must be
+	   divisible by four and, after having been divided by four, must
+	   fit in eight bits.)  */
+	if ((residual & 0x3) != 0 || residual >= 0x400)
+	  {
+	    (*_bfd_error_handler)
+	      (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"),
+	      input_bfd, input_section,
+	      (long) rel->r_offset, abs (signed_value), howto->name);
+	    return bfd_reloc_overflow;
+	  }
 
-        /* Mask out the value and U bit.  */
-        insn &= 0xff7fff00;
+	/* Mask out the value and U bit.  */
+	insn &= 0xff7fff00;
 
-        /* Set the U bit if the value to go in the place is non-negative.  */
-        if (signed_value >= 0)
-          insn |= 1 << 23;
+	/* Set the U bit if the value to go in the place is non-negative.  */
+	if (signed_value >= 0)
+	  insn |= 1 << 23;
 
-        /* Encode the offset.  */
-        insn |= residual >> 2;
+	/* Encode the offset.  */
+	insn |= residual >> 2;
 
 	bfd_put_32 (input_bfd, insn, hit_data);
       }
@@ -10340,8 +10392,8 @@
       r_type   = arm_real_reloc_type (globals, r_type);
 
       if (   r_type == R_ARM_GNU_VTENTRY
-          || r_type == R_ARM_GNU_VTINHERIT)
-        continue;
+	  || r_type == R_ARM_GNU_VTINHERIT)
+	continue;
 
       bfd_reloc.howto = elf32_arm_howto_from_type (r_type);
       howto = bfd_reloc.howto;
@@ -10474,12 +10526,12 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  sym_type = h->type;
 	}
@@ -10534,10 +10586,10 @@
 	}
 
       /* We call elf32_arm_final_link_relocate unless we're completely
-         done, i.e., the relaxation produced the final output we want,
-         and we won't let anybody mess with it. Also, we have to do
-         addend adjustments in case of a R_ARM_TLS_GOTDESC relocation
-         both in relaxed and non-relaxed cases */
+	 done, i.e., the relaxation produced the final output we want,
+	 and we won't let anybody mess with it. Also, we have to do
+	 addend adjustments in case of a R_ARM_TLS_GOTDESC relocation
+	 both in relaxed and non-relaxed cases */
      if ((elf32_arm_tls_transition (info, r_type, h) != (unsigned)r_type)
 	 || (IS_ARM_TLS_GNU_RELOC (r_type)
 	     && !((h ? elf32_arm_hash_entry (h)->tls_type :
@@ -10565,8 +10617,8 @@
 	 because such sections are not SEC_ALLOC and thus ld.so will
 	 not process them.  */
       if (unresolved_reloc
-          && !((input_section->flags & SEC_DEBUGGING) != 0
-               && h->def_dynamic)
+	  && !((input_section->flags & SEC_DEBUGGING) != 0
+	       && h->def_dynamic)
 	  && _bfd_elf_section_offset (output_bfd, info, input_section,
 				      rel->r_offset) != (bfd_vma) -1)
 	{
@@ -10713,7 +10765,7 @@
 
      1. Regions without unwind data are marked with EXIDX_CANTUNWIND entries.
      2. Duplicate entries are merged together (EXIDX_CANTUNWIND, or unwind
-        codes which have been inlined into the index).
+	codes which have been inlined into the index).
 
    If MERGE_EXIDX_ENTRIES is false, duplicate entries are not merged.
 
@@ -10739,7 +10791,7 @@
       asection *sec;
 
       for (sec = inp->sections; sec != NULL; sec = sec->next)
-        {
+	{
 	  struct bfd_elf_section_data *elf_sec = elf_section_data (sec);
 	  Elf_Internal_Shdr *hdr = &elf_sec->this_hdr;
 
@@ -10749,15 +10801,15 @@
 	  if (elf_sec->linked_to)
 	    {
 	      Elf_Internal_Shdr *linked_hdr
-	        = &elf_section_data (elf_sec->linked_to)->this_hdr;
+		= &elf_section_data (elf_sec->linked_to)->this_hdr;
 	      struct _arm_elf_section_data *linked_sec_arm_data
-	        = get_arm_elf_section_data (linked_hdr->bfd_section);
+		= get_arm_elf_section_data (linked_hdr->bfd_section);
 
 	      if (linked_sec_arm_data == NULL)
-	        continue;
+		continue;
 
 	      /* Link this .ARM.exidx section back from the text section it
-	         describes.  */
+		 describes.  */
 	      linked_sec_arm_data->u.text.arm_exidx_sec = sec;
 	    }
 	}
@@ -10782,7 +10834,7 @@
       bfd *ibfd;
 
       if (arm_data == NULL)
-        continue;
+	continue;
 
       exidx_sec = arm_data->u.text.arm_exidx_sec;
       if (exidx_sec == NULL)
@@ -10806,11 +10858,11 @@
 
       hdr = &elf_section_data (exidx_sec)->this_hdr;
       if (hdr->sh_type != SHT_ARM_EXIDX)
-        continue;
+	continue;
 
       exidx_arm_data = get_arm_elf_section_data (exidx_sec);
       if (exidx_arm_data == NULL)
-        continue;
+	continue;
 
       ibfd = exidx_sec->owner;
 
@@ -10860,7 +10912,7 @@
 
       /* Free contents if we allocated it ourselves.  */
       if (contents != hdr->contents)
-        free (contents);
+	free (contents);
 
       /* Record edits to be applied later (in elf32_arm_write_section).  */
       exidx_arm_data->u.exidx.unwind_edit_list = unwind_edit_head;
@@ -10986,6 +11038,20 @@
 
 	    if (strcmp (name, "IWMMXT") == 0)
 	      return bfd_mach_arm_iWMMXt;
+
+	    if (strcmp (name, "XSCALE") == 0)
+	      {
+		int wmmx;
+
+		BFD_ASSERT (Tag_WMMX_arch < NUM_KNOWN_OBJ_ATTRIBUTES);
+		wmmx = elf_known_obj_attributes (abfd) [OBJ_ATTR_PROC][Tag_WMMX_arch].i;
+		switch (wmmx)
+		  {
+		  case 1: return bfd_mach_arm_iWMMXt;
+		  case 2: return bfd_mach_arm_iWMMXt2;
+		  default: return bfd_mach_arm_XScale;
+		  }
+	      }
 	  }
 
 	return bfd_mach_arm_5TE;
@@ -11073,7 +11139,7 @@
 	return FALSE;
 
       /* If the src and dest have different interworking flags
-         then turn off the interworking bit.  */
+	 then turn off the interworking bit.  */
       if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
 	{
 	  if (out_flags & EF_ARM_INTERWORK)
@@ -11327,6 +11393,24 @@
       T(V7E_M),  /* V6S_M.  */
       T(V7E_M)   /* V7E_M.  */
     };
+  const int v8[] =
+    {
+      T(V8),		/* PRE_V4.  */
+      T(V8),		/* V4.  */
+      T(V8),		/* V4T.  */
+      T(V8),		/* V5T.  */
+      T(V8),		/* V5TE.  */
+      T(V8),		/* V5TEJ.  */
+      T(V8),		/* V6.  */
+      T(V8),		/* V6KZ.  */
+      T(V8),		/* V6T2.  */
+      T(V8),		/* V6K.  */
+      T(V8),		/* V7.  */
+      T(V8),		/* V6_M.  */
+      T(V8),		/* V6S_M.  */
+      T(V8),		/* V7E_M.  */
+      T(V8)		/* V8.  */
+    };
   const int v4t_plus_v6_m[] =
     {
       -1,		/* PRE_V4.  */
@@ -11343,6 +11427,7 @@
       T(V6_M),		/* V6_M.  */
       T(V6S_M),		/* V6S_M.  */
       T(V7E_M),		/* V7E_M.  */
+      T(V8),		/* V8.  */
       T(V4T_PLUS_V6_M)	/* V4T plus V6_M.  */
     };
   const int *comb[] =
@@ -11353,6 +11438,7 @@
       v6_m,
       v6s_m,
       v7e_m,
+      v8,
       /* Pseudo-architecture.  */
       v4t_plus_v6_m
     };
@@ -11485,7 +11571,7 @@
 	{
 	  if (out_attr[Tag_MPextension_use].i != 0
 	      && out_attr[Tag_MPextension_use_legacy].i
-	        != out_attr[Tag_MPextension_use].i)
+		!= out_attr[Tag_MPextension_use].i)
 	    {
 	      _bfd_error_handler
 		(_("Error: %B has both the current and legacy "
@@ -11554,7 +11640,8 @@
 		"ARM v6K",
 		"ARM v7",
 		"ARM v6-M",
-		"ARM v6S-M"
+		"ARM v6S-M",
+		"ARM v8"
 	    };
 
 	    /* Merge Tag_CPU_arch and Tag_also_compatible_with.  */
@@ -11672,7 +11759,7 @@
 	      /* 0 will merge with anything.
 		 'A' and 'S' merge to 'A'.
 		 'R' and 'S' merge to 'R'.
-	         'M' and 'A|R|S' is an error.  */
+		 'M' and 'A|R|S' is an error.  */
 	      if (out_attr[i].i == 0
 		  || (out_attr[i].i == 'S'
 		      && (in_attr[i].i == 'A' || in_attr[i].i == 'R')))
@@ -11699,11 +11786,12 @@
 		 when it's 0.  It might mean absence of FP hardware if
 		 Tag_FP_arch is zero, otherwise it is effectively SP + DP.  */
 
+#define VFP_VERSION_COUNT 8
 	      static const struct
 	      {
 		  int ver;
 		  int regs;
-	      } vfp_versions[7] =
+	      } vfp_versions[VFP_VERSION_COUNT] =
 		{
 		  {0, 0},
 		  {1, 16},
@@ -11711,7 +11799,8 @@
 		  {3, 32},
 		  {3, 16},
 		  {4, 32},
-		  {4, 16}
+		  {4, 16},
+		  {8, 32}
 		};
 	      int ver;
 	      int regs;
@@ -11751,9 +11840,10 @@
 
 	      /* Now we can handle Tag_FP_arch.  */
 
-	      /* Values greater than 6 aren't defined, so just pick the
-	         biggest */
-	      if (in_attr[i].i > 6 && in_attr[i].i > out_attr[i].i)
+	      /* Values of VFP_VERSION_COUNT or more aren't defined, so just
+		 pick the biggest.  */
+	      if (in_attr[i].i >= VFP_VERSION_COUNT
+		  && in_attr[i].i > out_attr[i].i)
 		{
 		  out_attr[i] = in_attr[i];
 		  break;
@@ -11767,8 +11857,8 @@
 	      if (regs < vfp_versions[out_attr[i].i].regs)
 		regs = vfp_versions[out_attr[i].i].regs;
 	      /* This assumes all possible supersets are also a valid
-	         options.  */
-	      for (newval = 6; newval > 0; newval--)
+		 options.  */
+	      for (newval = VFP_VERSION_COUNT - 1; newval > 0; newval--)
 		{
 		  if (regs == vfp_versions[newval].regs
 		      && ver == vfp_versions[newval].ver)
@@ -11783,7 +11873,7 @@
 	  else if (in_attr[i].i != 0 && out_attr[i].i != in_attr[i].i)
 	    {
 	      /* It's sometimes ok to mix different configs, so this is only
-	         a warning.  */
+		 a warning.  */
 	      _bfd_error_handler
 		(_("Warning: %B: Conflicting platform configuration"), ibfd);
 	    }
@@ -12086,6 +12176,15 @@
 
     case EF_ARM_EABI_VER5:
       fprintf (file, _(" [Version5 EABI]"));
+
+      if (flags & EF_ARM_ABI_FLOAT_SOFT)
+	fprintf (file, _(" [soft-float ABI]"));
+
+      if (flags & EF_ARM_ABI_FLOAT_HARD)
+	fprintf (file, _(" [hard-float ABI]"));
+
+      flags &= ~(EF_ARM_ABI_FLOAT_SOFT | EF_ARM_ABI_FLOAT_HARD);
+
     eabi:
       if (flags & EF_ARM_BE8)
 	fprintf (file, _(" [BE8]"));
@@ -12444,6 +12543,10 @@
 	      while (h->root.type == bfd_link_hash_indirect
 		     || h->root.type == bfd_link_hash_warning)
 		h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	      /* PR15323, ref flags aren't set for references in the
+		 same object.  */
+	      h->root.non_ir_ref = 1;
 	    }
 	}
 
@@ -12456,7 +12559,7 @@
       /* Could be done earlier, if h were already available.  */
       r_type = elf32_arm_tls_transition (info, r_type, h);
       switch (r_type)
-        {
+	{
 	  case R_ARM_GOT32:
 	  case R_ARM_GOT_PREL:
 	  case R_ARM_TLS_GD32:
@@ -12499,7 +12602,7 @@
 		}
 
 	      /* If a variable is accessed with both tls methods, two
-	         slots may be created.  */
+		 slots may be created.  */
 	      if (GOT_TLS_GD_ANY_P (old_tls_type)
 		  && GOT_TLS_GD_ANY_P (tls_type))
 		tls_type |= old_tls_type;
@@ -12512,9 +12615,9 @@
 		tls_type |= old_tls_type;
 
 	      /* If the symbol is accessed in both IE and GDESC
-	         method, we're able to relax. Turn off the GDESC flag,
-	         without messing up with any other kind of tls types
-	         that may be involved */
+		 method, we're able to relax. Turn off the GDESC flag,
+		 without messing up with any other kind of tls types
+		 that may be involved */
 	      if ((tls_type & GOT_TLS_IE) && (tls_type & GOT_TLS_GDESC))
 		tls_type &= ~GOT_TLS_GDESC;
 
@@ -12611,22 +12714,22 @@
 	      may_need_local_target_p = TRUE;
 	    break;
 
-        /* This relocation describes the C++ object vtable hierarchy.
-           Reconstruct it for later use during GC.  */
-        case R_ARM_GNU_VTINHERIT:
-          if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
-            return FALSE;
-          break;
+	/* This relocation describes the C++ object vtable hierarchy.
+	   Reconstruct it for later use during GC.  */
+	case R_ARM_GNU_VTINHERIT:
+	  if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+	    return FALSE;
+	  break;
 
-        /* This relocation describes which C++ vtable entries are actually
-           used.  Record for later use during GC.  */
-        case R_ARM_GNU_VTENTRY:
-          BFD_ASSERT (h != NULL);
-          if (h != NULL
-              && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
-            return FALSE;
-          break;
-        }
+	/* This relocation describes which C++ vtable entries are actually
+	   used.  Record for later use during GC.  */
+	case R_ARM_GNU_VTENTRY:
+	  BFD_ASSERT (h != NULL);
+	  if (h != NULL
+	      && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
+	    return FALSE;
+	  break;
+	}
 
       if (h != NULL)
 	{
@@ -12884,9 +12987,9 @@
   /* We skip _bfd_dwarf1_find_nearest_line since no known ARM toolchain uses it.  */
 
   if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections,
-                                     section, symbols, offset,
+				     section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr, 0,
+				     line_ptr, NULL, 0,
 				     & elf_tdata (abfd)->dwarf2_find_line_info))
     {
       if (!*functionname_ptr)
@@ -13195,18 +13298,18 @@
 	    s->size += 4;
 	  else
 	    {
-              if (tls_type & GOT_TLS_GDESC)
-	        {
+	      if (tls_type & GOT_TLS_GDESC)
+		{
 		  /* R_ARM_TLS_DESC needs 2 GOT slots.  */
-	          eh->tlsdesc_got
+		  eh->tlsdesc_got
 		    = (htab->root.sgotplt->size
 		       - elf32_arm_compute_jump_table_size (htab));
-	          htab->root.sgotplt->size += 8;
-	          h->got.offset = (bfd_vma) -2;
+		  htab->root.sgotplt->size += 8;
+		  h->got.offset = (bfd_vma) -2;
 		  /* plt.got_offset needs to know there's a TLS_DESC
 		     reloc in the middle of .got.plt.  */
-                  htab->num_tls_desc++;
-	        }
+		  htab->num_tls_desc++;
+		}
 
 	      if (tls_type & GOT_TLS_GD)
 		{
@@ -13253,7 +13356,7 @@
 	      if ((tls_type & GOT_TLS_GD) && indx != 0)
 		elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
 	    }
-	  else if (!SYMBOL_REFERENCES_LOCAL (info, h))
+	  else if (indx != -1 && !SYMBOL_REFERENCES_LOCAL (info, h))
 	    {
 	      if (htab->root.dynamic_sections_created)
 		/* Reserve room for the GOT entry's R_ARM_GLOB_DAT relocation.  */
@@ -13265,7 +13368,8 @@
 	       they all resolve dynamically instead.  Reserve room for the
 	       GOT entry's R_ARM_IRELATIVE relocation.  */
 	    elf32_arm_allocate_irelocs (info, htab->root.srelgot, 1);
-	  else if (info->shared)
+	  else if (info->shared && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+				    || h->root.type != bfd_link_hash_undefweak))
 	    /* Reserve room for the GOT entry's R_ARM_RELATIVE relocation.  */
 	    elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
 	}
@@ -13318,11 +13422,11 @@
   if (info->shared || htab->root.is_relocatable_executable)
     {
       /* The only relocs that use pc_count are R_ARM_REL32 and
-         R_ARM_REL32_NOI, which will appear on something like
-         ".long foo - .".  We want calls to protected symbols to resolve
-         directly to the function rather than going via the plt.  If people
-         want function pointer comparisons to work as expected then they
-         should avoid writing assembly like ".long foo - .".  */
+	 R_ARM_REL32_NOI, which will appear on something like
+	 ".long foo - .".  We want calls to protected symbols to resolve
+	 directly to the function rather than going via the plt.  If people
+	 want function pointer comparisons to work as expected then they
+	 should avoid writing assembly like ".long foo - .".  */
       if (SYMBOL_CALLS_LOCAL (info, h))
 	{
 	  struct elf_dyn_relocs **pp;
@@ -13352,7 +13456,7 @@
 	}
 
       /* Also discard relocs on undefined weak syms with non-default
-         visibility.  */
+	 visibility.  */
       if (eh->dyn_relocs != NULL
 	  && h->root.type == bfd_link_hash_undefweak)
 	{
@@ -13523,7 +13627,7 @@
 	  struct elf_dyn_relocs *p;
 
 	  for (p = (struct elf_dyn_relocs *)
-                   elf_section_data (s)->local_dynrel; p != NULL; p = p->next)
+		   elf_section_data (s)->local_dynrel; p != NULL; p = p->next)
 	    {
 	      if (!bfd_is_abs_section (p->sec)
 		  && bfd_is_abs_section (p->sec->output_section))
@@ -13619,7 +13723,7 @@
 		  *local_got = (bfd_vma) -2;
 		  /* plt.got_offset needs to know there's a TLS_DESC
 		     reloc in the middle of .got.plt.  */
-                  htab->num_tls_desc++;
+		  htab->num_tls_desc++;
 		}
 	      if (*local_tls_type & GOT_TLS_IE)
 		s->size += 4;
@@ -13643,14 +13747,18 @@
 		  && (local_iplt == NULL
 		      || local_iplt->arm.noncall_refcount == 0))
 		elf32_arm_allocate_irelocs (info, srel, 1);
-	      else if ((info->shared && !(*local_tls_type & GOT_TLS_GDESC))
-		       || *local_tls_type & GOT_TLS_GD)
-		elf32_arm_allocate_dynrelocs (info, srel, 1);
-
-	      if (info->shared && *local_tls_type & GOT_TLS_GDESC)
+	      else if (info->shared || output_bfd->flags & DYNAMIC)
 		{
-		  elf32_arm_allocate_dynrelocs (info, htab->root.srelplt, 1);
-		  htab->tls_trampoline = -1;
+		  if ((info->shared && !(*local_tls_type & GOT_TLS_GDESC))
+		      || *local_tls_type & GOT_TLS_GD)
+		    elf32_arm_allocate_dynrelocs (info, srel, 1);
+
+		  if (info->shared && *local_tls_type & GOT_TLS_GDESC)
+		    {
+		      elf32_arm_allocate_dynrelocs (info,
+						    htab->root.srelplt, 1);
+		      htab->tls_trampoline = -1;
+		    }
 		}
 	    }
 	  else
@@ -13685,8 +13793,8 @@
 
       if (!bfd_elf32_arm_process_before_allocation (ibfd, info)
 	  || !bfd_elf32_arm_vfp11_erratum_scan (ibfd, info))
-        /* xgettext:c-format */
-        _bfd_error_handler (_("Errors encountered processing file %s"),
+	/* xgettext:c-format */
+	_bfd_error_handler (_("Errors encountered processing file %s"),
 			    ibfd->filename);
     }
 
@@ -13710,7 +13818,7 @@
       htab->root.splt->size += htab->plt_entry_size;
 
       /* If we're not using lazy TLS relocations, don't generate the
-         PLT and GOT entries they require.  */
+	 PLT and GOT entries they require.  */
       if (!(info->flags & DF_BIND_NOW))
 	{
 	  htab->dt_tlsdesc_got = htab->root.sgot->size;
@@ -13864,7 +13972,7 @@
 
 static bfd_boolean
 elf32_arm_always_size_sections (bfd *output_bfd,
-	                        struct bfd_link_info *info)
+				struct bfd_link_info *info)
 {
   asection *tls_sec;
 
@@ -13881,22 +13989,22 @@
 	(elf_hash_table (info), "_TLS_MODULE_BASE_", TRUE, TRUE, FALSE);
 
       if (tlsbase)
-        {
-          struct bfd_link_hash_entry *bh = NULL;
+	{
+	  struct bfd_link_hash_entry *bh = NULL;
 	  const struct elf_backend_data *bed
-            = get_elf_backend_data (output_bfd);
+	    = get_elf_backend_data (output_bfd);
 
-          if (!(_bfd_generic_link_add_one_symbol
+	  if (!(_bfd_generic_link_add_one_symbol
 		(info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL,
 		 tls_sec, 0, NULL, FALSE,
 		 bed->collect, &bh)))
 	    return FALSE;
 
-      	  tlsbase->type = STT_TLS;
-          tlsbase = (struct elf_link_hash_entry *)bh;
-          tlsbase->def_regular = 1;
-          tlsbase->other = STV_HIDDEN;
-          (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE);
+	  tlsbase->type = STT_TLS;
+	  tlsbase = (struct elf_link_hash_entry *)bh;
+	  tlsbase->def_regular = 1;
+	  tlsbase->other = STV_HIDDEN;
+	  (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE);
 	}
     }
   return TRUE;
@@ -13925,8 +14033,9 @@
       if (!eh->is_iplt)
 	{
 	  BFD_ASSERT (h->dynindx != -1);
-	  elf32_arm_populate_plt_entry (output_bfd, info, &h->plt, &eh->plt,
-					h->dynindx, 0);
+	  if (! elf32_arm_populate_plt_entry (output_bfd, info, &h->plt, &eh->plt,
+					      h->dynindx, 0))
+	    return FALSE;
 	}
 
       if (!h->def_regular)
@@ -13979,7 +14088,7 @@
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  On VxWorks,
      the _GLOBAL_OFFSET_TABLE_ symbol is not absolute: it is relative
      to the ".got" section.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == htab->root.hdynamic
       || (!htab->vxworks_p && h == htab->root.hgot))
     sym->st_shndx = SHN_ABS;
 
@@ -14004,6 +14113,38 @@
     }
 }
 
+/* Install the special first PLT entry for elf32-arm-nacl.  Unlike
+   other variants, NaCl needs this entry in a static executable's
+   .iplt too.  When we're handling that case, GOT_DISPLACEMENT is
+   zero.  For .iplt really only the last bundle is useful, and .iplt
+   could have a shorter first entry, with each individual PLT entry's
+   relative branch calculated differently so it targets the last
+   bundle instead of the instruction before it (labelled .Lplt_tail
+   above).  But it's simpler to keep the size and layout of PLT0
+   consistent with the dynamic case, at the cost of some dead code at
+   the start of .iplt and the one dead store to the stack at the start
+   of .Lplt_tail.  */
+static void
+arm_nacl_put_plt0 (struct elf32_arm_link_hash_table *htab, bfd *output_bfd,
+		   asection *plt, bfd_vma got_displacement)
+{
+  unsigned int i;
+
+  put_arm_insn (htab, output_bfd,
+		elf32_arm_nacl_plt0_entry[0]
+		| arm_movw_immediate (got_displacement),
+		plt->contents + 0);
+  put_arm_insn (htab, output_bfd,
+		elf32_arm_nacl_plt0_entry[1]
+		| arm_movt_immediate (got_displacement),
+		plt->contents + 4);
+
+  for (i = 2; i < ARRAY_SIZE (elf32_arm_nacl_plt0_entry); ++i)
+    put_arm_insn (htab, output_bfd,
+		  elf32_arm_nacl_plt0_entry[i],
+		  plt->contents + (i * 4));
+}
+
 /* Finish up the dynamic sections.  */
 
 static bfd_boolean
@@ -14083,7 +14224,14 @@
 	      name = RELOC_SECTION (htab, ".plt");
 	    get_vma:
 	      s = bfd_get_section_by_name (output_bfd, name);
-	      BFD_ASSERT (s != NULL);
+	      if (s == NULL)
+		{
+		  /* PR ld/14397: Issue an error message if a required section is missing.  */
+		  (*_bfd_error_handler)
+		    (_("error: required section '%s' not found in the linker script"), name);
+		  bfd_set_error (bfd_error_invalid_operation);
+		  return FALSE;
+		}
 	      if (!htab->symbian_p)
 		dyn.d_un.d_ptr = s->vma;
 	      else
@@ -14162,16 +14310,16 @@
 	      break;
 
 	    case DT_TLSDESC_PLT:
-              s = htab->root.splt;
+	      s = htab->root.splt;
 	      dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
 				+ htab->dt_tlsdesc_plt);
 	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
 	    case DT_TLSDESC_GOT:
-              s = htab->root.sgot;
+	      s = htab->root.sgot;
 	      dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
-		      		+ htab->dt_tlsdesc_got);
+				+ htab->dt_tlsdesc_got);
 	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
 
@@ -14235,24 +14383,8 @@
 				     htab->srelplt2->contents);
 	    }
 	  else if (htab->nacl_p)
-	    {
-	      unsigned int i;
-
-	      got_displacement = got_address + 8 - (plt_address + 16);
-
-	      put_arm_insn (htab, output_bfd,
-			    elf32_arm_nacl_plt0_entry[0]
-			    | arm_movw_immediate (got_displacement),
-			    splt->contents + 0);
-	      put_arm_insn (htab, output_bfd,
-			    elf32_arm_nacl_plt0_entry[1]
-			    | arm_movt_immediate (got_displacement),
-			    splt->contents + 4);
-	      for (i = 2; i < ARRAY_SIZE (elf32_arm_nacl_plt0_entry); ++i)
-		put_arm_insn (htab, output_bfd,
-			      elf32_arm_nacl_plt0_entry[i],
-			      splt->contents + (i * 4));
-	    }
+	    arm_nacl_put_plt0 (htab, output_bfd, splt,
+			       got_address + 8 - (plt_address + 16));
 	  else
 	    {
 	      got_displacement = got_address - (plt_address + 16);
@@ -14345,6 +14477,10 @@
 	}
     }
 
+  if (htab->nacl_p && htab->root.iplt != NULL && htab->root.iplt->size > 0)
+    /* NaCl uses a special first entry in .iplt too.  */
+    arm_nacl_put_plt0 (htab, output_bfd, htab->root.iplt, 0);
+
   /* Fill in the first three entries in the global offset table.  */
   if (sgot)
     {
@@ -14386,10 +14522,22 @@
       if (globals != NULL && globals->byteswap_code)
 	i_ehdrp->e_flags |= EF_ARM_BE8;
     }
+
+  if (EF_ARM_EABI_VERSION (i_ehdrp->e_flags) == EF_ARM_EABI_VER5
+      && ((i_ehdrp->e_type == ET_DYN) || (i_ehdrp->e_type == ET_EXEC)))
+    {
+      int abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_PROC, Tag_ABI_VFP_args);
+      if (abi)
+	i_ehdrp->e_flags |= EF_ARM_ABI_FLOAT_HARD;
+      else
+	i_ehdrp->e_flags |= EF_ARM_ABI_FLOAT_SOFT;
+    }
 }
 
 static enum elf_reloc_type_class
-elf32_arm_reloc_type_class (const Elf_Internal_Rela *rela)
+elf32_arm_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			    const asection *rel_sec ATTRIBUTE_UNUSED,
+			    const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -14916,6 +15064,15 @@
 #endif
 	}
     }
+  if (htab->nacl_p && htab->root.iplt && htab->root.iplt->size > 0)
+    {
+      /* NaCl uses a special first entry in .iplt too.  */
+      osi.sec = htab->root.iplt;
+      osi.sec_shndx = (_bfd_elf_section_from_bfd_section
+		       (output_bfd, osi.sec->output_section));
+      if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
+	return FALSE;
+    }
   if ((htab->root.splt && htab->root.splt->size > 0)
       || (htab->root.iplt && htab->root.iplt->size > 0))
     {
@@ -15052,7 +15209,7 @@
 
 static bfd_boolean
 make_branch_to_a8_stub (struct bfd_hash_entry *gen_entry,
-                       void *in_arg)
+		       void *in_arg)
 {
   struct elf32_arm_stub_hash_entry *stub_entry;
   struct a8_branch_to_stub_data *data;
@@ -15191,82 +15348,82 @@
       unsigned int endianflip = bfd_big_endian (output_bfd) ? 3 : 0;
 
       for (errnode = arm_data->erratumlist; errnode != 0;
-           errnode = errnode->next)
-        {
-          bfd_vma target = errnode->vma - offset;
+	   errnode = errnode->next)
+	{
+	  bfd_vma target = errnode->vma - offset;
 
-          switch (errnode->type)
-            {
-            case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
-              {
-                bfd_vma branch_to_veneer;
-                /* Original condition code of instruction, plus bit mask for
-                   ARM B instruction.  */
-                unsigned int insn = (errnode->u.b.vfp_insn & 0xf0000000)
-                                  | 0x0a000000;
+	  switch (errnode->type)
+	    {
+	    case VFP11_ERRATUM_BRANCH_TO_ARM_VENEER:
+	      {
+		bfd_vma branch_to_veneer;
+		/* Original condition code of instruction, plus bit mask for
+		   ARM B instruction.  */
+		unsigned int insn = (errnode->u.b.vfp_insn & 0xf0000000)
+				  | 0x0a000000;
 
 		/* The instruction is before the label.  */
 		target -= 4;
 
 		/* Above offset included in -4 below.  */
 		branch_to_veneer = errnode->u.b.veneer->vma
-                                   - errnode->vma - 4;
+				   - errnode->vma - 4;
 
 		if ((signed) branch_to_veneer < -(1 << 25)
 		    || (signed) branch_to_veneer >= (1 << 25))
 		  (*_bfd_error_handler) (_("%B: error: VFP11 veneer out of "
 					   "range"), output_bfd);
 
-                insn |= (branch_to_veneer >> 2) & 0xffffff;
-                contents[endianflip ^ target] = insn & 0xff;
-                contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
-                contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
-                contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
-              }
-              break;
+		insn |= (branch_to_veneer >> 2) & 0xffffff;
+		contents[endianflip ^ target] = insn & 0xff;
+		contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
+		contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
+		contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
+	      }
+	      break;
 
 	    case VFP11_ERRATUM_ARM_VENEER:
-              {
-                bfd_vma branch_from_veneer;
-                unsigned int insn;
+	      {
+		bfd_vma branch_from_veneer;
+		unsigned int insn;
 
-                /* Take size of veneer into account.  */
-                branch_from_veneer = errnode->u.v.branch->vma
-                                     - errnode->vma - 12;
+		/* Take size of veneer into account.  */
+		branch_from_veneer = errnode->u.v.branch->vma
+				     - errnode->vma - 12;
 
 		if ((signed) branch_from_veneer < -(1 << 25)
 		    || (signed) branch_from_veneer >= (1 << 25))
 		  (*_bfd_error_handler) (_("%B: error: VFP11 veneer out of "
 					   "range"), output_bfd);
 
-                /* Original instruction.  */
-                insn = errnode->u.v.branch->u.b.vfp_insn;
-                contents[endianflip ^ target] = insn & 0xff;
-                contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
-                contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
-                contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
+		/* Original instruction.  */
+		insn = errnode->u.v.branch->u.b.vfp_insn;
+		contents[endianflip ^ target] = insn & 0xff;
+		contents[endianflip ^ (target + 1)] = (insn >> 8) & 0xff;
+		contents[endianflip ^ (target + 2)] = (insn >> 16) & 0xff;
+		contents[endianflip ^ (target + 3)] = (insn >> 24) & 0xff;
 
-                /* Branch back to insn after original insn.  */
-                insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff);
-                contents[endianflip ^ (target + 4)] = insn & 0xff;
-                contents[endianflip ^ (target + 5)] = (insn >> 8) & 0xff;
-                contents[endianflip ^ (target + 6)] = (insn >> 16) & 0xff;
-                contents[endianflip ^ (target + 7)] = (insn >> 24) & 0xff;
-              }
-              break;
+		/* Branch back to insn after original insn.  */
+		insn = 0xea000000 | ((branch_from_veneer >> 2) & 0xffffff);
+		contents[endianflip ^ (target + 4)] = insn & 0xff;
+		contents[endianflip ^ (target + 5)] = (insn >> 8) & 0xff;
+		contents[endianflip ^ (target + 6)] = (insn >> 16) & 0xff;
+		contents[endianflip ^ (target + 7)] = (insn >> 24) & 0xff;
+	      }
+	      break;
 
-            default:
-              abort ();
-            }
-        }
+	    default:
+	      abort ();
+	    }
+	}
     }
 
   if (arm_data->elf.this_hdr.sh_type == SHT_ARM_EXIDX)
     {
       arm_unwind_table_edit *edit_node
-        = arm_data->u.exidx.unwind_edit_list;
+	= arm_data->u.exidx.unwind_edit_list;
       /* Now, sec->size is the size of the section we will write.  The original
-         size (before we merged duplicate entries and inserted EXIDX_CANTUNWIND
+	 size (before we merged duplicate entries and inserted EXIDX_CANTUNWIND
 	 markers) was sec->rawsize.  (This isn't the case if we perform no
 	 edits, then rawsize will be zero and we should use size).  */
       bfd_byte *edited_contents = (bfd_byte *) bfd_malloc (sec->size);
@@ -15275,13 +15432,13 @@
       bfd_vma add_to_offsets = 0;
 
       for (in_index = 0, out_index = 0; in_index * 8 < input_size || edit_node;)
-        {
+	{
 	  if (edit_node)
 	    {
 	      unsigned int edit_index = edit_node->index;
 
 	      if (in_index < edit_index && in_index * 8 < input_size)
-	        {
+		{
 		  copy_exidx_entry (output_bfd, edited_contents + out_index * 8,
 				    contents + in_index * 8, add_to_offsets);
 		  out_index++;
@@ -15290,7 +15447,7 @@
 	      else if (in_index == edit_index
 		       || (in_index * 8 >= input_size
 			   && edit_index == UINT_MAX))
-	        {
+		{
 		  switch (edit_node->type)
 		    {
 		    case DELETE_EXIDX_ENTRY:
@@ -15300,12 +15457,12 @@
 
 		    case INSERT_EXIDX_CANTUNWIND_AT_END:
 		      {
-		        asection *text_sec = edit_node->linked_section;
+			asection *text_sec = edit_node->linked_section;
 			bfd_vma text_offset = text_sec->output_section->vma
 					      + text_sec->output_offset
 					      + text_sec->size;
 			bfd_vma exidx_offset = offset + out_index * 8;
-		        unsigned long prel31_offset;
+			unsigned long prel31_offset;
 
 			/* Note: this is meant to be equivalent to an
 			   R_ARM_PREL31 relocation.  These synthetic
@@ -15370,45 +15527,45 @@
 
       ptr = map[0].vma;
       for (i = 0; i < mapcount; i++)
-        {
-          if (i == mapcount - 1)
+	{
+	  if (i == mapcount - 1)
 	    end = sec->size;
-          else
-            end = map[i + 1].vma;
+	  else
+	    end = map[i + 1].vma;
 
-          switch (map[i].type)
+	  switch (map[i].type)
 	    {
 	    case 'a':
 	      /* Byte swap code words.  */
 	      while (ptr + 3 < end)
-	        {
-	          tmp = contents[ptr];
-	          contents[ptr] = contents[ptr + 3];
-	          contents[ptr + 3] = tmp;
-	          tmp = contents[ptr + 1];
-	          contents[ptr + 1] = contents[ptr + 2];
-	          contents[ptr + 2] = tmp;
-	          ptr += 4;
-	        }
+		{
+		  tmp = contents[ptr];
+		  contents[ptr] = contents[ptr + 3];
+		  contents[ptr + 3] = tmp;
+		  tmp = contents[ptr + 1];
+		  contents[ptr + 1] = contents[ptr + 2];
+		  contents[ptr + 2] = tmp;
+		  ptr += 4;
+		}
 	      break;
 
 	    case 't':
 	      /* Byte swap code halfwords.  */
 	      while (ptr + 1 < end)
-	        {
-	          tmp = contents[ptr];
-	          contents[ptr] = contents[ptr + 1];
-	          contents[ptr + 1] = tmp;
-	          ptr += 2;
-	        }
+		{
+		  tmp = contents[ptr];
+		  contents[ptr] = contents[ptr + 1];
+		  contents[ptr + 1] = tmp;
+		  ptr += 2;
+		}
 	      break;
 
 	    case 'd':
 	      /* Leave data alone.  */
 	      break;
 	    }
-          ptr = end;
-        }
+	  ptr = end;
+	}
     }
 
   free (map);
@@ -15477,17 +15634,17 @@
       if (ELF_ST_TYPE (src->st_info) != STT_GNU_IFUNC)
 	newsym.st_info = ELF_ST_INFO (ELF_ST_BIND (src->st_info), STT_FUNC);
       if (newsym.st_shndx != SHN_UNDEF)
-        {
-          /* Do this only for defined symbols. At link type, the static
-             linker will simulate the work of dynamic linker of resolving
-             symbols and will carry over the thumbness of found symbols to
-             the output symbol table. It's not clear how it happens, but
-             the thumbness of undefined symbols can well be different at
-             runtime, and writing '1' for them will be confusing for users
-             and possibly for dynamic linker itself.
-          */
-          newsym.st_value |= 1;
-        }
+	{
+	  /* Do this only for defined symbols. At link type, the static
+	     linker will simulate the work of dynamic linker of resolving
+	     symbols and will carry over the thumbness of found symbols to
+	     the output symbol table. It's not clear how it happens, but
+	     the thumbness of undefined symbols can well be different at
+	     runtime, and writing '1' for them will be confusing for users
+	     and possibly for dynamic linker itself.
+	  */
+	  newsym.st_value |= 1;
+	}
 
       src = &newsym;
     }
@@ -15509,21 +15666,21 @@
       /* If there is already a PT_ARM_EXIDX header, then we do not
 	 want to add another one.  This situation arises when running
 	 "strip"; the input binary already has the header.  */
-      m = elf_tdata (abfd)->segment_map;
+      m = elf_seg_map (abfd);
       while (m && m->p_type != PT_ARM_EXIDX)
 	m = m->next;
       if (!m)
 	{
 	  m = (struct elf_segment_map *)
-              bfd_zalloc (abfd, sizeof (struct elf_segment_map));
+	      bfd_zalloc (abfd, sizeof (struct elf_segment_map));
 	  if (m == NULL)
 	    return FALSE;
 	  m->p_type = PT_ARM_EXIDX;
 	  m->count = 1;
 	  m->sections[0] = sec;
 
-	  m->next = elf_tdata (abfd)->segment_map;
-	  elf_tdata (abfd)->segment_map = m;
+	  m->next = elf_seg_map (abfd);
+	  elf_seg_map (abfd) = m;
 	}
     }
 
@@ -15720,6 +15877,14 @@
 	  && nacl_modify_segment_map (abfd, info));
 }
 
+static void
+elf32_arm_nacl_final_write_processing (bfd *abfd, bfd_boolean linker)
+{
+  elf32_arm_final_write_processing (abfd, linker);
+  nacl_final_write_processing (abfd, linker);
+}
+
+
 #undef	elf32_bed
 #define elf32_bed			elf32_arm_nacl_bed
 #undef  bfd_elf32_bfd_link_hash_table_create
@@ -15731,9 +15896,14 @@
 #define	elf_backend_modify_segment_map		elf32_arm_nacl_modify_segment_map
 #undef	elf_backend_modify_program_headers
 #define	elf_backend_modify_program_headers	nacl_modify_program_headers
+#undef  elf_backend_final_write_processing
+#define elf_backend_final_write_processing	elf32_arm_nacl_final_write_processing
 
 #undef	ELF_MAXPAGESIZE
 #define ELF_MAXPAGESIZE			0x10000
+#undef	ELF_MINPAGESIZE
+#undef	ELF_COMMONPAGESIZE
+
 
 #include "elf32-target.h"
 
@@ -15742,6 +15912,13 @@
 #undef	elf_backend_modify_segment_map
 #define elf_backend_modify_segment_map		elf32_arm_modify_segment_map
 #undef	elf_backend_modify_program_headers
+#undef  elf_backend_final_write_processing
+#define elf_backend_final_write_processing	elf32_arm_final_write_processing
+#undef	ELF_MINPAGESIZE
+#define ELF_MINPAGESIZE			0x1000
+#undef	ELF_COMMONPAGESIZE
+#define ELF_COMMONPAGESIZE		0x1000
+
 
 /* VxWorks Targets.  */
 
@@ -15852,8 +16029,8 @@
 	 flags then do not bother setting the flags for the output
 	 architecture, instead allow future merges to do this.  If no
 	 future merges ever set these flags then they will retain their
-         uninitialised values, which surprise surprise, correspond
-         to the default values.  */
+	 uninitialised values, which surprise surprise, correspond
+	 to the default values.  */
       if (bfd_get_arch_info (ibfd)->the_default
 	  && elf_elfheader (ibfd)->e_flags == 0)
 	return TRUE;
@@ -15901,7 +16078,7 @@
 	      if ((bfd_get_section_flags (ibfd, sec)
 		   & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
 		  == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
-	    	only_data_sections = FALSE;
+		only_data_sections = FALSE;
 
 	      null_input_bfd = FALSE;
 	      break;
@@ -16116,15 +16293,15 @@
   dynsec = bfd_get_section_by_name (abfd, ".dynamic");
   if (dynsec)
     {
-      for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+      for (m = elf_seg_map (abfd); m != NULL; m = m->next)
 	if (m->p_type == PT_DYNAMIC)
 	  break;
 
       if (m == NULL)
 	{
 	  m = _bfd_elf_make_dynamic_segment (abfd, dynsec);
-	  m->next = elf_tdata (abfd)->segment_map;
-	  elf_tdata (abfd)->segment_map = m;
+	  m->next = elf_seg_map (abfd);
+	  elf_seg_map (abfd) = m;
 	}
     }
 
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 38e41df..b54b67f 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -1,7 +1,5 @@
 /* AVR-specific support for 32-bit ELF
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 1999-2013 Free Software Foundation, Inc.
    Contributed by Denis Chertykov <denisc@overta.ru>
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -672,7 +670,7 @@
   struct elf32_avr_link_hash_table *htab;
   bfd_size_type amt = sizeof (*htab);
 
-  htab = bfd_malloc (amt);
+  htab = bfd_zmalloc (amt);
   if (htab == NULL)
     return NULL;
 
@@ -690,15 +688,6 @@
                             sizeof (struct elf32_avr_stub_hash_entry)))
     return NULL;
 
-  htab->stub_bfd = NULL;
-  htab->stub_sec = NULL;
-
-  /* Initialize the address mapping table.  */
-  htab->amt_stub_offsets = NULL;
-  htab->amt_destination_addr = NULL;
-  htab->amt_entry_cnt = 0;
-  htab->amt_max_entry_cnt = 0;
-
   return &htab->etab.root;
 }
 
@@ -717,7 +706,7 @@
     free (htab->amt_destination_addr);
 
   bfd_hash_table_free (&htab->bstab);
-  _bfd_generic_link_hash_table_free (btab);
+  _bfd_elf_link_hash_table_free (btab);
 }
 
 /* Calculates the effective distance of a pc relative jump/call.  */
@@ -1225,12 +1214,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
@@ -1558,7 +1547,7 @@
        irel = elf_section_data (isec)->relocs;
        /* PR 12161: Read in the relocs for this section if necessary.  */
        if (irel == NULL)
-	 irel = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, FALSE);
+         irel = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, TRUE);
 
        for (irelend = irel + isec->reloc_count;
             irel < irelend;
@@ -1617,9 +1606,6 @@
 	   /* else...Reference symbol is extern.  No need for adjusting
 	      the addend.  */
 	 }
-
-       if (elf_section_data (isec)->relocs == NULL)
-	 free (irelend - isec->reloc_count);
      }
   }
 
@@ -1706,8 +1692,8 @@
   struct elf32_avr_link_hash_table *htab;
 
   /* If 'shrinkable' is FALSE, do not shrink by deleting bytes while
-     relaxing. Such shrinking can cause issues for the sections such 
-     as .vectors and .jumptables. Instead the unused bytes should be 
+     relaxing. Such shrinking can cause issues for the sections such
+     as .vectors and .jumptables. Instead the unused bytes should be
      filled with nop instructions. */
   bfd_boolean shrinkable = TRUE;
 
@@ -1878,7 +1864,7 @@
               distance_short_enough = 1;
             /* If shrinkable, then we can check for a range of distance which
                is two bytes farther on both the directions because the call
-               or jump target will be closer by two bytes after the 
+               or jump target will be closer by two bytes after the
                relaxation. */
             else if (shrinkable && ((int) gap >= -4094 && (int) gap <= 4097))
               distance_short_enough = 1;
@@ -1955,7 +1941,7 @@
                                              R_AVR_13_PCREL);
 
                 /* We should not modify the ordering if 'shrinkable' is
-                   FALSE. */ 
+                   FALSE. */
                 if (!shrinkable)
                   {
                     /* Let's insert a nop.  */
@@ -2150,6 +2136,7 @@
 			  irel->r_offset + insn_size;
                         Elf_Internal_Sym *isym, *isymend;
                         unsigned int sec_shndx;
+			struct bfd_section *isec;
 
                         sec_shndx =
 			  _bfd_elf_section_from_bfd_section (abfd, sec);
@@ -2200,80 +2187,85 @@
 				}
 			    }
 			}
+
 			/* Now we check for relocations pointing to ret.  */
-			{
-			  Elf_Internal_Rela *rel;
-			  Elf_Internal_Rela *relend;
+			for (isec = abfd->sections; isec && deleting_ret_is_safe; isec = isec->next)
+			  {
+			    Elf_Internal_Rela *rel;
+			    Elf_Internal_Rela *relend;
+              
+			    rel = elf_section_data (isec)->relocs;
+			    if (rel == NULL)
+			      rel = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, TRUE);
 
-			  relend = elf_section_data (sec)->relocs
-			    + sec->reloc_count;
+			    relend = rel + isec->reloc_count;
 
-			  for (rel = elf_section_data (sec)->relocs;
-			       rel < relend; rel++)
-			    {
-			      bfd_vma reloc_target = 0;
+			    for (; rel && rel < relend; rel++)
+			      {
+				bfd_vma reloc_target = 0;
 
-			      /* Read this BFD's local symbols if we haven't
-				 done so already.  */
-			      if (isymbuf == NULL && symtab_hdr->sh_info != 0)
-				{
-				  isymbuf = (Elf_Internal_Sym *)
-				    symtab_hdr->contents;
-				  if (isymbuf == NULL)
-				    isymbuf = bfd_elf_get_elf_syms
-				      (abfd,
-				       symtab_hdr,
-				       symtab_hdr->sh_info, 0,
-				       NULL, NULL, NULL);
-				  if (isymbuf == NULL)
+				/* Read this BFD's local symbols if we haven't
+				   done so already.  */
+				if (isymbuf == NULL && symtab_hdr->sh_info != 0)
+				  {
+				    isymbuf = (Elf_Internal_Sym *)
+				      symtab_hdr->contents;
+				    if (isymbuf == NULL)
+				      isymbuf = bfd_elf_get_elf_syms
+					(abfd,
+					 symtab_hdr,
+					 symtab_hdr->sh_info, 0,
+					 NULL, NULL, NULL);
+				    if (isymbuf == NULL)
+				      break;
+				  }
+
+				/* Get the value of the symbol referred to
+				   by the reloc.  */
+				if (ELF32_R_SYM (rel->r_info)
+				    < symtab_hdr->sh_info)
+				  {
+				    /* A local symbol.  */
+				    asection *sym_sec;
+
+				    isym = isymbuf
+				      + ELF32_R_SYM (rel->r_info);
+				    sym_sec = bfd_section_from_elf_index
+				      (abfd, isym->st_shndx);
+				    symval = isym->st_value;
+
+				    /* If the reloc is absolute, it will not
+				       have a symbol or section associated
+				       with it.  */
+
+				    if (sym_sec)
+				      {
+					symval +=
+					  sym_sec->output_section->vma
+					  + sym_sec->output_offset;
+					reloc_target = symval + rel->r_addend;
+				      }
+				    else
+				      {
+					reloc_target = symval + rel->r_addend;
+					/* Reference symbol is absolute.  */
+				      }
+				  }
+				/* else ... reference symbol is extern.  */
+
+				if (address_of_ret == reloc_target)
+				  {
+				    deleting_ret_is_safe = 0;
+				    if (debug_relax)
+				      printf ("ret from "
+					      "rjmp/jmp ret sequence at address"
+					      " 0x%x could not be deleted. ret"
+					      " is target of a relocation.\n",
+					      (int) address_of_ret);
 				    break;
-				}
-
-			      /* Get the value of the symbol referred to
-				 by the reloc.  */
-			      if (ELF32_R_SYM (rel->r_info)
-				  < symtab_hdr->sh_info)
-				{
-				  /* A local symbol.  */
-				  asection *sym_sec;
-
-				  isym = isymbuf
-				    + ELF32_R_SYM (rel->r_info);
-				  sym_sec = bfd_section_from_elf_index
-				    (abfd, isym->st_shndx);
-				  symval = isym->st_value;
-
-				  /* If the reloc is absolute, it will not
-				     have a symbol or section associated
-				     with it.  */
-
-				  if (sym_sec)
-				    {
-				      symval +=
-					sym_sec->output_section->vma
-					+ sym_sec->output_offset;
-				      reloc_target = symval + rel->r_addend;
-				    }
-				  else
-				    {
-				      reloc_target = symval + rel->r_addend;
-				      /* Reference symbol is absolute.  */
-				    }
-				}
-			      /* else ... reference symbol is extern.  */
-
-			      if (address_of_ret == reloc_target)
-				{
-				  deleting_ret_is_safe = 0;
-				  if (debug_relax)
-				    printf ("ret from "
-					    "rjmp/jmp ret sequence at address"
-					    " 0x%x could not be deleted. ret"
-					    " is target of a relocation.\n",
-					    (int) address_of_ret);
-				}
-			    }
-			}
+				  }
+			      }
+			  }
 
 			if (deleting_ret_is_safe)
 			  {
@@ -2294,7 +2286,6 @@
 			    break;
 			  }
                       }
-
                   }
               }
             break;
diff --git a/bfd/elf32-avr.h b/bfd/elf32-avr.h
index 5ca1fdf..5eeca86 100644
--- a/bfd/elf32-avr.h
+++ b/bfd/elf32-avr.h
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, 
+   Foundation, Inc., 51 Franklin Street - Fifth Floor,
    Boston, MA 02110-1301, USA.  */
 
 
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 6173433..73d0d09 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1187,7 +1187,13 @@
       if (r_symndx < symtab_hdr->sh_info)
 	h = NULL;
       else
-	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	{
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
+	}
 
       switch (ELF32_R_TYPE (rel->r_info))
 	{
@@ -1301,7 +1307,9 @@
 }
 
 static enum elf_reloc_type_class
-elf32_bfin_reloc_type_class (const Elf_Internal_Rela * rela)
+elf32_bfin_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			     const asection *rel_sec ATTRIBUTE_UNUSED,
+			     const Elf_Internal_Rela * rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -1436,12 +1444,12 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -1821,7 +1829,7 @@
   struct bfinfdpic_elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct bfinfdpic_elf_link_hash_table);
 
-  ret = bfd_zalloc (abfd, amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -2654,13 +2662,13 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  osec = sec;
 	}
 
@@ -4311,35 +4319,10 @@
 elf32_bfinfdpic_always_size_sections (bfd *output_bfd,
 				     struct bfd_link_info *info)
 {
-  if (!info->relocatable)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Force a PT_GNU_STACK segment to be created.  */
-      if (! elf_tdata (output_bfd)->stack_flags)
-	elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
-
-      /* Define __stacksize if it's not defined yet.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (! h || h->root.type != bfd_link_hash_defined
-	  || h->type != STT_OBJECT
-	  || !h->def_regular)
-	{
-	  struct bfd_link_hash_entry *bh = NULL;
-
-	  if (!(_bfd_generic_link_add_one_symbol
-		(info, output_bfd, "__stacksize",
-		 BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
-		 (const char *) NULL, FALSE,
-		 get_elf_backend_data (output_bfd)->collect, &bh)))
-	    return FALSE;
-
-	  h = (struct elf_link_hash_entry *) bh;
-	  h->def_regular = 1;
-	  h->type = STT_OBJECT;
-	}
-    }
+  if (!info->relocatable
+      && !bfd_elf_stack_segment_size (output_bfd, info,
+				      "__stacksize", DEFAULT_STACK_SIZE))
+    return FALSE;
 
   return TRUE;
 }
@@ -4460,51 +4443,6 @@
 }
 
 static bfd_boolean
-elf32_bfinfdpic_modify_program_headers (bfd *output_bfd,
-					struct bfd_link_info *info)
-{
-  struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
-  struct elf_segment_map *m;
-  Elf_Internal_Phdr *p;
-
-  /* objcopy and strip preserve what's already there using
-     elf32_bfinfdpic_copy_private_bfd_data ().  */
-  if (! info)
-    return TRUE;
-
-  for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
-    if (m->p_type == PT_GNU_STACK)
-      break;
-
-  if (m)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Obtain the pointer to the __stacksize symbol.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (h)
-	{
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  BFD_ASSERT (h->root.type == bfd_link_hash_defined);
-	}
-
-      /* Set the header p_memsz from the symbol value.  We
-	 intentionally ignore the symbol section.  */
-      if (h && h->root.type == bfd_link_hash_defined)
-	p->p_memsz = h->root.u.def.value;
-      else
-	p->p_memsz = DEFAULT_STACK_SIZE;
-
-      p->p_align = 8;
-    }
-
-  return TRUE;
-}
-
-static bfd_boolean
 elf32_bfinfdpic_finish_dynamic_sections (bfd *output_bfd,
 					struct bfd_link_info *info)
 {
@@ -5017,8 +4955,6 @@
 static bfd_boolean
 elf32_bfinfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
 {
-  unsigned i;
-
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
     return TRUE;
@@ -5030,31 +4966,6 @@
       || ! elf_tdata (obfd) || ! elf_tdata (obfd)->phdr)
     return TRUE;
 
-  /* Copy the stack size.  */
-  for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++)
-    if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK)
-      {
-	Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i];
-
-	for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++)
-	  if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK)
-	    {
-	      memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr));
-
-	      /* Rewrite the phdrs, since we're only called after they
-		 were first written.  */
-	      if (bfd_seek (obfd, (bfd_signed_vma) get_elf_backend_data (obfd)
-			    ->s->sizeof_ehdr, SEEK_SET) != 0
-		  || get_elf_backend_data (obfd)->s
-		  ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr,
-				     elf_elfheader (obfd)->e_phnum) != 0)
-		return FALSE;
-	      break;
-	    }
-
-	break;
-      }
-
   return TRUE;
 }
 
@@ -5185,7 +5096,7 @@
   struct bfin_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct bfin_link_hash_table);
 
-  ret = bfd_zalloc (abfd, amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -5802,6 +5713,7 @@
 #define elf_backend_final_write_processing \
                                         elf32_bfin_final_write_processing
 #define elf_backend_reloc_type_class    elf32_bfin_reloc_type_class
+#define elf_backend_stack_align		8
 #define elf_backend_can_gc_sections 1
 #define elf_backend_special_sections	elf32_bfin_special_sections
 #define elf_backend_can_refcount 1
@@ -5837,9 +5749,6 @@
 #undef elf_backend_always_size_sections
 #define elf_backend_always_size_sections \
 		elf32_bfinfdpic_always_size_sections
-#undef elf_backend_modify_program_headers
-#define elf_backend_modify_program_headers \
-		elf32_bfinfdpic_modify_program_headers
 #undef bfd_elf32_bfd_copy_private_bfd_data
 #define bfd_elf32_bfd_copy_private_bfd_data \
 		elf32_bfinfdpic_copy_private_bfd_data
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index 97fa569..af1cf7b 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -725,6 +725,10 @@
           while (h->root.type == bfd_link_hash_indirect
                  || h->root.type == bfd_link_hash_warning)
             h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
         }
 
       /* Some relocs require a global offset table.  */
@@ -761,7 +765,7 @@
             {
               srelgot = bfd_get_linker_section (dynobj, ".rela.got");
               if (srelgot == NULL)
-                { 
+                {
 		  flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
 				    | SEC_IN_MEMORY | SEC_LINKER_CREATED
 				    | SEC_READONLY);
@@ -912,7 +916,7 @@
        /* We only care about the addend, where the difference between
           expressions is kept.  */
        Rvalue = 0;
-       
+
      default:
        break;
     }
@@ -1043,7 +1047,7 @@
                         | ((Rvalue >> 16) & 0xf)), hit_data);
             bfd_put_16 (input_bfd, (Rvalue) & 0xffff, hit_data + 2);
           }
-        else if (r_type == R_CR16_GOT_REGREL20) 
+        else if (r_type == R_CR16_GOT_REGREL20)
           {
             asection * sgot = bfd_get_linker_section (dynobj, ".got");
 
@@ -1060,7 +1064,7 @@
                        -Bsymbolic link and the symbol is defined
                        locally, or the symbol was forced to be local
                        because of a version file.  We must initialize
-                       this entry in the global offset table. 
+                       this entry in the global offset table.
                        When doing a dynamic link, we create a .rela.got
                        relocation entry to initialize the value.  This
                        is done in the finish_dynamic_symbol routine.  */
@@ -1080,7 +1084,7 @@
 
              Rvalue += addend;
 
-             /* REVISIT: if ((long) Rvalue > 0xffffff || 
+             /* REVISIT: if ((long) Rvalue > 0xffffff ||
                                     (long) Rvalue < -0x800000).  */
              if ((long) Rvalue > 0xffffff || (long) Rvalue < 0)
                return bfd_reloc_overflow;
@@ -1111,7 +1115,7 @@
                     -Bsymbolic link and the symbol is defined
                      locally, or the symbol was forced to be local
                      because of a version file.  We must initialize
-                     this entry in the global offset table. 
+                     this entry in the global offset table.
                      When doing a dynamic link, we create a .rela.got
                      relocation entry to initialize the value.  This
                      is done in the finish_dynamic_symbol routine.  */
@@ -1142,7 +1146,7 @@
                Rvalue += Rvalue1;
 
               /* Check for range.  */
-             /* REVISIT: if ((long) Rvalue > 0xffffff 
+             /* REVISIT: if ((long) Rvalue > 0xffffff
                              || (long) Rvalue < -0x800000).  */
              if ((long) Rvalue > 0xffffff || (long) Rvalue < 0)
                return bfd_reloc_overflow;
@@ -1224,7 +1228,7 @@
               }
             else if (r_type == R_CR16_NUM32)
               {
-                 Rvalue1 = (bfd_get_32 (input_bfd, hit_data)); 
+                 Rvalue1 = (bfd_get_32 (input_bfd, hit_data));
 
                  /* Add or subtract the offset value */
                  if (Rvalue1 & 0x80000000)
@@ -1309,7 +1313,7 @@
                   && ELF32_R_TYPE (irel->r_info) != (int) R_CR16_SWITCH16
                   && ELF32_R_TYPE (irel->r_info) != (int) R_CR16_SWITCH32)
                  continue;
-        
+
               r_symndx = ELF32_R_SYM (irel->r_info);
               rsym = (Elf_Internal_Sym *) symtab_hdr->contents + r_symndx;
 
@@ -1421,12 +1425,12 @@
         }
       else
         {
-          bfd_boolean unresolved_reloc, warned;
+          bfd_boolean unresolved_reloc, warned, ignored;
 
           RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
                                    r_symndx, symtab_hdr, sym_hashes,
                                    h, sec, relocation,
-                                   unresolved_reloc, warned);
+                                   unresolved_reloc, warned, ignored);
         }
 
       if (sec != NULL && discarded_section (sec))
@@ -1660,7 +1664,7 @@
   struct elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_link_hash_table);
 
-  ret = (struct elf_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf_link_hash_table *) bfd_zmalloc (amt);
   if (ret == (struct elf_link_hash_table *) NULL)
     return NULL;
 
@@ -1676,18 +1680,6 @@
   return &ret->root;
 }
 
-/* Free an cr16 ELF linker hash table.  */
-
-static void
-elf32_cr16_link_hash_table_free (struct bfd_link_hash_table *hash)
-{
-  struct elf_link_hash_table *ret
-    = (struct elf_link_hash_table *) hash;
-
-  _bfd_generic_link_hash_table_free
-    ((struct bfd_link_hash_table *) ret);
-}
-
 static unsigned long
 elf_cr16_mach (flagword flags)
 {
@@ -1981,7 +1973,7 @@
           bfd_vma value = symval;
           unsigned short is_add_mov = 0;
           bfd_vma value1 = 0;
-          
+
           /* Get the existing value from the mcode */
           value1 = ((bfd_get_32 (abfd, contents + irel->r_offset + 2) >> 16)
                    |(((bfd_get_32 (abfd, contents + irel->r_offset + 2) & 0xffff) << 16)));
@@ -1996,7 +1988,7 @@
 
               /* Verify it's a 'arithmetic ADDD or MOVD instruction'.
                  For ADDD and MOVD only, convert to IMM32 -> IMM20.  */
-     
+
               if (((code & 0xfff0) == 0x0070) || ((code & 0xfff0) == 0x0020))
                  is_add_mov = 1;
 
@@ -2016,7 +2008,7 @@
 
                   bfd_put_8 (abfd, (code & 0xf) << 4, contents + irel->r_offset);
 
-                  /* If existing value is nagavive adjust approriately 
+                  /* If existing value is nagavive adjust approriately
                      place the 16-20bits (ie 4 bit) in new opcode,
                      as the 0xffffxxxx, the higher 2 byte values removed. */
                   if (value1 & 0x80000000)
@@ -2040,7 +2032,7 @@
             }
 
           /* See if the value will fit in 16 bits.  */
-          if ((!is_add_mov) 
+          if ((!is_add_mov)
               && ((long)(value + value1) < 0x7fff && (long)(value + value1) > 0))
             {
               unsigned short code;
@@ -2065,7 +2057,7 @@
 
               bfd_put_8 (abfd, 0xb0 | (code & 0xf), contents + irel->r_offset);
 
-              /* If existing value is nagavive adjust approriately 
+              /* If existing value is nagavive adjust approriately
                  place the 12-16bits (ie 4 bit) in new opcode,
                  as the 0xfffffxxx, the higher 2 byte values removed. */
               if (value1 & 0x80000000)
@@ -2092,7 +2084,7 @@
 #if 0
       /* Try to turn a 16bit immediate address into a 4bit
          immediate address.  */
-      if ((ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM20) 
+      if ((ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM20)
           || (ELF32_R_TYPE (irel->r_info) == (int) R_CR16_IMM16))
         {
           bfd_vma value = symval;
@@ -2200,7 +2192,7 @@
       else
        /* Cache the section contents for elf_link_input_bfd.  */
        elf_section_data (sec)->this_hdr.contents = contents;
-       
+
     }
 
   if (internal_relocs != NULL
@@ -2698,7 +2690,7 @@
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == elf_hash_table (info)->hdynamic
       || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
 
@@ -2928,7 +2920,9 @@
    properly.  */
 
 static enum elf_reloc_type_class
-_bfd_cr16_elf_reloc_type_class (const Elf_Internal_Rela *rela)
+_bfd_cr16_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+				const asection *rel_sec ATTRIBUTE_UNUSED,
+				const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -2973,8 +2967,6 @@
 
 #define bfd_elf32_bfd_link_hash_table_create \
                                   elf32_cr16_link_hash_table_create
-#define bfd_elf32_bfd_link_hash_table_free \
-                                  elf32_cr16_link_hash_table_free
 
 #define elf_backend_create_dynamic_sections \
                                   _bfd_cr16_elf_create_dynamic_sections
diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c
index ea22701..27d8f80 100644
--- a/bfd/elf32-cr16c.c
+++ b/bfd/elf32-cr16c.c
@@ -29,14 +29,14 @@
 
 #define USE_REL	1	/* CR16C uses REL relocations instead of RELA.  */
 
-/* The following definition is based on EMPTY_HOWTO macro, 
+/* The following definition is based on EMPTY_HOWTO macro,
    but also initiates the "name" field in HOWTO struct.  */
 #define ONLY_NAME_HOWTO(C) \
   HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
 	  STRINGX(C), FALSE, 0, 0, FALSE)
 
 /* reloc_map_index array maps CRASM relocation type into a BFD
-   relocation enum. The array's indices are synchronized with 
+   relocation enum. The array's indices are synchronized with
    RINDEX_16C_* indices, created in include/elf/cr16c.h.
    The array is used in:
    1. elf32-cr16c.c : elf_cr16c_reloc_type_lookup().
@@ -715,12 +715,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index c9316ee..ab79151 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -511,10 +511,10 @@
 
       case 202:		/* Linux/CRISv32 */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 22);
 
 	/* pr_reg */
 	offset = 70;
@@ -530,10 +530,10 @@
 
       case 214:		/* Linux/CRIS */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 22);
 
 	/* pr_reg */
 	offset = 70;
@@ -557,9 +557,9 @@
 	return FALSE;
 
       case 124:		/* Linux/CRISv32 elf_prpsinfo */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
       }
   else
@@ -569,9 +569,9 @@
 	return FALSE;
 
       case 124:		/* Linux/CRIS elf_prpsinfo */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
       }
 
@@ -580,7 +580,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -884,7 +884,7 @@
   struct elf_cris_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_cris_link_hash_table);
 
-  ret = ((struct elf_cris_link_hash_table *) bfd_malloc (amt));
+  ret = ((struct elf_cris_link_hash_table *) bfd_zmalloc (amt));
   if (ret == (struct elf_cris_link_hash_table *) NULL)
     return NULL;
 
@@ -901,9 +901,6 @@
      are used for run-time symbol evaluation.  */
   ret->next_gotplt_entry = 12;
 
-  /* We haven't seen any R_CRIS_nn_GOT_TPREL initially.  */
-  ret->dtpmod_refcount = 0;
-
   return &ret->root.root;
 }
 
@@ -1043,13 +1040,13 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  symname = h->root.root.string;
 
@@ -2288,7 +2285,7 @@
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == elf_hash_table (info)->hdynamic
       || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
 
@@ -2698,7 +2695,7 @@
     {
       bfd_size_type got_offset;
       bfd_byte gotoffs_raw[4];
-      
+
       if (!bfd_get_section_contents (abfd, (asection *) plt, gotoffs_raw,
 				     pltoffs + plt_entry_got_offset,
 				     sizeof (gotoffs_raw)))
@@ -3180,6 +3177,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       r_type = ELF32_R_TYPE (rel->r_info);
@@ -3235,15 +3236,20 @@
 		     abfd, sec);
 		  return FALSE;
 		}
-
-	      /* Create the .got section, so we can assume it's always
-		 present whenever there's a dynobj.  */
-	      if (!_bfd_elf_create_got_section (dynobj, info))
-		return FALSE;
 	    }
 
 	  if (sgot == NULL)
-	    sgot = bfd_get_linker_section (dynobj, ".got");
+	    {
+	      /* We may have a dynobj but no .got section, if machine-
+		 independent parts of the linker found a reason to create
+		 a dynobj.  We want to create the .got section now, so we
+		 can assume it's always present whenever there's a dynobj.
+		 It's ok to call this function more than once.  */
+	      if (!_bfd_elf_create_got_section (dynobj, info))
+		return FALSE;
+
+	      sgot = bfd_get_linker_section (dynobj, ".got");
+	    }
 
 	  if (local_got_refcounts == NULL)
 	    {
@@ -4244,7 +4250,9 @@
 }
 
 static enum elf_reloc_type_class
-elf_cris_reloc_type_class (const Elf_Internal_Rela *rela)
+elf_cris_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			   const asection *rel_sec ATTRIBUTE_UNUSED,
+			   const Elf_Internal_Rela *rela)
 {
   enum elf_cris_reloc_type r_type = ELF32_R_TYPE (rela->r_info);
   switch (r_type)
diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c
index 940f357..f26c01e 100644
--- a/bfd/elf32-crx.c
+++ b/bfd/elf32-crx.c
@@ -332,7 +332,7 @@
 	 0x0,  			/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
- 
+
   /* An 8 bit switch table entry.  This is generated for an expression
      such as ``.byte L1 - L2''.  The offset holds the difference
      between the reloc address and L2.  */
@@ -475,10 +475,10 @@
      case R_CRX_SWITCH8:
      case R_CRX_SWITCH16:
      case R_CRX_SWITCH32:
-       /* We only care about the addend, where the difference between 
+       /* We only care about the addend, where the difference between
 	  expressions is kept.  */
        Rvalue = 0;
-       
+
      default:
        break;
     }
@@ -585,7 +585,7 @@
 /* Delete some bytes from a section while relaxing.  */
 
 static bfd_boolean
-elf32_crx_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd, 
+elf32_crx_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd,
 			      asection *sec, bfd_vma addr, int count)
 {
   Elf_Internal_Shdr *symtab_hdr;
@@ -632,7 +632,7 @@
 	  && isym->st_value > addr
 	  && isym->st_value < toaddr)
 	{
-	  /* Adjust the addend of SWITCH relocations in this section, 
+	  /* Adjust the addend of SWITCH relocations in this section,
 	     which reference this local symbol.  */
 	  for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
 	    {
@@ -677,22 +677,22 @@
     {
       struct elf_link_hash_entry *sym_hash = *sym_hashes;
 
-      /* The '--wrap SYMBOL' option is causing a pain when the object file, 
-	 containing the definition of __wrap_SYMBOL, includes a direct 
-	 call to SYMBOL as well. Since both __wrap_SYMBOL and SYMBOL reference 
-	 the same symbol (which is __wrap_SYMBOL), but still exist as two 
-	 different symbols in 'sym_hashes', we don't want to adjust 
-	 the global symbol __wrap_SYMBOL twice.  
+      /* The '--wrap SYMBOL' option is causing a pain when the object file,
+	 containing the definition of __wrap_SYMBOL, includes a direct
+	 call to SYMBOL as well. Since both __wrap_SYMBOL and SYMBOL reference
+	 the same symbol (which is __wrap_SYMBOL), but still exist as two
+	 different symbols in 'sym_hashes', we don't want to adjust
+	 the global symbol __wrap_SYMBOL twice.
 	 This check is only relevant when symbols are being wrapped.  */
       if (link_info->wrap_hash != NULL)
 	{
 	  struct elf_link_hash_entry **cur_sym_hashes;
-	  
+
 	  /* Loop only over the symbols whom been already checked.  */
-	  for (cur_sym_hashes = start_hashes; cur_sym_hashes < sym_hashes; 
+	  for (cur_sym_hashes = start_hashes; cur_sym_hashes < sym_hashes;
 	       cur_sym_hashes++)
 	    {
-	      /* If the current symbol is identical to 'sym_hash', that means 
+	      /* If the current symbol is identical to 'sym_hash', that means
 		 the symbol was already adjusted (or at least checked).  */
 	      if (*cur_sym_hashes == sym_hash)
 		break;
@@ -865,12 +865,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c
index 246e5f5..7963bba 100644
--- a/bfd/elf32-d10v.c
+++ b/bfd/elf32-d10v.c
@@ -287,6 +287,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
@@ -455,12 +459,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c
index 29b8910..1379d3d 100644
--- a/bfd/elf32-dlx.c
+++ b/bfd/elf32-dlx.c
@@ -451,6 +451,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
diff --git a/bfd/elf32-epiphany.c b/bfd/elf32-epiphany.c
index b427ef3..f796a67 100644
--- a/bfd/elf32-epiphany.c
+++ b/bfd/elf32-epiphany.c
@@ -515,11 +515,12 @@
 	{
 	  bfd_boolean warned ATTRIBUTE_UNUSED;
 	  bfd_boolean unresolved_reloc ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index fe7cf92..a6ffda3 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -547,12 +547,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
@@ -671,6 +671,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 271ec02..cf187ac 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -952,7 +952,7 @@
   struct frvfdpic_elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct frvfdpic_elf_link_hash_table);
 
-  ret = bfd_zalloc (abfd, amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -2735,13 +2735,13 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  osec = sec;
 	  name = h->root.root.string;
 	}
@@ -3363,7 +3363,7 @@
 		   with ldi @(grB, #gottlsoff12(symbol+offset), grC.
 		   Preserve the packing bit.  */
 		insn = (insn & (unsigned long)0xfe03f000)
-		  | (unsigned long)0x00c80000;;
+		  | (unsigned long)0x00c80000;
 		bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
 
 		r_type = R_FRV_GOTTLSOFF12;
@@ -5494,36 +5494,10 @@
 elf32_frvfdpic_always_size_sections (bfd *output_bfd,
 				     struct bfd_link_info *info)
 {
-  if (!info->relocatable)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Force a PT_GNU_STACK segment to be created.  */
-      if (! elf_tdata (output_bfd)->stack_flags)
-	elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
-
-      /* Define __stacksize if it's not defined yet.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (! h || h->root.type != bfd_link_hash_defined
-	  || h->type != STT_OBJECT
-	  || !h->def_regular)
-	{
-	  struct bfd_link_hash_entry *bh = NULL;
-
-	  if (!(_bfd_generic_link_add_one_symbol
-		(info, output_bfd, "__stacksize",
-		 BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
-		 (const char *) NULL, FALSE,
-		 get_elf_backend_data (output_bfd)->collect, &bh)))
-	    return FALSE;
-
-	  h = (struct elf_link_hash_entry *) bh;
-	  h->def_regular = 1;
-	  h->type = STT_OBJECT;
-	  /* This one must NOT be hidden.  */
-	}
-    }
+  if (!info->relocatable
+      && !bfd_elf_stack_segment_size (output_bfd, info,
+				      "__stacksize", DEFAULT_STACK_SIZE))
+    return FALSE;
 
   return TRUE;
 }
@@ -5533,7 +5507,7 @@
 static bfd_boolean
 _frvfdpic_check_discarded_relocs (bfd *abfd, asection *sec,
 				  struct bfd_link_info *info,
-				  
+
 				  bfd_boolean *changed)
 {
   Elf_Internal_Shdr *symtab_hdr;
@@ -5720,51 +5694,6 @@
   return TRUE;
 }
 
-static bfd_boolean
-elf32_frvfdpic_modify_program_headers (bfd *output_bfd,
-				       struct bfd_link_info *info)
-{
-  struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
-  struct elf_segment_map *m;
-  Elf_Internal_Phdr *p;
-
-  /* objcopy and strip preserve what's already there using
-     elf32_frvfdpic_copy_private_bfd_data ().  */
-  if (! info)
-    return TRUE;
-
-  for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
-    if (m->p_type == PT_GNU_STACK)
-      break;
-
-  if (m)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Obtain the pointer to the __stacksize symbol.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (h)
-	{
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  BFD_ASSERT (h->root.type == bfd_link_hash_defined);
-	}
-
-      /* Set the header p_memsz from the symbol value.  We
-	 intentionally ignore the symbol section.  */
-      if (h && h->root.type == bfd_link_hash_defined)
-	p->p_memsz = h->root.u.def.value;
-      else
-	p->p_memsz = DEFAULT_STACK_SIZE;
-
-      p->p_align = 8;
-    }
-
-  return TRUE;
-}
-
 /* Fill in code and data in dynamic sections.  */
 
 static bfd_boolean
@@ -6117,6 +6046,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
@@ -6431,8 +6364,6 @@
 static bfd_boolean
 elf32_frvfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
 {
-  unsigned i;
-
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
     return TRUE;
@@ -6444,31 +6375,6 @@
       || ! elf_tdata (obfd) || ! elf_tdata (obfd)->phdr)
     return TRUE;
 
-  /* Copy the stack size.  */
-  for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++)
-    if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK)
-      {
-	Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i];
-
-	for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++)
-	  if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK)
-	    {
-	      memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr));
-
-	      /* Rewrite the phdrs, since we're only called after they
-		 were first written.  */
-	      if (bfd_seek (obfd, (bfd_signed_vma) get_elf_backend_data (obfd)
-			    ->s->sizeof_ehdr, SEEK_SET) != 0
-		  || get_elf_backend_data (obfd)->s
-		  ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr,
-				     elf_elfheader (obfd)->e_phnum) != 0)
-		return FALSE;
-	      break;
-	    }
-
-	break;
-      }
-
   return TRUE;
 }
 
@@ -6842,12 +6748,12 @@
          hardcoded offsets and sizes listed below (and contained within
 	 this lexical block) refer to fields in the target's elf_prstatus
 	 struct.  */
-      case 268:	
+      case 268:
 	/* `pr_cursig' is at offset 12.  */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* `pr_pid' is at offset 24.  */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	/* `pr_reg' is at offset 72.  */
 	offset = 72;
@@ -6858,7 +6764,7 @@
 	   and `pr_interp_fdpic_loadmap', both of which (by design)
 	   immediately follow `pr_reg'.  This will allow these fields to
 	   be viewed by GDB as registers.
-	   
+
 	   `pr_reg' is 184 bytes long.  `pr_exec_fdpic_loadmap' and
 	   `pr_interp_fdpic_loadmap' are 4 bytes each.  */
 	raw_size = 184 + 4 + 4;
@@ -6883,11 +6789,11 @@
       case 124:
 
 	/* `pr_fname' is found at offset 28 and is 16 bytes long.  */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
 
 	/* `pr_psargs' is found at offset 44 and is 80 bytes long.  */
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
     }
 
@@ -6896,7 +6802,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -6920,6 +6826,7 @@
 #define elf_backend_object_p			elf32_frv_object_p
 #define elf_backend_add_symbol_hook             elf32_frv_add_symbol_hook
 
+#define elf_backend_stack_align			8
 #define elf_backend_can_gc_sections		1
 #define elf_backend_rela_normal			1
 
@@ -6964,9 +6871,6 @@
 #undef elf_backend_always_size_sections
 #define elf_backend_always_size_sections \
 		elf32_frvfdpic_always_size_sections
-#undef elf_backend_modify_program_headers
-#define elf_backend_modify_program_headers \
-		elf32_frvfdpic_modify_program_headers
 #undef bfd_elf32_bfd_copy_private_bfd_data
 #define bfd_elf32_bfd_copy_private_bfd_data \
 		elf32_frvfdpic_copy_private_bfd_data
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 388d220..822d985 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -1,6 +1,5 @@
 /* BFD back-end for Renesas H8/300 ELF binaries.
-   Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006,
-   2007, 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+   Copyright 1993-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -185,7 +184,21 @@
 	 0,			/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
-#define R_H8_PCREL16_X (R_H8_DIR32A16_X + 1)
+#define R_H8_DISP32A16_X (R_H8_DIR32A16_X + 1)
+  HOWTO (R_H8_DISP32A16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 special,		/* special_function */
+	 "R_H8_DISP32A16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+#define R_H8_PCREL16_X (R_H8_DISP32A16_X + 1)
   HOWTO (R_H8_PCREL16,		/* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -234,6 +247,7 @@
   { BFD_RELOC_H8_DIR24A8, R_H8_DIR24A8_X },
   { BFD_RELOC_H8_DIR24R8, R_H8_DIR24R8_X },
   { BFD_RELOC_H8_DIR32A16, R_H8_DIR32A16_X },
+  { BFD_RELOC_H8_DISP32A16, R_H8_DISP32A16_X },
   { BFD_RELOC_16_PCREL, R_H8_PCREL16_X },
   { BFD_RELOC_8_PCREL, R_H8_PCREL8_X },
 };
@@ -338,6 +352,7 @@
 
     case R_H8_DIR32:
     case R_H8_DIR32A16:
+    case R_H8_DISP32A16:
     case R_H8_DIR24A8:
       value += addend;
       bfd_put_32 (input_bfd, value, hit_data);
@@ -453,12 +468,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -670,7 +685,9 @@
      bset:24/32	     ->    bset:16                2 bytes
      (also applicable to other bit manipulation instructions)
 
-     mov.[bwl]:24/32 ->    mov.[bwl]:16           2 bytes */
+     mov.[bwl]:24/32 ->    mov.[bwl]:16           2 bytes
+
+     mov.[bwl] @(displ:24/32+ERx) -> mov.[bwl] @(displ:16+ERx)  4 bytes.  */
 
 static bfd_boolean
 elf32_h8_relax_section (bfd *abfd, asection *sec,
@@ -725,13 +742,19 @@
 	 some long jumps created by the compiler.  */
       if (irel != internal_relocs)
 	last_reloc = irel - 1;
-
-      if (ELF32_R_TYPE (irel->r_info) != R_H8_DIR24R8
-	  && ELF32_R_TYPE (irel->r_info) != R_H8_PCREL16
-	  && ELF32_R_TYPE (irel->r_info) != R_H8_DIR16A8
-	  && ELF32_R_TYPE (irel->r_info) != R_H8_DIR24A8
-	  && ELF32_R_TYPE (irel->r_info) != R_H8_DIR32A16)
-	continue;
+      
+      switch(ELF32_R_TYPE (irel->r_info))
+	{
+	case R_H8_DIR24R8:
+	case R_H8_PCREL16:
+	case R_H8_DIR16A8:
+	case R_H8_DIR24A8:
+	case R_H8_DIR32A16:
+	case R_H8_DISP32A16:
+	  break;
+	default:
+	  continue;
+	}
 
       /* Get the section contents if we haven't done so already.  */
       if (contents == NULL)
@@ -807,8 +830,8 @@
 	 the linker is run.  */
       switch (ELF32_R_TYPE (irel->r_info))
 	{
-        /* Try to turn a 24-bit absolute branch/call into an 8-bit
-	   pc-relative branch/call.  */
+	  /* Try to turn a 24-bit absolute branch/call into an 8-bit
+	     pc-relative branch/call.  */
 	case R_H8_DIR24R8:
 	  {
 	    bfd_vma value = symval + irel->r_addend;
@@ -848,19 +871,19 @@
 		   Only perform this optimisation for jumps (code 0x5a) not
 		   subroutine calls, as otherwise it could transform:
 
-		   	             mov.w   r0,r0
-		   	             beq     .L1
-		         	     jsr     @_bar
-		              .L1:   rts
-		              _bar:  rts
+		   mov.w   r0,r0
+		   beq     .L1
+		   jsr     @_bar
+		   .L1:   rts
+		   _bar:  rts
 		   into:
-		   	             mov.w   r0,r0
-			             bne     _bar
-			             rts
-			      _bar:  rts
+		   mov.w   r0,r0
+		   bne     _bar
+		   rts
+		   _bar:  rts
 
 		   which changes the call (jsr) into a branch (bne).  */
-		if (code == 0x5a
+		if (code == 0x5a	/* jmp24.  */
 		    && (int) gap <= 130
 		    && (int) gap >= -128
 		    && last_reloc
@@ -904,7 +927,7 @@
 			code ^= 1;
 			bfd_put_8 (abfd,
 				   code,
-			contents + last_reloc->r_offset - 1);
+				   contents + last_reloc->r_offset - 1);
 
 			/* Delete four bytes of data.  */
 			if (!elf32_h8_relax_delete_bytes (abfd, sec,
@@ -918,11 +941,11 @@
 		  }
 
 		if (code == 0x5e)
-		  /* This is jsr.  */
-		  bfd_put_8 (abfd, 0x55, contents + irel->r_offset - 1);
+		  /* This is jsr24  */
+		  bfd_put_8 (abfd, 0x55, contents + irel->r_offset - 1);	/* bsr8. */
 		else if (code == 0x5a)
-		  /* This is jmp.  */
-		  bfd_put_8 (abfd, 0x40, contents + irel->r_offset - 1);
+		  /* This is jmp24  */
+		  bfd_put_8 (abfd, 0x40, contents + irel->r_offset - 1);	/* bra8. */
 		else
 		  abort ();
 
@@ -942,8 +965,8 @@
 	    break;
 	  }
 
-	/* Try to turn a 16-bit pc-relative branch into a 8-bit pc-relative
-	   branch.  */
+	  /* Try to turn a 16-bit pc-relative branch into a 8-bit pc-relative
+	     branch.  */
 	case R_H8_PCREL16:
 	  {
 	    bfd_vma value = symval + irel->r_addend;
@@ -980,18 +1003,18 @@
 		       contains the condition code.  */
 		    code = bfd_get_8 (abfd, contents + irel->r_offset - 1);
 
-		    /* Compute the fisrt byte of the relaxed
+		    /* Compute the first byte of the relaxed
 		       instruction.  The original sequence 0x58 0xX0
 		       is relaxed to 0x4X, where X represents the
 		       condition code.  */
 		    code &= 0xf0;
 		    code >>= 4;
 		    code |= 0x40;
-		    bfd_put_8 (abfd, code, contents + irel->r_offset - 2);
+		    bfd_put_8 (abfd, code, contents + irel->r_offset - 2); /* bCC:8.  */
 		  }
-		else if (code == 0x5c)
+		else if (code == 0x5c)	/* bsr16.  */
 		  /* This is bsr.  */
-		  bfd_put_8 (abfd, 0x55, contents + irel->r_offset - 2);
+		  bfd_put_8 (abfd, 0x55, contents + irel->r_offset - 2);  /* bsr8.  */
 		else
 		  /* Might be MOVSD.  */
 		  break;
@@ -1013,15 +1036,15 @@
 	    break;
 	  }
 
-	/* This is a 16-bit absolute address in one of the following
-	   instructions:
+	  /* This is a 16-bit absolute address in one of the following
+	     instructions:
 
 	     "band", "bclr", "biand", "bild", "bior", "bist", "bixor",
 	     "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", and
 	     "mov.b"
 
-	   We may relax this into an 8-bit absolute address if it's in
-	   the right range.  */
+	     We may relax this into an 8-bit absolute address if it's in
+	     the right range.  */
 	case R_H8_DIR16A8:
 	  {
 	    bfd_vma value;
@@ -1101,15 +1124,15 @@
 	    break;
 	  }
 
-	/* This is a 24-bit absolute address in one of the following
-	   instructions:
+	  /* This is a 24-bit absolute address in one of the following
+	     instructions:
 
 	     "band", "bclr", "biand", "bild", "bior", "bist", "bixor",
 	     "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", and
 	     "mov.b"
 
-	   We may relax this into an 8-bit absolute address if it's in
-	   the right range.  */
+	     We may relax this into an 8-bit absolute address if it's in
+	     the right range.  */
 	case R_H8_DIR24A8:
 	  {
 	    bfd_vma value;
@@ -1176,7 +1199,7 @@
 					     R_H8_DIR8);
 		irel->r_offset--;
 
-		/* Delete two bytes of data.  */
+		/* Delete four bytes of data.  */
 		if (!elf32_h8_relax_delete_bytes (abfd, sec,
 						  irel->r_offset + 1, 4))
 		  goto error_return;
@@ -1193,9 +1216,9 @@
 	  /* This is a 24-/32-bit absolute address in one of the
 	     following instructions:
 
-	       "band", "bclr", "biand", "bild", "bior", "bist",
-	       "bixor", "bld", "bnot", "bor", "bset", "bst", "btst",
-	       "bxor", "ldc.w", "stc.w" and "mov.[bwl]"
+	     "band", "bclr", "biand", "bild", "bior", "bist",
+	     "bixor", "bld", "bnot", "bor", "bset", "bst", "btst",
+	     "bxor", "ldc.w", "stc.w" and "mov.[bwl]"
 
 	     We may relax this into an 16-bit absolute address if it's
 	     in the right range.  */
@@ -1218,7 +1241,7 @@
 
 		if (irel->r_offset >= 4)
 		  {
-		    /* Check for 4-byte MOVA relaxation.  */
+		    /* Check for 4-byte MOVA relaxation (SH-specific).  */
 		    int second_reloc = 0;
 
 		    op_ptr = contents + irel->r_offset - 4;
@@ -1239,7 +1262,8 @@
 			    second_reloc = 1;
 			  }
 		      }
-		    if (irel < irelend)
+
+		    if (irel + 1 < irelend)
 		      {
 			Elf_Internal_Rela *next_reloc = irel + 1;
 			arelent bfd_reloc;
@@ -1284,7 +1308,7 @@
 		      }
 		  }
 
-		/* Now check for short version of MOVA.  */
+		/* Now check for short version of MOVA.  (SH-specific) */
 		op_ptr = contents + irel->r_offset - 2;
 		op0 = bfd_get_8 (abfd, op_ptr + 0);
 		op1 = bfd_get_8 (abfd, op_ptr + 1);
@@ -1321,9 +1345,99 @@
 		   Note that this is not required, and it may be slow.  */
 		*again = TRUE;
 	      }
-	    break;
+	    break;	/* case R_H8_DIR32A16 */
 	  }
 
+	case R_H8_DISP32A16:
+	  /* mov.[bwl] @(displ:24/32+ERx) -> mov.[bwl] @(displ:16+ERx)  4 bytes
+	     It is assured that instruction uses at least 4 bytes opcode before
+	     reloc entry addressing mode "register indirect with displacement"
+	     relaxing options (all saving 4 bytes):
+	     0x78 0sss0000 0x6A 0010dddd disp:32  mov.b @(d:32,ERs),Rd  ->
+	     0x6E 0sssdddd disp:16  mov.b @(d:16,ERs),Rd
+	     0x78 0sss0000 0x6B 0010dddd disp:32  mov.w @(d:32,ERs),Rd  ->
+	     0x6F 0sssdddd disp:16  mov.w @(d:16,ERs),Rd
+	     0x01 0x00 0x78 0sss0000 0x6B 00100ddd disp:32  mov.l @(d:32,ERs),ERd ->
+	     0x01 0x00 0x6F 0sss0ddd disp:16  mov.l @(d:16,ERs),ERd
+
+	     0x78 0ddd0000 0x6A 1010ssss disp:32  mov.b Rs,@(d:32,ERd)  ->
+	     0x6E 1dddssss disp:16  mov.b Rs,@(d:16,ERd)
+	     0x78 0ddd0000 0x6B 1010ssss disp:32  mov.w Rs,@(d:32,ERd)  ->
+	     0x6F 1dddssss disp:16  mov.w Rs,@(d:16,ERd)
+	     0x01 0x00 0x78 xddd0000 0x6B 10100sss disp:32  mov.l ERs,@(d:32,ERd) ->
+	     0x01 0x00 0x6F 1ddd0sss disp:16  mov.l ERs,@(d:16,ERd)
+	     mov.l prefix 0x01 0x00 can be left as is and mov.l handled same
+	     as mov.w/  */
+	  {
+	    bfd_vma value;
+
+	    value = bfd_h8300_pad_address (abfd, symval + irel->r_addend);
+	    if (value <= 0x7fff || value >= 0xffff8000u)
+	      {
+		unsigned char op0, op1, op2, op3, op0n, op1n;
+		int relax = 0;
+
+		/* Note that we've changed the relocs, section contents,
+		   etc.  */
+		elf_section_data (sec)->relocs = internal_relocs;
+		elf_section_data (sec)->this_hdr.contents = contents;
+		symtab_hdr->contents = (unsigned char *) isymbuf;
+
+		if (irel->r_offset >= 4)
+		  {
+		    op0 = bfd_get_8 (abfd, contents + irel->r_offset - 4);
+		    op1 = bfd_get_8 (abfd, contents + irel->r_offset - 3);
+		    op2 = bfd_get_8 (abfd, contents + irel->r_offset - 2);
+		    op3 = bfd_get_8 (abfd, contents + irel->r_offset - 1);
+
+		    if (op0 == 0x78)
+		      {
+			switch(op2)
+			  {
+			  case 0x6A:
+			    if ((op1 & 0x8F) == 0x00 && (op3 & 0x70) == 0x20)
+			      {
+				/* mov.b.  */
+				op0n = 0x6E;
+				relax = 1;
+			      }
+			    break;
+			  case 0x6B:
+			    if ((op1 & 0x0F) == 0x00 && (op3 & 0x70) == 0x20)
+			      {
+				/* mov.w/l.  */
+				op0n = 0x6F;
+				relax = 1;
+			      }
+			    break;
+			  default:
+			    break;
+			  }
+		      }
+		  }
+
+		if (relax)
+		  {
+		    op1n = (op3 & 0x8F) | (op1 & 0x70);
+		    bfd_put_8 (abfd, op0n, contents + irel->r_offset - 4);
+		    bfd_put_8 (abfd, op1n, contents + irel->r_offset - 3);
+
+		    /* Fix the relocation's type.  */
+		    irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_H8_DIR16);
+		    irel->r_offset -= 2;
+
+		    /* Delete four bytes of data.  */
+		    if (!elf32_h8_relax_delete_bytes (abfd, sec, irel->r_offset + 2, 4))
+		      goto error_return;
+
+		    /* That will change things, so, we should relax again.
+		       Note that this is not required, and it may be slow.  */
+		    *again = TRUE;
+		  }
+	      }
+	  }
+	  break;
+
 	default:
 	  break;
 	}
@@ -1404,7 +1518,7 @@
     {
       /* Get the new reloc address.  */
       if ((irel->r_offset > addr
-	   && irel->r_offset < toaddr))
+	   && irel->r_offset <= toaddr))
 	irel->r_offset -= count;
     }
 
@@ -1416,7 +1530,7 @@
     {
       if (isym->st_shndx == sec_shndx
 	  && isym->st_value > addr
-	  && isym->st_value < toaddr)
+	  && isym->st_value <= toaddr)
 	isym->st_value -= count;
     }
 
@@ -1428,14 +1542,13 @@
   for (; sym_hashes < end_hashes; sym_hashes++)
     {
       struct elf_link_hash_entry *sym_hash = *sym_hashes;
+
       if ((sym_hash->root.type == bfd_link_hash_defined
 	   || sym_hash->root.type == bfd_link_hash_defweak)
 	  && sym_hash->root.u.def.section == sec
 	  && sym_hash->root.u.def.value > addr
-	  && sym_hash->root.u.def.value < toaddr)
-	{
-	  sym_hash->root.u.def.value -= count;
-	}
+	  && sym_hash->root.u.def.value <= toaddr)
+	sym_hash->root.u.def.value -= count;
     }
 
   return TRUE;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index dc3053c..df25ac9 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -1,7 +1,5 @@
 /* BFD back-end for HP PA-RISC ELF files.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 1990-2013 Free Software Foundation, Inc.
 
    Original code by
 	Center for Software Science
@@ -10,7 +8,7 @@
    Largely rewritten by Alan Modra <alan@linuxcare.com.au>
    Naming cleanup by Carlos O'Donell <carlos@systemhalted.org>
    TLS support written by Randolph Chung <tausq@debian.org>
- 
+
    This file is part of BFD, the Binary File Descriptor library.
 
    This program is free software; you can redistribute it and/or modify
@@ -124,20 +122,20 @@
    Structure/Variable         		Prefix
    elf_link_hash_table			"etab"
    elf_link_hash_entry			"eh"
-   
+
    elf32_hppa_link_hash_table		"htab"
    elf32_hppa_link_hash_entry		"hh"
 
    bfd_hash_table			"btab"
    bfd_hash_entry			"bh"
-   
+
    bfd_hash_table containing stubs	"bstab"
    elf32_hppa_stub_hash_entry		"hsh"
 
    elf32_hppa_dyn_reloc_entry		"hdh"
-   
+
    Always remember to use GNU Coding Style. */
-					  
+
 #define PLT_ENTRY_SIZE 8
 #define GOT_ENTRY_SIZE 4
 #define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
@@ -419,7 +417,7 @@
   struct elf32_hppa_link_hash_table *htab;
   bfd_size_type amt = sizeof (*htab);
 
-  htab = bfd_malloc (amt);
+  htab = bfd_zmalloc (amt);
   if (htab == NULL)
     return NULL;
 
@@ -436,26 +434,8 @@
 			    sizeof (struct elf32_hppa_stub_hash_entry)))
     return NULL;
 
-  htab->stub_bfd = NULL;
-  htab->add_stub_section = NULL;
-  htab->layout_sections_again = NULL;
-  htab->stub_group = NULL;
-  htab->sgot = NULL;
-  htab->srelgot = NULL;
-  htab->splt = NULL;
-  htab->srelplt = NULL;
-  htab->sdynbss = NULL;
-  htab->srelbss = NULL;
   htab->text_segment_base = (bfd_vma) -1;
   htab->data_segment_base = (bfd_vma) -1;
-  htab->multi_subspace = 0;
-  htab->has_12bit_branch = 0;
-  htab->has_17bit_branch = 0;
-  htab->has_22bit_branch = 0;
-  htab->need_plt_stub = 0;
-  htab->sym_cache.abfd = NULL;
-  htab->tls_ldm_got.refcount = 0;
-
   return &htab->etab.root;
 }
 
@@ -468,7 +448,7 @@
     = (struct elf32_hppa_link_hash_table *) btab;
 
   bfd_hash_table_free (&htab->bstab);
-  _bfd_generic_link_hash_table_free (btab);
+  _bfd_elf_link_hash_table_free (btab);
 }
 
 /* Build a name for an entry in the stub hash table.  */
@@ -1110,7 +1090,7 @@
 {
   Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   bfd_signed_vma *local_refcounts;
-                  
+
   local_refcounts = elf_local_got_refcounts (abfd);
   if (local_refcounts == NULL)
     {
@@ -1187,6 +1167,10 @@
 	  while (hh->eh.root.type == bfd_link_hash_indirect
 		 || hh->eh.root.type == bfd_link_hash_warning)
 	    hh = hppa_elf_hash_entry (hh->eh.root.u.i.link);
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  hh->eh.root.non_ir_ref = 1;
 	}
 
       r_type = ELF32_R_TYPE (rela->r_info);
@@ -1378,7 +1362,7 @@
 	      else
 	        {
 	          bfd_signed_vma *local_got_refcounts;
-		  
+
 	          /* This is a global offset table entry for a local symbol.  */
 	          local_got_refcounts = hppa32_elf_local_refcounts (abfd);
 	          if (local_got_refcounts == NULL)
@@ -1724,10 +1708,10 @@
 
       case 396:		/* Linux/hppa */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	/* pr_reg */
 	offset = 72;
@@ -1750,9 +1734,9 @@
 	return FALSE;
 
       case 124:		/* Linux/hppa elf_prpsinfo.  */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
     }
 
@@ -1760,7 +1744,7 @@
      onto the end of the args in some (at least one anyway)
      implementations, so strip it off if it exists.  */
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -1787,6 +1771,10 @@
 	  _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
 				  eh->dynstr_index);
 	}
+
+      /* PR 16082: Remove version information from hidden symbol.  */
+      eh->verinfo.verdef = NULL;
+      eh->verinfo.vertree = NULL;
     }
 
   /* STT_GNU_IFUNC symbol must go through PLT.  */
@@ -1965,7 +1953,7 @@
 	     means that the plt entry is only used by a plabel.
 	     We'll be using a normal plt entry for this symbol, so
 	     clear the plabel indicator.  */
-	  
+
 	  hh->plabel = 0;
 	}
       else if (hh->plabel)
@@ -2013,7 +2001,7 @@
     return FALSE;
 
   hh = hppa_elf_hash_entry (eh);
-  
+
   if (htab->etab.dynamic_sections_created
       && eh->plt.offset != (bfd_vma) -1
       && !hh->plabel
@@ -2114,7 +2102,7 @@
       /* For the non-shared case, discard space for relocs against
 	 symbols which turn out to need copy relocs or are not
 	 dynamic.  */
-      
+
       if (!eh->non_got_ref
 	  && ((ELIMINATE_COPY_RELOCS
 	       && eh->def_dynamic
@@ -2301,7 +2289,7 @@
 		sec->size += 2 * GOT_ENTRY_SIZE;
 	      else if ((*local_tls_type & GOT_TLS_GD) == GOT_TLS_GD)
 		sec->size += GOT_ENTRY_SIZE;
-	      if (info->shared) 
+	      if (info->shared)
 	        {
 		  srel->size += sizeof (Elf32_External_Rela);
 		  if ((*local_tls_type & (GOT_TLS_GD | GOT_TLS_IE)) == (GOT_TLS_GD | GOT_TLS_IE))
@@ -2342,10 +2330,10 @@
 	    }
 	}
     }
-  
+
   if (htab->tls_ldm_got.refcount > 0)
     {
-      /* Allocate 2 got entries and 1 dynamic reloc for 
+      /* Allocate 2 got entries and 1 dynamic reloc for
          R_PARISC_TLS_DTPMOD32 relocs.  */
       htab->tls_ldm_got.offset = htab->sgot->size;
       htab->sgot->size += (GOT_ENTRY_SIZE * 2);
@@ -2384,7 +2372,7 @@
 	      bfd_size_type mask;
 
 	      if (gotalign > pltalign)
-		bfd_set_section_alignment (dynobj, sec, gotalign);
+		(void) bfd_set_section_alignment (dynobj, sec, gotalign);
 	      mask = ((bfd_size_type) 1 << gotalign) - 1;
 	      sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask;
 	    }
@@ -3220,7 +3208,7 @@
 }
 
 /* Return the base vma address which should be subtracted from the real
-   address when resolving a dtpoff relocation.  
+   address when resolving a dtpoff relocation.
    This is PT_TLS segment p_vaddr.  */
 
 static bfd_vma
@@ -3242,9 +3230,9 @@
   /* If tls_sec is NULL, we should have signalled an error already.  */
   if (htab->tls_sec == NULL)
     return 0;
-  /* hppa TLS ABI is variant I and static TLS block start just after 
+  /* hppa TLS ABI is variant I and static TLS block start just after
      tcbhead structure which has 2 pointer fields.  */
-  return (address - htab->tls_sec->vma 
+  return (address - htab->tls_sec->vma
 	  + align_power ((bfd_vma) 8, htab->tls_sec->alignment_power));
 }
 
@@ -3323,7 +3311,7 @@
   bfd_signed_vma addend = rela->r_addend;
   bfd_vma location;
   struct elf32_hppa_stub_hash_entry *hsh = NULL;
-  int val;  
+  int val;
 
   if (r_type == R_PARISC_NONE)
     return bfd_reloc_ok;
@@ -3706,13 +3694,14 @@
       else
 	{
 	  struct elf_link_hash_entry *eh;
-	  bfd_boolean unresolved_reloc;
+	  bfd_boolean unresolved_reloc, ignored;
 	  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rela,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   eh, sym_sec, relocation,
-				   unresolved_reloc, warned_undef);
+				   unresolved_reloc, warned_undef,
+				   ignored);
 
 	  if (!info->relocatable
 	      && relocation == 0
@@ -4002,7 +3991,7 @@
 		      || outrel.r_offset == (bfd_vma) -2);
 	      outrel.r_offset += (input_section->output_offset
 				  + input_section->output_section->vma);
-	      	      
+
 	      if (skip)
 		{
 		  memset (&outrel, 0, sizeof (outrel));
@@ -4064,12 +4053,12 @@
 	      bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
 	    }
 	  break;
-	  
+
 	case R_PARISC_TLS_LDM21L:
 	case R_PARISC_TLS_LDM14R:
 	  {
 	    bfd_vma off;
-	
+
 	    off = htab->tls_ldm_got.offset;
 	    if (off & 1)
 	      off &= ~1;
@@ -4078,12 +4067,12 @@
 		Elf_Internal_Rela outrel;
 		bfd_byte *loc;
 
-		outrel.r_offset = (off 
+		outrel.r_offset = (off
 				   + htab->sgot->output_section->vma
 				   + htab->sgot->output_offset);
 		outrel.r_addend = 0;
 		outrel.r_info = ELF32_R_INFO (0, R_PARISC_TLS_DTPMOD32);
-		loc = htab->srelgot->contents; 
+		loc = htab->srelgot->contents;
 		loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
 
 		bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
@@ -4155,7 +4144,7 @@
 			|| hh->eh.root.type != bfd_link_hash_undefweak))
 		  {
 		    need_relocs = TRUE;
-		    loc = htab->srelgot->contents; 
+		    loc = htab->srelgot->contents;
 		    /* FIXME (CAO): Should this be reloc_count++ ? */
 		    loc += htab->srelgot->reloc_count * sizeof (Elf32_External_Rela);
 		  }
@@ -4442,9 +4431,7 @@
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
-  if (eh_name (eh)[0] == '_'
-      && (strcmp (eh_name (eh), "_DYNAMIC") == 0
-	  || eh == htab->etab.hgot))
+  if (eh == htab->etab.hdynamic || eh == htab->etab.hgot)
     {
       sym->st_shndx = SHN_ABS;
     }
@@ -4456,7 +4443,9 @@
    dynamic linker, before writing them out.  */
 
 static enum elf_reloc_type_class
-elf32_hppa_reloc_type_class (const Elf_Internal_Rela *rela)
+elf32_hppa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			     const asection *rel_sec ATTRIBUTE_UNUSED,
+			     const Elf_Internal_Rela *rela)
 {
   /* Handle TLS relocs first; we don't want them to be marked
      relative by the "if (ELF32_R_SYM (rela->r_info) == STN_UNDEF)"
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index 5998db7..48e25f2 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -825,6 +825,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       if (info->shared)
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 7d3652d..4574c59 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1,6 +1,6 @@
 /* Intel 80386/80486-specific support for 32-bit ELF
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -133,7 +133,9 @@
   HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_386_TLS_TPOFF32",
 	TRUE, 0xffffffff, 0xffffffff, FALSE),
-  EMPTY_HOWTO (38),
+  HOWTO(R_386_SIZE32, 0, 2, 32, FALSE, 0, complain_overflow_unsigned,
+	bfd_elf_generic_reloc, "R_386_SIZE32",
+	TRUE, 0xffffffff, 0xffffffff, FALSE),
   HOWTO(R_386_TLS_GOTDESC, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_386_TLS_GOTDESC",
 	TRUE, 0xffffffff, 0xffffffff, FALSE),
@@ -312,6 +314,10 @@
       TRACE ("BFD_RELOC_386_TLS_TPOFF32");
       return &elf_howto_table[R_386_TLS_TPOFF32 - R_386_tls_offset];
 
+    case BFD_RELOC_SIZE32:
+      TRACE ("BFD_RELOC_SIZE32");
+      return &elf_howto_table[R_386_SIZE32 - R_386_tls_offset];
+
     case BFD_RELOC_386_TLS_GOTDESC:
       TRACE ("BFD_RELOC_386_TLS_GOTDESC");
       return &elf_howto_table[R_386_TLS_GOTDESC - R_386_tls_offset];
@@ -419,10 +425,10 @@
  	return FALSE;
 
       /* pr_cursig */
-      elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 20);
+      elf_tdata (abfd)->core->signal = bfd_get_32 (abfd, note->descdata + 20);
 
       /* pr_pid */
-      elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+      elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
       /* pr_reg */
       offset = 28;
@@ -437,10 +443,10 @@
 
 	case 144:		/* Linux/i386 */
 	  /* pr_cursig */
-	  elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	  elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	  /* pr_pid */
-	  elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	  elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	  /* pr_reg */
 	  offset = 72;
@@ -465,9 +471,9 @@
       if (pr_version != 1)
 	return FALSE;
 
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
 	= _bfd_elfcore_strndup (abfd, note->descdata + 8, 17);
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, note->descdata + 25, 81);
     }
   else
@@ -478,11 +484,11 @@
 	  return FALSE;
 
 	case 124:		/* Linux/i386 elf_prpsinfo.  */
-	  elf_tdata (abfd)->core_pid
+	  elf_tdata (abfd)->core->pid
 	    = bfd_get_32 (abfd, note->descdata + 12);
-	  elf_tdata (abfd)->core_program
+	  elf_tdata (abfd)->core->program
 	    = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	  elf_tdata (abfd)->core_command
+	  elf_tdata (abfd)->core->command
 	    = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
 	}
     }
@@ -491,7 +497,7 @@
      onto the end of the args in some (at least one anyway)
      implementations, so strip it off if it exists.  */
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -931,7 +937,7 @@
   struct elf_i386_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_i386_link_hash_table);
 
-  ret = (struct elf_i386_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf_i386_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -944,18 +950,6 @@
       return NULL;
     }
 
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->plt_eh_frame = NULL;
-  ret->tls_ldm_got.refcount = 0;
-  ret->next_tls_desc_index = 0;
-  ret->sgotplt_jump_table_size = 0;
-  ret->sym_cache.abfd = NULL;
-  ret->srelplt2 = NULL;
-  ret->tls_module_base = NULL;
-  ret->next_jump_slot_index = 0;
-  ret->next_irelative_index = 0;
-
   ret->loc_hash_table = htab_try_create (1024,
 					 elf_i386_local_htab_hash,
 					 elf_i386_local_htab_eq,
@@ -982,7 +976,7 @@
     htab_delete (htab->loc_hash_table);
   if (htab->loc_hash_memory)
     objalloc_free ((struct objalloc *) htab->loc_hash_memory);
-  _bfd_generic_link_hash_table_free (hash);
+  _bfd_elf_link_hash_table_free (hash);
 }
 
 /* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and
@@ -1448,6 +1442,7 @@
       struct elf_link_hash_entry *h;
       Elf_Internal_Sym *isym;
       const char *name;
+      bfd_boolean size_reloc;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
       r_type = ELF32_R_TYPE (rel->r_info);
@@ -1517,73 +1512,9 @@
 	      break;
 	    }
 
-	  /* Since STT_GNU_IFUNC symbol must go through PLT, we handle
-	     it here if it is defined in a non-shared object.  */
-	  if (h->type == STT_GNU_IFUNC
-	      && h->def_regular)
-	    {
-	      /* It is referenced by a non-shared object. */
-	      h->ref_regular = 1;
-	      h->needs_plt = 1;
-
-	      /* STT_GNU_IFUNC symbol must go through PLT.  */
-	      h->plt.refcount += 1;
-
-	      /* STT_GNU_IFUNC needs dynamic sections.  */
-	      if (htab->elf.dynobj == NULL)
-		htab->elf.dynobj = abfd;
-
-	      switch (r_type)
-		{
-		default:
-		  if (h->root.root.string)
-		    name = h->root.root.string;
-		  else
-		    name = bfd_elf_sym_name (abfd, symtab_hdr, isym,
-					     NULL);
-		  (*_bfd_error_handler)
-		    (_("%B: relocation %s against STT_GNU_IFUNC "
-		       "symbol `%s' isn't handled by %s"), abfd,
-		     elf_howto_table[r_type].name,
-		     name, __FUNCTION__);
-		  bfd_set_error (bfd_error_bad_value);
-		  return FALSE;
-
-		case R_386_32:
-		  h->non_got_ref = 1;
-		  h->pointer_equality_needed = 1;
-		  if (info->shared)
-		    {
-		      /* We must copy these reloc types into the
-			 output file.  Create a reloc section in
-			 dynobj and make room for this reloc.  */
-		      sreloc = _bfd_elf_create_ifunc_dyn_reloc
-			(abfd, info, sec, sreloc,
-			 &((struct elf_i386_link_hash_entry *) h)->dyn_relocs);
-		      if (sreloc == NULL)
-			return FALSE;
-		    }
-		  break;
-
-		case R_386_PC32:
-		  h->non_got_ref = 1;
-		  break;
-
-		case R_386_PLT32:
-		  break;
-
-		case R_386_GOT32:
-		case R_386_GOTOFF:
-		  h->got.refcount += 1;
-		  if (htab->elf.sgot == NULL
-		      && !_bfd_elf_create_got_section (htab->elf.dynobj,
-						       info))
-		    return FALSE;
-		  break;
-		}
-
-	      continue;
-	    }
+	  /* It is referenced by a non-shared object. */
+	  h->ref_regular = 1;
+	  h->root.non_ir_ref = 1;
 	}
 
       if (! elf_i386_tls_transition (info, abfd, sec, NULL,
@@ -1615,6 +1546,10 @@
 	  h->plt.refcount += 1;
 	  break;
 
+	case R_386_SIZE32:
+	  size_reloc = TRUE;
+	  goto do_size;
+
 	case R_386_TLS_IE_32:
 	case R_386_TLS_IE:
 	case R_386_TLS_GOTIE:
@@ -1707,6 +1642,7 @@
 		      (_("%B: `%s' accessed both as normal and "
 			 "thread local symbol"),
 		       abfd, name);
+		    bfd_set_error (bfd_error_bad_value);
 		    return FALSE;
 		  }
 	      }
@@ -1761,6 +1697,8 @@
 		h->pointer_equality_needed = 1;
 	    }
 
+	  size_reloc = FALSE;
+do_size:
 	  /* If we are creating a shared library, and this is a reloc
 	     against a global symbol, or a non PC relative reloc
 	     against a local symbol, then we need to copy the reloc
@@ -1857,7 +1795,8 @@
 		}
 
 	      p->count += 1;
-	      if (r_type == R_386_PC32)
+	      /* Count size relocation as PC-relative relocation.  */
+	      if (r_type == R_386_PC32 || size_reloc)
 		p->pc_count += 1;
 	    }
 	  break;
@@ -2023,6 +1962,7 @@
 
 	case R_386_32:
 	case R_386_PC32:
+	case R_386_SIZE32:
 	  if (info->shared
 	      && (h == NULL || h->type != STT_GNU_IFUNC))
 	    break;
@@ -2066,10 +2006,44 @@
 {
   struct elf_i386_link_hash_table *htab;
   asection *s;
+  struct elf_i386_link_hash_entry *eh;
+  struct elf_dyn_relocs *p;
 
   /* STT_GNU_IFUNC symbol must go through PLT. */
   if (h->type == STT_GNU_IFUNC)
     {
+      /* All local STT_GNU_IFUNC references must be treate as local
+	 calls via local PLT.  */
+      if (h->ref_regular
+	  && SYMBOL_CALLS_LOCAL (info, h))
+	{
+	  bfd_size_type pc_count = 0, count = 0;
+	  struct elf_dyn_relocs **pp;
+
+	  eh = (struct elf_i386_link_hash_entry *) h;
+	  for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+	    {
+	      pc_count += p->pc_count;
+	      p->count -= p->pc_count;
+	      p->pc_count = 0;
+	      count += p->count;
+	      if (p->count == 0)
+		*pp = p->next;
+	      else
+		pp = &p->next;
+	    }
+
+	  if (pc_count || count)
+	    {
+	      h->needs_plt = 1;
+	      h->non_got_ref = 1;
+	      if (h->plt.refcount <= 0)
+		h->plt.refcount = 1;
+	      else
+		h->plt.refcount += 1;
+	    }
+	}
+
       if (h->plt.refcount <= 0)
 	{
 	  h->plt.offset = (bfd_vma) -1;
@@ -2155,9 +2129,6 @@
   if (ELIMINATE_COPY_RELOCS
       && !get_elf_i386_backend_data (info->output_bfd)->is_vxworks)
     {
-      struct elf_i386_link_hash_entry * eh;
-      struct elf_dyn_relocs *p;
-
       eh = (struct elf_i386_link_hash_entry *) h;
       for (p = eh->dyn_relocs; p != NULL; p = p->next)
 	{
@@ -2226,7 +2197,8 @@
   if (h->type == STT_GNU_IFUNC
       && h->def_regular)
     return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs,
-                                               plt_entry_size, 4);
+                                               plt_entry_size,
+					       plt_entry_size, 4);
   else if (htab->elf.dynamic_sections_created
 	   && h->plt.refcount > 0)
     {
@@ -2247,7 +2219,7 @@
 	  /* If this is the first .plt entry, make room for the special
 	     first entry.  */
 	  if (s->size == 0)
-	    s->size += plt_entry_size;
+	    s->size = plt_entry_size;
 
 	  h->plt.offset = s->size;
 
@@ -2536,6 +2508,153 @@
   return TRUE;
 }
 
+/* Convert
+   mov foo@GOT(%reg), %reg
+   to
+   lea foo@GOTOFF(%reg), %reg
+   with the local symbol, foo.  */
+
+static bfd_boolean
+elf_i386_convert_mov_to_lea (bfd *abfd, asection *sec,
+			     struct bfd_link_info *link_info)
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  Elf_Internal_Rela *internal_relocs;
+  Elf_Internal_Rela *irel, *irelend;
+  bfd_byte *contents;
+  struct elf_i386_link_hash_table *htab;
+  bfd_boolean changed_contents;
+  bfd_boolean changed_relocs;
+  bfd_signed_vma *local_got_refcounts;
+
+  /* Don't even try to convert non-ELF outputs.  */
+  if (!is_elf_hash_table (link_info->hash))
+    return FALSE;
+
+  /* Nothing to do if there are no codes, no relocations or no output.  */
+  if ((sec->flags & (SEC_CODE | SEC_RELOC)) != (SEC_CODE | SEC_RELOC)
+      || sec->reloc_count == 0
+      || discarded_section (sec))
+    return TRUE;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+
+  /* Load the relocations for this section.  */
+  internal_relocs = (_bfd_elf_link_read_relocs
+		     (abfd, sec, NULL, (Elf_Internal_Rela *) NULL,
+		      link_info->keep_memory));
+  if (internal_relocs == NULL)
+    return FALSE;
+
+  htab = elf_i386_hash_table (link_info);
+  changed_contents = FALSE;
+  changed_relocs = FALSE;
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+
+  /* Get the section contents.  */
+  if (elf_section_data (sec)->this_hdr.contents != NULL)
+    contents = elf_section_data (sec)->this_hdr.contents;
+  else
+    {
+      if (!bfd_malloc_and_get_section (abfd, sec, &contents))
+	goto error_return;
+    }
+
+  irelend = internal_relocs + sec->reloc_count;
+  for (irel = internal_relocs; irel < irelend; irel++)
+    {
+      unsigned int r_type = ELF32_R_TYPE (irel->r_info);
+      unsigned int r_symndx = ELF32_R_SYM (irel->r_info);
+      unsigned int indx;
+      struct elf_link_hash_entry *h;
+
+      if (r_type != R_386_GOT32)
+	continue;
+
+      /* Get the symbol referred to by the reloc.  */
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  Elf_Internal_Sym *isym;
+
+	  isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+					abfd, r_symndx);
+
+	  /* STT_GNU_IFUNC must keep R_386_GOT32 relocation.  */
+	  if (ELF_ST_TYPE (isym->st_info) != STT_GNU_IFUNC
+	      && bfd_get_8 (input_bfd,
+			    contents + irel->r_offset - 2) == 0x8b)
+	    {
+	      bfd_put_8 (output_bfd, 0x8d,
+			 contents + irel->r_offset - 2);
+	      irel->r_info = ELF32_R_INFO (r_symndx, R_386_GOTOFF);
+	      if (local_got_refcounts != NULL
+		  && local_got_refcounts[r_symndx] > 0)
+		local_got_refcounts[r_symndx] -= 1;
+	      changed_contents = TRUE;
+	      changed_relocs = TRUE;
+	    }
+	  continue;
+	}
+
+      indx = r_symndx - symtab_hdr->sh_info;
+      h = elf_sym_hashes (abfd)[indx];
+      BFD_ASSERT (h != NULL);
+
+      while (h->root.type == bfd_link_hash_indirect
+	     || h->root.type == bfd_link_hash_warning)
+	h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+      /* STT_GNU_IFUNC must keep R_386_GOT32 relocation.  We also avoid
+	 optimizing _DYNAMIC since ld.so may use its link-time address.  */
+      if (h->def_regular
+	  && h->type != STT_GNU_IFUNC
+	  && h != htab->elf.hdynamic
+	  && SYMBOL_REFERENCES_LOCAL (link_info, h)
+	  && bfd_get_8 (input_bfd,
+			contents + irel->r_offset - 2) == 0x8b)
+	{
+	  bfd_put_8 (output_bfd, 0x8d,
+		     contents + irel->r_offset - 2);
+	  irel->r_info = ELF32_R_INFO (r_symndx, R_386_GOTOFF);
+	  if (h->got.refcount > 0)
+	    h->got.refcount -= 1;
+	  changed_contents = TRUE;
+	  changed_relocs = TRUE;
+	}
+    }
+
+  if (contents != NULL
+      && elf_section_data (sec)->this_hdr.contents != contents)
+    {
+      if (!changed_contents && !link_info->keep_memory)
+	free (contents);
+      else
+	{
+	  /* Cache the section contents for elf_link_input_bfd.  */
+	  elf_section_data (sec)->this_hdr.contents = contents;
+	}
+    }
+
+  if (elf_section_data (sec)->relocs != internal_relocs)
+    {
+      if (!changed_relocs)
+	free (internal_relocs);
+      else
+	elf_section_data (sec)->relocs = internal_relocs;
+    }
+
+  return TRUE;
+
+ error_return:
+  if (contents != NULL
+      && elf_section_data (sec)->this_hdr.contents != contents)
+    free (contents);
+  if (internal_relocs != NULL
+      && elf_section_data (sec)->relocs != internal_relocs)
+    free (internal_relocs);
+  return FALSE;
+}
+
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -2586,6 +2705,9 @@
 	{
 	  struct elf_dyn_relocs *p;
 
+	  if (!elf_i386_convert_mov_to_lea (ibfd, s, info))
+	    return FALSE;
+
 	  for (p = ((struct elf_dyn_relocs *)
 		     elf_section_data (s)->local_dynrel);
 	       p != NULL;
@@ -2713,15 +2835,10 @@
 
   if (htab->elf.sgotplt)
     {
-      struct elf_link_hash_entry *got;
-      got = elf_link_hash_lookup (elf_hash_table (info),
-				  "_GLOBAL_OFFSET_TABLE_",
-				  FALSE, FALSE, FALSE);
-
       /* Don't allocate .got.plt section if there are no GOT nor PLT
          entries and there is no reference to _GLOBAL_OFFSET_TABLE_.  */
-      if ((got == NULL
-	   || !got->ref_regular_nonweak)
+      if ((htab->elf.hgot == NULL
+	   || !htab->elf.hgot->ref_regular_nonweak)
 	  && (htab->elf.sgotplt->size
 	      == get_elf_backend_data (output_bfd)->got_header_size)
 	  && (htab->elf.splt == NULL
@@ -3073,6 +3190,7 @@
       bfd_reloc_status_type r;
       unsigned int indx;
       int tls_type;
+      bfd_vma st_size;
 
       r_type = ELF32_R_TYPE (rel->r_info);
       if (r_type == R_386_GNU_VTINHERIT
@@ -3105,6 +3223,7 @@
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
+	  st_size = sym->st_size;
 
 	  if (ELF_ST_TYPE (sym->st_info) == STT_SECTION
 	      && ((sec->flags & SEC_MERGE) != 0
@@ -3192,11 +3311,13 @@
       else
 	{
 	  bfd_boolean warned ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
+	  st_size = h->size;
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -3257,7 +3378,6 @@
 	      if (info->shared && h->non_got_ref)
 		{
 		  Elf_Internal_Rela outrel;
-		  bfd_byte *loc;
 		  asection *sreloc;
 		  bfd_vma offset;
 
@@ -3291,10 +3411,7 @@
 		    outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
 
 		  sreloc = htab->elf.irelifunc;
-		  loc = sreloc->contents;
-		  loc += (sreloc->reloc_count++
-			  * sizeof (Elf32_External_Rel));
-		  bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+		  elf_append_rel (output_bfd, sreloc, &outrel);
 
 		  /* If this reloc is against an external symbol, we
 		     do not want to fiddle with the addend.  Otherwise,
@@ -3448,7 +3565,6 @@
 		    {
 		      asection *s;
 		      Elf_Internal_Rela outrel;
-		      bfd_byte *loc;
 
 		      s = htab->elf.srelgot;
 		      if (s == NULL)
@@ -3458,9 +3574,7 @@
 					 + htab->elf.sgot->output_offset
 					 + off);
 		      outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
-		      loc = s->contents;
-		      loc += s->reloc_count++ * sizeof (Elf32_External_Rel);
-		      bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+		      elf_append_rel (output_bfd, s, &outrel);
 		    }
 
 		  local_got_offsets[r_symndx] |= 1;
@@ -3565,6 +3679,11 @@
 	  unresolved_reloc = FALSE;
 	  break;
 
+	case R_386_SIZE32:
+	  /* Set to symbol size.  */
+	  relocation = st_size;
+	  /* Fall through.  */
+
 	case R_386_32:
 	case R_386_PC32:
 	  if ((input_section->flags & SEC_ALLOC) == 0
@@ -3575,7 +3694,7 @@
 	       && (h == NULL
 		   || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 		   || h->root.type != bfd_link_hash_undefweak)
-	       && (r_type != R_386_PC32
+	       && ((r_type != R_386_PC32 && r_type != R_386_SIZE32)
 		   || !SYMBOL_CALLS_LOCAL (info, h)))
 	      || (ELIMINATE_COPY_RELOCS
 		  && !info->shared
@@ -3588,7 +3707,6 @@
 		      || h->root.type == bfd_link_hash_undefined)))
 	    {
 	      Elf_Internal_Rela outrel;
-	      bfd_byte *loc;
 	      bfd_boolean skip, relocate;
 	      asection *sreloc;
 
@@ -3633,10 +3751,7 @@
 		  goto check_relocation_error;
 		}
 
-	      loc = sreloc->contents;
-	      loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
-
-	      bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+	      elf_append_rel (output_bfd, sreloc, &outrel);
 
 	      /* If this reloc is against an external symbol, we do
 		 not want to fiddle with the addend.  Otherwise, we
@@ -3651,7 +3766,6 @@
 	  if (!info->executable)
 	    {
 	      Elf_Internal_Rela outrel;
-	      bfd_byte *loc;
 	      asection *sreloc;
 
 	      outrel.r_offset = rel->r_offset
@@ -3661,9 +3775,7 @@
 	      sreloc = elf_section_data (input_section)->sreloc;
 	      if (sreloc == NULL)
 		abort ();
-	      loc = sreloc->contents;
-	      loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
-	      bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+	      elf_append_rel (output_bfd, sreloc, &outrel);
 	    }
 	  /* Fall through */
 
@@ -3889,7 +4001,6 @@
 	  else
 	    {
 	      Elf_Internal_Rela outrel;
-	      bfd_byte *loc;
 	      int dr_type;
 	      asection *sreloc;
 
@@ -3900,6 +4011,7 @@
 
 	      if (GOT_TLS_GDESC_P (tls_type))
 		{
+		  bfd_byte *loc;
 		  outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_DESC);
 		  BFD_ASSERT (htab->sgotplt_jump_table_size + offplt + 8
 			      <= htab->elf.sgotplt->size);
@@ -3957,11 +4069,7 @@
 			    htab->elf.sgot->contents + off);
 	      outrel.r_info = ELF32_R_INFO (indx, dr_type);
 
-	      loc = sreloc->contents;
-	      loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
-	      BFD_ASSERT (loc + sizeof (Elf32_External_Rel)
-			  <= sreloc->contents + sreloc->size);
-	      bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+	      elf_append_rel (output_bfd, sreloc, &outrel);
 
 	      if (GOT_TLS_GD_P (tls_type))
 		{
@@ -3979,11 +4087,7 @@
 		      outrel.r_info = ELF32_R_INFO (indx,
 						    R_386_TLS_DTPOFF32);
 		      outrel.r_offset += 4;
-		      sreloc->reloc_count++;
-		      loc += sizeof (Elf32_External_Rel);
-		      BFD_ASSERT (loc + sizeof (Elf32_External_Rel)
-				  <= sreloc->contents + sreloc->size);
-		      bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+		      elf_append_rel (output_bfd, sreloc, &outrel);
 		    }
 		}
 	      else if (tls_type == GOT_TLS_IE_BOTH)
@@ -3995,9 +4099,7 @@
 			      htab->elf.sgot->contents + off + 4);
 		  outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF);
 		  outrel.r_offset += 4;
-		  sreloc->reloc_count++;
-		  loc += sizeof (Elf32_External_Rel);
-		  bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+		  elf_append_rel (output_bfd, sreloc, &outrel);
 		}
 
 	    dr_done:
@@ -4179,7 +4281,6 @@
 	  else
 	    {
 	      Elf_Internal_Rela outrel;
-	      bfd_byte *loc;
 
 	      if (htab->elf.srelgot == NULL)
 		abort ();
@@ -4192,9 +4293,7 @@
 	      bfd_put_32 (output_bfd, 0,
 			  htab->elf.sgot->contents + off + 4);
 	      outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32);
-	      loc = htab->elf.srelgot->contents;
-	      loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
-	      bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+	      elf_append_rel (output_bfd, htab->elf.srelgot, &outrel);
 	      htab->tls_ldm_got.offset |= 1;
 	    }
 	  relocation = htab->elf.sgot->output_section->vma
@@ -4218,7 +4317,6 @@
 	    {
 	      Elf_Internal_Rela outrel;
 	      asection *sreloc;
-	      bfd_byte *loc;
 
 	      outrel.r_offset = rel->r_offset
 				+ input_section->output_section->vma
@@ -4234,9 +4332,7 @@
 	      sreloc = elf_section_data (input_section)->sreloc;
 	      if (sreloc == NULL)
 		abort ();
-	      loc = sreloc->contents;
-	      loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
-	      bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+	      elf_append_rel (output_bfd, sreloc, &outrel);
 	      if (indx)
 		continue;
 	      else if (r_type == R_386_TLS_LE_32)
@@ -4371,7 +4467,7 @@
 	  || plt == NULL
 	  || gotplt == NULL
 	  || relplt == NULL)
-	return FALSE;
+	abort ();
 
       /* Get the index in the procedure linkage table which
 	 corresponds to this symbol.  This is the index of this symbol
@@ -4441,7 +4537,7 @@
 			      + got_offset);
 	      rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32);
 	      bfd_elf32_swap_reloc_out (output_bfd, &rel,
-	      loc + sizeof (Elf32_External_Rel));
+					loc + sizeof (Elf32_External_Rel));
 	    }
 	}
       else
@@ -4524,7 +4620,6 @@
       && (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE) == 0)
     {
       Elf_Internal_Rela rel;
-      bfd_byte *loc;
 
       /* This symbol has an entry in the global offset table.  Set it
 	 up.  */
@@ -4582,15 +4677,12 @@
 	  rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT);
 	}
 
-      loc = htab->elf.srelgot->contents;
-      loc += htab->elf.srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
-      bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+      elf_append_rel (output_bfd, htab->elf.srelgot, &rel);
     }
 
   if (h->needs_copy)
     {
       Elf_Internal_Rela rel;
-      bfd_byte *loc;
 
       /* This symbol needs a copy reloc.  Set it up.  */
 
@@ -4604,9 +4696,7 @@
 		      + h->root.u.def.section->output_section->vma
 		      + h->root.u.def.section->output_offset);
       rel.r_info = ELF32_R_INFO (h->dynindx, R_386_COPY);
-      loc = htab->srelbss->contents;
-      loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rel);
-      bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
+      elf_append_rel (output_bfd, htab->srelbss, &rel);
     }
 
   return TRUE;
@@ -4631,7 +4721,9 @@
    dynamic linker, before writing them out.  */
 
 static enum elf_reloc_type_class
-elf_i386_reloc_type_class (const Elf_Internal_Rela *rela)
+elf_i386_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			   const asection *rel_sec ATTRIBUTE_UNUSED,
+			   const Elf_Internal_Rela *rela)
 {
   switch (ELF32_R_TYPE (rela->r_info))
     {
@@ -5204,19 +5296,33 @@
     0,                                  /* is_vxworks */
   };
 
+static bfd_boolean
+elf32_i386_nacl_elf_object_p (bfd *abfd)
+{
+  /* Set the right machine number for a NaCl i386 ELF32 file.  */
+  bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_i386_i386_nacl);
+  return TRUE;
+}
+
 #undef	elf_backend_arch_data
 #define elf_backend_arch_data	&elf_i386_nacl_arch_bed
 
+#undef	elf_backend_object_p
+#define elf_backend_object_p			elf32_i386_nacl_elf_object_p
 #undef	elf_backend_modify_segment_map
 #define	elf_backend_modify_segment_map		nacl_modify_segment_map
 #undef	elf_backend_modify_program_headers
 #define	elf_backend_modify_program_headers	nacl_modify_program_headers
+#undef	elf_backend_final_write_processing
+#define elf_backend_final_write_processing	nacl_final_write_processing
 
 #include "elf32-target.h"
 
 /* Restore defaults.  */
+#undef	elf_backend_object_p
 #undef	elf_backend_modify_segment_map
 #undef	elf_backend_modify_program_headers
+#undef	elf_backend_final_write_processing
 
 /* VxWorks support.  */
 
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index f50e51b..5440c8b 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -1015,7 +1015,7 @@
   insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
 
   value += rel->r_addend;
-  value += 0x8000; 
+  value += 0x8000;
   value = ((value >> 16) & 0xffff);
 
   insn = (insn & 0xffff0000) | value;
@@ -1121,12 +1121,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c
index d696a27..2ee907c 100644
--- a/bfd/elf32-ip2k.c
+++ b/bfd/elf32-ip2k.c
@@ -348,7 +348,7 @@
 {
   bfd_byte code[4];
   int table_index = 0;
-  
+
   /* Check current page-jmp.  */
   if (addr + 4 > sec->size)
     return -1;
@@ -358,7 +358,7 @@
   if ((! IS_PAGE_OPCODE (code + 0))
       || (! IS_JMP_OPCODE (code + 2)))
     return -1;
-  
+
   /* Search back.  */
   while (1)
     {
@@ -428,7 +428,7 @@
 {
   bfd_byte code[16];
   int table_index = 0;
-  
+
   /* Check current page-jmp.  */
   if (addr + 4 > sec->size)
     return -1;
@@ -437,7 +437,7 @@
   if ((! IS_PAGE_OPCODE (code + 0))
       || (! IS_JMP_OPCODE (code + 2)))
     return -1;
-  
+
   /* Search back.  */
   while (1)
     {
@@ -464,7 +464,7 @@
 	  && (IS_INC_1SP_OPCODE (code + 12))
 	  && (IS_JMP_OPCODE (code + 14)))
 	return table_index;
-      
+
       if ((! IS_PAGE_OPCODE (code + 0))
 	  || (! IS_JMP_OPCODE (code + 2)))
 	return -1;
@@ -658,11 +658,11 @@
 	      if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
 		{
 		  asection *sym_sec;
-		  
+
 		  /* A local symbol.  */
 		  isym = isymbuf + ELF32_R_SYM (irel->r_info);
 		  sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
-		  
+
 		  if (sym_sec == sec)
 		    {
 		      const char *name;
@@ -671,20 +671,20 @@
 		      bfd_vma baseaddr = BASEADDR (sec);
 		      bfd_vma symval = BASEADDR (sym_sec) + isym->st_value
 			+ irel->r_addend;
-		      
+
 		      if ((baseaddr + addr) <= symval
 			  && symval <= (baseaddr + endaddr))
 			irel->r_addend += count;
 
 		      /* Go hunt up a function and fix its line info if needed.  */
-		      stabp = stabcontents + irel->r_offset - 8; 
+		      stabp = stabcontents + irel->r_offset - 8;
 
 		      /* Go pullout the stab entry.  */
 		      type  = bfd_h_get_8 (abfd, stabp + TYPEOFF);
 		      value = bfd_h_get_32 (abfd, stabp + VALOFF);
-		      
+
 		      name = bfd_get_stab_name (type);
-		      
+
 		      if (strcmp (name, "FUN") == 0)
 			{
 			  int function_adjusted = 0;
@@ -710,7 +710,7 @@
 				    {
 				      /* Adjust the value.  */
 				      value += count;
-				  
+
 				      /* We need to put it back.  */
 				      bfd_h_put_32 (abfd, value,stabp + VALOFF);
 				    }
@@ -819,10 +819,10 @@
   /* Delete the PAGE insn.  */
   if (!ip2k_elf_relax_delete_bytes (abfd, sec, irel->r_offset, 2))
     return FALSE;
-	
+
   /* Modified => will need to iterate relaxation again.  */
   *again = TRUE;
-  
+
   return TRUE;
 }
 
@@ -837,7 +837,7 @@
   Elf_Internal_Rela *ireltest = irel;
   bfd_byte code[4];
   bfd_vma addr;
-  
+
   /* Test all page instructions.  */
   addr = irel->r_offset;
   while (1)
@@ -908,7 +908,7 @@
   Elf_Internal_Rela *ireltest = irel;
   bfd_byte code[12];
   bfd_vma addr;
-  
+
   /* Test all page instructions.  */
   addr = irel->r_offset;
 
@@ -995,7 +995,7 @@
   Elf_Internal_Rela *irel;
   int switch_table_128;
   int switch_table_256;
-  
+
   /* Walk thru the section looking for relaxation opportunities.  */
   for (irel = misc->irelbase; irel < irelend; irel++)
     {
@@ -1425,13 +1425,13 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c
index 079a962..ff7ef4a 100644
--- a/bfd/elf32-iq2000.c
+++ b/bfd/elf32-iq2000.c
@@ -290,7 +290,7 @@
   bfd_vma insn;
 
   insn = bfd_get_32 (input_bfd, contents + relhi->r_offset);
-  
+
   value += relhi->r_addend;
   value &= 0x7fffffff; /* Mask off top-bit which is Harvard mask bit.  */
 
@@ -299,7 +299,7 @@
   if (value & 0x8000)
     value += 0x10000;
 
-  value >>= 16; 
+  value >>= 16;
   insn = ((insn & ~0xFFFF) | value);
 
   bfd_put_32 (input_bfd, insn, contents + relhi->r_offset);
@@ -444,7 +444,7 @@
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.	 */
- 
+
 static bfd_boolean
 iq2000_elf_check_relocs (bfd *abfd,
 			 struct bfd_link_info *info,
@@ -456,19 +456,19 @@
   const Elf_Internal_Rela *rel;
   const Elf_Internal_Rela *rel_end;
   bfd_boolean changed = FALSE;
-  
+
   if (info->relocatable)
     return TRUE;
-  
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  
+
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
-      
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
 	h = NULL;
@@ -478,8 +478,12 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
-      
+
       switch (ELF32_R_TYPE (rel->r_info))
 	{
 	  /* This relocation describes the C++ object vtable
@@ -488,7 +492,7 @@
 	  if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
 	    return FALSE;
 	  break;
-	  
+
 	  /* This relocation describes which C++ vtable entries
 	     are actually used.  Record for later use during GC.  */
 	case R_IQ2000_GNU_VTENTRY:
@@ -584,20 +588,20 @@
       bfd_reloc_status_type	   r;
       const char *		   name = NULL;
       int			   r_type;
-      
+
       r_type = ELF32_R_TYPE (rel->r_info);
-      
+
       if (   r_type == R_IQ2000_GNU_VTINHERIT
 	  || r_type == R_IQ2000_GNU_VTENTRY)
 	continue;
-      
+
       r_symndx = ELF32_R_SYM (rel->r_info);
 
       howto  = iq2000_elf_howto_table + ELF32_R_TYPE (rel->r_info);
       h	     = NULL;
       sym    = NULL;
       sec    = NULL;
-      
+
       if (r_symndx < symtab_hdr->sh_info)
 	{
 	  asection *osec;
@@ -615,7 +619,7 @@
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
-	  
+
 	  name = bfd_elf_string_from_elf_section
 	    (input_bfd, symtab_hdr->sh_link, sym->st_name);
 	  name = (name == NULL) ? bfd_section_name (input_bfd, osec) : name;
@@ -623,12 +627,12 @@
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
@@ -674,12 +678,12 @@
 		(info, (h ? &h->root : NULL), name, howto->name,
 		 (bfd_vma) 0, input_bfd, input_section, rel->r_offset);
 	      break;
-	      
+
 	    case bfd_reloc_undefined:
 	      r = info->callbacks->undefined_symbol
 		(info, name, input_bfd, input_section, rel->r_offset, TRUE);
 	      break;
-	      
+
 	    case bfd_reloc_outofrange:
 	      msg = _("internal error: out of range error");
 	      break;
@@ -836,7 +840,7 @@
 	      break;
 	    }
 	}
-      
+
       /* Print out any mismatches from above.  */
       if (new_opt[0])
 	{
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index 8d530a4..4ebe534 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -159,7 +159,7 @@
   struct elf_lm32_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_lm32_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -172,16 +172,6 @@
       return NULL;
     }
 
-  ret->sgot = NULL;
-  ret->sgotplt = NULL;
-  ret->srelgot = NULL;
-  ret->sfixup32 = NULL;
-  ret->splt = NULL;
-  ret->srelplt = NULL;
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->relocs32 = 0;
-
   return &ret->root.root;
 }
 
@@ -785,8 +775,7 @@
   Elf_Internal_Phdr *p;
 
   /* Find the segment that contains the output_section.  */
-  for (m = elf_tdata (output_bfd)->segment_map,
-	 p = elf_tdata (output_bfd)->phdr;
+  for (m = elf_seg_map (output_bfd), p = elf_tdata (output_bfd)->phdr;
        m != NULL;
        m = m->next, p++)
     {
@@ -886,12 +875,12 @@
         {
           /* It's a global symbol.  */
           bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  name = h->root.root.string;
         }
 
@@ -1316,6 +1305,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       /* Some relocs require a global offset table.  */
@@ -1745,15 +1738,16 @@
     }
 
   /* Mark some specially defined symbols as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
-      || h == htab->root.hgot)
+  if (h == htab->root.hdynamic || h == htab->root.hgot)
     sym->st_shndx = SHN_ABS;
 
   return TRUE;
 }
 
 static enum elf_reloc_type_class
-lm32_elf_reloc_type_class (const Elf_Internal_Rela *rela)
+lm32_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			   const asection *rel_sec ATTRIBUTE_UNUSED,
+			   const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -2616,136 +2610,23 @@
 }
 
 static bfd_boolean
-lm32_elf_always_size_sections (bfd *output_bfd,
-				 struct bfd_link_info *info)
+lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
 {
   if (!info->relocatable)
     {
-      struct elf_link_hash_entry *h;
+      if (!bfd_elf_stack_segment_size (output_bfd, info,
+				       "__stacksize", DEFAULT_STACK_SIZE))
+	return FALSE;
 
-      /* Force a PT_GNU_STACK segment to be created.  */
-      if (! elf_tdata (output_bfd)->stack_flags)
-	elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
-
-      /* Define __stacksize if it's not defined yet.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (! h || h->root.type != bfd_link_hash_defined
-	  || h->type != STT_OBJECT
-	  || !h->def_regular)
-	{
-	  struct bfd_link_hash_entry *bh = NULL;
-
-	  if (!(_bfd_generic_link_add_one_symbol
-		(info, output_bfd, "__stacksize",
-		 BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
-		 (const char *) NULL, FALSE,
-		 get_elf_backend_data (output_bfd)->collect, &bh)))
-	    return FALSE;
-
-	  h = (struct elf_link_hash_entry *) bh;
-	  h->def_regular = 1;
-	  h->type = STT_OBJECT;
-	  /* This one must NOT be hidden.  */
-	}
-    }
-
-  return TRUE;
-}
-
-static bfd_boolean
-lm32_elf_modify_segment_map (bfd *output_bfd,
-			     struct bfd_link_info *info)
-{
-  struct elf_segment_map *m;
-
-  /* objcopy and strip preserve what's already there using elf32_lm32fdpic_copy_
-     private_bfd_data ().  */
-  if (! info)
-    return TRUE;
-
-  for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next)
-    if (m->p_type == PT_GNU_STACK)
-      break;
-
-  if (m)
-    {
       asection *sec = bfd_get_section_by_name (output_bfd, ".stack");
-      struct elf_link_hash_entry *h;
-
       if (sec)
-	{
-	  /* Obtain the pointer to the __stacksize symbol.  */
-	  h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				    FALSE, FALSE, FALSE);
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *)h->root.u.i.link;
-	  BFD_ASSERT (h->root.type == bfd_link_hash_defined);
-
-	  /* Set the section size from the symbol value.  We
-	     intentionally ignore the symbol section.  */
-	  if (h->root.type == bfd_link_hash_defined)
-	    sec->size = h->root.u.def.value;
-	  else
-	    sec->size = DEFAULT_STACK_SIZE;
-
-	  /* Add the stack section to the PT_GNU_STACK segment,
-	     such that its size and alignment requirements make it
-	     to the segment.  */
-	  m->sections[m->count] = sec;
-	  m->count++;
-	}
+	sec->size = info->stacksize >= 0 ? info->stacksize : 0;
     }
 
   return TRUE;
 }
 
 static bfd_boolean
-lm32_elf_modify_program_headers (bfd *output_bfd,
-				       struct bfd_link_info *info)
-{
-  struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
-  struct elf_segment_map *m;
-  Elf_Internal_Phdr *p;
-
-  if (! info)
-    return TRUE;
-
-  for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
-    if (m->p_type == PT_GNU_STACK)
-      break;
-
-  if (m)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Obtain the pointer to the __stacksize symbol.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (h)
-	{
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  BFD_ASSERT (h->root.type == bfd_link_hash_defined);
-	}
-
-      /* Set the header p_memsz from the symbol value.  We
-	 intentionally ignore the symbol section.  */
-      if (h && h->root.type == bfd_link_hash_defined)
-	p->p_memsz = h->root.u.def.value;
-      else
-	p->p_memsz = DEFAULT_STACK_SIZE;
-
-      p->p_align = 8;
-    }
-
-  return TRUE;
-}
-
-
-static bfd_boolean
 lm32_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
 {
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
@@ -2823,6 +2704,7 @@
 #define elf_backend_rela_normal                 1
 #define elf_backend_object_p                    lm32_elf_object_p
 #define elf_backend_final_write_processing      lm32_elf_final_write_processing
+#define elf_backend_stack_align			8
 #define elf_backend_can_gc_sections             1
 #define elf_backend_can_refcount                1
 #define elf_backend_gc_mark_hook                lm32_elf_gc_mark_hook
@@ -2858,10 +2740,6 @@
 
 #undef  elf_backend_always_size_sections
 #define elf_backend_always_size_sections        lm32_elf_always_size_sections
-#undef  elf_backend_modify_segment_map
-#define elf_backend_modify_segment_map          lm32_elf_modify_segment_map
-#undef  elf_backend_modify_program_headers
-#define elf_backend_modify_program_headers      lm32_elf_modify_program_headers
 #undef  bfd_elf32_bfd_copy_private_bfd_data
 #define bfd_elf32_bfd_copy_private_bfd_data     lm32_elf_fdpic_copy_private_bfd_data
 
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c
index b2b12ca..8e77c5e 100644
--- a/bfd/elf32-m32c.c
+++ b/bfd/elf32-m32c.c
@@ -28,9 +28,9 @@
 /* Forward declarations.  */
 static reloc_howto_type * m32c_reloc_type_lookup
   (bfd *, bfd_reloc_code_real_type);
-static void m32c_info_to_howto_rela 
+static void m32c_info_to_howto_rela
   (bfd *, arelent *, Elf_Internal_Rela *);
-static bfd_boolean m32c_elf_relocate_section 
+static bfd_boolean m32c_elf_relocate_section
   (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
 static bfd_boolean m32c_elf_check_relocs
   (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
@@ -268,7 +268,7 @@
   for (i = ARRAY_SIZE (m32c_reloc_map); --i;)
     if (m32c_reloc_map [i].bfd_reloc_val == code)
       return & m32c_elf_howto_table [m32c_reloc_map[i].m32c_reloc_val];
-  
+
   return NULL;
 }
 
@@ -375,7 +375,7 @@
       bfd_reloc_status_type        r;
       const char *                 name = NULL;
       int                          r_type;
-      
+
       r_type = ELF32_R_TYPE (rel->r_info);
 
       /* These are only used for relaxing; we don't actually relocate
@@ -384,7 +384,7 @@
 	  || r_type == R_M32C_RL_1ADDR
 	  || r_type == R_M32C_RL_2ADDR)
 	continue;
-      
+
       r_symndx = ELF32_R_SYM (rel->r_info);
 
       howto  = m32c_elf_howto_table + ELF32_R_TYPE (rel->r_info);
@@ -400,7 +400,7 @@
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
-	  
+
 	  name = bfd_elf_string_from_elf_section
 	    (input_bfd, symtab_hdr->sh_link, sym->st_name);
 	  name = (sym->st_name == 0) ? bfd_section_name (input_bfd, sec) : name;
@@ -408,13 +408,13 @@
       else
 	{
 	  h = sym_hashes [r_symndx - symtab_hdr->sh_info];
-	  
+
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 	  name = h->root.root.string;
-	  
+
 	  if (h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
 	    {
@@ -542,13 +542,13 @@
 		(info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0,
 		 input_bfd, input_section, rel->r_offset);
 	      break;
-	      
+
 	    case bfd_reloc_undefined:
 	      r = info->callbacks->undefined_symbol
 		(info, name, input_bfd, input_section, rel->r_offset,
 		 TRUE);
 	      break;
-	      
+
 	    case bfd_reloc_outofrange:
 	      msg = _("internal error: out of range error");
 	      break;
@@ -580,7 +580,7 @@
 
 /* We support 16-bit pointers to code above 64k by generating a thunk
    below 64k containing a JMP instruction to the final address.  */
- 
+
 static bfd_boolean
 m32c_elf_check_relocs
     (bfd *                     abfd,
@@ -595,10 +595,10 @@
   bfd_vma *local_plt_offsets;
   asection *splt;
   bfd *dynobj;
- 
+
   if (info->relocatable)
     return TRUE;
- 
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
   local_plt_offsets = elf_local_got_offsets (abfd);
@@ -611,7 +611,7 @@
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
       bfd_vma *offset;
- 
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
@@ -621,8 +621,12 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
- 
+
       switch (ELF32_R_TYPE (rel->r_info))
         {
 	  /* This relocation describes a 16-bit pointer to a function.
@@ -676,7 +680,7 @@
 	  break;
         }
     }
- 
+
   return TRUE;
 }
 
@@ -799,7 +803,7 @@
 	    case EF_M32C_CPU_M32C:  strcat (old_opt, " -m32c");  break;
 	    }
 	}
-      
+
       /* Print out any mismatches from above.  */
       if (new_opt[0])
 	{
@@ -902,7 +906,7 @@
       external_syms = bfd_malloc (1000);
       free_external = 1;
     }
-  
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   locsymcount = symtab_hdr->sh_size / get_elf_backend_data(abfd)->s->sizeof_sym;
   if (free_internal)
@@ -917,37 +921,83 @@
     {
       switch (ELF_ST_TYPE (isym->st_info))
 	{
-	case STT_FUNC: st_info_str = "STT_FUNC";
-	case STT_SECTION: st_info_str = "STT_SECTION";
-	case STT_FILE: st_info_str = "STT_FILE";
-	case STT_OBJECT: st_info_str = "STT_OBJECT";
-	case STT_TLS: st_info_str = "STT_TLS";
-	default: st_info_str = "";
+	case STT_FUNC:
+	  st_info_str = "STT_FUNC";
+	  break;
+
+	case STT_SECTION:
+	  st_info_str = "STT_SECTION";
+	  break;
+
+	case STT_FILE:
+	  st_info_str = "STT_FILE";
+	  break;
+
+	case STT_OBJECT:
+	  st_info_str = "STT_OBJECT";
+	  break;
+
+	case STT_TLS:
+	  st_info_str = "STT_TLS";
+	  break;
+
+	default:
+	  st_info_str = "";
 	}
+
       switch (ELF_ST_BIND (isym->st_info))
 	{
-	case STB_LOCAL: st_info_stb_str = "STB_LOCAL";
-	case STB_GLOBAL: st_info_stb_str = "STB_GLOBAL";
-	default: st_info_stb_str = "";
+	case STB_LOCAL:
+	  st_info_stb_str = "STB_LOCAL";
+	  break;
+
+	case STB_GLOBAL:
+	  st_info_stb_str = "STB_GLOBAL";
+	  break;
+
+	default:
+	  st_info_stb_str = "";
 	}
+
       switch (ELF_ST_VISIBILITY (isym->st_other))
 	{
-	case STV_DEFAULT: st_other_str = "STV_DEFAULT";
-	case STV_INTERNAL: st_other_str = "STV_INTERNAL";
-	case STV_PROTECTED: st_other_str = "STV_PROTECTED";
-	default: st_other_str = "";
+	case STV_DEFAULT:
+	  st_other_str = "STV_DEFAULT";
+	  break;
+
+	case STV_INTERNAL:
+	  st_other_str = "STV_INTERNAL";
+	  break;
+
+	case STV_PROTECTED:
+	  st_other_str = "STV_PROTECTED";
+	  break;
+
+	default:
+	  st_other_str = "";
 	}
+
       switch (isym->st_shndx)
 	{
-	case SHN_ABS: st_shndx_str = "SHN_ABS";
-	case SHN_COMMON: st_shndx_str = "SHN_COMMON";
-	case SHN_UNDEF: st_shndx_str = "SHN_UNDEF";
-	default: st_shndx_str = "";
+	case SHN_ABS:
+	  st_shndx_str = "SHN_ABS";
+	  break;
+
+	case SHN_COMMON:
+	  st_shndx_str = "SHN_COMMON";
+	  break;
+
+	case SHN_UNDEF:
+	  st_shndx_str = "SHN_UNDEF";
+	  break;
+
+	default:
+	  st_shndx_str = "";
 	}
-      
+
       printf ("isym = %p st_value = %lx st_size = %lx st_name = (%lu) %s "
 	      "st_info = (%d) %s %s st_other = (%d) %s st_shndx = (%d) %s\n",
-	      isym, 
+	      isym,
 	      (unsigned long) isym->st_value,
 	      (unsigned long) isym->st_size,
 	      isym->st_name,
@@ -1579,7 +1629,7 @@
 
 	      enctbl = m16c_addr_encodings;
 	      posn = 2;
-	      
+
 	      /* Check the opcode for jumps.  We know it's safe to
 		 do this because all 2ADDR insns are at least two
 		 bytes long.  */
@@ -1765,7 +1815,7 @@
       /* Note that we've changed the relocs, section contents, etc.  */
       elf_section_data (sec)->relocs = internal_relocs;
       free_relocs = NULL;
-      
+
       elf_section_data (sec)->this_hdr.contents = contents;
       free_contents = NULL;
 
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index e3e3bb0..71e8fc7 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1,6 +1,5 @@
 /* M32R-specific support for 32-bit ELF.
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+   Copyright 1996-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -1390,7 +1389,8 @@
 						  flags);
 	  if (s == NULL)
 	    return FALSE;
-	  bfd_set_section_alignment (abfd, s, 2);
+	  if (! bfd_set_section_alignment (abfd, s, 2))
+	    return FALSE;
 	}
 
       bh = bfd_link_hash_lookup (info->hash, "_SDA_BASE_",
@@ -1585,7 +1585,7 @@
   struct elf_m32r_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_m32r_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -1598,15 +1598,6 @@
       return NULL;
     }
 
-  ret->sgot = NULL;
-  ret->sgotplt = NULL;
-  ret->srelgot = NULL;
-  ret->splt = NULL;
-  ret->srelplt = NULL;
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->sym_cache.abfd = NULL;
-
   return &ret->root.root;
 }
 
@@ -3295,8 +3286,7 @@
     }
 
   /* Mark some specially defined symbols as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
-      || h == htab->root.hgot)
+  if (h == htab->root.hdynamic || h == htab->root.hgot)
     sym->st_shndx = SHN_ABS;
 
   return TRUE;
@@ -3756,6 +3746,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       /* Some relocs require a global offset table.  */
@@ -3991,7 +3985,9 @@
 };
 
 static enum elf_reloc_type_class
-m32r_elf_reloc_type_class (const Elf_Internal_Rela *rela)
+m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			   const asection *rel_sec ATTRIBUTE_UNUSED,
+			   const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index d862c9f..f5f68bc 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -67,11 +67,10 @@
   struct m68hc11_elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table);
 
-  ret = (struct m68hc11_elf_link_hash_table *) bfd_malloc (amt);
+  ret = (struct m68hc11_elf_link_hash_table *) bfd_zmalloc (amt);
   if (ret == (struct m68hc11_elf_link_hash_table *) NULL)
     return NULL;
 
-  memset (ret, 0, amt);
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
 				      _bfd_elf_link_hash_newfunc,
 				      sizeof (struct elf_link_hash_entry),
@@ -93,11 +92,6 @@
 			    sizeof (struct elf32_m68hc11_stub_hash_entry)))
     return NULL;
 
-  ret->stub_bfd = NULL;
-  ret->stub_section = 0;
-  ret->add_stub_section = NULL;
-  ret->sym_cache.abfd = NULL;
-
   return ret;
 }
 
@@ -111,7 +105,7 @@
 
   bfd_hash_table_free (ret->stub_hash_table);
   free (ret->stub_hash_table);
-  _bfd_generic_link_hash_table_free (hash);
+  _bfd_elf_link_hash_table_free (hash);
 }
 
 /* Assorted hash table functions.  */
@@ -667,7 +661,7 @@
   /* Build the stubs as directed by the stub hash table.  */
   table = htab->stub_hash_table;
   bfd_hash_traverse (table, m68hc11_elf_export_one_stub, info);
-  
+
   /* Scan the output sections to see if we use the memory banks.
      If so, export the symbols that define how the memory banks
      are mapped.  This is used by gdb and the simulator to obtain
@@ -877,6 +871,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
@@ -918,9 +916,11 @@
   struct m68hc11_page_info *pinfo;
   const struct elf_backend_data * const ebd = get_elf_backend_data (input_bfd);
   struct m68hc11_elf_link_hash_table *htab;
+  unsigned long e_flags;
 
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
+  e_flags = elf_elfheader (input_bfd)->e_flags;
 
   htab = m68hc11_elf_hash_table (info);
   if (htab == NULL)
@@ -948,6 +948,8 @@
       bfd_vma insn_addr;
       bfd_vma insn_page;
       bfd_boolean is_far = FALSE;
+      bfd_boolean is_xgate_symbol = FALSE;
+      bfd_boolean is_section_symbol = FALSE;
       struct elf_link_hash_entry *h;
       bfd_vma val;
 
@@ -955,7 +957,7 @@
       r_type = ELF32_R_TYPE (rel->r_info);
 
       if (r_type == R_M68HC11_GNU_VTENTRY
-          || r_type == R_M68HC11_GNU_VTINHERIT )
+          || r_type == R_M68HC11_GNU_VTINHERIT)
         continue;
 
       (*ebd->elf_info_to_howto_rel) (input_bfd, &arel, rel);
@@ -972,17 +974,20 @@
 			+ sec->output_offset
 			+ sym->st_value);
 	  is_far = (sym && (sym->st_other & STO_M68HC12_FAR));
+	  is_xgate_symbol = (sym && (sym->st_target_internal));
+	  is_section_symbol = ELF_ST_TYPE (sym->st_info) & STT_SECTION;
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation, unresolved_reloc,
-				   warned);
+				   warned, ignored);
 
 	  is_far = (h && (h->other & STO_M68HC12_FAR));
+	  is_xgate_symbol = (h && (h->target_internal));
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -1043,7 +1048,7 @@
              a LO8XG. Does not actually check that it was a LO8XG.
 	     Adjusts high and low bytes.  */
           relocation = phys_addr;
-          if ((elf_elfheader (input_bfd)->e_flags & E_M68HC11_XGATE_RAMOFFSET)
+          if ((e_flags & E_M68HC11_XGATE_RAMOFFSET)
 	      && (relocation >= 0x2000))
 	    relocation += 0xc000; /* HARDCODED RAM offset for XGATE.  */
 
@@ -1110,7 +1115,7 @@
                       "relocation may result in incorrect execution");
               buf = alloca (strlen (msg) + strlen (name) + 10);
               sprintf (buf, msg, name);
-              
+
               (* info->callbacks->warning)
                 (info, buf, name, input_bfd, NULL, rel->r_offset);
             }
@@ -1122,12 +1127,45 @@
 
           insn_page = m68hc11_phys_page (pinfo, insn_addr);
 
+         /* If we are linking an S12 instruction against an XGATE symbol, we
+            need to change the offset of the symbol value so that it's correct
+	    from the S12's perspective.  */
+          if (is_xgate_symbol)
+	    {
+	      /* The ram in the global space is mapped to 0x2000 in the 16-bit
+		 address space for S12 and 0xE000 in the 16-bit address space
+		 for XGATE.  */
+	      if (relocation >= 0xE000)
+		{
+		  /* We offset the address by the difference
+		     between these two mappings.  */
+		  relocation -= 0xC000;
+		  break;
+		}
+	      else
+		{
+		  const char * msg;
+		  char * buf;
+
+		  msg = _("XGATE address (%lx) is not within shared RAM"
+			  "(0xE000-0xFFFF), therefore you must manually offset "
+			  "the address, and possibly manage the page, in your "
+			  "code.");
+		  buf = alloca (strlen (msg) + 128);
+		  sprintf (buf, msg, phys_addr);
+		  if (!((*info->callbacks->warning) (info, buf, name, input_bfd,
+						     input_section, insn_addr)))
+		    return FALSE;
+		  break;
+		}
+	    }
+
           if (m68hc11_addr_is_banked (pinfo, relocation + rel->r_addend)
               && m68hc11_addr_is_banked (pinfo, insn_addr)
-              && phys_page != insn_page)
+              && phys_page != insn_page && !(e_flags & E_M68HC11_NO_BANK_WARNING))
             {
-              const char* msg;
-              char* buf;
+              const char * msg;
+              char * buf;
 
               msg = _("banked address [%lx:%04lx] (%lx) is not in the same bank "
                       "as current banked address [%lx:%04lx] (%lx)");
@@ -1143,10 +1181,11 @@
                 return FALSE;
               break;
             }
+
           if (phys_page != 0 && insn_page == 0)
             {
-              const char* msg;
-              char* buf;
+              const char * msg;
+              char * buf;
 
               msg = _("reference to a banked address [%lx:%04lx] in the "
                       "normal address space at %04lx");
@@ -1169,6 +1208,45 @@
           break;
         }
 
+      /* If we are linking an XGATE instruction against an S12 symbol, we
+         need to change the offset of the symbol value so that it's correct
+	 from the XGATE's perspective.  */
+      if (!strcmp (howto->name, "R_XGATE_IMM8_LO")
+          || !strcmp (howto->name, "R_XGATE_IMM8_HI"))
+        {
+          /* We can only offset S12 addresses that lie within the non-paged
+             area of RAM.  */
+          if (!is_xgate_symbol && !is_section_symbol)
+            {
+              /* The ram in the global space is mapped to 0x2000 and stops at
+                 0x4000 in the 16-bit address space for S12 and 0xE000 in the
+                 16-bit address space for XGATE.  */
+              if (relocation >= 0x2000 && relocation < 0x4000)
+                 /* We offset the address by the difference
+                   between these two mappings.  */
+                relocation += 0xC000;
+              else
+                {
+                  const char * msg;
+                  char * buf;
+
+                  /* Get virtual address of instruction having the relocation.  */
+                  insn_addr = input_section->output_section->vma
+                      + input_section->output_offset + rel->r_offset;
+
+                  msg = _("S12 address (%lx) is not within shared RAM"
+                      "(0x2000-0x4000), therefore you must manually "
+                      "offset the address in your code");
+                  buf = alloca (strlen (msg) + 128);
+                  sprintf (buf, msg, phys_addr);
+                  if (!((*info->callbacks->warning) (info, buf, name, input_bfd,
+						     input_section, insn_addr)))
+                    return FALSE;
+                  break;
+                }
+            }
+        }
+
       if (r_type != R_M68HC11_NONE)
         {
           if ((r_type == R_M68HC12_PCREL_9) || (r_type == R_M68HC12_PCREL_10))
@@ -1363,7 +1441,7 @@
   else if (elf_elfheader (abfd)->e_flags & EF_M68HCS12_MACH)
     fprintf (file, _("cpu=HCS12]"));
   else
-    fprintf (file, _("cpu=HC12]"));    
+    fprintf (file, _("cpu=HC12]"));
 
   if (elf_elfheader (abfd)->e_flags & E_M68HC12_BANKS)
     fprintf (file, _(" [memory=bank-model]"));
@@ -1386,7 +1464,7 @@
   if (asect->vma >= p->pinfo->bank_virtual)
     p->use_memory_banks = TRUE;
 }
-  
+
 /* Tweak the OSABI field of the elf header.  */
 
 void
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 6946841..d8e3be1 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -1,6 +1,6 @@
 /* Motorola 68k series support for 32-bit ELF
    Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -950,7 +950,7 @@
   struct elf_m68k_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_m68k_link_hash_table);
 
-  ret = (struct elf_m68k_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf_m68k_link_hash_table *) bfd_zmalloc (amt);
   if (ret == (struct elf_m68k_link_hash_table *) NULL)
     return NULL;
 
@@ -963,12 +963,6 @@
       return NULL;
     }
 
-  ret->sym_cache.abfd = NULL;
-  ret->plt_info = NULL;
-  ret->local_gp_p = FALSE;
-  ret->use_neg_got_offsets_p = FALSE;
-  ret->allow_multigot_p = FALSE;
-  ret->multi_got_.bfd2got = NULL;
   ret->multi_got_.global_symndx = 1;
 
   return &ret->root.root;
@@ -988,6 +982,7 @@
       htab_delete (htab->multi_got_.bfd2got);
       htab->multi_got_.bfd2got = NULL;
     }
+  _bfd_elf_link_hash_table_free (_htab);
 }
 
 /* Set the right machine number.  */
@@ -2589,6 +2584,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
@@ -3368,7 +3367,7 @@
 #define add_dynamic_entry(TAG, VAL) \
   _bfd_elf_add_dynamic_entry (info, TAG, VAL)
 
-      if (!info->shared)
+      if (info->executable)
 	{
 	  if (!add_dynamic_entry (DT_DEBUG, 0))
 	    return FALSE;
@@ -3670,12 +3669,12 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -4742,7 +4741,9 @@
 }
 
 static enum elf_reloc_type_class
-elf32_m68k_reloc_type_class (const Elf_Internal_Rela *rela)
+elf32_m68k_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			     const asection *rel_sec ATTRIBUTE_UNUSED,
+			     const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -4782,10 +4783,10 @@
 
     case 154:		/* Linux/m68k */
       /* pr_cursig */
-      elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+      elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
       /* pr_pid */
-      elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
+      elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 22);
 
       /* pr_reg */
       offset = 70;
@@ -4808,11 +4809,11 @@
       return FALSE;
 
     case 124:		/* Linux/m68k elf_prpsinfo.  */
-      elf_tdata (abfd)->core_pid
+      elf_tdata (abfd)->core->pid
 	= bfd_get_32 (abfd, note->descdata + 12);
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
 	= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
     }
 
@@ -4820,7 +4821,7 @@
      onto the end of the args in some (at least one anyway)
      implementations, so strip it off if it exists.  */
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (n > 0 && command[n - 1] == ' ')
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index 288394f..8eb74c5 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -458,12 +458,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -613,6 +613,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c
index f356fd0..2204488 100644
--- a/bfd/elf32-mep.c
+++ b/bfd/elf32-mep.c
@@ -490,12 +490,12 @@
 	}
       else
 	{
-	  bfd_boolean warned, unresolved_reloc;
+	  bfd_boolean warned, unresolved_reloc, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel,
 				  r_symndx, symtab_hdr, sym_hashes,
 				  h, sec, relocation,
-				  unresolved_reloc, warned);
+				  unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
new file mode 100644
index 0000000..9c11dd3
--- /dev/null
+++ b/bfd/elf32-metag.c
@@ -0,0 +1,4325 @@
+/* Meta support for 32-bit ELF
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   Contributed by Imagination Technologies Ltd.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf32-metag.h"
+#include "elf/metag.h"
+
+#define GOT_ENTRY_SIZE 4
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+/* ABI version:
+    0 - original
+    1 - with GOT offset */
+#define METAG_ELF_ABI_VERSION 1
+
+static const unsigned int plt0_entry[] =
+  {
+    0x02000005, /* MOVT D0Re0, #HI(GOT+4) */
+    0x02000000, /* ADD  D0Re0, D0Re0, #LO(GOT+4) */
+    0xb70001e3, /* SETL [A0StP++], D0Re0, D1Re0 */
+    0xc600012a, /* GETD PC, [D0Re0+#4] */
+    0xa0fffffe  /* NOP */
+  };
+
+static const unsigned int plt0_pic_entry[] =
+  {
+    0x82900001, /* ADDT A0.2, CPC0, #0 */
+    0x82100000, /* ADD  A0.2, A0.2, #0 */
+    0xa3100c20, /* MOV  D0Re0, A0.2 */
+    0xb70001e3, /* SETL [A0StP++], D0Re0, D1Re0 */
+    0xc600012a, /* GETD PC, [D0Re0+#4] */
+  };
+
+static const unsigned int plt_entry[] =
+  {
+    0x82100005, /* MOVT A0.2, #HI(GOT+off) */
+    0x82100000, /* ADD  A0.2, A0.2, #LO(GOT+off) */
+    0xc600806a, /* GETD PC, [A0.2] */
+    0x03000004, /* MOV  D1Re0, #LO(offset) */
+    0xa0000000  /* B    PLT0 */
+  };
+
+static const unsigned int plt_pic_entry[] =
+  {
+    0x82900001, /* ADDT A0.2, CPC0, #HI(GOT+off) */
+    0x82100000, /* ADD  A0.2, A0.2, #LO(GOT+off) */
+    0xc600806a, /* GETD PC, [A0.2] */
+    0x03000004, /* MOV  D1Re0, #LO(offset) */
+    0xa0000000  /* B    PLT0 */
+  };
+
+/* Variable names follow a coding style.
+   Please follow this (Apps Hungarian) style:
+
+   Structure/Variable              Prefix
+   elf_link_hash_table             "etab"
+   elf_link_hash_entry             "eh"
+
+   elf_metag_link_hash_table       "htab"
+   elf_metag_link_hash_entry       "hh"
+
+   bfd_link_hash_table             "btab"
+   bfd_link_hash_entry             "bh"
+
+   bfd_hash_table containing stubs "bstab"
+   elf_metag_stub_hash_entry       "hsh"
+
+   elf_metag_dyn_reloc_entry       "hdh"
+
+   Always remember to use GNU Coding Style.  */
+
+#define PLT_ENTRY_SIZE sizeof(plt_entry)
+
+static reloc_howto_type elf_metag_howto_table[] =
+{
+  /* High order 16 bit absolute.  */
+  HOWTO (R_METAG_HIADDR16,	/* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_HIADDR16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Low order 16 bit absolute.  */
+  HOWTO (R_METAG_LOADDR16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_LOADDR16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* 32 bit absolute.  */
+  HOWTO (R_METAG_ADDR32,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_ADDR32",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* No relocation.  */
+  HOWTO (R_METAG_NONE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_NONE",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* 19 bit pc relative */
+  HOWTO (R_METAG_RELBRANCH,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 19,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 5,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_RELBRANCH",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x00ffffe0,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* GET/SET offset */
+  HOWTO (R_METAG_GETSETOFF,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 12,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 7,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_GETSETOFF",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  EMPTY_HOWTO (6),
+  EMPTY_HOWTO (7),
+  EMPTY_HOWTO (8),
+  EMPTY_HOWTO (9),
+  EMPTY_HOWTO (10),
+  EMPTY_HOWTO (11),
+  EMPTY_HOWTO (12),
+  EMPTY_HOWTO (13),
+  EMPTY_HOWTO (14),
+  EMPTY_HOWTO (15),
+  EMPTY_HOWTO (16),
+  EMPTY_HOWTO (17),
+  EMPTY_HOWTO (18),
+  EMPTY_HOWTO (19),
+  EMPTY_HOWTO (20),
+  EMPTY_HOWTO (21),
+  EMPTY_HOWTO (22),
+  EMPTY_HOWTO (23),
+  EMPTY_HOWTO (24),
+  EMPTY_HOWTO (25),
+  EMPTY_HOWTO (26),
+  EMPTY_HOWTO (27),
+  EMPTY_HOWTO (28),
+  EMPTY_HOWTO (29),
+
+  HOWTO (R_METAG_GNU_VTINHERIT, /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 FALSE,		/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 NULL,			/* special_function */
+	 "R_METAG_GNU_VTINHERIT", /* name */
+	 FALSE,		/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_GNU_VTENTRY,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_elf_rel_vtable_reloc_fn, /* special_function */
+	 "R_METAG_GNU_VTENTRY",  /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* High order 16 bit GOT offset */
+  HOWTO (R_METAG_HI16_GOTOFF,	/* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_HI16_GOTOFF", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Low order 16 bit GOT offset */
+  HOWTO (R_METAG_LO16_GOTOFF,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_LO16_GOTOFF", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* GET/SET GOT offset */
+  HOWTO (R_METAG_GETSET_GOTOFF, /* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 12,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 7,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_GETSET_GOTOFF", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* GET/SET GOT relative */
+  HOWTO (R_METAG_GETSET_GOT,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 12,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 7,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_GETSET_GOT",  /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* High order 16 bit GOT reference */
+  HOWTO (R_METAG_HI16_GOTPC,	/* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_HI16_GOTPC",  /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Low order 16 bit GOT reference */
+  HOWTO (R_METAG_LO16_GOTPC,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_LO16_GOTPC",  /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* High order 16 bit PLT */
+  HOWTO (R_METAG_HI16_PLT,	/* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_HI16_PLT",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Low order 16 bit PLT */
+  HOWTO (R_METAG_LO16_PLT,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_LO16_PLT",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_RELBRANCH_PLT, /* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 19,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 5,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_RELBRANCH_PLT", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x00ffffe0,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Dummy relocs used by the linker internally.  */
+  HOWTO (R_METAG_GOTOFF,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_GOTOFF",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_PLT,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_GOTOFF",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* This is used only by the dynamic linker.  The symbol should exist
+     both in the object being run and in some shared library.  The
+     dynamic linker copies the data addressed by the symbol from the
+     shared library into the object, because the object being
+     run has to have the data at some particular address.  */
+  HOWTO (R_METAG_COPY,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_COPY",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Marks a procedure linkage table entry for a symbol.  */
+  HOWTO (R_METAG_JMP_SLOT,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_JMP_SLOT",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Used only by the dynamic linker.  When the object is run, this
+     longword is set to the load address of the object, plus the
+     addend.  */
+  HOWTO (R_METAG_RELATIVE,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_RELATIVE",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_GLOB_DAT,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_GLOB_DAT",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_GD,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_GD",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_LDM,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_LDM",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_LDO_HI16,	/* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_LDO_HI16", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_LDO_LO16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_LDO_LO16", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Dummy reloc used by the linker internally.  */
+  HOWTO (R_METAG_TLS_LDO,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_LDO",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_IE,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 12,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 7,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_IE",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007ff80,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Dummy reloc used by the linker internally.  */
+  HOWTO (R_METAG_TLS_IENONPIC,  /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_IENONPIC", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_IENONPIC_HI16,/* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_IENONPIC_HI16", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_IENONPIC_LO16,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_IENONPIC_LO16", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_TPOFF,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_TPOFF",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_DTPMOD,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_DTPMOD",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_DTPOFF,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_DTPOFF",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Dummy reloc used by the linker internally.  */
+  HOWTO (R_METAG_TLS_LE,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_LE",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_LE_HI16,	/* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_LE_HI16", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_METAG_TLS_LE_LO16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 3,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_METAG_TLS_LE_LO16", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0007fff8,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+};
+
+#define BRANCH_BITS 19
+
+/* The GOT is typically accessed using a [GS]ETD instruction. The size of the
+   immediate offset which can be used in such instructions therefore limits
+   the usable size of the GOT. If the base register for the [GS]ETD (A1LbP)
+   is pointing to the base of the GOT then the size is limited to the maximum
+   11 bits unsigned dword offset, or 2^13 = 0x2000 bytes. However the offset
+   in a [GS]ETD instruction is signed, so by setting the base address register
+   to an offset of that 0x2000 byte maximum unsigned offset from the base of
+   the GOT we can use negative offsets in addition to positive. This
+   effectively doubles the usable GOT size to 0x4000 bytes.  */
+#define GOT_REG_OFFSET 0x2000
+
+struct metag_reloc_map
+{
+  bfd_reloc_code_real_type bfd_reloc_val;
+  unsigned int metag_reloc_val;
+};
+
+static const struct metag_reloc_map metag_reloc_map [] =
+  {
+    { BFD_RELOC_NONE,                R_METAG_NONE },
+    { BFD_RELOC_32,                  R_METAG_ADDR32 },
+    { BFD_RELOC_METAG_HIADDR16,      R_METAG_HIADDR16 },
+    { BFD_RELOC_METAG_LOADDR16,      R_METAG_LOADDR16 },
+    { BFD_RELOC_METAG_RELBRANCH,     R_METAG_RELBRANCH },
+    { BFD_RELOC_METAG_GETSETOFF,     R_METAG_GETSETOFF },
+    { BFD_RELOC_VTABLE_INHERIT,      R_METAG_GNU_VTINHERIT },
+    { BFD_RELOC_VTABLE_ENTRY,        R_METAG_GNU_VTENTRY },
+    { BFD_RELOC_METAG_REL8,          R_METAG_REL8 },
+    { BFD_RELOC_METAG_REL16,         R_METAG_REL16 },
+    { BFD_RELOC_METAG_HI16_GOTOFF,   R_METAG_HI16_GOTOFF },
+    { BFD_RELOC_METAG_LO16_GOTOFF,   R_METAG_LO16_GOTOFF },
+    { BFD_RELOC_METAG_GETSET_GOTOFF, R_METAG_GETSET_GOTOFF },
+    { BFD_RELOC_METAG_GETSET_GOT,    R_METAG_GETSET_GOT },
+    { BFD_RELOC_METAG_HI16_GOTPC,    R_METAG_HI16_GOTPC },
+    { BFD_RELOC_METAG_LO16_GOTPC,    R_METAG_LO16_GOTPC },
+    { BFD_RELOC_METAG_HI16_PLT,      R_METAG_HI16_PLT },
+    { BFD_RELOC_METAG_LO16_PLT,      R_METAG_LO16_PLT },
+    { BFD_RELOC_METAG_RELBRANCH_PLT, R_METAG_RELBRANCH_PLT },
+    { BFD_RELOC_METAG_GOTOFF,        R_METAG_GOTOFF },
+    { BFD_RELOC_METAG_PLT,           R_METAG_PLT },
+    { BFD_RELOC_METAG_COPY,          R_METAG_COPY },
+    { BFD_RELOC_METAG_JMP_SLOT,      R_METAG_JMP_SLOT },
+    { BFD_RELOC_METAG_RELATIVE,      R_METAG_RELATIVE },
+    { BFD_RELOC_METAG_GLOB_DAT,      R_METAG_GLOB_DAT },
+    { BFD_RELOC_METAG_TLS_GD,        R_METAG_TLS_GD },
+    { BFD_RELOC_METAG_TLS_LDM,       R_METAG_TLS_LDM },
+    { BFD_RELOC_METAG_TLS_LDO_HI16,  R_METAG_TLS_LDO_HI16 },
+    { BFD_RELOC_METAG_TLS_LDO_LO16,  R_METAG_TLS_LDO_LO16 },
+    { BFD_RELOC_METAG_TLS_LDO,       R_METAG_TLS_LDO },
+    { BFD_RELOC_METAG_TLS_IE,        R_METAG_TLS_IE },
+    { BFD_RELOC_METAG_TLS_IENONPIC,  R_METAG_TLS_IENONPIC },
+    { BFD_RELOC_METAG_TLS_IENONPIC_HI16, R_METAG_TLS_IENONPIC_HI16 },
+    { BFD_RELOC_METAG_TLS_IENONPIC_LO16, R_METAG_TLS_IENONPIC_LO16 },
+    { BFD_RELOC_METAG_TLS_TPOFF,     R_METAG_TLS_TPOFF },
+    { BFD_RELOC_METAG_TLS_DTPMOD,    R_METAG_TLS_DTPMOD },
+    { BFD_RELOC_METAG_TLS_DTPOFF,    R_METAG_TLS_DTPOFF },
+    { BFD_RELOC_METAG_TLS_LE,        R_METAG_TLS_LE },
+    { BFD_RELOC_METAG_TLS_LE_HI16,   R_METAG_TLS_LE_HI16 },
+    { BFD_RELOC_METAG_TLS_LE_LO16,   R_METAG_TLS_LE_LO16 },
+  };
+
+enum elf_metag_stub_type
+{
+  metag_stub_long_branch,
+  metag_stub_long_branch_shared,
+  metag_stub_none
+};
+
+struct elf_metag_stub_hash_entry
+{
+  /* Base hash table entry structure.  */
+  struct bfd_hash_entry bh_root;
+
+  /* The stub section.  */
+  asection *stub_sec;
+
+  /* Offset within stub_sec of the beginning of this stub.  */
+  bfd_vma stub_offset;
+
+  /* Given the symbol's value and its section we can determine its final
+     value when building the stubs (so the stub knows where to jump.  */
+  bfd_vma target_value;
+  asection *target_section;
+
+  enum elf_metag_stub_type stub_type;
+
+  /* The symbol table entry, if any, that this was derived from.  */
+  struct elf_metag_link_hash_entry *hh;
+
+  /* And the reloc addend that this was derived from.  */
+  bfd_vma addend;
+
+  /* Where this stub is being called from, or, in the case of combined
+     stub sections, the first input section in the group.  */
+  asection *id_sec;
+};
+
+struct elf_metag_link_hash_entry
+{
+  struct elf_link_hash_entry eh;
+
+  /* A pointer to the most recently used stub hash entry against this
+     symbol.  */
+  struct elf_metag_stub_hash_entry *hsh_cache;
+
+  /* Used to count relocations for delayed sizing of relocation
+     sections.  */
+  struct elf_metag_dyn_reloc_entry {
+
+    /* Next relocation in the chain.  */
+    struct elf_metag_dyn_reloc_entry *hdh_next;
+
+    /* The input section of the reloc.  */
+    asection *sec;
+
+    /* Number of relocs copied in this section.  */
+    bfd_size_type count;
+
+    /* Number of relative relocs copied for the input section.  */
+    bfd_size_type relative_count;
+  } *dyn_relocs;
+
+  enum
+    {
+      GOT_UNKNOWN = 0, GOT_NORMAL = 1, GOT_TLS_IE = 2, GOT_TLS_LDM = 4, GOT_TLS_GD = 8
+    } tls_type;
+};
+
+struct elf_metag_link_hash_table
+{
+  /* The main hash table.  */
+  struct elf_link_hash_table etab;
+
+  /* The stub hash table.  */
+  struct bfd_hash_table bstab;
+
+  /* Linker stub bfd.  */
+  bfd *stub_bfd;
+
+  /* Linker call-backs.  */
+  asection * (*add_stub_section) (const char *, asection *);
+  void (*layout_sections_again) (void);
+
+  /* Array to keep track of which stub sections have been created, and
+     information on stub grouping.  */
+  struct map_stub
+  {
+    /* This is the section to which stubs in the group will be
+       attached.  */
+    asection *link_sec;
+    /* The stub section.  */
+    asection *stub_sec;
+  } *stub_group;
+
+  /* Assorted information used by elf_metag_size_stubs.  */
+  unsigned int bfd_count;
+  int top_index;
+  asection **input_list;
+  Elf_Internal_Sym **all_local_syms;
+
+  /* Short-cuts to get to dynamic linker sections.  */
+  asection *sgot;
+  asection *sgotplt;
+  asection *srelgot;
+  asection *splt;
+  asection *srelplt;
+  asection *sdynbss;
+  asection *srelbss;
+
+  /* Small local sym cache.  */
+  struct sym_cache sym_cache;
+
+  /* Data for LDM relocations.  */
+  union
+  {
+    bfd_signed_vma refcount;
+    bfd_vma offset;
+  } tls_ldm_got;
+};
+
+/* Return the base vma address which should be subtracted from the
+   real address when resolving a dtpoff relocation.  This is PT_TLS
+   segment p_vaddr.  */
+static bfd_vma
+dtpoff_base (struct bfd_link_info *info)
+{
+  /* If tls_sec is NULL, we should have signalled an error already.  */
+  if (elf_hash_table (info)->tls_sec == NULL)
+    return 0;
+  return elf_hash_table (info)->tls_sec->vma;
+}
+
+/* Return the relocation value for R_METAG_TLS_IE */
+static bfd_vma
+tpoff (struct bfd_link_info *info, bfd_vma address)
+{
+  /* If tls_sec is NULL, we should have signalled an error already.  */
+  if (elf_hash_table (info)->tls_sec == NULL)
+    return 0;
+  /* METAG TLS ABI is variant I and static TLS blocks start just after
+     tcbhead structure which has 2 pointer fields.  */
+  return (address - elf_hash_table (info)->tls_sec->vma
+	  + align_power ((bfd_vma) 8,
+			 elf_hash_table (info)->tls_sec->alignment_power));
+}
+
+static void
+metag_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
+			  arelent *cache_ptr,
+			  Elf_Internal_Rela *dst)
+{
+  unsigned int r_type;
+
+  r_type = ELF32_R_TYPE (dst->r_info);
+  BFD_ASSERT (r_type < (unsigned int) R_METAG_MAX);
+  cache_ptr->howto = & elf_metag_howto_table [r_type];
+}
+
+static reloc_howto_type *
+metag_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
+			 bfd_reloc_code_real_type code)
+{
+  unsigned int i;
+
+  for (i = 0; i < sizeof (metag_reloc_map) / sizeof (metag_reloc_map[0]); i++)
+    if (metag_reloc_map [i].bfd_reloc_val == code)
+      return & elf_metag_howto_table [metag_reloc_map[i].metag_reloc_val];
+
+  return NULL;
+}
+
+static reloc_howto_type *
+metag_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+			 const char *r_name)
+{
+  unsigned int i;
+
+  for (i = 0; i < sizeof (elf_metag_howto_table) / sizeof (elf_metag_howto_table[0]); i++)
+    if (elf_metag_howto_table[i].name != NULL
+	&& strcasecmp (elf_metag_howto_table[i].name, r_name) == 0)
+      return &elf_metag_howto_table[i];
+
+  return NULL;
+}
+
+/* Various hash macros and functions.  */
+#define metag_link_hash_table(p) \
+  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+  == METAG_ELF_DATA ? ((struct elf_metag_link_hash_table *) ((p)->hash)) : NULL)
+
+#define metag_elf_hash_entry(ent) \
+  ((struct elf_metag_link_hash_entry *)(ent))
+
+#define metag_stub_hash_entry(ent) \
+  ((struct elf_metag_stub_hash_entry *)(ent))
+
+#define metag_stub_hash_lookup(table, string, create, copy) \
+  ((struct elf_metag_stub_hash_entry *) \
+   bfd_hash_lookup ((table), (string), (create), (copy)))
+
+#define metag_elf_local_got_tls_type(abfd) \
+  ((char *)(elf_local_got_offsets (abfd) + (elf_tdata (abfd)->symtab_hdr.sh_info)))
+
+/* Assorted hash table functions.  */
+
+/* Initialize an entry in the stub hash table.  */
+
+static struct bfd_hash_entry *
+stub_hash_newfunc (struct bfd_hash_entry *entry,
+		   struct bfd_hash_table *table,
+		   const char *string)
+{
+  /* Allocate the structure if it has not already been allocated by a
+     subclass.  */
+  if (entry == NULL)
+    {
+      entry = bfd_hash_allocate (table,
+				 sizeof (struct elf_metag_stub_hash_entry));
+      if (entry == NULL)
+	return entry;
+    }
+
+  /* Call the allocation method of the superclass.  */
+  entry = bfd_hash_newfunc (entry, table, string);
+  if (entry != NULL)
+    {
+      struct elf_metag_stub_hash_entry *hsh;
+
+      /* Initialize the local fields.  */
+      hsh = (struct elf_metag_stub_hash_entry *) entry;
+      hsh->stub_sec = NULL;
+      hsh->stub_offset = 0;
+      hsh->target_value = 0;
+      hsh->target_section = NULL;
+      hsh->stub_type = metag_stub_long_branch;
+      hsh->hh = NULL;
+      hsh->id_sec = NULL;
+    }
+
+  return entry;
+}
+
+/* Initialize an entry in the link hash table.  */
+
+static struct bfd_hash_entry *
+metag_link_hash_newfunc (struct bfd_hash_entry *entry,
+			 struct bfd_hash_table *table,
+			 const char *string)
+{
+  /* Allocate the structure if it has not already been allocated by a
+     subclass.  */
+  if (entry == NULL)
+    {
+      entry = bfd_hash_allocate (table,
+				 sizeof (struct elf_metag_link_hash_entry));
+      if (entry == NULL)
+	return entry;
+    }
+
+  /* Call the allocation method of the superclass.  */
+  entry = _bfd_elf_link_hash_newfunc (entry, table, string);
+  if (entry != NULL)
+    {
+      struct elf_metag_link_hash_entry *hh;
+
+      /* Initialize the local fields.  */
+      hh = (struct elf_metag_link_hash_entry *) entry;
+      hh->hsh_cache = NULL;
+      hh->dyn_relocs = NULL;
+      hh->tls_type = GOT_UNKNOWN;
+    }
+
+  return entry;
+}
+
+/* Create the derived linker hash table.  The Meta ELF port uses the derived
+   hash table to keep information specific to the Meta ELF linker (without
+   using static variables).  */
+
+static struct bfd_link_hash_table *
+elf_metag_link_hash_table_create (bfd *abfd)
+{
+  struct elf_metag_link_hash_table *htab;
+  bfd_size_type amt = sizeof (*htab);
+
+  htab = bfd_zmalloc (amt);
+  if (htab == NULL)
+    return NULL;
+
+  if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd,
+				      metag_link_hash_newfunc,
+				      sizeof (struct elf_metag_link_hash_entry),
+				      METAG_ELF_DATA))
+    {
+      free (htab);
+      return NULL;
+    }
+
+  /* Init the stub hash table too.  */
+  if (!bfd_hash_table_init (&htab->bstab, stub_hash_newfunc,
+			    sizeof (struct elf_metag_stub_hash_entry)))
+    return NULL;
+
+  return &htab->etab.root;
+}
+
+/* Free the derived linker hash table.  */
+
+static void
+elf_metag_link_hash_table_free (struct bfd_link_hash_table *btab)
+{
+  struct elf_metag_link_hash_table *htab
+    = (struct elf_metag_link_hash_table *) btab;
+
+  bfd_hash_table_free (&htab->bstab);
+  _bfd_elf_link_hash_table_free (btab);
+}
+
+/* Section name for stubs is the associated section name plus this
+   string.  */
+#define STUB_SUFFIX ".stub"
+
+/* Build a name for an entry in the stub hash table.  */
+
+static char *
+metag_stub_name (const asection *input_section,
+		 const asection *sym_sec,
+		 const struct elf_metag_link_hash_entry *hh,
+		 const Elf_Internal_Rela *rel)
+{
+  char *stub_name;
+  bfd_size_type len;
+
+  if (hh)
+    {
+      len = 8 + 1 + strlen (hh->eh.root.root.string) + 1 + 8 + 1;
+      stub_name = bfd_malloc (len);
+      if (stub_name != NULL)
+	{
+	  sprintf (stub_name, "%08x_%s+%x",
+		   input_section->id & 0xffffffff,
+		   hh->eh.root.root.string,
+		   (int) rel->r_addend & 0xffffffff);
+	}
+    }
+  else
+    {
+      len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1;
+      stub_name = bfd_malloc (len);
+      if (stub_name != NULL)
+	{
+	  sprintf (stub_name, "%08x_%x:%x+%x",
+		   input_section->id & 0xffffffff,
+		   sym_sec->id & 0xffffffff,
+		   (int) ELF32_R_SYM (rel->r_info) & 0xffffffff,
+		   (int) rel->r_addend & 0xffffffff);
+	}
+    }
+  return stub_name;
+}
+
+/* Look up an entry in the stub hash.  Stub entries are cached because
+   creating the stub name takes a bit of time.  */
+
+static struct elf_metag_stub_hash_entry *
+metag_get_stub_entry (const asection *input_section,
+		      const asection *sym_sec,
+		      struct elf_metag_link_hash_entry *hh,
+		      const Elf_Internal_Rela *rel,
+		      struct elf_metag_link_hash_table *htab)
+{
+  struct elf_metag_stub_hash_entry *hsh;
+  const asection *id_sec;
+
+  /* If this input section is part of a group of sections sharing one
+     stub section, then use the id of the first section in the group.
+     Stub names need to include a section id, as there may well be
+     more than one stub used to reach say, printf, and we need to
+     distinguish between them.  */
+  id_sec = htab->stub_group[input_section->id].link_sec;
+
+  if (hh != NULL && hh->hsh_cache != NULL
+      && hh->hsh_cache->hh == hh
+      && hh->hsh_cache->id_sec == id_sec)
+    {
+      hsh = hh->hsh_cache;
+    }
+  else
+    {
+      char *stub_name;
+
+      stub_name = metag_stub_name (id_sec, sym_sec, hh, rel);
+      if (stub_name == NULL)
+	return NULL;
+
+      hsh = metag_stub_hash_lookup (&htab->bstab,
+				    stub_name, FALSE, FALSE);
+
+      if (hh != NULL)
+	hh->hsh_cache = hsh;
+
+      free (stub_name);
+    }
+
+  return hsh;
+}
+
+/* Add a new stub entry to the stub hash.  Not all fields of the new
+   stub entry are initialised.  */
+
+static struct elf_metag_stub_hash_entry *
+metag_add_stub (const char *stub_name,
+		asection *section,
+		struct elf_metag_link_hash_table *htab)
+{
+  asection *link_sec;
+  asection *stub_sec;
+  struct elf_metag_stub_hash_entry *hsh;
+
+  link_sec = htab->stub_group[section->id].link_sec;
+  stub_sec = htab->stub_group[section->id].stub_sec;
+  if (stub_sec == NULL)
+    {
+      stub_sec = htab->stub_group[link_sec->id].stub_sec;
+      if (stub_sec == NULL)
+	{
+	  size_t namelen;
+	  bfd_size_type len;
+	  char *s_name;
+
+	  namelen = strlen (link_sec->name);
+	  len = namelen + sizeof (STUB_SUFFIX);
+	  s_name = bfd_alloc (htab->stub_bfd, len);
+	  if (s_name == NULL)
+	    return NULL;
+
+	  memcpy (s_name, link_sec->name, namelen);
+	  memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
+
+	  stub_sec = (*htab->add_stub_section) (s_name, link_sec);
+	  if (stub_sec == NULL)
+	    return NULL;
+	  htab->stub_group[link_sec->id].stub_sec = stub_sec;
+	}
+      htab->stub_group[section->id].stub_sec = stub_sec;
+    }
+
+  /* Enter this entry into the linker stub hash table.  */
+  hsh = metag_stub_hash_lookup (&htab->bstab, stub_name,
+				TRUE, FALSE);
+  if (hsh == NULL)
+    {
+      (*_bfd_error_handler) (_("%B: cannot create stub entry %s"),
+			     section->owner,
+			     stub_name);
+      return NULL;
+    }
+
+  hsh->stub_sec = stub_sec;
+  hsh->stub_offset = 0;
+  hsh->id_sec = link_sec;
+  return hsh;
+}
+
+/* Check a signed integer value can be represented in the given number
+   of bits.  */
+
+static bfd_boolean
+within_signed_range (int value, unsigned int bits)
+{
+  int min_val = -(1 << (bits - 1));
+  int max_val = (1 << (bits - 1)) - 1;
+  return (value <= max_val) && (value >= min_val);
+}
+
+/* Perform a relocation as part of a final link.  */
+
+static bfd_reloc_status_type
+metag_final_link_relocate (reloc_howto_type *howto,
+			   bfd *input_bfd,
+			   asection *input_section,
+			   bfd_byte *contents,
+			   Elf_Internal_Rela *rel,
+			   bfd_vma relocation,
+			   struct elf_metag_link_hash_entry *hh,
+			   struct elf_metag_link_hash_table *htab,
+			   asection *sym_sec)
+{
+  bfd_reloc_status_type r = bfd_reloc_ok;
+  bfd_byte *hit_data = contents + rel->r_offset;
+  int opcode, op_shift, op_extended, l1, l2;
+  bfd_signed_vma srel, addend = rel->r_addend;
+  struct elf_metag_stub_hash_entry *hsh = NULL;
+  bfd_vma location;
+
+  /* Find out where we are and where we're going.  */
+  location = (rel->r_offset +
+	      input_section->output_offset +
+	      input_section->output_section->vma);
+
+  switch (howto->type)
+    {
+    case R_METAG_RELBRANCH:
+    case R_METAG_RELBRANCH_PLT:
+      /* Make it a pc relative offset.  */
+      relocation -= location;
+      break;
+    case R_METAG_TLS_GD:
+    case R_METAG_TLS_IE:
+      relocation -= elf_gp (input_section->output_section->owner);
+      break;
+    default:
+      break;
+    }
+
+  switch (howto->type)
+    {
+    case R_METAG_RELBRANCH_PLT:
+    case R_METAG_RELBRANCH:
+      opcode = bfd_get_32 (input_bfd, hit_data);
+
+      srel = (bfd_signed_vma) relocation;
+      srel += addend;
+
+      /* If the branch is out of reach, then redirect the
+	 call to the local stub for this function.  */
+      if (srel > ((1 << (BRANCH_BITS + 1)) - 1) ||
+	  (srel < - (1 << (BRANCH_BITS + 1))))
+	{
+	  if (sym_sec == NULL)
+	    break;
+
+	  hsh = metag_get_stub_entry (input_section, sym_sec,
+				      hh, rel, htab);
+	  if (hsh == NULL)
+	    return bfd_reloc_undefined;
+
+	  /* Munge up the value and addend so that we call the stub
+	     rather than the procedure directly.  */
+	  srel = (hsh->stub_offset
+		  + hsh->stub_sec->output_offset
+		  + hsh->stub_sec->output_section->vma);
+	  srel -= location;
+	}
+
+      srel = srel >> 2;
+
+      if (!within_signed_range (srel, BRANCH_BITS))
+	{
+	  if (hh && hh->eh.root.type == bfd_link_hash_undefweak)
+	    srel = 0;
+	  else
+	    return bfd_reloc_overflow;
+	}
+
+      opcode &= ~(0x7ffff << 5);
+      opcode |= ((srel & 0x7ffff) << 5);
+
+      bfd_put_32 (input_bfd, opcode, hit_data);
+      break;
+    case R_METAG_GETSETOFF:
+    case R_METAG_GETSET_GOT:
+    case R_METAG_GETSET_GOTOFF:
+      opcode = bfd_get_32 (input_bfd, hit_data);
+
+      srel = (bfd_signed_vma) relocation;
+      srel += addend;
+
+      /* Is this a standard or extended GET/SET?  */
+      if ((opcode & 0xf0000000) == 0xa0000000)
+	{
+	  /* Extended GET/SET.  */
+	  l1 = opcode & 0x2;
+	  l2 = opcode & 0x4;
+	  op_extended = 1;
+	}
+      else
+	{
+	  /* Standard GET/SET.  */
+	  l1 = opcode & 0x01000000;
+	  l2 = opcode & 0x04000000;
+	  op_extended = 0;
+	}
+
+      /* Calculate the width of the GET/SET and how much we need to
+	 shift the result by.  */
+      if (l2)
+	if (l1)
+	  op_shift = 3;
+	else
+	  op_shift = 2;
+      else
+	if (l1)
+	  op_shift = 1;
+	else
+	  op_shift = 0;
+
+      /* GET/SET offsets are scaled by the width of the transfer.  */
+      srel = srel >> op_shift;
+
+      /* Extended GET/SET has signed 12 bits of offset, standard has
+	 signed 6 bits.  */
+      if (op_extended)
+	{
+	  if (!within_signed_range (srel, 12))
+	    {
+	      if (hh && hh->eh.root.type == bfd_link_hash_undefweak)
+		srel = 0;
+	      else
+		return bfd_reloc_overflow;
+	    }
+	  opcode &= ~(0xfff << 7);
+	  opcode |= ((srel & 0xfff) << 7);
+	}
+      else
+	{
+	  if (!within_signed_range (srel, 5))
+	    {
+	      if (hh && hh->eh.root.type == bfd_link_hash_undefweak)
+		srel = 0;
+	      else
+		return bfd_reloc_overflow;
+	    }
+	  opcode &= ~(0x3f << 8);
+	  opcode |= ((srel & 0x3f) << 8);
+	}
+
+      bfd_put_32 (input_bfd, opcode, hit_data);
+      break;
+    case R_METAG_TLS_GD:
+    case R_METAG_TLS_LDM:
+      opcode = bfd_get_32 (input_bfd, hit_data);
+
+      if ((bfd_signed_vma)relocation < 0)
+       {
+	 /* sign extend immediate */
+	 if ((opcode & 0xf2000001) == 0x02000000)
+	  {
+	    /* ADD De.e,Dx.r,#I16 */
+	    /* set SE bit */
+	    opcode |= (1 << 1);
+	  } else
+	    return bfd_reloc_overflow;
+       }
+
+      bfd_put_32 (input_bfd, opcode, hit_data);
+
+      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+				    contents, rel->r_offset,
+				    relocation, rel->r_addend);
+      break;
+    default:
+      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+				    contents, rel->r_offset,
+				    relocation, rel->r_addend);
+    }
+
+  return r;
+}
+
+/* This is defined because R_METAG_NONE != 0...
+   See RELOC_AGAINST_DISCARDED_SECTION for details.  */
+#define METAG_RELOC_AGAINST_DISCARDED_SECTION(info, input_bfd, input_section, \
+					      rel, relend, howto, contents) \
+  {									\
+    _bfd_clear_contents (howto, input_bfd, input_section,		\
+			 contents + rel->r_offset);			\
+									\
+    if (info->relocatable						\
+	&& (input_section->flags & SEC_DEBUGGING))			\
+      {									\
+	/* Only remove relocations in debug sections since other	\
+	   sections may require relocations.  */			\
+	Elf_Internal_Shdr *rel_hdr;					\
+									\
+	rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \
+									\
+	/* Avoid empty output section.  */				\
+	if (rel_hdr->sh_size > rel_hdr->sh_entsize)			\
+	  {								\
+	    rel_hdr->sh_size -= rel_hdr->sh_entsize;			\
+	    rel_hdr = _bfd_elf_single_rel_hdr (input_section);		\
+	    rel_hdr->sh_size -= rel_hdr->sh_entsize;			\
+									\
+	    memmove (rel, rel + 1, (relend - rel) * sizeof (*rel));	\
+									\
+	    input_section->reloc_count--;				\
+	    relend--;							\
+	    rel--;							\
+	    continue;							\
+	  }								\
+      }									\
+									\
+    rel->r_info = R_METAG_NONE;						\
+    rel->r_addend = 0;							\
+    continue;								\
+  }
+
+/* Relocate a META ELF section.
+
+The RELOCATE_SECTION function is called by the new ELF backend linker
+to handle the relocations for a section.
+
+The relocs are always passed as Rela structures; if the section
+actually uses Rel structures, the r_addend field will always be
+zero.
+
+This function is responsible for adjusting the section contents as
+necessary, and (if using Rela relocs and generating a relocatable
+output file) adjusting the reloc addend as necessary.
+
+This function does not have to worry about setting the reloc
+address or the reloc symbol index.
+
+LOCAL_SYMS is a pointer to the swapped in local symbols.
+
+LOCAL_SECTIONS is an array giving the section in the input file
+corresponding to the st_shndx field of each local symbol.
+
+The global hash table entry for the global symbols can be found
+via elf_sym_hashes (input_bfd).
+
+When generating relocatable output, this function must handle
+STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
+going to be the section symbol corresponding to the output
+section, which means that the addend must be adjusted
+accordingly.  */
+
+static bfd_boolean
+elf_metag_relocate_section (bfd *output_bfd,
+			    struct bfd_link_info *info,
+			    bfd *input_bfd,
+			    asection *input_section,
+			    bfd_byte *contents,
+			    Elf_Internal_Rela *relocs,
+			    Elf_Internal_Sym *local_syms,
+			    asection **local_sections)
+{
+  bfd_vma *local_got_offsets;
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **eh_syms;
+  struct elf_metag_link_hash_table *htab;
+  Elf_Internal_Rela *rel;
+  Elf_Internal_Rela *relend;
+  asection *sreloc;
+
+  symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+  eh_syms = elf_sym_hashes (input_bfd);
+  relend = relocs + input_section->reloc_count;
+
+  htab = metag_link_hash_table (info);
+  local_got_offsets = elf_local_got_offsets (input_bfd);
+
+  sreloc = NULL;
+
+  for (rel = relocs; rel < relend; rel ++)
+    {
+      reloc_howto_type *howto;
+      unsigned long r_symndx;
+      Elf_Internal_Sym *sym;
+      asection *sec;
+      struct elf_metag_link_hash_entry *hh;
+      bfd_vma relocation;
+      bfd_reloc_status_type r;
+      const char *name;
+      int r_type;
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+
+      if (r_type == R_METAG_GNU_VTINHERIT
+	  || r_type == R_METAG_GNU_VTENTRY
+	  || r_type == R_METAG_NONE)
+	continue;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+
+      howto  = elf_metag_howto_table + ELF32_R_TYPE (rel->r_info);
+      hh     = NULL;
+      sym    = NULL;
+      sec    = NULL;
+
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  sym = local_syms + r_symndx;
+	  sec = local_sections [r_symndx];
+	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+
+	  name = bfd_elf_string_from_elf_section
+	    (input_bfd, symtab_hdr->sh_link, sym->st_name);
+	  name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
+	}
+      else
+	{
+	  struct elf_link_hash_entry *eh;
+	  bfd_boolean unresolved_reloc, warned, ignored;
+
+	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+				   r_symndx, symtab_hdr, eh_syms,
+				   eh, sec, relocation,
+				   unresolved_reloc, warned, ignored);
+
+	  name = eh->root.root.string;
+	  hh = (struct elf_metag_link_hash_entry *) eh;
+	}
+
+      if (sec != NULL && discarded_section (sec))
+	  METAG_RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+						 rel, relend, howto, contents);
+
+      if (info->relocatable)
+	continue;
+
+      switch (r_type)
+	{
+	case R_METAG_ADDR32:
+	case R_METAG_RELBRANCH:
+	  if ((input_section->flags & SEC_ALLOC) == 0)
+	    break;
+
+	  if ((info->shared
+	       && r_symndx != STN_UNDEF
+	       && (input_section->flags & SEC_ALLOC) != 0
+	       && (r_type != R_METAG_RELBRANCH
+		   || !SYMBOL_CALLS_LOCAL (info, &hh->eh)))
+	      || (!info->shared
+		  && hh != NULL
+		  && hh->eh.dynindx != -1
+		  && !hh->eh.non_got_ref
+		  && ((hh->eh.def_dynamic
+		       && !hh->eh.def_regular)
+		      || hh->eh.root.type == bfd_link_hash_undefweak
+		      || hh->eh.root.type == bfd_link_hash_undefined)))
+	    {
+	      Elf_Internal_Rela outrel;
+	      bfd_boolean skip, relocate;
+	      bfd_byte *loc;
+
+	      /* When generating a shared object, these relocations
+		 are copied into the output file to be resolved at run
+		 time.  */
+
+	      sreloc = elf_section_data (input_section)->sreloc;
+	      BFD_ASSERT (sreloc != NULL);
+
+	      skip = FALSE;
+	      relocate = FALSE;
+
+	      outrel.r_offset = _bfd_elf_section_offset (output_bfd,
+							 info,
+							 input_section,
+							 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = TRUE;
+	      else if (outrel.r_offset == (bfd_vma) -2)
+		skip = TRUE, relocate = TRUE;
+	      outrel.r_offset += (input_section->output_section->vma
+				  + input_section->output_offset);
+
+	      if (skip)
+		{
+		  memset (&outrel, 0, sizeof outrel);
+		  outrel.r_info = ELF32_R_INFO (0, R_METAG_NONE);
+		}
+	      else if (r_type == R_METAG_RELBRANCH)
+		{
+		  BFD_ASSERT (hh != NULL && hh->eh.dynindx != -1);
+		  outrel.r_info = ELF32_R_INFO (hh->eh.dynindx, r_type);
+		  outrel.r_addend = rel->r_addend;
+		}
+	      else
+		{
+		  /* h->dynindx may be -1 if this symbol was marked to
+		     become local.  */
+		  if (hh == NULL
+		      || ((info->symbolic || hh->eh.dynindx == -1)
+			  && hh->eh.def_regular))
+		    {
+		      relocate = TRUE;
+		      outrel.r_info = ELF32_R_INFO (0, R_METAG_RELATIVE);
+		      outrel.r_addend = relocation + rel->r_addend;
+		    }
+		  else
+		    {
+		      BFD_ASSERT (hh->eh.dynindx != -1);
+		      outrel.r_info = ELF32_R_INFO (hh->eh.dynindx, r_type);
+		      outrel.r_addend = rel->r_addend;
+		    }
+		}
+
+	      loc = sreloc->contents;
+	      loc += sreloc->reloc_count * sizeof(Elf32_External_Rela);
+	      bfd_elf32_swap_reloca_out (output_bfd, &outrel,loc);
+	      ++sreloc->reloc_count;
+
+	      /* If this reloc is against an external symbol, we do
+		 not want to fiddle with the addend.  Otherwise, we
+		 need to include the symbol value so that it becomes
+		 an addend for the dynamic reloc.  */
+	      if (! relocate)
+		continue;
+	    }
+	  break;
+
+	case R_METAG_RELBRANCH_PLT:
+	  /* Relocation is to the entry for this symbol in the
+	     procedure linkage table.  */
+
+	  if (hh == NULL)
+	    break;
+
+	  if (hh->eh.forced_local)
+	    break;
+
+	  if (hh->eh.plt.offset == (bfd_vma) -1 ||
+	      htab->splt == NULL)
+	    {
+	      /* We didn't make a PLT entry for this symbol.  This
+		 happens when statically linking PIC code, or when
+		 using -Bsymbolic.  */
+	      break;
+	    }
+
+	  relocation = (htab->splt->output_section->vma
+			+ htab->splt->output_offset
+			+ hh->eh.plt.offset);
+	  break;
+	case R_METAG_HI16_GOTPC:
+	case R_METAG_LO16_GOTPC:
+	  BFD_ASSERT (htab->sgot != NULL);
+
+	  relocation = (htab->sgot->output_section->vma +
+			htab->sgot->output_offset);
+	  relocation += GOT_REG_OFFSET;
+	  relocation -= (input_section->output_section->vma
+			 + input_section->output_offset
+			 + rel->r_offset);
+	  break;
+	case R_METAG_HI16_GOTOFF:
+	case R_METAG_LO16_GOTOFF:
+	case R_METAG_GETSET_GOTOFF:
+	  BFD_ASSERT (htab->sgot != NULL);
+
+	  relocation -= (htab->sgot->output_section->vma +
+			 htab->sgot->output_offset);
+	  relocation -= GOT_REG_OFFSET;
+	  break;
+	case R_METAG_GETSET_GOT:
+	  {
+	    bfd_vma off;
+	    bfd_boolean do_got = 0;
+
+	    /* Relocation is to the entry for this symbol in the
+	       global offset table.  */
+	    if (hh != NULL)
+	      {
+		bfd_boolean dyn;
+
+		off = hh->eh.got.offset;
+		dyn = htab->etab.dynamic_sections_created;
+		if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared,
+						       &hh->eh))
+		  {
+		    /* If we aren't going to call finish_dynamic_symbol,
+		       then we need to handle initialisation of the .got
+		       entry and create needed relocs here.  Since the
+		       offset must always be a multiple of 4, we use the
+		       least significant bit to record whether we have
+		       initialised it already.  */
+		    if ((off & 1) != 0)
+		      off &= ~1;
+		    else
+		      {
+			hh->eh.got.offset |= 1;
+			do_got = 1;
+		      }
+		  }
+	      }
+	    else
+	      {
+		/* Local symbol case.  */
+		if (local_got_offsets == NULL)
+		  abort ();
+
+		off = local_got_offsets[r_symndx];
+
+		/* The offset must always be a multiple of 4.  We use
+		   the least significant bit to record whether we have
+		   already generated the necessary reloc.  */
+		if ((off & 1) != 0)
+		  off &= ~1;
+		else
+		  {
+		    local_got_offsets[r_symndx] |= 1;
+		    do_got = 1;
+		  }
+	      }
+
+	    if (do_got)
+	      {
+		if (info->shared)
+		  {
+		    /* Output a dynamic relocation for this GOT entry.
+		       In this case it is relative to the base of the
+		       object because the symbol index is zero.  */
+		    Elf_Internal_Rela outrel;
+		    bfd_byte *loc;
+		    asection *s = htab->srelgot;
+
+		    outrel.r_offset = (off
+				       + htab->sgot->output_offset
+				       + htab->sgot->output_section->vma);
+		    outrel.r_info = ELF32_R_INFO (0, R_METAG_RELATIVE);
+		    outrel.r_addend = relocation;
+		    loc = s->contents;
+		    loc += s->reloc_count++ * sizeof (Elf32_External_Rela);
+		    bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+		  }
+		else
+		  bfd_put_32 (output_bfd, relocation,
+			      htab->sgot->contents + off);
+	      }
+
+	    if (off >= (bfd_vma) -2)
+	      abort ();
+
+	    relocation = off - GOT_REG_OFFSET;
+	  }
+	  break;
+	case R_METAG_TLS_GD:
+	case R_METAG_TLS_IE:
+	  {
+	    /* XXXMJF There is room here for optimisations. For example
+	       converting from GD->IE, etc.  */
+	    bfd_vma off;
+	    int indx;
+	    char tls_type;
+
+	    if (htab->sgot == NULL)
+	      abort();
+
+	    indx = 0;
+	    if (hh != NULL)
+	      {
+		bfd_boolean dyn;
+		dyn = htab->etab.dynamic_sections_created;
+
+		if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, &hh->eh)
+		    && (!info->shared
+			|| !SYMBOL_REFERENCES_LOCAL (info, &hh->eh)))
+		  {
+		    indx = hh->eh.dynindx;
+		  }
+		off = hh->eh.got.offset;
+		tls_type = hh->tls_type;
+	      }
+	    else
+	      {
+		/* Local symbol case.  */
+		if (local_got_offsets == NULL)
+		  abort ();
+
+		off = local_got_offsets[r_symndx];
+		tls_type = metag_elf_local_got_tls_type (input_bfd) [r_symndx];
+	      }
+
+	    if (tls_type == GOT_UNKNOWN)
+	      abort();
+
+	    if ((off & 1) != 0)
+	      off &= ~1;
+	    else
+	      {
+		bfd_boolean need_relocs = FALSE;
+		Elf_Internal_Rela outrel;
+		bfd_byte *loc = NULL;
+		int cur_off = off;
+
+		/* The GOT entries have not been initialized yet.  Do it
+		   now, and emit any relocations.  If both an IE GOT and a
+		   GD GOT are necessary, we emit the GD first.  */
+
+		if ((info->shared || indx != 0)
+		    && (hh == NULL
+			|| ELF_ST_VISIBILITY (hh->eh.other) == STV_DEFAULT
+			|| hh->eh.root.type != bfd_link_hash_undefweak))
+		  {
+		    need_relocs = TRUE;
+		    loc = htab->srelgot->contents;
+		    /* FIXME (CAO): Should this be reloc_count++ ? */
+		    loc += htab->srelgot->reloc_count * sizeof (Elf32_External_Rela);
+		  }
+
+		if (tls_type & GOT_TLS_GD)
+		  {
+		    if (need_relocs)
+		      {
+			outrel.r_offset = (cur_off
+					   + htab->sgot->output_section->vma
+					   + htab->sgot->output_offset);
+			outrel.r_info = ELF32_R_INFO (indx, R_METAG_TLS_DTPMOD);
+			outrel.r_addend = 0;
+			bfd_put_32 (output_bfd, 0, htab->sgot->contents + cur_off);
+
+			bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+			htab->srelgot->reloc_count++;
+			loc += sizeof (Elf32_External_Rela);
+
+			if (indx == 0)
+			  bfd_put_32 (output_bfd, 0,
+				      htab->sgot->contents + cur_off + 4);
+			else
+			  {
+			    bfd_put_32 (output_bfd, 0,
+					htab->sgot->contents + cur_off + 4);
+			    outrel.r_info = ELF32_R_INFO (indx,
+						      R_METAG_TLS_DTPOFF);
+			    outrel.r_offset += 4;
+			    bfd_elf32_swap_reloca_out (output_bfd,
+						       &outrel, loc);
+			    htab->srelgot->reloc_count++;
+			    loc += sizeof (Elf32_External_Rela);
+			  }
+		      }
+		    else
+		      {
+			/* We don't support changing the TLS model.  */
+			abort ();
+		      }
+
+		    cur_off += 8;
+		  }
+
+		if (tls_type & GOT_TLS_IE)
+		  {
+		    if (need_relocs)
+		      {
+			outrel.r_offset = (cur_off
+					   + htab->sgot->output_section->vma
+					   + htab->sgot->output_offset);
+			outrel.r_info = ELF32_R_INFO (indx, R_METAG_TLS_TPOFF);
+
+			if (indx == 0)
+			  outrel.r_addend = relocation - dtpoff_base (info);
+			else
+			  outrel.r_addend = 0;
+
+			bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+			htab->srelgot->reloc_count++;
+			loc += sizeof (Elf32_External_Rela);
+		      }
+		    else
+		      bfd_put_32 (output_bfd, tpoff (info, relocation),
+				  htab->sgot->contents + cur_off);
+
+		    cur_off += 4;
+		  }
+
+		  if (hh != NULL)
+		    hh->eh.got.offset |= 1;
+		  else
+		    local_got_offsets[r_symndx] |= 1;
+	      }
+
+	    /* Add the base of the GOT to the relocation value.  */
+	    relocation = off - GOT_REG_OFFSET;
+
+	    break;
+	  }
+
+	case R_METAG_TLS_IENONPIC_HI16:
+	case R_METAG_TLS_IENONPIC_LO16:
+	case R_METAG_TLS_LE_HI16:
+	case R_METAG_TLS_LE_LO16:
+	  if (info->shared)
+	    {
+	      (*_bfd_error_handler)
+		(_("%B(%A+0x%lx): R_METAG_TLS_LE/IENONPIC relocation not permitted in shared object"),
+		 input_bfd, input_section,
+		 (long) rel->r_offset, howto->name);
+	      return FALSE;
+	    }
+	  else
+	    relocation = tpoff (info, relocation);
+	  break;
+	case R_METAG_TLS_LDO_HI16:
+	case R_METAG_TLS_LDO_LO16:
+	  if (! info->shared)
+	    relocation = tpoff (info, relocation);
+	  else
+	    relocation -= dtpoff_base (info);
+	  break;
+	case R_METAG_TLS_LDM:
+	  {
+	    bfd_vma off;
+
+	    if (htab->sgot == NULL)
+	      abort();
+	    off = htab->tls_ldm_got.offset;
+	    if (off & 1)
+	      off &= ~1;
+	    else
+	      {
+		Elf_Internal_Rela outrel;
+		bfd_byte *loc;
+
+		outrel.r_offset = (off
+				   + htab->sgot->output_section->vma
+				   + htab->sgot->output_offset);
+
+		outrel.r_addend = 0;
+		outrel.r_info = ELF32_R_INFO (0, R_METAG_TLS_DTPMOD);
+		loc = htab->srelgot->contents;
+		loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+		bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+		htab->tls_ldm_got.offset |= 1;
+	      }
+
+	    relocation = off - GOT_REG_OFFSET;
+	    break;
+	  }
+	default:
+	  break;
+	}
+
+      r = metag_final_link_relocate (howto, input_bfd, input_section,
+				     contents, rel, relocation, hh, htab,
+				     sec);
+
+      if (r != bfd_reloc_ok)
+	{
+	  const char * msg = (const char *) NULL;
+
+	  switch (r)
+	    {
+	    case bfd_reloc_overflow:
+	      r = info->callbacks->reloc_overflow
+		(info, (hh ? &hh->eh.root : NULL), name, howto->name,
+		 (bfd_vma) 0, input_bfd, input_section, rel->r_offset);
+	      break;
+
+	    case bfd_reloc_undefined:
+	      r = info->callbacks->undefined_symbol
+		(info, name, input_bfd, input_section, rel->r_offset,
+		 TRUE);
+	      break;
+
+	    case bfd_reloc_outofrange:
+	      msg = _("internal error: out of range error");
+	      break;
+
+	    case bfd_reloc_notsupported:
+	      msg = _("internal error: unsupported relocation error");
+	      break;
+
+	    case bfd_reloc_dangerous:
+	      msg = _("internal error: dangerous relocation");
+	      break;
+
+	    default:
+	      msg = _("internal error: unknown error");
+	      break;
+	    }
+
+	  if (msg)
+	    r = info->callbacks->warning
+	      (info, msg, name, input_bfd, input_section, rel->r_offset);
+
+	  if (! r)
+	    return FALSE;
+	}
+    }
+
+  return TRUE;
+}
+
+/* Create the .plt and .got sections, and set up our hash table
+   short-cuts to various dynamic sections.  */
+
+static bfd_boolean
+elf_metag_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
+{
+  struct elf_metag_link_hash_table *htab;
+  struct elf_link_hash_entry *eh;
+  struct bfd_link_hash_entry *bh;
+  const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+  /* Don't try to create the .plt and .got twice.  */
+  htab = metag_link_hash_table (info);
+  if (htab->splt != NULL)
+    return TRUE;
+
+  /* Call the generic code to do most of the work.  */
+  if (! _bfd_elf_create_dynamic_sections (abfd, info))
+    return FALSE;
+
+  htab->sgot = bfd_get_linker_section (abfd, ".got");
+  if (! htab->sgot)
+    return FALSE;
+
+  htab->sgotplt = bfd_make_section_with_flags (abfd, ".got.plt",
+					       (SEC_ALLOC | SEC_LOAD |
+						SEC_HAS_CONTENTS |
+						SEC_IN_MEMORY |
+						SEC_LINKER_CREATED));
+  if (htab->sgotplt == NULL
+      || !bfd_set_section_alignment (abfd, htab->sgotplt, 2))
+    return FALSE;
+
+  /* Define the symbol __GLOBAL_OFFSET_TABLE__ at the start of the .got
+     section.  We don't do this in the linker script because we don't want
+     to define the symbol if we are not creating a global offset table.  */
+  bh = NULL;
+  if (!(_bfd_generic_link_add_one_symbol
+	(info, abfd, "__GLOBAL_OFFSET_TABLE__", BSF_GLOBAL, htab->sgot,
+	 (bfd_vma) 0, NULL, FALSE, bed->collect, &bh)))
+    return FALSE;
+  eh = (struct elf_link_hash_entry *) bh;
+  eh->def_regular = 1;
+  eh->type = STT_OBJECT;
+  eh->other = STV_HIDDEN;
+
+  if (! info->executable
+      && ! bfd_elf_link_record_dynamic_symbol (info, eh))
+    return FALSE;
+
+  elf_hash_table (info)->hgot = eh;
+
+  htab->splt = bfd_get_linker_section (abfd, ".plt");
+  htab->srelplt = bfd_get_linker_section (abfd, ".rela.plt");
+
+  htab->srelgot = bfd_get_linker_section (abfd, ".rela.got");
+
+  htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
+  htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
+
+  return TRUE;
+}
+
+/* Look through the relocs for a section during the first phase, and
+   calculate needed space in the global offset table, procedure linkage
+   table, and dynamic reloc sections.  At this point we haven't
+   necessarily read all the input files.  */
+
+static bfd_boolean
+elf_metag_check_relocs (bfd *abfd,
+			struct bfd_link_info *info,
+			asection *sec,
+			const Elf_Internal_Rela *relocs)
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **eh_syms;
+  const Elf_Internal_Rela *rel;
+  const Elf_Internal_Rela *rel_end;
+  struct elf_metag_link_hash_table *htab;
+  asection *sreloc;
+  bfd *dynobj;
+  int tls_type = GOT_UNKNOWN, old_tls_type = GOT_UNKNOWN;
+
+  if (info->relocatable)
+    return TRUE;
+
+  htab = metag_link_hash_table (info);
+  dynobj = htab->etab.dynobj;
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  eh_syms = elf_sym_hashes (abfd);
+  sreloc = NULL;
+
+  if (htab == NULL)
+    return FALSE;
+
+  rel_end = relocs + sec->reloc_count;
+  for (rel = relocs; rel < rel_end; rel++)
+    {
+      int r_type;
+      struct elf_metag_link_hash_entry *hh;
+      Elf_Internal_Sym *isym;
+      unsigned long r_symndx;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      r_type = ELF32_R_TYPE (rel->r_info);
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  /* A local symbol.  */
+	  isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+					abfd, r_symndx);
+	  if (isym == NULL)
+	    return FALSE;
+
+	  hh = NULL;
+	}
+      else
+	{
+	  isym = NULL;
+
+	  hh = (struct elf_metag_link_hash_entry *)
+	    eh_syms[r_symndx - symtab_hdr->sh_info];
+	  while (hh->eh.root.type == bfd_link_hash_indirect
+		 || hh->eh.root.type == bfd_link_hash_warning)
+	    hh = (struct elf_metag_link_hash_entry *) hh->eh.root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  hh->eh.root.non_ir_ref = 1;
+	}
+
+      /* Some relocs require a global offset table.  */
+      if (htab->sgot == NULL)
+	{
+	  switch (r_type)
+	    {
+	    case R_METAG_TLS_GD:
+	    case R_METAG_TLS_LDM:
+	    case R_METAG_TLS_IE:
+	      if (info->shared)
+		info->flags |= DF_STATIC_TLS;
+	      /* Fall through.  */
+
+	    case R_METAG_HI16_GOTOFF:
+	    case R_METAG_LO16_GOTOFF:
+	    case R_METAG_GETSET_GOTOFF:
+	    case R_METAG_GETSET_GOT:
+	    case R_METAG_HI16_GOTPC:
+	    case R_METAG_LO16_GOTPC:
+	      if (dynobj == NULL)
+		htab->etab.dynobj = dynobj = abfd;
+	      if (!elf_metag_create_dynamic_sections (dynobj, info))
+		return FALSE;
+	      break;
+
+	    default:
+	      break;
+	    }
+	}
+
+      switch (r_type)
+	{
+	case R_METAG_TLS_IE:
+	case R_METAG_TLS_GD:
+	case R_METAG_GETSET_GOT:
+	  switch (r_type)
+	    {
+	    default:
+	      tls_type = GOT_NORMAL;
+	      break;
+	    case R_METAG_TLS_IE:
+	      tls_type = GOT_TLS_IE;
+	      break;
+	    case R_METAG_TLS_GD:
+	      tls_type = GOT_TLS_GD;
+	      break;
+	    }
+
+	  if (hh != NULL)
+	    {
+	      hh->eh.got.refcount += 1;
+	      old_tls_type = hh->tls_type;
+	    }
+	  else
+	    {
+	      bfd_signed_vma *local_got_refcounts;
+
+	      /* This is a global offset table entry for a local
+		 symbol.  */
+	      local_got_refcounts = elf_local_got_refcounts (abfd);
+	      if (local_got_refcounts == NULL)
+		{
+		  bfd_size_type size;
+
+		  size = symtab_hdr->sh_info;
+		  size *= sizeof (bfd_signed_vma);
+		  /* Add in space to store the local GOT TLS types.  */
+		  size += symtab_hdr->sh_info;
+		  local_got_refcounts = ((bfd_signed_vma *)
+					 bfd_zalloc (abfd, size));
+		  if (local_got_refcounts == NULL)
+		    return FALSE;
+		  elf_local_got_refcounts (abfd) = local_got_refcounts;
+		  memset (metag_elf_local_got_tls_type (abfd),
+			  GOT_UNKNOWN, symtab_hdr->sh_info);
+		}
+	      local_got_refcounts[r_symndx] += 1;
+	      old_tls_type = metag_elf_local_got_tls_type (abfd) [r_symndx];
+	    }
+
+	  if (old_tls_type != tls_type)
+	    {
+	      if (hh != NULL)
+		{
+		  hh->tls_type = tls_type;
+		}
+	      else
+		{
+		  metag_elf_local_got_tls_type (abfd) [r_symndx] = tls_type;
+		}
+	    }
+
+	  break;
+
+	case R_METAG_TLS_LDM:
+	  metag_link_hash_table (info)->tls_ldm_got.refcount += 1;
+	  break;
+
+	case R_METAG_RELBRANCH_PLT:
+	  /* This symbol requires a procedure linkage table entry.  We
+	     actually build the entry in adjust_dynamic_symbol,
+	     because this might be a case of linking PIC code without
+	     linking in any dynamic objects, in which case we don't
+	     need to generate a procedure linkage table after all.  */
+
+	  /* If this is a local symbol, we resolve it directly without
+	     creating a procedure linkage table entry.  */
+	  if (hh == NULL)
+	    continue;
+
+	  if (hh->eh.forced_local)
+	    break;
+
+	  hh->eh.needs_plt = 1;
+	  hh->eh.plt.refcount += 1;
+	  break;
+
+	case R_METAG_HIADDR16:
+	case R_METAG_LOADDR16:
+	  /* Let's help debug shared library creation.  These relocs
+	     cannot be used in shared libs.  Don't error out for
+	     sections we don't care about, such as debug sections or
+	     non-constant sections.  */
+	  if (info->shared
+	      && (sec->flags & SEC_ALLOC) != 0
+	      && (sec->flags & SEC_READONLY) != 0)
+	    {
+	      const char *name;
+
+	      if (hh)
+		name = hh->eh.root.root.string;
+	      else
+		name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
+	      (*_bfd_error_handler)
+		(_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
+		 abfd, elf_metag_howto_table[r_type].name, name);
+	      bfd_set_error (bfd_error_bad_value);
+	      return FALSE;
+	    }
+
+	  /* Fall through.  */
+	case R_METAG_ADDR32:
+	case R_METAG_RELBRANCH:
+	case R_METAG_GETSETOFF:
+	  if (hh != NULL && !info->shared)
+	    {
+	      hh->eh.non_got_ref = 1;
+	      hh->eh.plt.refcount += 1;
+	    }
+
+	  /* If we are creating a shared library, and this is a reloc
+	     against a global symbol, or a non PC relative reloc
+	     against a local symbol, then we need to copy the reloc
+	     into the shared library.  However, if we are linking with
+	     -Bsymbolic, we do not need to copy a reloc against a
+	     global symbol which is defined in an object we are
+	     including in the link (i.e., DEF_REGULAR is set).  At
+	     this point we have not seen all the input files, so it is
+	     possible that DEF_REGULAR is not set now but will be set
+	     later (it is never cleared).  We account for that
+	     possibility below by storing information in the
+	     dyn_relocs field of the hash table entry. A similar
+	     situation occurs when creating shared libraries and symbol
+	     visibility changes render the symbol local.
+
+	     If on the other hand, we are creating an executable, we
+	     may need to keep relocations for symbols satisfied by a
+	     dynamic library if we manage to avoid copy relocs for the
+	     symbol.  */
+	  if ((info->shared
+	       && (sec->flags & SEC_ALLOC) != 0
+	       && (r_type != R_METAG_RELBRANCH
+		   || (hh != NULL
+		       && (! info->symbolic
+			   || hh->eh.root.type == bfd_link_hash_defweak
+			   || !hh->eh.def_regular))))
+	      || (!info->shared
+		  && (sec->flags & SEC_ALLOC) != 0
+		  && hh != NULL
+		  && (hh->eh.root.type == bfd_link_hash_defweak
+		      || !hh->eh.def_regular)))
+	    {
+	      struct elf_metag_dyn_reloc_entry *hdh_p;
+	      struct elf_metag_dyn_reloc_entry **hdh_head;
+
+	      if (dynobj == NULL)
+		htab->etab.dynobj = dynobj = abfd;
+
+	      /* When creating a shared object, we must copy these
+		 relocs into the output file.  We create a reloc
+		 section in dynobj and make room for the reloc.  */
+	      if (sreloc == NULL)
+		{
+		  sreloc = _bfd_elf_make_dynamic_reloc_section
+		    (sec, htab->etab.dynobj, 2, abfd, /*rela?*/ TRUE);
+
+		  if (sreloc == NULL)
+		    {
+		      bfd_set_error (bfd_error_bad_value);
+		      return FALSE;
+		    }
+
+		  elf_section_data (sec)->sreloc = sreloc;
+		}
+
+	      /* If this is a global symbol, we count the number of
+		 relocations we need for this symbol.  */
+	      if (hh != NULL)
+		hdh_head = &((struct elf_metag_link_hash_entry *) hh)->dyn_relocs;
+	      else
+		{
+		  /* Track dynamic relocs needed for local syms too.  */
+		  asection *sr;
+		  void *vpp;
+
+		  sr = bfd_section_from_elf_index (abfd, isym->st_shndx);
+		  if (sr == NULL)
+		    sr = sec;
+
+		  vpp = &elf_section_data (sr)->local_dynrel;
+		  hdh_head = (struct elf_metag_dyn_reloc_entry **) vpp;
+		}
+
+	      hdh_p = *hdh_head;
+	      if (hdh_p == NULL || hdh_p->sec != sec)
+		{
+		  hdh_p = ((struct elf_metag_dyn_reloc_entry *)
+			   bfd_alloc (dynobj, sizeof *hdh_p));
+		  if (hdh_p == NULL)
+		    return FALSE;
+		  hdh_p->hdh_next = *hdh_head;
+		  *hdh_head = hdh_p;
+		  hdh_p->sec = sec;
+		  hdh_p->count = 0;
+		  hdh_p->relative_count = 0;
+		}
+
+	      hdh_p->count += 1;
+	      if (ELF32_R_TYPE (rel->r_info) == R_METAG_RELBRANCH)
+		hdh_p->relative_count += 1;
+	    }
+	  break;
+
+	  /* This relocation describes the C++ object vtable hierarchy.
+	     Reconstruct it for later use during GC.  */
+	case R_METAG_GNU_VTINHERIT:
+	  if (!bfd_elf_gc_record_vtinherit (abfd, sec, &hh->eh,
+					    rel->r_offset))
+	    return FALSE;
+	  break;
+
+	  /* This relocation describes which C++ vtable entries are actually
+	     used.  Record for later use during GC.  */
+	case R_METAG_GNU_VTENTRY:
+	  BFD_ASSERT (hh != NULL);
+	  if (hh != NULL
+	      && !bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rel->r_addend))
+	    return FALSE;
+	  break;
+	}
+    }
+
+  return TRUE;
+}
+
+/* Copy the extra info we tack onto an elf_link_hash_entry.  */
+
+static void
+elf_metag_copy_indirect_symbol (struct bfd_link_info *info,
+				struct elf_link_hash_entry *eh_dir,
+				struct elf_link_hash_entry *eh_ind)
+{
+  struct elf_metag_link_hash_entry *hh_dir, *hh_ind;
+
+  hh_dir = metag_elf_hash_entry (eh_dir);
+  hh_ind = metag_elf_hash_entry (eh_ind);
+
+  if (hh_ind->dyn_relocs != NULL)
+    {
+      if (hh_dir->dyn_relocs != NULL)
+	{
+	  struct elf_metag_dyn_reloc_entry **hdh_pp;
+	  struct elf_metag_dyn_reloc_entry *hdh_p;
+
+	  if (eh_ind->root.type == bfd_link_hash_indirect)
+	    abort ();
+
+	  /* Add reloc counts against the weak sym to the strong sym
+	     list.  Merge any entries against the same section.  */
+	  for (hdh_pp = &hh_ind->dyn_relocs; (hdh_p = *hdh_pp) != NULL; )
+	    {
+	      struct elf_metag_dyn_reloc_entry *hdh_q;
+
+	      for (hdh_q = hh_dir->dyn_relocs; hdh_q != NULL;
+		   hdh_q = hdh_q->hdh_next)
+		if (hdh_q->sec == hdh_p->sec)
+		  {
+		    hdh_q->relative_count += hdh_p->relative_count;
+		    hdh_q->count += hdh_p->count;
+		    *hdh_pp = hdh_p->hdh_next;
+		    break;
+		  }
+	      if (hdh_q == NULL)
+		hdh_pp = &hdh_p->hdh_next;
+	    }
+	  *hdh_pp = hh_dir->dyn_relocs;
+	}
+
+      hh_dir->dyn_relocs = hh_ind->dyn_relocs;
+      hh_ind->dyn_relocs = NULL;
+    }
+
+  if (eh_ind->root.type == bfd_link_hash_indirect
+      && eh_dir->got.refcount <= 0)
+    {
+      hh_dir->tls_type = hh_ind->tls_type;
+      hh_ind->tls_type = GOT_UNKNOWN;
+    }
+
+  _bfd_elf_link_hash_copy_indirect (info, eh_dir, eh_ind);
+}
+
+/* Adjust a symbol defined by a dynamic object and referenced by a
+   regular object.  The current definition is in some section of the
+   dynamic object, but we're not including those sections.  We have to
+   change the definition to something the rest of the link can
+   understand.  */
+
+static bfd_boolean
+elf_metag_adjust_dynamic_symbol (struct bfd_link_info *info,
+				 struct elf_link_hash_entry *eh)
+{
+  struct elf_metag_link_hash_table *htab;
+  struct elf_metag_link_hash_entry *hh;
+  struct elf_metag_dyn_reloc_entry *hdh_p;
+  asection *s;
+
+  /* If this is a function, put it in the procedure linkage table.  We
+     will fill in the contents of the procedure linkage table later,
+     when we know the address of the .got section.  */
+  if (eh->type == STT_FUNC
+      || eh->needs_plt)
+    {
+      if (eh->plt.refcount <= 0
+	  || SYMBOL_CALLS_LOCAL (info, eh)
+	  || (ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT
+	      && eh->root.type == bfd_link_hash_undefweak))
+	{
+	  /* This case can occur if we saw a PLT reloc in an input
+	     file, but the symbol was never referred to by a dynamic
+	     object.  In such a case, we don't actually need to build
+	     a procedure linkage table, and we can just do a PCREL
+	     reloc instead.  */
+	  eh->plt.offset = (bfd_vma) -1;
+	  eh->needs_plt = 0;
+	}
+
+      return TRUE;
+    }
+  else
+    eh->plt.offset = (bfd_vma) -1;
+
+  /* If this is a weak symbol, and there is a real definition, the
+     processor independent code will have arranged for us to see the
+     real definition first, and we can just use the same value.  */
+  if (eh->u.weakdef != NULL)
+    {
+      if (eh->u.weakdef->root.type != bfd_link_hash_defined
+	  && eh->u.weakdef->root.type != bfd_link_hash_defweak)
+	abort ();
+      eh->root.u.def.section = eh->u.weakdef->root.u.def.section;
+      eh->root.u.def.value = eh->u.weakdef->root.u.def.value;
+      eh->non_got_ref = eh->u.weakdef->non_got_ref;
+      return TRUE;
+    }
+
+  /* This is a reference to a symbol defined by a dynamic object which
+     is not a function.  */
+
+  /* If we are creating a shared library, we must presume that the
+     only references to the symbol are via the global offset table.
+     For such cases we need not do anything here; the relocations will
+     be handled correctly by relocate_section.  */
+  if (info->shared)
+    return TRUE;
+
+  /* If there are no references to this symbol that do not use the
+     GOT, we don't need to generate a copy reloc.  */
+  if (!eh->non_got_ref)
+    return TRUE;
+
+  /* If -z nocopyreloc was given, we won't generate them either.  */
+  if (info->nocopyreloc)
+    {
+      eh->non_got_ref = 0;
+      return TRUE;
+    }
+
+  hh = (struct elf_metag_link_hash_entry *) eh;
+  for (hdh_p = hh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->hdh_next)
+    {
+      s = hdh_p->sec->output_section;
+      if (s != NULL && (s->flags & SEC_READONLY) != 0)
+	break;
+    }
+
+  /* If we didn't find any dynamic relocs in read-only sections, then
+     we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
+  if (hdh_p == NULL)
+    {
+      eh->non_got_ref = 0;
+      return TRUE;
+    }
+
+  /* We must allocate the symbol in our .dynbss section, which will
+     become part of the .bss section of the executable.  There will be
+     an entry for this symbol in the .dynsym section.  The dynamic
+     object will contain position independent code, so all references
+     from the dynamic object to this symbol will go through the global
+     offset table.  The dynamic linker will use the .dynsym entry to
+     determine the address it must put in the global offset table, so
+     both the dynamic object and the regular object will refer to the
+     same memory location for the variable.  */
+
+  htab = metag_link_hash_table (info);
+
+  /* We must generate a COPY reloc to tell the dynamic linker to
+     copy the initial value out of the dynamic object and into the
+     runtime process image.  */
+  if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0 && eh->size != 0)
+    {
+      htab->srelbss->size += sizeof (Elf32_External_Rela);
+      eh->needs_copy = 1;
+    }
+
+  s = htab->sdynbss;
+
+  return _bfd_elf_adjust_dynamic_copy (eh, s);
+}
+
+/* Allocate space in .plt, .got and associated reloc sections for
+   global syms.  */
+
+static bfd_boolean
+allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
+{
+  struct bfd_link_info *info;
+  struct elf_metag_link_hash_table *htab;
+  struct elf_metag_link_hash_entry *hh;
+  struct elf_metag_dyn_reloc_entry *hdh_p;
+
+  if (eh->root.type == bfd_link_hash_indirect)
+    return TRUE;
+
+  if (eh->root.type == bfd_link_hash_warning)
+    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
+
+  info = inf;
+  htab = metag_link_hash_table (info);
+
+  if (htab->etab.dynamic_sections_created
+      && eh->plt.refcount > 0)
+    {
+      /* Make sure this symbol is output as a dynamic symbol.
+	 Undefined weak syms won't yet be marked as dynamic.  */
+      if (eh->dynindx == -1
+	  && !eh->forced_local)
+	{
+	  if (! bfd_elf_link_record_dynamic_symbol (info, eh))
+	    return FALSE;
+	}
+
+      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, eh))
+	{
+	  asection *s = htab->splt;
+
+	  /* If this is the first .plt entry, make room for the special
+	     first entry.  */
+	  if (s->size == 0)
+	    s->size += PLT_ENTRY_SIZE;
+
+	  eh->plt.offset = s->size;
+
+	  /* If this symbol is not defined in a regular file, and we are
+	     not generating a shared library, then set the symbol to this
+	     location in the .plt.  This is required to make function
+	     pointers compare as equal between the normal executable and
+	     the shared library.  */
+	  if (! info->shared
+	      && !eh->def_regular)
+	    {
+	      eh->root.u.def.section = s;
+	      eh->root.u.def.value = eh->plt.offset;
+	    }
+
+	  /* Make room for this entry.  */
+	  s->size += PLT_ENTRY_SIZE;
+
+	  /* We also need to make an entry in the .got.plt section, which
+	     will be placed in the .got section by the linker script.  */
+	  htab->sgotplt->size += 4;
+
+	  /* We also need to make an entry in the .rel.plt section.  */
+	  htab->srelplt->size += sizeof (Elf32_External_Rela);
+	}
+      else
+	{
+	  eh->plt.offset = (bfd_vma) -1;
+	  eh->needs_plt = 0;
+	}
+    }
+  else
+    {
+      eh->plt.offset = (bfd_vma) -1;
+      eh->needs_plt = 0;
+    }
+
+  if (eh->got.refcount > 0)
+    {
+      asection *s;
+      bfd_boolean dyn;
+      int tls_type = metag_elf_hash_entry (eh)->tls_type;
+
+      /* Make sure this symbol is output as a dynamic symbol.
+	 Undefined weak syms won't yet be marked as dynamic.  */
+      if (eh->dynindx == -1
+	  && !eh->forced_local)
+	{
+	  if (! bfd_elf_link_record_dynamic_symbol (info, eh))
+	    return FALSE;
+	}
+
+      s = htab->sgot;
+
+      eh->got.offset = s->size;
+      s->size += 4;
+      /* R_METAG_TLS_GD needs 2 consecutive GOT slots.  */
+      if (tls_type == GOT_TLS_GD)
+	  s->size += 4;
+      dyn = htab->etab.dynamic_sections_created;
+      /* R_METAG_TLS_IE needs one dynamic relocation if dynamic,
+	 R_METAG_TLS_GD needs one if local symbol and two if global.  */
+      if ((tls_type == GOT_TLS_GD && eh->dynindx == -1)
+	  || (tls_type == GOT_TLS_IE && dyn))
+	htab->srelgot->size += sizeof (Elf32_External_Rela);
+      else if (tls_type == GOT_TLS_GD)
+	  htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
+      else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, eh))
+	  htab->srelgot->size += sizeof (Elf32_External_Rela);
+    }
+  else
+    eh->got.offset = (bfd_vma) -1;
+
+  hh = (struct elf_metag_link_hash_entry *) eh;
+  if (hh->dyn_relocs == NULL)
+    return TRUE;
+
+  /* If this is a -Bsymbolic shared link, then we need to discard all
+     space allocated for dynamic pc-relative relocs against symbols
+     defined in a regular object.  For the normal shared case, discard
+     space for relocs that have become local due to symbol visibility
+     changes.  */
+  if (info->shared)
+    {
+      if (SYMBOL_CALLS_LOCAL (info, eh))
+	{
+	  struct elf_metag_dyn_reloc_entry **hdh_pp;
+
+	  for (hdh_pp = &hh->dyn_relocs; (hdh_p = *hdh_pp) != NULL; )
+	    {
+	      hdh_p->count -= hdh_p->relative_count;
+	      hdh_p->relative_count = 0;
+	      if (hdh_p->count == 0)
+		*hdh_pp = hdh_p->hdh_next;
+	      else
+		hdh_pp = &hdh_p->hdh_next;
+	    }
+	}
+
+      /* Also discard relocs on undefined weak syms with non-default
+	 visibility.  */
+      if (hh->dyn_relocs != NULL
+	  && eh->root.type == bfd_link_hash_undefweak)
+	{
+	  if (ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT)
+	    hh->dyn_relocs = NULL;
+
+	  /* Make sure undefined weak symbols are output as a dynamic
+	     symbol in PIEs.  */
+	  else if (eh->dynindx == -1
+		   && !eh->forced_local)
+	    {
+	      if (! bfd_elf_link_record_dynamic_symbol (info, eh))
+		return FALSE;
+	    }
+	}
+    }
+  else
+    {
+      /* For the non-shared case, discard space for relocs against
+	 symbols which turn out to need copy relocs or are not
+	 dynamic.  */
+      if (!eh->non_got_ref
+	  && ((eh->def_dynamic
+	       && !eh->def_regular)
+	      || (htab->etab.dynamic_sections_created
+		  && (eh->root.type == bfd_link_hash_undefweak
+		      || eh->root.type == bfd_link_hash_undefined))))
+	{
+	  /* Make sure this symbol is output as a dynamic symbol.
+	     Undefined weak syms won't yet be marked as dynamic.  */
+	  if (eh->dynindx == -1
+	      && !eh->forced_local)
+	    {
+	      if (! bfd_elf_link_record_dynamic_symbol (info, eh))
+		return FALSE;
+	    }
+
+	  /* If that succeeded, we know we'll be keeping all the
+	     relocs.  */
+	  if (eh->dynindx != -1)
+	    goto keep;
+	}
+
+      hh->dyn_relocs = NULL;
+      return TRUE;
+
+    keep: ;
+    }
+
+  /* Finally, allocate space.  */
+  for (hdh_p = hh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->hdh_next)
+    {
+      asection *sreloc = elf_section_data (hdh_p->sec)->sreloc;
+      sreloc->size += hdh_p->count * sizeof (Elf32_External_Rela);
+    }
+
+  return TRUE;
+}
+
+/* Find any dynamic relocs that apply to read-only sections.  */
+
+static bfd_boolean
+readonly_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
+{
+  struct elf_metag_link_hash_entry *hh;
+  struct elf_metag_dyn_reloc_entry *hdh_p;
+
+  if (eh->root.type == bfd_link_hash_warning)
+    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
+
+  hh = (struct elf_metag_link_hash_entry *) eh;
+  for (hdh_p = hh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->hdh_next)
+    {
+      asection *s = hdh_p->sec->output_section;
+
+      if (s != NULL && (s->flags & SEC_READONLY) != 0)
+	{
+	  struct bfd_link_info *info = inf;
+
+	  info->flags |= DF_TEXTREL;
+
+	  /* Not an error, just cut short the traversal.  */
+	  return FALSE;
+	}
+    }
+  return TRUE;
+}
+
+/* Set the sizes of the dynamic sections.  */
+
+static bfd_boolean
+elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+				 struct bfd_link_info *info)
+{
+  struct elf_metag_link_hash_table *htab;
+  bfd *dynobj;
+  bfd *ibfd;
+  asection *s;
+  bfd_boolean relocs;
+
+  htab = metag_link_hash_table (info);
+  dynobj = htab->etab.dynobj;
+  if (dynobj == NULL)
+    abort ();
+
+  if (htab->etab.dynamic_sections_created)
+    {
+      /* Set the contents of the .interp section to the interpreter.  */
+      if (info->executable)
+	{
+	  s = bfd_get_linker_section (dynobj, ".interp");
+	  if (s == NULL)
+	    abort ();
+	  s->size = sizeof ELF_DYNAMIC_INTERPRETER;
+	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+	}
+    }
+
+  /* Set up .got offsets for local syms, and space for local dynamic
+     relocs.  */
+  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+    {
+      bfd_signed_vma *local_got;
+      bfd_signed_vma *end_local_got;
+      bfd_size_type locsymcount;
+      Elf_Internal_Shdr *symtab_hdr;
+      asection *srel;
+      char *local_tls_type;
+
+      if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+	continue;
+
+      for (s = ibfd->sections; s != NULL; s = s->next)
+	{
+	  struct elf_metag_dyn_reloc_entry *hdh_p;
+
+	  for (hdh_p = ((struct elf_metag_dyn_reloc_entry *)
+			elf_section_data (s)->local_dynrel);
+	       hdh_p != NULL;
+	       hdh_p = hdh_p->hdh_next)
+	    {
+	      if (!bfd_is_abs_section (hdh_p->sec)
+		  && bfd_is_abs_section (hdh_p->sec->output_section))
+		{
+		  /* Input section has been discarded, either because
+		     it is a copy of a linkonce section or due to
+		     linker script /DISCARD/, so we'll be discarding
+		     the relocs too.  */
+		}
+	      else if (hdh_p->count != 0)
+		{
+		  srel = elf_section_data (hdh_p->sec)->sreloc;
+		  srel->size += hdh_p->count * sizeof (Elf32_External_Rela);
+		  if ((hdh_p->sec->output_section->flags & SEC_READONLY) != 0)
+		    info->flags |= DF_TEXTREL;
+		}
+	    }
+	}
+
+      local_got = elf_local_got_refcounts (ibfd);
+      if (!local_got)
+	continue;
+
+      symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+      locsymcount = symtab_hdr->sh_info;
+      end_local_got = local_got + locsymcount;
+      local_tls_type = metag_elf_local_got_tls_type (ibfd);
+      s = htab->sgot;
+      srel = htab->srelgot;
+      for (; local_got < end_local_got; ++local_got)
+	{
+	  if (*local_got > 0)
+	    {
+	      *local_got = s->size;
+	      s->size += GOT_ENTRY_SIZE;
+	      /* R_METAG_TLS_GD relocs need 2 consecutive GOT entries.  */
+	      if (*local_tls_type == GOT_TLS_GD)
+		s->size += 4;
+	      if (info->shared)
+		srel->size += sizeof (Elf32_External_Rela);
+	    }
+	  else
+	    *local_got = (bfd_vma) -1;
+	  ++local_tls_type;
+	}
+    }
+
+  if (htab->tls_ldm_got.refcount > 0)
+    {
+      /* Allocate 2 got entries and 1 dynamic reloc for R_METAG_TLS_LDM
+	 reloc.  */
+      htab->tls_ldm_got.offset = htab->sgot->size;
+      htab->sgot->size += 8;
+      htab->srelgot->size += sizeof (Elf32_External_Rela);
+    }
+  else
+    htab->tls_ldm_got.offset = -1;
+
+  /* Allocate global sym .plt and .got entries, and space for global
+     sym dynamic relocs.  */
+  elf_link_hash_traverse (&htab->etab, allocate_dynrelocs, info);
+
+  /* We now have determined the sizes of the various dynamic sections.
+     Allocate memory for them.  */
+  relocs = FALSE;
+  for (s = dynobj->sections; s != NULL; s = s->next)
+    {
+      bfd_boolean reloc_section = FALSE;
+
+      if ((s->flags & SEC_LINKER_CREATED) == 0)
+	continue;
+
+      if (s == htab->splt
+	  || s == htab->sgot
+	  || s == htab->sgotplt
+	  || s == htab->sdynbss)
+	{
+	  /* Strip this section if we don't need it; see the
+	     comment below.  */
+	}
+      else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
+	{
+	  if (s->size != 0 && s != htab->srelplt)
+	    relocs = TRUE;
+
+	  /* We use the reloc_count field as a counter if we need
+	     to copy relocs into the output file.  */
+	  s->reloc_count = 0;
+	  reloc_section = TRUE;
+	}
+      else
+	{
+	  /* It's not one of our sections, so don't allocate space.  */
+	  continue;
+	}
+
+      if (s->size == 0)
+	{
+	  /* If we don't need this section, strip it from the
+	     output file.  This is mostly to handle .rela.bss and
+	     .rela.plt.  We must create both sections in
+	     create_dynamic_sections, because they must be created
+	     before the linker maps input sections to output
+	     sections.  The linker does that before
+	     adjust_dynamic_symbol is called, and it is that
+	     function which decides whether anything needs to go
+	     into these sections.  */
+	  s->flags |= SEC_EXCLUDE;
+	  continue;
+	}
+
+      if ((s->flags & SEC_HAS_CONTENTS) == 0)
+	continue;
+
+      /* Allocate memory for the section contents.  */
+      s->contents = bfd_zalloc (dynobj, s->size);
+      if (s->contents == NULL)
+	return FALSE;
+      else if (reloc_section)
+	{
+	  unsigned char *contents = s->contents;
+	  Elf32_External_Rela reloc;
+
+	  /* Fill the reloc section with a R_METAG_NONE type reloc.  */
+	  memset(&reloc, 0, sizeof(Elf32_External_Rela));
+	  reloc.r_info[0] = R_METAG_NONE;
+	  for (; contents < (s->contents + s->size);
+	       contents += sizeof(Elf32_External_Rela))
+	    {
+	      memcpy(contents, &reloc, sizeof(Elf32_External_Rela));
+	    }
+	}
+    }
+
+  if (htab->etab.dynamic_sections_created)
+    {
+      /* Add some entries to the .dynamic section.  We fill in the
+	 values later, in elf_metag_finish_dynamic_sections, but we
+	 must add the entries now so that we get the correct size for
+	 the .dynamic section.  The DT_DEBUG entry is filled in by the
+	 dynamic linker and used by the debugger.  */
+#define add_dynamic_entry(TAG, VAL) \
+  _bfd_elf_add_dynamic_entry (info, TAG, VAL)
+
+      if (!add_dynamic_entry (DT_PLTGOT, 0))
+	return FALSE;
+
+      if (info->executable)
+	{
+	  if (!add_dynamic_entry (DT_DEBUG, 0))
+	    return FALSE;
+	}
+
+      if (htab->srelplt->size != 0)
+	{
+	  if (!add_dynamic_entry (DT_PLTRELSZ, 0)
+	      || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+	      || !add_dynamic_entry (DT_JMPREL, 0))
+	    return FALSE;
+	}
+
+      if (relocs)
+	{
+	  if (!add_dynamic_entry (DT_RELA, 0)
+	      || !add_dynamic_entry (DT_RELASZ, 0)
+	      || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
+	    return FALSE;
+
+	  /* If any dynamic relocs apply to a read-only section,
+	     then we need a DT_TEXTREL entry.  */
+	  if ((info->flags & DF_TEXTREL) == 0)
+	    elf_link_hash_traverse (&htab->etab, readonly_dynrelocs, info);
+
+	  if ((info->flags & DF_TEXTREL) != 0)
+	    {
+	      if (!add_dynamic_entry (DT_TEXTREL, 0))
+		return FALSE;
+	    }
+	}
+    }
+#undef add_dynamic_entry
+
+  return TRUE;
+}
+
+/* Finish up dynamic symbol handling.  We set the contents of various
+   dynamic sections here.  */
+
+static bfd_boolean
+elf_metag_finish_dynamic_symbol (bfd *output_bfd,
+				 struct bfd_link_info *info,
+				 struct elf_link_hash_entry *eh,
+				 Elf_Internal_Sym *sym)
+{
+  struct elf_metag_link_hash_table *htab;
+  Elf_Internal_Rela rel;
+  bfd_byte *loc;
+
+  htab = metag_link_hash_table (info);
+
+  if (eh->plt.offset != (bfd_vma) -1)
+    {
+      asection *splt;
+      asection *sgot;
+      asection *srela;
+
+      bfd_vma plt_index;
+      bfd_vma got_offset;
+      bfd_vma got_entry;
+
+      if (eh->plt.offset & 1)
+	abort ();
+
+      BFD_ASSERT (eh->dynindx != -1);
+
+      splt = htab->splt;
+      sgot = htab->sgotplt;
+      srela = htab->srelplt;
+      BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
+
+      /* Get the index in the procedure linkage table which
+	 corresponds to this symbol.  This is the index of this symbol
+	 in all the symbols for which we are making plt entries.  The
+	 first entry in the procedure linkage table is reserved.  */
+      plt_index = eh->plt.offset / PLT_ENTRY_SIZE - 1;
+
+      /* Get the offset into the .got.plt table of the entry that
+	 corresponds to this function.  */
+      got_offset = plt_index * GOT_ENTRY_SIZE;
+
+      BFD_ASSERT (got_offset < (1 << 16));
+
+      got_entry = sgot->output_section->vma
+	+ sgot->output_offset
+	+ got_offset;
+
+      BFD_ASSERT (plt_index < (1 << 16));
+
+      /* Fill in the entry in the procedure linkage table.  */
+      if (! info->shared)
+	{
+	  bfd_put_32 (output_bfd,
+		      (plt_entry[0]
+		       | (((got_entry >> 16) & 0xffff) << 3)),
+		      splt->contents + eh->plt.offset);
+	  bfd_put_32 (output_bfd,
+		      (plt_entry[1]
+		       | ((got_entry & 0xffff) << 3)),
+		      splt->contents + eh->plt.offset + 4);
+	  bfd_put_32 (output_bfd, plt_entry[2],
+		      splt->contents + eh->plt.offset + 8);
+	  bfd_put_32 (output_bfd,
+		      (plt_entry[3] | (plt_index << 3)),
+		      splt->contents + eh->plt.offset + 12);
+	  bfd_put_32 (output_bfd,
+		      (plt_entry[4]
+		       | ((((unsigned int) ((- (eh->plt.offset + 16)) >> 2)) & 0x7ffff) << 5)),
+		      splt->contents + eh->plt.offset + 16);
+	}
+      else
+	{
+	  bfd_vma addr = got_entry - (splt->output_section->vma +
+				      splt->output_offset + eh->plt.offset);
+
+	  bfd_put_32 (output_bfd,
+		      plt_pic_entry[0] | (((addr >> 16) & 0xffff) << 3),
+		      splt->contents + eh->plt.offset);
+	  bfd_put_32 (output_bfd,
+		      plt_pic_entry[1] | ((addr & 0xffff) << 3),
+		      splt->contents + eh->plt.offset + 4);
+	  bfd_put_32 (output_bfd, plt_pic_entry[2],
+		      splt->contents + eh->plt.offset + 8);
+	  bfd_put_32 (output_bfd,
+		      (plt_pic_entry[3] | (plt_index << 3)),
+		      splt->contents + eh->plt.offset + 12);
+	  bfd_put_32 (output_bfd,
+		      (plt_pic_entry[4]
+		       + ((((unsigned int) ((- (eh->plt.offset + 16)) >> 2)) & 0x7ffff) << 5)),
+		      splt->contents + eh->plt.offset + 16);
+	}
+
+      /* Fill in the entry in the global offset table.  */
+      bfd_put_32 (output_bfd,
+		  (splt->output_section->vma
+		   + splt->output_offset
+		   + eh->plt.offset
+		   + 12), /* offset within PLT entry */
+		  sgot->contents + got_offset);
+
+      /* Fill in the entry in the .rela.plt section.  */
+      rel.r_offset = (sgot->output_section->vma
+		      + sgot->output_offset
+		      + got_offset);
+      rel.r_info = ELF32_R_INFO (eh->dynindx, R_METAG_JMP_SLOT);
+      rel.r_addend = 0;
+      loc = htab->srelplt->contents;
+      loc += plt_index * sizeof(Elf32_External_Rela);
+      bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+
+      if (!eh->def_regular)
+	{
+	  /* Mark the symbol as undefined, rather than as defined in
+	     the .plt section.  Leave the value alone.  */
+	  sym->st_shndx = SHN_UNDEF;
+	}
+    }
+
+  if (eh->got.offset != (bfd_vma) -1
+      && (metag_elf_hash_entry (eh)->tls_type & GOT_TLS_GD) == 0
+      && (metag_elf_hash_entry (eh)->tls_type & GOT_TLS_IE) == 0)
+    {
+      /* This symbol has an entry in the global offset table.  Set it
+	 up.  */
+
+      rel.r_offset = ((eh->got.offset &~ (bfd_vma) 1)
+		      + htab->sgot->output_offset
+		      + htab->sgot->output_section->vma);
+
+      /* If this is a -Bsymbolic link and the symbol is defined
+	 locally or was forced to be local because of a version file,
+	 we just want to emit a RELATIVE reloc.  The entry in the
+	 global offset table will already have been initialized in the
+	 relocate_section function.  */
+      if (info->shared
+	  && (info->symbolic || eh->dynindx == -1)
+	  && eh->def_regular)
+	{
+	  rel.r_info = ELF32_R_INFO (0, R_METAG_RELATIVE);
+	  rel.r_addend = (eh->root.u.def.value
+			  + eh->root.u.def.section->output_offset
+			  + eh->root.u.def.section->output_section->vma);
+	}
+      else
+	{
+	  if ((eh->got.offset & 1) != 0)
+	    abort ();
+	  bfd_put_32 (output_bfd, 0, htab->sgot->contents + eh->got.offset);
+	  rel.r_info = ELF32_R_INFO (eh->dynindx, R_METAG_GLOB_DAT);
+	  rel.r_addend = 0;
+	}
+
+      loc = htab->srelgot->contents;
+      loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+      bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+    }
+
+  if (eh->needs_copy)
+    {
+      asection *s;
+
+      /* This symbol needs a copy reloc.  Set it up.  */
+
+      if (! (eh->dynindx != -1
+	     && (eh->root.type == bfd_link_hash_defined
+		 || eh->root.type == bfd_link_hash_defweak)))
+	abort ();
+
+      s = htab->srelbss;
+
+      rel.r_offset = (eh->root.u.def.value
+		      + eh->root.u.def.section->output_offset
+		      + eh->root.u.def.section->output_section->vma);
+      rel.r_addend = 0;
+      rel.r_info = ELF32_R_INFO (eh->dynindx, R_METAG_COPY);
+      loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+      bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
+    }
+
+  /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
+  if (eh->root.root.string[0] == '_'
+      && (strcmp (eh->root.root.string, "_DYNAMIC") == 0
+	  || eh == htab->etab.hgot))
+    {
+      sym->st_shndx = SHN_ABS;
+    }
+
+  return TRUE;
+}
+
+/* Set the Meta ELF ABI version.  */
+
+static void
+elf_metag_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATTRIBUTE_UNUSED)
+{
+  Elf_Internal_Ehdr * i_ehdrp;	/* ELF file header, internal form.  */
+
+  i_ehdrp = elf_elfheader (abfd);
+  i_ehdrp->e_ident[EI_ABIVERSION] = METAG_ELF_ABI_VERSION;
+}
+
+/* Used to decide how to sort relocs in an optimal manner for the
+   dynamic linker, before writing them out.  */
+
+static enum elf_reloc_type_class
+elf_metag_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			    const asection *rel_sec ATTRIBUTE_UNUSED,
+			    const Elf_Internal_Rela *rela)
+{
+  switch ((int) ELF32_R_TYPE (rela->r_info))
+    {
+    case R_METAG_RELATIVE:
+      return reloc_class_relative;
+    case R_METAG_JMP_SLOT:
+      return reloc_class_plt;
+    case R_METAG_COPY:
+      return reloc_class_copy;
+    default:
+      return reloc_class_normal;
+    }
+}
+
+/* Finish up the dynamic sections.  */
+
+static bfd_boolean
+elf_metag_finish_dynamic_sections (bfd *output_bfd,
+				   struct bfd_link_info *info)
+{
+  bfd *dynobj;
+  struct elf_metag_link_hash_table *htab;
+  asection *sdyn;
+
+  htab = metag_link_hash_table (info);
+  dynobj = htab->etab.dynobj;
+
+  sdyn = bfd_get_linker_section (dynobj, ".dynamic");
+
+  if (htab->etab.dynamic_sections_created)
+    {
+      asection *splt;
+      Elf32_External_Dyn *dyncon, *dynconend;
+
+      if (sdyn == NULL)
+	abort ();
+
+      dyncon = (Elf32_External_Dyn *) sdyn->contents;
+      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
+      for (; dyncon < dynconend; dyncon++)
+	{
+	  Elf_Internal_Dyn dyn;
+	  asection *s;
+
+	  bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+
+	  switch (dyn.d_tag)
+	    {
+	    default:
+	      continue;
+
+	    case DT_PLTGOT:
+	      s = htab->sgot->output_section;
+	      BFD_ASSERT (s != NULL);
+	      dyn.d_un.d_ptr = s->vma + htab->sgot->output_offset;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_JMPREL:
+	      s = htab->srelplt->output_section;
+	      BFD_ASSERT (s != NULL);
+	      dyn.d_un.d_ptr = s->vma;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_PLTRELSZ:
+	      s = htab->srelplt;
+	      dyn.d_un.d_val = s->size;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_RELASZ:
+	      /* Don't count procedure linkage table relocs in the
+		 overall reloc count.  */
+	      if (htab->srelplt) {
+		s = htab->srelplt;
+		dyn.d_un.d_val -= s->size;
+	      }
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_RELA:
+	      /* We may not be using the standard ELF linker script.
+		 If .rela.plt is the first .rela section, we adjust
+		 DT_RELA to not include it.  */
+	      if (htab->srelplt) {
+		s = htab->srelplt;
+		if (dyn.d_un.d_ptr == s->output_section->vma + s->output_offset)
+		  dyn.d_un.d_ptr += s->size;
+	      }
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+	    }
+
+	}
+
+      /* Fill in the first entry in the procedure linkage table.  */
+      splt = htab->splt;
+      if (splt && splt->size > 0)
+	{
+	  unsigned long addr;
+	  /* addr = .got + 4 */
+	  addr = htab->sgot->output_section->vma +
+	    htab->sgot->output_offset + 4;
+	  if (info->shared)
+	    {
+	      addr -= splt->output_section->vma + splt->output_offset;
+	      bfd_put_32 (output_bfd,
+			  plt0_pic_entry[0] | (((addr >> 16) & 0xffff) << 3),
+			  splt->contents);
+	      bfd_put_32 (output_bfd,
+			  plt0_pic_entry[1] | ((addr & 0xffff) << 3),
+			  splt->contents + 4);
+	      bfd_put_32 (output_bfd, plt0_pic_entry[2], splt->contents + 8);
+	      bfd_put_32 (output_bfd, plt0_pic_entry[3], splt->contents + 12);
+	      bfd_put_32 (output_bfd, plt0_pic_entry[4], splt->contents + 16);
+	    }
+	  else
+	    {
+	      bfd_put_32 (output_bfd,
+			  plt0_entry[0] | (((addr >> 16) & 0xffff) << 3),
+			  splt->contents);
+	      bfd_put_32 (output_bfd,
+			  plt0_entry[1] | ((addr & 0xffff) << 3),
+			  splt->contents + 4);
+	      bfd_put_32 (output_bfd, plt0_entry[2], splt->contents + 8);
+	      bfd_put_32 (output_bfd, plt0_entry[3], splt->contents + 12);
+	      bfd_put_32 (output_bfd, plt0_entry[4], splt->contents + 16);
+	    }
+
+	  elf_section_data (splt->output_section)->this_hdr.sh_entsize =
+	    PLT_ENTRY_SIZE;
+	}
+    }
+
+  if (htab->sgot != NULL && htab->sgot->size != 0)
+    {
+      /* Fill in the first entry in the global offset table.
+	 We use it to point to our dynamic section, if we have one.  */
+      bfd_put_32 (output_bfd,
+		  sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0,
+		  htab->sgot->contents);
+
+      /* The second entry is reserved for use by the dynamic linker.  */
+      memset (htab->sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE);
+
+      /* Set .got entry size.  */
+      elf_section_data (htab->sgot->output_section)
+	->this_hdr.sh_entsize = GOT_ENTRY_SIZE;
+    }
+
+  return TRUE;
+}
+
+/* Return the section that should be marked against GC for a given
+   relocation.  */
+
+static asection *
+elf_metag_gc_mark_hook (asection *sec,
+			struct bfd_link_info *info,
+			Elf_Internal_Rela *rela,
+			struct elf_link_hash_entry *hh,
+			Elf_Internal_Sym *sym)
+{
+  if (hh != NULL)
+    switch ((unsigned int) ELF32_R_TYPE (rela->r_info))
+      {
+      case R_METAG_GNU_VTINHERIT:
+      case R_METAG_GNU_VTENTRY:
+	return NULL;
+      }
+
+  return _bfd_elf_gc_mark_hook (sec, info, rela, hh, sym);
+}
+
+/* Update the got and plt entry reference counts for the section being
+   removed.  */
+
+static bfd_boolean
+elf_metag_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
+			 struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			 asection *sec ATTRIBUTE_UNUSED,
+			 const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **eh_syms;
+  bfd_signed_vma *local_got_refcounts;
+  bfd_signed_vma *local_plt_refcounts;
+  const Elf_Internal_Rela *rel, *relend;
+
+  if (info->relocatable)
+    return TRUE;
+
+  elf_section_data (sec)->local_dynrel = NULL;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  eh_syms = elf_sym_hashes (abfd);
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+  local_plt_refcounts = local_got_refcounts;
+  if (local_plt_refcounts != NULL)
+    local_plt_refcounts += symtab_hdr->sh_info;
+
+  relend = relocs + sec->reloc_count;
+  for (rel = relocs; rel < relend; rel++)
+    {
+      unsigned long r_symndx;
+      unsigned int r_type;
+      struct elf_link_hash_entry *eh = NULL;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+	{
+	  struct elf_metag_link_hash_entry *hh;
+	  struct elf_metag_dyn_reloc_entry **hdh_pp;
+	  struct elf_metag_dyn_reloc_entry *hdh_p;
+
+	  eh = eh_syms[r_symndx - symtab_hdr->sh_info];
+	  while (eh->root.type == bfd_link_hash_indirect
+		 || eh->root.type == bfd_link_hash_warning)
+	    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
+	  hh = (struct elf_metag_link_hash_entry *) eh;
+
+	  for (hdh_pp = &hh->dyn_relocs; (hdh_p = *hdh_pp) != NULL;
+	       hdh_pp = &hdh_p->hdh_next)
+	    if (hdh_p->sec == sec)
+	      {
+		/* Everything must go for SEC.  */
+		*hdh_pp = hdh_p->hdh_next;
+		break;
+	      }
+	}
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+      switch (r_type)
+	{
+	case R_METAG_TLS_LDM:
+	  if (metag_link_hash_table (info)->tls_ldm_got.refcount > 0)
+	    metag_link_hash_table (info)->tls_ldm_got.refcount -= 1;
+	  break;
+	case R_METAG_TLS_IE:
+	case R_METAG_TLS_GD:
+	case R_METAG_GETSET_GOT:
+	  if (eh != NULL)
+	    {
+	      if (eh->got.refcount > 0)
+		eh->got.refcount -= 1;
+	    }
+	  else if (local_got_refcounts != NULL)
+	    {
+	      if (local_got_refcounts[r_symndx] > 0)
+		local_got_refcounts[r_symndx] -= 1;
+	    }
+	  break;
+
+	case R_METAG_RELBRANCH_PLT:
+	  if (eh != NULL)
+	    {
+	      if (eh->plt.refcount > 0)
+		eh->plt.refcount -= 1;
+	    }
+	  break;
+
+	case R_METAG_ADDR32:
+	case R_METAG_HIADDR16:
+	case R_METAG_LOADDR16:
+	case R_METAG_GETSETOFF:
+	case R_METAG_RELBRANCH:
+	  if (eh != NULL)
+	    {
+	      struct elf_metag_link_hash_entry *hh;
+	      struct elf_metag_dyn_reloc_entry **hdh_pp;
+	      struct elf_metag_dyn_reloc_entry *hdh_p;
+
+	      if (!info->shared && eh->plt.refcount > 0)
+		eh->plt.refcount -= 1;
+
+	      hh = (struct elf_metag_link_hash_entry *) eh;
+
+	      for (hdh_pp = &hh->dyn_relocs; (hdh_p = *hdh_pp) != NULL;
+		   hdh_pp = &hdh_p->hdh_next)
+		if (hdh_p->sec == sec)
+		  {
+		    if (ELF32_R_TYPE (rel->r_info) == R_METAG_RELBRANCH)
+		      hdh_p->relative_count -= 1;
+		    hdh_p->count -= 1;
+		    if (hdh_p->count == 0)
+		      *hdh_pp = hdh_p->hdh_next;
+		    break;
+		  }
+	    }
+	  break;
+
+	default:
+	  break;
+	}
+    }
+
+  return TRUE;
+}
+
+/* Determine the type of stub needed, if any, for a call.  */
+
+static enum elf_metag_stub_type
+metag_type_of_stub (asection *input_sec,
+		    const Elf_Internal_Rela *rel,
+		    struct elf_metag_link_hash_entry *hh,
+		    bfd_vma destination,
+		    struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+  bfd_vma location;
+  bfd_vma branch_offset;
+  bfd_vma max_branch_offset;
+
+  if (hh != NULL &&
+      !(hh->eh.root.type == bfd_link_hash_defined
+	|| hh->eh.root.type == bfd_link_hash_defweak))
+    return metag_stub_none;
+
+  /* Determine where the call point is.  */
+  location = (input_sec->output_offset
+	      + input_sec->output_section->vma
+	      + rel->r_offset);
+
+  branch_offset = destination - location;
+
+  /* Determine if a long branch stub is needed.  Meta branch offsets
+     are signed 19 bits 4 byte aligned.  */
+  max_branch_offset = (1 << (BRANCH_BITS-1)) << 2;
+
+  if (branch_offset + max_branch_offset >= 2*max_branch_offset)
+    {
+      if (info->shared)
+	return metag_stub_long_branch_shared;
+      else
+	return metag_stub_long_branch;
+    }
+
+  return metag_stub_none;
+}
+
+#define MOVT_A0_3	0x82180005
+#define JUMP_A0_3	0xac180003
+
+#define MOVT_A1LBP	0x83080005
+#define ADD_A1LBP	0x83080000
+
+#define ADDT_A0_3_CPC	0x82980001
+#define ADD_A0_3_A0_3	0x82180000
+#define MOV_PC_A0_3	0xa3180ca0
+
+static bfd_boolean
+metag_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_UNUSED)
+{
+  struct elf_metag_stub_hash_entry *hsh;
+  asection *stub_sec;
+  bfd *stub_bfd;
+  bfd_byte *loc;
+  bfd_vma sym_value;
+  int size;
+
+  /* Massage our args to the form they really have.  */
+  hsh = (struct elf_metag_stub_hash_entry *) gen_entry;
+
+  stub_sec = hsh->stub_sec;
+
+  /* Make a note of the offset within the stubs for this entry.  */
+  hsh->stub_offset = stub_sec->size;
+  loc = stub_sec->contents + hsh->stub_offset;
+
+  stub_bfd = stub_sec->owner;
+
+  switch (hsh->stub_type)
+    {
+    case metag_stub_long_branch_shared:
+      /* A PIC long branch stub is an ADDT and an ADD instruction used to
+	 calculate the jump target using A0.3 as a temporary. Then a MOV
+	 to PC carries out the jump.  */
+      sym_value = (hsh->target_value
+		   + hsh->target_section->output_offset
+		   + hsh->target_section->output_section->vma
+		   + hsh->addend);
+
+      sym_value -= (hsh->stub_offset
+		    + stub_sec->output_offset
+		    + stub_sec->output_section->vma);
+
+      bfd_put_32 (stub_bfd, ADDT_A0_3_CPC | (((sym_value >> 16) & 0xffff) << 3),
+		  loc);
+
+      bfd_put_32 (stub_bfd, ADD_A0_3_A0_3 | ((sym_value & 0xffff) << 3),
+		  loc + 4);
+
+      bfd_put_32 (stub_bfd, MOV_PC_A0_3, loc + 8);
+
+      size = 12;
+      break;
+    case metag_stub_long_branch:
+      /* A standard long branch stub is a MOVT instruction followed by a
+	 JUMP instruction using the A0.3 register as a temporary. This is
+	 the same method used by the LDLK linker (patch.c).  */
+      sym_value = (hsh->target_value
+		   + hsh->target_section->output_offset
+		   + hsh->target_section->output_section->vma
+		   + hsh->addend);
+
+      bfd_put_32 (stub_bfd, MOVT_A0_3 | (((sym_value >> 16) & 0xffff) << 3),
+		  loc);
+
+      bfd_put_32 (stub_bfd, JUMP_A0_3 | ((sym_value & 0xffff) << 3), loc + 4);
+
+      size = 8;
+      break;
+    default:
+      BFD_FAIL ();
+      return FALSE;
+    }
+
+  stub_sec->size += size;
+  return TRUE;
+}
+
+/* As above, but don't actually build the stub.  Just bump offset so
+   we know stub section sizes.  */
+
+static bfd_boolean
+metag_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_UNUSED)
+{
+  struct elf_metag_stub_hash_entry *hsh;
+  int size = 0;
+
+  /* Massage our args to the form they really have.  */
+  hsh = (struct elf_metag_stub_hash_entry *) gen_entry;
+
+  if (hsh->stub_type == metag_stub_long_branch)
+    size = 8;
+  else if (hsh->stub_type == metag_stub_long_branch_shared)
+    size = 12;
+
+  hsh->stub_sec->size += size;
+  return TRUE;
+}
+
+/* Set up various things so that we can make a list of input sections
+   for each output section included in the link.  Returns -1 on error,
+   0 when no stubs will be needed, and 1 on success.  */
+
+int
+elf_metag_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
+{
+  bfd *input_bfd;
+  unsigned int bfd_count;
+  int top_id, top_index;
+  asection *section;
+  asection **input_list, **list;
+  bfd_size_type amt;
+  struct elf_metag_link_hash_table *htab = metag_link_hash_table (info);
+
+  /* Count the number of input BFDs and find the top input section id.  */
+  for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
+       input_bfd != NULL;
+       input_bfd = input_bfd->link_next)
+    {
+      bfd_count += 1;
+      for (section = input_bfd->sections;
+	   section != NULL;
+	   section = section->next)
+	{
+	  if (top_id < section->id)
+	    top_id = section->id;
+	}
+    }
+
+  htab->bfd_count = bfd_count;
+
+  amt = sizeof (struct map_stub) * (top_id + 1);
+  htab->stub_group = bfd_zmalloc (amt);
+  if (htab->stub_group == NULL)
+    return -1;
+
+  /* We can't use output_bfd->section_count here to find the top output
+     section index as some sections may have been removed, and
+     strip_excluded_output_sections doesn't renumber the indices.  */
+  for (section = output_bfd->sections, top_index = 0;
+       section != NULL;
+       section = section->next)
+    {
+      if (top_index < section->index)
+	top_index = section->index;
+    }
+
+  htab->top_index = top_index;
+  amt = sizeof (asection *) * (top_index + 1);
+  input_list = bfd_malloc (amt);
+  htab->input_list = input_list;
+  if (input_list == NULL)
+    return -1;
+
+  /* For sections we aren't interested in, mark their entries with a
+     value we can check later.  */
+  list = input_list + top_index;
+  do
+    *list = bfd_abs_section_ptr;
+  while (list-- != input_list);
+
+  for (section = output_bfd->sections;
+       section != NULL;
+       section = section->next)
+    {
+      /* FIXME: This is a bit of hack. Currently our .ctors and .dtors
+       * have PC relative relocs in them but no code flag set.  */
+      if (((section->flags & SEC_CODE) != 0) ||
+	  strcmp(".ctors", section->name) ||
+	  strcmp(".dtors", section->name))
+	input_list[section->index] = NULL;
+    }
+
+  return 1;
+}
+
+/* The linker repeatedly calls this function for each input section,
+   in the order that input sections are linked into output sections.
+   Build lists of input sections to determine groupings between which
+   we may insert linker stubs.  */
+
+void
+elf_metag_next_input_section (struct bfd_link_info *info, asection *isec)
+{
+  struct elf_metag_link_hash_table *htab = metag_link_hash_table (info);
+
+  if (isec->output_section->index <= htab->top_index)
+    {
+      asection **list = htab->input_list + isec->output_section->index;
+      if (*list != bfd_abs_section_ptr)
+	{
+	  /* Steal the link_sec pointer for our list.  */
+#define PREV_SEC(sec) (htab->stub_group[(sec)->id].link_sec)
+	  /* This happens to make the list in reverse order,
+	     which is what we want.  */
+	  PREV_SEC (isec) = *list;
+	  *list = isec;
+	}
+    }
+}
+
+/* See whether we can group stub sections together.  Grouping stub
+   sections may result in fewer stubs.  More importantly, we need to
+   put all .init* and .fini* stubs at the beginning of the .init or
+   .fini output sections respectively, because glibc splits the
+   _init and _fini functions into multiple parts.  Putting a stub in
+   the middle of a function is not a good idea.  */
+
+static void
+group_sections (struct elf_metag_link_hash_table *htab,
+		bfd_size_type stub_group_size,
+		bfd_boolean stubs_always_before_branch)
+{
+  asection **list = htab->input_list + htab->top_index;
+  do
+    {
+      asection *tail = *list;
+      if (tail == bfd_abs_section_ptr)
+	continue;
+      while (tail != NULL)
+	{
+	  asection *curr;
+	  asection *prev;
+	  bfd_size_type total;
+	  bfd_boolean big_sec;
+
+	  curr = tail;
+	  total = tail->size;
+	  big_sec = total >= stub_group_size;
+
+	  while ((prev = PREV_SEC (curr)) != NULL
+		 && ((total += curr->output_offset - prev->output_offset)
+		     < stub_group_size))
+	    curr = prev;
+
+	  /* OK, the size from the start of CURR to the end is less
+	     than stub_group_size bytes and thus can be handled by one stub
+	     section.  (or the tail section is itself larger than
+	     stub_group_size bytes, in which case we may be toast.)
+	     We should really be keeping track of the total size of
+	     stubs added here, as stubs contribute to the final output
+	     section size.  */
+	  do
+	    {
+	      prev = PREV_SEC (tail);
+	      /* Set up this stub group.  */
+	      htab->stub_group[tail->id].link_sec = curr;
+	    }
+	  while (tail != curr && (tail = prev) != NULL);
+
+	  /* But wait, there's more!  Input sections up to stub_group_size
+	     bytes before the stub section can be handled by it too.
+	     Don't do this if we have a really large section after the
+	     stubs, as adding more stubs increases the chance that
+	     branches may not reach into the stub section.  */
+	  if (!stubs_always_before_branch && !big_sec)
+	    {
+	      total = 0;
+	      while (prev != NULL
+		     && ((total += tail->output_offset - prev->output_offset)
+			 < stub_group_size))
+		{
+		  tail = prev;
+		  prev = PREV_SEC (tail);
+		  htab->stub_group[tail->id].link_sec = curr;
+		}
+	    }
+	  tail = prev;
+	}
+    }
+  while (list-- != htab->input_list);
+  free (htab->input_list);
+#undef PREV_SEC
+}
+
+/* Read in all local syms for all input bfds.
+   Returns -1 on error, 0 otherwise.  */
+
+static int
+get_local_syms (bfd *output_bfd ATTRIBUTE_UNUSED, bfd *input_bfd,
+		struct bfd_link_info *info)
+{
+  unsigned int bfd_indx;
+  Elf_Internal_Sym *local_syms, **all_local_syms;
+  int stub_changed = 0;
+  struct elf_metag_link_hash_table *htab = metag_link_hash_table (info);
+
+  /* We want to read in symbol extension records only once.  To do this
+     we need to read in the local symbols in parallel and save them for
+     later use; so hold pointers to the local symbols in an array.  */
+  bfd_size_type amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count;
+  all_local_syms = bfd_zmalloc (amt);
+  htab->all_local_syms = all_local_syms;
+  if (all_local_syms == NULL)
+    return -1;
+
+  /* Walk over all the input BFDs, swapping in local symbols.  */
+  for (bfd_indx = 0;
+       input_bfd != NULL;
+       input_bfd = input_bfd->link_next, bfd_indx++)
+    {
+      Elf_Internal_Shdr *symtab_hdr;
+
+      /* We'll need the symbol table in a second.  */
+      symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+      if (symtab_hdr->sh_info == 0)
+	continue;
+
+      /* We need an array of the local symbols attached to the input bfd.  */
+      local_syms = (Elf_Internal_Sym *) symtab_hdr->contents;
+      if (local_syms == NULL)
+	{
+	  local_syms = bfd_elf_get_elf_syms (input_bfd, symtab_hdr,
+					     symtab_hdr->sh_info, 0,
+					     NULL, NULL, NULL);
+	  /* Cache them for elf_link_input_bfd.  */
+	  symtab_hdr->contents = (unsigned char *) local_syms;
+	}
+      if (local_syms == NULL)
+	return -1;
+
+      all_local_syms[bfd_indx] = local_syms;
+    }
+
+  return stub_changed;
+}
+
+/* Determine and set the size of the stub section for a final link.
+
+The basic idea here is to examine all the relocations looking for
+PC-relative calls to a target that is unreachable with a "CALLR"
+instruction.  */
+
+/* See elf32-hppa.c and elf64-ppc.c.  */
+
+bfd_boolean
+elf_metag_size_stubs(bfd *output_bfd, bfd *stub_bfd,
+		     struct bfd_link_info *info,
+		     bfd_signed_vma group_size,
+		     asection * (*add_stub_section) (const char *, asection *),
+		     void (*layout_sections_again) (void))
+{
+  bfd_size_type stub_group_size;
+  bfd_boolean stubs_always_before_branch;
+  bfd_boolean stub_changed;
+  struct elf_metag_link_hash_table *htab = metag_link_hash_table (info);
+
+  /* Stash our params away.  */
+  htab->stub_bfd = stub_bfd;
+  htab->add_stub_section = add_stub_section;
+  htab->layout_sections_again = layout_sections_again;
+  stubs_always_before_branch = group_size < 0;
+  if (group_size < 0)
+    stub_group_size = -group_size;
+  else
+    stub_group_size = group_size;
+  if (stub_group_size == 1)
+    {
+      /* Default values.  */
+      /* FIXME: not sure what these values should be */
+      if (stubs_always_before_branch)
+	{
+	  stub_group_size = (1 << BRANCH_BITS);
+	}
+      else
+	{
+	  stub_group_size = (1 << BRANCH_BITS);
+	}
+    }
+
+  group_sections (htab, stub_group_size, stubs_always_before_branch);
+
+  switch (get_local_syms (output_bfd, info->input_bfds, info))
+    {
+    default:
+      if (htab->all_local_syms)
+	goto error_ret_free_local;
+      return FALSE;
+
+    case 0:
+      stub_changed = FALSE;
+      break;
+
+    case 1:
+      stub_changed = TRUE;
+      break;
+    }
+
+  while (1)
+    {
+      bfd *input_bfd;
+      unsigned int bfd_indx;
+      asection *stub_sec;
+
+      for (input_bfd = info->input_bfds, bfd_indx = 0;
+	   input_bfd != NULL;
+	   input_bfd = input_bfd->link_next, bfd_indx++)
+	{
+	  Elf_Internal_Shdr *symtab_hdr;
+	  asection *section;
+	  Elf_Internal_Sym *local_syms;
+
+	  /* We'll need the symbol table in a second.  */
+	  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+	  if (symtab_hdr->sh_info == 0)
+	    continue;
+
+	  local_syms = htab->all_local_syms[bfd_indx];
+
+	  /* Walk over each section attached to the input bfd.  */
+	  for (section = input_bfd->sections;
+	       section != NULL;
+	       section = section->next)
+	    {
+	      Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
+
+	      /* If there aren't any relocs, then there's nothing more
+		 to do.  */
+	      if ((section->flags & SEC_RELOC) == 0
+		  || section->reloc_count == 0)
+		continue;
+
+	      /* If this section is a link-once section that will be
+		 discarded, then don't create any stubs.  */
+	      if (section->output_section == NULL
+		  || section->output_section->owner != output_bfd)
+		continue;
+
+	      /* Get the relocs.  */
+	      internal_relocs
+		= _bfd_elf_link_read_relocs (input_bfd, section, NULL, NULL,
+					     info->keep_memory);
+	      if (internal_relocs == NULL)
+		goto error_ret_free_local;
+
+	      /* Now examine each relocation.  */
+	      irela = internal_relocs;
+	      irelaend = irela + section->reloc_count;
+	      for (; irela < irelaend; irela++)
+		{
+		  unsigned int r_type, r_indx;
+		  enum elf_metag_stub_type stub_type;
+		  struct elf_metag_stub_hash_entry *hsh;
+		  asection *sym_sec;
+		  bfd_vma sym_value;
+		  bfd_vma destination;
+		  struct elf_metag_link_hash_entry *hh;
+		  char *stub_name;
+		  const asection *id_sec;
+
+		  r_type = ELF32_R_TYPE (irela->r_info);
+		  r_indx = ELF32_R_SYM (irela->r_info);
+
+		  if (r_type >= (unsigned int) R_METAG_MAX)
+		    {
+		      bfd_set_error (bfd_error_bad_value);
+		    error_ret_free_internal:
+		      if (elf_section_data (section)->relocs == NULL)
+			free (internal_relocs);
+		      goto error_ret_free_local;
+		    }
+
+		  /* Only look for stubs on CALLR and B instructions.  */
+		  if (!(r_type == (unsigned int) R_METAG_RELBRANCH ||
+			r_type == (unsigned int) R_METAG_RELBRANCH_PLT))
+		    continue;
+
+		  /* Now determine the call target, its name, value,
+		     section.  */
+		  sym_sec = NULL;
+		  sym_value = 0;
+		  destination = 0;
+		  hh = NULL;
+		  if (r_indx < symtab_hdr->sh_info)
+		    {
+		      /* It's a local symbol.  */
+		      Elf_Internal_Sym *sym;
+		      Elf_Internal_Shdr *hdr;
+		      unsigned int shndx;
+
+		      sym = local_syms + r_indx;
+		      if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
+			sym_value = sym->st_value;
+		      shndx = sym->st_shndx;
+		      if (shndx < elf_numsections (input_bfd))
+			{
+			  hdr = elf_elfsections (input_bfd)[shndx];
+			  sym_sec = hdr->bfd_section;
+			  destination = (sym_value + irela->r_addend
+					 + sym_sec->output_offset
+					 + sym_sec->output_section->vma);
+			}
+		    }
+		  else
+		    {
+		      /* It's an external symbol.  */
+		      int e_indx;
+
+		      e_indx = r_indx - symtab_hdr->sh_info;
+		      hh = ((struct elf_metag_link_hash_entry *)
+			    elf_sym_hashes (input_bfd)[e_indx]);
+
+		      while (hh->eh.root.type == bfd_link_hash_indirect
+			     || hh->eh.root.type == bfd_link_hash_warning)
+			hh = ((struct elf_metag_link_hash_entry *)
+			      hh->eh.root.u.i.link);
+
+		      if (hh->eh.root.type == bfd_link_hash_defined
+			  || hh->eh.root.type == bfd_link_hash_defweak)
+			{
+			  sym_sec = hh->eh.root.u.def.section;
+			  sym_value = hh->eh.root.u.def.value;
+			  if (hh->eh.plt.offset != (bfd_vma) -1
+			      && hh->eh.dynindx != -1
+			      && r_type == (unsigned int) R_METAG_RELBRANCH_PLT)
+			    {
+			      sym_sec = htab->splt;
+			      sym_value = hh->eh.plt.offset;
+			    }
+
+			  if (sym_sec->output_section != NULL)
+			    destination = (sym_value + irela->r_addend
+					   + sym_sec->output_offset
+					   + sym_sec->output_section->vma);
+			  else
+			    continue;
+			}
+		      else if (hh->eh.root.type == bfd_link_hash_undefweak)
+			{
+			  if (! info->shared)
+			    continue;
+			}
+		      else if (hh->eh.root.type == bfd_link_hash_undefined)
+			{
+			  if (! (info->unresolved_syms_in_objects == RM_IGNORE
+				 && (ELF_ST_VISIBILITY (hh->eh.other)
+				     == STV_DEFAULT)))
+			    continue;
+			}
+		      else
+			{
+			  bfd_set_error (bfd_error_bad_value);
+			  goto error_ret_free_internal;
+			}
+		    }
+
+		  /* Determine what (if any) linker stub is needed.  */
+		  stub_type = metag_type_of_stub (section, irela, hh,
+						  destination, info);
+		  if (stub_type == metag_stub_none)
+		    continue;
+
+		  /* Support for grouping stub sections.  */
+		  id_sec = htab->stub_group[section->id].link_sec;
+
+		  /* Get the name of this stub.  */
+		  stub_name = metag_stub_name (id_sec, sym_sec, hh, irela);
+		  if (!stub_name)
+		    goto error_ret_free_internal;
+
+		  hsh = metag_stub_hash_lookup (&htab->bstab,
+						stub_name,
+						FALSE, FALSE);
+		  if (hsh != NULL)
+		    {
+		      /* The proper stub has already been created.  */
+		      free (stub_name);
+		      continue;
+		    }
+
+		  hsh = metag_add_stub (stub_name, section, htab);
+		  if (hsh == NULL)
+		    {
+		      free (stub_name);
+		      goto error_ret_free_internal;
+		    }
+		  hsh->target_value = sym_value;
+		  hsh->target_section = sym_sec;
+		  hsh->stub_type = stub_type;
+		  hsh->hh = hh;
+		  hsh->addend = irela->r_addend;
+		  stub_changed = TRUE;
+		}
+
+	      /* We're done with the internal relocs, free them.  */
+	      if (elf_section_data (section)->relocs == NULL)
+		free (internal_relocs);
+	    }
+	}
+
+      if (!stub_changed)
+	break;
+
+      /* OK, we've added some stubs.  Find out the new size of the
+	 stub sections.  */
+      for (stub_sec = htab->stub_bfd->sections;
+	   stub_sec != NULL;
+	   stub_sec = stub_sec->next)
+	stub_sec->size = 0;
+
+      bfd_hash_traverse (&htab->bstab, metag_size_one_stub, htab);
+
+      /* Ask the linker to do its stuff.  */
+      (*htab->layout_sections_again) ();
+      stub_changed = FALSE;
+    }
+
+  free (htab->all_local_syms);
+  return TRUE;
+
+ error_ret_free_local:
+  free (htab->all_local_syms);
+  return FALSE;
+}
+
+/* Build all the stubs associated with the current output file.  The
+   stubs are kept in a hash table attached to the main linker hash
+   table.  This function is called via metagelf_finish in the linker.  */
+
+bfd_boolean
+elf_metag_build_stubs (struct bfd_link_info *info)
+{
+  asection *stub_sec;
+  struct bfd_hash_table *table;
+  struct elf_metag_link_hash_table *htab;
+
+  htab = metag_link_hash_table (info);
+
+  for (stub_sec = htab->stub_bfd->sections;
+       stub_sec != NULL;
+       stub_sec = stub_sec->next)
+    {
+      bfd_size_type size;
+
+      /* Allocate memory to hold the linker stubs.  */
+      size = stub_sec->size;
+      stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
+      if (stub_sec->contents == NULL && size != 0)
+	return FALSE;
+      stub_sec->size = 0;
+    }
+
+  /* Build the stubs as directed by the stub hash table.  */
+  table = &htab->bstab;
+  bfd_hash_traverse (table, metag_build_one_stub, info);
+
+  return TRUE;
+}
+
+/* Return TRUE if SYM represents a local label symbol.  */
+
+static bfd_boolean
+elf_metag_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
+{
+  if (name[0] == '$' && name[1] == 'L')
+    return 1;
+  return _bfd_elf_is_local_label_name (abfd, name);
+}
+
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+   or (bfd_vma) -1 if it should not be included.  */
+
+static bfd_vma
+elf_metag_plt_sym_val (bfd_vma i, const asection *plt,
+		       const arelent *rel ATTRIBUTE_UNUSED)
+{
+  return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
+}
+
+#define ELF_ARCH		bfd_arch_metag
+#define ELF_TARGET_ID		METAG_ELF_DATA
+#define ELF_MACHINE_CODE	EM_METAG
+#define ELF_MINPAGESIZE	0x1000
+#define ELF_MAXPAGESIZE	0x4000
+#define ELF_COMMONPAGESIZE	0x1000
+
+#define TARGET_LITTLE_SYM	bfd_elf32_metag_vec
+#define TARGET_LITTLE_NAME	"elf32-metag"
+
+#define elf_symbol_leading_char '_'
+
+#define elf_info_to_howto_rel			NULL
+#define elf_info_to_howto			metag_info_to_howto_rela
+
+#define bfd_elf32_bfd_is_local_label_name	elf_metag_is_local_label_name
+#define bfd_elf32_bfd_link_hash_table_create \
+	elf_metag_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_free	elf_metag_link_hash_table_free
+#define elf_backend_relocate_section		elf_metag_relocate_section
+#define elf_backend_gc_mark_hook		elf_metag_gc_mark_hook
+#define elf_backend_gc_sweep_hook		elf_metag_gc_sweep_hook
+#define elf_backend_check_relocs		elf_metag_check_relocs
+#define elf_backend_create_dynamic_sections	elf_metag_create_dynamic_sections
+#define elf_backend_adjust_dynamic_symbol	elf_metag_adjust_dynamic_symbol
+#define elf_backend_finish_dynamic_symbol	elf_metag_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections	elf_metag_finish_dynamic_sections
+#define elf_backend_size_dynamic_sections	elf_metag_size_dynamic_sections
+#define elf_backend_omit_section_dynsym \
+  ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
+#define elf_backend_post_process_headers	elf_metag_post_process_headers
+#define elf_backend_reloc_type_class		elf_metag_reloc_type_class
+#define elf_backend_copy_indirect_symbol	elf_metag_copy_indirect_symbol
+#define elf_backend_plt_sym_val		elf_metag_plt_sym_val
+
+#define elf_backend_can_gc_sections		1
+#define elf_backend_can_refcount		1
+#define elf_backend_got_header_size		12
+#define elf_backend_rela_normal		1
+#define elf_backend_want_got_sym		0
+#define elf_backend_want_plt_sym		0
+#define elf_backend_plt_readonly		1
+
+#define bfd_elf32_bfd_reloc_type_lookup	metag_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup	metag_reloc_name_lookup
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-metag.h b/bfd/elf32-metag.h
new file mode 100644
index 0000000..46772e0
--- /dev/null
+++ b/bfd/elf32-metag.h
@@ -0,0 +1,38 @@
+/* Meta support for 32-bit ELF
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   Contributed by Imagination Technologies Ltd.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#ifndef _ELF32_METAG_H
+#define _ELF32_METAG_H
+
+extern int elf_metag_setup_section_lists
+  (bfd *, struct bfd_link_info *);
+
+extern void elf_metag_next_input_section
+  (struct bfd_link_info *, asection *);
+
+extern bfd_boolean elf_metag_size_stubs
+  (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
+   asection * (*) (const char *, asection *), void (*) (void));
+
+extern bfd_boolean elf_metag_build_stubs
+  (struct bfd_link_info *);
+
+#endif  /* _ELF32_METAG_H */
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index 27b569e..d936c42 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -370,6 +370,132 @@
           0,			/* Source Mask.  */
           0x0000ffff,		/* Dest Mask.  */
           FALSE), 		/* PC relative offset?  */
+
+   /* Marker relocs for TLS.  */
+   HOWTO (R_MICROBLAZE_TLS,
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MICROBLAZE_TLS",		/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+   HOWTO (R_MICROBLAZE_TLSGD,
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_MICROBLAZE_TLSGD",		/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+   HOWTO (R_MICROBLAZE_TLSLD,
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_MICROBLAZE_TLSLD",		/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+   /* Computes the load module index of the load module that contains the
+      definition of its TLS sym.  */
+   HOWTO (R_MICROBLAZE_TLSDTPMOD32,
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_MICROBLAZE_TLSDTPMOD32",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+   /* Computes a dtv-relative displacement, the difference between the value
+      of sym+add and the base address of the thread-local storage block that
+      contains the definition of sym, minus 0x8000.  Used for initializing GOT */
+   HOWTO (R_MICROBLAZE_TLSDTPREL32,
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_MICROBLAZE_TLSDTPREL32",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+   /* Computes a dtv-relative displacement, the difference between the value
+      of sym+add and the base address of the thread-local storage block that
+      contains the definition of sym, minus 0x8000.  */
+   HOWTO (R_MICROBLAZE_TLSDTPREL64,
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_MICROBLAZE_TLSDTPREL64",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+   /* Computes a tp-relative displacement, the difference between the value of
+      sym+add and the value of the thread pointer (r13).  */
+   HOWTO (R_MICROBLAZE_TLSGOTTPREL32,
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_MICROBLAZE_TLSGOTTPREL32",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+   /* Computes a tp-relative displacement, the difference between the value of
+      sym+add and the value of the thread pointer (r13).  */
+   HOWTO (R_MICROBLAZE_TLSTPREL32,
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* special_function */
+	 "R_MICROBLAZE_TLSTPREL32",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
 };
 
 #ifndef NUM_ELEM
@@ -461,6 +587,27 @@
     case BFD_RELOC_MICROBLAZE_32_GOTOFF:
       microblaze_reloc = R_MICROBLAZE_GOTOFF_32;
       break;
+    case BFD_RELOC_MICROBLAZE_64_TLSGD:
+      microblaze_reloc = R_MICROBLAZE_TLSGD;
+      break;
+    case BFD_RELOC_MICROBLAZE_64_TLSLD:
+      microblaze_reloc = R_MICROBLAZE_TLSLD;
+      break;
+    case BFD_RELOC_MICROBLAZE_32_TLSDTPREL:
+      microblaze_reloc = R_MICROBLAZE_TLSDTPREL32;
+      break;
+    case BFD_RELOC_MICROBLAZE_64_TLSDTPREL:
+      microblaze_reloc = R_MICROBLAZE_TLSDTPREL64;
+      break;
+    case BFD_RELOC_MICROBLAZE_32_TLSDTPMOD:
+      microblaze_reloc = R_MICROBLAZE_TLSDTPMOD32;
+      break;
+    case BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL:
+      microblaze_reloc = R_MICROBLAZE_TLSGOTTPREL32;
+      break;
+    case BFD_RELOC_MICROBLAZE_64_TLSTPREL:
+      microblaze_reloc = R_MICROBLAZE_TLSTPREL32;
+      break;
     case BFD_RELOC_MICROBLAZE_COPY:
       microblaze_reloc = R_MICROBLAZE_COPY;
       break;
@@ -550,8 +697,21 @@
   /* Track dynamic relocs copied for this symbol.  */
   struct elf32_mb_dyn_relocs *dyn_relocs;
 
+  /* TLS Reference Types for the symbol; Updated by check_relocs */
+#define TLS_GD     1  /* GD reloc. */
+#define TLS_LD     2  /* LD reloc. */
+#define TLS_TPREL  4  /* TPREL reloc, => IE. */
+#define TLS_DTPREL 8  /* DTPREL reloc, => LD. */
+#define TLS_TLS    16 /* Any TLS reloc.  */
+  unsigned char tls_mask;
+
 };
 
+#define IS_TLS_GD(x)     (x == (TLS_TLS | TLS_GD))
+#define IS_TLS_LD(x)     (x == (TLS_TLS | TLS_LD))
+#define IS_TLS_DTPREL(x) (x == (TLS_TLS | TLS_DTPREL))
+#define IS_TLS_NONE(x)   (x == 0)
+
 #define elf32_mb_hash_entry(ent) ((struct elf32_mb_link_hash_entry *)(ent))
 
 /* ELF linker hash table.  */
@@ -571,8 +731,17 @@
 
   /* Small local sym to section mapping cache.  */
   struct sym_cache sym_sec;
+
+  /* TLS Local Dynamic GOT Entry */
+  union {
+    bfd_signed_vma refcount;
+    bfd_vma offset;
+  } tlsld_got;
 };
 
+/* Nonzero if this section has TLS related relocations.  */
+#define has_tls_reloc sec_flg0
+
 /* Get the ELF linker hash table from a link_info structure.  */
 
 #define elf32_mb_hash_table(p)				\
@@ -604,6 +773,7 @@
 
       eh = (struct elf32_mb_link_hash_entry *) entry;
       eh->dyn_relocs = NULL;
+      eh->tls_mask = 0;
     }
 
   return entry;
@@ -654,6 +824,40 @@
                              + h->u.def.section->output_offset);
 }
 
+static bfd_vma
+dtprel_base (struct bfd_link_info *info)
+{
+  /* If tls_sec is NULL, we should have signalled an error already.  */
+  if (elf_hash_table (info)->tls_sec == NULL)
+    return 0;
+  return elf_hash_table (info)->tls_sec->vma;
+}
+
+/* The size of the thread control block.  */
+#define TCB_SIZE	8
+
+/* Output a simple dynamic relocation into SRELOC.  */
+
+static void
+microblaze_elf_output_dynamic_relocation (bfd *output_bfd,
+					  asection *sreloc,
+					  unsigned long reloc_index,
+					  unsigned long indx,
+					  int r_type,
+					  bfd_vma offset,
+					  bfd_vma addend)
+{
+
+  Elf_Internal_Rela rel;
+
+  rel.r_info = ELF32_R_INFO (indx, r_type);
+  rel.r_offset = offset;
+  rel.r_addend = addend;
+
+  bfd_elf32_swap_reloca_out (output_bfd, &rel,
+              (sreloc->contents + reloc_index * sizeof (Elf32_External_Rela)));
+}
+
 /* This code is taken from elf32-m32r.c
    There is some attempt to make this function usable for many architectures,
    both USE_REL and USE_RELA ['twould be nice if such a critter existed],
@@ -702,10 +906,12 @@
   Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
   Elf_Internal_Rela *rel, *relend;
+  int endian = (bfd_little_endian (output_bfd)) ? 0 : 2;
   /* Assume success.  */
   bfd_boolean ret = TRUE;
   asection *sreloc;
   bfd_vma *local_got_offsets;
+  unsigned int tls_type;
 
   if (!microblaze_elf_howto_table[R_MICROBLAZE_max-1])
     microblaze_elf_howto_init ();
@@ -737,6 +943,8 @@
 
       h = NULL;
       r_type = ELF32_R_TYPE (rel->r_info);
+      tls_type = 0;
+
       if (r_type < 0 || r_type >= (int) R_MICROBLAZE_max)
 	{
 	  (*_bfd_error_handler) (_("%s: unknown relocation type %d"),
@@ -815,11 +1023,12 @@
 	    {
 	      /* External symbol.  */
 	      bfd_boolean warned ATTRIBUTE_UNUSED;
+	      bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	      RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				       r_symndx, symtab_hdr, sym_hashes,
 				       h, sec, relocation,
-				       unresolved_reloc, warned);
+				       unresolved_reloc, warned, ignored);
 	      sym_name = h->root.root.string;
 	    }
 
@@ -933,9 +1142,9 @@
 			     + offset + INST_WORD_SIZE);
 	      relocation += addend;
 	      bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
-			  contents + offset + 2);
+	                  contents + offset + endian);
 	      bfd_put_16 (input_bfd, relocation & 0xffff,
-			  contents + offset + 2 + INST_WORD_SIZE);
+	                  contents + offset + endian + INST_WORD_SIZE);
 	      break;
 
 	    case (int) R_MICROBLAZE_PLT_64:
@@ -952,9 +1161,9 @@
 					      + input_section->output_offset
 					      + offset + INST_WORD_SIZE);
 		    bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff,
-				contents + offset + 2);
+		                contents + offset + endian);
 		    bfd_put_16 (input_bfd, immediate & 0xffff,
-				contents + offset + 2 + INST_WORD_SIZE);
+		                contents + offset + endian + INST_WORD_SIZE);
 		  }
 		else
 		  {
@@ -963,77 +1172,189 @@
 				   + offset + INST_WORD_SIZE);
 		    immediate = relocation;
 		    bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff,
-				contents + offset + 2);
+		                contents + offset + endian);
 		    bfd_put_16 (input_bfd, immediate & 0xffff,
-				contents + offset + 2 + INST_WORD_SIZE);
+		                contents + offset + endian + INST_WORD_SIZE);
 		  }
 		break;
 	      }
 
+	    case (int) R_MICROBLAZE_TLSGD:
+	      tls_type = (TLS_TLS | TLS_GD);
+	      goto dogot;
+	    case (int) R_MICROBLAZE_TLSLD:
+	      tls_type = (TLS_TLS | TLS_LD);
+	    dogot:
 	    case (int) R_MICROBLAZE_GOT_64:
 	      {
+		bfd_vma *offp;
+		bfd_vma off, off2;
+		unsigned long indx;
+		bfd_vma static_value;
+
+		bfd_boolean need_relocs = FALSE;
 		if (htab->sgot == NULL)
 		  abort ();
-		if (h == NULL)
-		  {
-		    bfd_vma off;
-		    if (local_got_offsets == NULL)
-		      abort ();
-		    off = local_got_offsets[r_symndx];
-		    /* The LSB indicates whether we've already
-		       created relocation.  */
-		    if (off & 1)
-		      off &= ~1;
-		    else
-		      {
-			bfd_put_32 (output_bfd, relocation + addend,
-				    htab->sgot->contents + off);
 
-			if (info->shared)
-			  {
-			    Elf_Internal_Rela outrel;
-			    bfd_byte *loc;
-			    if (htab->srelgot == NULL)
-			      abort ();
-			    outrel.r_offset = (htab->sgot->output_section->vma
-					       + htab->sgot->output_offset
-					       + off);
-			    outrel.r_info = ELF32_R_INFO (0, R_MICROBLAZE_REL);
-			    outrel.r_addend = relocation + addend;
-			    loc = htab->srelgot->contents;
-			    loc += htab->srelgot->reloc_count++
-			      * sizeof (Elf32_External_Rela);
-			    bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-			  }
-			local_got_offsets[r_symndx] |= 1;
-		      }
-		    relocation = htab->sgot->output_section->vma
-		      + htab->sgot->output_offset + off
-		      - htab->sgotplt->output_section->vma
-		      - htab->sgotplt->output_offset;
-		    unresolved_reloc = FALSE;
+		indx = 0;
+		offp = NULL;
+
+		/* 1. Identify GOT Offset;
+		   2. Compute Static Values
+		   3. Process Module Id, Process Offset
+		   4. Fixup Relocation with GOT offset value. */
+
+		/* 1. Determine GOT Offset to use : TLS_LD, global, local */
+		if (IS_TLS_LD (tls_type))
+		  offp = &htab->tlsld_got.offset;
+		else if (h != NULL)
+		  {
+		    if (htab->sgotplt != NULL && h->got.offset != (bfd_vma) -1)
+			offp = &h->got.offset;
+		    else
+			abort ();
 		  }
 		else
 		  {
-		    if (htab->sgotplt != NULL && h != NULL
-			&& h->got.offset != (bfd_vma) -1)
+		    if (local_got_offsets == NULL)
+		      abort ();
+		    offp = &local_got_offsets[r_symndx];
+		  }
+
+		if (!offp)
+		  abort ();
+
+		off = (*offp) & ~1;
+		off2 = off;
+
+		if (IS_TLS_LD(tls_type) || IS_TLS_GD(tls_type))
+		  off2 = off + 4;
+
+		/* Symbol index to use for relocs */
+		if (h != NULL)
+		  {
+		    bfd_boolean dyn =
+			elf_hash_table (info)->dynamic_sections_created;
+
+		    if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+			&& (!info->shared || !SYMBOL_REFERENCES_LOCAL (info, h)))
+		      indx = h->dynindx;
+		  }
+
+		/* Need to generate relocs ? */
+		if ((info->shared || indx != 0)
+		    && (h == NULL
+		    || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+		    || h->root.type != bfd_link_hash_undefweak))
+		  need_relocs = TRUE;
+
+		/* 2. Compute/Emit Static value of r-expression */
+		static_value = relocation + addend;
+
+		/* 3. Process module-id and offset */
+		if (! ((*offp) & 1) )
+		  {
+		    bfd_vma got_offset;
+
+		    got_offset = (htab->sgot->output_section->vma
+				  + htab->sgot->output_offset
+				  + off);
+
+		    /* Process module-id */
+		    if (IS_TLS_LD(tls_type))
 		      {
-			bfd_put_32 (output_bfd, relocation + addend,
-				    htab->sgot->contents + h->got.offset);
-			relocation = htab->sgot->output_section->vma
-			  + htab->sgot->output_offset
-			  + h->got.offset
-			  - htab->sgotplt->output_section->vma
-			  - htab->sgotplt->output_offset;
-			unresolved_reloc = FALSE;
+			if (! info->shared)
+			  {
+			    bfd_put_32 (output_bfd, 1, htab->sgot->contents + off);
+			  }
+			else
+			  {
+			    microblaze_elf_output_dynamic_relocation (output_bfd,
+			      htab->srelgot, htab->srelgot->reloc_count++,
+			      /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32,
+			      got_offset, 0);
+			  }
+		      }
+		    else if (IS_TLS_GD(tls_type))
+		      {
+		        if (! need_relocs)
+			  {
+			    bfd_put_32 (output_bfd, 1, htab->sgot->contents + off);
+			  }
+		        else
+			  {
+			    microblaze_elf_output_dynamic_relocation (output_bfd,
+			      htab->srelgot,
+			      htab->srelgot->reloc_count++,
+			      /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32,
+			      got_offset, indx ? 0 : static_value);
+			  }
+		      }
+
+		    /* Process Offset */
+		    if (htab->srelgot == NULL)
+		      abort ();
+
+		    got_offset = (htab->sgot->output_section->vma
+				  + htab->sgot->output_offset
+				  + off2);
+		    if (IS_TLS_LD(tls_type))
+		      {
+		        /* For LD, offset should be 0 */
+		        *offp |= 1;
+		        bfd_put_32 (output_bfd, 0, htab->sgot->contents + off2);
+		      }
+		    else if (IS_TLS_GD(tls_type))
+		      {
+		        *offp |= 1;
+		        static_value -= dtprel_base(info);
+		        if (need_relocs)
+		          {
+			    microblaze_elf_output_dynamic_relocation (output_bfd,
+			      htab->srelgot, htab->srelgot->reloc_count++,
+			      /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32,
+			      got_offset, indx ? 0 : static_value);
+		          }
+		        else
+			  {
+			    bfd_put_32 (output_bfd, static_value,
+					htab->sgot->contents + off2);
+		          }
 		      }
 		    else
-		      abort (); /* ??? */
+		      {
+			  bfd_put_32 (output_bfd, static_value,
+				      htab->sgot->contents + off2);
+
+			  /* Relocs for dyn symbols generated by
+			     finish_dynamic_symbols */
+			  if (info->shared && h == NULL)
+			    {
+			      *offp |= 1;
+			      microblaze_elf_output_dynamic_relocation (output_bfd,
+				htab->srelgot, htab->srelgot->reloc_count++,
+				/* symindex= */ indx, R_MICROBLAZE_REL,
+				got_offset, static_value);
+			    }
+		      }
 		  }
+
+		/* 4. Fixup Relocation with GOT offset value
+		      Compute relative address of GOT entry for applying
+		      the current relocation */
+		relocation = htab->sgot->output_section->vma
+			     + htab->sgot->output_offset
+			     + off
+			     - htab->sgotplt->output_section->vma
+			     - htab->sgotplt->output_offset;
+
+		/* Apply Current Relocation */
 		bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
-			    contents + offset + 2);
+		            contents + offset + endian);
 		bfd_put_16 (input_bfd, relocation & 0xffff,
-			    contents + offset + 2 + INST_WORD_SIZE);
+		            contents + offset + endian + INST_WORD_SIZE);
+
+		unresolved_reloc = FALSE;
 		break;
 	      }
 
@@ -1048,8 +1369,8 @@
 		immediate = relocation;
 		lo = immediate & 0x0000ffff;
 		high = (immediate >> 16) & 0x0000ffff;
-		bfd_put_16 (input_bfd, high, contents + offset + 2);
-		bfd_put_16 (input_bfd, lo, contents + offset + INST_WORD_SIZE + 2);
+		bfd_put_16 (input_bfd, high, contents + offset + endian);
+		bfd_put_16 (input_bfd, lo, contents + offset + INST_WORD_SIZE + endian);
 		break;
 	      }
 
@@ -1063,6 +1384,14 @@
 		break;
 	      }
 
+	    case (int) R_MICROBLAZE_TLSDTPREL64:
+	      relocation += addend;
+	      relocation -= dtprel_base(info);
+	      bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
+			  contents + offset + 2);
+	      bfd_put_16 (input_bfd, relocation & 0xffff,
+			  contents + offset + 2 + INST_WORD_SIZE);
+	      break;
 	    case (int) R_MICROBLAZE_64_PCREL :
 	    case (int) R_MICROBLAZE_64:
 	    case (int) R_MICROBLAZE_32:
@@ -1082,9 +1411,9 @@
 					 + input_section->output_offset
 					 + offset + INST_WORD_SIZE);
 			bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
-				    contents + offset + 2);
+			            contents + offset + endian);
 			bfd_put_16 (input_bfd, relocation & 0xffff,
-				    contents + offset + 2 + INST_WORD_SIZE);
+			            contents + offset + endian + INST_WORD_SIZE);
 		      }
 		    break;
 		  }
@@ -1176,9 +1505,9 @@
 					 + input_section->output_offset
 					 + offset + INST_WORD_SIZE);
 			bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
-				    contents + offset + 2);
+			            contents + offset + endian);
 			bfd_put_16 (input_bfd, relocation & 0xffff,
-				    contents + offset + 2 + INST_WORD_SIZE);
+			            contents + offset + endian + INST_WORD_SIZE);
 		      }
 		    break;
 		  }
@@ -1253,12 +1582,28 @@
 
   return ret;
 }
+
+/* Merge backend specific data from an object file to the output
+   object file when linking.
+
+   Note: We only use this hook to catch endian mismatches.  */
+static bfd_boolean
+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
+{
+  /* Check if we have the same endianess.  */
+  if (! _bfd_generic_verify_endian_match (ibfd, obfd))
+    return FALSE;
+
+  return TRUE;
+}
+
 
 /* Calculate fixup value for reference.  */
 
 static int
-calc_fixup (bfd_vma addr, asection *sec)
+calc_fixup (bfd_vma start, bfd_vma size, asection *sec)
 {
+  bfd_vma end = start + size;
   int i, fixup = 0;
 
   if (sec == NULL || sec->relax == NULL)
@@ -1267,14 +1612,45 @@
   /* Look for addr in relax table, total fixup value.  */
   for (i = 0; i < sec->relax_count; i++)
     {
-      if (addr <= sec->relax[i].addr)
+      if (end <= sec->relax[i].addr)
         break;
+      if ((end != start) && (start > sec->relax[i].addr))
+        continue;
       fixup += sec->relax[i].size;
     }
-
   return fixup;
 }
 
+/* Read-modify-write into the bfd, an immediate value into appropriate fields of
+   a 32-bit instruction.  */
+static void
+microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
+{
+    unsigned long instr = bfd_get_32 (abfd, bfd_addr);
+    instr &= ~0x0000ffff;
+    instr |= (val & 0x0000ffff);
+    bfd_put_32 (abfd, instr, bfd_addr);
+}
+
+/* Read-modify-write into the bfd, an immediate value into appropriate fields of
+   two consecutive 32-bit instructions.  */
+static void
+microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
+{
+    unsigned long instr_hi;
+    unsigned long instr_lo;
+
+    instr_hi = bfd_get_32 (abfd, bfd_addr);
+    instr_hi &= ~0x0000ffff;
+    instr_hi |= ((val >> 16) & 0x0000ffff);
+    bfd_put_32 (abfd, instr_hi, bfd_addr);
+
+    instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
+    instr_lo &= ~0x0000ffff;
+    instr_lo |= (val & 0x0000ffff);
+    bfd_put_32 (abfd, instr_lo, bfd_addr + INST_WORD_SIZE);
+}
+
 static bfd_boolean
 microblaze_elf_relax_section (bfd *abfd,
 			      asection *sec,
@@ -1305,7 +1681,8 @@
   /* Only do this for a text section.  */
   if (link_info->relocatable
       || (sec->flags & SEC_RELOC) == 0
-      || (sec->reloc_count == 0))
+      || (sec->reloc_count == 0)
+      || (sec->flags & SEC_CODE) == 0)
     return TRUE;
 
   BFD_ASSERT ((sec->size > 0) || (sec->rawsize > 0));
@@ -1453,7 +1830,7 @@
 	  bfd_vma nraddr;
 
           /* Get the new reloc address.  */
-	  nraddr = irel->r_offset - calc_fixup (irel->r_offset, sec);
+	  nraddr = irel->r_offset - calc_fixup (irel->r_offset, 0, sec);
           switch ((enum elf_microblaze_reloc_type) ELF32_R_TYPE (irel->r_info))
 	    {
 	    default:
@@ -1471,7 +1848,7 @@
 		  /* Only handle relocs against .text.  */
 		  if (isym->st_shndx == shndx
 		      && ELF32_ST_TYPE (isym->st_info) == STT_SECTION)
-		    irel->r_addend -= calc_fixup (irel->r_addend, sec);
+		    irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
 	        }
 	      break;
 	    case R_MICROBLAZE_NONE:
@@ -1481,11 +1858,12 @@
 	        int sfix, efix;
 	        bfd_vma target_address;
 	        target_address = irel->r_addend + irel->r_offset;
-	        sfix = calc_fixup (irel->r_offset, sec);
-	        efix = calc_fixup (target_address, sec);
+	        sfix = calc_fixup (irel->r_offset, 0, sec);
+	        efix = calc_fixup (target_address, 0, sec);
 	        irel->r_addend -= (efix - sfix);
 	        /* Should use HOWTO.  */
-	        bfd_put_16 (abfd, irel->r_addend, contents + irel->r_offset + 2);
+	        microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
+	                                           irel->r_addend);
 	      }
 	      break;
 	    case R_MICROBLAZE_64_NONE:
@@ -1495,11 +1873,11 @@
 	        int sfix, efix;
 	        bfd_vma target_address;
 		target_address = irel->r_addend + irel->r_offset + INST_WORD_SIZE;
-		sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, sec);
-		efix = calc_fixup (target_address, sec);
+		sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
+		efix = calc_fixup (target_address, 0, sec);
 		irel->r_addend -= (efix - sfix);
-		bfd_put_16 (abfd, irel->r_addend, contents + irel->r_offset
-			    + INST_WORD_SIZE + 2);
+    microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
+                                       + INST_WORD_SIZE, irel->r_addend);
 	      }
 	      break;
 	    }
@@ -1559,7 +1937,7 @@
                             }
 
                         }
-		      irelscan->r_addend -= calc_fixup (irelscan->r_addend, sec);
+		      irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
                     }
 		  else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
 		    {
@@ -1590,6 +1968,7 @@
 			}
 		      irelscan->r_addend -= calc_fixup (irel->r_addend
 							+ isym->st_value,
+							0,
 							sec);
 		    }
 		}
@@ -1627,13 +2006,14 @@
 			    }
 			}
 
-		      immediate = (unsigned short) bfd_get_16 (abfd, ocontents +
-							       irelscan->r_offset + 2);
+		      unsigned long instr = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
+		      immediate = instr & 0x0000ffff;
 		      target_address = immediate;
-		      offset = calc_fixup (target_address, sec);
+		      offset = calc_fixup (target_address, 0, sec);
 		      immediate -= offset;
 		      irelscan->r_addend -= offset;
-		      bfd_put_16 (abfd, immediate, ocontents + irelscan->r_offset + 2);
+          microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
+                                             irelscan->r_addend);
 		    }
 		}
 
@@ -1669,16 +2049,14 @@
 			      elf_section_data (o)->this_hdr.contents = ocontents;
 			    }
 			}
-		      immediate = (unsigned short) (bfd_get_16 (abfd, ocontents
-								+ irelscan->r_offset
-								+ 2) << 16)
-			& 0xffff0000;
-		      immediate += (unsigned short) (bfd_get_16 (abfd, ocontents
-								 + irelscan->r_offset
-								 + INST_WORD_SIZE + 2))
-			& 0x0000ffff;
-
-		      offset = calc_fixup (irelscan->r_addend, sec);
+          unsigned long instr_hi =  bfd_get_32 (abfd, ocontents
+                                                + irelscan->r_offset);
+          unsigned long instr_lo =  bfd_get_32 (abfd, ocontents
+                                                + irelscan->r_offset
+                                                + INST_WORD_SIZE);
+          immediate = (instr_hi & 0x0000ffff) << 16;
+          immediate |= (instr_lo & 0x0000ffff);
+		      offset = calc_fixup (irelscan->r_addend, 0, sec);
 		      immediate -= offset;
 		      irelscan->r_addend -= offset;
 		    }
@@ -1715,22 +2093,19 @@
 			      elf_section_data (o)->this_hdr.contents = ocontents;
 			    }
 			}
-
-		      immediate = (unsigned short)
-			(bfd_get_16 (abfd, ocontents + irelscan->r_offset + 2) << 16)
-			& 0xffff0000;
-		      immediate += (unsigned short)
-			(bfd_get_16 (abfd, ocontents + irelscan->r_offset
-				     + INST_WORD_SIZE + 2))
-			& 0x0000ffff;
+          unsigned long instr_hi =  bfd_get_32 (abfd, ocontents
+                                                + irelscan->r_offset);
+          unsigned long instr_lo =  bfd_get_32 (abfd, ocontents
+                                                + irelscan->r_offset
+                                                + INST_WORD_SIZE);
+          immediate = (instr_hi & 0x0000ffff) << 16;
+          immediate |= (instr_lo & 0x0000ffff);
 		      target_address = immediate;
-		      offset = calc_fixup (target_address, sec);
+		      offset = calc_fixup (target_address, 0, sec);
 		      immediate -= offset;
 		      irelscan->r_addend -= offset;
-		      bfd_put_16 (abfd, ((immediate >> 16) & 0x0000ffff),
-				  ocontents + irelscan->r_offset + 2);
-		      bfd_put_16 (abfd, (immediate & 0x0000ffff),
-				  ocontents + irelscan->r_offset + INST_WORD_SIZE + 2);
+          microblaze_bfd_write_imm_value_64 (abfd, ocontents
+                                             + irelscan->r_offset, immediate);
 		    }
 		}
             }
@@ -1741,24 +2116,30 @@
       for (isym = isymbuf; isym < isymend; isym++)
         {
           if (isym->st_shndx == shndx)
-	    isym->st_value =- calc_fixup (isym->st_value, sec);
+            {
+              isym->st_value -= calc_fixup (isym->st_value, 0, sec);
+              if (isym->st_size)
+                isym->st_size -= calc_fixup (isym->st_value, isym->st_size, sec);
+            }
         }
 
       /* Now adjust the global symbols defined in this section.  */
       isym = isymbuf + symtab_hdr->sh_info;
-      isymend = isymbuf + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym));
-      for (sym_index = 0; isym < isymend; isym++, sym_index++)
+      symcount =  (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)) - symtab_hdr->sh_info;
+      for (sym_index = 0; sym_index < symcount; sym_index++)
         {
           sym_hash = elf_sym_hashes (abfd)[sym_index];
-          if (isym->st_shndx == shndx
-              && (sym_hash->root.type == bfd_link_hash_defined
+          if ((sym_hash->root.type == bfd_link_hash_defined
                   || sym_hash->root.type == bfd_link_hash_defweak)
               && sym_hash->root.u.def.section == sec)
-	    {
-	      sym_hash->root.u.def.value -= calc_fixup (sym_hash->root.u.def.value,
-						        sec);
-	    }
-	}
+            {
+              sym_hash->root.u.def.value -= calc_fixup (sym_hash->root.u.def.value,
+                                                        0, sec);
+              if (sym_hash->size)
+                sym_hash->size -= calc_fixup (sym_hash->root.u.def.value,
+                                              sym_hash->size, sec);
+            }
+        }
 
       /* Physically move the code and change the cooked size.  */
       dest = sec->relax[0].addr;
@@ -1800,9 +2181,12 @@
 
   if (sec->relax_count == 0)
     {
+      *again = FALSE;
       free (sec->relax);
       sec->relax = NULL;
     }
+  else
+    *again = TRUE;
   return TRUE;
 
  error_return:
@@ -1894,6 +2278,33 @@
   return TRUE;
 }
 
+static bfd_boolean
+update_local_sym_info (bfd *abfd,
+		       Elf_Internal_Shdr *symtab_hdr,
+		       unsigned long r_symndx,
+		       unsigned int tls_type)
+{
+  bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd);
+  unsigned char *local_got_tls_masks;
+
+  if (local_got_refcounts == NULL)
+    {
+      bfd_size_type size = symtab_hdr->sh_info;
+
+      size *= (sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks));
+      local_got_refcounts = bfd_zalloc (abfd, size);
+      if (local_got_refcounts == NULL)
+        return FALSE;
+      elf_local_got_refcounts (abfd) = local_got_refcounts;
+    }
+
+  local_got_tls_masks =
+         (unsigned char *) (local_got_refcounts + symtab_hdr->sh_info);
+  local_got_tls_masks[r_symndx] |= tls_type;
+  local_got_refcounts[r_symndx] += 1;
+
+  return TRUE;
+}
 /* Look through the relocs for a section during the first phase.  */
 
 static bfd_boolean
@@ -1930,6 +2341,7 @@
       unsigned int r_type;
       struct elf_link_hash_entry * h;
       unsigned long r_symndx;
+      unsigned char tls_type = 0;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
       r_type = ELF32_R_TYPE (rel->r_info);
@@ -1937,7 +2349,13 @@
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
       else
-        h = sym_hashes [r_symndx - symtab_hdr->sh_info];
+	{
+	  h = sym_hashes [r_symndx - symtab_hdr->sh_info];
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
+	}
 
       switch (r_type)
         {
@@ -1965,6 +2383,13 @@
           break;
 
 	  /* This relocation requires .got entry.  */
+        case R_MICROBLAZE_TLSGD:
+          tls_type |= (TLS_TLS | TLS_GD);
+          goto dogottls;
+        case R_MICROBLAZE_TLSLD:
+          tls_type |= (TLS_TLS | TLS_LD);
+        dogottls:
+          sec->has_tls_reloc = 1;
         case R_MICROBLAZE_GOT_64:
           if (htab->sgot == NULL)
             {
@@ -1976,25 +2401,12 @@
           if (h != NULL)
 	    {
 	      h->got.refcount += 1;
+	      elf32_mb_hash_entry (h)->tls_mask |= tls_type;
 	    }
           else
 	    {
-	      bfd_signed_vma *local_got_refcounts;
-
-	      /* This is a global offset table entry for a local symbol.  */
-	      local_got_refcounts = elf_local_got_refcounts (abfd);
-	      if (local_got_refcounts == NULL)
-		{
-		  bfd_size_type size;
-
-		  size = symtab_hdr->sh_info;
-		  size *= sizeof (bfd_signed_vma);
-		  local_got_refcounts = bfd_zalloc (abfd, size);
-		  if (local_got_refcounts == NULL)
-		    return FALSE;
-		  elf_local_got_refcounts (abfd) = local_got_refcounts;
-		}
-	      local_got_refcounts[r_symndx] += 1;
+	      if (! update_local_sym_info(abfd, symtab_hdr, r_symndx, tls_type) )
+		return FALSE;
 	    }
           break;
 
@@ -2058,45 +2470,16 @@
 
 		if (sreloc == NULL)
 		  {
-		    const char *name;
 		    bfd *dynobj;
-		    unsigned int strndx = elf_elfheader (abfd)->e_shstrndx;
-		    unsigned int shnam = _bfd_elf_single_rel_hdr (sec)->sh_name;
-
-		    name = bfd_elf_string_from_elf_section (abfd, strndx, shnam);
-		    if (name == NULL)
-		      return FALSE;
-
-		    if (strncmp (name, ".rela", 5) != 0
-			|| strcmp (bfd_get_section_name (abfd, sec),
-				   name + 5) != 0)
-		      {
-			(*_bfd_error_handler)
-			  (_("%B: bad relocation section name `%s\'"),
-			   abfd, name);
-		      }
 
 		    if (htab->elf.dynobj == NULL)
 		      htab->elf.dynobj = abfd;
 		    dynobj = htab->elf.dynobj;
 
-		    sreloc = bfd_get_linker_section (dynobj, name);
+		    sreloc = _bfd_elf_make_dynamic_reloc_section (sec, dynobj,
+								  2, abfd, 1);
 		    if (sreloc == NULL)
-		      {
-			flagword flags;
-
-			flags = (SEC_HAS_CONTENTS | SEC_READONLY
-				 | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-			if ((sec->flags & SEC_ALLOC) != 0)
-			  flags |= SEC_ALLOC | SEC_LOAD;
-			sreloc = bfd_make_section_anyway_with_flags (dynobj,
-								     name,
-								     flags);
-			if (sreloc == NULL
-			    || ! bfd_set_section_alignment (dynobj, sreloc, 2))
-			  return FALSE;
-		      }
-		    elf_section_data (sec)->sreloc = sreloc;
+		      return FALSE;
 		  }
 
 		/* If this is a global symbol, we count the number of
@@ -2227,6 +2610,8 @@
       eind->dyn_relocs = NULL;
     }
 
+  edir->tls_mask |= eind->tls_mask;
+
   _bfd_elf_link_hash_copy_indirect (info, dir, ind);
 }
 
@@ -2445,8 +2830,10 @@
       h->needs_plt = 0;
     }
 
+  eh = (struct elf32_mb_link_hash_entry *) h;
   if (h->got.refcount > 0)
     {
+      unsigned int need;
       asection *s;
 
       /* Make sure this symbol is output as a dynamic symbol.
@@ -2458,15 +2845,43 @@
             return FALSE;
         }
 
-      s = htab->sgot;
-      h->got.offset = s->size;
-      s->size += 4;
-      htab->srelgot->size += sizeof (Elf32_External_Rela);
+      need = 0;
+      if ((eh->tls_mask & TLS_TLS) != 0)
+        {
+          /* Handle TLS Symbol */
+          if ((eh->tls_mask & TLS_LD) != 0)
+            {
+              if (!eh->elf.def_dynamic)
+                /* We'll just use htab->tlsld_got.offset.  This should
+                   always be the case.  It's a little odd if we have
+                   a local dynamic reloc against a non-local symbol.  */
+                htab->tlsld_got.refcount += 1;
+              else
+                need += 8;
+            }
+          if ((eh->tls_mask & TLS_GD) != 0)
+            need += 8;
+        }
+      else
+        {
+          /* Regular (non-TLS) symbol */
+          need += 4;
+        }
+      if (need == 0)
+        {
+          h->got.offset = (bfd_vma) -1;
+        }
+      else
+        {
+          s = htab->sgot;
+          h->got.offset = s->size;
+          s->size += need;
+          htab->srelgot->size += need * (sizeof (Elf32_External_Rela) / 4);
+        }
     }
   else
     h->got.offset = (bfd_vma) -1;
 
-  eh = (struct elf32_mb_link_hash_entry *) h;
   if (eh->dyn_relocs == NULL)
     return TRUE;
 
@@ -2564,6 +2979,7 @@
       bfd_signed_vma *end_local_got;
       bfd_size_type locsymcount;
       Elf_Internal_Shdr *symtab_hdr;
+      unsigned char *lgot_masks;
       asection *srel;
 
       if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
@@ -2603,17 +3019,36 @@
       symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
       locsymcount = symtab_hdr->sh_info;
       end_local_got = local_got + locsymcount;
+      lgot_masks = (unsigned char *) end_local_got;
       s = htab->sgot;
       srel = htab->srelgot;
 
-      for (; local_got < end_local_got; ++local_got)
-        {
-          if (*local_got > 0)
-            {
-              *local_got = s->size;
-              s->size += 4;
-              if (info->shared)
-                srel->size += sizeof (Elf32_External_Rela);
+      for (; local_got < end_local_got; ++local_got, ++lgot_masks)
+	{
+	  if (*local_got > 0)
+	    {
+	      unsigned int need = 0;
+	      if ((*lgot_masks & TLS_TLS) != 0)
+		{
+		  if ((*lgot_masks & TLS_GD) != 0)
+		    need += 8;
+		  if ((*lgot_masks & TLS_LD) != 0)
+		    htab->tlsld_got.refcount += 1;
+		}
+	      else
+		need += 4;
+
+	      if (need == 0)
+		{
+		  *local_got = (bfd_vma) -1;
+		}
+	      else
+		{
+		  *local_got = s->size;
+		  s->size += need;
+		  if (info->shared)
+		    srel->size += need * (sizeof (Elf32_External_Rela) / 4);
+		}
             }
           else
             *local_got = (bfd_vma) -1;
@@ -2624,6 +3059,16 @@
      sym dynamic relocs.  */
   elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
 
+  if (htab->tlsld_got.refcount > 0)
+    {
+      htab->tlsld_got.offset = htab->sgot->size;
+      htab->sgot->size += 8;
+      if (info->shared)
+        htab->srelgot->size += sizeof (Elf32_External_Rela);
+    }
+  else
+    htab->tlsld_got.offset = (bfd_vma) -1;
+
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       /* Make space for the trailing nop in .plt.  */
@@ -2742,6 +3187,7 @@
 				      Elf_Internal_Sym *sym)
 {
   struct elf32_mb_link_hash_table *htab;
+  struct elf32_mb_link_hash_entry *eh = elf32_mb_hash_entry(h);
 
   htab = elf32_mb_hash_table (info);
   if (htab == NULL)
@@ -2813,12 +3259,14 @@
         }
     }
 
-  if (h->got.offset != (bfd_vma) -1)
+  /* h->got.refcount to be checked ? */
+  if (h->got.offset != (bfd_vma) -1 &&
+      ! ((h->got.offset & 1) ||
+          IS_TLS_LD(eh->tls_mask) || IS_TLS_GD(eh->tls_mask)))
     {
       asection *sgot;
       asection *srela;
-      Elf_Internal_Rela rela;
-      bfd_byte *loc;
+      bfd_vma offset;
 
       /* This symbol has an entry in the global offset table.  Set it
          up.  */
@@ -2827,8 +3275,7 @@
       srela = htab->srelgot;
       BFD_ASSERT (sgot != NULL && srela != NULL);
 
-      rela.r_offset = (sgot->output_section->vma
-                       + sgot->output_offset
+      offset = (sgot->output_section->vma + sgot->output_offset
                        + (h->got.offset &~ (bfd_vma) 1));
 
       /* If this is a -Bsymbolic link, and the symbol is defined
@@ -2841,22 +3288,25 @@
           && h->def_regular)
         {
           asection *sec = h->root.u.def.section;
-          rela.r_info = ELF32_R_INFO (0, R_MICROBLAZE_REL);
-          rela.r_addend = (h->root.u.def.value
-                           + sec->output_section->vma
-                           + sec->output_offset);
+          microblaze_elf_output_dynamic_relocation (output_bfd,
+                                                    srela, srela->reloc_count++,
+                                                    /* symindex= */ 0,
+                                                    R_MICROBLAZE_REL, offset,
+                                                    h->root.u.def.value
+                                                    + sec->output_section->vma
+                                                    + sec->output_offset);
         }
       else
         {
-          rela.r_info = ELF32_R_INFO (h->dynindx, R_MICROBLAZE_GLOB_DAT);
-          rela.r_addend = 0;
+          microblaze_elf_output_dynamic_relocation (output_bfd,
+                                                    srela, srela->reloc_count++,
+                                                    h->dynindx,
+                                                    R_MICROBLAZE_GLOB_DAT,
+                                                    offset, 0);
         }
 
       bfd_put_32 (output_bfd, (bfd_vma) 0,
                   sgot->contents + (h->got.offset &~ (bfd_vma) 1));
-      loc = srela->contents;
-      loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
-      bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
     }
 
   if (h->needs_copy)
@@ -2882,9 +3332,9 @@
     }
 
   /* Mark some specially defined symbols as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
-      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
-      || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+  if (h == htab->elf.hdynamic
+      || h == htab->elf.hgot
+      || h == htab->elf.hplt)
     sym->st_shndx = SHN_ABS;
 
   return TRUE;
@@ -3016,6 +3466,8 @@
   return TRUE;
 }
 
+#define TARGET_LITTLE_SYM      bfd_elf32_microblazeel_vec
+#define TARGET_LITTLE_NAME     "elf32-microblazeel"
 
 #define TARGET_BIG_SYM          bfd_elf32_microblaze_vec
 #define TARGET_BIG_NAME		"elf32-microblaze"
@@ -3024,7 +3476,7 @@
 #define ELF_TARGET_ID		MICROBLAZE_ELF_DATA
 #define ELF_MACHINE_CODE	EM_MICROBLAZE
 #define ELF_MACHINE_ALT1	EM_MICROBLAZE_OLD
-#define ELF_MAXPAGESIZE		0x4   		/* 4k, if we ever have 'em.  */
+#define ELF_MAXPAGESIZE		0x1000
 #define elf_info_to_howto	microblaze_elf_info_to_howto
 #define elf_info_to_howto_rel	NULL
 
@@ -3032,6 +3484,7 @@
 #define bfd_elf32_bfd_is_local_label_name       microblaze_elf_is_local_label_name
 #define elf_backend_relocate_section		microblaze_elf_relocate_section
 #define bfd_elf32_bfd_relax_section             microblaze_elf_relax_section
+#define bfd_elf32_bfd_merge_private_bfd_data    microblaze_elf_merge_private_bfd_data
 #define bfd_elf32_bfd_reloc_name_lookup		microblaze_elf_reloc_name_lookup
 
 #define elf_backend_gc_mark_hook		microblaze_elf_gc_mark_hook
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 61e8b45..eec2ef7 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1515,7 +1515,7 @@
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS_COPY",		/* name */
 	 FALSE,			/* partial_inplace */
 	 0x0,         		/* src_mask */
@@ -1531,13 +1531,29 @@
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS_JUMP_SLOT",	/* name */
 	 FALSE,			/* partial_inplace */
 	 0x0,         		/* src_mask */
 	 0x0,		        /* dst_mask */
 	 FALSE);		/* pcrel_offset */
 
+/* Used in EH tables.  */
+static reloc_howto_type elf_mips_eh_howto =
+  HOWTO (R_MIPS_EH,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
+	 "R_MIPS_EH",		/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,	        /* dst_mask */
+	 FALSE);		/* pcrel_offset */
+
 /* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
    dangerous relocation.  */
 
@@ -2010,6 +2026,8 @@
       return &elf_mips_copy_howto;
     case BFD_RELOC_MIPS_JUMP_SLOT:
       return &elf_mips_jump_slot_howto;
+    case BFD_RELOC_MIPS_EH:
+      return &elf_mips_eh_howto;
     }
 }
 
@@ -2055,6 +2073,8 @@
     return &elf_mips_copy_howto;
   if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0)
     return &elf_mips_jump_slot_howto;
+  if (strcasecmp (elf_mips_eh_howto.name, r_name) == 0)
+    return &elf_mips_eh_howto;
 
   return NULL;
 }
@@ -2079,6 +2099,8 @@
       return &elf_mips_copy_howto;
     case R_MIPS_JUMP_SLOT:
       return &elf_mips_jump_slot_howto;
+    case R_MIPS_EH:
+      return &elf_mips_eh_howto;
     default:
       if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max)
 	return &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min];
@@ -2145,18 +2167,17 @@
 {
   unsigned long mach;
 
+  if (ABI_N32_P (abfd))
+    return FALSE;
+
   /* Irix 5 and 6 are broken.  Object file symbol tables are not always
      sorted correctly such that local symbols precede global symbols,
      and the sh_info field in the symbol table is not always right.  */
   if (SGI_COMPAT (abfd))
     elf_bad_symtab (abfd) = TRUE;
 
-  if (ABI_N32_P (abfd))
-    return FALSE;
-
   mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
   bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
-
   return TRUE;
 }
 
@@ -2187,10 +2208,10 @@
 
       case 256:		/* Linux/MIPS */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	/* pr_reg */
 	offset = 72;
@@ -2213,9 +2234,9 @@
 	return FALSE;
 
       case 128:		/* Linux/MIPS elf_prpsinfo */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
     }
 
@@ -2224,7 +2245,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -2345,7 +2366,6 @@
 #define elf_backend_default_use_rela_p	0
 #define elf_backend_sign_extend_vma	TRUE
 #define elf_backend_plt_readonly	1
-#define elf_backend_plt_sym_val		_bfd_mips_elf_plt_sym_val
 
 #define elf_backend_discard_info	_bfd_mips_elf_discard_info
 #define elf_backend_ignore_discarded_relocs \
@@ -2357,6 +2377,7 @@
 					mips_elf_is_local_label_name
 #define bfd_elf32_bfd_is_target_special_symbol \
 					_bfd_mips_elf_is_target_special_symbol
+#define bfd_elf32_get_synthetic_symtab	_bfd_mips_elf_get_synthetic_symtab
 #define bfd_elf32_find_nearest_line	_bfd_mips_elf_find_nearest_line
 #define bfd_elf32_find_inliner_info	_bfd_mips_elf_find_inliner_info
 #define bfd_elf32_new_section_hook	_bfd_mips_elf_new_section_hook
@@ -2372,6 +2393,7 @@
 #define bfd_elf32_bfd_print_private_bfd_data \
 					_bfd_mips_elf_print_private_bfd_data
 #define bfd_elf32_bfd_relax_section	_bfd_mips_elf_relax_section
+#define bfd_elf32_mkobject		_bfd_mips_elf_mkobject
 
 /* Support for SGI-ish mips targets.  */
 #define TARGET_LITTLE_SYM		bfd_elf32_littlemips_vec
@@ -2464,6 +2486,7 @@
 #define TARGET_LITTLE_NAME              "elf32-littlemips-vxworks"
 #define TARGET_BIG_SYM                  bfd_elf32_bigmips_vxworks_vec
 #define TARGET_BIG_NAME                 "elf32-bigmips-vxworks"
+#undef	ELF_OSABI
 
 #undef elf32_bed
 #define elf32_bed			elf32_mips_vxworks_bed
@@ -2483,7 +2506,6 @@
 #define elf_backend_default_use_rela_p		1
 #undef elf_backend_got_header_size
 #define elf_backend_got_header_size		(4 * 3)
-#undef elf_backend_plt_sym_val
 
 #undef elf_backend_finish_dynamic_symbol
 #define elf_backend_finish_dynamic_symbol \
@@ -2509,4 +2531,6 @@
 #undef elf_backend_symbol_processing
 /* NOTE: elf_backend_rela_normal is not defined for MIPS.  */
 
+#undef bfd_elf32_get_synthetic_symtab
+
 #include "elf32-target.h"
diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c
index c1a793e..a2215db 100644
--- a/bfd/elf32-moxie.c
+++ b/bfd/elf32-moxie.c
@@ -240,12 +240,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
@@ -356,6 +356,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
     }
 
@@ -366,8 +370,10 @@
 #define ELF_MACHINE_CODE	EM_MOXIE
 #define ELF_MAXPAGESIZE		0x1
 
-#define TARGET_BIG_SYM          bfd_elf32_moxie_vec
-#define TARGET_BIG_NAME		"elf32-moxie"
+#define TARGET_BIG_SYM          bfd_elf32_bigmoxie_vec
+#define TARGET_BIG_NAME		"elf32-bigmoxie"
+#define TARGET_LITTLE_SYM       bfd_elf32_littlemoxie_vec
+#define TARGET_LITTLE_NAME	"elf32-littlemoxie"
 
 #define elf_info_to_howto_rel			NULL
 #define elf_info_to_howto			moxie_info_to_howto_rela
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index c0459f4..533eea3 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -1,6 +1,5 @@
 /*  MSP430-specific support for 32-bit ELF
-    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012
-    Free Software Foundation, Inc.
+    Copyright (C) 2002-2013 Free Software Foundation, Inc.
     Contributed by Dmitry Diky <diwil@mail.ru>
 
     This file is part of BFD, the Binary File Descriptor library.
@@ -27,9 +26,6 @@
 #include "elf-bfd.h"
 #include "elf/msp430.h"
 
-/* Use RELA instead of REL.  */
-#undef USE_REL
-
 static reloc_howto_type elf_msp430_howto_table[] =
 {
   HOWTO (R_MSP430_NONE,		/* type */
@@ -60,7 +56,7 @@
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* A 13 bit PC relative relocation.  */
+  /* A 10 bit PC relative relocation.  */
   HOWTO (R_MSP430_10_PCREL,	/* type */
 	 1,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -69,10 +65,10 @@
 	 0,			/* bitpos */
 	 complain_overflow_bitfield,/* complain_on_overflow */
 	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_MSP430_13_PCREL",	/* name */
+	 "R_MSP430_10_PCREL",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xfff,			/* src_mask */
-	 0xfff,			/* dst_mask */
+	 0x3ff,			/* src_mask */
+	 0x3ff,			/* dst_mask */
 	 TRUE),			/* pcrel_offset */
 
   /* A 16 bit absolute relocation.  */
@@ -90,7 +86,7 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
-  /* A 16 bit absolute relocation for command address.  */
+  /* A 16 bit PC relative relocation for command address.  */
   HOWTO (R_MSP430_16_PCREL,	/* type */
 	 1,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -135,7 +131,7 @@
 	 0xffff,		/* dst_mask */
 	 TRUE),			/* pcrel_offset */
 
-  /* A 13 bit PC relative relocation for complicated polymorphs.  */
+  /* A 10 bit PC relative relocation for complicated polymorphs.  */
   HOWTO (R_MSP430_2X_PCREL,	/* type */
 	 1,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -146,8 +142,8 @@
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_MSP430_2X_PCREL",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xfff,			/* src_mask */
-	 0xfff,			/* dst_mask */
+	 0x3ff,			/* src_mask */
+	 0x3ff,			/* dst_mask */
 	 TRUE),			/* pcrel_offset */
 
   /* A 16 bit relaxable relocation for command address.  */
@@ -164,6 +160,340 @@
 	 0,			/* src_mask */
 	 0xffff,		/* dst_mask */
 	 TRUE)			/* pcrel_offset */
+
+  /* A 8-bit absolute relocation.  */
+  , HOWTO (R_MSP430_8,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430_8",		/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Together with a following reloc, allows for the difference
+     between two symbols to be the real addend of the second reloc.  */
+  HOWTO (R_MSP430_SYM_DIFF,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 NULL, 			/* special handler.  */
+	 "R_MSP430_SYM_DIFF",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE)			/* pcrel_offset */  
+};
+
+static reloc_howto_type elf_msp430x_howto_table[] =
+{
+  HOWTO (R_MSP430_NONE,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430_NONE",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_MSP430_ABS32,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430_ABS32",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_MSP430_ABS16,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430_ABS16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_MSP430_ABS8,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430_ABS8",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xff,			/* src_mask */
+	 0xff,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_MSP430_PCR16,	/* type */
+	 1,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430_PCR16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_PCR20_EXT_SRC,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_PCR20_EXT_SRC",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_PCR20_EXT_DST,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_PCR20_EXT_DST",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_PCR20_EXT_ODST,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_PCR20_EXT_ODST",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_ABS20_EXT_SRC,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_ABS20_EXT_SRC",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_ABS20_EXT_DST,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_ABS20_EXT_DST",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_ABS20_EXT_ODST,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_ABS20_EXT_ODST",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_ABS20_ADR_SRC,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_ABS20_ADR_SRC",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_ABS20_ADR_DST,/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_ABS20_ADR_DST",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_PCR16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_PCR16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_PCR20_CALL,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_PCR20_CALL",/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430X_ABS16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_ABS16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430_ABS_HI16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430_ABS_HI16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_MSP430_PREL31,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430_PREL31",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 TRUE),                 /* pcrel_offset */
+
+  EMPTY_HOWTO (R_MSP430_EHTYPE),
+  
+  /* A 10 bit PC relative relocation.  */
+  HOWTO (R_MSP430X_10_PCREL,	/* type */
+	 1,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 10,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_10_PCREL",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0x3ff,			/* src_mask */
+	 0x3ff,			/* dst_mask */
+	 TRUE),  		/* pcrel_offset */
+
+  /* A 10 bit PC relative relocation for complicated polymorphs.  */
+  HOWTO (R_MSP430X_2X_PCREL,	/* type */
+	 1,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 10,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_MSP430X_2X_PCREL",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0x3ff,			/* src_mask */
+	 0x3ff,			/* dst_mask */
+	 TRUE),			/* pcrel_offset */
+
+  /* Together with a following reloc, allows for the difference
+     between two symbols to be the real addend of the second reloc.  */
+  HOWTO (R_MSP430X_SYM_DIFF,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 NULL, 			/* special handler.  */
+	 "R_MSP430X_SYM_DIFF",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE)			/* pcrel_offset */  
 };
 
 /* Map BFD reloc types to MSP430 ELF reloc types.  */
@@ -175,18 +505,55 @@
 };
 
 static const struct msp430_reloc_map msp430_reloc_map[] =
-  {
-    {BFD_RELOC_NONE,                 R_MSP430_NONE},
-    {BFD_RELOC_32,                   R_MSP430_32},
-    {BFD_RELOC_MSP430_10_PCREL,      R_MSP430_10_PCREL},
-    {BFD_RELOC_16,                   R_MSP430_16_BYTE},
-    {BFD_RELOC_MSP430_16_PCREL,      R_MSP430_16_PCREL},
-    {BFD_RELOC_MSP430_16,            R_MSP430_16},
-    {BFD_RELOC_MSP430_16_PCREL_BYTE, R_MSP430_16_PCREL_BYTE},
-    {BFD_RELOC_MSP430_16_BYTE,       R_MSP430_16_BYTE},
-    {BFD_RELOC_MSP430_2X_PCREL,      R_MSP430_2X_PCREL},
-    {BFD_RELOC_MSP430_RL_PCREL,      R_MSP430_RL_PCREL}
-  };
+{
+  {BFD_RELOC_NONE,                 R_MSP430_NONE},
+  {BFD_RELOC_32,                   R_MSP430_32},
+  {BFD_RELOC_MSP430_10_PCREL,      R_MSP430_10_PCREL},
+  {BFD_RELOC_16,                   R_MSP430_16_BYTE},
+  {BFD_RELOC_MSP430_16_PCREL,      R_MSP430_16_PCREL},
+  {BFD_RELOC_MSP430_16,            R_MSP430_16},
+  {BFD_RELOC_MSP430_16_PCREL_BYTE, R_MSP430_16_PCREL_BYTE},
+  {BFD_RELOC_MSP430_16_BYTE,       R_MSP430_16_BYTE},
+  {BFD_RELOC_MSP430_2X_PCREL,      R_MSP430_2X_PCREL},
+  {BFD_RELOC_MSP430_RL_PCREL,      R_MSP430_RL_PCREL},
+  {BFD_RELOC_8,                    R_MSP430_8},
+  {BFD_RELOC_MSP430_SYM_DIFF,      R_MSP430_SYM_DIFF}
+};
+
+static const struct msp430_reloc_map msp430x_reloc_map[] =
+{
+  {BFD_RELOC_NONE,                    R_MSP430_NONE},
+  {BFD_RELOC_32,                      R_MSP430_ABS32},
+  {BFD_RELOC_16,                      R_MSP430_ABS16},
+  {BFD_RELOC_8,                       R_MSP430_ABS8},
+  {BFD_RELOC_MSP430_ABS8,             R_MSP430_ABS8},
+  {BFD_RELOC_MSP430X_PCR20_EXT_SRC,   R_MSP430X_PCR20_EXT_SRC},
+  {BFD_RELOC_MSP430X_PCR20_EXT_DST,   R_MSP430X_PCR20_EXT_DST},
+  {BFD_RELOC_MSP430X_PCR20_EXT_ODST,  R_MSP430X_PCR20_EXT_ODST},
+  {BFD_RELOC_MSP430X_ABS20_EXT_SRC,   R_MSP430X_ABS20_EXT_SRC},
+  {BFD_RELOC_MSP430X_ABS20_EXT_DST,   R_MSP430X_ABS20_EXT_DST},
+  {BFD_RELOC_MSP430X_ABS20_EXT_ODST,  R_MSP430X_ABS20_EXT_ODST},
+  {BFD_RELOC_MSP430X_ABS20_ADR_SRC,   R_MSP430X_ABS20_ADR_SRC},
+  {BFD_RELOC_MSP430X_ABS20_ADR_DST,   R_MSP430X_ABS20_ADR_DST},
+  {BFD_RELOC_MSP430X_PCR16,           R_MSP430X_PCR16},
+  {BFD_RELOC_MSP430X_PCR20_CALL,      R_MSP430X_PCR20_CALL},
+  {BFD_RELOC_MSP430X_ABS16,           R_MSP430X_ABS16},
+  {BFD_RELOC_MSP430_ABS_HI16,         R_MSP430_ABS_HI16},
+  {BFD_RELOC_MSP430_PREL31,           R_MSP430_PREL31},
+  {BFD_RELOC_MSP430_10_PCREL,         R_MSP430X_10_PCREL},
+  {BFD_RELOC_MSP430_2X_PCREL,         R_MSP430X_2X_PCREL},
+  {BFD_RELOC_MSP430_RL_PCREL,         R_MSP430X_PCR16},
+  {BFD_RELOC_MSP430_SYM_DIFF,         R_MSP430X_SYM_DIFF}
+};
+
+static inline bfd_boolean
+uses_msp430x_relocs (bfd * abfd)
+{
+  extern const bfd_target bfd_elf32_msp430_ti_vec;
+
+  return bfd_get_mach (abfd) == bfd_mach_msp430x
+    || abfd->xvec == & bfd_elf32_msp430_ti_vec;
+}
 
 static reloc_howto_type *
 bfd_elf32_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
@@ -194,9 +561,18 @@
 {
   unsigned int i;
 
-  for (i = 0; i < ARRAY_SIZE (msp430_reloc_map); i++)
-    if (msp430_reloc_map[i].bfd_reloc_val == code)
-      return &elf_msp430_howto_table[msp430_reloc_map[i].elf_reloc_val];
+  if (uses_msp430x_relocs (abfd))
+    {
+      for (i = ARRAY_SIZE (msp430x_reloc_map); i--;)
+	if (msp430x_reloc_map[i].bfd_reloc_val == code)
+	  return elf_msp430x_howto_table + msp430x_reloc_map[i].elf_reloc_val;
+    }
+  else
+    {
+      for (i = 0; i < ARRAY_SIZE (msp430_reloc_map); i++)
+	if (msp430_reloc_map[i].bfd_reloc_val == code)
+	  return &elf_msp430_howto_table[msp430_reloc_map[i].elf_reloc_val];
+    }
 
   return NULL;
 }
@@ -207,13 +583,23 @@
 {
   unsigned int i;
 
-  for (i = 0;
-       i < (sizeof (elf_msp430_howto_table)
-	    / sizeof (elf_msp430_howto_table[0]));
-       i++)
-    if (elf_msp430_howto_table[i].name != NULL
-	&& strcasecmp (elf_msp430_howto_table[i].name, r_name) == 0)
-      return &elf_msp430_howto_table[i];
+  if (uses_msp430x_relocs (abfd))
+    {
+      for (i = ARRAY_SIZE (elf_msp430x_howto_table); i--;)
+	if (elf_msp430x_howto_table[i].name != NULL
+	    && strcasecmp (elf_msp430x_howto_table[i].name, r_name) == 0)
+	  return elf_msp430x_howto_table + i;
+    }
+  else
+    {
+      for (i = 0;
+	   i < (sizeof (elf_msp430_howto_table)
+		/ sizeof (elf_msp430_howto_table[0]));
+	   i++)
+	if (elf_msp430_howto_table[i].name != NULL
+	    && strcasecmp (elf_msp430_howto_table[i].name, r_name) == 0)
+	  return &elf_msp430_howto_table[i];
+    }
 
   return NULL;
 }
@@ -228,6 +614,14 @@
   unsigned int r_type;
 
   r_type = ELF32_R_TYPE (dst->r_info);
+
+  if (uses_msp430x_relocs (abfd))
+    {
+      BFD_ASSERT (r_type < (unsigned int) R_MSP430x_max);
+      cache_ptr->howto = elf_msp430x_howto_table + r_type;
+      return;
+    }
+
   BFD_ASSERT (r_type < (unsigned int) R_MSP430_max);
   cache_ptr->howto = &elf_msp430_howto_table[r_type];
 }
@@ -266,6 +660,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
     }
 
@@ -276,16 +674,413 @@
    routines, but a few relocs, we have to do them ourselves.  */
 
 static bfd_reloc_status_type
-msp430_final_link_relocate (reloc_howto_type * howto, bfd * input_bfd,
-			    asection * input_section, bfd_byte * contents,
-			    Elf_Internal_Rela * rel, bfd_vma relocation)
+msp430_final_link_relocate (reloc_howto_type *     howto,
+			    bfd *                  input_bfd,
+			    asection *             input_section,
+			    bfd_byte *             contents,
+			    Elf_Internal_Rela *    rel,
+			    bfd_vma                relocation,
+			    struct bfd_link_info * info)
 {
+  static asection *  sym_diff_section;
+  static bfd_vma     sym_diff_value;
+
+  struct bfd_elf_section_data * esd = elf_section_data (input_section);
   bfd_reloc_status_type r = bfd_reloc_ok;
   bfd_vma x;
   bfd_signed_vma srel;
+  bfd_boolean is_rel_reloc = FALSE;
 
-  switch (howto->type)
+  if (uses_msp430x_relocs (input_bfd))
     {
+      /* See if we have a REL type relocation.  */
+      is_rel_reloc = (esd->rel.hdr != NULL);
+      /* Sanity check - only one type of relocation per section.
+	 FIXME: Theoretically it is possible to have both types,
+	 but if that happens how can we distinguish between the two ?  */
+      BFD_ASSERT (! is_rel_reloc || ! esd->rela.hdr);
+      /* If we are using a REL relocation then the addend should be empty.  */
+      BFD_ASSERT (! is_rel_reloc || rel->r_addend == 0);
+    }
+
+  if (sym_diff_section != NULL)
+    {
+      BFD_ASSERT (sym_diff_section == input_section);
+ 
+     if (uses_msp430x_relocs (input_bfd))
+       switch (howto->type)
+	 {
+	 case R_MSP430_ABS32:
+	  /* If we are computing a 32-bit value for the location lists
+	     and the result is 0 then we add one to the value.  A zero
+	     value can result because of linker relaxation deleteing
+	     prologue instructions and using a value of 1 (for the begin
+	     and end offsets in the location list entry) results in a
+	     nul entry which does not prevent the following entries from
+	     being parsed.  */
+	   if (relocation == sym_diff_value
+	       && strcmp (input_section->name, ".debug_loc") == 0)
+	     ++ relocation;
+	   /* Fall through.  */
+	 case R_MSP430_ABS16:
+	 case R_MSP430X_ABS16:
+	 case R_MSP430_ABS8:
+	   BFD_ASSERT (! is_rel_reloc);
+	   relocation -= sym_diff_value;
+	  break;
+
+	 default:
+	   return bfd_reloc_dangerous;
+	 }
+     else
+       switch (howto->type)
+	 {
+	 case R_MSP430_32:
+	 case R_MSP430_16:
+	 case R_MSP430_16_BYTE:
+	 case R_MSP430_8:
+	   relocation -= sym_diff_value;
+	  break;
+
+	 default:
+	   return bfd_reloc_dangerous;
+	 }
+       
+      sym_diff_section = NULL;
+    }
+
+  if (uses_msp430x_relocs (input_bfd))
+    switch (howto->type)
+      {
+      case R_MSP430X_SYM_DIFF:
+	/* Cache the input section and value.
+	   The offset is unreliable, since relaxation may
+	   have reduced the following reloc's offset.  */
+	BFD_ASSERT (! is_rel_reloc);
+	sym_diff_section = input_section;
+	sym_diff_value = relocation;
+	return bfd_reloc_ok;
+
+      case R_MSP430_ABS16:
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  srel += bfd_get_16 (input_bfd, contents);
+	else
+	  srel += rel->r_addend;
+	bfd_put_16 (input_bfd, srel & 0xffff, contents);
+	break;
+
+      case R_MSP430X_10_PCREL:
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  srel += bfd_get_16 (input_bfd, contents) & 0x3ff;
+	else
+	  srel += rel->r_addend;
+	srel -= rel->r_offset;
+	srel -= 2;		/* Branch instructions add 2 to the PC...  */
+	srel -= (input_section->output_section->vma +
+		 input_section->output_offset);
+	if (srel & 1)
+	  return bfd_reloc_outofrange;
+
+	/* MSP430 addresses commands as words.  */
+	srel >>= 1;
+
+	/* Check for an overflow.  */
+	if (srel < -512 || srel > 511)
+	  {
+	    if (info->disable_target_specific_optimizations < 0)
+	      {
+		static bfd_boolean warned = FALSE;
+		if (! warned)
+		  {
+		    info->callbacks->warning
+		      (info,
+		       _("Try enabling relaxation to avoid relocation truncations"),
+		       NULL, input_bfd, input_section, relocation);
+		    warned = TRUE;
+		  }
+	      }
+	    return bfd_reloc_overflow;
+	  }
+
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xfc00) | (srel & 0x3ff);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430X_PCR20_EXT_ODST:
+	/* [0,4]+[48,16] = ---F ---- FFFF */
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  {
+	    bfd_vma addend;
+	    addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16;
+	    addend |= bfd_get_16 (input_bfd, contents+4);
+	    srel += addend;
+	    
+	  }
+	else
+	  srel += rel->r_addend;
+	srel -= rel->r_offset;
+	srel -= (input_section->output_section->vma +
+		 input_section->output_offset);
+	bfd_put_16 (input_bfd, (srel & 0xffff), contents + 6);
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xfff0) | ((srel >> 16) & 0xf);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430X_ABS20_EXT_SRC:
+	/* [7,4]+[32,16] = -78- FFFF */
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  {
+	    bfd_vma addend;
+	    addend = (bfd_get_16 (input_bfd, contents) & 0x0780) << 9;
+	    addend |= bfd_get_16 (input_bfd, contents+2);
+	    srel += addend;
+	  }
+	else
+	  srel += rel->r_addend;
+	bfd_put_16 (input_bfd, (srel & 0xffff), contents + 4);
+	srel >>= 16;
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xf87f) | ((srel << 7) & 0x0780);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430_16_PCREL:
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  srel += bfd_get_16 (input_bfd, contents);
+	else
+	  srel += rel->r_addend;
+	srel -= rel->r_offset;
+	/* Only branch instructions add 2 to the PC...  */
+	srel -= (input_section->output_section->vma +
+		 input_section->output_offset);
+	if (srel & 1)
+	  return bfd_reloc_outofrange;
+	bfd_put_16 (input_bfd, srel & 0xffff, contents);
+	break;
+
+      case R_MSP430X_PCR20_EXT_DST:
+	/* [0,4]+[32,16] = ---F FFFF */
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  {
+	    bfd_vma addend;
+	    addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16;
+	    addend |= bfd_get_16 (input_bfd, contents+2);
+	    srel += addend;
+	  }
+	else
+	  srel += rel->r_addend;
+	srel -= rel->r_offset;
+	srel -= (input_section->output_section->vma +
+		 input_section->output_offset);
+	bfd_put_16 (input_bfd, (srel & 0xffff), contents + 4);
+	srel >>= 16;
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xfff0) | (srel & 0xf);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430X_PCR20_EXT_SRC:
+	/* [7,4]+32,16] = -78- FFFF */
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  {
+	    bfd_vma addend;
+	    addend = ((bfd_get_16 (input_bfd, contents) & 0x0780) << 9);
+	    addend |= bfd_get_16 (input_bfd, contents+2);
+	    srel += addend;;
+	  }
+	else
+	  srel += rel->r_addend;
+	srel -= rel->r_offset;
+	/* Only branch instructions add 2 to the PC...  */
+	srel -= (input_section->output_section->vma +
+		 input_section->output_offset);
+	bfd_put_16 (input_bfd, (srel & 0xffff), contents + 4);
+	srel >>= 16;
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xf87f) | ((srel << 7) & 0x0780);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430_ABS8:
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  srel += bfd_get_8 (input_bfd, contents);
+	else
+	  srel += rel->r_addend;
+	bfd_put_8 (input_bfd, srel & 0xff, contents);
+	break;
+
+      case R_MSP430X_ABS20_EXT_DST:
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  srel += bfd_get_16 (input_bfd, contents) & 0xf;
+	else
+	  srel += rel->r_addend;
+	bfd_put_16 (input_bfd, (srel & 0xffff), contents + 4);
+	srel >>= 16;
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xfff0) | (srel & 0xf);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430X_ABS20_EXT_ODST:
+	/* [0,4]+[48,16] = ---F ---- FFFF */
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  {
+	    bfd_vma addend;
+	    addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16;
+	    addend |= bfd_get_16 (input_bfd, contents+4);
+	    srel += addend;
+	  }
+	else
+	  srel += rel->r_addend;
+	bfd_put_16 (input_bfd, (srel & 0xffff), contents + 6);
+	srel >>= 16;
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xfff0) | (srel & 0xf);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430X_ABS20_ADR_SRC:
+	/* [8,4]+[32,16] = -F-- FFFF */
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  {
+	    bfd_vma addend;
+
+	    addend = ((bfd_get_16 (input_bfd, contents) & 0xf00) << 8);
+	    addend |= bfd_get_16 (input_bfd, contents+2);
+	    srel += addend;
+	  }
+	else
+	  srel += rel->r_addend;
+	bfd_put_16 (input_bfd, (srel & 0xffff), contents + 2);
+	srel >>= 16;
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xf0ff) | ((srel << 8) & 0x0f00);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430X_ABS20_ADR_DST:
+	/* [0,4]+[32,16] = ---F FFFF */
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  {
+	    bfd_vma addend;
+	    addend = ((bfd_get_16 (input_bfd, contents) & 0xf) << 16);
+	    addend |= bfd_get_16 (input_bfd, contents+2);
+	    srel += addend;
+	  }
+	else
+	  srel += rel->r_addend;
+	bfd_put_16 (input_bfd, (srel & 0xffff), contents + 2);
+	srel >>= 16;
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xfff0) | (srel & 0xf);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+
+      case R_MSP430X_ABS16:
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  srel += bfd_get_16 (input_bfd, contents);
+	else
+	  srel += rel->r_addend;
+	x = srel;
+	if (x > 0xffff)
+	  return bfd_reloc_overflow;	
+	bfd_put_16 (input_bfd, srel & 0xffff, contents);
+	break;
+
+      case R_MSP430_ABS_HI16:
+	/* The EABI specifies that this must be a RELA reloc.  */
+	BFD_ASSERT (! is_rel_reloc);
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	srel += rel->r_addend;
+	bfd_put_16 (input_bfd, (srel >> 16) & 0xffff, contents);
+	break;
+      
+      case R_MSP430X_PCR20_CALL:
+	/* [0,4]+[32,16] = ---F FFFF*/
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  {
+	    bfd_vma addend;
+	    addend = (bfd_get_16 (input_bfd, contents) & 0xf) << 16;
+	    addend |= bfd_get_16 (input_bfd, contents+2);
+	    srel += addend;
+	  }
+	else
+	  srel += rel->r_addend;
+	srel -= rel->r_offset;
+	srel -= (input_section->output_section->vma +
+		 input_section->output_offset);
+	bfd_put_16 (input_bfd, srel & 0xffff, contents + 2);
+	srel >>= 16;
+	x = bfd_get_16 (input_bfd, contents);
+	x = (x & 0xfff0) | (srel & 0xf);
+	bfd_put_16 (input_bfd, x, contents);
+	break;
+	
+      case R_MSP430X_PCR16:
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  srel += bfd_get_16 (input_bfd, contents);
+	else
+	  srel += rel->r_addend;
+	srel -= rel->r_offset;
+	srel -= (input_section->output_section->vma +
+		 input_section->output_offset);
+	bfd_put_16 (input_bfd, srel & 0xffff, contents);
+	break;
+      
+      case R_MSP430_PREL31:
+	contents += rel->r_offset;
+	srel = (bfd_signed_vma) relocation;
+	if (is_rel_reloc)
+	  srel += (bfd_get_32 (input_bfd, contents) & 0x7fffffff);
+	else
+	  srel += rel->r_addend;
+	srel += rel->r_addend;
+	x = bfd_get_32 (input_bfd, contents);
+	x = (x & 0x80000000) | ((srel >> 31) & 0x7fffffff);
+	bfd_put_32 (input_bfd, x, contents);
+	break;
+	
+      default:
+	r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+				      contents, rel->r_offset,
+				      relocation, rel->r_addend);
+      }
+  else
+    switch (howto->type)
+      {
     case R_MSP430_10_PCREL:
       contents += rel->r_offset;
       srel = (bfd_signed_vma) relocation;
@@ -303,8 +1098,22 @@
 
       /* Check for an overflow.  */
       if (srel < -512 || srel > 511)
-	return bfd_reloc_overflow;
-
+	{
+	  if (info->disable_target_specific_optimizations < 0)
+	    {
+	      static bfd_boolean warned = FALSE;
+	      if (! warned)
+		{
+		  info->callbacks->warning
+		    (info,
+		     _("Try enabling relaxation to avoid relocation truncations"),
+		     NULL, input_bfd, input_section, relocation);
+		  warned = TRUE;
+		}
+	    }
+	  return bfd_reloc_overflow;
+	}
+      
       x = bfd_get_16 (input_bfd, contents);
       x = (x & 0xfc00) | (srel & 0x3ff);
       bfd_put_16 (input_bfd, x, contents);
@@ -339,8 +1148,8 @@
       bfd_put_16 (input_bfd, x, contents - 2);
       break;
 
-    case R_MSP430_16_PCREL:
     case R_MSP430_RL_PCREL:
+    case R_MSP430_16_PCREL:
       contents += rel->r_offset;
       srel = (bfd_signed_vma) relocation;
       srel += rel->r_addend;
@@ -385,11 +1194,27 @@
       bfd_put_16 (input_bfd, srel & 0xffff, contents);
       break;
 
-    default:
-      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
-				    contents, rel->r_offset,
-				    relocation, rel->r_addend);
-    }
+    case R_MSP430_8:
+      contents += rel->r_offset;
+      srel = (bfd_signed_vma) relocation;
+      srel += rel->r_addend;
+
+      bfd_put_8 (input_bfd, srel & 0xff, contents);
+      break;
+	 
+    case R_MSP430_SYM_DIFF:
+      /* Cache the input section and value.
+	 The offset is unreliable, since relaxation may
+	 have reduced the following reloc's offset.  */
+      sym_diff_section = input_section;
+      sym_diff_value = relocation;
+      return bfd_reloc_ok;
+
+      default:
+	r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+				      contents, rel->r_offset,
+				      relocation, rel->r_addend);
+      }
 
   return r;
 }
@@ -429,7 +1254,12 @@
 
       r_type = ELF32_R_TYPE (rel->r_info);
       r_symndx = ELF32_R_SYM (rel->r_info);
-      howto = elf_msp430_howto_table + r_type;
+
+      if (uses_msp430x_relocs (input_bfd))
+	howto = elf_msp430x_howto_table + r_type;
+      else
+	howto = elf_msp430_howto_table + r_type;
+
       h = NULL;
       sym = NULL;
       sec = NULL;
@@ -442,16 +1272,17 @@
 
 	  name = bfd_elf_string_from_elf_section
 	      (input_bfd, symtab_hdr->sh_link, sym->st_name);
-	  name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
+	  name = (name == NULL || * name == 0) ? bfd_section_name (input_bfd, sec) : name;
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
+	  name = h->root.root.string;
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -462,7 +1293,7 @@
 	continue;
 
       r = msp430_final_link_relocate (howto, input_bfd, input_section,
-				      contents, rel, relocation);
+				      contents, rel, relocation, info);
 
       if (r != bfd_reloc_ok)
 	{
@@ -472,7 +1303,7 @@
 	    {
 	    case bfd_reloc_overflow:
 	      r = info->callbacks->reloc_overflow
-		  (info, (h ? &h->root : NULL), name, howto->name,
+		(info, (h ? &h->root : NULL), name, howto->name,
 		   (bfd_vma) 0, input_bfd, input_section,
 		   rel->r_offset);
 	      break;
@@ -483,7 +1314,7 @@
 	      break;
 
 	    case bfd_reloc_outofrange:
-	      msg = _("internal error: out of range error");
+	      msg = _("internal error: branch/jump to an odd address detected");
 	      break;
 
 	    case bfd_reloc_notsupported:
@@ -525,61 +1356,29 @@
   switch (bfd_get_mach (abfd))
     {
     default:
-    case bfd_mach_msp110:
-      val = E_MSP430_MACH_MSP430x11x1;
-      break;
-
-    case bfd_mach_msp11:
-      val = E_MSP430_MACH_MSP430x11;
-      break;
-
-    case bfd_mach_msp12:
-      val = E_MSP430_MACH_MSP430x12;
-      break;
-
-    case bfd_mach_msp13:
-      val = E_MSP430_MACH_MSP430x13;
-      break;
-
-    case bfd_mach_msp14:
-      val = E_MSP430_MACH_MSP430x14;
-      break;
-
-    case bfd_mach_msp15:
-      val = E_MSP430_MACH_MSP430x15;
-      break;
-
-    case bfd_mach_msp16:
-      val = E_MSP430_MACH_MSP430x16;
-      break;
-
-    case bfd_mach_msp31:
-      val = E_MSP430_MACH_MSP430x31;
-      break;
-
-    case bfd_mach_msp32:
-      val = E_MSP430_MACH_MSP430x32;
-      break;
-
-    case bfd_mach_msp33:
-      val = E_MSP430_MACH_MSP430x33;
-      break;
-
-    case bfd_mach_msp41:
-      val = E_MSP430_MACH_MSP430x41;
-      break;
-
-    case bfd_mach_msp42:
-      val = E_MSP430_MACH_MSP430x42;
-      break;
-
-    case bfd_mach_msp43:
-      val = E_MSP430_MACH_MSP430x43;
-      break;
-
-    case bfd_mach_msp44:
-      val = E_MSP430_MACH_MSP430x44;
-      break;
+    case bfd_mach_msp110: val = E_MSP430_MACH_MSP430x11x1; break;
+    case bfd_mach_msp11: val = E_MSP430_MACH_MSP430x11; break;
+    case bfd_mach_msp12: val = E_MSP430_MACH_MSP430x12; break;
+    case bfd_mach_msp13: val = E_MSP430_MACH_MSP430x13; break;
+    case bfd_mach_msp14: val = E_MSP430_MACH_MSP430x14; break;
+    case bfd_mach_msp15: val = E_MSP430_MACH_MSP430x15; break;
+    case bfd_mach_msp16: val = E_MSP430_MACH_MSP430x16; break;
+    case bfd_mach_msp31: val = E_MSP430_MACH_MSP430x31; break;
+    case bfd_mach_msp32: val = E_MSP430_MACH_MSP430x32; break;
+    case bfd_mach_msp33: val = E_MSP430_MACH_MSP430x33; break;
+    case bfd_mach_msp41: val = E_MSP430_MACH_MSP430x41; break;
+    case bfd_mach_msp42: val = E_MSP430_MACH_MSP430x42; break;
+    case bfd_mach_msp43: val = E_MSP430_MACH_MSP430x43; break;
+    case bfd_mach_msp44: val = E_MSP430_MACH_MSP430x44; break;
+    case bfd_mach_msp20: val = E_MSP430_MACH_MSP430x20; break;
+    case bfd_mach_msp22: val = E_MSP430_MACH_MSP430x22; break;
+    case bfd_mach_msp23: val = E_MSP430_MACH_MSP430x23; break;
+    case bfd_mach_msp24: val = E_MSP430_MACH_MSP430x24; break;
+    case bfd_mach_msp26: val = E_MSP430_MACH_MSP430x26; break;
+    case bfd_mach_msp46: val = E_MSP430_MACH_MSP430x46; break;
+    case bfd_mach_msp47: val = E_MSP430_MACH_MSP430x47; break;
+    case bfd_mach_msp54: val = E_MSP430_MACH_MSP430x54; break;
+    case bfd_mach_msp430x: val = E_MSP430_MACH_MSP430X; break;
     }
 
   elf_elfheader (abfd)->e_machine = EM_MSP430;
@@ -602,64 +1401,32 @@
       switch (e_mach)
 	{
 	default:
-	case E_MSP430_MACH_MSP430x11:
-	  e_set = bfd_mach_msp11;
-	  break;
-
-	case E_MSP430_MACH_MSP430x11x1:
-	  e_set = bfd_mach_msp110;
-	  break;
-
-	case E_MSP430_MACH_MSP430x12:
-	  e_set = bfd_mach_msp12;
-	  break;
-
-	case E_MSP430_MACH_MSP430x13:
-	  e_set = bfd_mach_msp13;
-	  break;
-
-	case E_MSP430_MACH_MSP430x14:
-	  e_set = bfd_mach_msp14;
-	  break;
-
-	case E_MSP430_MACH_MSP430x15:
-	  e_set = bfd_mach_msp15;
-	  break;
-
-	case E_MSP430_MACH_MSP430x16:
-	  e_set = bfd_mach_msp16;
-	  break;
-
-	case E_MSP430_MACH_MSP430x31:
-	  e_set = bfd_mach_msp31;
-	  break;
-
-	case E_MSP430_MACH_MSP430x32:
-	  e_set = bfd_mach_msp32;
-	  break;
-
-	case E_MSP430_MACH_MSP430x33:
-	  e_set = bfd_mach_msp33;
-	  break;
-
-	case E_MSP430_MACH_MSP430x41:
-	  e_set = bfd_mach_msp41;
-	  break;
-
-	case E_MSP430_MACH_MSP430x42:
-	  e_set = bfd_mach_msp42;
-	  break;
-
-	case E_MSP430_MACH_MSP430x43:
-	  e_set = bfd_mach_msp43;
-	  break;
-
-	case E_MSP430_MACH_MSP430x44:
-	  e_set = bfd_mach_msp44;
-	  break;
+	case E_MSP430_MACH_MSP430x11: e_set = bfd_mach_msp11; break;
+	case E_MSP430_MACH_MSP430x11x1: e_set = bfd_mach_msp110; break;
+	case E_MSP430_MACH_MSP430x12: e_set = bfd_mach_msp12; break;
+	case E_MSP430_MACH_MSP430x13: e_set = bfd_mach_msp13; break;
+	case E_MSP430_MACH_MSP430x14: e_set = bfd_mach_msp14; break;
+	case E_MSP430_MACH_MSP430x15: e_set = bfd_mach_msp15; break;
+	case E_MSP430_MACH_MSP430x16: e_set = bfd_mach_msp16; break;
+	case E_MSP430_MACH_MSP430x31: e_set = bfd_mach_msp31; break;
+	case E_MSP430_MACH_MSP430x32: e_set = bfd_mach_msp32; break;
+	case E_MSP430_MACH_MSP430x33: e_set = bfd_mach_msp33; break;
+	case E_MSP430_MACH_MSP430x41: e_set = bfd_mach_msp41; break;
+	case E_MSP430_MACH_MSP430x42: e_set = bfd_mach_msp42; break;
+	case E_MSP430_MACH_MSP430x43: e_set = bfd_mach_msp43; break;
+	case E_MSP430_MACH_MSP430x44: e_set = bfd_mach_msp44; break;
+	case E_MSP430_MACH_MSP430x20: e_set = bfd_mach_msp20; break;
+	case E_MSP430_MACH_MSP430x22: e_set = bfd_mach_msp22; break;
+	case E_MSP430_MACH_MSP430x23: e_set = bfd_mach_msp23; break;
+	case E_MSP430_MACH_MSP430x24: e_set = bfd_mach_msp24; break;
+	case E_MSP430_MACH_MSP430x26: e_set = bfd_mach_msp26; break;
+	case E_MSP430_MACH_MSP430x46: e_set = bfd_mach_msp46; break;
+	case E_MSP430_MACH_MSP430x47: e_set = bfd_mach_msp47; break;
+	case E_MSP430_MACH_MSP430x54: e_set = bfd_mach_msp54; break;
+	case E_MSP430_MACH_MSP430X: e_set = bfd_mach_msp430x; break;
 	}
     }
-
+  
   return bfd_default_set_arch_mach (abfd, bfd_arch_msp430, e_set);
 }
 
@@ -667,9 +1434,11 @@
    Relaxation required only in two cases:
     - Bad hand coding like jumps from one section to another or
       from file to file.
-    - Sibling calls. This will affect onlu 'jump label' polymorph. Without
+    - Sibling calls. This will affect only 'jump label' polymorph. Without
       relaxing this enlarges code by 2 bytes. Sibcalls implemented but
       do not work in gcc's port by the reason I do not know.
+    - To convert out of range conditional jump instructions (found inside
+      a function) into inverted jumps over an unconditional branch instruction.
    Anyway, if a relaxation required, user should pass -relax option to the
    linker.
 
@@ -793,11 +1562,13 @@
   return FALSE;
 }
 
-/* Adjust all local symbols defined as '.section + 0xXXXX' (.section has sec_shndx)
-    referenced from current and other sections */
+/* Adjust all local symbols defined as '.section + 0xXXXX' (.section has
+   sec_shndx) referenced from current and other sections.  */
+
 static bfd_boolean
-msp430_elf_relax_adjust_locals(bfd * abfd, asection * sec, bfd_vma addr,
-    int count, unsigned int sec_shndx, bfd_vma toaddr)
+msp430_elf_relax_adjust_locals (bfd * abfd, asection * sec, bfd_vma addr,
+				int count, unsigned int sec_shndx,
+				bfd_vma toaddr)
 {
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Rela *irel;
@@ -805,11 +1576,14 @@
   Elf_Internal_Sym *isym;
 
   irel = elf_section_data (sec)->relocs;
+  if (irel == NULL)
+    return TRUE;
+
   irelend = irel + sec->reloc_count;
   symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
   isym = (Elf_Internal_Sym *) symtab_hdr->contents;
   
-  for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
+  for (;irel < irelend; irel++)
     {
       int sidx = ELF32_R_SYM(irel->r_info);
       Elf_Internal_Sym *lsym = isym + sidx;
@@ -859,7 +1633,7 @@
   /* Adjust all the relocs.  */
   symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
   isym = (Elf_Internal_Sym *) symtab_hdr->contents;
-  for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
+  for (; irel < irelend; irel++)
     {
       /* Get the new reloc address.  */
       if ((irel->r_offset > addr && irel->r_offset < toaddr))
@@ -867,7 +1641,7 @@
     }
 
   for (p = abfd->sections; p != NULL; p = p->next)
-    msp430_elf_relax_adjust_locals(abfd,p,addr,count,sec_shndx,toaddr);
+    msp430_elf_relax_adjust_locals (abfd,p,addr,count,sec_shndx,toaddr);
   
   /* Adjust the local symbols defined in this section.  */
   symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
@@ -897,7 +1671,82 @@
   return TRUE;
 }
 
+/* Insert two words into a section whilst relaxing.  */
 
+static bfd_byte *
+msp430_elf_relax_add_two_words (bfd * abfd, asection * sec, bfd_vma addr,
+				int word1, int word2)
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  unsigned int sec_shndx;
+  bfd_byte *contents;
+  Elf_Internal_Rela *irel;
+  Elf_Internal_Rela *irelend;
+  Elf_Internal_Sym *isym;
+  Elf_Internal_Sym *isymend;
+  struct elf_link_hash_entry **sym_hashes;
+  struct elf_link_hash_entry **end_hashes;
+  unsigned int symcount;
+  bfd_vma sec_end;
+  asection *p;
+
+  contents = elf_section_data (sec)->this_hdr.contents;
+  sec_end = sec->size;
+
+  /* Make space for the new words.  */
+  contents = bfd_realloc (contents, sec_end + 4);
+  memmove (contents + addr + 4, contents + addr, sec_end - addr);
+
+  /* Insert the new words.  */
+  bfd_put_16 (abfd, word1, contents + addr);
+  bfd_put_16 (abfd, word2, contents + addr + 2);
+
+  /* Update the section information.  */
+  sec->size += 4;
+  elf_section_data (sec)->this_hdr.contents = contents;  
+
+  /* Adjust all the relocs.  */
+  irel = elf_section_data (sec)->relocs;
+  irelend = irel + sec->reloc_count;
+
+  for (; irel < irelend; irel++)
+    if ((irel->r_offset >= addr && irel->r_offset < sec_end))
+      irel->r_offset += 4;
+
+  /* Adjust the local symbols defined in this section.  */
+  sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
+  for (p = abfd->sections; p != NULL; p = p->next)
+    msp430_elf_relax_adjust_locals (abfd, p, addr, -4,
+				    sec_shndx, sec_end);
+
+  /* Adjust the global symbols affected by the move.  */
+  symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
+  isym = (Elf_Internal_Sym *) symtab_hdr->contents;
+  for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++)
+    if (isym->st_shndx == sec_shndx
+	&& isym->st_value >= addr && isym->st_value < sec_end)
+      isym->st_value += 4;
+
+  /* Now adjust the global symbols defined in this section.  */
+  symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
+	      - symtab_hdr->sh_info);
+  sym_hashes = elf_sym_hashes (abfd);
+  end_hashes = sym_hashes + symcount;
+  for (; sym_hashes < end_hashes; sym_hashes++)
+    {
+      struct elf_link_hash_entry *sym_hash = *sym_hashes;
+
+      if ((sym_hash->root.type == bfd_link_hash_defined
+	   || sym_hash->root.type == bfd_link_hash_defweak)
+	  && sym_hash->root.u.def.section == sec
+	  && sym_hash->root.u.def.value >= addr
+	  && sym_hash->root.u.def.value < sec_end)
+	sym_hash->root.u.def.value += 4;
+    }
+
+  return contents;
+}
+   
 static bfd_boolean
 msp430_elf_relax_section (bfd * abfd, asection * sec,
 			  struct bfd_link_info * link_info,
@@ -910,6 +1759,7 @@
   bfd_byte *          contents = NULL;
   Elf_Internal_Sym *  isymbuf = NULL;
 
+
   /* Assume nothing changes.  */
   *again = FALSE;
 
@@ -917,8 +1767,8 @@
      this section does not have relocs, or if this is not a
      code section.  */
   if (link_info->relocatable
-      || (sec->flags & SEC_RELOC) == 0
-      || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0)
+    || (sec->flags & SEC_RELOC) == 0
+    || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0)
     return TRUE;
 
   symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
@@ -931,13 +1781,21 @@
 
   /* Walk through them looking for relaxing opportunities.  */
   irelend = internal_relocs + sec->reloc_count;
+
+  /* Do code size growing relocs first.  */
   for (irel = internal_relocs; irel < irelend; irel++)
     {
       bfd_vma symval;
 
       /* If this isn't something that can be relaxed, then ignore
          this reloc.  */
-      if (ELF32_R_TYPE (irel->r_info) != (int) R_MSP430_RL_PCREL)
+      if (uses_msp430x_relocs (abfd)
+          && ELF32_R_TYPE (irel->r_info) == (int) R_MSP430X_10_PCREL)
+	;
+      else if (! uses_msp430x_relocs (abfd)
+               && ELF32_R_TYPE (irel->r_info) == (int) R_MSP430_10_PCREL)
+	;
+      else
 	continue;
 
       /* Get the section contents if we haven't done so already.  */
@@ -1011,109 +1869,288 @@
          that would be more work, but would require less memory when
          the linker is run.  */
 
-      /* Try to turn a 16bit pc-relative branch into a 10bit pc-relative
-         branch.  */
-      /* Paranoia? paranoia...  */      
-      if (ELF32_R_TYPE (irel->r_info) == (int) R_MSP430_RL_PCREL)
+      bfd_signed_vma value = symval;
+      int opcode;
+
+      /* Compute the value that will be relocated.  */
+      value += irel->r_addend;
+      /* Convert to PC relative.  */
+      value -= (sec->output_section->vma + sec->output_offset);
+      value -= irel->r_offset;
+      value -= 2;
+      /* Scale.  */
+      value >>= 1;
+
+      /* If it is in range then no modifications are needed.  */
+      if (value >= -512 && value <= 511)
+	continue;
+
+      /* Get the opcode.  */
+      opcode = bfd_get_16 (abfd, contents + irel->r_offset);
+	  
+      /* Compute the new opcode.  We are going to convert:
+	 J<cond> label
+	 into:
+	 J<inv-cond> 1f
+	 BR[A] #label
+	 1:                     */
+      switch (opcode & 0xfc00)
 	{
-	  bfd_vma value = symval;
-
-	  /* Deal with pc-relative gunk.  */
-	  value -= (sec->output_section->vma + sec->output_offset);
-	  value -= irel->r_offset;
-	  value += irel->r_addend;
-
-	  /* See if the value will fit in 10 bits, note the high value is
-	     1016 as the target will be two bytes closer if we are
-	     able to relax. */
-	  if ((long) value < 1016 && (long) value > -1016)
-	    {
-	      int code0 = 0, code1 = 0, code2 = 0;
-	      int i;
-	      struct rcodes_s *rx;
-
-	      /* Get the opcode.  */
-	      if (irel->r_offset >= 6)
-		code0 = bfd_get_16 (abfd, contents + irel->r_offset - 6);
-
-	      if (irel->r_offset >= 4)
-		code1 = bfd_get_16 (abfd, contents + irel->r_offset - 4);
-
-	      code2 = bfd_get_16 (abfd, contents + irel->r_offset - 2);
-
-	      if (code2 != 0x4010)
-		continue;
-
-	      /* Check r4 and r3.  */
-	      for (i = NUMB_RELAX_CODES - 1; i >= 0; i--)
-		{
-		  rx = &rcode[i];
-		  if (rx->cdx == 2 && rx->f0 == code0 && rx->f1 == code1)
-		    break;
-		  else if (rx->cdx == 1 && rx->f1 == code1)
-		    break;
-		  else if (rx->cdx == 0)	/* This is an unconditional jump.  */
-		    break;
-		}
-
-	      /* Check labels:
-		   .Label0:       ; we do not care about this label
-		      jeq    +6
-		   .Label1:       ; make sure there is no label here
-		      jl     +4
-		   .Label2:       ; make sure there is no label here
-		      br .Label_dst
-
-	         So, if there is .Label1 or .Label2 we cannot relax this code.
-	         This actually should not happen, cause for relaxable
-		 instructions we use RL_PCREL reloc instead of 16_PCREL.
-		 Will change this in the future. */
-
-	      if (rx->cdx > 0
-		  && msp430_elf_symbol_address_p (abfd, sec, isymbuf,
-						  irel->r_offset - 2))
-		continue;
-	      if (rx->cdx > 1
-		  && msp430_elf_symbol_address_p (abfd, sec, isymbuf,
-						  irel->r_offset - 4))
-		continue;
-
-	      /* Note that we've changed the relocs, section contents, etc.  */
-	      elf_section_data (sec)->relocs = internal_relocs;
-	      elf_section_data (sec)->this_hdr.contents = contents;
-	      symtab_hdr->contents = (unsigned char *) isymbuf;
-
-	      /* Fix the relocation's type.  */
-	      if (rx->labels == 3)	/* Handle special cases.  */
-		irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
-					   R_MSP430_2X_PCREL);
-	      else
-		irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
-					   R_MSP430_10_PCREL);
-
-	      /* Fix the opcode right way.  */
-	      bfd_put_16 (abfd, rx->t0, contents + irel->r_offset - rx->off);
-	      if (rx->t1)
-		bfd_put_16 (abfd, rx->t1,
-			    contents + irel->r_offset - rx->off + 2);
-
-	      /* Delete bytes. */
-	      if (!msp430_elf_relax_delete_bytes (abfd, sec,
-						  irel->r_offset - rx->off +
-						  rx->ncl, rx->bs))
-		goto error_return;
-
-	      /* Handle unconditional jumps.  */
-	      if (rx->cdx == 0)
-		irel->r_offset -= 2;
-
-	      /* That will change things, so, we should relax again.
-	         Note that this is not required, and it may be slow.  */
-	      *again = TRUE;
-	    }
+	case 0x3800: opcode = 0x3402; break; /* Jl  -> Jge +2 */  
+	case 0x3400: opcode = 0x3802; break; /* Jge -> Jl  +2 */
+	case 0x2c00: opcode = 0x2802; break; /* Jhs -> Jlo +2 */
+	case 0x2800: opcode = 0x2c02; break; /* Jlo -> Jhs +2 */
+	case 0x2400: opcode = 0x2002; break; /* Jeq -> Jne +2 */
+	case 0x2000: opcode = 0x2402; break; /* jne -> Jeq +2 */
+	case 0x3000: /* jn    */
+	  /* There is no direct inverse of the Jn insn.
+	     FIXME: we could do this as:
+	        Jn 1f
+	        br 2f
+	     1: br label
+	     2:                */
+	  continue;
+	default:
+	  /* Not a conditional branch instruction.  */
+	  /* fprintf (stderr, "unrecog: %x\n", opcode); */
+	  goto error_return;
 	}
+
+      /* Note that we've changed the relocs, section contents, etc.  */
+      elf_section_data (sec)->relocs = internal_relocs;
+      elf_section_data (sec)->this_hdr.contents = contents;
+      symtab_hdr->contents = (unsigned char *) isymbuf;
+
+      /* Install the new opcode.  */
+      bfd_put_16 (abfd, opcode, contents + irel->r_offset);
+
+      /* Insert the new branch instruction.  */
+      if (uses_msp430x_relocs (abfd))
+	{
+	  /* Insert an absolute branch (aka MOVA) instruction.  */	  
+	  contents = msp430_elf_relax_add_two_words
+	    (abfd, sec, irel->r_offset + 2, 0x0080, 0x0000);
+
+	  /* Update the relocation to point to the inserted branch
+	     instruction.  Note - we are changing a PC-relative reloc
+	     into an absolute reloc, but this is OK because we have
+	     arranged with the assembler to have the reloc's value be
+	     a (local) symbol, not a section+offset value.  */
+	  irel->r_offset += 2;
+	  irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+				       R_MSP430X_ABS20_ADR_SRC);
+	}
+      else
+	{
+	  contents = msp430_elf_relax_add_two_words
+	    (abfd, sec, irel->r_offset + 2, 0x4030, 0x0000);
+
+	  /* See comment above about converting a 10-bit PC-rel
+	     relocation into a 16-bit absolute relocation.  */
+	  irel->r_offset += 4;
+	  irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+				       R_MSP430_16);
+	}
+
+      /* Growing the section may mean that other
+	 conditional branches need to be fixed.  */
+      *again = TRUE;
     }
 
+  if (! uses_msp430x_relocs (abfd))
+    /* Now perform the relocations that shrink the code size.
+       We only do this for non msp430x as gas only generates the RL
+       reloc for the msp430.  */
+    for (irel = internal_relocs; irel < irelend; irel++)
+      {
+	bfd_vma symval;
+
+	/* Get the section contents if we haven't done so already.  */
+	if (contents == NULL)
+	  {
+	    /* Get cached copy if it exists.  */
+	    if (elf_section_data (sec)->this_hdr.contents != NULL)
+	      contents = elf_section_data (sec)->this_hdr.contents;
+	    else if (! bfd_malloc_and_get_section (abfd, sec, &contents))
+	      goto error_return;
+	  }
+
+	/* Read this BFD's local symbols if we haven't done so already.  */
+	if (isymbuf == NULL && symtab_hdr->sh_info != 0)
+	  {
+	    isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
+	    if (isymbuf == NULL)
+	      isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
+					      symtab_hdr->sh_info, 0,
+					      NULL, NULL, NULL);
+	    if (isymbuf == NULL)
+	      goto error_return;
+	  }
+
+	/* Get the value of the symbol referred to by the reloc.  */
+	if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
+	  {
+	    /* A local symbol.  */
+	    Elf_Internal_Sym *isym;
+	    asection *sym_sec;
+
+	    isym = isymbuf + ELF32_R_SYM (irel->r_info);
+	    if (isym->st_shndx == SHN_UNDEF)
+	      sym_sec = bfd_und_section_ptr;
+	    else if (isym->st_shndx == SHN_ABS)
+	      sym_sec = bfd_abs_section_ptr;
+	    else if (isym->st_shndx == SHN_COMMON)
+	      sym_sec = bfd_com_section_ptr;
+	    else
+	      sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+	    symval = (isym->st_value
+		      + sym_sec->output_section->vma + sym_sec->output_offset);
+	  }
+	else
+	  {
+	    unsigned long indx;
+	    struct elf_link_hash_entry *h;
+
+	    /* An external symbol.  */
+	    indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info;
+	    h = elf_sym_hashes (abfd)[indx];
+	    BFD_ASSERT (h != NULL);
+
+	    if (h->root.type != bfd_link_hash_defined
+		&& h->root.type != bfd_link_hash_defweak)
+	      /* This appears to be a reference to an undefined
+		 symbol.  Just ignore it--it will be caught by the
+		 regular reloc processing.  */
+	      continue;
+
+	    symval = (h->root.u.def.value
+		      + h->root.u.def.section->output_section->vma
+		      + h->root.u.def.section->output_offset);
+	  }
+
+	/* For simplicity of coding, we are going to modify the section
+	   contents, the section relocs, and the BFD symbol table.  We
+	   must tell the rest of the code not to free up this
+	   information.  It would be possible to instead create a table
+	   of changes which have to be made, as is done in coff-mips.c;
+	   that would be more work, but would require less memory when
+	   the linker is run.  */
+
+	/* Try to turn a 16bit pc-relative branch into a 10bit pc-relative
+	   branch.  */
+	/* Paranoia? paranoia...  */      
+	if (ELF32_R_TYPE (irel->r_info) == (int) R_MSP430_RL_PCREL)
+	  {
+	    bfd_vma value = symval;
+
+	    /* Deal with pc-relative gunk.  */
+	    value -= (sec->output_section->vma + sec->output_offset);
+	    value -= irel->r_offset;
+	    value += irel->r_addend;
+
+	    /* See if the value will fit in 10 bits, note the high value is
+	       1016 as the target will be two bytes closer if we are
+	       able to relax.  */
+	    if ((long) value < 1016 && (long) value > -1016)
+	      {
+		int code0 = 0, code1 = 0, code2 = 0;
+		int i;
+		struct rcodes_s *rx;
+
+		/* Get the opcode.  */
+		if (irel->r_offset >= 6)
+		  code0 = bfd_get_16 (abfd, contents + irel->r_offset - 6);
+
+		if (irel->r_offset >= 4)
+		  code1 = bfd_get_16 (abfd, contents + irel->r_offset - 4);
+
+		code2 = bfd_get_16 (abfd, contents + irel->r_offset - 2);
+
+		if (code2 != 0x4010)
+		  continue;
+
+		/* Check r4 and r3.  */
+		for (i = NUMB_RELAX_CODES - 1; i >= 0; i--)
+		  {
+		    rx = &rcode[i];
+		    if (rx->cdx == 2 && rx->f0 == code0 && rx->f1 == code1)
+		      break;
+		    else if (rx->cdx == 1 && rx->f1 == code1)
+		      break;
+		    else if (rx->cdx == 0)	/* This is an unconditional jump.  */
+		      break;
+		  }
+
+		/* Check labels:
+		   .Label0:       ; we do not care about this label
+		   jeq    +6
+		   .Label1:       ; make sure there is no label here
+		   jl     +4
+		   .Label2:       ; make sure there is no label here
+		   br .Label_dst
+
+		   So, if there is .Label1 or .Label2 we cannot relax this code.
+		   This actually should not happen, cause for relaxable
+		   instructions we use RL_PCREL reloc instead of 16_PCREL.
+		   Will change this in the future. */
+
+		if (rx->cdx > 0
+		    && msp430_elf_symbol_address_p (abfd, sec, isymbuf,
+						    irel->r_offset - 2))
+		  continue;
+		if (rx->cdx > 1
+		    && msp430_elf_symbol_address_p (abfd, sec, isymbuf,
+						    irel->r_offset - 4))
+		  continue;
+
+		/* Note that we've changed the relocs, section contents, etc.  */
+		elf_section_data (sec)->relocs = internal_relocs;
+		elf_section_data (sec)->this_hdr.contents = contents;
+		symtab_hdr->contents = (unsigned char *) isymbuf;
+
+		/* Fix the relocation's type.  */
+		if (uses_msp430x_relocs (abfd))
+		  {
+		    if (rx->labels == 3)	/* Handle special cases.  */
+		      irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+						   R_MSP430X_2X_PCREL);
+		    else
+		      irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+						   R_MSP430X_10_PCREL);
+		  }
+		else
+		  {
+		    if (rx->labels == 3)	/* Handle special cases.  */
+		      irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+						   R_MSP430_2X_PCREL);
+		    else
+		      irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+						   R_MSP430_10_PCREL);
+		  }
+
+		/* Fix the opcode right way.  */
+		bfd_put_16 (abfd, rx->t0, contents + irel->r_offset - rx->off);
+		if (rx->t1)
+		  bfd_put_16 (abfd, rx->t1,
+			      contents + irel->r_offset - rx->off + 2);
+
+		/* Delete bytes. */
+		if (!msp430_elf_relax_delete_bytes (abfd, sec,
+						    irel->r_offset - rx->off +
+						    rx->ncl, rx->bs))
+		  goto error_return;
+
+		/* Handle unconditional jumps.  */
+		if (rx->cdx == 0)
+		  irel->r_offset -= 2;
+
+		/* That will change things, so, we should relax again.
+		   Note that this is not required, and it may be slow.  */
+		*again = TRUE;
+	      }
+	  }
+      }
+
   if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
     {
       if (!link_info->keep_memory)
@@ -1156,11 +2193,259 @@
   return FALSE;
 }
 
+/* Handle an MSP430 specific section when reading an object file.
+   This is called when bfd_section_from_shdr finds a section with
+   an unknown type.  */
+
+static bfd_boolean
+elf32_msp430_section_from_shdr (bfd *abfd,
+				Elf_Internal_Shdr * hdr,
+				const char *name,
+				int shindex)
+{
+  switch (hdr->sh_type)
+    {
+    case SHT_MSP430_SEC_FLAGS:
+    case SHT_MSP430_SYM_ALIASES:
+    case SHT_MSP430_ATTRIBUTES:
+      return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+    default:
+      return FALSE;
+    }
+}
+
+static bfd_boolean
+elf32_msp430_obj_attrs_handle_unknown (bfd *abfd, int tag)
+{
+  _bfd_error_handler
+    (_("Warning: %B: Unknown MSPABI object attribute %d"),
+     abfd, tag);
+  return TRUE;
+}
+
+/* Determine whether an object attribute tag takes an integer, a
+   string or both.  */
+
+static int
+elf32_msp430_obj_attrs_arg_type (int tag)
+{
+  if (tag == Tag_compatibility)
+    return ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL;
+
+  if (tag < 32)
+    return ATTR_TYPE_FLAG_INT_VAL;
+
+  return (tag & 1) != 0 ? ATTR_TYPE_FLAG_STR_VAL : ATTR_TYPE_FLAG_INT_VAL;
+}
+
+static inline const char *
+isa_type (int isa)
+{
+  switch (isa)
+    {
+    case 1: return "MSP430";
+    case 2: return "MSP430X";
+    default: return "unknown";
+    }
+}
+
+static inline const char *
+code_model (int model)
+{
+  switch (model)
+    {
+    case 1: return "small";
+    case 2: return "large";
+    default: return "unknown";
+    }
+}
+
+static inline const char *
+data_model (int model)
+{
+  switch (model)
+    {
+    case 1: return "small";
+    case 2: return "large";
+    case 3: return "restricted large";
+    default: return "unknown";
+    }
+}
+
+/* Merge MSPABI object attributes from IBFD into OBFD.
+   Raise an error if there are conflicting attributes.  */
+
+static bfd_boolean
+elf32_msp430_merge_mspabi_attributes (bfd *ibfd, bfd *obfd)
+{
+  obj_attribute *in_attr;
+  obj_attribute *out_attr;
+  bfd_boolean result = TRUE;
+  static bfd * first_input_bfd = NULL;
+
+  /* Skip linker created files.  */
+  if (ibfd->flags & BFD_LINKER_CREATED)
+    return TRUE;
+
+  /* If this is the first real object just copy the attributes.  */
+  if (!elf_known_obj_attributes_proc (obfd)[0].i)
+    {
+      _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+      out_attr = elf_known_obj_attributes_proc (obfd);
+
+      /* Use the Tag_null value to indicate that
+	 the attributes have been initialized.  */
+      out_attr[0].i = 1;
+
+      first_input_bfd = ibfd;
+      return TRUE;
+    }
+
+  in_attr = elf_known_obj_attributes_proc (ibfd);
+  out_attr = elf_known_obj_attributes_proc (obfd);
+
+  /* The ISAs must be the same.  */
+  if (in_attr[OFBA_MSPABI_Tag_ISA].i != out_attr[OFBA_MSPABI_Tag_ISA].i)
+    {
+      _bfd_error_handler
+	(_("error: %B uses %s instructions but %B uses %s"),
+	 ibfd, first_input_bfd,
+	 isa_type (in_attr[OFBA_MSPABI_Tag_ISA].i),
+	 isa_type (out_attr[OFBA_MSPABI_Tag_ISA].i));
+      result = FALSE;
+    }
+
+  /* The code models must be the same.  */
+  if (in_attr[OFBA_MSPABI_Tag_Code_Model].i !=
+      out_attr[OFBA_MSPABI_Tag_Code_Model].i)
+    {
+      _bfd_error_handler
+	(_("error: %B uses the %s code model whereas %B uses the %s code model"),
+	 ibfd, first_input_bfd,
+	 code_model (in_attr[OFBA_MSPABI_Tag_Code_Model].i),
+	 code_model (out_attr[OFBA_MSPABI_Tag_Code_Model].i));
+      result = FALSE;
+    }
+
+  /* The large code model is only supported by the MSP430X.  */
+  if (in_attr[OFBA_MSPABI_Tag_Code_Model].i == 2
+      && out_attr[OFBA_MSPABI_Tag_ISA].i != 2)
+    {
+      _bfd_error_handler
+	(_("error: %B uses the large code model but %B uses MSP430 instructions"),
+	 ibfd, first_input_bfd);
+      result = FALSE;
+    }
+
+  /* The data models must be the same.  */
+  if (in_attr[OFBA_MSPABI_Tag_Data_Model].i !=
+      out_attr[OFBA_MSPABI_Tag_Data_Model].i)
+    {
+      _bfd_error_handler
+	(_("error: %B uses the %s data model whereas %B uses the %s data model"),
+	 ibfd, first_input_bfd,
+	 data_model (in_attr[OFBA_MSPABI_Tag_Data_Model].i),
+	 data_model (out_attr[OFBA_MSPABI_Tag_Data_Model].i));
+      result = FALSE;
+    }
+
+  /* The small code model requires the use of the small data model.  */
+  if (in_attr[OFBA_MSPABI_Tag_Code_Model].i == 1
+      && out_attr[OFBA_MSPABI_Tag_Data_Model].i != 1)
+    {
+      _bfd_error_handler
+	(_("error: %B uses the small code model but %B uses the %s data model"),
+	 ibfd, first_input_bfd,
+	 data_model (out_attr[OFBA_MSPABI_Tag_Data_Model].i));
+      result = FALSE;
+    }
+
+  /* The large data models are only supported by the MSP430X.  */
+  if (in_attr[OFBA_MSPABI_Tag_Data_Model].i > 1
+      && out_attr[OFBA_MSPABI_Tag_ISA].i != 2)
+    {
+      _bfd_error_handler
+	(_("error: %B uses the %s data model but %B only uses MSP430 instructions"),
+	 ibfd, first_input_bfd,
+	 data_model (in_attr[OFBA_MSPABI_Tag_Data_Model].i));
+      result = FALSE;
+    }
+  
+  return result;
+}
+
+/* Merge backend specific data from an object file to the output
+   object file when linking.  */
+
+static bfd_boolean
+elf32_msp430_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
+{
+  /* Make sure that the machine number reflects the most
+     advanced version of the MSP architecture required.  */
+#define max(a,b) ((a) > (b) ? (a) : (b))
+  if (bfd_get_mach (ibfd) != bfd_get_mach (obfd))
+    bfd_default_set_arch_mach (obfd, bfd_get_arch (obfd),
+			       max (bfd_get_mach (ibfd), bfd_get_mach (obfd)));
+#undef max
+
+  return elf32_msp430_merge_mspabi_attributes (ibfd, obfd);
+}
+
+/* Copy backend specific data from one object module to another.  */
+
+static bfd_boolean
+elf32_msp430_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
+{
+  /* Copy object attributes.  */
+  _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+  return TRUE;
+}
+
+static bfd_boolean
+msp430_elf_is_target_special_symbol (bfd *abfd, asymbol *sym)
+{
+  return _bfd_elf_is_local_label_name (abfd, sym->name);
+}
+
+/* This is gross.  The MSP430 EABI says that (sec 11.5):
+
+     "An implementation may choose to use Rel or Rela
+      type relocations for other relocations."
+
+   But it also says that:
+   
+     "Certain relocations are identified as Rela only. [snip]
+      Where Rela is specified, an implementation must honor
+      this requirement."
+
+  There is one relocation marked as requiring RELA - R_MSP430_ABS_HI16 - but
+  to keep things simple we choose to use RELA relocations throughout.  The
+  problem is that the TI compiler generates REL relocations, so we have to
+  be able to accept those as well.  */
+
+#define elf_backend_may_use_rel_p  1
+#define elf_backend_may_use_rela_p 1
+#define elf_backend_default_use_rela_p 1
+
+#undef  elf_backend_obj_attrs_vendor
+#define elf_backend_obj_attrs_vendor		"mspabi"
+#undef  elf_backend_obj_attrs_section
+#define elf_backend_obj_attrs_section		".MSP430.attributes"
+#undef  elf_backend_obj_attrs_section_type
+#define elf_backend_obj_attrs_section_type	SHT_MSP430_ATTRIBUTES
+#define elf_backend_section_from_shdr  		elf32_msp430_section_from_shdr
+#define elf_backend_obj_attrs_handle_unknown 	elf32_msp430_obj_attrs_handle_unknown
+#undef  elf_backend_obj_attrs_arg_type
+#define elf_backend_obj_attrs_arg_type		elf32_msp430_obj_attrs_arg_type
+#define bfd_elf32_bfd_copy_private_bfd_data	elf32_msp430_copy_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data	elf32_msp430_merge_private_bfd_data
 
 #define ELF_ARCH		bfd_arch_msp430
 #define ELF_MACHINE_CODE	EM_MSP430
 #define ELF_MACHINE_ALT1	EM_MSP430_OLD
-#define ELF_MAXPAGESIZE		1
+#define ELF_MAXPAGESIZE		4
 #define	ELF_OSABI		ELFOSABI_STANDALONE
 
 #define TARGET_LITTLE_SYM       bfd_elf32_msp430_vec
@@ -1175,5 +2460,30 @@
 #define elf_backend_object_p		     elf32_msp430_object_p
 #define elf_backend_post_process_headers     _bfd_elf_set_osabi
 #define bfd_elf32_bfd_relax_section	     msp430_elf_relax_section
+#define bfd_elf32_bfd_is_target_special_symbol	msp430_elf_is_target_special_symbol
+
+#undef  elf32_bed
+#define elf32_bed		elf32_msp430_bed
+
+#include "elf32-target.h"
+
+/* The TI compiler sets the OSABI field to ELFOSABI_NONE.  */
+#undef  TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM       bfd_elf32_msp430_ti_vec
+
+#undef  elf32_bed
+#define elf32_bed		elf32_msp430_ti_bed
+
+#undef	ELF_OSABI		
+#define	ELF_OSABI		ELFOSABI_NONE
+
+static const struct bfd_elf_special_section msp430_ti_elf_special_sections[] =
+{
+  /* prefix, prefix_length,        suffix_len, type,               attributes.  */
+  { STRING_COMMA_LEN (".TI.symbol.alias"),  0, SHT_MSP430_SYM_ALIASES, 0 },
+  { STRING_COMMA_LEN (".TI.section.flags"), 0, SHT_MSP430_SEC_FLAGS,   0 },
+  { STRING_COMMA_LEN ("_TI_build_attrib"),  0, SHT_MSP430_ATTRIBUTES,  0 },
+  { NULL, 0,                                0, 0,                      0 }
+};
 
 #include "elf32-target.h"
diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c
index c03d8f4..597665c 100644
--- a/bfd/elf32-mt.c
+++ b/bfd/elf32-mt.c
@@ -26,7 +26,7 @@
 #include "elf/mt.h"
 
 /* Prototypes.  */
-static reloc_howto_type * mt_reloc_type_lookup 
+static reloc_howto_type * mt_reloc_type_lookup
   (bfd *, bfd_reloc_code_real_type);
 
 static void mt_info_to_howto_rela
@@ -36,11 +36,11 @@
   (bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma);
 
 static bfd_reloc_status_type mt_final_link_relocate
-  (reloc_howto_type *, bfd *, asection *, bfd_byte *, 
+  (reloc_howto_type *, bfd *, asection *, bfd_byte *,
    Elf_Internal_Rela *, bfd_vma);
 
 static bfd_boolean mt_elf_relocate_section
-  (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 
+  (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
    Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
 
 /* Relocation tables.  */
@@ -48,77 +48,77 @@
 {
   /* This reloc does nothing.  */
   HOWTO (R_MT_NONE,           /* type */
-          0,                      /* rightshift */ 
-          2,                      /* size (0 = byte, 1 = short, 2 = long) */ 
+          0,                      /* rightshift */
+          2,                      /* size (0 = byte, 1 = short, 2 = long) */
           32,                     /* bitsize */
-          FALSE,                  /* pc_relative */ 
-          0,                      /* bitpos */ 
-          complain_overflow_dont, /* complain_on_overflow */ 
-          bfd_elf_generic_reloc,  /* special_function */ 
-          "R_MT_NONE",          /* name */ 
-          FALSE,                  /* partial_inplace */ 
-          0 ,                     /* src_mask */ 
-          0,                      /* dst_mask */ 
+          FALSE,                  /* pc_relative */
+          0,                      /* bitpos */
+          complain_overflow_dont, /* complain_on_overflow */
+          bfd_elf_generic_reloc,  /* special_function */
+          "R_MT_NONE",          /* name */
+          FALSE,                  /* partial_inplace */
+          0 ,                     /* src_mask */
+          0,                      /* dst_mask */
           FALSE),                 /* pcrel_offset */
 
   /* A 16 bit absolute relocation.  */
   HOWTO (R_MT_16,             /* type */
-          0,                      /* rightshift */ 
-          2,                      /* size (0 = byte, 1 = short, 2 = long) */ 
+          0,                      /* rightshift */
+          2,                      /* size (0 = byte, 1 = short, 2 = long) */
           16,                     /* bitsize */
-          FALSE,                  /* pc_relative */ 
-          0,                      /* bitpos */ 
-          complain_overflow_dont, /* complain_on_overflow */ 
-          bfd_elf_generic_reloc,  /* special_function */ 
-          "R_MT_16",            /* name */ 
-          FALSE,                  /* partial_inplace */ 
-          0 ,                     /* src_mask */ 
-          0xffff,                 /* dst_mask */ 
+          FALSE,                  /* pc_relative */
+          0,                      /* bitpos */
+          complain_overflow_dont, /* complain_on_overflow */
+          bfd_elf_generic_reloc,  /* special_function */
+          "R_MT_16",            /* name */
+          FALSE,                  /* partial_inplace */
+          0 ,                     /* src_mask */
+          0xffff,                 /* dst_mask */
           FALSE),                 /* pcrel_offset */
 
   /* A 32 bit absolute relocation.  */
   HOWTO (R_MT_32,             /* type */
-          0,                      /* rightshift */ 
-          2,                      /* size (0 = byte, 1 = short, 2 = long) */ 
+          0,                      /* rightshift */
+          2,                      /* size (0 = byte, 1 = short, 2 = long) */
           32,                     /* bitsize */
-          FALSE,                  /* pc_relative */ 
-          0,                      /* bitpos */ 
-          complain_overflow_dont, /* complain_on_overflow */ 
-          bfd_elf_generic_reloc,  /* special_function */ 
-          "R_MT_32",            /* name */ 
-          FALSE,                  /* partial_inplace */ 
-          0 ,                     /* src_mask */ 
-          0xffffffff,             /* dst_mask */ 
+          FALSE,                  /* pc_relative */
+          0,                      /* bitpos */
+          complain_overflow_dont, /* complain_on_overflow */
+          bfd_elf_generic_reloc,  /* special_function */
+          "R_MT_32",            /* name */
+          FALSE,                  /* partial_inplace */
+          0 ,                     /* src_mask */
+          0xffffffff,             /* dst_mask */
           FALSE),                 /* pcrel_offset */
 
   /* A 32 bit pc-relative relocation.  */
   HOWTO (R_MT_32_PCREL,       /* type */
-          0,                      /* rightshift */ 
-          2,                      /* size (0 = byte, 1 = short, 2 = long) */ 
+          0,                      /* rightshift */
+          2,                      /* size (0 = byte, 1 = short, 2 = long) */
           32,                     /* bitsize */
-          TRUE,                   /* pc_relative */ 
-          0,                      /* bitpos */ 
-          complain_overflow_dont, /* complain_on_overflow */ 
-          bfd_elf_generic_reloc,  /* special_function */ 
-          "R_MT_32_PCREL",    /* name */ 
-          FALSE,                  /* partial_inplace */ 
-          0 ,                     /* src_mask */ 
-          0xffffffff,             /* dst_mask */ 
+          TRUE,                   /* pc_relative */
+          0,                      /* bitpos */
+          complain_overflow_dont, /* complain_on_overflow */
+          bfd_elf_generic_reloc,  /* special_function */
+          "R_MT_32_PCREL",    /* name */
+          FALSE,                  /* partial_inplace */
+          0 ,                     /* src_mask */
+          0xffffffff,             /* dst_mask */
           TRUE),                  /* pcrel_offset */
 
   /* A 16 bit pc-relative relocation.  */
   HOWTO (R_MT_PC16,           /* type */
-          0,                      /* rightshift */ 
-          2,                      /* size (0 = byte, 1 = short, 2 = long) */ 
+          0,                      /* rightshift */
+          2,                      /* size (0 = byte, 1 = short, 2 = long) */
           16,                     /* bitsize */
-          TRUE,                   /* pc_relative */ 
-          0,                      /* bitpos */ 
-          complain_overflow_signed, /* complain_on_overflow */ 
-          bfd_elf_generic_reloc,  /* special_function */ 
-          "R_MT_PC16",          /* name */ 
-          FALSE,                  /* partial_inplace */ 
-          0,                      /* src_mask */ 
-          0xffff,                 /* dst_mask */ 
+          TRUE,                   /* pc_relative */
+          0,                      /* bitpos */
+          complain_overflow_signed, /* complain_on_overflow */
+          bfd_elf_generic_reloc,  /* special_function */
+          "R_MT_PC16",          /* name */
+          FALSE,                  /* partial_inplace */
+          0,                      /* src_mask */
+          0xffff,                 /* dst_mask */
           TRUE),                  /* pcrel_offset */
 
   /* high 16 bits of symbol value.  */
@@ -321,7 +321,7 @@
       bfd_reloc_status_type        r;
       const char *                 name = NULL;
       int                          r_type;
-      
+
       r_type = ELF32_R_TYPE (rel->r_info);
 
       r_symndx = ELF32_R_SYM (rel->r_info);
@@ -330,13 +330,13 @@
       h      = NULL;
       sym    = NULL;
       sec    = NULL;
-      
+
       if (r_symndx < symtab_hdr->sh_info)
 	{
 	  sym = local_syms + r_symndx;
 	  sec = local_sections [r_symndx];
 	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
-	  
+
 	  name = bfd_elf_string_from_elf_section
 	    (input_bfd, symtab_hdr->sh_link, sym->st_name);
 	  name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
@@ -344,12 +344,12 @@
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
@@ -385,12 +385,12 @@
 		(info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0,
 		 input_bfd, input_section, rel->r_offset);
 	      break;
-	      
+
 	    case bfd_reloc_undefined:
 	      r = info->callbacks->undefined_symbol
 		(info, name, input_bfd, input_section, rel->r_offset, TRUE);
 	      break;
-	      
+
 	    case bfd_reloc_outofrange:
 	      msg = _("internal error: out of range error");
 	      break;
@@ -419,7 +419,7 @@
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.  */
- 
+
 static bfd_boolean
 mt_elf_check_relocs
     (bfd *                     abfd,
@@ -431,19 +431,19 @@
   struct elf_link_hash_entry ** sym_hashes;
   const Elf_Internal_Rela *     rel;
   const Elf_Internal_Rela *     rel_end;
-  
+
   if (info->relocatable)
     return TRUE;
-  
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  
+
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
-      
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
@@ -453,6 +453,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
     }
 
@@ -499,7 +503,7 @@
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
     return TRUE;
-  
+
   BFD_ASSERT (!elf_flags_init (obfd)
 	      || elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
 
@@ -551,7 +555,7 @@
 	 MS2 are not subsets of each other.   */
       ok = FALSE;
     }
-  
+
   if (ok)
     {
       obfd->arch_info = ibfd->arch_info;
@@ -568,7 +572,7 @@
   flagword flags;
 
   BFD_ASSERT (abfd != NULL && ptr != NULL);
-  
+
   /* Print normal ELF private data.  */
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
new file mode 100644
index 0000000..82e5516
--- /dev/null
+++ b/bfd/elf32-nios2.c
@@ -0,0 +1,4135 @@
+/* 32-bit ELF support for Nios II.
+   Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+   Contributed by Nigel Gray (ngray@altera.com).
+   Contributed by Mentor Graphics, Inc.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+/* This file handles Altera Nios II ELF targets.  */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+#include "bfdlink.h"
+#include "genlink.h"
+#include "elf-bfd.h"
+#include "elf/nios2.h"
+#include "opcode/nios2.h"
+
+/* Use RELA relocations.  */
+#ifndef USE_RELA
+#define USE_RELA
+#endif
+
+#ifdef USE_REL
+#undef USE_REL
+#endif
+
+/* Forward declarations.  */
+static bfd_reloc_status_type nios2_elf32_ignore_reloc
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_hi16_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_lo16_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_hiadj16_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_pcrel_lo16_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_pcrel_hiadj16_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_pcrel16_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_call26_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_gprel_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_ujmp_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_cjmp_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+static bfd_reloc_status_type nios2_elf32_callr_relocate
+  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
+
+/* Target vector.  */
+extern const bfd_target bfd_elf32_littlenios2_vec;
+extern const bfd_target bfd_elf32_bignios2_vec;
+
+/* Offset of tp and dtp pointers from start of TLS block.  */
+#define TP_OFFSET	0x7000
+#define DTP_OFFSET	0x8000
+
+/* The relocation table used for SHT_REL sections.  */
+static reloc_howto_type elf_nios2_howto_table_rel[] = {
+  /* No relocation.  */
+  HOWTO (R_NIOS2_NONE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_NIOS2_NONE",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* 16-bit signed immediate relocation.  */
+  HOWTO (R_NIOS2_S16,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 6,			/* bitpos */
+	 complain_overflow_signed,	/* complain on overflow */
+	 bfd_elf_generic_reloc,	/* special function */
+	 "R_NIOS2_S16",		/* name */
+	 FALSE,			/* partial_inplace */
+	 0x003fffc0,		/* src_mask */
+	 0x003fffc0,		/* dest_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* 16-bit unsigned immediate relocation.  */
+  HOWTO (R_NIOS2_U16,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 6,			/* bitpos */
+	 complain_overflow_unsigned,	/* complain on overflow */
+	 bfd_elf_generic_reloc,	/* special function */
+	 "R_NIOS2_U16",		/* name */
+	 FALSE,			/* partial_inplace */
+	 0x003fffc0,		/* src_mask */
+	 0x003fffc0,		/* dest_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_NIOS2_PCREL16,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 6,			/* bitpos */
+	 complain_overflow_signed,	/* complain on overflow */
+	 nios2_elf32_pcrel16_relocate,	/* special function */
+	 "R_NIOS2_PCREL16",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0x003fffc0,		/* src_mask */
+	 0x003fffc0,		/* dest_mask */
+	 TRUE),			/* pcrel_offset */
+
+  HOWTO (R_NIOS2_CALL26,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 26,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 6,			/* bitpos */
+	 complain_overflow_dont,	/* complain on overflow */
+	 nios2_elf32_call26_relocate,	/* special function */
+	 "R_NIOS2_CALL26",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0xffffffc0,		/* src_mask */
+	 0xffffffc0,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  HOWTO (R_NIOS2_IMM5,
+	 0,
+	 2,
+	 5,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_IMM5",
+	 FALSE,
+	 0x000007c0,
+	 0x000007c0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_CACHE_OPX,
+	 0,
+	 2,
+	 5,
+	 FALSE,
+	 22,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_CACHE_OPX",
+	 FALSE,
+	 0x07c00000,
+	 0x07c00000,
+	 FALSE),
+
+  HOWTO (R_NIOS2_IMM6,
+	 0,
+	 2,
+	 6,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_IMM6",
+	 FALSE,
+	 0x00000fc0,
+	 0x00000fc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_IMM8,
+	 0,
+	 2,
+	 8,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_IMM8",
+	 FALSE,
+	 0x00003fc0,
+	 0x00003fc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_HI16,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_hi16_relocate,
+	 "R_NIOS2_HI16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_LO16,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_lo16_relocate,
+	 "R_NIOS2_LO16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_HIADJ16,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_hiadj16_relocate,
+	 "R_NIOS2_HIADJ16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_BFD_RELOC_32,
+	 0,
+	 2,			/* long */
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_BFD_RELOC32",
+	 FALSE,
+	 0xffffffff,
+	 0xffffffff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_BFD_RELOC_16,
+	 0,
+	 1,			/* short */
+	 16,
+	 FALSE,
+	 0,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_BFD_RELOC16",
+	 FALSE,
+	 0x0000ffff,
+	 0x0000ffff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_BFD_RELOC_8,
+	 0,
+	 0,			/* byte */
+	 8,
+	 FALSE,
+	 0,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_BFD_RELOC8",
+	 FALSE,
+	 0x000000ff,
+	 0x000000ff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_GPREL,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_gprel_relocate,
+	 "R_NIOS2_GPREL",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_GNU_VTINHERIT,
+	 0,
+	 2,			/* short */
+	 0,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 NULL,
+	 "R_NIOS2_GNU_VTINHERIT",
+	 FALSE,
+	 0,
+	 0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_GNU_VTENTRY,
+	 0,
+	 2,			/* byte */
+	 0,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 _bfd_elf_rel_vtable_reloc_fn,
+	 "R_NIOS2_GNU_VTENTRY",
+	 FALSE,
+	 0,
+	 0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_UJMP,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_ujmp_relocate,
+	 "R_NIOS2_UJMP",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_CJMP,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_cjmp_relocate,
+	 "R_NIOS2_CJMP",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_CALLR,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_callr_relocate,
+	 "R_NIOS2_CALLR",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_ALIGN,
+	 0,
+	 2,
+	 0,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 nios2_elf32_ignore_reloc,
+	 "R_NIOS2_ALIGN",
+	 FALSE,
+	 0,
+	 0,
+	 TRUE),
+
+
+  HOWTO (R_NIOS2_GOT16,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_GOT16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_CALL16,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_CALL16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_GOTOFF_LO,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_GOTOFF_LO",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_GOTOFF_HA,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_GOTOFF_HA",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_PCREL_LO,
+	 0,
+	 2,
+	 16,
+	 TRUE,
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_pcrel_lo16_relocate,
+	 "R_NIOS2_PCREL_LO",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 TRUE),
+
+  HOWTO (R_NIOS2_PCREL_HA,
+	 0,
+	 2,
+	 16,
+	 FALSE, /* This is a PC-relative relocation, but we need to subtract
+		   PC ourselves before the HIADJ.  */
+	 6,
+	 complain_overflow_dont,
+	 nios2_elf32_pcrel_hiadj16_relocate,
+	 "R_NIOS2_PCREL_HA",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 TRUE),
+
+  HOWTO (R_NIOS2_TLS_GD16,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_TLS_GD16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_TLS_LDM16,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_TLS_LDM16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_TLS_LDO16,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_TLS_LDO16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_TLS_IE16,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_TLS_IE16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_TLS_LE16,
+	 0,
+	 2,
+	 16,
+	 FALSE,
+	 6,
+	 complain_overflow_bitfield,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_TLS_LE16",
+	 FALSE,
+	 0x003fffc0,
+	 0x003fffc0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_TLS_DTPMOD,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_TLS_DTPMOD",
+	 FALSE,
+	 0xffffffff,
+	 0xffffffff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_TLS_DTPREL,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_TLS_DTPREL",
+	 FALSE,
+	 0xffffffff,
+	 0xffffffff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_TLS_TPREL,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_TLS_TPREL",
+	 FALSE,
+	 0xffffffff,
+	 0xffffffff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_COPY,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_COPY",
+	 FALSE,
+	 0,
+	 0,
+	 FALSE),
+
+  HOWTO (R_NIOS2_GLOB_DAT,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_GLOB_DAT",
+	 FALSE,
+	 0xffffffff,
+	 0xffffffff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_JUMP_SLOT,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_JUMP_SLOT",
+	 FALSE,
+	 0xffffffff,
+	 0xffffffff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_RELATIVE,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_RELATIVE",
+	 FALSE,
+	 0xffffffff,
+	 0xffffffff,
+	 FALSE),
+
+  HOWTO (R_NIOS2_GOTOFF,
+	 0,
+	 2,
+	 32,
+	 FALSE,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "R_NIOS2_GOTOFF",
+	 FALSE,
+	 0xffffffff,
+	 0xffffffff,
+	 FALSE),
+
+/* Add other relocations here.  */
+};
+
+static unsigned char elf_code_to_howto_index[R_NIOS2_ILLEGAL + 1];
+
+/* Return the howto for relocation RTYPE.  */
+static reloc_howto_type *
+lookup_howto (unsigned int rtype)
+{
+  static int initialized = 0;
+  int i;
+  int howto_tbl_size = (int) (sizeof (elf_nios2_howto_table_rel)
+			      / sizeof (elf_nios2_howto_table_rel[0]));
+
+  if (!initialized)
+    {
+      initialized = 1;
+      memset (elf_code_to_howto_index, 0xff,
+	      sizeof (elf_code_to_howto_index));
+      for (i = 0; i < howto_tbl_size; i++)
+	elf_code_to_howto_index[elf_nios2_howto_table_rel[i].type] = i;
+    }
+
+  BFD_ASSERT (rtype <= R_NIOS2_ILLEGAL);
+  i = elf_code_to_howto_index[rtype];
+  if (i >= howto_tbl_size)
+    return 0;
+  return elf_nios2_howto_table_rel + i;
+}
+
+/* Map for converting BFD reloc types to Nios II reloc types.  */
+struct elf_reloc_map
+{
+  bfd_reloc_code_real_type bfd_val;
+  enum elf_nios2_reloc_type elf_val;
+};
+
+static const struct elf_reloc_map nios2_reloc_map[] = {
+  {BFD_RELOC_NIOS2_S16, R_NIOS2_S16},
+  {BFD_RELOC_NIOS2_U16, R_NIOS2_U16},
+  {BFD_RELOC_16_PCREL, R_NIOS2_PCREL16},
+  {BFD_RELOC_NIOS2_CALL26, R_NIOS2_CALL26},
+  {BFD_RELOC_NIOS2_IMM5, R_NIOS2_IMM5},
+  {BFD_RELOC_NIOS2_CACHE_OPX, R_NIOS2_CACHE_OPX},
+  {BFD_RELOC_NIOS2_IMM6, R_NIOS2_IMM6},
+  {BFD_RELOC_NIOS2_IMM8, R_NIOS2_IMM8},
+  {BFD_RELOC_NIOS2_HI16, R_NIOS2_HI16},
+  {BFD_RELOC_NIOS2_LO16, R_NIOS2_LO16},
+  {BFD_RELOC_NIOS2_HIADJ16, R_NIOS2_HIADJ16},
+  {BFD_RELOC_32, R_NIOS2_BFD_RELOC_32},
+  {BFD_RELOC_16, R_NIOS2_BFD_RELOC_16},
+  {BFD_RELOC_8, R_NIOS2_BFD_RELOC_8},
+  {BFD_RELOC_NIOS2_GPREL, R_NIOS2_GPREL},
+  {BFD_RELOC_VTABLE_INHERIT, R_NIOS2_GNU_VTINHERIT},
+  {BFD_RELOC_VTABLE_ENTRY, R_NIOS2_GNU_VTENTRY},
+  {BFD_RELOC_NIOS2_UJMP, R_NIOS2_UJMP},
+  {BFD_RELOC_NIOS2_CJMP, R_NIOS2_CJMP},
+  {BFD_RELOC_NIOS2_CALLR, R_NIOS2_CALLR},
+  {BFD_RELOC_NIOS2_ALIGN, R_NIOS2_ALIGN},
+  {BFD_RELOC_NIOS2_GOT16, R_NIOS2_GOT16},
+  {BFD_RELOC_NIOS2_CALL16, R_NIOS2_CALL16},
+  {BFD_RELOC_NIOS2_GOTOFF_LO, R_NIOS2_GOTOFF_LO},
+  {BFD_RELOC_NIOS2_GOTOFF_HA, R_NIOS2_GOTOFF_HA},
+  {BFD_RELOC_NIOS2_PCREL_LO, R_NIOS2_PCREL_LO},
+  {BFD_RELOC_NIOS2_PCREL_HA, R_NIOS2_PCREL_HA},
+  {BFD_RELOC_NIOS2_TLS_GD16, R_NIOS2_TLS_GD16},
+  {BFD_RELOC_NIOS2_TLS_LDM16, R_NIOS2_TLS_LDM16},
+  {BFD_RELOC_NIOS2_TLS_LDO16, R_NIOS2_TLS_LDO16},
+  {BFD_RELOC_NIOS2_TLS_IE16, R_NIOS2_TLS_IE16},
+  {BFD_RELOC_NIOS2_TLS_LE16, R_NIOS2_TLS_LE16},
+  {BFD_RELOC_NIOS2_TLS_DTPMOD, R_NIOS2_TLS_DTPMOD},
+  {BFD_RELOC_NIOS2_TLS_DTPREL, R_NIOS2_TLS_DTPREL},
+  {BFD_RELOC_NIOS2_TLS_TPREL, R_NIOS2_TLS_TPREL},
+  {BFD_RELOC_NIOS2_COPY, R_NIOS2_COPY},
+  {BFD_RELOC_NIOS2_GLOB_DAT, R_NIOS2_GLOB_DAT},
+  {BFD_RELOC_NIOS2_JUMP_SLOT, R_NIOS2_JUMP_SLOT},
+  {BFD_RELOC_NIOS2_RELATIVE, R_NIOS2_RELATIVE},
+  {BFD_RELOC_NIOS2_GOTOFF, R_NIOS2_GOTOFF}
+};
+
+/* The Nios II linker needs to keep track of the number of relocs that it
+   decides to copy as dynamic relocs in check_relocs for each symbol.
+   This is so that it can later discard them if they are found to be
+   unnecessary.  We store the information in a field extending the
+   regular ELF linker hash table.  */
+
+struct elf32_nios2_dyn_relocs
+{
+  struct elf32_nios2_dyn_relocs *next;
+
+  /* The input section of the reloc.  */
+  asection *sec;
+
+  /* Total number of relocs copied for the input section.  */
+  bfd_size_type count;
+
+  /* Number of pc-relative relocs copied for the input section.  */
+  bfd_size_type pc_count;
+};
+
+/* Nios II ELF linker hash entry.  */
+
+struct elf32_nios2_link_hash_entry
+{
+  struct elf_link_hash_entry root;
+
+  /* Track dynamic relocs copied for this symbol.  */
+  struct elf32_nios2_dyn_relocs *dyn_relocs;
+
+#define GOT_UNKNOWN	0
+#define GOT_NORMAL	1
+#define GOT_TLS_GD	2
+#define GOT_TLS_IE	4
+  unsigned char tls_type;
+
+  /* We need to detect and take special action for symbols which are only
+     referenced with %call() and not with %got().  Such symbols do not need
+     a dynamic GOT reloc in shared objects, only a dynamic PLT reloc.  Lazy
+     linking will not work if the dynamic GOT reloc exists.
+     To check for this condition efficiently, we compare got_types_used against
+     CALL16_USED, meaning
+     (got_types_used & (GOT16_USED | CALL16_USED)) == CALL16_USED.  */
+#define GOT16_USED	1
+#define CALL16_USED	2
+  unsigned char got_types_used;
+};
+
+#define elf32_nios2_hash_entry(ent) \
+  ((struct elf32_nios2_link_hash_entry *) (ent))
+
+/* Get the Nios II elf linker hash table from a link_info structure.  */
+#define elf32_nios2_hash_table(info) \
+  ((struct elf32_nios2_link_hash_table *) ((info)->hash))
+
+/* Nios II ELF linker hash table.  */
+struct elf32_nios2_link_hash_table
+  {
+    /* The main hash table.  */
+    struct elf_link_hash_table root;
+
+    /* Short-cuts to get to dynamic linker sections.  */
+    asection *sdynbss;
+    asection *srelbss;
+    asection *sbss;
+
+    union {
+      bfd_signed_vma refcount;
+      bfd_vma offset;
+    } tls_ldm_got;
+
+    /* Small local sym cache.  */
+    struct sym_cache sym_cache;
+
+    bfd_vma res_n_size;
+  };
+
+struct nios2_elf32_obj_tdata
+{
+  struct elf_obj_tdata root;
+
+  /* tls_type for each local got entry.  */
+  char *local_got_tls_type;
+
+  /* TRUE if TLS GD relocs have been seen for this object.  */
+  bfd_boolean has_tlsgd;
+};
+
+#define elf32_nios2_tdata(abfd) \
+  ((struct nios2_elf32_obj_tdata *) (abfd)->tdata.any)
+
+#define elf32_nios2_local_got_tls_type(abfd) \
+  (elf32_nios2_tdata (abfd)->local_got_tls_type)
+
+/* The name of the dynamic interpreter.  This is put in the .interp
+   section.  */
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
+
+/* PLT implementation for position-dependent code.  */
+static const bfd_vma nios2_plt_entry[] = { /* .PLTn: */
+  0x03c00034,	/* movhi r15, %hiadj(plt_got_slot_address) */
+  0x7bc00017,	/* ldw r15, %lo(plt_got_slot_address)(r15) */
+  0x7800683a	/* jmp r15 */
+};
+
+static const bfd_vma nios2_plt0_entry[] = { /* .PLTresolve */
+  0x03800034,	/* movhi r14, %hiadj(res_0) */
+  0x73800004,	/* addi r14, r14, %lo(res_0) */
+  0x7b9fc83a,	/* sub r15, r15, r14 */
+  0x03400034,	/* movhi r13, %hiadj(_GLOBAL_OFFSET_TABLE_) */
+  0x6b800017,	/* ldw r14, %lo(_GLOBAL_OFFSET_TABLE_+4)(r13) */
+  0x6b400017,	/* ldw r13, %lo(_GLOBAL_OFFSET_TABLE_+8)(r13) */
+  0x6800683a	/* jmp r13 */
+};
+
+/* PLT implementation for position-independent code.  */
+static const bfd_vma nios2_so_plt_entry[] = { /* .PLTn */
+  0x03c00034,	/* movhi r15, %hiadj(index * 4) */
+  0x7bc00004,	/* addi r15, r15, %lo(index * 4) */
+  0x00000006	/* br .PLTresolve */
+};
+
+static const bfd_vma nios2_so_plt0_entry[] = { /* .PLTresolve */
+  0x001ce03a,	/* nextpc r14 */
+  0x03400034,	/* movhi r13, %hiadj(_GLOBAL_OFFSET_TABLE_) */
+  0x6b9b883a,	/* add r13, r13, r14 */
+  0x6b800017,	/* ldw r14, %lo(_GLOBAL_OFFSET_TABLE_+4)(r13) */
+  0x6b400017,	/* ldw r13, %lo(_GLOBAL_OFFSET_TABLE_+8)(r13) */
+  0x6800683a	/* jmp r13 */
+};
+
+/* Implement elf_backend_grok_prstatus:
+   Support for core dump NOTE sections.  */
+static bfd_boolean
+nios2_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+{
+  int offset;
+  size_t size;
+
+  switch (note->descsz)
+    {
+    default:
+      return FALSE;
+
+    case 212:	      /* Linux/Nios II */
+      /* pr_cursig */
+      elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
+
+      /* pr_pid */
+      elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
+
+      /* pr_reg */
+      offset = 72;
+      size = 136;
+
+      break;
+    }
+
+  /* Make a ".reg/999" section.  */
+  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+					  size, note->descpos + offset);
+}
+
+/* Implement elf_backend_grok_psinfo.  */
+static bfd_boolean
+nios2_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+  switch (note->descsz)
+    {
+    default:
+      return FALSE;
+
+    case 124:	      /* Linux/Nios II elf_prpsinfo */
+      elf_tdata (abfd)->core->program
+	= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+      elf_tdata (abfd)->core->command
+	= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+    }
+
+  /* Note that for some reason, a spurious space is tacked
+     onto the end of the args in some (at least one anyway)
+     implementations, so strip it off if it exists.  */
+
+  {
+    char *command = elf_tdata (abfd)->core->command;
+    int n = strlen (command);
+
+    if (0 < n && command[n - 1] == ' ')
+      command[n - 1] = '\0';
+  }
+
+  return TRUE;
+}
+
+/* Create an entry in a Nios II ELF linker hash table.  */
+static struct bfd_hash_entry *
+link_hash_newfunc (struct bfd_hash_entry *entry,
+		   struct bfd_hash_table *table, const char *string)
+{
+  /* Allocate the structure if it has not already been allocated by a
+     subclass.  */
+  if (entry == NULL)
+    {
+      entry = bfd_hash_allocate (table,
+				 sizeof (struct elf32_nios2_link_hash_entry));
+      if (entry == NULL)
+	return entry;
+    }
+
+  /* Call the allocation method of the superclass.  */
+  entry = _bfd_elf_link_hash_newfunc (entry, table, string);
+  if (entry)
+    {
+      struct elf32_nios2_link_hash_entry *eh;
+
+      eh = (struct elf32_nios2_link_hash_entry *) entry;
+      eh->dyn_relocs = NULL;
+      eh->tls_type = GOT_UNKNOWN;
+      eh->got_types_used = 0;
+    }
+
+  return entry;
+}
+
+/* Implement bfd_elf32_bfd_reloc_type_lookup:
+   Given a BFD reloc type, return a howto structure.  */
+static reloc_howto_type *
+nios2_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+				   bfd_reloc_code_real_type code)
+{
+  int i;
+  for (i = 0;
+       i < (int) (sizeof (nios2_reloc_map) / sizeof (struct elf_reloc_map));
+       ++i)
+    if (nios2_reloc_map[i].bfd_val == code)
+      return &elf_nios2_howto_table_rel[(int) nios2_reloc_map[i].elf_val];
+  return NULL;
+}
+
+/* Implement bfd_elf32_bfd_reloc_name_lookup:
+   Given a reloc name, return a howto structure.  */
+static reloc_howto_type *
+nios2_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+				   const char *r_name)
+{
+  unsigned int i;
+  for (i = 0;
+       i < (sizeof (elf_nios2_howto_table_rel)
+	    / sizeof (elf_nios2_howto_table_rel[0]));
+       i++)
+    if (elf_nios2_howto_table_rel[i].name
+	&& strcasecmp (elf_nios2_howto_table_rel[i].name, r_name) == 0)
+      return &elf_nios2_howto_table_rel[i];
+
+  return NULL;	
+}
+
+/* Implement elf_info_to_howto:
+   Given a ELF32 relocation, fill in a arelent structure.  */
+static void
+nios2_elf32_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
+			   Elf_Internal_Rela *dst)
+{
+  unsigned int r_type;
+
+  r_type = ELF32_R_TYPE (dst->r_info);
+  BFD_ASSERT (r_type < R_NIOS2_ILLEGAL);
+  cache_ptr->howto = &elf_nios2_howto_table_rel[r_type];
+}
+
+/* Return the base VMA address which should be subtracted from real addresses
+   when resolving @dtpoff relocation.
+   This is PT_TLS segment p_vaddr.  */
+static bfd_vma
+dtpoff_base (struct bfd_link_info *info)
+{
+  /* If tls_sec is NULL, we should have signalled an error already.  */
+  if (elf_hash_table (info)->tls_sec == NULL)
+    return 0;
+  return elf_hash_table (info)->tls_sec->vma;
+}
+
+/* Return the relocation value for @tpoff relocation
+   if STT_TLS virtual address is ADDRESS.  */
+static bfd_vma
+tpoff (struct bfd_link_info *info, bfd_vma address)
+{
+  struct elf_link_hash_table *htab = elf_hash_table (info);
+
+  /* If tls_sec is NULL, we should have signalled an error already.  */
+  if (htab->tls_sec == NULL)
+    return 0;
+  return address - htab->tls_sec->vma;
+}
+
+/* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
+   dangerous relocation.  */
+static bfd_boolean
+nios2_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp, struct bfd_link_info *info)
+{
+
+  bfd_boolean gp_found;
+  struct bfd_hash_entry *h;
+  struct bfd_link_hash_entry *lh;
+
+  /* If we've already figured out what GP will be, just return it. */
+  *pgp = _bfd_get_gp_value (output_bfd);
+  if (*pgp)
+    return TRUE;
+
+  h = bfd_hash_lookup (&info->hash->table, "_gp", FALSE, FALSE);
+  lh = (struct bfd_link_hash_entry *) h;
+lookup:
+  if (lh)
+    {
+      switch (lh->type)
+	{
+	case bfd_link_hash_undefined:
+	case bfd_link_hash_undefweak:
+	case bfd_link_hash_common:
+	  gp_found = FALSE;
+	  break;
+	case bfd_link_hash_defined:
+	case bfd_link_hash_defweak:
+	  gp_found = TRUE;
+	  *pgp = lh->u.def.value;
+	  break;
+	case bfd_link_hash_indirect:
+	case bfd_link_hash_warning:
+	  lh = lh->u.i.link;
+	  /* @@FIXME  ignoring warning for now */
+	  goto lookup;
+	case bfd_link_hash_new:
+	default:
+	  abort ();
+	}
+    }
+  else
+    gp_found = FALSE;
+
+  if (!gp_found)
+    {
+      /* Only get the error once. */
+      *pgp = 4;
+      _bfd_set_gp_value (output_bfd, *pgp);
+      return FALSE;
+    }
+
+  _bfd_set_gp_value (output_bfd, *pgp);
+
+  return TRUE;
+}
+
+/* Retrieve the previously cached _gp pointer, returning bfd_reloc_dangerous
+   if it's not available as we don't have a link_info pointer available here
+   to look it up in the output symbol table.  We don't need to adjust the
+   symbol value for an external symbol if we are producing relocatable
+   output.  */
+static bfd_reloc_status_type
+nios2_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable, 
+		    char **error_message, bfd_vma *pgp)
+{
+  if (bfd_is_und_section (symbol->section) && !relocatable)
+    {
+      *pgp = 0;
+      return bfd_reloc_undefined;
+    }
+
+  *pgp = _bfd_get_gp_value (output_bfd);
+  if (*pgp == 0 && (!relocatable || (symbol->flags & BSF_SECTION_SYM) != 0))
+    {
+      if (relocatable)
+	{
+	  /* Make up a value.  */
+	  *pgp = symbol->section->output_section->vma + 0x4000;
+	  _bfd_set_gp_value (output_bfd, *pgp);
+	}
+      else
+	{
+	  *error_message
+	    = (char *) _("global pointer relative relocation when _gp not defined");
+	  return bfd_reloc_dangerous;
+	}
+    }
+
+  return bfd_reloc_ok;
+}
+
+/* The usual way of loading a 32-bit constant into a Nios II register is to
+   load the high 16 bits in one instruction and then add the low 16 bits with
+   a signed add. This means that the high halfword needs to be adjusted to
+   compensate for the sign bit of the low halfword. This function returns the
+   adjusted high halfword for a given 32-bit constant.  */
+static
+bfd_vma hiadj (bfd_vma symbol_value)
+{
+  return ((symbol_value + 0x8000) >> 16) & 0xffff;
+}
+
+/* Do the relocations that require special handling.  */
+static bfd_reloc_status_type
+nios2_elf32_do_hi16_relocate (bfd *abfd, reloc_howto_type *howto, 
+			      asection *input_section,
+			      bfd_byte *data, bfd_vma offset, 
+			      bfd_vma symbol_value, bfd_vma addend)
+{
+  symbol_value = symbol_value + addend;
+  addend = 0;
+  symbol_value = (symbol_value >> 16) & 0xffff;
+  return _bfd_final_link_relocate (howto, abfd, input_section,
+				   data, offset, symbol_value, addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_lo16_relocate (bfd *abfd, reloc_howto_type *howto,
+			      asection *input_section,
+			      bfd_byte *data, bfd_vma offset, 
+			      bfd_vma symbol_value, bfd_vma addend)
+{
+  symbol_value = symbol_value + addend;
+  addend = 0;
+  symbol_value = symbol_value & 0xffff;
+  return _bfd_final_link_relocate (howto, abfd, input_section,
+				   data, offset, symbol_value, addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_hiadj16_relocate (bfd *abfd, reloc_howto_type *howto,
+				 asection *input_section,
+				 bfd_byte *data, bfd_vma offset,
+				 bfd_vma symbol_value, bfd_vma addend)
+{
+  symbol_value = symbol_value + addend;
+  addend = 0;
+  symbol_value = hiadj(symbol_value);
+  return _bfd_final_link_relocate (howto, abfd, input_section, data, offset,
+				   symbol_value, addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_pcrel_lo16_relocate (bfd *abfd, reloc_howto_type *howto,
+				    asection *input_section,
+				    bfd_byte *data, bfd_vma offset,
+				    bfd_vma symbol_value, bfd_vma addend)
+{
+  symbol_value = symbol_value + addend;
+  addend = 0;
+  symbol_value = symbol_value & 0xffff;
+  return _bfd_final_link_relocate (howto, abfd, input_section,
+				   data, offset, symbol_value, addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_pcrel_hiadj16_relocate (bfd *abfd, reloc_howto_type *howto,
+				       asection *input_section,
+				       bfd_byte *data, bfd_vma offset,
+				       bfd_vma symbol_value, bfd_vma addend)
+{
+  symbol_value = symbol_value + addend;
+  symbol_value -= (input_section->output_section->vma
+		   + input_section->output_offset);
+  symbol_value -= offset;
+  addend = 0;
+  symbol_value = hiadj(symbol_value);
+  return _bfd_final_link_relocate (howto, abfd, input_section, data, offset,
+				   symbol_value, addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_pcrel16_relocate (bfd *abfd, reloc_howto_type *howto,
+				 asection *input_section,
+				 bfd_byte *data, bfd_vma offset, 
+				 bfd_vma symbol_value, bfd_vma addend)
+{
+  /* NIOS2 pc relative relocations are relative to the next 32-bit instruction 
+     so we need to subtract 4 before doing a final_link_relocate. */
+  symbol_value = symbol_value + addend - 4;
+  addend = 0;
+  return _bfd_final_link_relocate (howto, abfd, input_section,
+				   data, offset, symbol_value, addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_call26_relocate (bfd *abfd, reloc_howto_type *howto,
+				asection *input_section,
+				bfd_byte *data, bfd_vma offset, 
+				bfd_vma symbol_value, bfd_vma addend)
+{
+  /* Check that the relocation is in the same page as the current address.  */
+  if (((symbol_value + addend) & 0xf0000000)
+      != ((input_section->output_section->vma + offset) & 0xf0000000))
+    return bfd_reloc_overflow;
+
+  return _bfd_final_link_relocate (howto, abfd, input_section,
+				   data, offset, symbol_value, addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_gprel_relocate (bfd *abfd, reloc_howto_type *howto,
+			       asection *input_section,
+			       bfd_byte *data, bfd_vma offset, 
+			       bfd_vma symbol_value, bfd_vma addend)
+{
+  /* Because we need the output_bfd, the special handling is done
+     in nios2_elf32_relocate_section or in nios2_elf32_gprel_relocate.  */
+  return _bfd_final_link_relocate (howto, abfd, input_section,
+				   data, offset, symbol_value, addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_ujmp_relocate (bfd *abfd, reloc_howto_type *howto,
+			      asection *input_section,
+			      bfd_byte *data, bfd_vma offset, 
+			      bfd_vma symbol_value, bfd_vma addend)
+{
+  bfd_vma symbol_lo16, symbol_hi16;
+  bfd_reloc_status_type r;
+  symbol_value = symbol_value + addend;
+  addend = 0;
+  symbol_hi16 = (symbol_value >> 16) & 0xffff;
+  symbol_lo16 = symbol_value & 0xffff;
+
+  r = _bfd_final_link_relocate (howto, abfd, input_section,
+				data, offset, symbol_hi16, addend);
+
+  if (r == bfd_reloc_ok)
+    return _bfd_final_link_relocate (howto, abfd, input_section,
+				     data, offset + 4, symbol_lo16, addend);
+
+  return r;
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_cjmp_relocate (bfd *abfd, reloc_howto_type *howto,
+			      asection *input_section,
+			      bfd_byte *data, bfd_vma offset, 
+			      bfd_vma symbol_value, bfd_vma addend)
+{
+  bfd_vma symbol_lo16, symbol_hi16;
+  bfd_reloc_status_type r;
+  symbol_value = symbol_value + addend;
+  addend = 0;
+  symbol_hi16 = (symbol_value >> 16) & 0xffff;
+  symbol_lo16 = symbol_value & 0xffff;
+
+  r = _bfd_final_link_relocate (howto, abfd, input_section,
+				data, offset, symbol_hi16, addend);
+
+  if (r == bfd_reloc_ok)
+    return _bfd_final_link_relocate (howto, abfd, input_section,
+				     data, offset + 4, symbol_lo16, addend);
+
+  return r;
+}
+
+static bfd_reloc_status_type
+nios2_elf32_do_callr_relocate (bfd *abfd, reloc_howto_type *howto,
+			       asection *input_section,
+			       bfd_byte *data, bfd_vma offset, 
+			       bfd_vma symbol_value, bfd_vma addend)
+{
+  bfd_vma symbol_lo16, symbol_hi16;
+  bfd_reloc_status_type r;
+  symbol_value = symbol_value + addend;
+  addend = 0;
+  symbol_hi16 = (symbol_value >> 16) & 0xffff;
+  symbol_lo16 = symbol_value & 0xffff;
+
+  r = _bfd_final_link_relocate (howto, abfd, input_section,
+				data, offset, symbol_hi16, addend);
+
+  if (r == bfd_reloc_ok)
+    return _bfd_final_link_relocate (howto, abfd, input_section,
+				     data, offset + 4, symbol_lo16, addend);
+
+  return r;
+}
+
+/* HOWTO handlers for relocations that require special handling.  */
+
+/* This is for relocations used only when relaxing to ensure
+   changes in size of section don't screw up .align.  */
+static bfd_reloc_status_type
+nios2_elf32_ignore_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
+			  asymbol *symbol ATTRIBUTE_UNUSED, 
+			  void *data ATTRIBUTE_UNUSED, asection *input_section, 
+			  bfd *output_bfd, 
+			  char **error_message ATTRIBUTE_UNUSED)
+{
+  if (output_bfd != NULL)
+    reloc_entry->address += input_section->output_offset;
+  return bfd_reloc_ok;
+}
+
+static bfd_reloc_status_type
+nios2_elf32_hi16_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol, 
+			   void *data, asection *input_section, 
+			   bfd *output_bfd, 
+			   char **error_message ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_hi16_relocate (abfd, reloc_entry->howto,
+				       input_section,
+				       data, reloc_entry->address,
+				       (symbol->value
+					+ symbol->section->output_section->vma
+					+ symbol->section->output_offset),
+				       reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_lo16_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			   void *data, asection *input_section, 
+			   bfd *output_bfd, 
+			   char **error_message ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_lo16_relocate (abfd, reloc_entry->howto,
+				       input_section,
+				       data, reloc_entry->address,
+				       (symbol->value
+					+ symbol->section->output_section->vma
+					+ symbol->section->output_offset),
+				       reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_hiadj16_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			      void *data, asection *input_section, 
+			      bfd *output_bfd, 
+			      char **error_message ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_hiadj16_relocate (abfd, reloc_entry->howto,
+					  input_section,
+					  data, reloc_entry->address,
+					  (symbol->value
+					   + symbol->section->output_section->vma
+					   + symbol->section->output_offset),
+					  reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_pcrel_lo16_relocate (bfd *abfd, arelent *reloc_entry,
+				 asymbol *symbol, void *data,
+				 asection *input_section, bfd *output_bfd,
+				 char **error_message ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_pcrel_lo16_relocate (
+    abfd, reloc_entry->howto, input_section, data, reloc_entry->address,
+    (symbol->value + symbol->section->output_section->vma
+     + symbol->section->output_offset),
+    reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_pcrel_hiadj16_relocate (bfd *abfd, arelent *reloc_entry,
+				    asymbol *symbol, void *data,
+				    asection *input_section, bfd *output_bfd,
+				    char **error_message ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_pcrel_hiadj16_relocate (
+    abfd, reloc_entry->howto, input_section, data, reloc_entry->address,
+    (symbol->value + symbol->section->output_section->vma
+     + symbol->section->output_offset),
+    reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_pcrel16_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			      void *data, asection *input_section, 
+			      bfd *output_bfd, 
+			      char **error_message ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_pcrel16_relocate (abfd, reloc_entry->howto,
+					  input_section,
+					  data, reloc_entry->address,
+					  (symbol->value
+					   + symbol->section->output_section->vma
+					   + symbol->section->output_offset),
+					  reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_call26_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			     void *data, asection *input_section, 
+			     bfd *output_bfd, 
+			     char **error_message ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_call26_relocate (abfd, reloc_entry->howto,
+					 input_section,
+					 data, reloc_entry->address,
+					 (symbol->value
+					  + symbol->section->output_section->vma
+					  + symbol->section->output_offset),
+					 reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_gprel_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			    void *data, asection *input_section, 
+			    bfd *output_bfd, char **msg)
+{
+  bfd_vma relocation;
+  bfd_vma gp;
+  bfd_reloc_status_type r;
+
+
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  relocation = (symbol->value
+		+ symbol->section->output_section->vma
+		+ symbol->section->output_offset);
+
+  /* This assumes we've already cached the _gp symbol.  */
+  r = nios2_elf_final_gp (abfd, symbol, FALSE, msg, &gp);
+  if (r == bfd_reloc_ok)
+    {
+      relocation = relocation + reloc_entry->addend - gp;
+      reloc_entry->addend = 0;
+      if ((signed) relocation < -32768 || (signed) relocation > 32767)
+	{
+	  *msg = _("global pointer relative address out of range");
+	  r = bfd_reloc_outofrange;
+	}
+      else
+	r = nios2_elf32_do_gprel_relocate (abfd, reloc_entry->howto,
+					   input_section,
+					   data, reloc_entry->address,
+					   relocation, reloc_entry->addend);
+    }
+
+  return r;
+}
+
+static bfd_reloc_status_type
+nios2_elf32_ujmp_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			   void *data, asection *input_section, 
+			   bfd *output_bfd, char **msg ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_ujmp_relocate (abfd, reloc_entry->howto,
+				       input_section,
+				       data, reloc_entry->address,
+				       (symbol->value
+					+ symbol->section->output_section->vma
+					+ symbol->section->output_offset),
+				       reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_cjmp_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			   void *data, asection *input_section, 
+			   bfd *output_bfd, char **msg ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_cjmp_relocate (abfd, reloc_entry->howto,
+				       input_section,
+				       data, reloc_entry->address,
+				       (symbol->value
+					+ symbol->section->output_section->vma
+					+ symbol->section->output_offset),
+				       reloc_entry->addend);
+}
+
+static bfd_reloc_status_type
+nios2_elf32_callr_relocate (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
+			    void *data, asection *input_section, 
+			    bfd *output_bfd, char **msg ATTRIBUTE_UNUSED)
+{
+  /* This part is from bfd_elf_generic_reloc.  */
+  if (output_bfd != NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
+    {
+      reloc_entry->address += input_section->output_offset;
+      return bfd_reloc_ok;
+    }
+
+  if (output_bfd != NULL)
+    /* FIXME: See bfd_perform_relocation.  Is this right?  */
+    return bfd_reloc_continue;
+
+  return nios2_elf32_do_callr_relocate (abfd, reloc_entry->howto,
+					input_section,
+					data, reloc_entry->address,
+					(symbol->value
+					 + symbol->section->output_section->vma
+					 + symbol->section->output_offset),
+					reloc_entry->addend);
+}
+
+ 
+/* Implement elf_backend_relocate_section.  */
+static bfd_boolean
+nios2_elf32_relocate_section (bfd *output_bfd,
+			      struct bfd_link_info *info,
+			      bfd *input_bfd,
+			      asection *input_section,
+			      bfd_byte *contents,
+			      Elf_Internal_Rela *relocs,
+			      Elf_Internal_Sym *local_syms,
+			      asection **local_sections)
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes;
+  Elf_Internal_Rela *rel;
+  Elf_Internal_Rela *relend;
+  struct elf32_nios2_link_hash_table *htab;
+  asection *sgot;
+  asection *splt;
+  asection *sreloc = NULL;
+  bfd_vma *local_got_offsets;
+
+  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (input_bfd);
+  relend = relocs + input_section->reloc_count;
+
+  htab = elf32_nios2_hash_table (info);
+  sgot = htab->root.sgot;
+  splt = htab->root.splt;
+  local_got_offsets = elf_local_got_offsets (input_bfd);
+
+  for (rel = relocs; rel < relend; rel++)
+    {
+      reloc_howto_type *howto;
+      unsigned long r_symndx;
+      Elf_Internal_Sym *sym;
+      asection *sec;
+      struct elf_link_hash_entry *h;
+      struct elf32_nios2_link_hash_entry *eh;
+      bfd_vma relocation;
+      bfd_vma gp;
+      bfd_vma reloc_address;
+      bfd_reloc_status_type r = bfd_reloc_ok;
+      const char *name = NULL;
+      int r_type;
+      const char *format;
+      char msgbuf[256];
+      const char* msg = (const char*) NULL;
+      bfd_boolean unresolved_reloc;
+      bfd_vma off;
+      int use_plt;
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+      r_symndx = ELF32_R_SYM (rel->r_info);
+
+      howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info));
+      h = NULL;
+      sym = NULL;
+      sec = NULL;
+
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  sym = local_syms + r_symndx;
+	  sec = local_sections[r_symndx];
+	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+	}
+      else
+	{
+	  bfd_boolean warned, ignored;
+
+	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+				   r_symndx, symtab_hdr, sym_hashes,
+				   h, sec, relocation,
+				   unresolved_reloc, warned, ignored);
+	}
+
+      if (sec && discarded_section (sec))
+	RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+					 rel, 1, relend, howto, 0, contents);
+
+      /* Nothing more to do unless this is a final link.  */
+      if (info->relocatable)
+	continue;
+
+      if (sec && sec->output_section)
+	reloc_address = (sec->output_section->vma + sec->output_offset
+			 + rel->r_offset);
+      else
+	reloc_address = 0;
+		
+      if (howto)
+	{
+	  switch (howto->type)
+	    {
+	    case R_NIOS2_HI16:
+	      r = nios2_elf32_do_hi16_relocate (input_bfd, howto,
+						input_section,
+						contents, rel->r_offset,
+						relocation, rel->r_addend);
+	      break;
+	    case R_NIOS2_LO16:
+	      r = nios2_elf32_do_lo16_relocate (input_bfd, howto,
+						input_section,
+						contents, rel->r_offset,
+						relocation, rel->r_addend);
+	      break;
+	    case R_NIOS2_PCREL_LO:
+	      r = nios2_elf32_do_pcrel_lo16_relocate (input_bfd, howto,
+						      input_section,
+						      contents,
+						      rel->r_offset,
+						      relocation,
+						      rel->r_addend);
+	      break;
+	    case R_NIOS2_HIADJ16:
+	      r = nios2_elf32_do_hiadj16_relocate (input_bfd, howto,
+						   input_section, contents,
+						   rel->r_offset, relocation,
+						   rel->r_addend);
+	      break;
+	    case R_NIOS2_PCREL_HA:
+	      r = nios2_elf32_do_pcrel_hiadj16_relocate (input_bfd, howto,
+							 input_section,
+							 contents,
+							 rel->r_offset,
+							 relocation,
+							 rel->r_addend);
+	      break;
+	    case R_NIOS2_PCREL16:
+	      r = nios2_elf32_do_pcrel16_relocate (input_bfd, howto,
+						   input_section, contents,
+						   rel->r_offset, relocation,
+						   rel->r_addend);
+	      break;
+	    case R_NIOS2_GPREL:
+	      /* Turns an absolute address into a gp-relative address.  */
+	      if (!nios2_elf_assign_gp (output_bfd, &gp, info))
+		{
+		  format = _("global pointer relative relocation at address "
+			     "0x%08x when _gp not defined\n");
+		  sprintf (msgbuf, format, reloc_address);
+		  msg = msgbuf;
+		  r = bfd_reloc_dangerous;
+		}
+	      else
+		{
+		  bfd_vma symbol_address = rel->r_addend + relocation;
+		  relocation = relocation + rel->r_addend - gp;
+		  rel->r_addend = 0;
+		  if (((signed) relocation < -32768
+		       || (signed) relocation > 32767)
+		      && (!h
+			  || h->root.type == bfd_link_hash_defined
+			  || h->root.type == bfd_link_hash_defweak))
+		    {
+		      format = _("Unable to reach %s (at 0x%08x) from the "
+				 "global pointer (at 0x%08x) because the "
+				 "offset (%d) is out of the allowed range, "
+				 "-32678 to 32767.\n" );
+		      sprintf (msgbuf, format, name, symbol_address, gp, 
+			       (signed)relocation);
+		      msg = msgbuf;
+		      r = bfd_reloc_outofrange;
+		    }
+		  else
+		    r =	_bfd_final_link_relocate (howto, input_bfd,
+						  input_section, contents,
+						  rel->r_offset, relocation,
+						  rel->r_addend);
+		}
+
+	      break;
+	    case R_NIOS2_UJMP:
+	      r = nios2_elf32_do_ujmp_relocate (input_bfd, howto,
+						input_section,
+						contents, rel->r_offset,
+						relocation, rel->r_addend);
+	      break;
+	    case R_NIOS2_CJMP:
+	      r = nios2_elf32_do_cjmp_relocate (input_bfd, howto,
+						input_section,
+						contents, rel->r_offset,
+						relocation, rel->r_addend);
+	      break;
+	    case R_NIOS2_CALLR:
+	      r = nios2_elf32_do_callr_relocate (input_bfd, howto,
+						 input_section, contents,
+						 rel->r_offset, relocation,
+						 rel->r_addend);
+	      break;
+	    case R_NIOS2_CALL26:
+	      /* If we have a call to an undefined weak symbol, we just want
+		 to stuff a zero in the bits of the call instruction and
+		 bypass the normal call26 relocation handling, because it'll
+		 diagnose an overflow error if address 0 isn't in the same
+		 256MB segment as the call site.  Presumably the call
+		 should be guarded by a null check anyway.  */
+	      if (h != NULL && h->root.type == bfd_link_hash_undefweak)
+		{
+		  BFD_ASSERT (relocation == 0 && rel->r_addend == 0);
+		  r = _bfd_final_link_relocate (howto, input_bfd,
+						input_section, contents,
+						rel->r_offset, relocation,
+						rel->r_addend);
+		  break;
+		}
+	      /* Handle relocations which should use the PLT entry.
+		 NIOS2_BFD_RELOC_32 relocations will use the symbol's value,
+		 which may point to a PLT entry, but we don't need to handle
+		 that here.  If we created a PLT entry, all branches in this
+		 object should go to it.  */
+	      if (h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1)
+		{
+		  /* If we've created a .plt section, and assigned a PLT entry
+		     to this function, it should not be known to bind locally.
+		     If it were, we would have cleared the PLT entry.  */
+		  BFD_ASSERT (!SYMBOL_CALLS_LOCAL (info, h));
+
+		  relocation = (splt->output_section->vma
+				+ splt->output_offset
+				+ h->plt.offset);
+
+		  unresolved_reloc = FALSE;
+		}
+	      r = nios2_elf32_do_call26_relocate (input_bfd, howto,
+						  input_section, contents,
+						  rel->r_offset, relocation,
+						  rel->r_addend);
+	      break;
+	    case R_NIOS2_ALIGN:
+	      r = bfd_reloc_ok;
+	      /* For symmetry this would be
+		 r = nios2_elf32_do_ignore_reloc (input_bfd, howto,
+						  input_section, contents,
+						  rel->r_offset, relocation,
+						  rel->r_addend);
+		but do_ignore_reloc would do no more than return
+		bfd_reloc_ok. */
+	      break;
+
+	    case R_NIOS2_GOT16:
+	    case R_NIOS2_CALL16:
+	      /* Relocation is to the entry for this symbol in the
+		 global offset table.  */
+	      if (sgot == NULL)
+		{
+		  r = bfd_reloc_notsupported;
+		  break;
+		}
+
+	      use_plt = 0;
+
+	      if (h != NULL)
+		{
+		  bfd_boolean dyn;
+
+		  eh = (struct elf32_nios2_link_hash_entry *)h;
+		  use_plt = (eh->got_types_used == CALL16_USED
+			     && h->plt.offset != (bfd_vma) -1);
+
+		  off = h->got.offset;
+		  BFD_ASSERT (off != (bfd_vma) -1);
+		  dyn = elf_hash_table (info)->dynamic_sections_created;
+		  if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+		      || (info->shared
+			  && SYMBOL_REFERENCES_LOCAL (info, h))
+		      || (ELF_ST_VISIBILITY (h->other)
+			  && h->root.type == bfd_link_hash_undefweak))
+		    {
+		      /* This is actually a static link, or it is a -Bsymbolic
+			 link and the symbol is defined locally.  We must
+			 initialize this entry in the global offset table.
+			 Since the offset must always be a multiple of 4, we
+			 use the least significant bit to record whether we
+			 have initialized it already.
+
+			 When doing a dynamic link, we create a .rela.got
+			 relocation entry to initialize the value.  This is
+			 done in the finish_dynamic_symbol routine.  */
+		      if ((off & 1) != 0)
+			off &= ~1;
+		      else
+			{
+			  bfd_put_32 (output_bfd, relocation,
+				      sgot->contents + off);
+			  h->got.offset |= 1;
+			}
+		    }
+		  else
+		    unresolved_reloc = FALSE;
+		}
+	      else
+		{
+		  BFD_ASSERT (local_got_offsets != NULL
+			      && local_got_offsets[r_symndx] != (bfd_vma) -1);
+
+		  off = local_got_offsets[r_symndx];
+
+		  /* The offset must always be a multiple of 4.  We use the
+		     least significant bit to record whether we have already
+		     generated the necessary reloc.  */
+		  if ((off & 1) != 0)
+		    off &= ~1;
+		  else
+		    {
+		      bfd_put_32 (output_bfd, relocation,
+				  sgot->contents + off);
+
+		      if (info->shared)
+			{
+			  asection *srelgot;
+			  Elf_Internal_Rela outrel;
+			  bfd_byte *loc;
+
+			  srelgot = htab->root.srelgot;
+			  BFD_ASSERT (srelgot != NULL);
+
+			  outrel.r_addend = relocation;
+			  outrel.r_offset = (sgot->output_section->vma
+					     + sgot->output_offset
+					     + off);
+			  outrel.r_info = ELF32_R_INFO (0, R_NIOS2_RELATIVE);
+			  loc = srelgot->contents;
+			  loc += (srelgot->reloc_count++ *
+				  sizeof (Elf32_External_Rela));
+			  bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+			}
+
+		      local_got_offsets[r_symndx] |= 1;
+		    }
+		}
+
+	      if (use_plt && info->shared)
+		{
+		  off = ((h->plt.offset - 24) / 12 + 3) * 4;
+		  relocation = htab->root.sgotplt->output_offset + off;
+		}
+	      else
+		relocation = sgot->output_offset + off;
+
+	      /* This relocation does not use the addend.  */
+	      rel->r_addend = 0;
+
+	      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+					    contents, rel->r_offset,
+					    relocation, rel->r_addend);
+	      break;
+
+	    case R_NIOS2_GOTOFF_LO:
+	    case R_NIOS2_GOTOFF_HA:
+	    case R_NIOS2_GOTOFF:
+	      /* Relocation is relative to the start of the
+		 global offset table.  */
+
+	      BFD_ASSERT (sgot != NULL);
+	      if (sgot == NULL)
+		{
+		  r = bfd_reloc_notsupported;
+		  break;
+		}
+
+	      /* Note that sgot->output_offset is not involved in this
+		 calculation.  We always want the start of .got.  If we
+		 define _GLOBAL_OFFSET_TABLE in a different way, as is
+		 permitted by the ABI, we might have to change this
+		 calculation.  */
+	      relocation -= sgot->output_section->vma;
+	      switch (howto->type)
+		{
+		case R_NIOS2_GOTOFF_LO:
+		  r = nios2_elf32_do_lo16_relocate (input_bfd, howto,
+						    input_section, contents,
+						    rel->r_offset, relocation,
+						    rel->r_addend);
+		  break;
+		case R_NIOS2_GOTOFF_HA:
+		  r = nios2_elf32_do_hiadj16_relocate (input_bfd, howto,
+						       input_section, contents,
+						       rel->r_offset,
+						       relocation,
+						       rel->r_addend);
+		  break;
+		default:
+		  r = _bfd_final_link_relocate (howto, input_bfd,
+						input_section, contents,
+						rel->r_offset, relocation,
+						rel->r_addend);
+		  break;
+		}
+	      break;
+
+	    case R_NIOS2_TLS_LDO16:
+	      relocation -= dtpoff_base (info) + DTP_OFFSET;
+
+	      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+					    contents, rel->r_offset,
+					    relocation, rel->r_addend);
+	      break;
+	    case R_NIOS2_TLS_LDM16:
+	      if (htab->root.sgot == NULL)
+		abort ();
+
+	      off = htab->tls_ldm_got.offset;
+
+	      if ((off & 1) != 0)
+		off &= ~1;
+	      else
+		{
+		  /* If we don't know the module number, create a relocation
+		     for it.  */
+		  if (info->shared)
+		    {
+		      Elf_Internal_Rela outrel;
+		      bfd_byte *loc;
+
+		      if (htab->root.srelgot == NULL)
+			abort ();
+
+		      outrel.r_addend = 0;
+		      outrel.r_offset = (htab->root.sgot->output_section->vma
+					 + htab->root.sgot->output_offset
+					 + off);
+		      outrel.r_info = ELF32_R_INFO (0, R_NIOS2_TLS_DTPMOD);
+
+		      loc = htab->root.srelgot->contents;
+		      loc += (htab->root.srelgot->reloc_count++
+			      * sizeof (Elf32_External_Rela));
+		      bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+		    }
+		  else
+		    bfd_put_32 (output_bfd, 1,
+				htab->root.sgot->contents + off);
+
+		  htab->tls_ldm_got.offset |= 1;
+		}
+
+	      relocation = (htab->root.sgot->output_offset + off);
+
+	      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+					    contents, rel->r_offset,
+					    relocation, rel->r_addend);
+
+	      break;
+	    case R_NIOS2_TLS_GD16:
+	    case R_NIOS2_TLS_IE16:
+	      {
+		int indx;
+		char tls_type;
+
+		if (htab->root.sgot == NULL)
+		  abort ();
+
+		indx = 0;
+		if (h != NULL)
+		  {
+		    bfd_boolean dyn;
+		    dyn = htab->root.dynamic_sections_created;
+		    if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+			&& (!info->shared
+			    || !SYMBOL_REFERENCES_LOCAL (info, h)))
+		      {
+			unresolved_reloc = FALSE;
+			indx = h->dynindx;
+		      }
+		    off = h->got.offset;
+		    tls_type = (((struct elf32_nios2_link_hash_entry *) h)
+				->tls_type);
+		  }
+		else
+		  {
+		    if (local_got_offsets == NULL)
+		      abort ();
+		    off = local_got_offsets[r_symndx];
+		    tls_type = (elf32_nios2_local_got_tls_type (input_bfd)
+				[r_symndx]);
+		  }
+
+		if (tls_type == GOT_UNKNOWN)
+		  abort ();
+
+		if ((off & 1) != 0)
+		  off &= ~1;
+		else
+		  {
+		    bfd_boolean need_relocs = FALSE;
+		    Elf_Internal_Rela outrel;
+		    bfd_byte *loc = NULL;
+		    int cur_off = off;
+
+		    /* The GOT entries have not been initialized yet.  Do it
+		       now, and emit any relocations.  If both an IE GOT and a
+		       GD GOT are necessary, we emit the GD first.  */
+
+		    if ((info->shared || indx != 0)
+			&& (h == NULL
+			    || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+			    || h->root.type != bfd_link_hash_undefweak))
+		      {
+			need_relocs = TRUE;
+			if (htab->root.srelgot == NULL)
+			  abort ();
+			loc = htab->root.srelgot->contents;
+			loc += (htab->root.srelgot->reloc_count *
+				sizeof (Elf32_External_Rela));
+		      }
+
+		    if (tls_type & GOT_TLS_GD)
+		      {
+			if (need_relocs)
+			  {
+			    outrel.r_addend = 0;
+			    outrel.r_offset = (htab->root.sgot->output_section->vma
+					       + htab->root.sgot->output_offset
+					       + cur_off);
+			    outrel.r_info = ELF32_R_INFO (indx,
+							  R_NIOS2_TLS_DTPMOD);
+
+			    bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+						       loc);
+			    htab->root.srelgot->reloc_count++;
+			    loc += sizeof (Elf32_External_Rela);
+
+			    if (indx == 0)
+			      bfd_put_32 (output_bfd,
+					  (relocation - dtpoff_base (info) -
+					   DTP_OFFSET),
+					  htab->root.sgot->contents + cur_off + 4);
+			    else
+			      {
+				outrel.r_addend = 0;
+				outrel.r_info = ELF32_R_INFO (indx,
+				  R_NIOS2_TLS_DTPREL);
+				outrel.r_offset += 4;
+
+				bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+							   loc);
+				htab->root.srelgot->reloc_count++;
+				loc += sizeof (Elf32_External_Rela);
+			      }
+			  }
+			else
+			  {
+			    /* If we are not emitting relocations for a
+			       general dynamic reference, then we must be in a
+			       static link or an executable link with the
+			       symbol binding locally.  Mark it as belonging
+			       to module 1, the executable.  */
+			    bfd_put_32 (output_bfd, 1,
+					htab->root.sgot->contents + cur_off);
+			    bfd_put_32 (output_bfd, (relocation -
+						     dtpoff_base (info) -
+						     DTP_OFFSET),
+					htab->root.sgot->contents + cur_off + 4);
+			  }
+
+			cur_off += 8;
+		      }
+
+		    if (tls_type & GOT_TLS_IE)
+		      {
+			if (need_relocs)
+			  {
+			    if (indx == 0)
+			      outrel.r_addend = (relocation -
+						 dtpoff_base (info));
+			    else
+			      outrel.r_addend = 0;
+			    outrel.r_offset = (htab->root.sgot->output_section->vma
+					       + htab->root.sgot->output_offset
+					       + cur_off);
+			    outrel.r_info = ELF32_R_INFO (indx,
+							  R_NIOS2_TLS_TPREL);
+
+			    bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+						       loc);
+			    htab->root.srelgot->reloc_count++;
+			    loc += sizeof (Elf32_External_Rela);
+			  }
+			else
+			  bfd_put_32 (output_bfd, (tpoff (info, relocation)
+						   - TP_OFFSET),
+				      htab->root.sgot->contents + cur_off);
+			cur_off += 4;
+		      }
+
+		    if (h != NULL)
+		      h->got.offset |= 1;
+		    else
+		      local_got_offsets[r_symndx] |= 1;
+		  }
+
+		if ((tls_type & GOT_TLS_GD) && r_type != R_NIOS2_TLS_GD16)
+		  off += 8;
+		relocation = (htab->root.sgot->output_offset + off);
+
+		r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+					      contents, rel->r_offset,
+					      relocation, rel->r_addend);
+	      }
+
+	      break;
+	    case R_NIOS2_TLS_LE16:
+	      if (info->shared && !info->pie)
+		{
+		  (*_bfd_error_handler)
+		    (_("%B(%A+0x%lx): R_NIOS2_TLS_LE16 relocation not "
+		       "permitted in shared object"),
+		     input_bfd, input_section,
+		     (long) rel->r_offset, howto->name);
+		  return FALSE;
+		}
+	      else
+		relocation = tpoff (info, relocation) - TP_OFFSET;
+
+	      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+					    contents, rel->r_offset,
+					    relocation, rel->r_addend);
+	      break;
+
+	    case R_NIOS2_BFD_RELOC_32:
+	      if (info->shared
+		  && (input_section->flags & SEC_ALLOC) != 0
+		  && (h == NULL
+		      || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+		      || h->root.type != bfd_link_hash_undefweak))
+		{
+		  Elf_Internal_Rela outrel;
+		  bfd_byte *loc;
+		  bfd_boolean skip, relocate;
+
+		  /* When generating a shared object, these relocations
+		     are copied into the output file to be resolved at run
+		     time.  */
+
+		  skip = FALSE;
+		  relocate = FALSE;
+
+		  outrel.r_offset
+		    = _bfd_elf_section_offset (output_bfd, info,
+					       input_section, rel->r_offset);
+		  if (outrel.r_offset == (bfd_vma) -1)
+		    skip = TRUE;
+		  else if (outrel.r_offset == (bfd_vma) -2)
+		    skip = TRUE, relocate = TRUE;
+		  outrel.r_offset += (input_section->output_section->vma
+				      + input_section->output_offset);
+
+		  if (skip)
+		    memset (&outrel, 0, sizeof outrel);
+		  else if (h != NULL
+			   && h->dynindx != -1
+			   && (!info->shared
+			       || !info->symbolic
+			       || !h->def_regular))
+		    {
+		      outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
+		      outrel.r_addend = rel->r_addend;
+		    }
+		  else
+		    {
+		      /* This symbol is local, or marked to become local.  */
+		      outrel.r_addend = relocation + rel->r_addend;
+		      relocate = TRUE;
+		      outrel.r_info = ELF32_R_INFO (0, R_NIOS2_RELATIVE);
+		    }
+
+		  sreloc = elf_section_data (input_section)->sreloc;
+		  if (sreloc == NULL)
+		    abort ();
+
+		  loc = sreloc->contents;
+		  loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+		  bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+
+		  /* This reloc will be computed at runtime, so there's no
+		     need to do anything now, except for R_NIOS2_BFD_RELOC_32
+		     relocations that have been turned into
+		     R_NIOS2_RELATIVE.  */
+		  if (!relocate)
+		    break;
+		}
+
+	      r = _bfd_final_link_relocate (howto, input_bfd,
+					    input_section, contents,
+					    rel->r_offset, relocation,
+					    rel->r_addend);
+	      break;
+
+	    case R_NIOS2_TLS_DTPREL:
+	      relocation -= dtpoff_base (info);
+	      /* Fall through.  */
+
+	    default:
+	      r = _bfd_final_link_relocate (howto, input_bfd,
+					    input_section, contents,
+					    rel->r_offset, relocation,
+					    rel->r_addend);
+	      break;
+	    }
+	}
+      else
+	r = bfd_reloc_notsupported;
+
+      if (r != bfd_reloc_ok)
+	{
+	  if (h != NULL)
+	    name = h->root.root.string;
+	  else
+	    {
+	      name = bfd_elf_string_from_elf_section (input_bfd,
+						      symtab_hdr->sh_link,
+						      sym->st_name);
+	      if (name == NULL || *name == '\0')
+		name = bfd_section_name (input_bfd, sec);
+	    }
+
+	  switch (r)
+	    {
+	    case bfd_reloc_overflow:
+	      r = info->callbacks->reloc_overflow (info, NULL, name,
+						   howto->name, (bfd_vma) 0,
+						   input_bfd, input_section,
+						   rel->r_offset);
+	      break;
+
+	    case bfd_reloc_undefined:
+	      r = info->callbacks->undefined_symbol (info, name, input_bfd,
+						     input_section,
+						     rel->r_offset, TRUE);
+	      break;
+
+	    case bfd_reloc_outofrange:
+	      if (msg == NULL)
+		msg = _("relocation out of range");
+	      break;
+
+	    case bfd_reloc_notsupported:
+	      if (msg == NULL)
+		msg = _("unsupported relocation");
+	      break;
+
+	    case bfd_reloc_dangerous:
+	      if (msg == NULL)
+		msg = _("dangerous relocation");
+	      break;
+
+	    default:
+	      if (msg == NULL)
+		msg = _("unknown error");
+	      break;
+	    }
+
+	  if (msg)
+	    {
+	      r = info->callbacks->warning
+		(info, msg, name, input_bfd, input_section, rel->r_offset);
+	      return FALSE;
+	    }
+	}
+    }
+  return TRUE;
+}
+
+/* Implement elf-backend_section_flags:
+   Convert NIOS2 specific section flags to bfd internal section flags.  */
+static bfd_boolean
+nios2_elf32_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr)
+{
+  if (hdr->sh_flags & SHF_NIOS2_GPREL)
+    *flags |= SEC_SMALL_DATA;
+
+  return TRUE;
+}
+
+/* Implement elf_backend_fake_sections:
+   Set the correct type for an NIOS2 ELF section.  We do this by the
+   section name, which is a hack, but ought to work.  */
+static bfd_boolean
+nios2_elf32_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
+			   Elf_Internal_Shdr *hdr, asection *sec)
+{
+  register const char *name = bfd_get_section_name (abfd, sec);
+
+  if ((sec->flags & SEC_SMALL_DATA)
+      || strcmp (name, ".sdata") == 0
+      || strcmp (name, ".sbss") == 0
+      || strcmp (name, ".lit4") == 0 || strcmp (name, ".lit8") == 0)
+    hdr->sh_flags |= SHF_NIOS2_GPREL;
+
+  return TRUE;
+}
+
+/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
+   shortcuts to them in our hash table.  */
+static bfd_boolean
+create_got_section (bfd *dynobj, struct bfd_link_info *info)
+{
+  struct elf32_nios2_link_hash_table *htab;
+
+  htab = elf32_nios2_hash_table (info);
+
+  if (! _bfd_elf_create_got_section (dynobj, info))
+    return FALSE;
+
+  /* In order for the two loads in .PLTresolve to share the same %hiadj,
+     _GLOBAL_OFFSET_TABLE_ must be aligned to a 16-byte boundary.  */
+  if (!bfd_set_section_alignment (dynobj, htab->root.sgotplt, 4))
+    return FALSE;
+
+  return TRUE;
+}
+
+/* Implement elf_backend_create_dynamic_sections:
+   Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
+   .rela.bss sections in DYNOBJ, and set up shortcuts to them in our
+   hash table.  */
+static bfd_boolean
+nios2_elf32_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
+{
+  struct elf32_nios2_link_hash_table *htab;
+
+  htab = elf32_nios2_hash_table (info);
+  if (!htab->root.sgot && !create_got_section (dynobj, info))
+    return FALSE;
+
+  _bfd_elf_create_dynamic_sections (dynobj, info);
+
+  /* In order for the two loads in a shared object .PLTresolve to share the
+     same %hiadj, the start of the PLT (as well as the GOT) must be aligned
+     to a 16-byte boundary.  This is because the addresses for these loads
+     include the -(.plt+4) PIC correction.  */
+  if (!bfd_set_section_alignment (dynobj, htab->root.splt, 4))
+    return FALSE;
+
+  htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
+  if (!htab->sdynbss)
+    return FALSE;
+  if (!info->shared)
+    {
+      htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
+      if (!htab->srelbss)
+	return FALSE;
+    }
+
+  return TRUE;
+}
+
+/* Implement elf_backend_copy_indirect_symbol:
+   Copy the extra info we tack onto an elf_link_hash_entry.  */
+static void
+nios2_elf32_copy_indirect_symbol (struct bfd_link_info *info,
+				  struct elf_link_hash_entry *dir,
+				  struct elf_link_hash_entry *ind)
+{
+  struct elf32_nios2_link_hash_entry *edir, *eind;
+
+  edir = (struct elf32_nios2_link_hash_entry *) dir;
+  eind = (struct elf32_nios2_link_hash_entry *) ind;
+
+  if (eind->dyn_relocs != NULL)
+    {
+      if (edir->dyn_relocs != NULL)
+	{
+	  struct elf32_nios2_dyn_relocs **pp;
+	  struct elf32_nios2_dyn_relocs *p;
+
+	  /* Add reloc counts against the indirect sym to the direct sym
+	     list.  Merge any entries against the same section.  */
+	  for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+	    {
+	      struct elf32_nios2_dyn_relocs *q;
+
+	      for (q = edir->dyn_relocs; q != NULL; q = q->next)
+		if (q->sec == p->sec)
+		  {
+		    q->pc_count += p->pc_count;
+		    q->count += p->count;
+		    *pp = p->next;
+		    break;
+		  }
+	      if (q == NULL)
+		pp = &p->next;
+	    }
+	  *pp = edir->dyn_relocs;
+	}
+
+      edir->dyn_relocs = eind->dyn_relocs;
+      eind->dyn_relocs = NULL;
+    }
+
+  if (ind->root.type == bfd_link_hash_indirect
+      && dir->got.refcount <= 0)
+    {
+      edir->tls_type = eind->tls_type;
+      eind->tls_type = GOT_UNKNOWN;
+    }
+
+  edir->got_types_used |= eind->got_types_used;
+
+  _bfd_elf_link_hash_copy_indirect (info, dir, ind);
+}
+
+/* Implement elf_backend_check_relocs:
+   Look through the relocs for a section during the first phase.  */
+static bfd_boolean
+nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
+			  asection *sec, const Elf_Internal_Rela *relocs)
+{
+  bfd *dynobj;
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
+  const Elf_Internal_Rela *rel;
+  const Elf_Internal_Rela *rel_end;
+  struct elf32_nios2_link_hash_table *htab;
+  asection *sgot;
+  asection *srelgot;
+  asection *sreloc = NULL;
+  bfd_signed_vma *local_got_refcounts;
+
+  if (info->relocatable)
+    return TRUE;
+
+  dynobj = elf_hash_table (info)->dynobj;
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  sym_hashes_end = (sym_hashes
+		    + symtab_hdr->sh_size / sizeof (Elf32_External_Sym));
+  if (!elf_bad_symtab (abfd))
+    sym_hashes_end -= symtab_hdr->sh_info;
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+
+  htab = elf32_nios2_hash_table (info);
+  sgot = htab->root.sgot;
+  srelgot = htab->root.srelgot;
+
+  rel_end = relocs + sec->reloc_count;
+  for (rel = relocs; rel < rel_end; rel++)
+    {
+      unsigned int r_type;
+      struct elf_link_hash_entry *h;
+      unsigned long r_symndx;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx < symtab_hdr->sh_info)
+	h = NULL;
+      else
+	{
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
+	}
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+
+      switch (r_type)
+	{
+	case R_NIOS2_GOT16:
+	case R_NIOS2_CALL16:
+	case R_NIOS2_TLS_GD16:
+	case R_NIOS2_TLS_IE16:
+	  /* This symbol requires a global offset table entry.  */
+	  {
+	    int tls_type, old_tls_type;
+
+	    switch (r_type)
+	      {
+	      default:
+	      case R_NIOS2_GOT16:
+	      case R_NIOS2_CALL16:
+		tls_type = GOT_NORMAL;
+		break;
+	      case R_NIOS2_TLS_GD16:
+		tls_type = GOT_TLS_GD;
+		break;
+	      case R_NIOS2_TLS_IE16:
+		tls_type = GOT_TLS_IE;
+		break;
+	      }
+
+	    if (dynobj == NULL)
+	      {
+		/* Create the .got section.  */
+		elf_hash_table (info)->dynobj = dynobj = abfd;
+		nios2_elf32_create_dynamic_sections (dynobj, info);
+	      }
+
+	    if (sgot == NULL)
+	      {
+		sgot = htab->root.sgot;
+		BFD_ASSERT (sgot != NULL);
+	      }
+
+	    if (srelgot == NULL
+		&& (h != NULL || info->shared))
+	      {
+		srelgot = htab->root.srelgot;
+		BFD_ASSERT (srelgot != NULL);
+	      }
+
+	    if (h != NULL)
+	      {
+		struct elf32_nios2_link_hash_entry *eh
+		  = (struct elf32_nios2_link_hash_entry *)h;
+		h->got.refcount++;
+		old_tls_type = elf32_nios2_hash_entry(h)->tls_type;
+		if (r_type == R_NIOS2_CALL16)
+		  {
+		    /* Make sure a plt entry is created for this symbol if
+		       it turns out to be a function defined by a dynamic
+		       object.  */
+		    h->plt.refcount++;
+		    h->needs_plt = 1;
+		    h->type = STT_FUNC;
+		    eh->got_types_used |= CALL16_USED;
+		  }
+		else
+		  eh->got_types_used |= GOT16_USED;
+	      }
+	    else
+	      {
+		/* This is a global offset table entry for a local symbol.  */
+		if (local_got_refcounts == NULL)
+		  {
+		    bfd_size_type size;
+
+		    size = symtab_hdr->sh_info;
+		    size *= (sizeof (bfd_signed_vma) + sizeof (char));
+		    local_got_refcounts
+		      = ((bfd_signed_vma *) bfd_zalloc (abfd, size));
+		    if (local_got_refcounts == NULL)
+		      return FALSE;
+		    elf_local_got_refcounts (abfd) = local_got_refcounts;
+		    elf32_nios2_local_got_tls_type (abfd)
+		      = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+		  }
+		local_got_refcounts[r_symndx]++;
+		old_tls_type = elf32_nios2_local_got_tls_type (abfd) [r_symndx];
+	      }
+
+	    /* We will already have issued an error message if there is a
+	       TLS / non-TLS mismatch, based on the symbol type.  We don't
+	       support any linker relaxations.  So just combine any TLS
+	       types needed.  */
+	    if (old_tls_type != GOT_UNKNOWN && old_tls_type != GOT_NORMAL
+		&& tls_type != GOT_NORMAL)
+	      tls_type |= old_tls_type;
+
+	    if (old_tls_type != tls_type)
+	      {
+		if (h != NULL)
+		  elf32_nios2_hash_entry (h)->tls_type = tls_type;
+		else
+		  elf32_nios2_local_got_tls_type (abfd) [r_symndx] = tls_type;
+	      }
+	  }
+	  /* Fall through */
+	case R_NIOS2_TLS_LDM16:
+	  if (r_type == R_NIOS2_TLS_LDM16)
+	    htab->tls_ldm_got.refcount++;
+
+	  if (htab->root.sgot == NULL)
+	    {
+	      if (htab->root.dynobj == NULL)
+		htab->root.dynobj = abfd;
+	      if (!create_got_section (htab->root.dynobj, info))
+		return FALSE;
+	    }
+	  break;
+
+	  /* This relocation describes the C++ object vtable hierarchy.
+	     Reconstruct it for later use during GC.  */
+	case R_NIOS2_GNU_VTINHERIT:
+	  if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+	    return FALSE;
+	  break;
+
+	  /* This relocation describes which C++ vtable entries are actually
+	     used.  Record for later use during GC.  */
+	case R_NIOS2_GNU_VTENTRY:
+	  if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+	    return FALSE;
+	  break;
+
+	case R_NIOS2_BFD_RELOC_32:
+	case R_NIOS2_CALL26:
+	case R_NIOS2_HIADJ16:
+	case R_NIOS2_LO16:
+
+	  if (h != NULL)
+	    {
+	      /* If this reloc is in a read-only section, we might
+		   need a copy reloc.  We can't check reliably at this
+		   stage whether the section is read-only, as input
+		   sections have not yet been mapped to output sections.
+		   Tentatively set the flag for now, and correct in
+		   adjust_dynamic_symbol.  */
+	      if (!info->shared)
+		h->non_got_ref = 1;
+
+	      /* Make sure a plt entry is created for this symbol if it
+		 turns out to be a function defined by a dynamic object.  */
+	      h->plt.refcount++;
+
+	      if (r_type == R_NIOS2_CALL26)
+		h->needs_plt = 1;
+	    }
+
+	  /* If we are creating a shared library, we need to copy the
+	     reloc into the shared library.  */
+	  if (info->shared
+	      && (sec->flags & SEC_ALLOC) != 0
+	      && (r_type == R_NIOS2_BFD_RELOC_32
+		  || (h != NULL && ! h->needs_plt
+		      && (! info->symbolic || ! h->def_regular))))
+	    {
+	      struct elf32_nios2_dyn_relocs *p;
+	      struct elf32_nios2_dyn_relocs **head;
+
+	      /* When creating a shared object, we must copy these
+		 reloc types into the output file.  We create a reloc
+		 section in dynobj and make room for this reloc.  */
+	      if (sreloc == NULL)
+		{
+		  sreloc = _bfd_elf_make_dynamic_reloc_section
+		    (sec, dynobj, 2, abfd, TRUE);
+		  if (sreloc == NULL)
+		    return FALSE;
+		}
+
+	      /* If this is a global symbol, we count the number of
+		 relocations we need for this symbol.  */
+	      if (h != NULL)
+		head = &((struct elf32_nios2_link_hash_entry *) h)->dyn_relocs;
+	      else
+		{
+		  /* Track dynamic relocs needed for local syms too.
+		     We really need local syms available to do this
+		     easily.  Oh well.  */
+
+		  asection *s;
+		  void *vpp;
+		  Elf_Internal_Sym *isym;
+
+		  isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+						abfd, r_symndx);
+		  if (isym == NULL)
+		    return FALSE;
+
+		  s = bfd_section_from_elf_index (abfd, isym->st_shndx);
+		  if (s == NULL)
+		    s = sec;
+
+		  vpp = &elf_section_data (s)->local_dynrel;
+		  head = (struct elf32_nios2_dyn_relocs **) vpp;
+		}
+
+	      p = *head;
+	      if (p == NULL || p->sec != sec)
+		{
+		  bfd_size_type amt = sizeof *p;
+		  p = ((struct elf32_nios2_dyn_relocs *)
+		       bfd_alloc (htab->root.dynobj, amt));
+		  if (p == NULL)
+		    return FALSE;
+		  p->next = *head;
+		  *head = p;
+		  p->sec = sec;
+		  p->count = 0;
+		  p->pc_count = 0;
+		}
+
+	      p->count += 1;
+
+	    }
+	  break;
+	}
+    }
+
+  return TRUE;
+}
+
+
+/* Implement elf_backend_gc_mark_hook:
+   Return the section that should be marked against GC for a given
+   relocation.  */
+static asection *
+nios2_elf32_gc_mark_hook (asection *sec,
+			  struct bfd_link_info *info,
+			  Elf_Internal_Rela *rel,
+			  struct elf_link_hash_entry *h,
+			  Elf_Internal_Sym *sym)
+{
+  if (h != NULL)
+    switch (ELF32_R_TYPE (rel->r_info))
+      {
+      case R_NIOS2_GNU_VTINHERIT:
+      case R_NIOS2_GNU_VTENTRY:
+	return NULL;
+      }
+  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+}
+
+/* Implement elf_backend_gc_sweep_hook:
+   Update the got entry reference counts for the section being removed.  */
+static bfd_boolean
+nios2_elf32_gc_sweep_hook (bfd *abfd,
+			   struct bfd_link_info *info,
+			   asection *sec,
+			   const Elf_Internal_Rela *relocs)
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes;
+  bfd_signed_vma *local_got_refcounts;
+  const Elf_Internal_Rela *rel, *relend;
+  bfd *dynobj;
+
+  if (info->relocatable)
+    return TRUE;
+
+  elf_section_data (sec)->local_dynrel = NULL;
+
+  dynobj = elf_hash_table (info)->dynobj;
+  if (dynobj == NULL)
+    return TRUE;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+
+  relend = relocs + sec->reloc_count;
+  for (rel = relocs; rel < relend; rel++)
+    {
+      unsigned long r_symndx;
+      struct elf_link_hash_entry *h = NULL;
+      int r_type;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+	{
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+	}
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+      switch (r_type)
+	{
+	case R_NIOS2_GOT16:
+	case R_NIOS2_CALL16:
+	  if (h != NULL)
+	    {
+	      if (h->got.refcount > 0)
+		--h->got.refcount;
+	    }
+	  else if (local_got_refcounts != NULL)
+	    {
+	      if (local_got_refcounts[r_symndx] > 0)
+		--local_got_refcounts[r_symndx];
+	    }
+	  break;
+
+	case R_NIOS2_PCREL_LO:
+	case R_NIOS2_PCREL_HA:
+	case R_NIOS2_BFD_RELOC_32:
+	case R_NIOS2_CALL26:
+	  if (h != NULL)
+	    {
+	      struct elf32_nios2_link_hash_entry *eh;
+	      struct elf32_nios2_dyn_relocs **pp;
+	      struct elf32_nios2_dyn_relocs *p;
+
+	      eh = (struct elf32_nios2_link_hash_entry *) h;
+
+	      if (h->plt.refcount > 0)
+		--h->plt.refcount;
+
+	      if (r_type == R_NIOS2_PCREL_LO || r_type == R_NIOS2_PCREL_HA
+		  || r_type == R_NIOS2_BFD_RELOC_32)
+		{
+		  for (pp = &eh->dyn_relocs; (p = *pp) != NULL;
+		       pp = &p->next)
+		    if (p->sec == sec)
+		      {
+			p->count -= 1;
+			if (p->count == 0)
+			  *pp = p->next;
+			break;
+		      }
+		}
+	    }
+	  break;
+
+	default:
+	  break;
+	}
+    }
+
+  return TRUE;
+}
+
+/* Install 16-bit immediate value VALUE at offset OFFSET into section SEC.  */
+static void
+nios2_elf32_install_imm16 (asection *sec, bfd_vma offset, bfd_vma value)
+{
+  bfd_vma word = bfd_get_32 (sec->owner, sec->contents + offset);
+
+  BFD_ASSERT(value <= 0xffff);
+
+  bfd_put_32 (sec->owner, word | ((value & 0xffff) << 6),
+	      sec->contents + offset);
+}
+
+/* Install COUNT 32-bit values DATA starting at offset OFFSET into
+   section SEC. */
+static void
+nios2_elf32_install_data (asection *sec, const bfd_vma *data, bfd_vma offset,
+			  int count)
+{
+  while (count--)
+    {
+      bfd_put_32 (sec->owner, *data, sec->contents + offset);
+      offset += 4;
+      ++data;
+    }
+}
+
+/* Implement elf_backend_finish_dynamic_symbols:
+   Finish up dynamic symbol handling.  We set the contents of various
+   dynamic sections here.  */
+static bfd_boolean
+nios2_elf32_finish_dynamic_symbol (bfd *output_bfd,
+				   struct bfd_link_info *info,
+				   struct elf_link_hash_entry *h,
+				   Elf_Internal_Sym *sym)
+{
+  struct elf32_nios2_link_hash_table *htab;
+  struct elf32_nios2_link_hash_entry *eh
+    = (struct elf32_nios2_link_hash_entry *)h;
+  int use_plt;
+
+  htab = elf32_nios2_hash_table (info);
+
+  if (h->plt.offset != (bfd_vma) -1)
+    {
+      asection *splt;
+      asection *sgotplt;
+      asection *srela;
+      bfd_vma plt_index;
+      bfd_vma got_offset;
+      Elf_Internal_Rela rela;
+      bfd_byte *loc;
+      bfd_vma got_address;
+
+      /* This symbol has an entry in the procedure linkage table.  Set
+	 it up.  */
+      BFD_ASSERT (h->dynindx != -1);
+      splt = htab->root.splt;
+      sgotplt = htab->root.sgotplt;
+      srela = htab->root.srelplt;
+      BFD_ASSERT (splt != NULL && sgotplt != NULL && srela != NULL);
+
+      /* Emit the PLT entry.  */
+      if (info->shared)
+	{
+	  nios2_elf32_install_data (splt, nios2_so_plt_entry, h->plt.offset,
+				    3);
+	  plt_index = (h->plt.offset - 24) / 12;
+	  got_offset = (plt_index + 3) * 4;
+	  nios2_elf32_install_imm16 (splt, h->plt.offset,
+				     hiadj(plt_index * 4));
+	  nios2_elf32_install_imm16 (splt, h->plt.offset + 4,
+				     (plt_index * 4) & 0xffff);
+	  nios2_elf32_install_imm16 (splt, h->plt.offset + 8,
+				     0xfff4 - h->plt.offset);
+	  got_address = (sgotplt->output_section->vma + sgotplt->output_offset
+			 + got_offset);
+
+	  /* Fill in the entry in the global offset table.  There are no
+	     res_n slots for a shared object PLT, instead the .got.plt entries
+	     point to the PLT entries.  */
+	  bfd_put_32 (output_bfd,
+		      splt->output_section->vma + splt->output_offset
+		      + h->plt.offset, sgotplt->contents + got_offset);
+	}
+      else
+	{
+	  plt_index = (h->plt.offset - 28 - htab->res_n_size) / 12;
+	  got_offset = (plt_index + 3) * 4;
+
+	  nios2_elf32_install_data (splt, nios2_plt_entry, h->plt.offset, 3);
+	  got_address = (sgotplt->output_section->vma + sgotplt->output_offset
+			 + got_offset);
+	  nios2_elf32_install_imm16 (splt, h->plt.offset, hiadj(got_address));
+	  nios2_elf32_install_imm16 (splt, h->plt.offset + 4,
+				     got_address & 0xffff);
+
+	  /* Fill in the entry in the global offset table.  */
+	  bfd_put_32 (output_bfd,
+		      splt->output_section->vma + splt->output_offset
+		      + plt_index * 4, sgotplt->contents + got_offset);
+	}
+
+      /* Fill in the entry in the .rela.plt section.  */
+      rela.r_offset = got_address;
+      rela.r_info = ELF32_R_INFO (h->dynindx, R_NIOS2_JUMP_SLOT);
+      rela.r_addend = 0;
+      loc = srela->contents + plt_index * sizeof (Elf32_External_Rela);
+      bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+
+      if (!h->def_regular)
+	{
+	  /* Mark the symbol as undefined, rather than as defined in
+	     the .plt section.  Leave the value alone.  */
+	  sym->st_shndx = SHN_UNDEF;
+	  /* If the symbol is weak, we do need to clear the value.
+	     Otherwise, the PLT entry would provide a definition for
+	     the symbol even if the symbol wasn't defined anywhere,
+	     and so the symbol would never be NULL.  */
+	  if (!h->ref_regular_nonweak)
+	    sym->st_value = 0;
+	}
+    }
+
+  use_plt = (eh->got_types_used == CALL16_USED
+	     && h->plt.offset != (bfd_vma) -1);
+
+  if (!use_plt && h->got.offset != (bfd_vma) -1
+      && (elf32_nios2_hash_entry (h)->tls_type & GOT_TLS_GD) == 0
+      && (elf32_nios2_hash_entry (h)->tls_type & GOT_TLS_IE) == 0)
+    {
+      asection *sgot;
+      asection *srela;
+      Elf_Internal_Rela rela;
+      bfd_byte *loc;
+      bfd_vma offset;
+
+      /* This symbol has an entry in the global offset table.  Set it
+	 up.  */
+      sgot = htab->root.sgot;
+      srela = htab->root.srelgot;
+      BFD_ASSERT (sgot != NULL && srela != NULL);
+
+      offset = (h->got.offset & ~(bfd_vma) 1);
+      rela.r_offset = (sgot->output_section->vma
+		       + sgot->output_offset + offset);
+
+      /* If this is a -Bsymbolic link, and the symbol is defined
+	 locally, we just want to emit a RELATIVE reloc.  Likewise if
+	 the symbol was forced to be local because of a version file.
+	 The entry in the global offset table will already have been
+	 initialized in the relocate_section function.  */
+
+      if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
+	{
+	  rela.r_info = ELF32_R_INFO (0, R_NIOS2_RELATIVE);
+	  rela.r_addend = bfd_get_signed_32 (output_bfd,
+					     (sgot->contents + offset));
+	  bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + offset);
+	}
+      else
+	{
+	  bfd_put_32 (output_bfd, (bfd_vma) 0,
+		      sgot->contents + offset);
+	  rela.r_info = ELF32_R_INFO (h->dynindx, R_NIOS2_GLOB_DAT);
+	  rela.r_addend = 0;
+	}
+
+      loc = srela->contents;
+      loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
+      bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+    }
+
+  if (use_plt && h->got.offset != (bfd_vma) -1)
+    {
+      bfd_vma offset = (h->got.offset & ~(bfd_vma) 1);
+      asection *sgot = htab->root.sgot;
+      asection *splt = htab->root.splt;
+      bfd_put_32 (output_bfd, (splt->output_section->vma + splt->output_offset
+			       + h->plt.offset),
+		  sgot->contents + offset);
+    }
+
+  if (h->needs_copy)
+    {
+      asection *s;
+      Elf_Internal_Rela rela;
+      bfd_byte *loc;
+
+      /* This symbol needs a copy reloc.  Set it up.  */
+      BFD_ASSERT (h->dynindx != -1
+		  && (h->root.type == bfd_link_hash_defined
+		      || h->root.type == bfd_link_hash_defweak));
+
+      s = htab->srelbss;
+      BFD_ASSERT (s != NULL);
+
+      rela.r_offset = (h->root.u.def.value
+		       + h->root.u.def.section->output_section->vma
+		       + h->root.u.def.section->output_offset);
+      rela.r_info = ELF32_R_INFO (h->dynindx, R_NIOS2_COPY);
+      rela.r_addend = 0;
+      loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+      bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
+    }
+
+  /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
+  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+      || h == elf_hash_table (info)->hgot)
+    sym->st_shndx = SHN_ABS;
+
+  return TRUE;
+}
+
+/* Implement elf_backend_finish_dynamic_sections.  */
+static bfd_boolean
+nios2_elf32_finish_dynamic_sections (bfd *output_bfd,
+				     struct bfd_link_info *info)
+{
+  bfd *dynobj;
+  asection *sgotplt;
+  asection *sdyn;
+  struct elf32_nios2_link_hash_table *htab;
+
+  htab = elf32_nios2_hash_table (info);
+  dynobj = elf_hash_table (info)->dynobj;
+  sgotplt = htab->root.sgotplt;
+  BFD_ASSERT (sgotplt != NULL);
+  sdyn = bfd_get_linker_section (dynobj, ".dynamic");
+
+  if (elf_hash_table (info)->dynamic_sections_created)
+    {
+      asection *splt;
+      Elf32_External_Dyn *dyncon, *dynconend;
+
+      splt = htab->root.splt;
+      BFD_ASSERT (splt != NULL && sdyn != NULL);
+
+      dyncon = (Elf32_External_Dyn *) sdyn->contents;
+      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
+      for (; dyncon < dynconend; dyncon++)
+	{
+	  Elf_Internal_Dyn dyn;
+	  asection *s;
+
+	  bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+
+	  switch (dyn.d_tag)
+	    {
+	    default:
+	      break;
+
+	    case DT_PLTGOT:
+	      s = htab->root.sgot;
+	      BFD_ASSERT (s != NULL);
+	      dyn.d_un.d_ptr = s->output_section->vma;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_JMPREL:
+	      s = htab->root.srelplt;
+	      BFD_ASSERT (s != NULL);
+	      dyn.d_un.d_ptr = s->output_section->vma;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_PLTRELSZ:
+	      s = htab->root.srelplt;
+	      BFD_ASSERT (s != NULL);
+	      dyn.d_un.d_val = s->size;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_RELASZ:
+	      /* The procedure linkage table relocs (DT_JMPREL) should
+		 not be included in the overall relocs (DT_RELA).
+		 Therefore, we override the DT_RELASZ entry here to
+		 make it not include the JMPREL relocs.  Since the
+		 linker script arranges for .rela.plt to follow all
+		 other relocation sections, we don't have to worry
+		 about changing the DT_RELA entry.  */
+	      s = htab->root.srelplt;
+	      if (s != NULL)
+		dyn.d_un.d_val -= s->size;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_NIOS2_GP:
+	      s = htab->root.sgot;
+	      BFD_ASSERT (s != NULL);
+	      dyn.d_un.d_ptr = s->output_section->vma + 0x7ff0;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+	    }
+	}
+
+      /* Fill in the first entry in the procedure linkage table.  */
+      if (splt->size > 0)
+	{
+	  bfd_vma got_address = (sgotplt->output_section->vma
+				 + sgotplt->output_offset);
+	  if (info->shared)
+	    {
+	      bfd_vma corrected = got_address - (splt->output_section->vma
+						 + splt->output_offset + 4);
+	      nios2_elf32_install_data (splt, nios2_so_plt0_entry, 0, 6);
+	      nios2_elf32_install_imm16 (splt, 4, hiadj (corrected));
+	      nios2_elf32_install_imm16 (splt, 12, (corrected & 0xffff) + 4);
+	      nios2_elf32_install_imm16 (splt, 16, (corrected & 0xffff) + 8);
+	    }
+	  else
+	    {
+	      /* Divide by 4 here, not 3 because we already corrected for the
+		 res_N branches.  */
+	      bfd_vma res_size = (splt->size - 28) / 4;
+	      bfd_vma res_start = (splt->output_section->vma
+				   + splt->output_offset);
+	      bfd_vma res_offset;
+
+	      for (res_offset = 0; res_offset < res_size; res_offset += 4)
+		bfd_put_32 (output_bfd,
+			    6 | ((res_size - (res_offset + 4)) << 6),
+			    splt->contents + res_offset);
+
+	      nios2_elf32_install_data (splt, nios2_plt0_entry, res_size, 7);
+	      nios2_elf32_install_imm16 (splt, res_size, hiadj (res_start));
+	      nios2_elf32_install_imm16 (splt, res_size + 4,
+					 res_start & 0xffff);
+	      nios2_elf32_install_imm16 (splt, res_size + 12,
+					 hiadj (got_address));
+	      nios2_elf32_install_imm16 (splt, res_size + 16,
+					 (got_address & 0xffff) + 4);
+	      nios2_elf32_install_imm16 (splt, res_size + 20,
+					 (got_address & 0xffff) + 8);
+	    }
+	}
+    }
+  /* Fill in the first three entries in the global offset table.  */
+  if (sgotplt->size > 0)
+    {
+      if (sdyn == NULL)
+	bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents);
+      else
+	bfd_put_32 (output_bfd,
+		    sdyn->output_section->vma + sdyn->output_offset,
+		    sgotplt->contents);
+      bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 4);
+      bfd_put_32 (output_bfd, (bfd_vma) 0, sgotplt->contents + 8);
+    }
+
+  elf_section_data (sgotplt->output_section)->this_hdr.sh_entsize = 4;
+
+  return TRUE;
+}
+
+/* Implement elf_backend_adjust_dynamic_symbol:
+   Adjust a symbol defined by a dynamic object and referenced by a
+   regular object.  The current definition is in some section of the
+   dynamic object, but we're not including those sections.  We have to
+   change the definition to something the rest of the link can
+   understand.  */
+static bfd_boolean
+nios2_elf32_adjust_dynamic_symbol (struct bfd_link_info *info,
+				   struct elf_link_hash_entry *h)
+{
+  struct elf32_nios2_link_hash_table *htab;
+  bfd *dynobj;
+  asection *s;
+  unsigned align2;
+
+  htab = elf32_nios2_hash_table (info);
+  dynobj = elf_hash_table (info)->dynobj;
+
+  /* Make sure we know what is going on here.  */
+  BFD_ASSERT (dynobj != NULL
+	      && (h->needs_plt
+		  || h->u.weakdef != NULL
+		  || (h->def_dynamic
+		      && h->ref_regular
+		      && !h->def_regular)));
+
+  /* If this is a function, put it in the procedure linkage table.  We
+     will fill in the contents of the procedure linkage table later,
+     when we know the address of the .got section.  */
+  if (h->type == STT_FUNC || h->needs_plt)
+    {
+      if (h->plt.refcount <= 0
+	  || SYMBOL_CALLS_LOCAL (info, h)
+	  || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	      && h->root.type == bfd_link_hash_undefweak))
+	{
+	  /* This case can occur if we saw a PLT reloc in an input
+	     file, but the symbol was never referred to by a dynamic
+	     object, or if all references were garbage collected.  In
+	     such a case, we don't actually need to build a procedure
+	     linkage table, and we can just do a PCREL reloc instead.  */
+	  h->plt.offset = (bfd_vma) -1;
+	  h->needs_plt = 0;
+	}
+
+      return TRUE;
+    }
+
+  /* Reinitialize the plt offset now that it is not used as a reference
+     count any more.  */
+  h->plt.offset = (bfd_vma) -1;
+
+  /* If this is a weak symbol, and there is a real definition, the
+     processor independent code will have arranged for us to see the
+     real definition first, and we can just use the same value.  */
+  if (h->u.weakdef != NULL)
+    {
+      BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+		  || h->u.weakdef->root.type == bfd_link_hash_defweak);
+      h->root.u.def.section = h->u.weakdef->root.u.def.section;
+      h->root.u.def.value = h->u.weakdef->root.u.def.value;
+      return TRUE;
+    }
+
+  /* If there are no non-GOT references, we do not need a copy
+     relocation.  */
+  if (!h->non_got_ref)
+    return TRUE;
+
+  /* This is a reference to a symbol defined by a dynamic object which
+     is not a function.
+     If we are creating a shared library, we must presume that the
+     only references to the symbol are via the global offset table.
+     For such cases we need not do anything here; the relocations will
+     be handled correctly by relocate_section.  */
+  if (info->shared)
+    return TRUE;
+
+  if (h->size == 0)
+    {
+      (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+			     h->root.root.string);
+      return TRUE;
+    }
+
+  /* We must allocate the symbol in our .dynbss section, which will
+     become part of the .bss section of the executable.  There will be
+     an entry for this symbol in the .dynsym section.  The dynamic
+     object will contain position independent code, so all references
+     from the dynamic object to this symbol will go through the global
+     offset table.  The dynamic linker will use the .dynsym entry to
+     determine the address it must put in the global offset table, so
+     both the dynamic object and the regular object will refer to the
+     same memory location for the variable.  */
+  s = htab->sdynbss;
+  BFD_ASSERT (s != NULL);
+
+  /* We must generate a R_NIOS2_COPY reloc to tell the dynamic linker to
+     copy the initial value out of the dynamic object and into the
+     runtime process image.  We need to remember the offset into the
+     .rela.bss section we are going to use.  */
+  if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
+    {
+      asection *srel;
+
+      srel = htab->srelbss;
+      BFD_ASSERT (srel != NULL);
+      srel->size += sizeof (Elf32_External_Rela);
+      h->needs_copy = 1;
+    }
+
+  align2 = bfd_log2 (h->size);
+  if (align2 > h->root.u.def.section->alignment_power)
+    align2 = h->root.u.def.section->alignment_power;
+
+  /* Align dynbss.  */
+  s->size = BFD_ALIGN (s->size, (bfd_size_type)1 << align2);
+  if (align2 > bfd_get_section_alignment (dynobj, s)
+      && !bfd_set_section_alignment (dynobj, s, align2))
+    return FALSE;
+
+  /* Define the symbol as being at this point in the section.  */
+  h->root.u.def.section = s;
+  h->root.u.def.value = s->size;
+
+  /* Increment the section size to make room for the symbol.  */
+  s->size += h->size;
+
+  return TRUE;
+}
+
+/* Worker function for nios2_elf32_size_dynamic_sections.  */
+static bfd_boolean
+adjust_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+{
+  struct bfd_link_info *info;
+  struct elf32_nios2_link_hash_table *htab;
+
+  if (h->root.type == bfd_link_hash_indirect)
+    return TRUE;
+
+  if (h->root.type == bfd_link_hash_warning)
+    /* When warning symbols are created, they **replace** the "real"
+       entry in the hash table, thus we never get to see the real
+       symbol in a hash traversal.  So look at it now.  */
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+  info = (struct bfd_link_info *) inf;
+  htab = elf32_nios2_hash_table (info);
+
+  if (h->plt.offset != (bfd_vma)-1)
+    h->plt.offset += htab->res_n_size;
+  if (htab->root.splt == h->root.u.def.section)
+    h->root.u.def.value += htab->res_n_size;
+
+  return TRUE;
+}
+
+/* Another worker function for nios2_elf32_size_dynamic_sections.
+   Allocate space in .plt, .got and associated reloc sections for
+   dynamic relocs.  */
+static bfd_boolean
+allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
+{
+  struct bfd_link_info *info;
+  struct elf32_nios2_link_hash_table *htab;
+  struct elf32_nios2_link_hash_entry *eh;
+  struct elf32_nios2_dyn_relocs *p;
+  int use_plt;
+
+  if (h->root.type == bfd_link_hash_indirect)
+    return TRUE;
+
+  if (h->root.type == bfd_link_hash_warning)
+    /* When warning symbols are created, they **replace** the "real"
+       entry in the hash table, thus we never get to see the real
+       symbol in a hash traversal.  So look at it now.  */
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+  info = (struct bfd_link_info *) inf;
+  htab = elf32_nios2_hash_table (info);
+
+  if (htab->root.dynamic_sections_created
+      && h->plt.refcount > 0)
+    {
+      /* Make sure this symbol is output as a dynamic symbol.
+	 Undefined weak syms won't yet be marked as dynamic.  */
+      if (h->dynindx == -1
+	  && !h->forced_local
+	  && !bfd_elf_link_record_dynamic_symbol (info, h))
+	return FALSE;
+
+      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
+	{
+	  asection *s = htab->root.splt;
+
+	  /* Allocate room for the header.  */
+	  if (s->size == 0)
+	    {
+	      if (info->shared)
+		s->size = 24;
+	      else
+		s->size = 28;
+	    }
+
+	  h->plt.offset = s->size;
+
+	  /* If this symbol is not defined in a regular file, and we are
+	     not generating a shared library, then set the symbol to this
+	     location in the .plt.  This is required to make function
+	     pointers compare as equal between the normal executable and
+	     the shared library.  */
+	  if (! info->shared
+	      && !h->def_regular)
+	    {
+	      h->root.u.def.section = s;
+	      h->root.u.def.value = h->plt.offset;
+	    }
+
+	  /* Make room for this entry.  */
+	  s->size += 12;
+
+	  /* We also need to make an entry in the .rela.plt section.  */
+	  htab->root.srelplt->size += sizeof (Elf32_External_Rela);
+
+	  /* And the .got.plt section.  */
+	  htab->root.sgotplt->size += 4;
+	}
+      else
+	{
+	  h->plt.offset = (bfd_vma) -1;
+	  h->needs_plt = 0;
+	}
+    }
+  else
+    {
+      h->plt.offset = (bfd_vma) -1;
+      h->needs_plt = 0;
+    }
+
+  eh = (struct elf32_nios2_link_hash_entry *) h;
+  use_plt = (eh->got_types_used == CALL16_USED
+	     && h->plt.offset != (bfd_vma) -1);
+
+  if (h->got.refcount > 0)
+    {
+      asection *s;
+      bfd_boolean dyn;
+      int tls_type = eh->tls_type;
+      int indx;
+
+      /* Make sure this symbol is output as a dynamic symbol.
+	 Undefined weak syms won't yet be marked as dynamic.  */
+      if (h->dynindx == -1
+	  && !h->forced_local
+	  && !bfd_elf_link_record_dynamic_symbol (info, h))
+	return FALSE;
+
+      s = htab->root.sgot;
+      h->got.offset = s->size;
+
+      if (tls_type == GOT_UNKNOWN)
+	abort ();
+
+      if (tls_type == GOT_NORMAL)
+	/* Non-TLS symbols need one GOT slot.  */
+	s->size += 4;
+      else
+	{
+	  if (tls_type & GOT_TLS_GD)
+	    /* R_NIOS2_TLS_GD16 needs 2 consecutive GOT slots.  */
+	    s->size += 8;
+	  if (tls_type & GOT_TLS_IE)
+	    /* R_NIOS2_TLS_IE16 needs one GOT slot.  */
+	    s->size += 4;
+	}
+
+      dyn = htab->root.dynamic_sections_created;
+
+      indx = 0;
+      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+	  && (!info->shared
+	      || !SYMBOL_REFERENCES_LOCAL (info, h)))
+	indx = h->dynindx;
+
+      if (tls_type != GOT_NORMAL
+	  && (info->shared || indx != 0)
+	  && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+	      || h->root.type != bfd_link_hash_undefweak))
+	{
+	  if (tls_type & GOT_TLS_IE)
+	    htab->root.srelgot->size += sizeof (Elf32_External_Rela);
+
+	  if (tls_type & GOT_TLS_GD)
+	    htab->root.srelgot->size += sizeof (Elf32_External_Rela);
+
+	  if ((tls_type & GOT_TLS_GD) && indx != 0)
+	    htab->root.srelgot->size += sizeof (Elf32_External_Rela);
+	}
+      else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+		|| h->root.type != bfd_link_hash_undefweak)
+	       && !use_plt
+	       && (info->shared
+		   || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
+	htab->root.srelgot->size += sizeof (Elf32_External_Rela);
+    }
+  else
+    h->got.offset = (bfd_vma) -1;
+
+  if (eh->dyn_relocs == NULL)
+    return TRUE;
+
+  /* In the shared -Bsymbolic case, discard space allocated for
+     dynamic pc-relative relocs against symbols which turn out to be
+     defined in regular objects.  For the normal shared case, discard
+     space for pc-relative relocs that have become local due to symbol
+     visibility changes.  */
+
+  if (info->shared)
+    {
+      if (h->def_regular
+	  && (h->forced_local || info->symbolic))
+	{
+	  struct elf32_nios2_dyn_relocs **pp;
+
+	  for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+	    {
+	      p->count -= p->pc_count;
+	      p->pc_count = 0;
+	      if (p->count == 0)
+		*pp = p->next;
+	      else
+		pp = &p->next;
+	    }
+	}
+
+      /* Also discard relocs on undefined weak syms with non-default
+	 visibility.  */
+      if (eh->dyn_relocs != NULL
+	  && h->root.type == bfd_link_hash_undefweak)
+	{
+	  if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+	    eh->dyn_relocs = NULL;
+
+	  /* Make sure undefined weak symbols are output as a dynamic
+	     symbol in PIEs.  */
+	  else if (h->dynindx == -1
+		   && !h->forced_local
+		   && !bfd_elf_link_record_dynamic_symbol (info, h))
+	    return FALSE;
+	}
+    }
+  else
+    {
+      /* For the non-shared case, discard space for relocs against
+	 symbols which turn out to need copy relocs or are not
+	 dynamic.  */
+
+      if (!h->non_got_ref
+	  && ((h->def_dynamic && !h->def_regular)
+	      || (htab->root.dynamic_sections_created
+		  && (h->root.type == bfd_link_hash_undefweak
+		      || h->root.type == bfd_link_hash_undefined))))
+	{
+	  /* Make sure this symbol is output as a dynamic symbol.
+	     Undefined weak syms won't yet be marked as dynamic.  */
+	  if (h->dynindx == -1
+	      && !h->forced_local
+	      && !bfd_elf_link_record_dynamic_symbol (info, h))
+	    return FALSE;
+
+	  /* If that succeeded, we know we'll be keeping all the
+	     relocs.  */
+	  if (h->dynindx != -1)
+	    goto keep;
+	}
+
+      eh->dyn_relocs = NULL;
+
+    keep: ;
+    }
+
+  /* Finally, allocate space.  */
+  for (p = eh->dyn_relocs; p != NULL; p = p->next)
+    {
+      asection *sreloc = elf_section_data (p->sec)->sreloc;
+      sreloc->size += p->count * sizeof (Elf32_External_Rela);
+    }
+
+  return TRUE;
+}
+
+/* Implement elf_backend_size_dynamic_sections:
+   Set the sizes of the dynamic sections.  */
+static bfd_boolean
+nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+				   struct bfd_link_info *info)
+{
+  bfd *dynobj;
+  asection *s;
+  bfd_boolean plt;
+  bfd_boolean got;
+  bfd_boolean relocs;
+  bfd *ibfd;
+  struct elf32_nios2_link_hash_table *htab;
+
+  htab = elf32_nios2_hash_table (info);
+  dynobj = elf_hash_table (info)->dynobj;
+  BFD_ASSERT (dynobj != NULL);
+
+  htab->res_n_size = 0;
+  if (elf_hash_table (info)->dynamic_sections_created)
+    {
+      /* Set the contents of the .interp section to the interpreter.  */
+      if (info->executable)
+	{
+	  s = bfd_get_linker_section (dynobj, ".interp");
+	  BFD_ASSERT (s != NULL);
+	  s->size = sizeof ELF_DYNAMIC_INTERPRETER;
+	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+	}
+    }
+  else
+    {
+      /* We may have created entries in the .rela.got section.
+	 However, if we are not creating the dynamic sections, we will
+	 not actually use these entries.  Reset the size of .rela.got,
+	 which will cause it to get stripped from the output file
+	 below.  */
+      s = htab->root.srelgot;
+      if (s != NULL)
+	s->size = 0;
+    }
+
+  /* Set up .got offsets for local syms, and space for local dynamic
+     relocs.  */
+  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+    {
+      bfd_signed_vma *local_got;
+      bfd_signed_vma *end_local_got;
+      char *local_tls_type;
+      bfd_size_type locsymcount;
+      Elf_Internal_Shdr *symtab_hdr;
+      asection *srel;
+
+      if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+	continue;
+
+      for (s = ibfd->sections; s != NULL; s = s->next)
+	{
+	  struct elf32_nios2_dyn_relocs *p;
+
+	  for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next)
+	    {
+	      if (!bfd_is_abs_section (p->sec)
+		  && bfd_is_abs_section (p->sec->output_section))
+		{
+		  /* Input section has been discarded, either because
+		     it is a copy of a linkonce section or due to
+		     linker script /DISCARD/, so we'll be discarding
+		     the relocs too.  */
+		}
+	      else if (p->count != 0)
+		{
+		  srel = elf_section_data (p->sec)->sreloc;
+		  srel->size += p->count * sizeof (Elf32_External_Rela);
+		  if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+		    info->flags |= DF_TEXTREL;
+		}
+	    }
+	}
+
+      local_got = elf_local_got_refcounts (ibfd);
+      if (!local_got)
+	continue;
+
+      symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+      locsymcount = symtab_hdr->sh_info;
+      end_local_got = local_got + locsymcount;
+      local_tls_type = elf32_nios2_local_got_tls_type (ibfd);
+      s = htab->root.sgot;
+      srel = htab->root.srelgot;
+      for (; local_got < end_local_got; ++local_got, ++local_tls_type)
+	{
+	  if (*local_got > 0)
+	    {
+	      *local_got = s->size;
+	      if (*local_tls_type & GOT_TLS_GD)
+		/* TLS_GD relocs need an 8-byte structure in the GOT.  */
+		s->size += 8;
+	      if (*local_tls_type & GOT_TLS_IE)
+		s->size += 4;
+	      if (*local_tls_type == GOT_NORMAL)
+		s->size += 4;
+
+	      if (info->shared || *local_tls_type == GOT_TLS_GD)
+		srel->size += sizeof (Elf32_External_Rela);
+	    }
+	  else
+	    *local_got = (bfd_vma) -1;
+	}
+    }
+
+  if (htab->tls_ldm_got.refcount > 0)
+    {
+      /* Allocate two GOT entries and one dynamic relocation (if necessary)
+	 for R_NIOS2_TLS_LDM16 relocations.  */
+      htab->tls_ldm_got.offset = htab->root.sgot->size;
+      htab->root.sgot->size += 8;
+      if (info->shared)
+	htab->root.srelgot->size += sizeof (Elf32_External_Rela);
+    }
+  else
+    htab->tls_ldm_got.offset = -1;
+
+  /* Allocate global sym .plt and .got entries, and space for global
+     sym dynamic relocs.  */
+  elf_link_hash_traverse (& htab->root, allocate_dynrelocs, info);
+
+  /* The check_relocs and adjust_dynamic_symbol entry points have
+     determined the sizes of the various dynamic sections.  Allocate
+     memory for them.  */
+  plt = FALSE;
+  got = FALSE;
+  relocs = FALSE;
+  for (s = dynobj->sections; s != NULL; s = s->next)
+    {
+      const char *name;
+
+      if ((s->flags & SEC_LINKER_CREATED) == 0)
+	continue;
+
+      /* It's OK to base decisions on the section name, because none
+	 of the dynobj section names depend upon the input files.  */
+      name = bfd_get_section_name (dynobj, s);
+
+      if (strcmp (name, ".plt") == 0)
+	{
+	  /* Remember whether there is a PLT.  */
+	  plt = s->size != 0;
+
+	  /* Correct for the number of res_N branches.  */
+	  if (plt && !info->shared)
+	    {
+	      htab->res_n_size = (s->size-28) / 3;
+	      s->size += htab->res_n_size;
+	    }
+	}
+      else if (CONST_STRNEQ (name, ".rela"))
+	{
+	  if (s->size != 0)
+	    {
+	      relocs = TRUE;
+
+	      /* We use the reloc_count field as a counter if we need
+		 to copy relocs into the output file.  */
+	      s->reloc_count = 0;
+	    }
+	}
+      else if (CONST_STRNEQ (name, ".got"))
+	got = s->size != 0;
+      else if (strcmp (name, ".dynbss") != 0)
+	/* It's not one of our sections, so don't allocate space.  */
+	continue;
+
+      if (s->size == 0)
+	{
+	  /* If we don't need this section, strip it from the
+	     output file.  This is mostly to handle .rela.bss and
+	     .rela.plt.  We must create both sections in
+	     create_dynamic_sections, because they must be created
+	     before the linker maps input sections to output
+	     sections.  The linker does that before
+	     adjust_dynamic_symbol is called, and it is that
+	     function which decides whether anything needs to go
+	     into these sections.  */
+	  s->flags |= SEC_EXCLUDE;
+	  continue;
+	}
+
+      if ((s->flags & SEC_HAS_CONTENTS) == 0)
+	continue;
+
+      /* Allocate memory for the section contents.  */
+      /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
+	 Unused entries should be reclaimed before the section's contents
+	 are written out, but at the moment this does not happen.  Thus in
+	 order to prevent writing out garbage, we initialize the section's
+	 contents to zero.  */
+      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
+      if (s->contents == NULL)
+	return FALSE;
+    }
+
+  /* Adjust dynamic symbols that point to the plt to account for the
+     now-known number of resN slots.  */
+  if (htab->res_n_size)
+    elf_link_hash_traverse (& htab->root, adjust_dynrelocs, info);
+
+  if (elf_hash_table (info)->dynamic_sections_created)
+    {
+      /* Add some entries to the .dynamic section.  We fill in the
+	 values later, in elf_nios2_finish_dynamic_sections, but we
+	 must add the entries now so that we get the correct size for
+	 the .dynamic section.  The DT_DEBUG entry is filled in by the
+	 dynamic linker and used by the debugger.  */
+#define add_dynamic_entry(TAG, VAL) \
+  _bfd_elf_add_dynamic_entry (info, TAG, VAL)
+
+      if (!info->shared && !add_dynamic_entry (DT_DEBUG, 0))
+	return FALSE;
+
+      if (got && !add_dynamic_entry (DT_PLTGOT, 0))
+	return FALSE;
+
+      if (plt
+	  && (!add_dynamic_entry (DT_PLTRELSZ, 0)
+	      || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+	      || !add_dynamic_entry (DT_JMPREL, 0)))
+	return FALSE;
+
+      if (relocs
+	  && (!add_dynamic_entry (DT_RELA, 0)
+	      || !add_dynamic_entry (DT_RELASZ, 0)
+	      || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))))
+	return FALSE;
+
+      if (!info->shared && !add_dynamic_entry (DT_NIOS2_GP, 0))
+	return FALSE;
+
+      if ((info->flags & DF_TEXTREL) != 0
+	  && !add_dynamic_entry (DT_TEXTREL, 0))
+	return FALSE;
+    }
+#undef add_dynamic_entry
+
+  return TRUE;
+}
+
+/* Implement bfd_elf32_bfd_link_hash_table_create.  */
+static struct bfd_link_hash_table *
+nios2_elf32_link_hash_table_create (bfd *abfd)
+{
+  struct elf32_nios2_link_hash_table *ret;
+  bfd_size_type amt = sizeof (struct elf32_nios2_link_hash_table);
+
+  ret = bfd_zmalloc (amt);
+  if (ret == NULL)
+    return NULL;
+
+  if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+				      link_hash_newfunc,
+				      sizeof (struct
+					      elf32_nios2_link_hash_entry),
+				      NIOS2_ELF_DATA))
+    {
+      free (ret);
+      return NULL;
+    }
+
+  return &ret->root.root;
+}
+
+/* Implement elf_backend_reloc_type_class.  */
+static enum elf_reloc_type_class
+nios2_elf32_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			      const asection *rel_sec ATTRIBUTE_UNUSED,
+			      const Elf_Internal_Rela *rela)
+{
+  switch ((int) ELF32_R_TYPE (rela->r_info))
+    {
+    case R_NIOS2_RELATIVE:
+      return reloc_class_relative;
+    case R_NIOS2_JUMP_SLOT:
+      return reloc_class_plt;
+    case R_NIOS2_COPY:
+      return reloc_class_copy;
+    default:
+      return reloc_class_normal;
+    }
+}
+
+/* Return 1 if target is one of ours.  */
+static bfd_boolean
+is_nios2_elf_target (const struct bfd_target *targ)
+{
+  return (targ == &bfd_elf32_littlenios2_vec
+	  || targ == &bfd_elf32_bignios2_vec);
+}
+
+/* Implement elf_backend_add_symbol_hook.
+   This hook is called by the linker when adding symbols from an object
+   file.  We use it to put .comm items in .sbss, and not .bss.  */
+static bfd_boolean
+nios2_elf_add_symbol_hook (bfd *abfd,
+			   struct bfd_link_info *info,
+			   Elf_Internal_Sym *sym,
+			   const char **namep ATTRIBUTE_UNUSED,
+			   flagword *flagsp ATTRIBUTE_UNUSED,
+			   asection **secp,
+			   bfd_vma *valp)
+{
+  bfd *dynobj;
+
+  if (sym->st_shndx == SHN_COMMON
+      && !info->relocatable
+      && sym->st_size <= elf_gp_size (abfd)
+      && is_nios2_elf_target (info->output_bfd->xvec))
+    {
+      /* Common symbols less than or equal to -G nn bytes are automatically
+	 put into .sbss.  */
+      struct elf32_nios2_link_hash_table *htab;
+
+      htab = elf32_nios2_hash_table (info);
+      if (htab->sbss == NULL)
+	{
+	  flagword flags = SEC_IS_COMMON | SEC_LINKER_CREATED;
+
+	  dynobj = elf_hash_table (info)->dynobj;
+	  if (!dynobj)
+	    dynobj = abfd;
+
+	  htab->sbss = bfd_make_section_anyway_with_flags (dynobj, ".sbss",
+							   flags);
+	  if (htab->sbss == NULL)
+	    return FALSE;
+	}
+
+      *secp = htab->sbss;
+      *valp = sym->st_size;
+    }
+
+  return TRUE;
+}
+
+/* Implement elf_backend_can_make_relative_eh_frame:
+   Decide whether to attempt to turn absptr or lsda encodings in
+   shared libraries into pcrel within the given input section.  */
+static bfd_boolean
+nios2_elf32_can_make_relative_eh_frame (bfd *input_bfd ATTRIBUTE_UNUSED,
+					struct bfd_link_info *info
+					ATTRIBUTE_UNUSED,
+					asection *eh_frame_section
+					ATTRIBUTE_UNUSED)
+{
+  /* We can't use PC-relative encodings in the .eh_frame section.  */
+  return FALSE;
+}
+
+/* Implement elf_backend_special_sections.  */
+const struct bfd_elf_special_section elf32_nios2_special_sections[] =
+{
+  { STRING_COMMA_LEN (".sbss"),	 -2, SHT_NOBITS,
+    SHF_ALLOC + SHF_WRITE + SHF_NIOS2_GPREL },
+  { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS,
+    SHF_ALLOC + SHF_WRITE + SHF_NIOS2_GPREL },
+  { NULL,		      0,  0, 0,		     0 }
+};
+
+#define ELF_ARCH			bfd_arch_nios2
+#define ELF_TARGET_ID			NIOS2_ELF_DATA
+#define ELF_MACHINE_CODE		EM_ALTERA_NIOS2
+
+/* The Nios II MMU uses a 4K page size.  */
+
+#define ELF_MAXPAGESIZE			0x1000
+
+#define bfd_elf32_bfd_link_hash_table_create \
+					  nios2_elf32_link_hash_table_create
+
+/* Relocation table lookup macros.  */
+
+#define bfd_elf32_bfd_reloc_type_lookup	  nios2_elf32_bfd_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_name_lookup	  nios2_elf32_bfd_reloc_name_lookup
+
+/* JUMP_TABLE_LINK macros.  */
+
+/* elf_info_to_howto (using RELA relocations).  */
+
+#define elf_info_to_howto		  nios2_elf32_info_to_howto
+
+/* elf backend functions.  */
+
+#define elf_backend_can_gc_sections	1
+#define elf_backend_can_refcount	1
+#define elf_backend_plt_readonly	1
+#define elf_backend_want_got_plt	1
+#define elf_backend_rela_normal		1
+
+#define elf_backend_relocate_section	  nios2_elf32_relocate_section
+#define elf_backend_section_flags	  nios2_elf32_section_flags
+#define elf_backend_fake_sections	  nios2_elf32_fake_sections
+#define elf_backend_check_relocs	  nios2_elf32_check_relocs
+
+#define elf_backend_gc_mark_hook	  nios2_elf32_gc_mark_hook
+#define elf_backend_gc_sweep_hook	  nios2_elf32_gc_sweep_hook
+#define elf_backend_create_dynamic_sections \
+					  nios2_elf32_create_dynamic_sections
+#define elf_backend_finish_dynamic_symbol nios2_elf32_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections \
+					  nios2_elf32_finish_dynamic_sections
+#define elf_backend_adjust_dynamic_symbol nios2_elf32_adjust_dynamic_symbol
+#define elf_backend_reloc_type_class	  nios2_elf32_reloc_type_class
+#define elf_backend_size_dynamic_sections nios2_elf32_size_dynamic_sections
+#define elf_backend_add_symbol_hook	  nios2_elf_add_symbol_hook
+#define elf_backend_copy_indirect_symbol  nios2_elf32_copy_indirect_symbol
+
+#define elf_backend_grok_prstatus	  nios2_grok_prstatus
+#define elf_backend_grok_psinfo		  nios2_grok_psinfo
+
+#undef elf_backend_can_make_relative_eh_frame
+#define elf_backend_can_make_relative_eh_frame \
+					  nios2_elf32_can_make_relative_eh_frame
+
+#define elf_backend_special_sections	  elf32_nios2_special_sections
+
+#define TARGET_LITTLE_SYM		bfd_elf32_littlenios2_vec
+#define TARGET_LITTLE_NAME		"elf32-littlenios2"
+#define TARGET_BIG_SYM			bfd_elf32_bignios2_vec
+#define TARGET_BIG_NAME			"elf32-bignios2"
+
+#define elf_backend_got_header_size	12
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c
index 2b002ab..496d263 100644
--- a/bfd/elf32-openrisc.c
+++ b/bfd/elf32-openrisc.c
@@ -365,12 +365,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -486,6 +486,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 3d0a2d9..47c92ba 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -37,6 +37,7 @@
 #include "elf32-ppc.h"
 #include "elf-vxworks.h"
 #include "dwarf2.h"
+#include "elf-linux-psinfo.h"
 
 typedef enum split16_format_type
 {
@@ -1415,7 +1416,7 @@
 	 0,			/* src_mask */
 	 0xff,			/* dst_mask */
 	 TRUE),			/* pcrel_offset */
-	 
+
   /* A relative 15 bit branch.  */
   HOWTO (R_PPC_VLE_REL15,	/* type */
 	 1,			/* rightshift */
@@ -1431,7 +1432,7 @@
 	 0xfe,			/* dst_mask */
 	 TRUE),			/* pcrel_offset */
 
-  /* A relative 24 bit branch.  */ 
+  /* A relative 24 bit branch.  */
   HOWTO (R_PPC_VLE_REL24,	/* type */
 	 1,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -1451,14 +1452,14 @@
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
 	 32,			/* bitsize */
-	 FALSE,			/* pc_relative */  /* FIXME: Does this apply to split relocs? */
+	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
 	 bfd_elf_generic_reloc,	 /* special_function */
 	 "R_PPC_VLE_LO16A",	/* name */
 	 FALSE,			/* partial_inplace */
 	 0,			/* src_mask */
-	 0x1f00fff,		/* dst_mask */
+	 0x1f007ff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
   /* The 16 LSBS in split16d format.  */
@@ -1488,7 +1489,7 @@
 	 "R_PPC_VLE_HI16A",		/* name */
 	 FALSE,			/* partial_inplace */
 	 0,			/* src_mask */
-	 0x1f00fff,		/* dst_mask */
+	 0x1f007ff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
   /* Bits 16-31 split16d format.  */
@@ -1518,7 +1519,7 @@
 	 "R_PPC_VLE_HA16A",		/* name */
 	 FALSE,			/* partial_inplace */
 	 0,			/* src_mask */
-	 0x1f00fff,		/* dst_mask */
+	 0x1f007ff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
   /* Bits 16-31 (High Adjusted) in split16d format.  */
@@ -1578,7 +1579,7 @@
 	 "R_PPC_VLE_SDAREL_LO16A",	/* name */
 	 FALSE,			/* partial_inplace */
 	 0,			/* src_mask */
-	 0x1f00fff,		/* dst_mask */
+	 0x1f007ff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
   /* The 16 LSBS relative to _SDA_BASE_ in split16d format.  */
@@ -1609,7 +1610,7 @@
 	 "R_PPC_VLE_SDAREL_HI16A",	/* name */
 	 FALSE,			/* partial_inplace */
 	 0,			/* src_mask */
-	 0x1f00fff,		/* dst_mask */
+	 0x1f007ff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
   /* Bits 16-31 relative to _SDA_BASE_ in split16d format.  */
@@ -1639,7 +1640,7 @@
 	 "R_PPC_VLE_SDAREL_HA16A",	/* name */
 	 FALSE,			/* partial_inplace */
 	 0,			/* src_mask */
-	 0x1f00fff,		/* dst_mask */
+	 0x1f007ff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
   /* Bits 16-31 (HA) relative to _SDA_BASE split16d format.  */
@@ -1777,6 +1778,58 @@
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 };
+
+/* External 32-bit PPC structure for PRPSINFO.  This structure is
+   ABI-defined, thus we choose to use char arrays here in order to
+   avoid dealing with different types in different architectures.
+
+   The PPC 32-bit structure uses int for `pr_uid' and `pr_gid' while
+   most non-PPC architectures use `short int'.
+
+   This structure will ultimately be written in the corefile's note
+   section, as the PRPSINFO.  */
+
+struct elf_external_ppc_linux_prpsinfo32
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    char pr_flag[4];			/* Flags.  */
+    char pr_uid[4];
+    char pr_gid[4];
+    char pr_pid[4];
+    char pr_ppid[4];
+    char pr_pgrp[4];
+    char pr_sid[4];
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[80];			/* Initial part of arg list.  */
+  };
+
+/* Helper macro to swap (properly handling endianess) things from the
+   `elf_internal_prpsinfo' structure to the `elf_external_ppc_prpsinfo32'
+   structure.
+
+   Note that FROM should be a pointer, and TO should be the explicit type.  */
+
+#define PPC_LINUX_PRPSINFO32_SWAP_FIELDS(abfd, from, to)	      \
+  do								      \
+    {								      \
+      H_PUT_8 (abfd, from->pr_state, &to.pr_state);		      \
+      H_PUT_8 (abfd, from->pr_sname, &to.pr_sname);		      \
+      H_PUT_8 (abfd, from->pr_zomb, &to.pr_zomb);		      \
+      H_PUT_8 (abfd, from->pr_nice, &to.pr_nice);		      \
+      H_PUT_32 (abfd, from->pr_flag, to.pr_flag);		      \
+      H_PUT_32 (abfd, from->pr_uid, to.pr_uid);			      \
+      H_PUT_32 (abfd, from->pr_gid, to.pr_gid);			      \
+      H_PUT_32 (abfd, from->pr_pid, to.pr_pid);			      \
+      H_PUT_32 (abfd, from->pr_ppid, to.pr_ppid);		      \
+      H_PUT_32 (abfd, from->pr_pgrp, to.pr_pgrp);		      \
+      H_PUT_32 (abfd, from->pr_sid, to.pr_sid);			      \
+      strncpy (to.pr_fname, from->pr_fname, sizeof (to.pr_fname));    \
+      strncpy (to.pr_psargs, from->pr_psargs, sizeof (to.pr_psargs)); \
+    } while (0)
+
 
 /* Initialize the ppc_elf_howto_table, so that linear accesses can be done.  */
 
@@ -1815,7 +1868,9 @@
     case BFD_RELOC_NONE:		r = R_PPC_NONE;			break;
     case BFD_RELOC_32:			r = R_PPC_ADDR32;		break;
     case BFD_RELOC_PPC_BA26:		r = R_PPC_ADDR24;		break;
+    case BFD_RELOC_PPC64_ADDR16_DS:
     case BFD_RELOC_16:			r = R_PPC_ADDR16;		break;
+    case BFD_RELOC_PPC64_ADDR16_LO_DS:
     case BFD_RELOC_LO16:		r = R_PPC_ADDR16_LO;		break;
     case BFD_RELOC_HI16:		r = R_PPC_ADDR16_HI;		break;
     case BFD_RELOC_HI16_S:		r = R_PPC_ADDR16_HA;		break;
@@ -1826,7 +1881,9 @@
     case BFD_RELOC_PPC_B16:		r = R_PPC_REL14;		break;
     case BFD_RELOC_PPC_B16_BRTAKEN:	r = R_PPC_REL14_BRTAKEN;	break;
     case BFD_RELOC_PPC_B16_BRNTAKEN:	r = R_PPC_REL14_BRNTAKEN;	break;
+    case BFD_RELOC_PPC64_GOT16_DS:
     case BFD_RELOC_16_GOTOFF:		r = R_PPC_GOT16;		break;
+    case BFD_RELOC_PPC64_GOT16_LO_DS:
     case BFD_RELOC_LO16_GOTOFF:		r = R_PPC_GOT16_LO;		break;
     case BFD_RELOC_HI16_GOTOFF:		r = R_PPC_GOT16_HI;		break;
     case BFD_RELOC_HI16_S_GOTOFF:	r = R_PPC_GOT16_HA;		break;
@@ -1837,26 +1894,34 @@
     case BFD_RELOC_32_PCREL:		r = R_PPC_REL32;		break;
     case BFD_RELOC_32_PLTOFF:		r = R_PPC_PLT32;		break;
     case BFD_RELOC_32_PLT_PCREL:	r = R_PPC_PLTREL32;		break;
+    case BFD_RELOC_PPC64_PLT16_LO_DS:
     case BFD_RELOC_LO16_PLTOFF:		r = R_PPC_PLT16_LO;		break;
     case BFD_RELOC_HI16_PLTOFF:		r = R_PPC_PLT16_HI;		break;
     case BFD_RELOC_HI16_S_PLTOFF:	r = R_PPC_PLT16_HA;		break;
     case BFD_RELOC_GPREL16:		r = R_PPC_SDAREL16;		break;
+    case BFD_RELOC_PPC64_SECTOFF_DS:
     case BFD_RELOC_16_BASEREL:		r = R_PPC_SECTOFF;		break;
+    case BFD_RELOC_PPC64_SECTOFF_LO_DS:
     case BFD_RELOC_LO16_BASEREL:	r = R_PPC_SECTOFF_LO;		break;
     case BFD_RELOC_HI16_BASEREL:	r = R_PPC_SECTOFF_HI;		break;
     case BFD_RELOC_HI16_S_BASEREL:	r = R_PPC_SECTOFF_HA;		break;
     case BFD_RELOC_CTOR:		r = R_PPC_ADDR32;		break;
+    case BFD_RELOC_PPC64_TOC16_DS:
     case BFD_RELOC_PPC_TOC16:		r = R_PPC_TOC16;		break;
     case BFD_RELOC_PPC_TLS:		r = R_PPC_TLS;			break;
     case BFD_RELOC_PPC_TLSGD:		r = R_PPC_TLSGD;		break;
     case BFD_RELOC_PPC_TLSLD:		r = R_PPC_TLSLD;		break;
     case BFD_RELOC_PPC_DTPMOD:		r = R_PPC_DTPMOD32;		break;
+    case BFD_RELOC_PPC64_TPREL16_DS:
     case BFD_RELOC_PPC_TPREL16:		r = R_PPC_TPREL16;		break;
+    case BFD_RELOC_PPC64_TPREL16_LO_DS:
     case BFD_RELOC_PPC_TPREL16_LO:	r = R_PPC_TPREL16_LO;		break;
     case BFD_RELOC_PPC_TPREL16_HI:	r = R_PPC_TPREL16_HI;		break;
     case BFD_RELOC_PPC_TPREL16_HA:	r = R_PPC_TPREL16_HA;		break;
     case BFD_RELOC_PPC_TPREL:		r = R_PPC_TPREL32;		break;
+    case BFD_RELOC_PPC64_DTPREL16_DS:
     case BFD_RELOC_PPC_DTPREL16:	r = R_PPC_DTPREL16;		break;
+    case BFD_RELOC_PPC64_DTPREL16_LO_DS:
     case BFD_RELOC_PPC_DTPREL16_LO:	r = R_PPC_DTPREL16_LO;		break;
     case BFD_RELOC_PPC_DTPREL16_HI:	r = R_PPC_DTPREL16_HI;		break;
     case BFD_RELOC_PPC_DTPREL16_HA:	r = R_PPC_DTPREL16_HA;		break;
@@ -2151,10 +2216,10 @@
 
     case 268:		/* Linux/PPC.  */
       /* pr_cursig */
-      elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+      elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
       /* pr_pid */
-      elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+      elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
       /* pr_reg */
       offset = 72;
@@ -2177,11 +2242,11 @@
       return FALSE;
 
     case 128:		/* Linux/PPC elf_prpsinfo.  */
-      elf_tdata (abfd)->core_pid
+      elf_tdata (abfd)->core->pid
 	= bfd_get_32 (abfd, note->descdata + 16);
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
 	= _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
     }
 
@@ -2190,7 +2255,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -2200,6 +2265,19 @@
   return TRUE;
 }
 
+char *
+elfcore_write_ppc_linux_prpsinfo32 (bfd *abfd, char *buf, int *bufsiz,
+				      const struct elf_internal_linux_prpsinfo *prpsinfo)
+{
+  struct elf_external_ppc_linux_prpsinfo32 data;
+
+  memset (&data, 0, sizeof (data));
+  PPC_LINUX_PRPSINFO32_SWAP_FIELDS (abfd, prpsinfo, data);
+
+  return elfcore_write_note (abfd, buf, bufsiz,
+			     "CORE", NT_PRPSINFO, &data, sizeof (data));
+}
+
 static char *
 ppc_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, ...)
 {
@@ -2247,7 +2325,7 @@
 }
 
 static flagword
-ppc_elf_lookup_section_flags (char *flag_name) 
+ppc_elf_lookup_section_flags (char *flag_name)
 {
 
   if (!strcmp (flag_name, "SHF_PPC_VLE"))
@@ -2341,7 +2419,7 @@
   return ret;
 }
 
-/* Modify the segment map for VLE executables.  */ 
+/* Modify the segment map for VLE executables.  */
 
 bfd_boolean
 ppc_elf_modify_segment_map (bfd *abfd,
@@ -2358,7 +2436,7 @@
      If we find that case, we split the segment.
      We maintain the original output section order.  */
 
-  for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+  for (m = elf_seg_map (abfd); m != NULL; m = m->next)
     {
       if (m->count == 0)
 	continue;
@@ -3005,6 +3083,21 @@
    shared lib.  */
 #define ELIMINATE_COPY_RELOCS 1
 
+/* Used to track dynamic relocations for local symbols.  */
+struct ppc_dyn_relocs
+{
+  struct ppc_dyn_relocs *next;
+
+  /* The input section of the reloc.  */
+  asection *sec;
+
+  /* Total number of relocs copied for the input section.  */
+  unsigned int count : 31;
+
+  /* Whether this entry is for STT_GNU_IFUNC symbols.  */
+  unsigned int ifunc : 1;
+};
+
 /* PPC ELF linker hash entry.  */
 
 struct ppc_elf_link_hash_entry
@@ -3401,7 +3494,7 @@
   /* If we were called to copy over info for a weak sym, that's all.
      You might think dyn_relocs need not be copied over;  After all,
      both syms will be dynamic or both non-dynamic so we're just
-     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS 
+     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS
      code in ppc_elf_adjust_dynamic_symbol needs to check for
      dyn_relocs in read-only sections, and it does so on what is the
      DIR sym here.  */
@@ -3818,6 +3911,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       /* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got.
@@ -3843,13 +3940,11 @@
 	  if (isym == NULL)
 	    return FALSE;
 
-	  if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC
-	      && (!info->shared
-		  || is_branch_reloc (r_type)))
+	  if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
 	    {
 	      struct plt_entry **ifunc;
-	      bfd_vma addend;
 
+	      /* Set PLT_IFUNC flag for this sym, no GOT entry yet.  */
 	      ifunc = update_local_sym_info (abfd, symtab_hdr, r_symndx,
 					     PLT_IFUNC);
 	      if (ifunc == NULL)
@@ -3858,15 +3953,19 @@
 	      /* STT_GNU_IFUNC symbols must have a PLT entry;
 		 In a non-pie executable even when there are
 		 no plt calls.  */
-	      addend = 0;
-	      if (r_type == R_PPC_PLTREL24)
+	      if (!info->shared
+		  || is_branch_reloc (r_type))
 		{
-		  ppc_elf_tdata (abfd)->makes_plt_call = 1;
-		  if (info->shared)
-		    addend = rel->r_addend;
+		  bfd_vma addend = 0;
+		  if (r_type == R_PPC_PLTREL24)
+		    {
+		      ppc_elf_tdata (abfd)->makes_plt_call = 1;
+		      if (info->shared)
+			addend = rel->r_addend;
+		    }
+		  if (!update_plt_info (abfd, ifunc, got2, addend))
+		    return FALSE;
 		}
-	      if (!update_plt_info (abfd, ifunc, got2, addend))
-		return FALSE;
 	    }
 	}
 
@@ -4325,7 +4424,7 @@
 	  if ((info->shared
 	       && (must_be_dyn_reloc (info, r_type)
 		   || (h != NULL
-		       && (! info->symbolic
+		       && (!SYMBOLIC_BIND (info, h)
 			   || h->root.type == bfd_link_hash_defweak
 			   || !h->def_regular))))
 	      || (ELIMINATE_COPY_RELOCS
@@ -4334,9 +4433,6 @@
 		  && (h->root.type == bfd_link_hash_defweak
 		      || !h->def_regular)))
 	    {
-	      struct elf_dyn_relocs *p;
-	      struct elf_dyn_relocs **rel_head;
-
 #ifdef DEBUG
 	      fprintf (stderr,
 		       "ppc_elf_check_relocs needs to "
@@ -4360,13 +4456,34 @@
 		 relocations we need for this symbol.  */
 	      if (h != NULL)
 		{
+		  struct elf_dyn_relocs *p;
+		  struct elf_dyn_relocs **rel_head;
+
 		  rel_head = &ppc_elf_hash_entry (h)->dyn_relocs;
+		  p = *rel_head;
+		  if (p == NULL || p->sec != sec)
+		    {
+		      p = bfd_alloc (htab->elf.dynobj, sizeof *p);
+		      if (p == NULL)
+			return FALSE;
+		      p->next = *rel_head;
+		      *rel_head = p;
+		      p->sec = sec;
+		      p->count = 0;
+		      p->pc_count = 0;
+		    }
+		  p->count += 1;
+		  if (!must_be_dyn_reloc (info, r_type))
+		    p->pc_count += 1;
 		}
 	      else
 		{
 		  /* Track dynamic relocs needed for local syms too.
 		     We really need local syms available to do this
 		     easily.  Oh well.  */
+		  struct ppc_dyn_relocs *p;
+		  struct ppc_dyn_relocs **rel_head;
+		  bfd_boolean is_ifunc;
 		  asection *s;
 		  void *vpp;
 		  Elf_Internal_Sym *isym;
@@ -4381,25 +4498,24 @@
 		    s = sec;
 
 		  vpp = &elf_section_data (s)->local_dynrel;
-		  rel_head = (struct elf_dyn_relocs **) vpp;
+		  rel_head = (struct ppc_dyn_relocs **) vpp;
+		  is_ifunc = ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC;
+		  p = *rel_head;
+		  if (p != NULL && p->sec == sec && p->ifunc != is_ifunc)
+		    p = p->next;
+		  if (p == NULL || p->sec != sec || p->ifunc != is_ifunc)
+		    {
+		      p = bfd_alloc (htab->elf.dynobj, sizeof *p);
+		      if (p == NULL)
+			return FALSE;
+		      p->next = *rel_head;
+		      *rel_head = p;
+		      p->sec = sec;
+		      p->ifunc = is_ifunc;
+		      p->count = 0;
+		    }
+		  p->count += 1;
 		}
-
-	      p = *rel_head;
-	      if (p == NULL || p->sec != sec)
-		{
-		  p = bfd_alloc (htab->elf.dynobj, sizeof *p);
-		  if (p == NULL)
-		    return FALSE;
-		  p->next = *rel_head;
-		  *rel_head = p;
-		  p->sec = sec;
-		  p->count = 0;
-		  p->pc_count = 0;
-		}
-
-	      p->count += 1;
-	      if (!must_be_dyn_reloc (info, r_type))
-		p->pc_count += 1;
 	    }
 
 	  break;
@@ -5823,6 +5939,9 @@
 		  || eh->elf.root.type != bfd_link_hash_undefweak))
 	    {
 	      asection *rsec = htab->relgot;
+
+	      if (eh->elf.type == STT_GNU_IFUNC)
+		rsec = htab->reliplt;
 	      /* All the entries we allocated need relocs.
 		 Except LD only needs one.  */
 	      if ((eh->tls_mask & TLS_LD) != 0
@@ -5940,7 +6059,7 @@
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
       asection *sreloc = elf_section_data (p->sec)->sreloc;
-      if (!htab->elf.dynamic_sections_created)
+      if (eh->elf.type == STT_GNU_IFUNC)
 	sreloc = htab->reliplt;
       sreloc->size += p->count * sizeof (Elf32_External_Rela);
     }
@@ -6033,9 +6152,9 @@
 
       for (s = ibfd->sections; s != NULL; s = s->next)
 	{
-	  struct elf_dyn_relocs *p;
+	  struct ppc_dyn_relocs *p;
 
-	  for (p = ((struct elf_dyn_relocs *)
+	  for (p = ((struct ppc_dyn_relocs *)
 		    elf_section_data (s)->local_dynrel);
 	       p != NULL;
 	       p = p->next)
@@ -6058,7 +6177,7 @@
 	      else if (p->count != 0)
 		{
 		  asection *sreloc = elf_section_data (p->sec)->sreloc;
-		  if (!htab->elf.dynamic_sections_created)
+		  if (p->ifunc)
 		    sreloc = htab->reliplt;
 		  sreloc->size += p->count * sizeof (Elf32_External_Rela);
 		  if ((p->sec->output_section->flags
@@ -6103,8 +6222,12 @@
 	      {
 		*local_got = allocate_got (htab, need);
 		if (info->shared)
-		  htab->relgot->size += (need
-					 * (sizeof (Elf32_External_Rela) / 4));
+		  {
+		    asection *srel = htab->relgot;
+		    if ((*lgot_masks & PLT_IFUNC) != 0)
+		      srel = htab->reliplt;
+		    srel->size += need * (sizeof (Elf32_External_Rela) / 4);
+		  }
 	      }
 	  }
 	else
@@ -6365,7 +6488,7 @@
 	  if (!htab->no_tls_get_addr_opt
 	      && htab->tls_get_addr != NULL
 	      && htab->tls_get_addr->plt.plist != NULL
-	      && !add_dynamic_entry (DT_PPC_TLSOPT, 0))
+	      && !add_dynamic_entry (DT_PPC_OPT, PPC_OPT_TLS))
 	    return FALSE;
 	}
 
@@ -7243,6 +7366,21 @@
   return insn;
 }
 
+static bfd_boolean
+is_insn_ds_form (unsigned int insn)
+{
+  return ((insn & (0x3f << 26)) == 58u << 26 /* ld,ldu,lwa */
+	  || (insn & (0x3f << 26)) == 62u << 26 /* std,stdu,stq */
+	  || (insn & (0x3f << 26)) == 57u << 26 /* lfdp */
+	  || (insn & (0x3f << 26)) == 61u << 26 /* stfdp */);
+}
+
+static bfd_boolean
+is_insn_dq_form (unsigned int insn)
+{
+  return (insn & (0x3f << 26)) == 56u << 26; /* lq */
+}
+
 /* The RELOCATE_SECTION function is called by the ELF backend linker
    to handle the relocations for a section.
 
@@ -7288,7 +7426,7 @@
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
   Elf_Internal_Rela outrel;
-  asection *got2, *sreloc = NULL;
+  asection *got2;
   bfd_vma *local_got_offsets;
   bfd_boolean ret = TRUE;
   bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0);
@@ -7355,10 +7493,12 @@
 	}
       else
 	{
+	  bfd_boolean ignored;
+
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  sym_name = h->root.root.string;
 	}
@@ -7379,7 +7519,7 @@
 	{
 	  if (got2 != NULL
 	      && r_type == R_PPC_PLTREL24
-	      && rel->r_addend >= 32768)
+	      && rel->r_addend != 0)
 	    {
 	      /* R_PPC_PLTREL24 is rather special.  If non-zero, the
 		 addend specifies the GOT pointer offset within .got2.  */
@@ -7826,6 +7966,7 @@
 		  ;
 		else
 		  {
+		    BFD_ASSERT (h->dynindx != -1);
 		    indx = h->dynindx;
 		    unresolved_reloc = FALSE;
 		  }
@@ -7893,6 +8034,8 @@
 			asection *rsec = htab->relgot;
 			bfd_byte * loc;
 
+			if (ifunc != NULL)
+			  rsec = htab->reliplt;
 			outrel.r_offset = (htab->got->output_section->vma
 					   + htab->got->output_offset
 					   + off);
@@ -8139,7 +8282,8 @@
 		  && !h->def_regular))
 	    {
 	      int skip;
-	      bfd_byte * loc;
+	      bfd_byte *loc;
+	      asection *sreloc;
 #ifdef DEBUG
 	      fprintf (stderr, "ppc_elf_relocate_section needs to "
 		       "create relocation for %s\n",
@@ -8150,14 +8294,11 @@
 	      /* When generating a shared object, these relocations
 		 are copied into the output file to be resolved at run
 		 time.  */
+	      sreloc = elf_section_data (input_section)->sreloc;
+	      if (ifunc)
+		sreloc = htab->reliplt;
 	      if (sreloc == NULL)
-		{
-		  sreloc = elf_section_data (input_section)->sreloc;
-		  if (!htab->elf.dynamic_sections_created)
-		    sreloc = htab->reliplt;
-		  if (sreloc == NULL)
-		    return FALSE;
-		}
+		return FALSE;
 
 	      skip = 0;
 	      outrel.r_offset = _bfd_elf_section_offset (output_bfd, info,
@@ -8176,6 +8317,7 @@
 			    || h->root.type == bfd_link_hash_undefweak))
 		       || !SYMBOL_REFERENCES_LOCAL (info, h))
 		{
+		  BFD_ASSERT (h->dynindx != -1);
 		  unresolved_reloc = FALSE;
 		  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
 		  outrel.r_addend = rel->r_addend;
@@ -8382,33 +8524,37 @@
 	  break;
 
 	case R_PPC_PLTREL24:
-	  if (h == NULL || ifunc != NULL)
-	    break;
-	  /* Relocation is to the entry for this symbol in the
-	     procedure linkage table.  */
-	  {
-	    struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2,
-						  info->shared ? addend : 0);
-	    addend = 0;
-	    if (ent == NULL
-		|| htab->plt == NULL)
-	      {
-		/* We didn't make a PLT entry for this symbol.  This
-		   happens when statically linking PIC code, or when
-		   using -Bsymbolic.  */
-		break;
-	      }
+	  if (h != NULL && ifunc == NULL)
+	    {
+	      struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2,
+						    info->shared ? addend : 0);
+	      if (ent == NULL
+		  || htab->plt == NULL)
+		{
+		  /* We didn't make a PLT entry for this symbol.  This
+		     happens when statically linking PIC code, or when
+		     using -Bsymbolic.  */
+		}
+	      else
+		{
+		  /* Relocation is to the entry for this symbol in the
+		     procedure linkage table.  */
+		  unresolved_reloc = FALSE;
+		  if (htab->plt_type == PLT_NEW)
+		    relocation = (htab->glink->output_section->vma
+				  + htab->glink->output_offset
+				  + ent->glink_offset);
+		  else
+		    relocation = (htab->plt->output_section->vma
+				  + htab->plt->output_offset
+				  + ent->plt.offset);
+		}
+	    }
 
-	    unresolved_reloc = FALSE;
-	    if (htab->plt_type == PLT_NEW)
-	      relocation = (htab->glink->output_section->vma
-			    + htab->glink->output_offset
-			    + ent->glink_offset);
-	    else
-	      relocation = (htab->plt->output_section->vma
-			    + htab->plt->output_offset
-			    + ent->plt.offset);
-	  }
+	  /* R_PPC_PLTREL24 is rather special.  If non-zero, the
+	     addend specifies the GOT pointer offset within .got2.
+	     Don't apply it to the relocation field.  */
+	  addend = 0;
 	  break;
 
 	  /* Relocate against _SDA_BASE_.  */
@@ -8786,6 +8932,54 @@
 	     Bits 0:15 are not used.  */
 	  addend += 0x8000;
 	  break;
+
+	case R_PPC_ADDR16:
+	case R_PPC_ADDR16_LO:
+	case R_PPC_GOT16:
+	case R_PPC_GOT16_LO:
+	case R_PPC_SDAREL16:
+	case R_PPC_SECTOFF:
+	case R_PPC_SECTOFF_LO:
+	case R_PPC_DTPREL16:
+	case R_PPC_DTPREL16_LO:
+	case R_PPC_TPREL16:
+	case R_PPC_TPREL16_LO:
+	case R_PPC_GOT_TLSGD16:
+	case R_PPC_GOT_TLSGD16_LO:
+	case R_PPC_GOT_TLSLD16:
+	case R_PPC_GOT_TLSLD16_LO:
+	case R_PPC_GOT_DTPREL16:
+	case R_PPC_GOT_DTPREL16_LO:
+	case R_PPC_GOT_TPREL16:
+	case R_PPC_GOT_TPREL16_LO:
+	  {
+	    /* The 32-bit ABI lacks proper relocations to deal with
+	       certain 64-bit instructions.  Prevent damage to bits
+	       that make up part of the insn opcode.  */
+	    unsigned int insn, mask, lobit;
+
+	    insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
+	    mask = 0;
+	    if (is_insn_ds_form (insn))
+	      mask = 3;
+	    else if (is_insn_dq_form (insn))
+	      mask = 15;
+	    else
+	      break;
+	    lobit = mask & (relocation + addend);
+	    if (lobit != 0)
+	      {
+		addend -= lobit;
+		info->callbacks->einfo
+		  (_("%P: %H: error: %s against `%s' not a multiple of %u\n"),
+		   input_bfd, input_section, rel->r_offset,
+		   howto->name, sym_name, mask + 1);
+		bfd_set_error (bfd_error_bad_value);
+		ret = FALSE;
+	      }
+	    addend += insn & mask;
+	  }
+	  break;
 	}
 
 #ifdef DEBUG
@@ -8980,7 +9174,7 @@
 			    htab->plt->contents + ent->plt.offset + 28);
 
 		/* Fill in the GOT entry corresponding to this PLT slot with
-		   the address immediately after the the "bctr" instruction
+		   the address immediately after the "bctr" instruction
 		   in this PLT entry.  */
 		bfd_put_32 (output_bfd, (htab->plt->output_section->vma
 					 + htab->plt->output_offset
@@ -9204,14 +9398,19 @@
 }
 
 static enum elf_reloc_type_class
-ppc_elf_reloc_type_class (const Elf_Internal_Rela *rela)
+ppc_elf_reloc_type_class (const struct bfd_link_info *info,
+			  const asection *rel_sec,
+			  const Elf_Internal_Rela *rela)
 {
+  struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
+
+  if (rel_sec == htab->reliplt)
+    return reloc_class_ifunc;
+
   switch (ELF32_R_TYPE (rela->r_info))
     {
     case R_PPC_RELATIVE:
       return reloc_class_relative;
-    case R_PPC_REL24:
-    case R_PPC_ADDR24:
     case R_PPC_JMP_SLOT:
       return reloc_class_plt;
     case R_PPC_COPY:
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c
index f116839..5bdef67 100644
--- a/bfd/elf32-rl78.c
+++ b/bfd/elf32-rl78.c
@@ -1,6 +1,5 @@
 /* Renesas RL78 specific support for 32-bit ELF.
-   Copyright (C) 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 2011-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -461,12 +460,13 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes, h,
 				   sec, relocation, unresolved_reloc,
-				   warned);
+				   warned, ignored);
 
 	  name = h->root.root.string;
 	}
@@ -778,6 +778,8 @@
 			       + sec->output_section->vma
 			       + sec->output_offset
 			       + rel->r_addend);
+	      else if (h->root.type == bfd_link_hash_undefweak)
+		RL78_STACK_PUSH (0);
 	      else
 		_bfd_error_handler (_("Warning: RL78_SYM reloc with an unknown symbol"));
 	    }
@@ -808,10 +810,13 @@
 	  {
 	    int32_t tmp1, tmp2;
 
-	    RL78_STACK_POP (tmp2);
-	    RL78_STACK_POP (tmp1);
-	    tmp2 -= tmp1;
-	    RL78_STACK_PUSH (tmp2);
+	    /* For the expression "A - B", the assembler pushes A,
+	       then B, then OPSUB.  So the first op we pop is B, not
+	       A.  */
+	    RL78_STACK_POP (tmp2);	/* B */
+	    RL78_STACK_POP (tmp1);	/* A */
+	    tmp1 -= tmp2;		/* A - B */
+	    RL78_STACK_PUSH (tmp1);
 	  }
 	  break;
 
@@ -1016,9 +1021,11 @@
 rl78_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
 {
   flagword new_flags;
+  flagword old_flags;
   bfd_boolean error = FALSE;
 
   new_flags = elf_elfheader (ibfd)->e_flags;
+  old_flags = elf_elfheader (obfd)->e_flags;
 
   if (!elf_flags_init (obfd))
     {
@@ -1026,6 +1033,23 @@
       elf_flags_init (obfd) = TRUE;
       elf_elfheader (obfd)->e_flags = new_flags;
     }
+  else if (old_flags != new_flags)
+    {
+      flagword changed_flags = old_flags ^ new_flags;
+
+      if (changed_flags & E_FLAG_RL78_G10)
+	{
+	  (*_bfd_error_handler)
+	    (_("RL78/G10 ABI conflict: cannot link G10 and non-G10 objects together"));
+
+	  if (old_flags & E_FLAG_RL78_G10)
+	    (*_bfd_error_handler) (_("- %s is G10, %s is not"),
+				   bfd_get_filename (obfd), bfd_get_filename (ibfd));
+	  else
+	    (*_bfd_error_handler) (_("- %s is G10, %s is not"),
+				   bfd_get_filename (ibfd), bfd_get_filename (obfd));
+	}
+    }
 
   return !error;
 }
@@ -1044,6 +1068,9 @@
   flags = elf_elfheader (abfd)->e_flags;
   fprintf (file, _("private flags = 0x%lx:"), (long) flags);
 
+  if (flags & E_FLAG_RL78_G10)
+    fprintf (file, _(" [G10]"));
+
   fputc ('\n', file);
   return TRUE;
 }
@@ -1066,96 +1093,12 @@
 			     elf32_rl78_machine (abfd));
   return TRUE;
 }
- 
-#ifdef DEBUG
-void
-rl78_dump_symtab (bfd * abfd, void * internal_syms, void * external_syms)
-{
-  size_t locsymcount;
-  Elf_Internal_Sym * isymbuf;
-  Elf_Internal_Sym * isymend;
-  Elf_Internal_Sym * isym;
-  Elf_Internal_Shdr * symtab_hdr;
-  bfd_boolean free_internal = FALSE, free_external = FALSE;
-  char * st_info_str;
-  char * st_info_stb_str;
-  char * st_other_str;
-  char * st_shndx_str;
-
-  if (! internal_syms)
-    {
-      internal_syms = bfd_malloc (1000);
-      free_internal = 1;
-    }
-  if (! external_syms)
-    {
-      external_syms = bfd_malloc (1000);
-      free_external = 1;
-    }
-
-  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  locsymcount = symtab_hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
-  if (free_internal)
-    isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
-				    symtab_hdr->sh_info, 0,
-				    internal_syms, external_syms, NULL);
-  else
-    isymbuf = internal_syms;
-  isymend = isymbuf + locsymcount;
-
-  for (isym = isymbuf ; isym < isymend ; isym++)
-    {
-      switch (ELF_ST_TYPE (isym->st_info))
-	{
-	case STT_FUNC: st_info_str = "STT_FUNC";
-	case STT_SECTION: st_info_str = "STT_SECTION";
-	case STT_FILE: st_info_str = "STT_FILE";
-	case STT_OBJECT: st_info_str = "STT_OBJECT";
-	case STT_TLS: st_info_str = "STT_TLS";
-	default: st_info_str = "";
-	}
-      switch (ELF_ST_BIND (isym->st_info))
-	{
-	case STB_LOCAL: st_info_stb_str = "STB_LOCAL";
-	case STB_GLOBAL: st_info_stb_str = "STB_GLOBAL";
-	default: st_info_stb_str = "";
-	}
-      switch (ELF_ST_VISIBILITY (isym->st_other))
-	{
-	case STV_DEFAULT: st_other_str = "STV_DEFAULT";
-	case STV_INTERNAL: st_other_str = "STV_INTERNAL";
-	case STV_PROTECTED: st_other_str = "STV_PROTECTED";
-	default: st_other_str = "";
-	}
-      switch (isym->st_shndx)
-	{
-	case SHN_ABS: st_shndx_str = "SHN_ABS";
-	case SHN_COMMON: st_shndx_str = "SHN_COMMON";
-	case SHN_UNDEF: st_shndx_str = "SHN_UNDEF";
-	default: st_shndx_str = "";
-	}
-    }
-  if (free_internal)
-    free (internal_syms);
-  if (free_external)
-    free (external_syms);
-}
-
-char *
-rl78_get_reloc (long reloc)
-{
-  if (0 <= reloc && reloc < R_RL78_max)
-    return rl78_elf_howto_table[reloc].name;
-  return "";
-}
-#endif /* DEBUG */
-
 
 /* support PLT for 16-bit references to 24-bit functions.  */
 
 /* We support 16-bit pointers to code above 64k by generating a thunk
    below 64k containing a JMP instruction to the final address.  */
- 
+
 static bfd_boolean
 rl78_elf_check_relocs
     (bfd *                     abfd,
@@ -1173,7 +1116,7 @@
 
   if (info->relocatable)
     return TRUE;
- 
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
   local_plt_offsets = elf_local_got_offsets (abfd);
@@ -1186,7 +1129,7 @@
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
       bfd_vma *offset;
- 
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
@@ -1196,8 +1139,12 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
- 
+
       switch (ELF32_R_TYPE (rel->r_info))
         {
 	  /* This relocation describes a 16-bit pointer to a function.
@@ -1251,7 +1198,7 @@
 	  break;
         }
     }
- 
+
   return TRUE;
 }
 
@@ -1264,24 +1211,28 @@
   bfd *dynobj;
   asection *splt;
 
+  if (!elf_hash_table (info)->dynamic_sections_created)
+    return TRUE;
+
   /* As an extra sanity check, verify that all plt entries have been
      filled in.  However, relaxing might have changed the relocs so
      that some plt entries don't get filled in, so we have to skip
      this check if we're relaxing.  Unfortunately, check_relocs is
      called before relaxation.  */
 
-  if (info->relax_trip > 0)
+  if (info->relax_trip > 0) 
+    return TRUE;
+
+  if ((dynobj = elf_hash_table (info)->dynobj) != NULL
+      && (splt = bfd_get_linker_section (dynobj, ".plt")) != NULL)
     {
-      if ((dynobj = elf_hash_table (info)->dynobj) != NULL
-	  && (splt = bfd_get_linker_section (dynobj, ".plt")) != NULL)
+      bfd_byte *contents = splt->contents;
+      unsigned int i, size = splt->size;
+
+      for (i = 0; i < size; i += 4)
 	{
-	  bfd_byte *contents = splt->contents;
-	  unsigned int i, size = splt->size;
-	  for (i = 0; i < size; i += 4)
-	    {
-	      unsigned int x = bfd_get_32 (dynobj, contents + i);
-	      BFD_ASSERT (x != 0);
-	    }
+	  unsigned int x = bfd_get_32 (dynobj, contents + i);
+	  BFD_ASSERT (x != 0);
 	}
     }
 
@@ -1530,6 +1481,12 @@
     toaddr = alignment_rel->r_offset;
 
   irel = elf_section_data (sec)->relocs;
+  if (irel == NULL)
+    {
+      _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, TRUE);
+      irel = elf_section_data (sec)->relocs;
+    }
+
   irelend = irel + sec->reloc_count;
 
   /* Actually delete the bytes.  */
@@ -1545,7 +1502,7 @@
     memset (contents + toaddr - count, 0x03, count);
 
   /* Adjust all the relocs.  */
-  for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
+  for (; irel && irel < irelend; irel++)
     {
       /* Get the new reloc address.  */
       if (irel->r_offset > addr
@@ -1971,7 +1928,7 @@
   { 0x71, 0x58, 0x53, 0x5b },	/* CLR1	!addr16.0 */
   { 0x71, 0x68, 0x63, 0x6b },	/* CLR1	!addr16.0 */
   { 0x71, 0x78, 0x73, 0x7b },	/* CLR1	!addr16.0 */
-  
+
   { -1, -1, -1, -1 }
 };
 
@@ -2187,6 +2144,7 @@
 	+ srel->r_offset;
 
 #define GET_RELOC \
+      BFD_ASSERT (nrelocs > 0);			       \
       symval = OFFSET_FOR_RELOC (srel, &srel, &scale); \
       pcrel = symval - pc + srel->r_addend; \
       nrelocs --;
@@ -2227,7 +2185,13 @@
 
       if (irel->r_addend & RL78_RELAXA_BRA)
 	{
-	  GET_RELOC;
+	  /* SKIP opcodes that skip non-branches will have a relax tag
+	     but no corresponding symbol to relax against; we just
+	     skip those.  */
+	  if (irel->r_addend & RL78_RELAXA_RNUM)
+	    {
+	      GET_RELOC;
+	    }
 
 	  switch (insn[0])
 	    {
@@ -2296,6 +2260,9 @@
 	      /* For SKIP/BR, we change the BR opcode and delete the
 		 SKIP.  That way, we don't have to find and change the
 		 relocation for the BR.  */
+	      /* Note that, for the case where we're skipping some
+		 other insn, we have no "other" reloc but that's safe
+		 here anyway. */
 	      switch (insn[1])
 		{
 		case 0xc8: /* SKC */
@@ -2348,7 +2315,7 @@
 		}
 	      break;
 	    }
-	  
+
 	}
 
       if (irel->r_addend & RL78_RELAXA_ADDR16)
@@ -2414,7 +2381,7 @@
 		      insn[poff] = relax_addr16[idx].insn_for_saddr;
 		      SNIP (poff+2, 1, R_RL78_RH_SADDR);
 		    }
-		
+
 		}
 	    }
 	}
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index 771867f..a1f29eb 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -1,6 +1,5 @@
 /* Renesas RX specific support for 32-bit ELF.
-   Copyright (C) 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 2008-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -511,12 +510,12 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes, h,
 				   sec, relocation, unresolved_reloc,
-				   warned);
+				   warned, ignored);
 
 	  name = h->root.root.string;
 	}
@@ -1163,6 +1162,7 @@
 	  {
 	    int32_t tmp;
 
+	    saw_subtract = TRUE;
 	    RX_STACK_POP (tmp);
 	    tmp = - tmp;
 	    RX_STACK_PUSH (tmp);
@@ -1207,7 +1207,6 @@
 	  {
 	    int32_t tmp1, tmp2;
 
-	    saw_subtract = TRUE;
 	    RX_STACK_POP (tmp1);
 	    RX_STACK_POP (tmp2);
 	    tmp1 /= tmp2;
@@ -2937,6 +2936,39 @@
   ignore_lma = user_ignore_lma;
 }
 
+/* Converts FLAGS into a descriptive string.
+   Returns a static pointer.  */
+
+static const char *
+describe_flags (flagword flags)
+{
+  static char buf [128];
+
+  buf[0] = 0;
+
+  if (flags & E_FLAG_RX_64BIT_DOUBLES)
+    strcat (buf, "64-bit doubles");
+  else
+    strcat (buf, "32-bit doubles");
+
+  if (flags & E_FLAG_RX_DSP)
+    strcat (buf, ", dsp");
+  else
+    strcat (buf, ", no dsp");
+
+  if (flags & E_FLAG_RX_PID)
+    strcat (buf, ", pid");
+  else
+    strcat (buf, ", no pid");
+
+  if (flags & E_FLAG_RX_ABI)
+    strcat (buf, ", RX ABI");
+  else
+    strcat (buf, ", GCC ABI");
+
+  return buf;
+}
+
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
 
@@ -2958,7 +2990,10 @@
     }
   else if (old_flags != new_flags)
     {
-      flagword known_flags = E_FLAG_RX_64BIT_DOUBLES | E_FLAG_RX_DSP | E_FLAG_RX_PID;
+      flagword known_flags;
+
+      known_flags = E_FLAG_RX_ABI | E_FLAG_RX_64BIT_DOUBLES
+	| E_FLAG_RX_DSP | E_FLAG_RX_PID;
 
       if ((old_flags ^ new_flags) & known_flags)
 	{
@@ -2971,9 +3006,12 @@
 	    }
 	  else
 	    {
-	      (*_bfd_error_handler)
-		("ELF header flags mismatch: old_flags = 0x%.8lx, new_flags = 0x%.8lx, filename = %s",
-		 old_flags, new_flags, bfd_get_filename (ibfd));
+	      _bfd_error_handler ("There is a conflict merging the ELF header flags from %s",
+				  bfd_get_filename (ibfd));
+	      _bfd_error_handler ("  the input  file's flags: %s",
+				  describe_flags (new_flags));
+	      _bfd_error_handler ("  the output file's flags: %s",
+				  describe_flags (old_flags));
 	      error = TRUE;
 	    }
 	}
@@ -3001,21 +3039,20 @@
   flags = elf_elfheader (abfd)->e_flags;
   fprintf (file, _("private flags = 0x%lx:"), (long) flags);
 
-  if (flags & E_FLAG_RX_64BIT_DOUBLES)
-    fprintf (file, _(" [64-bit doubles]"));
-  if (flags & E_FLAG_RX_DSP)
-    fprintf (file, _(" [dsp]"));
-
-  fputc ('\n', file);
+  fprintf (file, "%s", describe_flags (flags));
   return TRUE;
 }
 
 /* Return the MACH for an e_flags value.  */
 
 static int
-elf32_rx_machine (bfd * abfd)
+elf32_rx_machine (bfd * abfd ATTRIBUTE_UNUSED)
 {
+#if 0 /* FIXME: EF_RX_CPU_MASK collides with E_FLAG_RX_...
+	 Need to sort out how these flag bits are used.
+         For now we assume that the flags are OK.  */
   if ((elf_elfheader (abfd)->e_flags & EF_RX_CPU_MASK) == EF_RX_CPU_RX)
+#endif
     return bfd_mach_rx;
 
   return 0;
@@ -3139,31 +3176,31 @@
     {
       switch (ELF_ST_TYPE (isym->st_info))
 	{
-	case STT_FUNC: st_info_str = "STT_FUNC";
-	case STT_SECTION: st_info_str = "STT_SECTION";
-	case STT_FILE: st_info_str = "STT_FILE";
-	case STT_OBJECT: st_info_str = "STT_OBJECT";
-	case STT_TLS: st_info_str = "STT_TLS";
+	case STT_FUNC: st_info_str = "STT_FUNC"; break;
+	case STT_SECTION: st_info_str = "STT_SECTION"; break;
+	case STT_FILE: st_info_str = "STT_FILE"; break;
+	case STT_OBJECT: st_info_str = "STT_OBJECT"; break;
+	case STT_TLS: st_info_str = "STT_TLS"; break;
 	default: st_info_str = "";
 	}
       switch (ELF_ST_BIND (isym->st_info))
 	{
-	case STB_LOCAL: st_info_stb_str = "STB_LOCAL";
-	case STB_GLOBAL: st_info_stb_str = "STB_GLOBAL";
+	case STB_LOCAL: st_info_stb_str = "STB_LOCAL"; break;
+	case STB_GLOBAL: st_info_stb_str = "STB_GLOBAL"; break;
 	default: st_info_stb_str = "";
 	}
       switch (ELF_ST_VISIBILITY (isym->st_other))
 	{
-	case STV_DEFAULT: st_other_str = "STV_DEFAULT";
-	case STV_INTERNAL: st_other_str = "STV_INTERNAL";
-	case STV_PROTECTED: st_other_str = "STV_PROTECTED";
+	case STV_DEFAULT: st_other_str = "STV_DEFAULT"; break;
+	case STV_INTERNAL: st_other_str = "STV_INTERNAL"; break;
+	case STV_PROTECTED: st_other_str = "STV_PROTECTED"; break;
 	default: st_other_str = "";
 	}
       switch (isym->st_shndx)
 	{
-	case SHN_ABS: st_shndx_str = "SHN_ABS";
-	case SHN_COMMON: st_shndx_str = "SHN_COMMON";
-	case SHN_UNDEF: st_shndx_str = "SHN_UNDEF";
+	case SHN_ABS: st_shndx_str = "SHN_ABS"; break;
+	case SHN_COMMON: st_shndx_str = "SHN_COMMON"; break;
+	case SHN_UNDEF: st_shndx_str = "SHN_UNDEF"; break;
 	default: st_shndx_str = "";
 	}
 
@@ -3472,7 +3509,7 @@
   bed = get_elf_backend_data (abfd);
   tdata = elf_tdata (abfd);
   phdr = tdata->phdr;
-  count = tdata->program_header_size / bed->s->sizeof_phdr;
+  count = elf_program_header_size (abfd) / bed->s->sizeof_phdr;
 
   if (ignore_lma)
     for (i = count; i-- != 0;)
@@ -3495,6 +3532,17 @@
 
   return TRUE;
 }
+
+/* The default literal sections should always be marked as "code" (i.e.,
+   SHF_EXECINSTR).  This is particularly important for big-endian mode
+   when we do not want their contents byte reversed.  */
+static const struct bfd_elf_special_section elf32_rx_special_sections[] =
+{
+  { STRING_COMMA_LEN (".init_array"),    0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_EXECINSTR },
+  { STRING_COMMA_LEN (".fini_array"),    0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_EXECINSTR },
+  { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_EXECINSTR },
+  { NULL,                        0,      0, 0,            0 }
+};
 
 #define ELF_ARCH		bfd_arch_rx
 #define ELF_MACHINE_CODE	EM_RX
@@ -3523,6 +3571,7 @@
 #define bfd_elf32_set_section_contents		rx_set_section_contents
 #define bfd_elf32_bfd_final_link		rx_final_link
 #define bfd_elf32_bfd_relax_section		elf32_rx_relax_section_wrapper
+#define elf_backend_special_sections	        elf32_rx_special_sections
 
 #include "elf32-target.h"
 
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 8d654d5..9827d46 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -40,7 +40,7 @@
 {
   HOWTO (R_390_NONE,		/* type */
 	 0,			/* rightshift */
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */
 	 0,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
@@ -161,6 +161,14 @@
 	s390_elf_ldisp_reloc, "R_390_TLS_GOTIE20", FALSE, 0,0x0fffff00, FALSE),
   HOWTO(R_390_IRELATIVE, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_390_IRELATIVE", FALSE, 0, 0xffffffff, FALSE),
+  HOWTO(R_390_PC12DBL,   1, 1, 12,  TRUE, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_390_PC12DBL",  FALSE, 0,0x00000fff, TRUE),
+  HOWTO(R_390_PLT12DBL,	 1, 1, 12,  TRUE, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_390_PLT12DBL", FALSE, 0,0x00000fff, TRUE),
+  HOWTO(R_390_PC24DBL,   1, 2, 24,  TRUE, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_390_PC24DBL",  FALSE, 0,0x00ffffff, TRUE),
+  HOWTO(R_390_PLT24DBL,	 1, 2, 24,  TRUE, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_390_PLT24DBL", FALSE, 0,0x00ffffff, TRUE),
 };
 
 /* GNU extension to record C++ vtable hierarchy.  */
@@ -211,10 +219,18 @@
       return &elf_howto_table[(int) R_390_GOT16];
     case BFD_RELOC_16_PCREL:
       return &elf_howto_table[(int) R_390_PC16];
+    case BFD_RELOC_390_PC12DBL:
+      return &elf_howto_table[(int) R_390_PC12DBL];
+    case BFD_RELOC_390_PLT12DBL:
+      return &elf_howto_table[(int) R_390_PLT12DBL];
     case BFD_RELOC_390_PC16DBL:
       return &elf_howto_table[(int) R_390_PC16DBL];
     case BFD_RELOC_390_PLT16DBL:
       return &elf_howto_table[(int) R_390_PLT16DBL];
+    case BFD_RELOC_390_PC24DBL:
+      return &elf_howto_table[(int) R_390_PC24DBL];
+    case BFD_RELOC_390_PLT24DBL:
+      return &elf_howto_table[(int) R_390_PLT24DBL];
     case BFD_RELOC_390_PC32DBL:
       return &elf_howto_table[(int) R_390_PC32DBL];
     case BFD_RELOC_390_PLT32DBL:
@@ -362,7 +378,7 @@
   reloc_howto_type *howto = reloc_entry->howto;
   bfd_vma relocation;
   bfd_vma insn;
-  
+
   if (output_bfd != (bfd *) NULL
       && (symbol->flags & BSF_SECTION_SYM) == 0
       && (! howto->partial_inplace
@@ -371,13 +387,13 @@
       reloc_entry->address += input_section->output_offset;
       return bfd_reloc_ok;
     }
-  
+
   if (output_bfd != NULL)
     return bfd_reloc_continue;
-  
+
   if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
     return bfd_reloc_outofrange;
-  
+
   relocation = (symbol->value
 		+ symbol->section->output_section->vma
 		+ symbol->section->output_offset);
@@ -388,11 +404,11 @@
 		     + input_section->output_offset);
       relocation -= reloc_entry->address;
     }
-  
+
   insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
   insn |= (relocation & 0xfff) << 16 | (relocation & 0xff000) >> 4;
   bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
-  
+
   if ((bfd_signed_vma) relocation < - 0x80000
       || (bfd_signed_vma) relocation > 0x7ffff)
     return bfd_reloc_overflow;
@@ -786,7 +802,7 @@
   struct elf_s390_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_s390_link_hash_table);
 
-  ret = (struct elf_s390_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf_s390_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -798,16 +814,6 @@
       return NULL;
     }
 
-  ret->elf.sgot = NULL;
-  ret->elf.sgotplt = NULL;
-  ret->elf.srelgot = NULL;
-  ret->elf.splt = NULL;
-  ret->elf.srelplt = NULL;
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->tls_ldm_got.refcount = 0;
-  ret->sym_cache.abfd = NULL;
-
   return &ret->elf.root;
 }
 
@@ -1013,6 +1019,9 @@
 	    {
 	      struct plt_entry *plt;
 
+	      if (htab->elf.dynobj == NULL)
+		htab->elf.dynobj = abfd;
+
 	      if (!s390_elf_create_ifunc_sections (htab->elf.dynobj, info))
 		return FALSE;
 
@@ -1033,6 +1042,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       /* Create got section and local_got_refcounts array if they
@@ -1110,7 +1123,9 @@
 	     are done.  */
 	  break;
 
+	case R_390_PLT12DBL:
 	case R_390_PLT16DBL:
+	case R_390_PLT24DBL:
 	case R_390_PLT32DBL:
 	case R_390_PLT32:
 	case R_390_PLTOFF16:
@@ -1245,7 +1260,9 @@
 	case R_390_16:
 	case R_390_32:
 	case R_390_PC16:
+	case R_390_PC12DBL:
 	case R_390_PC16DBL:
+	case R_390_PC24DBL:
 	case R_390_PC32DBL:
 	case R_390_PC32:
 	  if (h != NULL)
@@ -1290,7 +1307,9 @@
 	  if ((info->shared
 	       && (sec->flags & SEC_ALLOC) != 0
 	       && ((ELF32_R_TYPE (rel->r_info) != R_390_PC16
+		    && ELF32_R_TYPE (rel->r_info) != R_390_PC12DBL
 		    && ELF32_R_TYPE (rel->r_info) != R_390_PC16DBL
+		    && ELF32_R_TYPE (rel->r_info) != R_390_PC24DBL
 		    && ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL
 		    && ELF32_R_TYPE (rel->r_info) != R_390_PC32)
 		   || (h != NULL
@@ -1367,7 +1386,9 @@
 
 	      p->count += 1;
 	      if (ELF32_R_TYPE (rel->r_info) == R_390_PC16
+		  || ELF32_R_TYPE (rel->r_info) == R_390_PC12DBL
 		  || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL
+		  || ELF32_R_TYPE (rel->r_info) == R_390_PC24DBL
 		  || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL
 		  || ELF32_R_TYPE (rel->r_info) == R_390_PC32)
 		p->pc_count += 1;
@@ -1534,14 +1555,18 @@
 	case R_390_20:
 	case R_390_32:
 	case R_390_PC16:
+	case R_390_PC12DBL:
 	case R_390_PC16DBL:
+	case R_390_PC24DBL:
 	case R_390_PC32DBL:
 	case R_390_PC32:
 	  if (info->shared)
 	    break;
 	  /* Fall through.  */
 
+	case R_390_PLT12DBL:
 	case R_390_PLT16DBL:
+	case R_390_PLT24DBL:
 	case R_390_PLT32DBL:
 	case R_390_PLT32:
 	case R_390_PLTOFF16:
@@ -2349,6 +2374,10 @@
 
 	      switch (r_type)
 		{
+		case R_390_PLTOFF16:
+		case R_390_PLTOFF32:
+		  relocation -= htab->elf.sgot->output_section->vma;
+		  break;
 		case R_390_GOTPLT12:
 		case R_390_GOTPLT16:
 		case R_390_GOTPLT20:
@@ -2386,11 +2415,12 @@
       else
 	{
 	  bfd_boolean warned ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -2507,6 +2537,36 @@
 				  base_got->contents + off);
 		      h->got.offset |= 1;
 		    }
+
+		  if ((h->def_regular
+		       && info->shared
+		       && SYMBOL_REFERENCES_LOCAL (info, h))
+		      /* lrl rx,sym@GOTENT -> larl rx, sym */
+		      && ((r_type == R_390_GOTENT
+			   && (bfd_get_16 (input_bfd,
+					   contents + rel->r_offset - 2)
+			       & 0xff0f) == 0xc40d)
+			  /* ly rx, sym@GOT(r12) -> larl rx, sym */
+			  || (r_type == R_390_GOT20
+			      && (bfd_get_32 (input_bfd,
+					      contents + rel->r_offset - 2)
+				  & 0xff00f000) == 0xe300c000
+			      && bfd_get_8 (input_bfd,
+					    contents + rel->r_offset + 3) == 0x58)))
+		    {
+		      unsigned short new_insn =
+			(0xc000 | (bfd_get_8 (input_bfd,
+					      contents + rel->r_offset - 1) & 0xf0));
+		      bfd_put_16 (output_bfd, new_insn,
+				  contents + rel->r_offset - 2);
+		      r_type = R_390_PC32DBL;
+		      rel->r_addend = 2;
+		      howto = elf_howto_table + r_type;
+		      relocation = h->root.u.def.value
+			+ h->root.u.def.section->output_section->vma
+			+ h->root.u.def.section->output_offset;
+		      goto do_relocation;
+		    }
 		}
 	      else
 		unresolved_reloc = FALSE;
@@ -2587,7 +2647,9 @@
 	  unresolved_reloc = FALSE;
 	  break;
 
+	case R_390_PLT12DBL:
 	case R_390_PLT16DBL:
+	case R_390_PLT24DBL:
 	case R_390_PLT32DBL:
 	case R_390_PLT32:
 	  /* Relocation is to the entry for this symbol in the
@@ -2625,9 +2687,9 @@
 
 	  /* For local symbols or if we didn't make a PLT entry for
 	     this symbol resolve the symbol directly.  */
-	  if (   h == NULL
+	  if (h == NULL
 	      || h->plt.offset == (bfd_vma) -1
-	      || htab->elf.splt == NULL)
+	      || (htab->elf.splt == NULL && !s390_is_ifunc_symbol_p (h)))
 	    {
 	      relocation -= htab->elf.sgot->output_section->vma;
 	      break;
@@ -2650,7 +2712,9 @@
 	case R_390_16:
 	case R_390_32:
 	case R_390_PC16:
+	case R_390_PC12DBL:
 	case R_390_PC16DBL:
+	case R_390_PC24DBL:
 	case R_390_PC32DBL:
 	case R_390_PC32:
 	  if (h != NULL
@@ -2722,7 +2786,9 @@
 		   || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 		   || h->root.type != bfd_link_hash_undefweak)
 	       && ((r_type != R_390_PC16
+		    && r_type != R_390_PC12DBL
 		    && r_type != R_390_PC16DBL
+		    && r_type != R_390_PC24DBL
 		    && r_type != R_390_PC32DBL
 		    && r_type != R_390_PC32)
 		   || !SYMBOL_CALLS_LOCAL (info, h)))
@@ -2763,7 +2829,9 @@
 	      else if (h != NULL
 		       && h->dynindx != -1
 		       && (r_type == R_390_PC16
+			   || r_type == R_390_PC12DBL
 			   || r_type == R_390_PC16DBL
+			   || r_type == R_390_PC24DBL
 			   || r_type == R_390_PC32DBL
 			   || r_type == R_390_PC32
 			   || !info->shared
@@ -3241,6 +3309,13 @@
 
     do_relocation:
 
+      /* When applying a 24 bit reloc we need to start one byte
+	 earlier.  Otherwise the 32 bit get/put bfd operations might
+	 access a byte after the actual section.  */
+      if (r_type == R_390_PC24DBL
+	  || r_type == R_390_PLT24DBL)
+	rel->r_offset--;
+
       if (r_type == R_390_20
 	  || r_type == R_390_GOT20
 	  || r_type == R_390_GOTPLT20
@@ -3703,7 +3778,7 @@
     }
 
   /* Mark some specially defined symbols as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == htab->elf.hdynamic
       || h == htab->elf.hgot
       || h == htab->elf.hplt)
     sym->st_shndx = SHN_ABS;
@@ -3715,7 +3790,9 @@
    dynamic linker, before writing them out.  */
 
 static enum elf_reloc_type_class
-elf_s390_reloc_type_class (const Elf_Internal_Rela *rela)
+elf_s390_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			   const asection *rel_sec ATTRIBUTE_UNUSED,
+			   const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -3872,10 +3949,10 @@
 
       case 224:		/* S/390 Linux.  */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	/* pr_reg */
 	offset = 72;
@@ -3943,7 +4020,6 @@
 #define elf_backend_relocate_section	      elf_s390_relocate_section
 #define elf_backend_size_dynamic_sections     elf_s390_size_dynamic_sections
 #define elf_backend_init_index_section	      _bfd_elf_init_1_index_section
-#define elf_backend_reloc_type_class	      elf_s390_reloc_type_class
 #define elf_backend_grok_prstatus	      elf_s390_grok_prstatus
 #define elf_backend_plt_sym_val		      elf_s390_plt_sym_val
 #define elf_backend_add_symbol_hook           elf_s390_add_symbol_hook
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index 01a602b..47cc987 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -2837,6 +2837,10 @@
             {
               while (h->root.type == bfd_link_hash_indirect)
                 h = (struct elf_link_hash_entry *)h->root.u.i.link;
+
+	      /* PR15323, ref flags aren't set for references in the
+		 same object.  */
+	      h->root.non_ir_ref = 1;
             }
         }
 
@@ -3537,7 +3541,8 @@
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
   name = h->root.root.string;
-  if (strcmp (name, "_DYNAMIC") == 0 || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+  if (h == elf_hash_table (info)->hdynamic
+      || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
   else if (strcmp (name, "_DYNAMIC_LINK") == 0)
     {
@@ -3905,10 +3910,12 @@
 
     case 148:                  /* Linux/Score 32-bit.  */
       /* pr_cursig */
-      elf_tdata (abfd)->core_signal = score_bfd_get_16 (abfd, note->descdata + 12);
+      elf_tdata (abfd)->core->signal
+	= score_bfd_get_16 (abfd, note->descdata + 12);
 
       /* pr_pid */
-      elf_tdata (abfd)->core_lwpid = score_bfd_get_32 (abfd, note->descdata + 24);
+      elf_tdata (abfd)->core->lwpid
+	= score_bfd_get_32 (abfd, note->descdata + 24);
 
       /* pr_reg */
       offset = 72;
@@ -3918,7 +3925,8 @@
     }
 
   /* Make a ".reg/999" section.  */
-  return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size, note->descpos + offset);
+  return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size,
+					  note->descpos + offset);
 }
 
 static bfd_boolean
@@ -3930,8 +3938,10 @@
       return FALSE;
 
     case 124:                  /* Linux/Score elf_prpsinfo.  */
-      elf_tdata (abfd)->core_program = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-      elf_tdata (abfd)->core_command = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+      elf_tdata (abfd)->core->program
+	= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+      elf_tdata (abfd)->core->command
+	= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
     }
 
   /* Note that for some reason, a spurious space is tacked
@@ -3939,7 +3949,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -4356,7 +4366,7 @@
   struct elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_link_hash_table);
 
-  ret = (struct elf_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
diff --git a/bfd/elf32-score.h b/bfd/elf32-score.h
index 54bd092..f315603 100644
--- a/bfd/elf32-score.h
+++ b/bfd/elf32-score.h
@@ -30,10 +30,10 @@
                               struct elf_link_hash_entry *,
                               bfd_boolean);
 
-extern void 
+extern void
 s7_bfd_score_info_to_howto (bfd *, arelent *, Elf_Internal_Rela *);
 
-extern bfd_boolean 
+extern bfd_boolean
 s7_bfd_score_elf_relocate_section (bfd *,
                                    struct bfd_link_info *,
                                    bfd *,
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index 3615a1e..c75c703 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -2641,6 +2641,10 @@
             {
               while (h->root.type == bfd_link_hash_indirect)
                 h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	      /* PR15323, ref flags aren't set for references in the
+		 same object.  */
+	      h->root.non_ir_ref = 1;
             }
         }
 
@@ -3345,7 +3349,8 @@
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
   name = h->root.root.string;
-  if (strcmp (name, "_DYNAMIC") == 0 || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+  if (h == elf_hash_table (info)->hdynamic
+      || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
   else if (strcmp (name, "_DYNAMIC_LINK") == 0)
     {
@@ -3721,10 +3726,10 @@
     case 272:                  /* Linux/Score elf_prstatus */
 
       /* pr_cursig */
-      elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+      elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
       /* pr_pid */
-      elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+      elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
       /* pr_reg */
       offset = 72;
@@ -3736,7 +3741,8 @@
     }
 
   /* Make a ".reg/999" section.  */
-  return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size, note->descpos + offset);
+  return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size,
+					  note->descpos + offset);
 }
 
 bfd_boolean
@@ -3749,10 +3755,12 @@
 
     case 128:                  /* Linux/Score elf_prpsinfo.  */
       /* pr_fname */
-      elf_tdata (abfd)->core_program = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+      elf_tdata (abfd)->core->program
+	= _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
 
       /* pr_psargs */
-      elf_tdata (abfd)->core_command = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+      elf_tdata (abfd)->core->command
+	= _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
       break;
     }
 
@@ -3761,7 +3769,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
diff --git a/bfd/elf32-sh-symbian.c b/bfd/elf32-sh-symbian.c
index 0882d52..85c26f3 100644
--- a/bfd/elf32-sh-symbian.c
+++ b/bfd/elf32-sh-symbian.c
@@ -24,7 +24,7 @@
 /* Stop elf32-sh.c from defining any target vectors.  */
 #define SH_TARGET_ALREADY_DEFINED
 #define sh_find_elf_flags           sh_symbian_find_elf_flags
-#define sh_elf_get_flags_from_mach  sh_symbian_elf_get_flags_from_mach 
+#define sh_elf_get_flags_from_mach  sh_symbian_elf_get_flags_from_mach
 #include "elf32-sh.c"
 
 
@@ -129,7 +129,7 @@
 	bfd_set_error (bfd_error_invalid_operation);
 	_bfd_error_handler (_("%B: IMPORT AS directive for %s conceals previous IMPORT AS"),
 			    abfd, current_name);
-	return FALSE;	    
+	return FALSE;
       }
 
   if ((node = bfd_malloc (sizeof * node)) == NULL)
@@ -148,7 +148,7 @@
     }
   else
     strcpy (node->current_name, current_name);
-  
+
   if ((node->new_name = bfd_malloc (strlen (new_name) + 1)) == NULL)
     {
       if (SYMBIAN_DEBUG)
@@ -378,7 +378,7 @@
 	  if (SYMBIAN_DEBUG)
 	    fprintf (stderr, "offset into .directive section: %ld\n",
 		     (long) (directive - (char *) contents));
-	  
+
 	  bfd_set_error (bfd_error_invalid_operation);
 	  _bfd_error_handler (_("%B: Unrecognised .directive command: %s"),
 			      abfd, directive);
@@ -409,7 +409,7 @@
 
   if (!contents)
     bfd_set_error (bfd_error_no_memory);
-  else 
+  else
     {
       if (bfd_get_section_contents (abfd, sec, contents, 0, sz))
 	result = sh_symbian_process_embedded_commands (info, abfd, sec, contents);
@@ -444,9 +444,9 @@
       symbol_rename *                ptr;
       bfd_size_type                  num_global_syms;
       unsigned long		     num_local_syms;
-      
+
       BFD_ASSERT (! elf_bad_symtab (input_bfd));
- 
+
       symtab_hdr       = & elf_tdata (input_bfd)->symtab_hdr;
       hash_table       = elf_hash_table (info);
       num_local_syms   = symtab_hdr->sh_info;
@@ -469,52 +469,37 @@
 		fprintf (stderr, "IMPORT AS: current symbol '%s' does not exist\n", ptr->current_name);
 	      continue;
 	    }
-	  
-	  new_hash = elf_link_hash_lookup (hash_table, ptr->new_name, FALSE, FALSE, TRUE);
 
+	  new_hash = elf_link_hash_lookup (hash_table, ptr->new_name,
+					   FALSE, FALSE, TRUE);
 	  /* If we could not find the symbol then it is a new, undefined symbol.
 	     Symbian want this behaviour - ie they want to be able to rename the
 	     reference in a reloc from one undefined symbol to another, new and
 	     undefined symbol.  So we create that symbol here.  */
 	  if (new_hash == NULL)
 	    {
-	      asection *                     psec = bfd_und_section_ptr;
-	      Elf_Internal_Sym               new_sym;
-	      bfd_vma                        new_value = 0;
-	      bfd_boolean                    skip;
-	      bfd_boolean                    override;
-	      bfd_boolean                    type_change_ok;
-	      bfd_boolean                    size_change_ok;
-
-	      new_sym.st_value = 0;
-	      new_sym.st_size  = 0;
-	      new_sym.st_name  = -1;
-	      new_sym.st_info  = ELF_ST_INFO (STB_GLOBAL, STT_FUNC);
-	      new_sym.st_other = ELF_ST_VISIBILITY (STV_DEFAULT);
-	      new_sym.st_shndx = SHN_UNDEF;
-	      new_sym.st_target_internal = 0;
-
-	      if (! _bfd_elf_merge_symbol (input_bfd, info,
-					   ptr->new_name, & new_sym,
-					   & psec, & new_value, NULL,
-					   & new_hash, & skip,
-					   & override, & type_change_ok,
-					   & size_change_ok))
+	      struct bfd_link_hash_entry *bh = NULL;
+	      bfd_boolean collect = get_elf_backend_data (input_bfd)->collect;
+	      if (_bfd_generic_link_add_one_symbol (info, input_bfd,
+						    ptr->new_name, BSF_GLOBAL,
+						    bfd_und_section_ptr, 0,
+						    NULL, FALSE, collect,
+						    &bh))
 		{
-		  _bfd_error_handler (_("%B: Failed to add renamed symbol %s"),
-				      input_bfd, ptr->new_name);
-		  continue;
+		  new_hash = (struct elf_link_hash_entry *) bh;
+		  new_hash->type = STT_FUNC;
+		  new_hash->non_elf = 0;
+
+		  if (SYMBIAN_DEBUG)
+		    fprintf (stderr, "Created new symbol %s\n", ptr->new_name);
 		}
-	      /* XXX - should we check psec, skip, override etc ?  */
+	    }
 
-	      new_hash->root.type = bfd_link_hash_undefined;
-
-	      /* Allow the symbol to become local if necessary.  */
-	      if (new_hash->dynindx == -1)
-		new_hash->def_regular = 1;
-
-	      if (SYMBIAN_DEBUG)
-		fprintf (stderr, "Created new symbol %s\n", ptr->new_name);
+	  if (new_hash == NULL)
+	    {
+	      _bfd_error_handler (_("%B: Failed to add renamed symbol %s"),
+				  input_bfd, ptr->new_name);
+	      continue;
 	    }
 
 	  /* Convert the new_hash value into a index into the table of symbol hashes.  */
@@ -568,7 +553,7 @@
 	  int                          r_type;
 	  unsigned long                r_symndx;
 	  struct elf_link_hash_entry * h;
-      
+
 	  r_symndx = ELF32_R_SYM (rel->r_info);
 	  r_type = ELF32_R_TYPE (rel->r_info);
 
@@ -612,7 +597,7 @@
 	      }
 	}
     }
-  
+
   return sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 				  contents, relocs, local_syms, local_sections);
 }
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index cbd00aa..86fe1b3 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -1,6 +1,6 @@
 /* Renesas / SuperH SH specific support for 32-bit ELF
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010, 2011, 2012
+   2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    Free Software Foundation, Inc.
    Contributed by Ian Lance Taylor, Cygnus Support.
 
@@ -2549,7 +2549,7 @@
   struct elf_sh_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_sh_link_hash_table);
 
-  ret = (struct elf_sh_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf_sh_link_hash_table *) bfd_zmalloc (amt);
   if (ret == (struct elf_sh_link_hash_table *) NULL)
     return NULL;
 
@@ -2562,17 +2562,6 @@
       return NULL;
     }
 
-  ret->sgot = NULL;
-  ret->sgotplt = NULL;
-  ret->srelgot = NULL;
-  ret->splt = NULL;
-  ret->srelplt = NULL;
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->srelplt2 = NULL;
-  ret->sym_cache.abfd = NULL;
-  ret->tls_ldm_got.refcount = 0;
-  ret->plt_info = NULL;
   ret->vxworks_p = vxworks_object_p (abfd);
   ret->fdpic_p = fdpic_object_p (abfd);
 
@@ -3314,86 +3303,13 @@
 {
   sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, info->shared);
 
-  if (sh_elf_hash_table (info)->fdpic_p && !info->relocatable)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Force a PT_GNU_STACK segment to be created.  */
-      if (! elf_tdata (output_bfd)->stack_flags)
-	elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
-
-      /* Define __stacksize if it's not defined yet.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (! h || h->root.type != bfd_link_hash_defined
-	  || h->type != STT_OBJECT
-	  || !h->def_regular)
-	{
-	  struct bfd_link_hash_entry *bh = NULL;
-
-	  if (!(_bfd_generic_link_add_one_symbol
-		(info, output_bfd, "__stacksize",
-		 BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
-		 (const char *) NULL, FALSE,
-		 get_elf_backend_data (output_bfd)->collect, &bh)))
-	    return FALSE;
-
-	  h = (struct elf_link_hash_entry *) bh;
-	  h->def_regular = 1;
-	  h->type = STT_OBJECT;
-	}
-    }
+  if (sh_elf_hash_table (info)->fdpic_p && !info->relocatable
+      && !bfd_elf_stack_segment_size (output_bfd, info,
+				      "__stacksize", DEFAULT_STACK_SIZE))
+    return FALSE;
   return TRUE;
 }
 
-#if !defined INCLUDE_SHMEDIA && !defined SH_TARGET_ALREADY_DEFINED
-
-static bfd_boolean
-sh_elf_modify_program_headers (bfd *output_bfd, struct bfd_link_info *info)
-{
-  struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
-  struct elf_segment_map *m;
-  Elf_Internal_Phdr *p;
-
-  /* objcopy and strip preserve what's already there using
-     sh_elf_copy_private_bfd_data ().  */
-  if (! info)
-    return TRUE;
-
-  for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
-    if (m->p_type == PT_GNU_STACK)
-      break;
-
-  if (m)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Obtain the pointer to the __stacksize symbol.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (h)
-	{
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  BFD_ASSERT (h->root.type == bfd_link_hash_defined);
-	}
-
-      /* Set the header p_memsz from the symbol value.  We
-	 intentionally ignore the symbol section.  */
-      if (h && h->root.type == bfd_link_hash_defined)
-	p->p_memsz = h->root.u.def.value;
-      else
-	p->p_memsz = DEFAULT_STACK_SIZE;
-
-      p->p_align = 8;
-    }
-
-  return TRUE;
-}
-
-#endif
-
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -4306,7 +4222,7 @@
 	      ((*_bfd_error_handler)
 	       (_("%B: 0x%lx: fatal: unaligned %s relocation 0x%lx"),
 		input_section->owner,
-		(unsigned long) rel->r_offset, howto->name, 
+		(unsigned long) rel->r_offset, howto->name,
 		(unsigned long) relocation));
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
@@ -4321,7 +4237,7 @@
 	      ((*_bfd_error_handler)
 	       (_("%B: 0x%lx: fatal: unaligned %s relocation 0x%lx"),
 		input_section->owner,
-		(unsigned long) rel->r_offset, howto->name, 
+		(unsigned long) rel->r_offset, howto->name,
 		(unsigned long) relocation));
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
@@ -4509,6 +4425,12 @@
 
 	      check_segment[0] = check_segment[1] = -1;
 	    }
+	    /* We don't want warnings for non-NULL tests on undefined weak
+	       symbols.  */
+	    else if (r_type == R_SH_REL32
+		     && h
+		     && h->root.type == bfd_link_hash_undefweak) 
+	      check_segment[0] = check_segment[1] = -1;
 	  goto final_link_relocate;
 
 	case R_SH_GOTPLT32:
@@ -6006,9 +5928,9 @@
   eind->datalabel_got.refcount = 0;
 #endif
   edir->funcdesc.refcount += eind->funcdesc.refcount;
-  eind->funcdesc.refcount = 0;  
+  eind->funcdesc.refcount = 0;
   edir->abs_funcdesc_refcount += eind->abs_funcdesc_refcount;
-  eind->abs_funcdesc_refcount = 0;  
+  eind->abs_funcdesc_refcount = 0;
 
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
@@ -6109,6 +6031,10 @@
 #endif
 	      h = (struct elf_link_hash_entry *) h->root.u.i.link;
 	    }
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       r_type = sh_elf_optimized_tls_reloc (info, r_type, h == NULL);
@@ -6628,7 +6554,7 @@
 
   if (sh_ef_bfd_table[flags] == 0)
     return FALSE;
-  
+
   bfd_default_set_arch_mach (abfd, bfd_arch_sh, sh_ef_bfd_table[flags]);
 
   return TRUE;
@@ -6644,11 +6570,11 @@
 sh_elf_get_flags_from_mach (unsigned long mach)
 {
   int i = ARRAY_SIZE (sh_ef_bfd_table) - 1;
-  
+
   for (; i>0; i--)
     if (sh_ef_bfd_table[i] == mach)
       return i;
-  
+
   /* shouldn't get here */
   BFD_FAIL();
 
@@ -6683,38 +6609,6 @@
   if (! is_sh_elf (ibfd) || ! is_sh_elf (obfd))
     return TRUE;
 
-  /* Copy the stack size.  */
-  if (elf_tdata (ibfd)->phdr && elf_tdata (obfd)->phdr
-      && fdpic_object_p (ibfd) && fdpic_object_p (obfd))
-    {
-      unsigned i;
-
-      for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++)
-	if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK)
-	  {
-	    Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i];
-
-	    for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++)
-	      if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK)
-		{
-		  memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr));
-
-		  /* Rewrite the phdrs, since we're only called after they
-		     were first written.  */
-		  if (bfd_seek (obfd,
-				(bfd_signed_vma) get_elf_backend_data (obfd)
-				->s->sizeof_ehdr, SEEK_SET) != 0
-		      || get_elf_backend_data (obfd)->s
-		      ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr,
-					 elf_elfheader (obfd)->e_phnum) != 0)
-		    return FALSE;
-		  break;
-		}
-
-	    break;
-	  }
-    }
-
   return sh_elf_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags);
 }
 #endif /* not sh_elf_copy_private_data */
@@ -7157,7 +7051,7 @@
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  On VxWorks,
      _GLOBAL_OFFSET_TABLE_ is not absolute: it is relative to the
      ".got" section.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == htab->root.hdynamic
       || (!htab->vxworks_p && h == htab->root.hgot))
     sym->st_shndx = SHN_ABS;
 
@@ -7350,7 +7244,7 @@
 
   if (sgotplt && sgotplt->size > 0)
     elf_section_data (sgotplt->output_section)->this_hdr.sh_entsize = 4;
-    
+
   /* At the very end of the .rofixup section is a pointer to the GOT.  */
   if (htab->fdpic_p && htab->srofixup != NULL)
     {
@@ -7377,7 +7271,9 @@
 }
 
 static enum elf_reloc_type_class
-sh_elf_reloc_type_class (const Elf_Internal_Rela *rela)
+sh_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			 const asection *rel_sec ATTRIBUTE_UNUSED,
+			 const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -7408,10 +7304,10 @@
 
       case 168:		/* Linux/SH */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	/* pr_reg */
 	offset = 72;
@@ -7434,9 +7330,9 @@
 	return FALSE;
 
       case 124:		/* Linux/SH elf_prpsinfo */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
     }
 
@@ -7445,7 +7341,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -7456,7 +7352,7 @@
 }
 #endif /* not SH_TARGET_ALREADY_DEFINED */
 
- 
+
 /* Return address for Ith PLT stub in section PLT, for relocation REL
    or (bfd_vma) -1 if it should not be included.  */
 
@@ -7587,6 +7483,7 @@
 #define elf_backend_encode_eh_address \
 					sh_elf_encode_eh_address
 
+#define elf_backend_stack_align		8
 #define elf_backend_can_gc_sections	1
 #define elf_backend_can_refcount	1
 #define elf_backend_want_got_plt	1
@@ -7649,9 +7546,6 @@
 #define	TARGET_LITTLE_SYM		bfd_elf32_shfd_vec
 #undef	TARGET_LITTLE_NAME
 #define	TARGET_LITTLE_NAME		"elf32-sh-fdpic"
-#undef elf_backend_modify_program_headers
-#define elf_backend_modify_program_headers \
-					sh_elf_modify_program_headers
 
 #undef	elf32_bed
 #define	elf32_bed			elf32_sh_fd_bed
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index f722fcc..52abfd4 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -41,16 +41,16 @@
       return FALSE;
 
     case 260:			/* Solaris prpsinfo_t.  */
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
 	= _bfd_elfcore_strndup (abfd, note->descdata + 84, 16);
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, note->descdata + 100, 80);
       break;
 
     case 336:			/* Solaris psinfo_t.  */
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
 	= _bfd_elfcore_strndup (abfd, note->descdata + 88, 16);
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, note->descdata + 104, 80);
       break;
     }
@@ -153,7 +153,9 @@
 }
 
 static enum elf_reloc_type_class
-elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
+elf32_sparc_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			      const asection *rel_sec ATTRIBUTE_UNUSED,
+			      const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 28628f8..86fb33c 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -1,7 +1,6 @@
 /* SPU specific support for 32-bit ELF
 
-   Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 2006-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -440,7 +439,7 @@
 {
   struct spu_link_hash_table *htab;
 
-  htab = bfd_malloc (sizeof (*htab));
+  htab = bfd_zmalloc (sizeof (*htab));
   if (htab == NULL)
     return NULL;
 
@@ -453,9 +452,6 @@
       return NULL;
     }
 
-  memset (&htab->ovtab, 0,
-	  sizeof (*htab) - offsetof (struct spu_link_hash_table, ovtab));
-
   htab->elf.init_got_refcount.refcount = 0;
   htab->elf.init_got_refcount.glist = NULL;
   htab->elf.init_got_offset.offset = 0;
@@ -1146,7 +1142,7 @@
 }
 
 /* Support two sizes of overlay stubs, a slower more compact stub of two
-   intructions, and a faster stub of four instructions.
+   instructions, and a faster stub of four instructions.
    Soft-icache stubs are four or eight words.  */
 
 static unsigned int
@@ -1486,7 +1482,7 @@
     {
       return count_stub (htab, NULL, NULL, nonovl_stub, h, NULL);
     }
-  
+
   return TRUE;
 }
 
@@ -1512,7 +1508,7 @@
       return build_stub (info, NULL, NULL, nonovl_stub, h, NULL,
 			 h->root.u.def.value, sym_sec);
     }
-  
+
   return TRUE;
 }
 
@@ -2155,7 +2151,7 @@
 
   htab->local_store = hi + 1 - lo;
 
-  for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+  for (m = elf_seg_map (abfd); m != NULL; m = m->next)
     if (m->p_type == PT_LOAD)
       for (i = 0; i < m->count; i++)
 	if (m->sections[i]->size != 0
@@ -2949,7 +2945,7 @@
   sec_arr = bfd_zmalloc (bfd_idx * sizeof (*sec_arr));
   if (sec_arr == NULL)
     return FALSE;
-  
+
   for (ibfd = info->input_bfds, bfd_idx = 0;
        ibfd != NULL;
        ibfd = ibfd->link_next, bfd_idx++)
@@ -2982,7 +2978,7 @@
       if (symtab_hdr->contents != NULL)
 	{
 	  /* Don't use cached symbols since the generic ELF linker
-	     code only reads local symbols, and we need globals too.  */ 
+	     code only reads local symbols, and we need globals too.  */
 	  free (symtab_hdr->contents);
 	  symtab_hdr->contents = NULL;
 	}
@@ -4081,7 +4077,7 @@
 			   struct bfd_link_info *info)
 {
   unsigned int j;
-	  
+
   for (j = base; j < count && ovly_map[j] == ovlynum; j++)
     {
       asection *sec = ovly_sections[2 * j];
@@ -4178,7 +4174,7 @@
   /* Find the extents of our loadable image.  */
   lo = (unsigned int) -1;
   hi = 0;
-  for (m = elf_tdata (info->output_bfd)->segment_map; m != NULL; m = m->next)
+  for (m = elf_seg_map (info->output_bfd); m != NULL; m = m->next)
     if (m->p_type == PT_LOAD)
       for (i = 0; i < m->count; i++)
 	if (m->sections[i]->size != 0)
@@ -4909,8 +4905,8 @@
 	  && !(h->def_regular || ELF_COMMON_DEF_P (h)))
 	{
 	  bfd_byte *loc = contents + rel->r_offset;
-	  loc[0] = 0x1c; 
-	  loc[1] = 0x00; 
+	  loc[0] = 0x1c;
+	  loc[1] = 0x00;
 	  loc[2] &= 0x3f;
 	}
 
@@ -5201,7 +5197,7 @@
     return TRUE;
 
   toe = bfd_get_section_by_name (abfd, ".toe");
-  for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+  for (m = elf_seg_map (abfd); m != NULL; m = m->next)
     if (m->p_type == PT_LOAD && m->count > 1)
       for (i = 0; i < m->count; i++)
 	if ((s = m->sections[i]) == toe
@@ -5251,7 +5247,7 @@
      as PF_OVERLAY) will be placed into SPU local store on startup.  */
 
   /* Move all overlay segments onto a separate list.  */
-  p = &elf_tdata (abfd)->segment_map;
+  p = &elf_seg_map (abfd);
   p_overlay = &m_overlay;
   while (*p != NULL)
     {
@@ -5269,8 +5265,8 @@
     }
 
   /* Re-insert overlay segments at the head of the segment map.  */
-  *p_overlay = elf_tdata (abfd)->segment_map;
-  elf_tdata (abfd)->segment_map = m_overlay;
+  *p_overlay = elf_seg_map (abfd);
+  elf_seg_map (abfd) = m_overlay;
 
   return TRUE;
 }
@@ -5305,14 +5301,14 @@
   bed = get_elf_backend_data (abfd);
   tdata = elf_tdata (abfd);
   phdr = tdata->phdr;
-  count = tdata->program_header_size / bed->s->sizeof_phdr;
+  count = elf_program_header_size (abfd) / bed->s->sizeof_phdr;
   htab = spu_hash_table (info);
   if (htab->num_overlays != 0)
     {
       struct elf_segment_map *m;
       unsigned int o;
 
-      for (i = 0, m = elf_tdata (abfd)->segment_map; m; ++i, m = m->next)
+      for (i = 0, m = elf_seg_map (abfd); m; ++i, m = m->next)
 	if (m->count != 0
 	    && (o = spu_elf_section_data (m->sections[0])->u.o.ovl_index) != 0)
 	  {
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index dbe2c16..92726b2 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -1,6 +1,5 @@
 /* 32-bit ELF support for TI C6X
-   Copyright 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 2010-2013 Free Software Foundation, Inc.
    Contributed by Joseph Myers <joseph@codesourcery.com>
    		  Bernd Schmidt  <bernds@codesourcery.com>
 
@@ -1570,7 +1569,7 @@
   struct elf32_tic6x_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf32_tic6x_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -1583,7 +1582,6 @@
       return NULL;
     }
 
-  ret->sym_cache.abfd = NULL;
   ret->obfd = abfd;
   ret->elf.is_relocatable_executable = 1;
 
@@ -1615,14 +1613,6 @@
   return TRUE;
 }
 
-/* Destroy a C6X ELF linker hash table.  */
-
-static void
-elf32_tic6x_link_hash_table_free (struct bfd_link_hash_table *hash)
-{
-  _bfd_generic_link_hash_table_free (hash);
-}
-
 /* Called to pass PARAMS to the backend.  We store them in the hash table
    associated with INFO.  */
 
@@ -1787,7 +1777,7 @@
 	 Get the offset into the .got table of the entry that
 	 corresponds to this function.  Each .got entry is 4 bytes.
 	 The first three are reserved.
-	 
+
 	 For static executables, we don't reserve anything.  */
 
       plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
@@ -1903,7 +1893,7 @@
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == elf_hash_table (info)->hdynamic
       || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
 
@@ -2319,12 +2309,12 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -2841,6 +2831,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (r_type)
@@ -3043,7 +3037,7 @@
       *secp = bfd_make_section_old_way (abfd, ".scommon");
       (*secp)->flags |= SEC_IS_COMMON;
       *valp = sym->st_size;
-      bfd_set_section_alignment (abfd, *secp, bfd_log2 (sym->st_value));
+      (void) bfd_set_section_alignment (abfd, *secp, bfd_log2 (sym->st_value));
       break;
     }
 
@@ -3319,8 +3313,6 @@
     {
       bfd_signed_vma *local_got;
       bfd_signed_vma *end_local_got;
-      char *local_tls_type;
-      bfd_vma *local_tlsdesc_gotent;
       bfd_size_type locsymcount;
       Elf_Internal_Shdr *symtab_hdr;
       asection *srel;
@@ -3361,8 +3353,7 @@
       end_local_got = local_got + locsymcount;
       s = htab->elf.sgot;
       srel = htab->elf.srelgot;
-      for (; local_got < end_local_got;
-	   ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
+      for (; local_got < end_local_got; ++local_got)
 	{
 	  if (*local_got > 0)
 	    {
@@ -3520,79 +3511,10 @@
 static bfd_boolean
 elf32_tic6x_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
 {
-  if (elf32_tic6x_using_dsbt (output_bfd) && !info->relocatable)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Force a PT_GNU_STACK segment to be created.  */
-      if (! elf_tdata (output_bfd)->stack_flags)
-	elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
-
-      /* Define __stacksize if it's not defined yet.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (! h || h->root.type != bfd_link_hash_defined
-	  || h->type != STT_OBJECT
-	  || !h->def_regular)
-	{
-	  struct bfd_link_hash_entry *bh = NULL;
-
-	  if (!(_bfd_generic_link_add_one_symbol
-		(info, output_bfd, "__stacksize",
-		 BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE,
-		 (const char *) NULL, FALSE,
-		 get_elf_backend_data (output_bfd)->collect, &bh)))
-	    return FALSE;
-
-	  h = (struct elf_link_hash_entry *) bh;
-	  h->def_regular = 1;
-	  h->type = STT_OBJECT;
-	}
-    }
-  return TRUE;
-}
-
-static bfd_boolean
-elf32_tic6x_modify_program_headers (bfd *output_bfd,
-				    struct bfd_link_info *info)
-{
-  struct elf_obj_tdata *tdata = elf_tdata (output_bfd);
-  struct elf_segment_map *m;
-  Elf_Internal_Phdr *p;
-
-  /* objcopy and strip preserve what's already there using
-     elf32_tic6x_copy_private_bfd_data ().  */
-  if (! info)
-    return TRUE;
-
-  for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
-    if (m->p_type == PT_GNU_STACK)
-      break;
-
-  if (m)
-    {
-      struct elf_link_hash_entry *h;
-
-      /* Obtain the pointer to the __stacksize symbol.  */
-      h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize",
-				FALSE, FALSE, FALSE);
-      if (h)
-	{
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  BFD_ASSERT (h->root.type == bfd_link_hash_defined);
-	}
-
-      /* Set the header p_memsz from the symbol value.  We
-	 intentionally ignore the symbol section.  */
-      if (h && h->root.type == bfd_link_hash_defined)
-	p->p_memsz = h->root.u.def.value;
-      else
-	p->p_memsz = DEFAULT_STACK_SIZE;
-
-      p->p_align = 8;
-    }
+  if (elf32_tic6x_using_dsbt (output_bfd) && !info->relocatable
+      && !bfd_elf_stack_segment_size (output_bfd, info,
+				      "__stacksize", DEFAULT_STACK_SIZE))
+    return FALSE;
 
   return TRUE;
 }
@@ -4020,49 +3942,6 @@
   return TRUE;
 }
 
-static bfd_boolean
-elf32_tic6x_copy_private_data (bfd * ibfd, bfd * obfd)
-{
-  _bfd_elf_copy_private_bfd_data (ibfd, obfd);
-
-  if (! is_tic6x_elf (ibfd) || ! is_tic6x_elf (obfd))
-    return TRUE;
-
-  /* Copy the stack size.  */
-  if (elf_tdata (ibfd)->phdr && elf_tdata (obfd)->phdr
-      && elf32_tic6x_using_dsbt (ibfd) && elf32_tic6x_using_dsbt (obfd))
-    {
-      unsigned i;
-
-      for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++)
-	if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK)
-	  {
-	    Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i];
-
-	    for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++)
-	      if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK)
-		{
-		  memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr));
-
-		  /* Rewrite the phdrs, since we're only called after they
-		     were first written.  */
-		  if (bfd_seek (obfd,
-				(bfd_signed_vma) get_elf_backend_data (obfd)
-				->s->sizeof_ehdr, SEEK_SET) != 0
-		      || get_elf_backend_data (obfd)->s
-		      ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr,
-					 elf_elfheader (obfd)->e_phnum) != 0)
-		    return FALSE;
-		  break;
-		}
-
-	    break;
-	  }
-    }
-
-  return TRUE;
-}
-
 /* Add a new unwind edit to the list described by HEAD, TAIL.  If TINDEX is zero,
    adds the edit to the start of the list.  (The list must be built in order of
    ascending TINDEX: the function's callers are primarily responsible for
@@ -4077,11 +3956,11 @@
 {
   tic6x_unwind_table_edit *new_edit = (tic6x_unwind_table_edit *)
       xmalloc (sizeof (tic6x_unwind_table_edit));
-  
+
   new_edit->type = type;
   new_edit->linked_section = linked_section;
   new_edit->index = tindex;
-  
+
   if (tindex > 0)
     {
       new_edit->next = NULL;
@@ -4147,7 +4026,7 @@
 
 /* Scan .cx6abi.exidx tables, and create a list describing edits which
    should be made to those tables, such that:
-   
+
      1. Regions without unwind data are marked with EXIDX_CANTUNWIND entries.
      2. Duplicate entries are merged together (EXIDX_CANTUNWIND, or unwind
         codes which have been inlined into the index).
@@ -4175,15 +4054,15 @@
   for (inp = info->input_bfds; inp != NULL; inp = inp->link_next)
     {
       asection *sec;
-      
+
       for (sec = inp->sections; sec != NULL; sec = sec->next)
         {
 	  struct bfd_elf_section_data *elf_sec = elf_section_data (sec);
 	  Elf_Internal_Shdr *hdr = &elf_sec->this_hdr;
-	  
+
 	  if (!hdr || hdr->sh_type != SHT_C6000_UNWIND)
 	    continue;
-	  
+
 	  if (elf_sec->linked_to)
 	    {
 	      Elf_Internal_Shdr *linked_hdr
@@ -4246,13 +4125,13 @@
       hdr = &elf_section_data (exidx_sec)->this_hdr;
       if (hdr->sh_type != SHT_C6000_UNWIND)
         continue;
-      
+
       exidx_data = get_tic6x_elf_section_data (exidx_sec);
       if (exidx_data == NULL)
         continue;
-      
+
       ibfd = exidx_sec->owner;
-	  
+
       if (hdr->contents != NULL)
 	contents = hdr->contents;
       else if (! bfd_malloc_and_get_section (ibfd, exidx_sec, &contents))
@@ -4305,7 +4184,7 @@
       /* Record edits to be applied later (in elf32_tic6x_write_section).  */
       exidx_data->u.exidx.unwind_edit_list = unwind_edit_head;
       exidx_data->u.exidx.unwind_edit_tail = unwind_edit_tail;
-	  
+
       if (deleted_exidx_bytes > 0)
 	elf32_tic6x_adjust_exidx_size (exidx_sec, -deleted_exidx_bytes);
 
@@ -4343,12 +4222,12 @@
   /* High bit of first word is supposed to be zero.  */
   if ((first_word & 0x80000000ul) == 0)
     first_word = elf32_tic6x_add_low31 (first_word, offset);
-  
+
   /* If the high bit of the first word is clear, and the bit pattern is not 0x1
      (EXIDX_CANTUNWIND), this is an offset to an .c6xabi.extab entry.  */
   if ((second_word != 0x1) && ((second_word & 0x80000000ul) == 0))
     second_word = elf32_tic6x_add_low31 (second_word, offset);
-  
+
   bfd_put_32 (output_bfd, first_word, to);
   bfd_put_32 (output_bfd, second_word, to + 4);
 }
@@ -4394,7 +4273,7 @@
       if (edit_node)
 	{
 	  unsigned int edit_index = edit_node->index;
-	  
+
 	  if (in_index < edit_index && in_index * 8 < input_size)
 	    {
 	      elf32_tic6x_copy_exidx_entry (output_bfd,
@@ -4413,7 +4292,7 @@
 		  in_index++;
 		  add_to_offsets += 8;
 		  break;
-		
+
 		case INSERT_EXIDX_CANTUNWIND_AT_END:
 		  {
 		    asection *text_sec = edit_node->linked_section;
@@ -4443,7 +4322,7 @@
 		  }
 		  break;
 		}
-	      
+
 	      edit_node = edit_node->next;
 	    }
 	}
@@ -4484,12 +4363,11 @@
 #define ELF_MAXPAGESIZE		0x1000
 #define bfd_elf32_bfd_reloc_type_lookup elf32_tic6x_reloc_type_lookup
 #define bfd_elf32_bfd_reloc_name_lookup elf32_tic6x_reloc_name_lookup
-#define bfd_elf32_bfd_copy_private_bfd_data	elf32_tic6x_copy_private_data
 #define bfd_elf32_bfd_merge_private_bfd_data	elf32_tic6x_merge_private_bfd_data
 #define bfd_elf32_mkobject		elf32_tic6x_mkobject
 #define bfd_elf32_bfd_link_hash_table_create  elf32_tic6x_link_hash_table_create
-#define bfd_elf32_bfd_link_hash_table_free    elf32_tic6x_link_hash_table_free
 #define bfd_elf32_new_section_hook	elf32_tic6x_new_section_hook
+#define elf_backend_stack_align		8
 #define elf_backend_can_gc_sections	1
 #define elf_backend_default_use_rela_p	1
 #define elf_backend_may_use_rel_p	1
@@ -4509,8 +4387,6 @@
 #define elf_backend_fake_sections       elf32_tic6x_fake_sections
 #define elf_backend_gc_sweep_hook	elf32_tic6x_gc_sweep_hook
 #define elf_backend_gc_mark_extra_sections elf32_tic6x_gc_mark_extra_sections
-#define elf_backend_modify_program_headers \
-  elf32_tic6x_modify_program_headers
 #define elf_backend_create_dynamic_sections \
   elf32_tic6x_create_dynamic_sections
 #define elf_backend_adjust_dynamic_symbol \
diff --git a/bfd/elf32-tilegx.c b/bfd/elf32-tilegx.c
index 1b4884b..648fbf1 100644
--- a/bfd/elf32-tilegx.c
+++ b/bfd/elf32-tilegx.c
@@ -38,11 +38,11 @@
     return FALSE;
 
   /* pr_cursig */
-  elf_tdata (abfd)->core_signal =
+  elf_tdata (abfd)->core->signal =
     bfd_get_16 (abfd, note->descdata + TILEGX_PRSTATUS_OFFSET_PR_CURSIG);
 
   /* pr_pid */
-  elf_tdata (abfd)->core_pid =
+  elf_tdata (abfd)->core->pid =
     bfd_get_32 (abfd, note->descdata + TILEGX_PRSTATUS_OFFSET_PR_PID);
 
   /* pr_reg */
@@ -60,9 +60,9 @@
   if (note->descsz != TILEGX_PRPSINFO_SIZEOF)
     return FALSE;
 
-  elf_tdata (abfd)->core_program
+  elf_tdata (abfd)->core->program
     = _bfd_elfcore_strndup (abfd, note->descdata + TILEGX_PRPSINFO_OFFSET_PR_FNAME, 16);
-  elf_tdata (abfd)->core_command
+  elf_tdata (abfd)->core->command
     = _bfd_elfcore_strndup (abfd, note->descdata + TILEGX_PRPSINFO_OFFSET_PR_PSARGS, ELF_PR_PSARGS_SIZE);
 
 
@@ -70,7 +70,7 @@
      onto the end of the args in some (at least one anyway)
      implementations, so strip it off if it exists.  */
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
index fa883e1..0e808c4 100644
--- a/bfd/elf32-tilepro.c
+++ b/bfd/elf32-tilepro.c
@@ -737,6 +737,16 @@
    && elf_tdata (bfd) != NULL				\
    && elf_object_id (bfd) == TILEPRO_ELF_DATA)
 
+/* Allocate TILEPro ELF private object data.  */
+
+static bfd_boolean
+tilepro_elf_mkobject (bfd *abfd)
+{
+  return bfd_elf_allocate_object (abfd,
+				  sizeof (struct _bfd_tilepro_elf_obj_tdata),
+				  TILEPRO_ELF_DATA);
+}
+
 #include "elf/common.h"
 #include "elf/internal.h"
 
@@ -934,11 +944,11 @@
     return FALSE;
 
   /* pr_cursig */
-  elf_tdata (abfd)->core_signal =
+  elf_tdata (abfd)->core->signal =
     bfd_get_16 (abfd, note->descdata + TILEPRO_PRSTATUS_OFFSET_PR_CURSIG);
 
   /* pr_pid */
-  elf_tdata (abfd)->core_pid =
+  elf_tdata (abfd)->core->pid =
     bfd_get_32 (abfd, note->descdata + TILEPRO_PRSTATUS_OFFSET_PR_PID);
 
   /* pr_reg */
@@ -956,11 +966,11 @@
   if (note->descsz != TILEPRO_PRPSINFO_SIZEOF)
     return FALSE;
 
-  elf_tdata (abfd)->core_program
+  elf_tdata (abfd)->core->program
     = _bfd_elfcore_strndup (abfd,
 			    note->descdata + TILEPRO_PRPSINFO_OFFSET_PR_FNAME,
 			    16);
-  elf_tdata (abfd)->core_command
+  elf_tdata (abfd)->core->command
     = _bfd_elfcore_strndup (abfd,
 			    note->descdata + TILEPRO_PRPSINFO_OFFSET_PR_PSARGS,
 			    ELF_PR_PSARGS_SIZE);
@@ -970,7 +980,7 @@
      onto the end of the args in some (at least one anyway)
      implementations, so strip it off if it exists.  */
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -1105,7 +1115,7 @@
 tilepro_plt_entry_build (asection *splt, asection *sgotplt, bfd_vma offset,
 		      bfd_vma *r_offset)
 {
-  int plt_index = (offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE;
+  int plt_index = (offset - PLT_ENTRY_SIZE) / PLT_ENTRY_SIZE;
   int got_offset = plt_index * GOT_ENTRY_SIZE + GOTPLT_HEADER_SIZE;
   tilepro_bundle_bits *pc;
 
@@ -1511,6 +1521,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       r_type = tilepro_elf_tls_transition (info, r_type, h == NULL);
@@ -1858,11 +1872,33 @@
   if (h != NULL)
     {
       switch (ELF32_R_TYPE (rel->r_info))
-      {
-      case R_TILEPRO_GNU_VTINHERIT:
-      case R_TILEPRO_GNU_VTENTRY:
-	break;
-      }
+	{
+	case R_TILEPRO_GNU_VTINHERIT:
+	case R_TILEPRO_GNU_VTENTRY:
+	  return NULL;
+	}
+    }
+
+  /* FIXME: The test here, in check_relocs and in relocate_section
+     dealing with TLS optimization, ought to be !info->executable.  */
+  if (info->shared)
+    {
+      switch (ELF32_R_TYPE (rel->r_info))
+	{
+	case R_TILEPRO_TLS_GD_CALL:
+	  /* This reloc implicitly references __tls_get_addr.  We know
+	     another reloc will reference the same symbol as the one
+	     on this reloc, so the real symbol and section will be
+	     gc marked when processing the other reloc.  That lets
+	     us handle __tls_get_addr here.  */
+	  h = elf_link_hash_lookup (elf_hash_table (info), "__tls_get_addr",
+				    FALSE, FALSE, TRUE);
+	  BFD_ASSERT (h != NULL);
+	  h->mark = 1;
+	  if (h->u.weakdef != NULL)
+	    h->u.weakdef->mark = 1;
+	  sym = NULL;
+	}
     }
 
   return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
@@ -2193,7 +2229,7 @@
 	  /* Allocate room for the header.  */
 	  if (s->size == 0)
 	    {
-	      s->size = PLT_HEADER_SIZE;
+	      s->size = PLT_ENTRY_SIZE;
 	    }
 
           h->plt.offset = s->size;
@@ -2856,12 +2892,13 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  if (warned)
 	    {
 	      /* To avoid generating warning messages about truncated
@@ -3092,7 +3129,7 @@
 		  local_got_offsets[r_symndx] |= 1;
 		}
 	    }
-	  relocation = htab->elf.sgot->output_offset + off - got_base;
+	  relocation = off - got_base;
 	  break;
 
         case R_TILEPRO_JOFFLONG_X1_PLT:
@@ -3511,7 +3548,7 @@
 	  if (off >= (bfd_vma) -2)
 	    abort ();
 
-	  relocation = htab->elf.sgot->output_offset + off - got_base;
+	  relocation = off - got_base;
 	  unresolved_reloc = FALSE;
 	  howto = tilepro_elf_howto_table + r_type;
 	  break;
@@ -3787,7 +3824,7 @@
     }
 
   /* Mark some specially defined symbols as absolute. */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == htab->elf.hdynamic
       || (h == htab->elf.hgot || h == htab->elf.hplt))
     sym->st_shndx = SHN_ABS;
 
@@ -3867,10 +3904,15 @@
 
       /* Fill in the first entry in the procedure linkage table.  */
       if (splt->size > 0)
-        memcpy (splt->contents, tilepro_plt0_entry, PLT_HEADER_SIZE);
+	{
+	  memcpy (splt->contents, tilepro_plt0_entry, PLT_HEADER_SIZE);
+	  memset (splt->contents + PLT_HEADER_SIZE, 0,
+		  PLT_ENTRY_SIZE - PLT_HEADER_SIZE);
+	}
 
-      elf_section_data (splt->output_section)->this_hdr.sh_entsize
-	= PLT_ENTRY_SIZE;
+      if (elf_section_data (splt->output_section) != NULL)
+	elf_section_data (splt->output_section)->this_hdr.sh_entsize
+	  = PLT_ENTRY_SIZE;
     }
 
   if (htab->elf.sgotplt)
@@ -3924,11 +3966,13 @@
 tilepro_elf_plt_sym_val (bfd_vma i, const asection *plt,
                       const arelent *rel ATTRIBUTE_UNUSED)
 {
-  return plt->vma + PLT_HEADER_SIZE + i * PLT_ENTRY_SIZE;
+  return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
 }
 
 static enum elf_reloc_type_class
-tilepro_reloc_type_class (const Elf_Internal_Rela *rela)
+tilepro_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			  const asection *rel_sec ATTRIBUTE_UNUSED,
+			  const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -4004,6 +4048,8 @@
 #define elf_backend_grok_psinfo              tilepro_elf_grok_psinfo
 #define elf_backend_additional_program_headers tilepro_additional_program_headers
 
+#define bfd_elf32_mkobject		     tilepro_elf_mkobject
+
 #define elf_backend_init_index_section	_bfd_elf_init_1_index_section
 
 #define elf_backend_can_gc_sections 1
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 11fbbb4..6528dc1 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -1,7 +1,5 @@
 /* V850-specific support for 32-bit ELF
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 1996-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -55,7 +53,7 @@
   struct elf_link_hash_entry **sym_hashes;
   const Elf_Internal_Rela *rel;
   const Elf_Internal_Rela *rel_end;
-  enum v850_reloc_type r_type;
+  unsigned int r_type;
   int other = 0;
   const char *common = NULL;
 
@@ -85,34 +83,16 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
-      r_type = (enum v850_reloc_type) ELF32_R_TYPE (rel->r_info);
+      r_type = ELF32_R_TYPE (rel->r_info);
       switch (r_type)
 	{
 	default:
-	case R_V850_NONE:
-	case R_V850_9_PCREL:
-	case R_V850_16_PCREL:
-	case R_V850_17_PCREL:
-	case R_V850_22_PCREL:
-	case R_V850_32_PCREL:
-	case R_V850_32_ABS:
-	case R_V850_HI16:
-	case R_V850_HI16_S:
-	case R_V850_LO16:
-	case R_V850_LO16_S1:
-	case R_V850_LO16_SPLIT_OFFSET:
-	case R_V850_23:
-	case R_V850_ABS32:
-	case R_V850_REL32:
-	case R_V850_16:
-	case R_V850_16_S1:
-	case R_V850_16_SPLIT_OFFSET:
-	case R_V850_8:
-	case R_V850_CALLT_6_7_OFFSET:
-	case R_V850_CALLT_15_16_OFFSET:
-	case R_V850_CALLT_16_16_OFFSET:
 	  break;
 
         /* This relocation describes the C++ object vtable hierarchy.
@@ -134,6 +114,9 @@
 	case R_V850_SDA_16_16_SPLIT_OFFSET:
 	case R_V850_SDA_16_16_OFFSET:
 	case R_V850_SDA_15_16_OFFSET:
+	case R_V810_GPWLO_1:
+	case R_V850_HWLO:
+	case R_V850_HWLO_1:
 	  other = V850_OTHER_SDA;
 	  common = ".scommon";
 	  goto small_data_common;
@@ -510,13 +493,19 @@
   switch (r_type)
     {
     default:
+#ifdef DEBUG
+      fprintf (stderr, "reloc number %d not recognised\n", r_type);
+#endif
       return bfd_reloc_notsupported;
 
     case R_V850_REL32:
     case R_V850_ABS32:
+    case R_V810_WORD:
+    case R_V850_PC32:
       bfd_put_32 (abfd, addend, address);
       return bfd_reloc_ok;
 
+    case R_V850_WLO23:
     case R_V850_23:
       insn  = bfd_get_32 (abfd, address);
       insn &= ~((0x7f << 4) | (0x7fff80 << (16-7)));
@@ -524,6 +513,7 @@
       bfd_put_32 (abfd, (bfd_vma) insn, address);
       return bfd_reloc_ok;
 
+    case R_V850_PCR22:
     case R_V850_22_PCREL:
       if (saddend > 0x1fffff || saddend < -0x200000)
 	return bfd_reloc_overflow;
@@ -537,6 +527,7 @@
       bfd_put_32 (abfd, (bfd_vma) insn, address);
       return bfd_reloc_ok;
 
+    case R_V850_PC17:
     case R_V850_17_PCREL:
       if (saddend > 0xffff || saddend < -0x10000)
 	return bfd_reloc_overflow;
@@ -549,6 +540,7 @@
       insn |= ((addend & 0xfffe) << 16) | ((addend & 0x10000) >> (16-4));
       break;
 
+    case R_V850_PC16U:
     case R_V850_16_PCREL:
       if ((saddend < -0xffff) || (saddend > 0))
 	return bfd_reloc_overflow;
@@ -561,6 +553,7 @@
       insn |= (-addend & 0xfffe);
       break;
 
+    case R_V850_PC9:
     case R_V850_9_PCREL:
       if (saddend > 0xff || saddend < -0x100)
 	return bfd_reloc_overflow;
@@ -573,12 +566,14 @@
       insn |= ((addend & 0x1f0) << 7) | ((addend & 0x0e) << 3);
       break;
 
+    case R_V810_WHI:
     case R_V850_HI16:
       addend += (bfd_get_16 (abfd, address) << 16);
       addend = (addend >> 16);
       insn = addend;
       break;
 
+    case R_V810_WHI1:
     case R_V850_HI16_S:
       /* Remember where this relocation took place.  */
       remember_hi16s_reloc (abfd, addend, address);
@@ -593,12 +588,14 @@
       insn = addend;
       break;
 
+    case R_V810_WLO:
     case R_V850_LO16:
       insn = bfd_get_16 (abfd, address);
       if (! v850_elf_perform_lo16_relocation (abfd, &insn, addend))
 	return bfd_reloc_overflow;
       break;
 
+    case R_V810_BYTE:
     case R_V850_8:
       addend += (char) bfd_get_8 (abfd, address);
 
@@ -624,7 +621,7 @@
     case R_V850_CALLT_15_16_OFFSET:
       insn = bfd_get_16 (abfd, address);
 
-      addend += insn & 0xfffe;;
+      addend += insn & 0xfffe;
 
       saddend = (bfd_signed_vma) addend;
 
@@ -652,6 +649,7 @@
       break;
 
     case R_V850_16:
+    case R_V810_HWORD:
     case R_V850_SDA_16_16_OFFSET:
     case R_V850_ZDA_16_16_OFFSET:
     case R_V850_TDA_16_16_OFFSET:
@@ -668,6 +666,7 @@
     case R_V850_16_S1:
     case R_V850_SDA_15_16_OFFSET:
     case R_V850_ZDA_15_16_OFFSET:
+    case R_V810_GPWLO_1:
       insn = bfd_get_16 (abfd, address);
       addend += (insn & 0xfffe);
 
@@ -756,6 +755,9 @@
       insn |= addend;
       break;
 
+    case R_V810_WLO_1:
+    case R_V850_HWLO:
+    case R_V850_HWLO_1:
     case R_V850_LO16_S1:
       insn = bfd_get_16 (abfd, address);
       result = insn & 0xfffe;
@@ -768,6 +770,7 @@
 	bfd_put_16 (abfd, insn, address);
       return bfd_reloc_ok;
 
+    case R_V850_BLO:
     case R_V850_LO16_SPLIT_OFFSET:
       insn = bfd_get_32 (abfd, address);
       result = ((insn & 0xfffe0000) >> 16) | ((insn & 0x20) >> 5);
@@ -886,7 +889,7 @@
 }
 /* Note: It is REQUIRED that the 'type' value of each entry
    in this array match the index of the entry in the array.
-   SeeAlso: RELOC_NUBMER in include/elf/v850.h  */
+   SeeAlso: RELOC_NUBMER in include/elf/v850.h.  */
 static reloc_howto_type v850_elf_howto_table[] =
 {
   /* This reloc does nothing.  */
@@ -1742,6 +1745,109 @@
   { BFD_RELOC_V850_CODE,                   R_V850_CODE                   },
   { BFD_RELOC_V850_DATA,                   R_V850_DATA                   },
 };
+
+#define V800_RELOC(name,sz,bit,shift,complain,pcrel,resolver)		 \
+  HOWTO (name, shift, sz, bit, pcrel, 0, complain_overflow_ ## complain, \
+	 bfd_elf_ ## resolver ## _reloc, #name, FALSE, 0, ~0, FALSE)
+
+#define V800_EMPTY(name) EMPTY_HOWTO (name - R_V810_NONE)
+
+#define bfd_elf_v850_reloc v850_elf_reloc
+
+/* Note: It is REQUIRED that the 'type' value (R_V810_...) of each entry
+   in this array match the index of the entry in the array minus 0x30.
+   See: bfd_elf_v850_relocate_section(), v800_elf_reloc_type_lookup()
+   and v800_elf_info_to_howto().  */
+
+static reloc_howto_type v800_elf_howto_table[] =
+{
+  V800_RELOC (R_V810_NONE,      0,  0, 0, dont,     FALSE, generic),	/* Type = 0x30 */
+  V800_RELOC (R_V810_BYTE,      0,  8, 0, dont,     FALSE, generic),
+  V800_RELOC (R_V810_HWORD,     1, 16, 0, dont,     FALSE, generic),
+  V800_RELOC (R_V810_WORD,      2, 32, 0, dont,     FALSE, generic),
+  V800_RELOC (R_V810_WLO,       1, 16, 0, dont,     FALSE, generic),
+  V800_RELOC (R_V810_WHI,       1, 16, 0, dont,     FALSE, generic),
+  V800_RELOC (R_V810_WHI1,      1, 16, 0, dont,     FALSE, generic),
+  V800_RELOC (R_V810_GPBYTE,    0,  8, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_GPHWORD,   1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_GPWORD,    2, 32, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_GPWLO,     1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_GPWHI,     1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_GPWHI1,    1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_HWLO,      1, 16, 0, dont,     FALSE, generic),
+  V800_EMPTY (R_V810_reserved1),
+  V800_RELOC (R_V850_EP7BIT,    0,  7, 0, unsigned, FALSE, v850),
+  V800_RELOC (R_V850_EPHBYTE,   0,  8, 1, unsigned, FALSE, v850),
+  V800_RELOC (R_V850_EPWBYTE,   0,  8, 2, unsigned, FALSE, v850),
+  V800_RELOC (R_V850_REGHWLO,   1, 16, 0, dont,     FALSE, v850),
+  V800_EMPTY (R_V810_reserved2),
+  V800_RELOC (R_V850_GPHWLO,    1, 16, 0, dont,     FALSE, v850),
+  V800_EMPTY (R_V810_reserved3),
+  V800_RELOC (R_V850_PCR22,     2, 22, 0, signed,   TRUE,  generic),
+  V800_RELOC (R_V850_BLO,       2, 24, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_EP4BIT,    0,  4, 0, unsigned, FALSE, v850),
+  V800_RELOC (R_V850_EP5BIT,    0,  5, 0, unsigned, FALSE, v850),
+  V800_RELOC (R_V850_REGBLO,    2, 24, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_GPBLO,     2, 24, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_WLO_1,     1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_GPWLO_1,   1, 16, 0, signed,   FALSE, v850),
+  V800_RELOC (R_V850_BLO_1,     2, 16, 0, signed,   FALSE, v850),
+  V800_RELOC (R_V850_HWLO_1,    1, 16, 0, signed,   FALSE, v850),
+  V800_EMPTY  (R_V810_reserved4),
+  V800_RELOC (R_V850_GPBLO_1,   2, 16, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_GPHWLO_1,  1, 16, 1, signed,   FALSE, v850),
+  V800_EMPTY (R_V810_reserved5),
+  V800_RELOC (R_V850_EPBLO,     2, 16, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_EPHWLO,    1, 16, 1, signed,   FALSE, v850),
+  V800_EMPTY (R_V810_reserved6),
+  V800_RELOC (R_V850_EPWLO_N,   1, 16, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_PC32,      2, 32, 1, signed,   TRUE,  v850),
+  V800_RELOC (R_V850_W23BIT,    2, 23, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_GPW23BIT,  2, 23, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_EPW23BIT,  2, 23, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_B23BIT,    2, 23, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_GPB23BIT,  2, 23, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_EPB23BIT,  2, 23, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_PC16U,     1, 16, 1, unsigned, TRUE,  generic),
+  V800_RELOC (R_V850_PC17,      2, 17, 1, signed,   TRUE,  generic),
+  V800_RELOC (R_V850_DW8,       2,  8, 2, signed,   FALSE, v850),
+  V800_RELOC (R_V850_GPDW8,     2,  8, 2, signed,   FALSE, v850),
+  V800_RELOC (R_V850_EPDW8,     2,  8, 2, signed,   FALSE, v850),
+  V800_RELOC (R_V850_PC9,       1,  9, 3, signed,   TRUE,  v850),
+  V800_RELOC (R_V810_REGBYTE,   0,  8, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_REGHWORD,  1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_REGWORD,   2, 32, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_REGWLO,    1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_REGWHI,    1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_REGWHI1,   1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_REGW23BIT, 2, 23, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_REGB23BIT, 2, 23, 1, signed,   FALSE, v850),
+  V800_RELOC (R_V850_REGDW8,    2,  8, 2, signed,   FALSE, v850),
+  V800_RELOC (R_V810_EPBYTE,    0,  8, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_EPHWORD,   1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_EPWORD,    2, 32, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_WLO23,     2, 32, 1, dont,     FALSE, v850),
+  V800_RELOC (R_V850_WORD_E,    2, 32, 1, dont,     FALSE, v850),
+  V800_RELOC (R_V850_REGWORD_E, 2, 32, 1, dont,     FALSE, v850),
+  V800_RELOC (R_V850_WORD,      2, 32, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_GPWORD,    2, 32, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_REGWORD,   2, 32, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_EPWORD,    2, 32, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_TPBYTE,    0,  8, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_TPHWORD,   1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_TPWORD,    2, 32, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_TPWLO,     1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_TPWHI,     1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_TPWHI1,    1, 16, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V850_TPHWLO,    1, 16, 1, dont,     FALSE, v850),
+  V800_RELOC (R_V850_TPBLO,     2, 24, 0, dont,     FALSE, v850),
+  V800_RELOC (R_V810_TPWLO_1,   1, 16, 0, signed,   FALSE, v850),
+  V800_RELOC (R_V850_TPBLO_1,   2, 16, 0, signed,   FALSE, v850),
+  V800_RELOC (R_V850_TPHWLO_1,  1, 16, 0, signed,   FALSE, v850),
+  V800_RELOC (R_V850_TP23BIT,   2, 23, 0, signed,   FALSE, v850),
+  V800_RELOC (R_V850_TPW23BIT,  2, 23, 0, signed,   FALSE, v850),
+  V800_RELOC (R_V850_TPDW8,     2,  8, 0, signed,   FALSE, v850)
+};
 
 /* Map a bfd relocation into the appropriate howto structure.  */
 
@@ -1814,6 +1920,12 @@
   return (   (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
 	  || (name[0] == '_' &&  name[1] == '.' && name[2] == 'L' && name[3] == '_'));
 }
+
+static bfd_boolean
+v850_elf_is_target_special_symbol (bfd *abfd, asymbol *sym)
+{
+  return v850_elf_is_local_label_name (abfd, sym->name);
+}
 
 /* We overload some of the bfd_reloc error codes for own purposes.  */
 #define bfd_reloc_gp_not_found		bfd_reloc_other
@@ -1841,12 +1953,14 @@
   /* Adjust the value according to the relocation.  */
   switch (r_type)
     {
+    case R_V850_PC9:
     case R_V850_9_PCREL:
       value -= (input_section->output_section->vma
 		+ input_section->output_offset);
       value -= offset;
       break;
 
+    case R_V850_PC16U:
     case R_V850_16_PCREL:
       value -= (input_section->output_section->vma
 		+ input_section->output_offset
@@ -1858,6 +1972,7 @@
 
       break;
 
+    case R_V850_PC17:
     case R_V850_17_PCREL:
       value -= (input_section->output_section->vma
 		+ input_section->output_offset
@@ -1870,6 +1985,7 @@
       value = SEXT17 (value);
       break;
 
+    case R_V850_PCR22:
     case R_V850_22_PCREL:
       value -= (input_section->output_section->vma
 		+ input_section->output_offset
@@ -1883,6 +1999,7 @@
       value = SEXT22 (value);
       break;
 
+    case R_V850_PC32:
     case R_V850_32_PCREL:
       value -= (input_section->output_section->vma
 		+ input_section->output_offset
@@ -1899,6 +2016,15 @@
     case R_V850_16:
     case R_V850_ABS32:
     case R_V850_8:
+    case R_V810_BYTE:
+    case R_V810_HWORD:
+    case R_V810_WORD:
+    case R_V810_WLO:
+    case R_V810_WHI:
+    case R_V810_WHI1:
+    case R_V810_WLO_1:
+    case R_V850_WLO23:
+    case R_V850_BLO:
       break;
 
     case R_V850_ZDA_15_16_OFFSET:
@@ -1913,6 +2039,7 @@
     case R_V850_SDA_15_16_OFFSET:
     case R_V850_SDA_16_16_OFFSET:
     case R_V850_SDA_16_16_SPLIT_OFFSET:
+    case R_V810_GPWLO_1:
       {
 	unsigned long                gp;
 	struct bfd_link_hash_entry * h;
@@ -2002,6 +2129,7 @@
     break;
 
     case R_V850_NONE:
+    case R_V810_NONE:
     case R_V850_GNU_VTINHERIT:
     case R_V850_GNU_VTENTRY:
     case R_V850_LONGCALL:
@@ -2010,6 +2138,9 @@
       return bfd_reloc_ok;
 
     default:
+#ifdef DEBUG
+      fprintf (stderr, "reloc number %d not recognised\n", r_type);
+#endif
       return bfd_reloc_notsupported;
     }
 
@@ -2046,7 +2177,7 @@
   relend = relocs + input_section->reloc_count;
   for (; rel < relend; rel++)
     {
-      int r_type;
+      unsigned int r_type;
       reloc_howto_type *howto;
       unsigned long r_symndx;
       Elf_Internal_Sym *sym;
@@ -2062,7 +2193,13 @@
           || r_type == R_V850_GNU_VTINHERIT)
         continue;
 
-      howto = v850_elf_howto_table + r_type;
+      if (bfd_get_arch (input_bfd) == bfd_arch_v850_rh850)
+	howto = v800_elf_howto_table + (r_type - R_V810_NONE);
+      else
+	howto = v850_elf_howto_table + r_type;
+
+      BFD_ASSERT (r_type == howto->type);
+
       h = NULL;
       sym = NULL;
       sec = NULL;
@@ -2074,7 +2211,7 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  /* Note - this check is delayed until now as it is possible and
 	     valid to have a file without any symbols but with relocs that
@@ -2091,7 +2228,7 @@
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -2199,31 +2336,42 @@
   return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
 }
 
-/* Set the right machine number.  */
+/* Set the right machine number and architecture.  */
 
 static bfd_boolean
 v850_elf_object_p (bfd *abfd)
 {
-  switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH)
+  enum bfd_architecture arch;
+  unsigned long mach;
+
+  switch (elf_elfheader (abfd)->e_machine)
     {
+    case EM_V800:
+      arch = bfd_arch_v850_rh850;
+      mach = (elf_elfheader (abfd)->e_flags & EF_V800_850E3)
+	? bfd_mach_v850e3v5 : bfd_mach_v850e2v3;
+      break;
+
+    case EM_CYGNUS_V850:
+    case EM_V850:
+      arch = bfd_arch_v850;
+      switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH)
+	{
+	default:
+	case E_V850_ARCH:     mach = bfd_mach_v850; break;
+	case E_V850E_ARCH:    mach = bfd_mach_v850e; break;
+	case E_V850E1_ARCH:   mach = bfd_mach_v850e1; break;
+	case E_V850E2_ARCH:   mach = bfd_mach_v850e2; break;
+	case E_V850E2V3_ARCH: mach = bfd_mach_v850e2v3; break;
+	case E_V850E3V5_ARCH: mach = bfd_mach_v850e3v5; break;
+	}
+      break;
+
     default:
-    case E_V850_ARCH:
-      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850);
-      break;
-    case E_V850E_ARCH:
-      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e);
-      break;
-    case E_V850E1_ARCH:
-      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e1);
-      break;
-    case E_V850E2_ARCH:
-      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e2);
-      break;
-    case E_V850E2V3_ARCH:
-      bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e2v3);
-      break;
+      return FALSE;
     }
-  return TRUE;
+
+  return bfd_default_set_arch_mach (abfd, arch, mach);
 }
 
 /* Store the machine number in the flags field.  */
@@ -2234,18 +2382,32 @@
 {
   unsigned long val;
 
-  switch (bfd_get_mach (abfd))
+  switch (bfd_get_arch (abfd))
     {
-    default:
-    case bfd_mach_v850:   val = E_V850_ARCH; break;
-    case bfd_mach_v850e:  val = E_V850E_ARCH; break;
-    case bfd_mach_v850e1: val = E_V850E1_ARCH; break;
-    case bfd_mach_v850e2: val = E_V850E2_ARCH;  break;
-    case bfd_mach_v850e2v3: val = E_V850E2V3_ARCH;  break;
-    }
+    case bfd_arch_v850_rh850:
+      val = EF_RH850_ABI;
+      if (bfd_get_mach (abfd) == bfd_mach_v850e3v5)
+	val |= EF_V800_850E3;
+      elf_elfheader (abfd)->e_flags |= val;
+      break;
 
-  elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH;
-  elf_elfheader (abfd)->e_flags |= val;
+    case bfd_arch_v850:
+      switch (bfd_get_mach (abfd))
+	{
+	default:
+	case bfd_mach_v850:     val = E_V850_ARCH; break;
+	case bfd_mach_v850e:    val = E_V850E_ARCH; break;
+	case bfd_mach_v850e1:   val = E_V850E1_ARCH; break;
+	case bfd_mach_v850e2:   val = E_V850E2_ARCH; break;
+	case bfd_mach_v850e2v3: val = E_V850E2V3_ARCH; break;
+	case bfd_mach_v850e3v5: val = E_V850E3V5_ARCH; break;
+	}
+      elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH;
+      elf_elfheader (abfd)->e_flags |= val;
+      break;
+    default:
+      break;
+    }
 }
 
 /* Function to keep V850 specific file flags.  */
@@ -2302,17 +2464,36 @@
   if (in_flags == out_flags)
     return TRUE;
 
+  if (bfd_get_arch (obfd) == bfd_arch_v850_rh850)
+    {
+      if ((in_flags & EF_V800_850E3) != (out_flags & EF_V800_850E3))
+	{
+	  _bfd_error_handler (_("%B: Architecture mismatch with previous modules"),
+			      ibfd);
+	  elf_elfheader (obfd)->e_flags |= EF_V800_850E3;
+	}
+
+      if ((in_flags & EF_RH850_DATA_ALIGN8) != (out_flags & EF_RH850_DATA_ALIGN8))
+	{
+	  _bfd_error_handler (_("%B: Alignment mismatch with previous modules"),
+			      ibfd);
+	  elf_elfheader (obfd)->e_flags |= EF_RH850_DATA_ALIGN8;
+	}
+
+      return TRUE;
+    }
+
   if ((in_flags & EF_V850_ARCH) != (out_flags & EF_V850_ARCH)
       && (in_flags & EF_V850_ARCH) != E_V850_ARCH)
     {
-
-      /* Allow v850e1 binaries to be linked with v850e binaries.
-         Set the output binary to v850e.  */
-      if ((in_flags & EF_V850_ARCH) == E_V850E1_ARCH
+      /* Allow earlier architecture binaries to be linked with later binaries.
+         Set the output binary to the later architecture, except for v850e1,
+         which we set to v850e.  */
+      if (   (in_flags  & EF_V850_ARCH) == E_V850E1_ARCH
           && (out_flags & EF_V850_ARCH) == E_V850E_ARCH)
         return TRUE;
 
-      if ((in_flags & EF_V850_ARCH) == E_V850_ARCH
+      if (   (in_flags  & EF_V850_ARCH) == E_V850_ARCH
 	  && (out_flags & EF_V850_ARCH) == E_V850E_ARCH)
 	{
 	  elf_elfheader (obfd)->e_flags =
@@ -2320,7 +2501,7 @@
 	  return TRUE;
 	}
 
-      if (((in_flags & EF_V850_ARCH) == E_V850_ARCH
+      if ((   (in_flags & EF_V850_ARCH) == E_V850_ARCH
 	   || (in_flags & EF_V850_ARCH) == E_V850E_ARCH)
 	  && (out_flags & EF_V850_ARCH) == E_V850E2_ARCH)
 	{
@@ -2329,7 +2510,7 @@
 	  return TRUE;
 	}
 
-      if (((in_flags & EF_V850_ARCH) == E_V850_ARCH
+      if ((   (in_flags & EF_V850_ARCH) == E_V850_ARCH
 	   || (in_flags & EF_V850_ARCH) == E_V850E_ARCH
 	   || (in_flags & EF_V850_ARCH) == E_V850E2_ARCH)
 	  && (out_flags & EF_V850_ARCH) == E_V850E2V3_ARCH)
@@ -2339,6 +2520,17 @@
 	  return TRUE;
 	}
 
+      if ((   (in_flags & EF_V850_ARCH) == E_V850_ARCH
+	   || (in_flags & EF_V850_ARCH) == E_V850E_ARCH
+	   || (in_flags & EF_V850_ARCH) == E_V850E2_ARCH
+           || (in_flags & EF_V850_ARCH) == E_V850E2V3_ARCH)
+	  && (out_flags & EF_V850_ARCH) == E_V850E3V5_ARCH)
+	{
+	  elf_elfheader (obfd)->e_flags =
+	    ((out_flags & ~ EF_V850_ARCH) | E_V850E3V5_ARCH);
+	  return TRUE;
+	}
+
       _bfd_error_handler (_("%B: Architecture mismatch with previous modules"),
 			  ibfd);
     }
@@ -2360,14 +2552,30 @@
   /* xgettext:c-format.  */
   fprintf (file, _("private flags = %lx: "), elf_elfheader (abfd)->e_flags);
 
-  switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH)
+  if (bfd_get_arch (abfd) == bfd_arch_v850_rh850)
     {
-    default:
-    case E_V850_ARCH: fprintf (file, _("v850 architecture")); break;
-    case E_V850E_ARCH: fprintf (file, _("v850e architecture")); break;
-    case E_V850E1_ARCH: fprintf (file, _("v850e1 architecture")); break;
-    case E_V850E2_ARCH: fprintf (file, _("v850e2 architecture")); break;
-    case E_V850E2V3_ARCH: fprintf (file, _("v850e2v3 architecture")); break;
+      if ((elf_elfheader (abfd)->e_flags & EF_RH850_ABI) != EF_RH850_ABI)
+	fprintf (file, _("unknown v850 architecture"));
+      else if (elf_elfheader (abfd)->e_flags & EF_V800_850E3)
+	fprintf (file, _("v850 E3 architecture"));
+      else
+	fprintf (file, _("v850 architecture"));
+
+      if (elf_elfheader (abfd)->e_flags & EF_RH850_DATA_ALIGN8)
+	fprintf (file, _(", 8-byte data alignment"));
+    }
+  else
+    {
+      switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH)
+	{
+	default:
+	case E_V850_ARCH: fprintf (file, _("v850 architecture")); break;
+	case E_V850E_ARCH: fprintf (file, _("v850e architecture")); break;
+	case E_V850E1_ARCH: fprintf (file, _("v850e1 architecture")); break;
+	case E_V850E2_ARCH: fprintf (file, _("v850e2 architecture")); break;
+	case E_V850E2V3_ARCH: fprintf (file, _("v850e2v3 architecture")); break;
+	case E_V850E3V5_ARCH: fprintf (file, _("v850e3v5 architecture")); break;
+	}
     }
 
   fputc ('\n', file);
@@ -2933,7 +3141,7 @@
 
 	  if (alignmoveto < alignto)
 	    {
-	      unsigned int i;
+	      bfd_vma i;
 
 	      align_pad_size = alignto - alignmoveto;
 #ifdef DEBUG_RELAX
@@ -2965,6 +3173,7 @@
 	  Elf_Internal_Rela *lo_irelfn;
 	  Elf_Internal_Rela *irelcall;
 	  bfd_signed_vma foff;
+	  unsigned int r_type;
 
 	  if (! (irel->r_offset >= addr && irel->r_offset < toaddr
 		 && (ELF32_R_TYPE (irel->r_info) == (int) R_V850_LONGCALL
@@ -3060,23 +3269,33 @@
 	      /* Get the reloc for the address from which the register is
 	         being loaded.  This reloc will tell us which function is
 	         actually being called.  */
+
 	      for (hi_irelfn = internal_relocs; hi_irelfn < irelend; hi_irelfn ++)
-		if (hi_irelfn->r_offset == laddr + 2
-		    && ELF32_R_TYPE (hi_irelfn->r_info)
-		        == (int) R_V850_HI16_S)
-		  break;
+		{
+		  r_type = ELF32_R_TYPE (hi_irelfn->r_info);
+
+		  if (hi_irelfn->r_offset == laddr + 2
+		      && (r_type == (int) R_V850_HI16_S || r_type == (int) R_V810_WHI1))
+		    break;
+		}
 
 	      for (lo_irelfn = internal_relocs; lo_irelfn < irelend; lo_irelfn ++)
-		if (lo_irelfn->r_offset == laddr + 6
-		    && ELF32_R_TYPE (lo_irelfn->r_info)
-		        == (int) R_V850_LO16)
-		  break;
+		{
+		  r_type = ELF32_R_TYPE (lo_irelfn->r_info);
+
+		  if (lo_irelfn->r_offset == laddr + 6
+		      && (r_type == (int) R_V850_LO16 || r_type == (int) R_V810_WLO))
+		    break;
+		}
 
 	      for (irelcall = internal_relocs; irelcall < irelend; irelcall ++)
-		if (irelcall->r_offset == laddr + 8
-		    && ELF32_R_TYPE (irelcall->r_info)
-                        == (int) R_V850_22_PCREL)
-		  break;
+		{
+		  r_type = ELF32_R_TYPE (irelcall->r_info);
+
+		  if (irelcall->r_offset == laddr + 8
+		      && (r_type == (int) R_V850_22_PCREL || r_type == (int) R_V850_PCR22))
+		    break;
+		}
 
 	      if (   hi_irelfn == irelend
 		  || lo_irelfn == irelend
@@ -3202,7 +3421,10 @@
 	      symtab_hdr->contents = (bfd_byte *) isymbuf;
 
 	      /* Replace the long call with a jarl.  */
-	      irel->r_info = ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_22_PCREL);
+	      if (bfd_get_arch (abfd) == bfd_arch_v850_rh850)
+		irel->r_info = ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_PCR22);
+	      else
+		irel->r_info = ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_22_PCREL);
 
 	      addend = 0;
 
@@ -3278,14 +3500,22 @@
 	         being loaded.  This reloc will tell us which function is
 	         actually being called.  */
 	      for (hi_irelfn = internal_relocs; hi_irelfn < irelend; hi_irelfn ++)
-		if (hi_irelfn->r_offset == laddr + 2
-		    && ELF32_R_TYPE (hi_irelfn->r_info) == (int) R_V850_HI16_S)
-		  break;
+		{
+		  r_type = ELF32_R_TYPE (hi_irelfn->r_info);
+
+		  if (hi_irelfn->r_offset == laddr + 2
+		      && ((r_type == (int) R_V850_HI16_S) || r_type == (int) R_V810_WHI1))
+		    break;
+		}
 
 	      for (lo_irelfn = internal_relocs; lo_irelfn < irelend; lo_irelfn ++)
-		if (lo_irelfn->r_offset == laddr + 6
-		    && ELF32_R_TYPE (lo_irelfn->r_info) == (int) R_V850_LO16)
-		  break;
+		{
+		  r_type = ELF32_R_TYPE (lo_irelfn->r_info);
+
+		  if (lo_irelfn->r_offset == laddr + 6
+		      && (r_type == (int) R_V850_LO16 || r_type == (int) R_V810_WLO))
+		    break;
+		}
 
 	      if (   hi_irelfn == irelend
 		  || lo_irelfn == irelend)
@@ -3392,8 +3622,11 @@
 		{
 		  /* Replace the long jump with a jr.  */
 
-		  irel->r_info =
-		    ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_V850_22_PCREL);
+		  if (bfd_get_arch (abfd) == bfd_arch_v850_rh850)
+		    irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_V850_PCR22);
+		  else
+		    irel->r_info =
+		      ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_V850_22_PCREL);
 
 		  irel->r_addend = addend;
 		  addend = 0;
@@ -3425,8 +3658,11 @@
 		{
 		  /* Replace the long jump with a br.  */
 
-		  irel->r_info =
-			ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_V850_9_PCREL);
+		  if (bfd_get_arch (abfd) == bfd_arch_v850_rh850)
+		    irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_V850_PC9);
+		  else
+		    irel->r_info =
+		      ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_V850_9_PCREL);
 
 		  irel->r_addend = addend;
 		  addend = 0;
@@ -3539,7 +3775,6 @@
 #define ELF_ARCH				bfd_arch_v850
 #define ELF_MACHINE_CODE			EM_V850
 #define ELF_MACHINE_ALT1			EM_CYGNUS_V850
-#define ELF_MACHINE_ALT2			EM_V800 /* This is the value used by the GreenHills toolchain.  */
 #define ELF_MAXPAGESIZE				0x1000
 
 #define elf_info_to_howto			v850_elf_info_to_howto_rela
@@ -3562,8 +3797,10 @@
 #define elf_backend_rela_normal 1
 
 #define bfd_elf32_bfd_is_local_label_name	v850_elf_is_local_label_name
+#define bfd_elf32_bfd_is_target_special_symbol	v850_elf_is_target_special_symbol
+
 #define bfd_elf32_bfd_reloc_type_lookup		v850_elf_reloc_type_lookup
-#define bfd_elf32_bfd_reloc_name_lookup	v850_elf_reloc_name_lookup
+#define bfd_elf32_bfd_reloc_name_lookup	        v850_elf_reloc_name_lookup
 #define bfd_elf32_bfd_merge_private_bfd_data 	v850_elf_merge_private_bfd_data
 #define bfd_elf32_bfd_set_private_flags		v850_elf_set_private_flags
 #define bfd_elf32_bfd_print_private_bfd_data	v850_elf_print_private_bfd_data
@@ -3571,4 +3808,122 @@
 
 #define elf_symbol_leading_char			'_'
 
+#undef  elf32_bed
+#define elf32_bed elf32_v850_bed
+
+#include "elf32-target.h"
+
+/* Map BFD reloc types to V800 ELF reloc types.  */
+
+static const struct v850_elf_reloc_map v800_elf_reloc_map[] =
+{
+  { BFD_RELOC_NONE,                   R_V810_NONE    },
+  { BFD_RELOC_8,                      R_V810_BYTE    },
+  { BFD_RELOC_16,                     R_V810_HWORD   },
+  { BFD_RELOC_32,                     R_V810_WORD    },
+  { BFD_RELOC_LO16,                   R_V810_WLO     },
+  { BFD_RELOC_HI16,                   R_V810_WHI     },
+  { BFD_RELOC_HI16_S,                 R_V810_WHI1    },
+  { BFD_RELOC_V850_32_PCREL,          R_V850_PC32    },
+  { BFD_RELOC_V850_22_PCREL,          R_V850_PCR22   },
+  { BFD_RELOC_V850_17_PCREL,          R_V850_PC17    },
+  { BFD_RELOC_V850_16_PCREL,          R_V850_PC16U   },
+  { BFD_RELOC_V850_9_PCREL,	      R_V850_PC9     },
+  { BFD_RELOC_V850_LO16_S1,           R_V810_WLO_1   }, /* Or R_V850_HWLO or R_V850_HWLO_1.  */
+  { BFD_RELOC_V850_23,                R_V850_WLO23   },
+  { BFD_RELOC_V850_LO16_SPLIT_OFFSET, R_V850_BLO     },
+  { BFD_RELOC_V850_ZDA_16_16_OFFSET,  R_V810_HWORD   },
+  { BFD_RELOC_V850_TDA_16_16_OFFSET,  R_V810_HWORD   },
+  { BFD_RELOC_V850_SDA_16_16_OFFSET,  R_V810_HWORD   },
+  { BFD_RELOC_V850_SDA_15_16_OFFSET,  R_V810_GPWLO_1 }
+};
+
+/* Map a bfd relocation into the appropriate howto structure.  */
+
+static reloc_howto_type *
+v800_elf_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code)
+{
+  unsigned int i;
+
+  BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_v850_rh850);
+
+  for (i = ARRAY_SIZE (v800_elf_reloc_map); i --;)
+    if (v800_elf_reloc_map[i].bfd_reloc_val == code)
+      {
+	unsigned int elf_reloc_val = v800_elf_reloc_map[i].elf_reloc_val;
+	unsigned int idx = elf_reloc_val - R_V810_NONE;
+
+	BFD_ASSERT (v800_elf_howto_table[idx].type == elf_reloc_val);
+
+	return v800_elf_howto_table + idx;
+      }
+
+#ifdef DEBUG
+  fprintf (stderr, "failed to find v800 equiv of bfd reloc code %d\n", code);
+#endif
+  return NULL;
+}
+
+static reloc_howto_type *
+v800_elf_reloc_name_lookup (bfd * abfd, const char * r_name)
+{
+  unsigned int i;
+
+  BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_v850_rh850);
+
+  for (i = ARRAY_SIZE (v800_elf_howto_table); i--;)
+    if (v800_elf_howto_table[i].name != NULL
+	&& strcasecmp (v800_elf_howto_table[i].name, r_name) == 0)
+      return v800_elf_howto_table + i;
+
+  return NULL;
+}
+
+
+/* Set the howto pointer in CACHE_PTR for a V800 ELF reloc.  */
+
+static void
+v800_elf_info_to_howto (bfd *               abfd,
+			arelent *           cache_ptr,
+			Elf_Internal_Rela * dst)
+{
+  unsigned int r_type = ELF32_R_TYPE (dst->r_info);
+
+  BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_v850_rh850);
+
+  BFD_ASSERT (r_type < (unsigned int) R_V800_max);
+
+  if (r_type == R_V800_NONE)
+    r_type = R_V810_NONE;
+
+  BFD_ASSERT (r_type >= (unsigned int) R_V810_NONE);
+  r_type -= R_V810_NONE;
+  BFD_ASSERT (r_type < ARRAY_SIZE (v800_elf_howto_table));
+
+  cache_ptr->howto = v800_elf_howto_table + r_type;
+}
+
+
+#undef  TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM			bfd_elf32_v850_rh850_vec
+#undef  TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME			"elf32-v850-rh850"
+#undef  ELF_ARCH
+#define ELF_ARCH				bfd_arch_v850_rh850
+#undef  ELF_MACHINE_CODE
+#define ELF_MACHINE_CODE			EM_V800
+#undef  ELF_MACHINE_ALT1
+
+#undef  elf32_bed
+#define elf32_bed elf32_v850_rh850_bed
+
+#undef  elf_info_to_howto
+#define elf_info_to_howto			v800_elf_info_to_howto
+#undef  elf_info_to_howto_rel
+#define elf_info_to_howto_rel			NULL
+#undef  bfd_elf32_bfd_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_type_lookup		v800_elf_reloc_type_lookup
+#undef  bfd_elf32_bfd_reloc_name_lookup
+#define bfd_elf32_bfd_reloc_name_lookup		v800_elf_reloc_name_lookup
+
 #include "elf32-target.h"
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 84ec972..d6ae14e 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -465,7 +465,7 @@
   struct elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -585,20 +585,22 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
 	{
 	case R_VAX_GOT32:
 	  BFD_ASSERT (h != NULL);
-	  if (h->forced_local
-	      || h == elf_hash_table (info)->hgot
-	      || h == elf_hash_table (info)->hplt)
-	    break;
 
 	  /* If this is a local symbol, we resolve it directly without
 	     creating a global offset table entry.  */
-	  if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+	  if (h->forced_local
+	      || h == elf_hash_table (info)->hgot
+	      || h == elf_hash_table (info)->hplt)
 	    break;
 
 	  /* This symbol requires a global offset table entry.  */
@@ -668,11 +670,11 @@
              never referenced by a dynamic object, in which case we
              don't need to generate a procedure linkage table entry
              after all.  */
+	  BFD_ASSERT (h != NULL);
 
 	  /* If this is a local symbol, we resolve it directly without
 	     creating a procedure linkage table entry.  */
-	  BFD_ASSERT (h != NULL);
-	  if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || h->forced_local)
+	  if (h->forced_local)
 	    break;
 
 	  h->needs_plt = 1;
@@ -910,9 +912,8 @@
    understand.  */
 
 static bfd_boolean
-elf_vax_adjust_dynamic_symbol (info, h)
-     struct bfd_link_info *info;
-     struct elf_link_hash_entry *h;
+elf_vax_adjust_dynamic_symbol (struct bfd_link_info *info,
+			       struct elf_link_hash_entry *h)
 {
   bfd *dynobj;
   asection *s;
@@ -933,39 +934,21 @@
   if (h->type == STT_FUNC
       || h->needs_plt)
     {
-      if (! info->shared
-	  && !h->def_dynamic
-	  && !h->ref_dynamic
-	  /* We must always create the plt entry if it was referenced
-	     by a PLTxxO relocation.  In this case we already recorded
-	     it as a dynamic symbol.  */
-	  && h->dynindx == -1)
+      if (h->plt.refcount <= 0
+	  || SYMBOL_CALLS_LOCAL (info, h)
+	  || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	      && h->root.type == bfd_link_hash_undefweak))
 	{
 	  /* This case can occur if we saw a PLTxx reloc in an input
 	     file, but the symbol was never referred to by a dynamic
-	     object.  In such a case, we don't actually need to build
-	     a procedure linkage table, and we can just do a PCxx
-	     reloc instead.  */
-	  BFD_ASSERT (h->needs_plt);
+	     object, or if all references were garbage collected.  In
+	     such a case, we don't actually need to build a procedure
+	     linkage table, and we can just do a PCxx reloc instead.  */
 	  h->plt.offset = (bfd_vma) -1;
-	  return TRUE;
-	}
-
-      /* GC may have rendered this entry unused.  */
-      if (h->plt.refcount <= 0)
-	{
 	  h->needs_plt = 0;
-	  h->plt.offset = (bfd_vma) -1;
 	  return TRUE;
 	}
 
-      /* Make sure this symbol is output as a dynamic symbol.  */
-      if (h->dynindx == -1)
-	{
-	  if (! bfd_elf_link_record_dynamic_symbol (info, h))
-	    return FALSE;
-	}
-
       s = bfd_get_linker_section (dynobj, ".plt");
       BFD_ASSERT (s != NULL);
 
@@ -1065,6 +1048,59 @@
   return _bfd_elf_adjust_dynamic_copy (h, s);
 }
 
+/* This function is called via elf_link_hash_traverse.  It resets GOT
+   and PLT (.GOT) reference counts back to -1 so normal PC32 relocation
+   will be done.  */
+
+static bfd_boolean
+elf_vax_discard_got_entries (struct elf_link_hash_entry *h,
+			     void *infoptr ATTRIBUTE_UNUSED)
+{
+  h->got.refcount = -1;
+  h->plt.refcount = -1;
+
+  return TRUE;
+}
+
+/* Discard unused dynamic data if this is a static link.  */
+
+static bfd_boolean
+elf_vax_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+			      struct bfd_link_info *info)
+{
+  bfd *dynobj;
+  asection *s;
+
+  dynobj = elf_hash_table (info)->dynobj;
+
+  if (dynobj && !elf_hash_table (info)->dynamic_sections_created)
+    {
+      /* We may have created entries in the .rela.got and .got sections.
+	 However, if we are not creating the dynamic sections, we will
+	 not actually use these entries.  Reset the size of .rela.got
+	 and .got, which will cause them to get stripped from the output
+	 file below.  */
+      s = bfd_get_linker_section (dynobj, ".rela.got");
+      if (s != NULL)
+	s->size = 0;
+      s = bfd_get_linker_section (dynobj, ".got.plt");
+      if (s != NULL)
+	s->size = 0;
+      s = bfd_get_linker_section (dynobj, ".got");
+      if (s != NULL)
+	s->size = 0;
+    }
+
+  /* If this is a static link, we need to discard all the got entries we've
+     recorded.  */
+  if (!dynobj || !elf_hash_table (info)->dynamic_sections_created)
+    elf_link_hash_traverse (elf_hash_table (info),
+			    elf_vax_discard_got_entries,
+			    info);
+
+  return TRUE;
+}
+
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -1090,23 +1126,6 @@
 	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
 	}
     }
-  else
-    {
-      /* We may have created entries in the .rela.got and .got sections.
-	 However, if we are not creating the dynamic sections, we will
-	 not actually use these entries.  Reset the size of .rela.got
-	 and .got, which will cause it to get stripped from the output
-	 file below.  */
-      s = bfd_get_linker_section (dynobj, ".rela.got");
-      if (s != NULL)
-	s->size = 0;
-      s = bfd_get_linker_section (dynobj, ".got.plt");
-      if (s != NULL)
-	s->size = 0;
-      s = bfd_get_linker_section (dynobj, ".got");
-      if (s != NULL)
-	s->size = 0;
-    }
 
   /* If this is a -Bsymbolic shared link, then we need to discard all PC
      relative relocs against symbols defined in a regular object.  We
@@ -1117,9 +1136,9 @@
 				elf_vax_discard_copies,
 				NULL);
 
-  /* If this is a -Bsymbolic shared link or a static link, we need to
-     discard all the got entries we've recorded.  Otherwise, we need to
-     instantiate (allocate space for them).  */
+  /* If this is a -Bsymbolic shared link, we need to discard all the got
+     entries we've recorded.  Otherwise, we need to instantiate (allocate
+     space for them).  */
   elf_link_hash_traverse (elf_hash_table (info),
 			  elf_vax_instantiate_got_entries,
 			  info);
@@ -1275,12 +1294,12 @@
   return TRUE;
 }
 
-/* This function is called via elf_link_hash_traverse.  It looks for entries
-   that have GOT or PLT (.GOT) references.  If creating a static object or a
-   shared object with -Bsymbolic, it resets the reference count back to 0
-   and sets the offset to -1 so normal PC32 relocation will be done.  If
-   creating a shared object or executable, space in the .got and .rela.got
-   will be reserved for the symbol.  */
+/* This function is called via elf_link_hash_traverse.  It looks for
+   entries that have GOT or PLT (.GOT) references.  If creating a shared
+   object with -Bsymbolic, or the symbol has been forced local, then it
+   resets the reference count back to -1 so normal PC32 relocation will
+   be done.  Otherwise space in the .got and .rela.got will be reserved
+   for the symbol.  */
 
 static bfd_boolean
 elf_vax_instantiate_got_entries (struct elf_link_hash_entry *h, void * infoptr)
@@ -1295,25 +1314,18 @@
     return TRUE;
 
   dynobj = elf_hash_table (info)->dynobj;
-  if (dynobj == NULL)
-    return TRUE;
+  BFD_ASSERT (dynobj != NULL);
 
   sgot = bfd_get_linker_section (dynobj, ".got");
   srelgot = bfd_get_linker_section (dynobj, ".rela.got");
 
-  if (!elf_hash_table (info)->dynamic_sections_created
-      || (info->shared && info->symbolic)
-      || h->forced_local)
+  if (SYMBOL_REFERENCES_LOCAL (info, h))
     {
-      h->got.refcount = 0;
-      h->got.offset = (bfd_vma) -1;
-      h->plt.refcount = 0;
-      h->plt.offset = (bfd_vma) -1;
+      h->got.refcount = -1;
+      h->plt.refcount = -1;
     }
   else if (h->got.refcount > 0)
     {
-      bfd_boolean dyn;
-
       /* Make sure this symbol is output as a dynamic symbol.  */
       if (h->dynindx == -1)
 	{
@@ -1321,15 +1333,9 @@
 	    return FALSE;
 	}
 
-      dyn = elf_hash_table (info)->dynamic_sections_created;
       /* Allocate space in the .got and .rela.got sections.  */
-      if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
-	  && (info->shared
-	      || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
-	{
-	  sgot->size += 4;
-	  srelgot->size += sizeof (Elf32_External_Rela);
-	}
+      sgot->size += 4;
+      srelgot->size += sizeof (Elf32_External_Rela);
     }
 
   return TRUE;
@@ -1402,12 +1408,12 @@
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if ((h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
@@ -1454,17 +1460,14 @@
 	case R_VAX_GOT32:
 	  /* Relocation is to the address of the entry for this symbol
 	     in the global offset table.  */
+
+	  /* Resolve a GOTxx reloc against a local symbol directly,
+	     without using the global offset table.  */
 	  if (h == NULL
-	      || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
-	      || h->got.offset == (bfd_vma) -1
-	      || h->forced_local)
+	      || h->got.offset == (bfd_vma) -1)
 	    break;
 
-	  /* Relocation is the offset of the entry for this symbol in
-	     the global offset table.  */
-
 	  {
-	    bfd_boolean dyn;
 	    bfd_vma off;
 
 	    if (sgot == NULL)
@@ -1473,37 +1476,10 @@
 		BFD_ASSERT (sgot != NULL);
 	      }
 
-	    BFD_ASSERT (h != NULL);
 	    off = h->got.offset;
-	    BFD_ASSERT (off != (bfd_vma) -1);
 	    BFD_ASSERT (off < sgot->size);
 
-	    dyn = elf_hash_table (info)->dynamic_sections_created;
-	    if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
-		|| (info->shared
-		    && SYMBOL_REFERENCES_LOCAL (info, h)))
-	      {
-		/* The symbol was forced to be local
-		   because of a version file..  We must initialize
-		   this entry in the global offset table.  Since
-		   the offset must always be a multiple of 4, we
-		   use the least significant bit to record whether
-		   we have initialized it already.
-
-		   When doing a dynamic link, we create a .rela.got
-		   relocation entry to initialize the value.  This
-		   is done in the finish_dynamic_symbol routine.  */
-		if ((off & 1) != 0)
-		  off &= ~1;
-		else
-		  {
-		    bfd_put_32 (output_bfd, relocation + rel->r_addend,
-				sgot->contents + off);
-		    h->got.offset |= 1;
-		  }
-	      } else {
-		bfd_put_32 (output_bfd, rel->r_addend, sgot->contents + off);
-	      }
+	    bfd_put_32 (output_bfd, rel->r_addend, sgot->contents + off);
 
 	    relocation = sgot->output_offset + off;
 	    /* The GOT relocation uses the addend.  */
@@ -1530,19 +1506,9 @@
 	  /* Resolve a PLTxx reloc against a local symbol directly,
 	     without using the procedure linkage table.  */
 	  if (h == NULL
-	      || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
-	      || h->forced_local)
+	      || h->plt.offset == (bfd_vma) -1)
 	    break;
 
-	  if (h->plt.offset == (bfd_vma) -1
-	      || !elf_hash_table (info)->dynamic_sections_created)
-	    {
-	      /* We didn't make a PLT entry for this symbol.  This
-		 happens when statically linking PIC code, or when
-		 using -Bsymbolic.  */
-	      break;
-	    }
-
 	  if (splt == NULL)
 	    {
 	      splt = bfd_get_linker_section (dynobj, ".plt");
@@ -1877,25 +1843,10 @@
 
       rela.r_offset = (sgot->output_section->vma
 		       + sgot->output_offset
-		       + (h->got.offset &~ 1));
-
-      /* If the symbol was forced to be local because of a version file
-	 locally we just want to emit a RELATIVE reloc.  The entry in
-	 the global offset table will already have been initialized in
-	 the relocate_section function.  */
-      if (info->shared
-	  && h->dynindx == -1
-	  && h->def_regular)
-	{
-	  rela.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE);
-	}
-      else
-	{
-	  rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_GLOB_DAT);
-	}
+		       + h->got.offset);
+      rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_GLOB_DAT);
       rela.r_addend = bfd_get_signed_32 (output_bfd,
-					 (sgot->contents
-					  + (h->got.offset & ~1)));
+					 sgot->contents + h->got.offset);
 
       loc = srela->contents;
       loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
@@ -1926,7 +1877,7 @@
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == elf_hash_table (info)->hdynamic
       || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
 
@@ -2038,13 +1989,16 @@
       bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8);
     }
 
-  elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+  if (elf_section_data (sgot->output_section) != NULL)
+    elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
 
   return TRUE;
 }
 
 static enum elf_reloc_type_class
-elf_vax_reloc_type_class (const Elf_Internal_Rela *rela)
+elf_vax_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			  const asection *rel_sec ATTRIBUTE_UNUSED,
+			  const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -2080,6 +2034,8 @@
 #define elf_backend_check_relocs	elf_vax_check_relocs
 #define elf_backend_adjust_dynamic_symbol \
 					elf_vax_adjust_dynamic_symbol
+#define elf_backend_always_size_sections \
+					elf_vax_always_size_sections
 #define elf_backend_size_dynamic_sections \
 					elf_vax_size_dynamic_sections
 #define elf_backend_init_index_section	_bfd_elf_init_1_index_section
diff --git a/bfd/elf32-xc16x.c b/bfd/elf32-xc16x.c
index b7e0d41..ec7e3da 100644
--- a/bfd/elf32-xc16x.c
+++ b/bfd/elf32-xc16x.c
@@ -1,6 +1,6 @@
 /* Infineon XC16X-specific support for 16-bit ELF.
    Copyright 2006, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
-   Contributed by KPIT Cummins Infosystems 
+   Contributed by KPIT Cummins Infosystems
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -373,12 +373,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -433,11 +433,11 @@
 
 static unsigned long
 elf32_xc16x_mach (flagword flags)
-{  
+{
   switch (flags)
     {
     case 0x1000:
-    default: 
+    default:
       return bfd_mach_xc16x;
 
     case 0x1001:
diff --git a/bfd/elf32-xgate.c b/bfd/elf32-xgate.c
index bd62438..b822260 100644
--- a/bfd/elf32-xgate.c
+++ b/bfd/elf32-xgate.c
@@ -106,8 +106,8 @@
 	 bfd_elf_generic_reloc, /* special_function */
 	 "R_XGATE_16", /* name */
 	 FALSE, /* partial_inplace */
-	 0x00ff, /* src_mask */
-	 0x00ff, /* dst_mask */
+	 0xffff, /* src_mask */
+	 0xffff, /* dst_mask */
 	 FALSE), /* pcrel_offset */
 
   /* A 32 bit absolute relocation.  This one is never used for the
@@ -437,7 +437,7 @@
 
   bfd_hash_table_free (ret->stub_hash_table);
   free (ret->stub_hash_table);
-  _bfd_generic_link_hash_table_free (hash);
+  _bfd_elf_link_hash_table_free (hash);
 }
 
 /* Create a XGATE ELF linker hash table.  */
@@ -448,11 +448,10 @@
   struct xgate_elf_link_hash_table *ret;
   bfd_size_type amt = sizeof(struct xgate_elf_link_hash_table);
 
-  ret = (struct xgate_elf_link_hash_table *) bfd_malloc (amt);
+  ret = (struct xgate_elf_link_hash_table *) bfd_zmalloc (amt);
   if (ret == (struct xgate_elf_link_hash_table *) NULL)
     return NULL;
 
-  memset (ret, 0, amt);
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
       _bfd_elf_link_hash_newfunc, sizeof(struct elf_link_hash_entry),
       XGATE_ELF_DATA))
@@ -463,7 +462,7 @@
 
   /* Init the stub hash table too.  */
   amt = sizeof(struct bfd_hash_table);
-  ret->stub_hash_table = (struct bfd_hash_table*) bfd_malloc (amt);
+  ret->stub_hash_table = (struct bfd_hash_table*) bfd_zmalloc (amt);
   if (ret->stub_hash_table == NULL)
     {
       free (ret);
@@ -472,12 +471,11 @@
 
   if (!bfd_hash_table_init (ret->stub_hash_table, stub_hash_newfunc,
       sizeof(struct elf32_xgate_stub_hash_entry)))
-    return NULL;
-
-  ret->stub_bfd = NULL;
-  ret->stub_section = 0;
-  ret->add_stub_section = NULL;
-  ret->sym_cache.abfd = NULL;
+    {
+      free (ret->stub_hash_table);
+      free (ret);
+      return NULL;
+    }
 
   return &ret->root.root;
 }
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index c657b84..b5946b7 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -437,6 +437,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF32_R_TYPE (rel->r_info))
@@ -814,12 +818,12 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 2de9480..75ccefe 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -655,7 +655,7 @@
   struct elf_xtensa_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_xtensa_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -668,16 +668,6 @@
       return NULL;
     }
 
-  ret->sgot = NULL;
-  ret->sgotplt = NULL;
-  ret->srelgot = NULL;
-  ret->splt = NULL;
-  ret->srelplt = NULL;
-  ret->sgotloc = NULL;
-  ret->spltlittbl = NULL;
-
-  ret->plt_reloc_count = 0;
-
   /* Create a hash entry for "_TLS_MODULE_BASE_" to speed up checking
      for it later.  */
   tlsbase = elf_link_hash_lookup (&ret->elf, "_TLS_MODULE_BASE_",
@@ -752,7 +742,7 @@
 	      != GET_XTENSA_PROP_ALIGNMENT (b->flags)))
 	return (GET_XTENSA_PROP_ALIGNMENT (a->flags)
 		- GET_XTENSA_PROP_ALIGNMENT (b->flags));
-      
+
       if ((a->flags & XTENSA_PROP_UNREACHABLE)
 	  != (b->flags & XTENSA_PROP_UNREACHABLE))
 	return ((b->flags & XTENSA_PROP_UNREACHABLE)
@@ -814,7 +804,7 @@
   if (table_section)
     table_size = table_section->size;
 
-  if (table_size == 0) 
+  if (table_size == 0)
     {
       *table_p = NULL;
       return 0;
@@ -849,7 +839,7 @@
   section_limit = bfd_get_section_limit (abfd, section);
   rel_end = internal_relocs + table_section->reloc_count;
 
-  for (off = 0; off < table_size; off += table_entry_size) 
+  for (off = 0; off < table_size; off += table_entry_size)
     {
       bfd_vma address = bfd_get_32 (abfd, table_data + off);
 
@@ -1017,6 +1007,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
       eh = elf_xtensa_hash_entry (h);
 
@@ -1969,7 +1963,7 @@
 	  if (is_windowed_call_opcode (opcode))
 	    {
 	      if ((self_address >> CALL_SEGMENT_BITS)
-		  != (relocation >> CALL_SEGMENT_BITS)) 
+		  != (relocation >> CALL_SEGMENT_BITS))
 		{
 		  *error_message = "windowed longcall crosses 1GB boundary; "
 		    "return may fail";
@@ -2142,7 +2136,7 @@
       && is_windowed_call_opcode (opcode))
     {
       if ((self_address >> CALL_SEGMENT_BITS)
-	  != (relocation >> CALL_SEGMENT_BITS)) 
+	  != (relocation >> CALL_SEGMENT_BITS))
 	{
 	  *error_message =
 	    "windowed call crosses 1GB boundary; return may fail";
@@ -2170,8 +2164,8 @@
 
   VA_OPEN (ap, arglen);
   VA_FIXEDARG (ap, const char *, origmsg);
-  
-  is_append = (origmsg == message);  
+
+  is_append = (origmsg == message);
 
   orig_len = strlen (origmsg);
   len = orig_len + strlen (fmt) + arglen + 20;
@@ -2644,10 +2638,12 @@
 	}
       else
 	{
+	  bfd_boolean ignored;
+
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if (relocation == 0
 	      && !unresolved_reloc
@@ -3135,7 +3131,7 @@
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == elf_hash_table (info)->hdynamic
       || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
 
@@ -3502,10 +3498,10 @@
       return TRUE;
     }
 
-  if ((out_flag & EF_XTENSA_XT_INSN) != (in_flag & EF_XTENSA_XT_INSN)) 
+  if ((out_flag & EF_XTENSA_XT_INSN) != (in_flag & EF_XTENSA_XT_INSN))
     elf_elfheader (obfd)->e_flags &= (~ EF_XTENSA_XT_INSN);
 
-  if ((out_flag & EF_XTENSA_XT_LIT) != (in_flag & EF_XTENSA_XT_LIT)) 
+  if ((out_flag & EF_XTENSA_XT_LIT) != (in_flag & EF_XTENSA_XT_LIT))
     elf_elfheader (obfd)->e_flags &= (~ EF_XTENSA_XT_LIT);
 
   return TRUE;
@@ -3595,7 +3591,9 @@
 
 
 static enum elf_reloc_type_class
-elf_xtensa_reloc_type_class (const Elf_Internal_Rela *rela)
+elf_xtensa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			     const asection *rel_sec ATTRIBUTE_UNUSED,
+			     const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -3792,10 +3790,10 @@
      based on the size.  Just assume this is GNU/Linux.  */
 
   /* pr_cursig */
-  elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+  elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
   /* pr_pid */
-  elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+  elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
   /* pr_reg */
   offset = 72;
@@ -3816,9 +3814,9 @@
 	return FALSE;
 
       case 128:		/* GNU/Linux elf_prpsinfo */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
     }
 
@@ -3827,7 +3825,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -4096,7 +4094,7 @@
     return 0;
 
   size += insnlen;
-  
+
   insnlen = insn_decode_len (contents, content_len, offset + size);
   if (insnlen == 0)
     return 0;
@@ -4135,7 +4133,7 @@
   return FALSE;
 }
 
-      
+
 #define MIN_INSN_LENGTH 2
 
 /* Return 0 if it fails to decode.  */
@@ -4236,7 +4234,7 @@
       BFD_ASSERT (FALSE);
       return FALSE;
     }
-  
+
   loop_len = insn_decode_len (contents, content_length, offset);
   insn_len = insn_decode_len (contents, content_length, offset + loop_len);
   if (loop_len == 0 || insn_len == 0)
@@ -4628,7 +4626,7 @@
   return 0;
 }
 
-		       
+
 /* Attempt to widen an instruction.  If the widening is valid, perform
    the action in-place directly into the contents and return TRUE.  Otherwise,
    the return value is FALSE and the contents are not modified.  */
@@ -4723,12 +4721,12 @@
       *error_message = _("Attempt to convert L32R/CALLX to CALL failed");
       return bfd_reloc_other;
     }
-  
+
   /* Assemble a NOP ("or a1, a1, a1") into the 0 byte offset.  */
   core_format = xtensa_format_lookup (isa, "x24");
   opcode = xtensa_opcode_lookup (isa, "or");
   xtensa_opcode_encode (isa, core_format, 0, slotbuf, opcode);
-  for (opn = 0; opn < 3; opn++) 
+  for (opn = 0; opn < 3; opn++)
     {
       uint32 regno = 1;
       xtensa_operand_encode (isa, opcode, opn, &regno);
@@ -4796,7 +4794,7 @@
 #define CONST16_TARGET_REG_OPERAND 0
 #define CALLN_SOURCE_OPERAND 0
 
-static xtensa_opcode 
+static xtensa_opcode
 get_expanded_call_opcode (bfd_byte *buf, int bufsize, bfd_boolean *p_uses_l32r)
 {
   static xtensa_insnbuf insnbuf = NULL;
@@ -4872,7 +4870,7 @@
       || xtensa_format_get_slot (isa, fmt, 0, insnbuf, slotbuf))
     return XTENSA_UNDEFINED;
   opcode = xtensa_opcode_decode (isa, fmt, 0, slotbuf);
-  if (opcode == XTENSA_UNDEFINED 
+  if (opcode == XTENSA_UNDEFINED
       || !is_indirect_call_opcode (opcode))
     return XTENSA_UNDEFINED;
 
@@ -4903,7 +4901,7 @@
    For efficiency, an r_reloc also contains a "target_offset" field to
    cache the target-section-relative offset value that is represented by
    the relocation.
-   
+
    The r_reloc also contains a virtual offset that allows multiple
    inserted literals to be placed at the same "address" with
    different offsets.  */
@@ -5030,7 +5028,7 @@
       fprintf (fp, " + ");
       fprintf_vma (fp, r_rel->virtual_offset);
     }
-    
+
   fprintf (fp, ")");
 }
 
@@ -5150,7 +5148,7 @@
 
 struct literal_value_struct
 {
-  r_reloc r_rel; 
+  r_reloc r_rel;
   unsigned long value;
   bfd_boolean is_abs_literal;
 };
@@ -5191,7 +5189,7 @@
 {
   struct elf_link_hash_entry *h1, *h2;
 
-  if (r_reloc_is_const (&src1->r_rel) != r_reloc_is_const (&src2->r_rel)) 
+  if (r_reloc_is_const (&src1->r_rel) != r_reloc_is_const (&src2->r_rel))
     return FALSE;
 
   if (r_reloc_is_const (&src1->r_rel))
@@ -5203,13 +5201,13 @@
 
   if (src1->r_rel.target_offset != src2->r_rel.target_offset)
     return FALSE;
-   
+
   if (src1->r_rel.virtual_offset != src2->r_rel.virtual_offset)
     return FALSE;
 
   if (src1->value != src2->value)
     return FALSE;
-  
+
   /* Now check for the same section (if defined) or the same elf_hash
      (if undefined or weak).  */
   h1 = r_reloc_get_hash_entry (&src1->r_rel);
@@ -5251,7 +5249,7 @@
   values->count = 0;
   values->buckets = (value_map **)
     bfd_zmalloc (sizeof (value_map *) * values->bucket_count);
-  if (values->buckets == NULL) 
+  if (values->buckets == NULL)
     {
       free (values);
       return NULL;
@@ -5290,7 +5288,7 @@
       hash_val += hash_bfd_vma (src->is_abs_literal * 1000);
       hash_val += hash_bfd_vma (src->r_rel.target_offset);
       hash_val += hash_bfd_vma (src->r_rel.virtual_offset);
-  
+
       /* Now check for the same section and the same elf_hash.  */
       if (r_reloc_is_defined (&src->r_rel))
 	sec_or_hash = r_reloc_get_section (&src->r_rel);
@@ -5356,7 +5354,7 @@
   *bucket_p = val_e;
   map->count++;
   /* FIXME: Consider resizing the hash table if we get too many entries.  */
-  
+
   return val_e;
 }
 
@@ -5496,7 +5494,7 @@
    "unreachable_space" bytes can be freely contracted.  Note that a
    negative removed value is a fill.  */
 
-static void 
+static void
 text_action_add (text_action_list *l,
 		 text_action_t action,
 		 asection *sec,
@@ -5517,8 +5515,8 @@
   for (m_p = &l->head; *m_p && (*m_p)->offset <= offset; m_p = &(*m_p)->next)
     {
       text_action *t = *m_p;
-      
-      if (action == ta_fill) 
+
+      if (action == ta_fill)
 	{
 	  /* When the action is another fill at the same address,
 	     just increase the size.  */
@@ -5615,7 +5613,7 @@
 }
 
 
-static bfd_vma 
+static bfd_vma
 offset_with_removed_text (text_action_list *action_list, bfd_vma offset)
 {
   text_action *r = action_list->head;
@@ -5753,9 +5751,9 @@
   else
     new_r->to.abfd = NULL;
   new_r->next = NULL;
-  
+
   r = removed_list->head;
-  if (r == NULL) 
+  if (r == NULL)
     {
       removed_list->head = new_r;
       removed_list->tail = new_r;
@@ -5768,7 +5766,7 @@
     }
   else
     {
-      while (r->from.target_offset < from->target_offset && r->next) 
+      while (r->from.target_offset < from->target_offset && r->next)
 	{
 	  r = r->next;
 	}
@@ -5846,7 +5844,7 @@
      reallocated, the newly allocated relocations will be referenced
      here along with the actual size allocated.  The relocation
      count will always be found in the section structure.  */
-  Elf_Internal_Rela *allocated_relocs; 
+  Elf_Internal_Rela *allocated_relocs;
   unsigned relocs_count;
   unsigned allocated_relocs_count;
 };
@@ -5912,7 +5910,7 @@
   relax_info->fix_array = NULL;
   relax_info->fix_array_count = 0;
 
-  relax_info->allocated_relocs = NULL; 
+  relax_info->allocated_relocs = NULL;
   relax_info->relocs_count = 0;
   relax_info->allocated_relocs_count = 0;
 }
@@ -5932,11 +5930,11 @@
   asection *src_sec;
   bfd_vma src_offset;
   unsigned src_type;			/* Relocation type.  */
-  
+
   asection *target_sec;
   bfd_vma target_offset;
   bfd_boolean translated;
-  
+
   reloc_bfd_fix *next;
 };
 
@@ -6067,7 +6065,7 @@
 
 
 static void
-clear_section_cache (section_cache_t *sec_cache)
+free_section_cache (section_cache_t *sec_cache)
 {
   if (sec_cache->sec)
     {
@@ -6075,7 +6073,6 @@
       release_internal_relocs (sec_cache->sec, sec_cache->relocs);
       if (sec_cache->ptbl)
 	free (sec_cache->ptbl);
-      memset (sec_cache, 0, sizeof (sec_cache));
     }
 }
 
@@ -6116,8 +6113,8 @@
     goto err;
 
   /* Fill in the new section cache.  */
-  clear_section_cache (sec_cache);
-  memset (sec_cache, 0, sizeof (sec_cache));
+  free_section_cache (sec_cache);
+  init_section_cache (sec_cache);
 
   sec_cache->sec = sec;
   sec_cache->contents = contents;
@@ -6548,7 +6545,7 @@
 
   sec_size = bfd_get_section_limit (abfd, sec);
   contents = elf_section_data (sec)->this_hdr.contents;
-  
+
   if (contents == NULL && sec_size != 0)
     {
       if (!bfd_malloc_and_get_section (abfd, sec, &contents))
@@ -6557,7 +6554,7 @@
 	    free (contents);
 	  return NULL;
 	}
-      if (keep_memory) 
+      if (keep_memory)
 	elf_section_data (sec)->this_hdr.contents = contents;
     }
   return contents;
@@ -6632,12 +6629,12 @@
   (bfd *, asection *, struct bfd_link_info *, value_map_hash_table *);
 static Elf_Internal_Rela *get_irel_at_offset
   (asection *, Elf_Internal_Rela *, bfd_vma);
-static bfd_boolean is_removable_literal 
+static bfd_boolean is_removable_literal
   (const source_reloc *, int, const source_reloc *, int, asection *,
    property_table_entry *, int);
 static bfd_boolean remove_dead_literal
   (bfd *, asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-   Elf_Internal_Rela *, source_reloc *, property_table_entry *, int); 
+   Elf_Internal_Rela *, source_reloc *, property_table_entry *, int);
 static bfd_boolean identify_literal_placement
   (bfd *, asection *, bfd_byte *, struct bfd_link_info *,
    value_map_hash_table *, bfd_boolean *, Elf_Internal_Rela *, int,
@@ -6667,7 +6664,7 @@
 static bfd_boolean relax_section_symbols (bfd *, asection *);
 
 
-static bfd_boolean 
+static bfd_boolean
 elf_xtensa_relax_section (bfd *abfd,
 			  asection *sec,
 			  struct bfd_link_info *link_info,
@@ -6830,7 +6827,7 @@
 
   internal_relocs = retrieve_internal_relocs (abfd, sec,
 					      link_info->keep_memory);
-  if (internal_relocs == NULL) 
+  if (internal_relocs == NULL)
     return ok;
 
   contents = retrieve_contents (abfd, sec, link_info->keep_memory);
@@ -6841,7 +6838,7 @@
     }
 
   source_relax_info = get_xtensa_relax_info (sec);
-  for (i = 0; i < sec->reloc_count; i++) 
+  for (i = 0; i < sec->reloc_count; i++)
     {
       Elf_Internal_Rela *irel = &internal_relocs[i];
       r_reloc r_rel;
@@ -6921,9 +6918,9 @@
   unsigned i;
   bfd_size_type sec_size;
 
-  internal_relocs = retrieve_internal_relocs (abfd, sec, 
+  internal_relocs = retrieve_internal_relocs (abfd, sec,
 					      link_info->keep_memory);
-  if (internal_relocs == NULL) 
+  if (internal_relocs == NULL)
     return ok;
 
   sec_size = bfd_get_section_limit (abfd, sec);
@@ -6935,7 +6932,7 @@
     }
 
   /* Record relocations against relaxable literal sections.  */
-  for (i = 0; i < sec->reloc_count; i++) 
+  for (i = 0; i < sec->reloc_count; i++)
     {
       Elf_Internal_Rela *irel = &internal_relocs[i];
       r_reloc r_rel;
@@ -6993,7 +6990,7 @@
      relocations associated with ASM_EXPANDs because they were just
      added in the preceding loop over the relocations.  */
 
-  for (i = 0; i < sec->reloc_count; i++) 
+  for (i = 0; i < sec->reloc_count; i++)
     {
       Elf_Internal_Rela *irel = &internal_relocs[i];
       bfd_boolean is_reachable;
@@ -7032,7 +7029,7 @@
 		 the l32r_irel.  Note: The src_relocs array is not yet
 		 sorted, but it wouldn't matter anyway because we're
 		 searching by source offset instead of target offset.  */
-	      s_reloc = find_source_reloc (target_relax_info->src_relocs, 
+	      s_reloc = find_source_reloc (target_relax_info->src_relocs,
 					   target_relax_info->src_next,
 					   sec, l32r_irel);
 	      BFD_ASSERT (s_reloc);
@@ -7091,7 +7088,7 @@
   if (contents == NULL)
     return FALSE;
 
-  if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_ASM_EXPAND) 
+  if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_ASM_EXPAND)
     return FALSE;
 
   sec_size = bfd_get_section_limit (abfd, sec);
@@ -7100,7 +7097,7 @@
   /* Optimization of longcalls that use CONST16 is not yet implemented.  */
   if (!uses_l32r)
     return FALSE;
-  
+
   direct_call_opcode = swap_callx_for_call_opcode (opcode);
   if (direct_call_opcode == XTENSA_UNDEFINED)
     return FALSE;
@@ -7119,7 +7116,7 @@
      shouldn't crash regardless.  */
   if (!target_sec->output_section)
     return FALSE;
-      
+
   /* For relocatable sections, we can only simplify when the output
      section of the target is the same as the output section of the
      source.  */
@@ -7132,7 +7129,7 @@
 		  + sec->output_offset + irel->r_offset + 3);
   dest_address = (target_sec->output_section->vma
 		  + target_sec->output_offset + target_offset);
-      
+
   *is_reachable_p = pcrel_reloc_fits (direct_call_opcode, 0,
 				      self_address, dest_address);
 
@@ -7153,7 +7150,7 @@
 {
   unsigned i;
 
-  for (i = 0; i < sec->reloc_count; i++) 
+  for (i = 0; i < sec->reloc_count; i++)
     {
       Elf_Internal_Rela *irel = &internal_relocs[i];
 
@@ -7370,7 +7367,7 @@
     return FALSE;
   prev_opcode = insn_decode_opcode (contents, content_length, offset-3, 0);
   return (xtensa_opcode_is_loop (xtensa_default_isa, prev_opcode) == 1);
-} 
+}
 
 
 /* Find all of the possible actions for an extended basic block.  */
@@ -7420,7 +7417,7 @@
 
 	  insn_len = insn_decode_len (ebb->contents, ebb->content_length,
 				      offset);
-	  if (insn_len == 0) 
+	  if (insn_len == 0)
 	    goto decode_error;
 
 	  if (check_branch_target_aligned_address (offset, insn_len))
@@ -7449,7 +7446,7 @@
 	    {
 	      bfd_size_type simplify_size;
 
-	      simplify_size = get_asm_simplify_size (ebb->contents, 
+	      simplify_size = get_asm_simplify_size (ebb->contents,
 						     ebb->content_length,
 						     irel->r_offset);
 	      if (simplify_size == 0)
@@ -7457,7 +7454,7 @@
 
 	      ebb_propose_action (ebb_table, EBB_NO_ALIGN, 0,
 				  ta_convert_longcall, offset, 0, TRUE);
-	      
+
 	      offset += simplify_size;
 	      continue;
 	    }
@@ -7804,7 +7801,7 @@
 };
 
 
-static int 
+static int
 xlate_compare (const void *a_v, const void *b_v)
 {
   const xlate_map_entry_t *a = (const xlate_map_entry_t *) a_v;
@@ -7834,7 +7831,7 @@
   r = bsearch (&offset, map->entry, map->entry_count,
 	       sizeof (xlate_map_entry_t), &xlate_compare);
   e = (xlate_map_entry_t *) r;
-  
+
   BFD_ASSERT (e != NULL);
   if (e == NULL)
     return offset;
@@ -7859,7 +7856,7 @@
     return NULL;
 
   num_actions = action_list_count (action_list);
-  map->entry = (xlate_map_entry_t *) 
+  map->entry = (xlate_map_entry_t *)
     bfd_malloc (sizeof (xlate_map_entry_t) * (num_actions + 1));
   if (map->entry == NULL)
     {
@@ -7867,7 +7864,7 @@
       return NULL;
     }
   map->entry_count = 0;
-  
+
   removed = 0;
   current_entry = &map->entry[0];
 
@@ -7922,7 +7919,7 @@
 
 /* Free an offset translation map.  */
 
-static void 
+static void
 free_xlate_map (xlate_map_t *map)
 {
   if (map && map->entry)
@@ -8154,7 +8151,7 @@
    add an entry to the per-section list of removed literals.  The
    actual changes are deferred until the next pass.  */
 
-static bfd_boolean 
+static bfd_boolean
 compute_removed_literals (bfd *abfd,
 			  asection *sec,
 			  struct bfd_link_info *link_info,
@@ -8181,7 +8178,7 @@
   if (!relax_info->is_relaxable_literal_section)
     return ok;
 
-  internal_relocs = retrieve_internal_relocs (abfd, sec, 
+  internal_relocs = retrieve_internal_relocs (abfd, sec,
 					      link_info->keep_memory);
 
   sec_size = bfd_get_section_limit (abfd, sec);
@@ -8233,14 +8230,14 @@
 	continue;
       prev_i = i;
 
-      if (last_loc_is_prev && 
+      if (last_loc_is_prev &&
 	  last_target_offset + 4 != rel->r_rel.target_offset)
 	last_loc_is_prev = FALSE;
 
       /* Check if the relocation was from an L32R that is being removed
 	 because a CALLX was converted to a direct CALL, and check if
 	 there are no other relocations to the literal.  */
-      if (is_removable_literal (rel, i, src_relocs, relax_info->src_count, 
+      if (is_removable_literal (rel, i, src_relocs, relax_info->src_count,
 				sec, prop_table, ptblsize))
 	{
 	  if (!remove_dead_literal (abfd, sec, link_info, internal_relocs,
@@ -8254,8 +8251,8 @@
 	}
 
       if (!identify_literal_placement (abfd, sec, contents, link_info,
-				       values, 
-				       &last_loc_is_prev, irel, 
+				       values,
+				       &last_loc_is_prev, irel,
 				       relax_info->src_count - i, rel,
 				       prop_table, ptblsize,
 				       &target_sec_cache, rel->is_abs_literal))
@@ -8272,8 +8269,9 @@
 #endif /* DEBUG */
 
 error_return:
-  if (prop_table) free (prop_table);
-  clear_section_cache (&target_sec_cache);
+  if (prop_table)
+    free (prop_table);
+  free_section_cache (&target_sec_cache);
 
   release_contents (sec, contents);
   release_internal_relocs (sec, internal_relocs);
@@ -8291,7 +8289,7 @@
   unsigned r_type;
   Elf_Internal_Rela key;
 
-  if (!internal_relocs) 
+  if (!internal_relocs)
     return NULL;
 
   key.r_offset = offset;
@@ -8335,8 +8333,8 @@
 
   if (!rel->is_null)
     return FALSE;
-  
-  entry = elf_xtensa_find_property_entry (prop_table, ptblsize, 
+
+  entry = elf_xtensa_find_property_entry (prop_table, ptblsize,
 					  sec->vma + rel->r_rel.target_offset);
   if (entry && (entry->flags & XTENSA_PROP_NO_TRANSFORM))
     return FALSE;
@@ -8357,7 +8355,7 @@
 }
 
 
-bfd_boolean 
+bfd_boolean
 remove_dead_literal (bfd *abfd,
 		     asection *sec,
 		     struct bfd_link_info *link_info,
@@ -8384,7 +8382,7 @@
 		   ta_remove_literal, sec, rel->r_rel.target_offset, 4);
 
   /* If the section is 4-byte aligned, do not add fill.  */
-  if (sec->alignment_power > 2) 
+  if (sec->alignment_power > 2)
     {
       int fill_extra_space;
       bfd_vma entry_sec_offset;
@@ -8428,7 +8426,7 @@
 }
 
 
-bfd_boolean 
+bfd_boolean
 identify_literal_placement (bfd *abfd,
 			    asection *sec,
 			    bfd_byte *contents,
@@ -8498,7 +8496,7 @@
   /* For relocatable links, do not try to move literals.  To do it
      correctly might increase the number of relocations in an input
      section making the default relocatable linking fail.  */
-  if (!link_info->relocatable && !literal_placed 
+  if (!link_info->relocatable && !literal_placed
       && values->has_last_loc && !(*last_loc_is_prev_p))
     {
       asection *target_sec = r_reloc_get_section (&values->last_loc);
@@ -8511,7 +8509,7 @@
 	  /* There is a last loc that was in the same output section.  */
 	  if (relocations_reach (rel, remaining_src_rels, &try_loc)
 	      && move_shared_literal (sec, link_info, rel,
-				      prop_table, ptblsize, 
+				      prop_table, ptblsize,
 				      &try_loc, &val, target_sec_cache))
 	    {
 	      values->last_loc.virtual_offset += 4;
@@ -8611,7 +8609,7 @@
 /* Move a literal to another literal location because it is
    the same as the other literal value.  */
 
-static bfd_boolean 
+static bfd_boolean
 coalesce_shared_literal (asection *sec,
 			 source_reloc *rel,
 			 property_table_entry *prop_table,
@@ -8640,7 +8638,7 @@
 		   ta_remove_literal, sec, rel->r_rel.target_offset, 4);
 
   /* If the section is 4-byte aligned, do not add fill.  */
-  if (sec->alignment_power > 2) 
+  if (sec->alignment_power > 2)
     {
       int fill_extra_space;
       bfd_vma entry_sec_offset;
@@ -8676,7 +8674,7 @@
    total amount of space used because of alignments so we need to do
    this carefully.  Also, it may make a branch go out of range.  */
 
-static bfd_boolean 
+static bfd_boolean
 move_shared_literal (asection *sec,
 		     struct bfd_link_info *link_info,
 		     source_reloc *rel,
@@ -8719,7 +8717,7 @@
     return FALSE;
 
   target_entry = elf_xtensa_find_property_entry
-    (target_sec_cache->ptbl, target_sec_cache->pte_count, 
+    (target_sec_cache->ptbl, target_sec_cache->pte_count,
      target_sec->vma + target_loc->target_offset);
 
   if (!target_entry)
@@ -8730,7 +8728,7 @@
 
   init_ebb_constraint (&ebb_table);
   ebb = &ebb_table.ebb;
-  init_ebb (ebb, target_sec_cache->sec, target_sec_cache->contents, 
+  init_ebb (ebb, target_sec_cache->sec, target_sec_cache->contents,
 	    target_sec_cache->content_length,
 	    target_sec_cache->ptbl, target_sec_cache->pte_count,
 	    target_sec_cache->relocs, target_sec_cache->reloc_count);
@@ -8742,24 +8740,24 @@
 		      -4 - (1 << target_sec->alignment_power), TRUE);
 
   /* Check all of the PC-relative relocations to make sure they still fit.  */
-  relocs_fit = check_section_ebb_pcrels_fit (target_sec->owner, target_sec, 
+  relocs_fit = check_section_ebb_pcrels_fit (target_sec->owner, target_sec,
 					     target_sec_cache->contents,
 					     target_sec_cache->relocs,
 					     &ebb_table, NULL);
 
-  if (!relocs_fit) 
+  if (!relocs_fit)
     return FALSE;
 
   text_action_add_literal (&target_relax_info->action_list,
 			   ta_add_literal, target_loc, lit_value, -4);
 
-  if (target_sec->alignment_power > 2 && target_entry != src_entry) 
+  if (target_sec->alignment_power > 2 && target_entry != src_entry)
     {
       /* May need to add or remove some fill to maintain alignment.  */
       int fill_extra_space;
       bfd_vma entry_sec_offset;
 
-      entry_sec_offset = 
+      entry_sec_offset =
 	target_entry->address - target_sec->vma + target_entry->size;
 
       /* If the literal range is at the end of the section,
@@ -8792,7 +8790,7 @@
 		   ta_remove_literal, sec, rel->r_rel.target_offset, 4);
 
   /* If the section is 4-byte aligned, do not add fill.  */
-  if (sec->alignment_power > 2 && target_entry != src_entry) 
+  if (sec->alignment_power > 2 && target_entry != src_entry)
     {
       int fill_extra_space;
       bfd_vma entry_sec_offset;
@@ -8856,7 +8854,7 @@
       return relax_property_section (abfd, sec, link_info);
     }
 
-  internal_relocs = retrieve_internal_relocs (abfd, sec, 
+  internal_relocs = retrieve_internal_relocs (abfd, sec,
 					      link_info->keep_memory);
   if (!internal_relocs && !relax_info->action_list.head)
     return TRUE;
@@ -9186,7 +9184,7 @@
 		      dup_dot += copy_size;
 		    }
 		  virtual_action = TRUE;
-		} 
+		}
 	      else
 		BFD_ASSERT (action->virtual_offset <= orig_dot_vo);
 	    }
@@ -9257,7 +9255,7 @@
 				 relax_info, &internal_relocs, &action->value))
 		goto error_return;
 
-	      if (virtual_action) 
+	      if (virtual_action)
 		orig_dot_vo += copy_size;
 
 	      orig_dot += orig_insn_size;
@@ -9322,7 +9320,7 @@
 }
 
 
-static bfd_boolean 
+static bfd_boolean
 translate_section_fixes (asection *sec)
 {
   xtensa_relax_info *relax_info;
@@ -9343,7 +9341,7 @@
 /* Translate a fix given the mapping in the relax info for the target
    section.  If it has already been translated, no work is required.  */
 
-static bfd_boolean 
+static bfd_boolean
 translate_reloc_bfd_fix (reloc_bfd_fix *fix)
 {
   reloc_bfd_fix new_fix;
@@ -9389,7 +9387,7 @@
 				      target_offset);
     }
 
-  if (removed) 
+  if (removed)
     {
       asection *new_sec;
 
@@ -9399,11 +9397,11 @@
 
       /* This was moved to some other address (possibly another section).  */
       new_sec = r_reloc_get_section (&removed->to);
-      if (new_sec != sec) 
+      if (new_sec != sec)
 	{
 	  sec = new_sec;
 	  relax_info = get_xtensa_relax_info (sec);
-	  if (!relax_info || 
+	  if (!relax_info ||
 	      (!relax_info->is_relaxable_literal_section
 	       && !relax_info->is_relaxable_asm_section))
 	    {
@@ -9692,7 +9690,7 @@
 	  BFD_ASSERT (relax_info->allocated_relocs == NULL
 		      || sec->reloc_count == relax_info->relocs_count);
 
-	  if (relax_info->allocated_relocs_count == 0) 
+	  if (relax_info->allocated_relocs_count == 0)
 	    new_relocs_count = (sec->reloc_count + 2) * 2;
 	  else
 	    new_relocs_count = (relax_info->allocated_relocs_count + 2) * 2;
@@ -9712,7 +9710,7 @@
 	  if (insert_at != sec->reloc_count)
 	    memcpy (new_relocs + insert_at + 1,
 		    (*internal_relocs_p) + insert_at,
-		    (sec->reloc_count - insert_at) 
+		    (sec->reloc_count - insert_at)
 		    * sizeof (Elf_Internal_Rela));
 
 	  if (*internal_relocs_p != relax_info->allocated_relocs)
@@ -9771,7 +9769,7 @@
   bfd_size_type entry_size;
 
   sec_size = bfd_get_section_limit (abfd, sec);
-  internal_relocs = retrieve_internal_relocs (abfd, sec, 
+  internal_relocs = retrieve_internal_relocs (abfd, sec,
 					      link_info->keep_memory);
   contents = retrieve_contents (abfd, sec, link_info->keep_memory);
   if (contents == NULL && sec_size != 0)
@@ -9996,7 +9994,7 @@
 	  actual_offset = offset - removed_bytes;
 	  size = bfd_get_32 (abfd, &contents[actual_offset + 4]);
 
-	  if (is_full_prop_section) 
+	  if (is_full_prop_section)
 	    flags = bfd_get_32 (abfd, &contents[actual_offset + 8]);
 	  else
 	    flags = predef_flags;
@@ -10024,7 +10022,7 @@
 		  bfd_vma new_address =
 		    (offset_rel->r_addend
 		     + bfd_get_32 (abfd, &contents[actual_offset]));
-		  if (is_full_prop_section) 
+		  if (is_full_prop_section)
 		    old_flags = bfd_get_32
 		      (abfd, &contents[last_irel->r_offset + 8]);
 		  else
@@ -10440,7 +10438,7 @@
 }
 
 
-static bfd_boolean 
+static bfd_boolean
 xtensa_is_property_section (asection *sec)
 {
   if (xtensa_is_insntable_section (sec)
@@ -10452,7 +10450,7 @@
 }
 
 
-static bfd_boolean 
+static bfd_boolean
 xtensa_is_insntable_section (asection *sec)
 {
   if (CONST_STRNEQ (sec->name, XTENSA_INSN_SEC_NAME)
@@ -10463,7 +10461,7 @@
 }
 
 
-static bfd_boolean 
+static bfd_boolean
 xtensa_is_littable_section (asection *sec)
 {
   if (CONST_STRNEQ (sec->name, XTENSA_LIT_SEC_NAME)
@@ -10474,7 +10472,7 @@
 }
 
 
-static bfd_boolean 
+static bfd_boolean
 xtensa_is_proptable_section (asection *sec)
 {
   if (CONST_STRNEQ (sec->name, XTENSA_PROP_SEC_NAME)
@@ -10527,7 +10525,7 @@
 {
   const char *gname = inf;
   const char *group_name = elf_group_name (sec);
-  
+
   return (group_name == gname
 	  || (group_name != NULL
 	      && gname != NULL
@@ -10559,9 +10557,9 @@
     {
       char *linkonce_kind = 0;
 
-      if (strcmp (base_name, XTENSA_INSN_SEC_NAME) == 0) 
+      if (strcmp (base_name, XTENSA_INSN_SEC_NAME) == 0)
 	linkonce_kind = "x.";
-      else if (strcmp (base_name, XTENSA_LIT_SEC_NAME) == 0) 
+      else if (strcmp (base_name, XTENSA_LIT_SEC_NAME) == 0)
 	linkonce_kind = "p.";
       else if (strcmp (base_name, XTENSA_PROP_SEC_NAME) == 0)
 	linkonce_kind = "prop.";
@@ -10701,7 +10699,7 @@
   if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
     return ok;
 
-  internal_relocs = retrieve_internal_relocs (abfd, sec, 
+  internal_relocs = retrieve_internal_relocs (abfd, sec,
 					      link_info->keep_memory);
   if (internal_relocs == NULL
       || sec->reloc_count == 0)
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 40e4bfb..3dbdab7 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -1,6 +1,6 @@
 /* Alpha specific support for 64-bit ELF
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010, 2011, 2012
+   2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    Free Software Foundation, Inc.
    Contributed by Richard Henderson <rth@tamu.edu>.
 
@@ -225,7 +225,7 @@
 #define alpha_elf_sym_hashes(abfd) \
   ((struct alpha_elf_link_hash_entry **)elf_sym_hashes(abfd))
 
-/* Should we do dynamic things to this symbol?  This differs from the 
+/* Should we do dynamic things to this symbol?  This differs from the
    generic version in that we never need to consider function pointer
    equality wrt PLT entries -- we don't create a PLT entry if a symbol's
    address is ever taken.  */
@@ -299,6 +299,15 @@
   return &ret->root.root;
 }
 
+/* Alpha ELF follows MIPS ELF in using a special find_nearest_line
+   routine in order to handle the ECOFF debugging information.  */
+
+struct alpha_elf_find_line
+{
+  struct ecoff_debug_info d;
+  struct ecoff_find_line i;
+};
+
 /* We have some private fields hanging off of the elf_tdata structure.  */
 
 struct alpha_elf_obj_tdata
@@ -328,6 +337,10 @@
   /* For every got, this is the sum of the number of words required
      to hold all of the member object's local got.  */
   int local_got_size;
+
+  /* Used by elf64_alpha_find_nearest_line entry point.  */
+  struct alpha_elf_find_line *find_line_info;
+
 };
 
 #define alpha_elf_tdata(abfd) \
@@ -1430,17 +1443,6 @@
   return name[0] == '$';
 }
 
-/* Alpha ELF follows MIPS ELF in using a special find_nearest_line
-   routine in order to handle the ECOFF debugging information.  We
-   still call this mips_elf_find_line because of the slot
-   find_line_info in elf_obj_tdata is declared that way.  */
-
-struct mips_elf_find_line
-{
-  struct ecoff_debug_info d;
-  struct ecoff_find_line i;
-};
-
 static bfd_boolean
 elf64_alpha_find_nearest_line (bfd *abfd, asection *section, asymbol **symbols,
 			       bfd_vma offset, const char **filename_ptr,
@@ -1452,7 +1454,7 @@
   if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections,
                                      section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr, 0,
+				     line_ptr, NULL, 0,
 				     &elf_tdata (abfd)->dwarf2_find_line_info))
     return TRUE;
 
@@ -1460,7 +1462,7 @@
   if (msec != NULL)
     {
       flagword origflags;
-      struct mips_elf_find_line *fi;
+      struct alpha_elf_find_line *fi;
       const struct ecoff_debug_swap * const swap =
 	get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
 
@@ -1471,16 +1473,16 @@
       if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS)
 	msec->flags |= SEC_HAS_CONTENTS;
 
-      fi = elf_tdata (abfd)->find_line_info;
+      fi = alpha_elf_tdata (abfd)->find_line_info;
       if (fi == NULL)
 	{
 	  bfd_size_type external_fdr_size;
 	  char *fraw_src;
 	  char *fraw_end;
 	  struct fdr *fdr_ptr;
-	  bfd_size_type amt = sizeof (struct mips_elf_find_line);
+	  bfd_size_type amt = sizeof (struct alpha_elf_find_line);
 
-	  fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt);
+	  fi = (struct alpha_elf_find_line *) bfd_zalloc (abfd, amt);
 	  if (fi == NULL)
 	    {
 	      msec->flags = origflags;
@@ -1509,7 +1511,7 @@
 	  for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++)
 	    (*swap->swap_fdr_in) (abfd, fraw_src, fdr_ptr);
 
-	  elf_tdata (abfd)->find_line_info = fi;
+	  alpha_elf_tdata (abfd)->find_line_info = fi;
 
 	  /* Note that we don't bother to ever free this information.
              find_nearest_line is either called all the time, as in
@@ -1810,6 +1812,9 @@
 		 || h->root.root.type == bfd_link_hash_warning)
 	    h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link;
 
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.root.non_ir_ref = 1;
 	  h->root.ref_regular = 1;
 	}
 
@@ -3585,7 +3590,9 @@
   use_gottprel = FALSE;
   new_symndx = is_gd ? ELF64_R_SYM (irel->r_info) : STN_UNDEF;
 
-  switch (!dynamic && !info->link_info->shared)
+  /* Some compilers warn about a Boolean-looking expression being
+     used in a switch.  The explicit cast silences them.  */
+  switch ((int) (!dynamic && !info->link_info->shared))
     {
     case 1:
       {
@@ -4141,7 +4148,7 @@
   bfd_boolean ret_val;
 
   BFD_ASSERT (is_alpha_elf (input_bfd));
-  
+
   /* Handle relocatable links with a smaller loop.  */
   if (info->relocatable)
     return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd,
@@ -4296,14 +4303,14 @@
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  struct elf_link_hash_entry *hh;
 	  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   hh, sec, value,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if (warned)
 	    continue;
@@ -4890,19 +4897,19 @@
 	      abort ();
 	    }
 
-	  elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel, 
+	  elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
 				   gotent->got_offset, h->dynindx,
 				   r_type, gotent->addend);
 
 	  if (gotent->reloc_type == R_ALPHA_TLSGD)
-	    elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel, 
+	    elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel,
 				     gotent->got_offset + 8, h->dynindx,
 				     R_ALPHA_DTPREL64, gotent->addend);
 	}
     }
 
   /* Mark some specially defined symbols as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == elf_hash_table (info)->hdynamic
       || h == elf_hash_table (info)->hgot
       || h == elf_hash_table (info)->hplt)
     sym->st_shndx = SHN_ABS;
@@ -5313,7 +5320,9 @@
 }
 
 static enum elf_reloc_type_class
-elf64_alpha_reloc_type_class (const Elf_Internal_Rela *rela)
+elf64_alpha_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			      const asection *rel_sec ATTRIBUTE_UNUSED,
+			      const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF64_R_TYPE (rela->r_info))
     {
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 62efef3..c992563 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -1,6 +1,6 @@
 /* Support for HPPA 64-bit ELF
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010, 2011, 2012
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+   2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -194,9 +194,6 @@
   (bfd *, struct bfd_link_info *,
    struct elf_link_hash_entry *, Elf_Internal_Sym *);
 
-static enum elf_reloc_type_class elf64_hppa_reloc_type_class
-  (const Elf_Internal_Rela *);
-
 static bfd_boolean elf64_hppa_finish_dynamic_sections
   (bfd *, struct bfd_link_info *);
 
@@ -299,7 +296,7 @@
   struct elf64_hppa_link_hash_table *htab;
   bfd_size_type amt = sizeof (*htab);
 
-  htab = bfd_zalloc (abfd, amt);
+  htab = bfd_zmalloc (amt);
   if (htab == NULL)
     return NULL;
 
@@ -308,7 +305,7 @@
 				      sizeof (struct elf64_hppa_link_hash_entry),
 				      HPPA64_ELF_DATA))
     {
-      bfd_release (abfd, htab);
+      free (htab);
       return NULL;
     }
 
@@ -476,7 +473,7 @@
 {
   Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   bfd_signed_vma *local_refcounts;
-                  
+
   local_refcounts = elf_local_got_refcounts (abfd);
   if (local_refcounts == NULL)
     {
@@ -647,6 +644,9 @@
 		 || hh->eh.root.type == bfd_link_hash_warning)
 	    hh = hppa_elf_hash_entry (hh->eh.root.u.i.link);
 
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  hh->eh.root.non_ir_ref = 1;
 	  hh->eh.ref_regular = 1;
 	}
       else
@@ -796,7 +796,7 @@
 	  else
 	    {
 	      bfd_signed_vma *local_dlt_refcounts;
-                  
+
 	      /* This is a DLT entry for a local symbol.  */
 	      local_dlt_refcounts = hppa64_elf_local_refcounts (abfd);
 	      if (local_dlt_refcounts == NULL)
@@ -821,7 +821,7 @@
 	    {
 	      bfd_signed_vma *local_dlt_refcounts;
 	      bfd_signed_vma *local_plt_refcounts;
-                  
+
 	      /* This is a PLT entry for a local symbol.  */
 	      local_dlt_refcounts = hppa64_elf_local_refcounts (abfd);
 	      if (local_dlt_refcounts == NULL)
@@ -855,7 +855,7 @@
 	    {
 	      bfd_signed_vma *local_dlt_refcounts;
 	      bfd_signed_vma *local_opd_refcounts;
-                  
+
 	      /* This is a OPD for a local symbol.  */
 	      local_dlt_refcounts = hppa64_elf_local_refcounts (abfd);
 	      if (local_dlt_refcounts == NULL)
@@ -1132,7 +1132,7 @@
   Elf_Internal_Ehdr * i_ehdrp;
 
   i_ehdrp = elf_elfheader (abfd);
-  
+
   i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
   i_ehdrp->e_ident[EI_ABIVERSION] = 1;
 }
@@ -1639,7 +1639,7 @@
 	    {
 	      *local_dlt = sec->size;
 	      sec->size += DLT_ENTRY_SIZE;
-	      if (info->shared) 
+	      if (info->shared)
 	        {
 		  srel->size += sizeof (Elf64_External_Rela);
 	        }
@@ -2213,7 +2213,7 @@
 
 	  nh = elf_link_hash_lookup (elf_hash_table (info),
 				     new_name, TRUE, TRUE, FALSE);
- 
+
 	  /* All we really want from the new symbol is its dynamic
 	     symbol index.  */
 	  if (nh)
@@ -2446,7 +2446,9 @@
    dynamic linker, before writing them out.  */
 
 static enum elf_reloc_type_class
-elf64_hppa_reloc_type_class (const Elf_Internal_Rela *rela)
+elf64_hppa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			     const asection *rel_sec ATTRIBUTE_UNUSED,
+			     const Elf_Internal_Rela *rela)
 {
   if (ELF64_R_SYM (rela->r_info) == STN_UNDEF)
     return reloc_class_relative;
@@ -2522,6 +2524,8 @@
 		 area at the start of the .data section.  So all we have to
 		 to is find the start of the .data section.  */
 	      s = bfd_get_section_by_name (output_bfd, ".data");
+	      if (!s)
+		return FALSE;
 	      dyn.d_un.d_ptr = s->vma;
 	      bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
@@ -2591,10 +2595,10 @@
 
       case 760:		/* Linux/hppa */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 32);
 
 	/* pr_reg */
 	offset = 112;
@@ -2620,16 +2624,16 @@
       return FALSE;
 
     case 136:		/* Linux/hppa elf_prpsinfo.  */
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
 	= _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
     }
 
   /* Note that for some reason, a spurious space is tacked
      onto the end of the args in some (at least one anyway)
      implementations, so strip it off if it exists.  */
-  command = elf_tdata (abfd)->core_command;
+  command = elf_tdata (abfd)->core->command;
   n = strlen (command);
 
   if (0 < n && command[n - 1] == ' ')
@@ -2687,7 +2691,7 @@
   s = bfd_get_section_by_name (abfd, ".interp");
   if (! s)
     {
-      for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+      for (m = elf_seg_map (abfd); m != NULL; m = m->next)
 	if (m->p_type == PT_PHDR)
 	  break;
       if (m == NULL)
@@ -2703,12 +2707,12 @@
 	  m->p_paddr_valid = 1;
 	  m->includes_phdrs = 1;
 
-	  m->next = elf_tdata (abfd)->segment_map;
-	  elf_tdata (abfd)->segment_map = m;
+	  m->next = elf_seg_map (abfd);
+	  elf_seg_map (abfd) = m;
 	}
     }
 
-  for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+  for (m = elf_seg_map (abfd); m != NULL; m = m->next)
     if (m->p_type == PT_LOAD)
       {
 	unsigned int i;
@@ -2772,7 +2776,7 @@
       if (bfd_bread (&sig, 4, abfd) != 4)
 	return FALSE;
 
-      elf_tdata (abfd)->core_signal = sig;
+      elf_tdata (abfd)->core->signal = sig;
 
       if (!_bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename))
 	return FALSE;
@@ -3190,7 +3194,7 @@
 
   if (hppa_info == NULL)
     return bfd_reloc_notsupported;
-  
+
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   local_offsets = elf_local_got_offsets (input_bfd);
   insn = bfd_get_32 (input_bfd, hit_data);
@@ -3273,7 +3277,7 @@
 	    && value + addend + max_branch_offset >= 2*max_branch_offset)
 	  {
 	    (*_bfd_error_handler)
-	      (_("%B(%A+0x" BFD_VMA_FMT "x): cannot reach %s"),
+	      (_("%B(%A+0x%" BFD_VMA_FMT "x): cannot reach %s"),
 	      input_bfd,
 	      input_section,
 	      offset,
@@ -3859,14 +3863,14 @@
 	  /* This is not a local symbol.  */
 	  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
 
-	  /* It seems this can happen with erroneous or unsupported 
+	  /* It seems this can happen with erroneous or unsupported
 	     input (mixing a.out and elf in an archive, for example.)  */
 	  if (sym_hashes == NULL)
 	    return FALSE;
 
 	  eh = sym_hashes[r_symndx - symtab_hdr->sh_info];
 
-	  while (eh->root.type == bfd_link_hash_indirect 
+	  while (eh->root.type == bfd_link_hash_indirect
 		 || eh->root.type == bfd_link_hash_warning)
 	    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
 
@@ -4057,7 +4061,7 @@
 					elf64_hppa_finish_dynamic_sections
 #define elf_backend_grok_prstatus	elf64_hppa_grok_prstatus
 #define elf_backend_grok_psinfo		elf64_hppa_grok_psinfo
- 
+
 /* Stuff for the BFD linker: */
 #define bfd_elf64_bfd_link_hash_table_create \
 	elf64_hppa_hash_table_create
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index ef78374..58a05af 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -539,7 +539,7 @@
 	     .plt section.  After the first relaxation pass, linker may
 	     increase the gap between the .plt and .text sections up
 	     to 32byte.  We assume linker will always insert 32byte
-	     between the .plt and .text sections after the the first
+	     between the .plt and .text sections after the first
 	     relaxation pass.  */
 	  if (tsec == ia64_info->root.splt)
 	    offset = -0x1000000 + 32;
@@ -1072,7 +1072,7 @@
     objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory);
   elf_link_hash_traverse (&ia64_info->root,
 			  elf64_ia64_global_dyn_info_free, NULL);
-  _bfd_generic_link_hash_table_free (hash);
+  _bfd_elf_link_hash_table_free (hash);
 }
 
 /* Traverse both local and global hash tables.  */
@@ -2095,6 +2095,9 @@
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	  h->ref_regular = 1;
 	}
       else
@@ -3492,13 +3495,13 @@
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sym_sec, value,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if (h->root.type == bfd_link_hash_undefweak)
 	    undef_weak_ref = TRUE;
@@ -4030,7 +4033,7 @@
     }
 
   /* Mark some specially defined symbols as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == ia64_info->root.hdynamic
       || h == ia64_info->root.hgot
       || h == ia64_info->root.hplt)
     sym->st_shndx = SHN_ABS;
@@ -4310,7 +4313,9 @@
 }
 
 static enum elf_reloc_type_class
-elf64_ia64_reloc_type_class (const Elf_Internal_Rela *rela)
+elf64_ia64_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			     const asection *rel_sec ATTRIBUTE_UNUSED,
+			     const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF64_R_TYPE (rela->r_info))
     {
@@ -5046,7 +5051,8 @@
 	h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
       *sym_hash = h;
-      h->unique_global = (flags & BSF_GNU_UNIQUE) != 0;
+      if (definition)
+	h->unique_global = (flags & BSF_GNU_UNIQUE) != 0;
 
       /* Set the alignment of a common symbol.  */
       if ((common || bfd_is_com_section (sec))
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index e02f969..a0c5cc5 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -1803,7 +1803,7 @@
 	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_TLS_GD",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0x0000ffff,		/* src_mask */
+	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -1818,7 +1818,7 @@
 	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_TLS_LDM",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0x0000ffff,		/* src_mask */
+	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -1833,7 +1833,7 @@
 	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_TLS_DTPREL_HI16",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0x0000ffff,		/* src_mask */
+	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -1848,7 +1848,7 @@
 	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_TLS_DTPREL_LO16",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0x0000ffff,		/* src_mask */
+	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -1863,7 +1863,7 @@
 	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_TLS_GOTTPREL",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0x0000ffff,		/* src_mask */
+	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -1878,7 +1878,7 @@
 	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_TLS_TPREL_HI16", /* name */
 	 FALSE,			/* partial_inplace */
-	 0x0000ffff,		/* src_mask */
+	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -1893,7 +1893,7 @@
 	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS16_TLS_TPREL_LO16", /* name */
 	 FALSE,			/* partial_inplace */
-	 0x0000ffff,		/* src_mask */
+	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 };
@@ -2184,6 +2184,37 @@
 	 0x0000ffff,		/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
+
+  /* Section displacement.  */
+  HOWTO (R_MICROMIPS_SCN_DISP,  /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
+	 "R_MICROMIPS_SCN_DISP", /* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Protected jump conversion.  This is an optimization hint.  No
+     relocation is required for correctness.  */
+  HOWTO (R_MICROMIPS_JALR,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
+	 "R_MICROMIPS_JALR",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x00000000,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
 };
 
 static reloc_howto_type micromips_elf64_howto_table_rela[] =
@@ -2495,6 +2526,37 @@
 	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
+
+  /* Section displacement.  */
+  HOWTO (R_MICROMIPS_SCN_DISP,  /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
+	 "R_MICROMIPS_SCN_DISP", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Protected jump conversion.  This is an optimization hint.  No
+     relocation is required for correctness.  */
+  HOWTO (R_MICROMIPS_JALR,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
+	 "R_MICROMIPS_JALR",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0x00000000,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
 };
 
 /* GNU extension to record C++ vtable hierarchy */
@@ -2560,6 +2622,23 @@
 	 0,			/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 TRUE);			/* pcrel_offset */
+
+/* 32 bit pc-relative.  Used for compact EH tables.  */
+static reloc_howto_type elf_mips_gnu_pcrel32 =
+  HOWTO (R_MIPS_PC32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 TRUE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
+	 "R_MIPS_PC32",		/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 TRUE);			/* pcrel_offset */
+
 
 /* Originally a VxWorks extension, but now used for other systems too.  */
 static reloc_howto_type elf_mips_copy_howto =
@@ -2570,7 +2649,7 @@
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS_COPY",		/* name */
 	 FALSE,			/* partial_inplace */
 	 0x0,         		/* src_mask */
@@ -2586,12 +2665,29 @@
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
 	 "R_MIPS_JUMP_SLOT",	/* name */
 	 FALSE,			/* partial_inplace */
 	 0x0,         		/* src_mask */
 	 0x0,		        /* dst_mask */
 	 FALSE);		/* pcrel_offset */
+
+/* Used in EH tables.  */
+static reloc_howto_type elf_mips_eh_howto =
+  HOWTO (R_MIPS_EH,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed, /* complain_on_overflow */
+	 _bfd_mips_elf_generic_reloc, /* special_function */
+	 "R_MIPS_EH",		/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,	        /* dst_mask */
+	 FALSE);		/* pcrel_offset */
+
 
 /* Swap in a MIPS 64-bit Rel reloc.  */
 
@@ -3152,6 +3248,8 @@
   { BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min },
   { BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min },
   { BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min },
+  { BFD_RELOC_MICROMIPS_SCN_DISP, R_MICROMIPS_SCN_DISP - R_MICROMIPS_min },
+  { BFD_RELOC_MICROMIPS_JALR, R_MICROMIPS_JALR - R_MICROMIPS_min },
 };
 /* Given a BFD reloc type, return a howto structure.  */
 
@@ -3193,6 +3291,10 @@
       return &elf_mips_gnu_vtinherit_howto;
     case BFD_RELOC_VTABLE_ENTRY:
       return &elf_mips_gnu_vtentry_howto;
+    case BFD_RELOC_32_PCREL:
+      return &elf_mips_gnu_pcrel32;
+    case BFD_RELOC_MIPS_EH:
+      return &elf_mips_eh_howto;
     case BFD_RELOC_MIPS_COPY:
       return &elf_mips_copy_howto;
     case BFD_RELOC_MIPS_JUMP_SLOT:
@@ -3240,6 +3342,10 @@
     return &elf_mips_gnu_rel16_s2;
   if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
     return &elf_mips_gnu_rela16_s2;
+  if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0)
+    return &elf_mips_gnu_pcrel32;
+  if (strcasecmp (elf_mips_eh_howto.name, r_name) == 0)
+    return &elf_mips_eh_howto;
   if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0)
     return &elf_mips_copy_howto;
   if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0)
@@ -3264,6 +3370,10 @@
 	return &elf_mips_gnu_rela16_s2;
       else
 	return &elf_mips_gnu_rel16_s2;
+    case R_MIPS_PC32:
+      return &elf_mips_gnu_pcrel32;
+    case R_MIPS_EH:
+      return &elf_mips_eh_howto;
     case R_MIPS_COPY:
       return &elf_mips_copy_howto;
     case R_MIPS_JUMP_SLOT:
@@ -3944,10 +4054,10 @@
 
       case 480:		/* Linux/MIPS - N64 kernel */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 32);
 
 	/* pr_reg */
 	offset = 112;
@@ -3970,9 +4080,9 @@
 	return FALSE;
 
       case 136:		/* Linux/MIPS - N64 kernel elf_prpsinfo */
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
     }
 
@@ -3981,7 +4091,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -4166,6 +4276,7 @@
 #define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
 #define bfd_elf64_canonicalize_dynamic_reloc mips_elf64_canonicalize_dynamic_reloc
 #define bfd_elf64_bfd_relax_section     _bfd_mips_relax_section
+#define bfd_elf64_mkobject		_bfd_mips_elf_mkobject
 
 /* MIPS ELF64 archive functions.  */
 #define bfd_elf64_archive_functions
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 3195075..c7e1c25 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -1413,12 +1413,13 @@
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc;
+	  bfd_boolean unresolved_reloc, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, undefined_signalled);
+				   unresolved_reloc, undefined_signalled,
+				   ignored);
 	  name = h->root.root.string;
 	}
 
@@ -2009,6 +2010,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       switch (ELF64_R_TYPE (rel->r_info))
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 50dad3b..f30c009 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -81,7 +81,8 @@
 #define bfd_elf64_mkobject		      ppc64_elf_mkobject
 #define bfd_elf64_bfd_reloc_type_lookup	      ppc64_elf_reloc_type_lookup
 #define bfd_elf64_bfd_reloc_name_lookup	      ppc64_elf_reloc_name_lookup
-#define bfd_elf64_bfd_merge_private_bfd_data  _bfd_generic_verify_endian_match
+#define bfd_elf64_bfd_merge_private_bfd_data  ppc64_elf_merge_private_bfd_data
+#define bfd_elf64_bfd_print_private_bfd_data  ppc64_elf_print_private_bfd_data
 #define bfd_elf64_new_section_hook	      ppc64_elf_new_section_hook
 #define bfd_elf64_bfd_link_hash_table_create  ppc64_elf_link_hash_table_create
 #define bfd_elf64_bfd_link_hash_table_free    ppc64_elf_link_hash_table_free
@@ -96,7 +97,7 @@
 #define elf_backend_copy_indirect_symbol      ppc64_elf_copy_indirect_symbol
 #define elf_backend_add_symbol_hook	      ppc64_elf_add_symbol_hook
 #define elf_backend_check_directives	      ppc64_elf_process_dot_syms
-#define elf_backend_as_needed_cleanup	      ppc64_elf_as_needed_cleanup
+#define elf_backend_notice_as_needed	      ppc64_elf_notice_as_needed
 #define elf_backend_archive_symbol_lookup     ppc64_elf_archive_symbol_lookup
 #define elf_backend_check_relocs	      ppc64_elf_check_relocs
 #define elf_backend_gc_keep		      ppc64_elf_gc_keep
@@ -108,6 +109,7 @@
 #define elf_backend_maybe_function_sym	      ppc64_elf_maybe_function_sym
 #define elf_backend_always_size_sections      ppc64_elf_func_desc_adjust
 #define elf_backend_size_dynamic_sections     ppc64_elf_size_dynamic_sections
+#define elf_backend_hash_symbol		      ppc64_elf_hash_symbol
 #define elf_backend_init_index_section	      _bfd_elf_init_2_index_sections
 #define elf_backend_action_discarded	      ppc64_elf_action_discarded
 #define elf_backend_relocate_section	      ppc64_elf_relocate_section
@@ -117,16 +119,25 @@
 #define elf_backend_link_output_symbol_hook   ppc64_elf_output_symbol_hook
 #define elf_backend_special_sections	      ppc64_elf_special_sections
 #define elf_backend_post_process_headers      _bfd_elf_set_osabi
+#define elf_backend_merge_symbol_attribute    ppc64_elf_merge_symbol_attribute
 
 /* The name of the dynamic interpreter.  This is put in the .interp
    section.  */
 #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
 
 /* The size in bytes of an entry in the procedure linkage table.  */
-#define PLT_ENTRY_SIZE 24
+#define PLT_ENTRY_SIZE(htab) (htab->opd_abi ? 24 : 8)
 
 /* The initial size of the plt reserved for the dynamic linker.  */
-#define PLT_INITIAL_ENTRY_SIZE PLT_ENTRY_SIZE
+#define PLT_INITIAL_ENTRY_SIZE(htab) (htab->opd_abi ? 24 : 16)
+
+/* Offsets to some stack save slots.  */
+#define STK_LR 16
+#define STK_TOC(htab) (htab->opd_abi ? 40 : 24)
+/* This one is dodgy.  ABIv2 does not have a linker word, so use the
+   CR save slot.  Used only by optimised __tls_get_addr call stub,
+   relying on __tls_get_addr_opt not saving CR..  */
+#define STK_LINKER(htab) (htab->opd_abi ? 32 : 8)
 
 /* TOC base pointers offset from start of TOC.  */
 #define TOC_BASE_OFF	0x8000
@@ -137,33 +148,35 @@
 
 /* .plt call stub instructions.  The normal stub is like this, but
    sometimes the .plt entry crosses a 64k boundary and we need to
-   insert an addi to adjust r12.  */
-#define PLT_CALL_STUB_SIZE (7*4)
-#define ADDIS_R12_R2	0x3d820000	/* addis %r12,%r2,xxx@ha     */
-#define STD_R2_40R1	0xf8410028	/* std	 %r2,40(%r1)	     */
-#define LD_R11_0R12	0xe96c0000	/* ld	 %r11,xxx+0@l(%r12)  */
-#define MTCTR_R11	0x7d6903a6	/* mtctr %r11		     */
-#define LD_R2_0R12	0xe84c0000	/* ld	 %r2,xxx+8@l(%r12)   */
-					/* ld	 %r11,xxx+16@l(%r12) */
+   insert an addi to adjust r11.  */
+#define STD_R2_0R1	0xf8410000	/* std	 %r2,0+40(%r1)	     */
+#define ADDIS_R11_R2	0x3d620000	/* addis %r11,%r2,xxx@ha     */
+#define LD_R12_0R11	0xe98b0000	/* ld	 %r12,xxx+0@l(%r11)  */
+#define MTCTR_R12	0x7d8903a6	/* mtctr %r12		     */
+#define LD_R2_0R11	0xe84b0000	/* ld	 %r2,xxx+8@l(%r11)   */
+#define LD_R11_0R11	0xe96b0000	/* ld	 %r11,xxx+16@l(%r11) */
 #define BCTR		0x4e800420	/* bctr			     */
 
-
-#define ADDIS_R12_R12	0x3d8c0000	/* addis %r12,%r12,off@ha  */
-#define ADDI_R12_R12	0x398c0000	/* addi %r12,%r12,off@l  */
+#define ADDI_R11_R11	0x396b0000	/* addi %r11,%r11,off@l  */
 #define ADDIS_R2_R2	0x3c420000	/* addis %r2,%r2,off@ha  */
 #define ADDI_R2_R2	0x38420000	/* addi  %r2,%r2,off@l   */
 
-#define XOR_R11_R11_R11	0x7d6b5a78	/* xor   %r11,%r11,%r11  */
-#define ADD_R12_R12_R11	0x7d8c5a14	/* add   %r12,%r12,%r11  */
+#define XOR_R2_R12_R12	0x7d826278	/* xor   %r2,%r12,%r12   */
+#define ADD_R11_R11_R2	0x7d6b1214	/* add   %r11,%r11,%r2   */
+#define XOR_R11_R12_R12	0x7d8b6278	/* xor   %r11,%r12,%r12  */
 #define ADD_R2_R2_R11	0x7c425a14	/* add   %r2,%r2,%r11    */
 #define CMPLDI_R2_0	0x28220000	/* cmpldi %r2,0          */
 #define BNECTR		0x4ca20420	/* bnectr+               */
 #define BNECTR_P4	0x4ce20420	/* bnectr+               */
 
+#define LD_R12_0R2	0xe9820000	/* ld	 %r12,xxx+0(%r2) */
 #define LD_R11_0R2	0xe9620000	/* ld	 %r11,xxx+0(%r2) */
 #define LD_R2_0R2	0xe8420000	/* ld	 %r2,xxx+0(%r2)  */
 
-#define LD_R2_40R1	0xe8410028	/* ld    %r2,40(%r1)     */
+#define LD_R2_0R1	0xe8410000	/* ld    %r2,0(%r1)      */
+
+#define ADDIS_R12_R12	0x3d8c0000	/* addis %r12,%r12,xxx@ha */
+#define LD_R12_0R12	0xe98c0000	/* ld    %r12,xxx@l(%r12) */
 
 /* glink call stub instructions.  We enter with the index in R0.  */
 #define GLINK_CALL_STUB_SIZE (16*4)
@@ -174,14 +187,19 @@
 #define BCL_20_31	0x429f0005	/*  bcl 20,31,1f		*/
 					/* 1:				*/
 #define MFLR_R11	0x7d6802a6	/*  mflr %11			*/
-#define LD_R2_M16R11	0xe84bfff0	/*  ld %2,(0b-1b)(%11)		*/
+					/*  ld %2,(0b-1b)(%11)		*/
 #define MTLR_R12	0x7d8803a6	/*  mtlr %12			*/
-#define ADD_R12_R2_R11	0x7d825a14	/*  add %12,%2,%11		*/
-					/*  ld %11,0(%12)		*/
-					/*  ld %2,8(%12)		*/
-					/*  mtctr %11			*/
-					/*  ld %11,16(%12)		*/
+#define ADD_R11_R2_R11	0x7d625a14	/*  add %11,%2,%11		*/
+					/*  ld %12,0(%11)		*/
+					/*  ld %2,8(%11)		*/
+					/*  mtctr %12			*/
+					/*  ld %11,16(%11)		*/
 					/*  bctr			*/
+#define MFLR_R0		0x7c0802a6	/*  mflr %r0			*/
+#define MTLR_R0		0x7c0803a6	/*  mtlr %r0			*/
+#define SUB_R12_R12_R11	0x7d8b6050	/*  subf %r12,%r11,%r12		*/
+#define ADDI_R0_R12	0x380c0000	/*  addi %r0,%r12,0		*/
+#define SRDI_R0_R0_2	0x7800f082	/*  rldicl %r0,%r0,62,2		*/
 
 /* Pad with this.  */
 #define NOP		0x60000000
@@ -309,7 +327,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_PPC64_ADDR16_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -325,7 +343,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_ha_reloc,	/* special_function */
 	 "R_PPC64_ADDR16_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -487,7 +505,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont,/* complain_on_overflow */
+	 complain_overflow_signed,/* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT16_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -503,7 +521,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont,/* complain_on_overflow */
+	 complain_overflow_signed,/* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT16_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -680,7 +698,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_PLT16_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -696,7 +714,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_PLT16_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -741,7 +759,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_sectoff_reloc, /* special_function */
 	 "R_PPC64_SECTOFF_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -756,7 +774,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_sectoff_ha_reloc, /* special_function */
 	 "R_PPC64_SECTOFF_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -963,7 +981,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_toc_reloc,	/* special_function */
 	 "R_PPC64_TOC16_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -982,7 +1000,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_toc_ha_reloc, /* special_function */
 	 "R_PPC64_TOC16_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1054,7 +1072,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_PLTGOT16_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1072,7 +1090,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont,/* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_PLTGOT16_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1374,7 +1392,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_DTPREL16_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1389,7 +1407,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_DTPREL16_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1540,7 +1558,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_TPREL16_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1555,7 +1573,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_TPREL16_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1692,7 +1710,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT_TLSGD16_HI", /* name */
 	 FALSE,			/* partial_inplace */
@@ -1707,7 +1725,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT_TLSGD16_HA", /* name */
 	 FALSE,			/* partial_inplace */
@@ -1754,7 +1772,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT_TLSLD16_HI", /* name */
 	 FALSE,			/* partial_inplace */
@@ -1769,7 +1787,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT_TLSLD16_HA", /* name */
 	 FALSE,			/* partial_inplace */
@@ -1815,7 +1833,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT_DTPREL16_HI", /* name */
 	 FALSE,			/* partial_inplace */
@@ -1830,7 +1848,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT_DTPREL16_HA", /* name */
 	 FALSE,			/* partial_inplace */
@@ -1876,7 +1894,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT_TPREL16_HI", /* name */
 	 FALSE,			/* partial_inplace */
@@ -1891,7 +1909,7 @@
 	 16,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_unhandled_reloc, /* special_function */
 	 "R_PPC64_GOT_TPREL16_HA", /* name */
 	 FALSE,			/* partial_inplace */
@@ -1964,7 +1982,7 @@
 	 16,			/* bitsize */
 	 TRUE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_PPC64_REL16_HI",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1980,7 +1998,7 @@
 	 16,			/* bitsize */
 	 TRUE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont, /* complain_on_overflow */
+	 complain_overflow_signed, /* complain_on_overflow */
 	 ppc64_elf_ha_reloc,	/* special_function */
 	 "R_PPC64_REL16_HA",	/* name */
 	 FALSE,			/* partial_inplace */
@@ -1988,6 +2006,96 @@
 	 0xffff,		/* dst_mask */
 	 TRUE),			/* pcrel_offset */
 
+  /* Like R_PPC64_ADDR16_HI, but no overflow.  */
+  HOWTO (R_PPC64_ADDR16_HIGH,	/* type */
+	 16,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_PPC64_ADDR16_HIGH",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Like R_PPC64_ADDR16_HA, but no overflow.  */
+  HOWTO (R_PPC64_ADDR16_HIGHA,	/* type */
+	 16,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 ppc64_elf_ha_reloc,	/* special_function */
+	 "R_PPC64_ADDR16_HIGHA",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Like R_PPC64_DTPREL16_HI, but no overflow.  */
+  HOWTO (R_PPC64_DTPREL16_HIGH,
+	 16,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 ppc64_elf_unhandled_reloc, /* special_function */
+	 "R_PPC64_DTPREL16_HIGH", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Like R_PPC64_DTPREL16_HA, but no overflow.  */
+  HOWTO (R_PPC64_DTPREL16_HIGHA,
+	 16,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 ppc64_elf_unhandled_reloc, /* special_function */
+	 "R_PPC64_DTPREL16_HIGHA", /* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Like R_PPC64_TPREL16_HI, but no overflow.  */
+  HOWTO (R_PPC64_TPREL16_HIGH,
+	 16,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 ppc64_elf_unhandled_reloc, /* special_function */
+	 "R_PPC64_TPREL16_HIGH",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
+  /* Like R_PPC64_TPREL16_HA, but no overflow.  */
+  HOWTO (R_PPC64_TPREL16_HIGHA,
+	 16,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 ppc64_elf_unhandled_reloc, /* special_function */
+	 "R_PPC64_TPREL16_HIGHA",	/* name */
+	 FALSE,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
   /* GNU extension to record C++ vtable hierarchy.  */
   HOWTO (R_PPC64_GNU_VTINHERIT,	/* type */
 	 0,			/* rightshift */
@@ -2066,8 +2174,12 @@
       break;
     case BFD_RELOC_HI16:			r = R_PPC64_ADDR16_HI;
       break;
+    case BFD_RELOC_PPC64_ADDR16_HIGH:		r = R_PPC64_ADDR16_HIGH;
+      break;
     case BFD_RELOC_HI16_S:			r = R_PPC64_ADDR16_HA;
       break;
+    case BFD_RELOC_PPC64_ADDR16_HIGHA:		r = R_PPC64_ADDR16_HIGHA;
+      break;
     case BFD_RELOC_PPC_BA16:			r = R_PPC64_ADDR14;
       break;
     case BFD_RELOC_PPC_BA16_BRTAKEN:		r = R_PPC64_ADDR14_BRTAKEN;
@@ -2186,8 +2298,12 @@
       break;
     case BFD_RELOC_PPC_TPREL16_HI:		r = R_PPC64_TPREL16_HI;
       break;
+    case BFD_RELOC_PPC64_TPREL16_HIGH:		r = R_PPC64_TPREL16_HIGH;
+      break;
     case BFD_RELOC_PPC_TPREL16_HA:		r = R_PPC64_TPREL16_HA;
       break;
+    case BFD_RELOC_PPC64_TPREL16_HIGHA:		r = R_PPC64_TPREL16_HIGHA;
+      break;
     case BFD_RELOC_PPC_TPREL:			r = R_PPC64_TPREL64;
       break;
     case BFD_RELOC_PPC_DTPREL16:		r = R_PPC64_DTPREL16;
@@ -2196,8 +2312,12 @@
       break;
     case BFD_RELOC_PPC_DTPREL16_HI:		r = R_PPC64_DTPREL16_HI;
       break;
+    case BFD_RELOC_PPC64_DTPREL16_HIGH:		r = R_PPC64_DTPREL16_HIGH;
+      break;
     case BFD_RELOC_PPC_DTPREL16_HA:		r = R_PPC64_DTPREL16_HA;
       break;
+    case BFD_RELOC_PPC64_DTPREL16_HIGHA:	r = R_PPC64_DTPREL16_HIGHA;
+      break;
     case BFD_RELOC_PPC_DTPREL:			r = R_PPC64_DTPREL64;
       break;
     case BFD_RELOC_PPC_GOT_TLSGD16:		r = R_PPC64_GOT_TLSGD16;
@@ -2472,7 +2592,7 @@
 
   TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
   if (TOCstart == 0)
-    TOCstart = ppc64_elf_toc (input_section->output_section->owner);
+    TOCstart = ppc64_elf_set_toc (NULL, input_section->output_section->owner);
 
   /* Subtract the TOC base address.  */
   reloc_entry->addend -= TOCstart + TOC_BASE_OFF;
@@ -2495,7 +2615,7 @@
 
   TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
   if (TOCstart == 0)
-    TOCstart = ppc64_elf_toc (input_section->output_section->owner);
+    TOCstart = ppc64_elf_set_toc (NULL, input_section->output_section->owner);
 
   /* Subtract the TOC base address.  */
   reloc_entry->addend -= TOCstart + TOC_BASE_OFF;
@@ -2522,7 +2642,7 @@
 
   TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
   if (TOCstart == 0)
-    TOCstart = ppc64_elf_toc (input_section->output_section->owner);
+    TOCstart = ppc64_elf_set_toc (NULL, input_section->output_section->owner);
 
   octets = reloc_entry->address * bfd_octets_per_byte (abfd);
   bfd_put_64 (abfd, TOCstart + TOC_BASE_OFF, (bfd_byte *) data + octets);
@@ -2615,8 +2735,13 @@
      sections means we potentially need one of these for each input bfd.  */
   struct got_entry tlsld_got;
 
-  /* A copy of relocs before they are modified for --emit-relocs.  */
-  Elf_Internal_Rela *opd_relocs;
+  union {
+    /* A copy of relocs before they are modified for --emit-relocs.  */
+    Elf_Internal_Rela *relocs;
+
+    /* Section contents.  */
+    bfd_byte *contents;
+  } opd;
 
   /* Nonzero if this bfd has small toc/got relocs, ie. that expect
      the reloc to be in the range -32768 to 32767.  */
@@ -2677,10 +2802,10 @@
     return FALSE;
 
   /* pr_cursig */
-  elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+  elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
   /* pr_pid */
-  elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32);
+  elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 32);
 
   /* pr_reg */
   offset = 112;
@@ -2697,11 +2822,11 @@
   if (note->descsz != 136)
     return FALSE;
 
-  elf_tdata (abfd)->core_pid
+  elf_tdata (abfd)->core->pid
     = bfd_get_32 (abfd, note->descdata + 24);
-  elf_tdata (abfd)->core_program
+  elf_tdata (abfd)->core->program
     = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
-  elf_tdata (abfd)->core_command
+  elf_tdata (abfd)->core->command
     = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
 
   return TRUE;
@@ -2836,6 +2961,19 @@
     return &ppc64_elf_section_data (sec)->u.opd;
   return NULL;
 }
+
+static inline int
+abiversion (bfd *abfd)
+{
+  return elf_elfheader (abfd)->e_flags & EF_PPC64_ABI;
+}
+
+static inline void
+set_abiversion (bfd *abfd, int ver)
+{
+  elf_elfheader (abfd)->e_flags &= ~EF_PPC64_ABI;
+  elf_elfheader (abfd)->e_flags |= ver & EF_PPC64_ABI;
+}
 
 /* Parameters for the qsort hook.  */
 static bfd_boolean synthetic_relocatable;
@@ -2982,15 +3120,19 @@
   long count;
   char *names;
   long symcount, codesecsym, codesecsymend, secsymend, opdsymend;
-  asection *opd;
+  asection *opd = NULL;
   bfd_boolean relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0;
   asymbol **syms;
+  int abi = abiversion (abfd);
 
   *ret = NULL;
 
-  opd = bfd_get_section_by_name (abfd, ".opd");
-  if (opd == NULL)
-    return 0;
+  if (abi < 2)
+    {
+      opd = bfd_get_section_by_name (abfd, ".opd");
+      if (opd == NULL && abi == 1)
+	return 0;
+    }
 
   symcount = static_count;
   if (!relocatable)
@@ -3159,20 +3301,18 @@
   else
     {
       bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
-      bfd_byte *contents;
+      bfd_byte *contents = NULL;
       size_t size;
       long plt_count = 0;
       bfd_vma glink_vma = 0, resolv_vma = 0;
       asection *dynamic, *glink = NULL, *relplt = NULL;
       arelent *p;
 
-      if (!bfd_malloc_and_get_section (abfd, opd, &contents))
+      if (opd != NULL && !bfd_malloc_and_get_section (abfd, opd, &contents))
 	{
+	free_contents_and_exit:
 	  if (contents)
-	    {
-	    free_contents_and_exit:
-	      free (contents);
-	    }
+	    free (contents);
 	  count = -1;
 	  goto done;
 	}
@@ -3221,9 +3361,9 @@
 
 	      if (dyn.d_tag == DT_PPC64_GLINK)
 		{
-		  /* The first glink stub starts at offset 32; see comment in
-		     ppc64_elf_finish_dynamic_sections. */
-		  glink_vma = dyn.d_un.d_val + 32;
+		  /* The first glink stub starts at offset 32; see
+		     comment in ppc64_elf_finish_dynamic_sections. */
+		  glink_vma = dyn.d_un.d_val + GLINK_CALL_STUB_SIZE - 8 * 4;
 		  /* The .glink section usually does not survive the final
 		     link; search for the section (usually .text) where the
 		     glink stubs now reside.  */
@@ -3241,13 +3381,21 @@
 	  /* Determine __glink trampoline by reading the relative branch
 	     from the first glink stub.  */
 	  bfd_byte buf[4];
-	  if (bfd_get_section_contents (abfd, glink, buf,
-					glink_vma + 4 - glink->vma, 4))
+	  unsigned int off = 0;
+
+	  while (bfd_get_section_contents (abfd, glink, buf,
+					   glink_vma + off - glink->vma, 4))
 	    {
 	      unsigned int insn = bfd_get_32 (abfd, buf);
 	      insn ^= B_DOT;
 	      if ((insn & ~0x3fffffc) == 0)
-		resolv_vma = glink_vma + 4 + (insn ^ 0x2000000) - 0x2000000;
+		{
+		  resolv_vma = glink_vma + off + (insn ^ 0x2000000) - 0x2000000;
+		  break;
+		}
+	      off += 4;
+	      if (off > 4)
+		break;
 	    }
 
 	  if (resolv_vma)
@@ -3259,7 +3407,7 @@
 	      slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
 	      if (! (*slurp_relocs) (abfd, relplt, dyn_syms, TRUE))
 		goto free_contents_and_exit;
-	
+
 	      plt_count = relplt->size / sizeof (Elf64_External_Rela);
 	      size += plt_count * sizeof (asymbol);
 
@@ -3400,8 +3548,13 @@
 	      memcpy (names, "@plt", sizeof ("@plt"));
 	      names += sizeof ("@plt");
 	      s++;
-	      glink_vma += 8;
-	      if (i >= 0x8000)
+	      if (abi < 2)
+		{
+		  glink_vma += 8;
+		  if (i >= 0x8000)
+		    glink_vma += 4;
+		}
+	      else
 		glink_vma += 4;
 	    }
 	  count += plt_count;
@@ -3452,13 +3605,13 @@
    .
    .
    .	.foo_stub:
-   .		addis	12,2,Lfoo@toc@ha	# in practice, the call stub
-   .		addi	12,12,Lfoo@toc@l	# is slightly optimized, but
-   .		std	2,40(1)			# this is the general idea
-   .		ld	11,0(12)
-   .		ld	2,8(12)
-   .		mtctr	11
-   .		ld	11,16(12)
+   .		std	2,40(1)			# in practice, the call stub
+   .		addis	11,2,Lfoo@toc@ha	# is slightly optimized, but
+   .		addi	11,11,Lfoo@toc@l	# this is the general idea
+   .		ld	12,0(11)
+   .		ld	2,8(11)
+   .		mtctr	12
+   .		ld	11,16(11)
    .		bctr
    .
    .		.section .plt
@@ -3509,6 +3662,8 @@
     case R_PPC64_TPREL16_HA:
     case R_PPC64_TPREL16_DS:
     case R_PPC64_TPREL16_LO_DS:
+    case R_PPC64_TPREL16_HIGH:
+    case R_PPC64_TPREL16_HIGHA:
     case R_PPC64_TPREL16_HIGHER:
     case R_PPC64_TPREL16_HIGHERA:
     case R_PPC64_TPREL16_HIGHEST:
@@ -3548,21 +3703,21 @@
    ppc_stub_plt_branch:
    Similar to the above, but a 24 bit branch in the stub section won't
    reach its destination.
-   .	addis	%r12,%r2,xxx@toc@ha
-   .	ld	%r11,xxx@toc@l(%r12)
-   .	mtctr	%r11
+   .	addis	%r11,%r2,xxx@toc@ha
+   .	ld	%r12,xxx@toc@l(%r11)
+   .	mtctr	%r12
    .	bctr
 
    ppc_stub_plt_call:
    Used to call a function in a shared library.  If it so happens that
    the plt entry referenced crosses a 64k boundary, then an extra
-   "addi %r12,%r12,xxx@toc@l" will be inserted before the "mtctr".
-   .	addis	%r12,%r2,xxx@toc@ha
+   "addi %r11,%r11,xxx@toc@l" will be inserted before the "mtctr".
    .	std	%r2,40(%r1)
-   .	ld	%r11,xxx+0@toc@l(%r12)
-   .	mtctr	%r11
-   .	ld	%r2,xxx+8@toc@l(%r12)
-   .	ld	%r11,xxx+16@toc@l(%r12)
+   .	addis	%r11,%r2,xxx@toc@ha
+   .	ld	%r12,xxx+0@toc@l(%r11)
+   .	mtctr	%r12
+   .	ld	%r2,xxx+8@toc@l(%r11)
+   .	ld	%r11,xxx+16@toc@l(%r11)
    .	bctr
 
    ppc_stub_long_branch and ppc_stub_plt_branch may also have additional
@@ -3575,11 +3730,11 @@
 
    A ppc_stub_plt_branch with an r2 offset looks like:
    .	std	%r2,40(%r1)
-   .	addis	%r12,%r2,xxx@toc@ha
-   .	ld	%r11,xxx@toc@l(%r12)
+   .	addis	%r11,%r2,xxx@toc@ha
+   .	ld	%r12,xxx@toc@l(%r11)
    .	addis	%r2,%r2,off@ha
    .	addi	%r2,%r2,off@l
-   .	mtctr	%r11
+   .	mtctr	%r12
    .	bctr
 
    In cases where the "addis" instruction would add zero, the "addis" is
@@ -3618,12 +3773,12 @@
   struct ppc_link_hash_entry *h;
   struct plt_entry *plt_ent;
 
-  /* And the reloc addend that this was derived from.  */
-  bfd_vma addend;
-
   /* Where this stub is being called from, or, in the case of combined
      stub sections, the first input section in the group.  */
   asection *id_sec;
+
+  /* Symbol st_other.  */
+  unsigned char other;
 };
 
 struct ppc_branch_hash_entry {
@@ -3638,6 +3793,21 @@
   unsigned int iter;
 };
 
+/* Used to track dynamic relocations for local symbols.  */
+struct ppc_dyn_relocs
+{
+  struct ppc_dyn_relocs *next;
+
+  /* The input section of the reloc.  */
+  asection *sec;
+
+  /* Total number of relocs copied for the input section.  */
+  unsigned int count : 31;
+
+  /* Whether this entry is for STT_GNU_IFUNC symbols.  */
+  unsigned int ifunc : 1;
+};
+
 struct ppc_link_hash_entry
 {
   struct elf_link_hash_entry elf;
@@ -3739,12 +3909,7 @@
   /* List of input sections for each output section.  */
   asection **input_list;
 
-  /* Short-cuts to get to dynamic linker sections.  */
-  asection *got;
-  asection *plt;
-  asection *relplt;
-  asection *iplt;
-  asection *reliplt;
+  /* Shortcuts to get to dynamic linker sections.  */
   asection *dynbss;
   asection *relbss;
   asection *glink;
@@ -3769,6 +3934,9 @@
   /* Alignment of PLT call stubs.  */
   unsigned int plt_stub_align:4;
 
+  /* Set if we're linking code with function descriptors.  */
+  unsigned int opd_abi:1;
+
   /* Set if PLT call stubs should load r11.  */
   unsigned int plt_static_chain:1;
 
@@ -3864,7 +4032,9 @@
       eh->target_value = 0;
       eh->target_section = NULL;
       eh->h = NULL;
+      eh->plt_ent = NULL;
       eh->id_sec = NULL;
+      eh->other = 0;
     }
 
   return entry;
@@ -4040,12 +4210,88 @@
   bfd_hash_table_free (&htab->branch_hash_table);
   if (htab->tocsave_htab)
     htab_delete (htab->tocsave_htab);
-  _bfd_generic_link_hash_table_free (hash);
+  _bfd_elf_link_hash_table_free (hash);
+}
+
+/* Create sections for linker generated code.  */
+
+static bfd_boolean
+create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
+{
+  struct ppc_link_hash_table *htab;
+  flagword flags;
+
+  htab = ppc_hash_table (info);
+
+  /* Create .sfpr for code to save and restore fp regs.  */
+  flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
+	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+  htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr",
+						   flags);
+  if (htab->sfpr == NULL
+      || ! bfd_set_section_alignment (dynobj, htab->sfpr, 2))
+    return FALSE;
+
+  /* Create .glink for lazy dynamic linking support.  */
+  htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink",
+						    flags);
+  if (htab->glink == NULL
+      || ! bfd_set_section_alignment (dynobj, htab->glink, 3))
+    return FALSE;
+
+  if (!info->no_ld_generated_unwind_info)
+    {
+      flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
+	       | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+      htab->glink_eh_frame = bfd_make_section_anyway_with_flags (dynobj,
+								 ".eh_frame",
+								 flags);
+      if (htab->glink_eh_frame == NULL
+	  || !bfd_set_section_alignment (dynobj, htab->glink_eh_frame, 2))
+	return FALSE;
+    }
+
+  flags = SEC_ALLOC | SEC_LINKER_CREATED;
+  htab->elf.iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags);
+  if (htab->elf.iplt == NULL
+      || ! bfd_set_section_alignment (dynobj, htab->elf.iplt, 3))
+    return FALSE;
+
+  flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
+	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+  htab->elf.irelplt
+    = bfd_make_section_anyway_with_flags (dynobj, ".rela.iplt", flags);
+  if (htab->elf.irelplt == NULL
+      || ! bfd_set_section_alignment (dynobj, htab->elf.irelplt, 3))
+    return FALSE;
+
+  /* Create branch lookup table for plt_branch stubs.  */
+  flags = (SEC_ALLOC | SEC_LOAD
+	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+  htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt",
+						   flags);
+  if (htab->brlt == NULL
+      || ! bfd_set_section_alignment (dynobj, htab->brlt, 3))
+    return FALSE;
+
+  if (!info->shared)
+    return TRUE;
+
+  flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
+	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+  htab->relbrlt = bfd_make_section_anyway_with_flags (dynobj,
+						      ".rela.branch_lt",
+						      flags);
+  if (htab->relbrlt == NULL
+      || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
+    return FALSE;
+
+  return TRUE;
 }
 
 /* Satisfy the ELF linker by filling in some fields in our fake bfd.  */
 
-void
+bfd_boolean
 ppc64_elf_init_stub_bfd (bfd *abfd, struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
@@ -4057,9 +4303,14 @@
    the start of the output TOC section.  */
   htab = ppc_hash_table (info);
   if (htab == NULL)
-    return;
+    return FALSE;
   htab->stub_bfd = abfd;
   htab->elf.dynobj = abfd;
+
+  if (info->relocatable)
+    return TRUE;
+
+  return create_linkage_sections (htab->elf.dynobj, info);
 }
 
 /* Build a name for an entry in the stub hash table.  */
@@ -4071,7 +4322,7 @@
 	       const Elf_Internal_Rela *rel)
 {
   char *stub_name;
-  bfd_size_type len;
+  ssize_t len;
 
   /* rel->r_addend is actually 64 bit, but who uses more than +/- 2^31
      offsets from a sym as a branch target?  In fact, we could
@@ -4085,10 +4336,10 @@
       if (stub_name == NULL)
 	return stub_name;
 
-      sprintf (stub_name, "%08x.%s+%x",
-	       input_section->id & 0xffffffff,
-	       h->elf.root.root.string,
-	       (int) rel->r_addend & 0xffffffff);
+      len = sprintf (stub_name, "%08x.%s+%x",
+		     input_section->id & 0xffffffff,
+		     h->elf.root.root.string,
+		     (int) rel->r_addend & 0xffffffff);
     }
   else
     {
@@ -4097,13 +4348,13 @@
       if (stub_name == NULL)
 	return stub_name;
 
-      sprintf (stub_name, "%08x.%x:%x+%x",
-	       input_section->id & 0xffffffff,
-	       sym_sec->id & 0xffffffff,
-	       (int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
-	       (int) rel->r_addend & 0xffffffff);
+      len = sprintf (stub_name, "%08x.%x:%x+%x",
+		     input_section->id & 0xffffffff,
+		     sym_sec->id & 0xffffffff,
+		     (int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
+		     (int) rel->r_addend & 0xffffffff);
     }
-  if (stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
+  if (len > 2 && stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
     stub_name[len - 2] = 0;
   return stub_name;
 }
@@ -4209,85 +4460,6 @@
   return stub_entry;
 }
 
-/* Create sections for linker generated code.  */
-
-static bfd_boolean
-create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
-{
-  struct ppc_link_hash_table *htab;
-  flagword flags;
-
-  htab = ppc_hash_table (info);
-  if (htab == NULL)
-    return FALSE;
-
-  /* Create .sfpr for code to save and restore fp regs.  */
-  flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
-	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-  htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr",
-						   flags);
-  if (htab->sfpr == NULL
-      || ! bfd_set_section_alignment (dynobj, htab->sfpr, 2))
-    return FALSE;
-
-  /* Create .glink for lazy dynamic linking support.  */
-  htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink",
-						    flags);
-  if (htab->glink == NULL
-      || ! bfd_set_section_alignment (dynobj, htab->glink, 3))
-    return FALSE;
-
-  if (!info->no_ld_generated_unwind_info)
-    {
-      flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
-	       | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-      htab->glink_eh_frame = bfd_make_section_anyway_with_flags (dynobj,
-								 ".eh_frame",
-								 flags);
-      if (htab->glink_eh_frame == NULL
-	  || !bfd_set_section_alignment (dynobj, htab->glink_eh_frame, 2))
-	return FALSE;
-    }
-
-  flags = SEC_ALLOC | SEC_LINKER_CREATED;
-  htab->iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags);
-  if (htab->iplt == NULL
-      || ! bfd_set_section_alignment (dynobj, htab->iplt, 3))
-    return FALSE;
-
-  flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
-	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-  htab->reliplt = bfd_make_section_anyway_with_flags (dynobj,
-						      ".rela.iplt",
-						      flags);
-  if (htab->reliplt == NULL
-      || ! bfd_set_section_alignment (dynobj, htab->reliplt, 3))
-    return FALSE;
-
-  /* Create branch lookup table for plt_branch stubs.  */
-  flags = (SEC_ALLOC | SEC_LOAD
-	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-  htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt",
-						   flags);
-  if (htab->brlt == NULL
-      || ! bfd_set_section_alignment (dynobj, htab->brlt, 3))
-    return FALSE;
-
-  if (!info->shared)
-    return TRUE;
-
-  flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
-	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-  htab->relbrlt = bfd_make_section_anyway_with_flags (dynobj,
-						      ".rela.branch_lt",
-						      flags);
-  if (htab->relbrlt == NULL
-      || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
-    return FALSE;
-
-  return TRUE;
-}
-
 /* Create .got and .rela.got sections in ABFD, and .got in dynobj if
    not already done.  */
 
@@ -4303,15 +4475,9 @@
   if (htab == NULL)
     return FALSE;
 
-  if (!htab->got)
-    {
-      if (! _bfd_elf_create_got_section (htab->elf.dynobj, info))
-	return FALSE;
-
-      htab->got = bfd_get_linker_section (htab->elf.dynobj, ".got");
-      if (!htab->got)
-	abort ();
-    }
+  if (!htab->elf.sgot
+      && !_bfd_elf_create_got_section (htab->elf.dynobj, info))
+    return FALSE;
 
   flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
 	   | SEC_LINKER_CREATED);
@@ -4346,15 +4512,11 @@
   if (htab == NULL)
     return FALSE;
 
-  if (!htab->got)
-    htab->got = bfd_get_linker_section (dynobj, ".got");
-  htab->plt = bfd_get_linker_section (dynobj, ".plt");
-  htab->relplt = bfd_get_linker_section (dynobj, ".rela.plt");
   htab->dynbss = bfd_get_linker_section (dynobj, ".dynbss");
   if (!info->shared)
     htab->relbss = bfd_get_linker_section (dynobj, ".rela.bss");
 
-  if (!htab->got || !htab->plt || !htab->relplt || !htab->dynbss
+  if (!htab->elf.sgot || !htab->elf.splt || !htab->elf.srelplt || !htab->dynbss
       || (!info->shared && !htab->relbss))
     abort ();
 
@@ -4449,6 +4611,7 @@
   edir->elf.ref_regular |= eind->elf.ref_regular;
   edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
   edir->elf.needs_plt |= eind->elf.needs_plt;
+  edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed;
 
   /* Copy over any dynamic relocs we may have on the indirect sym.  */
   if (eind->dyn_relocs != NULL)
@@ -4485,7 +4648,7 @@
   /* If we were called to copy over info for a weak sym, that's all.
      You might think dyn_relocs need not be copied over;  After all,
      both syms will be dynamic or both non-dynamic so we're just
-     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS 
+     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS
      code in ppc64_elf_adjust_dynamic_symbol needs to check for
      dyn_relocs in read-only sections, and it does so on what is the
      DIR sym here.  */
@@ -4607,7 +4770,7 @@
 ppc64_elf_add_symbol_hook (bfd *ibfd,
 			   struct bfd_link_info *info,
 			   Elf_Internal_Sym *isym,
-			   const char **name ATTRIBUTE_UNUSED,
+			   const char **name,
 			   flagword *flags ATTRIBUTE_UNUSED,
 			   asection **sec,
 			   bfd_vma *value ATTRIBUTE_UNUSED)
@@ -4627,9 +4790,35 @@
 	   && strcmp ((*sec)->name, ".opd") == 0)
     isym->st_info = ELF_ST_INFO (ELF_ST_BIND (isym->st_info), STT_FUNC);
 
+  if ((STO_PPC64_LOCAL_MASK & isym->st_other) != 0)
+    {
+      if (abiversion (ibfd) == 0)
+	set_abiversion (ibfd, 2);
+      else if (abiversion (ibfd) == 1)
+	{
+	  info->callbacks->einfo (_("%P: symbol '%s' has invalid st_other"
+				    " for ABI version 1\n"), name);
+	  bfd_set_error (bfd_error_bad_value);
+	  return FALSE;
+	}
+    }
+
   return TRUE;
 }
 
+/* Merge non-visibility st_other attributes: local entry point.  */
+
+static void
+ppc64_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
+				  const Elf_Internal_Sym *isym,
+				  bfd_boolean definition,
+				  bfd_boolean dynamic)
+{
+  if (definition && !dynamic)
+    h->other = ((isym->st_other & ~ELF_ST_VISIBILITY (-1))
+		| ELF_ST_VISIBILITY (h->other));
+}
+
 /* This function makes an old ABI object reference to ".bar" cause the
    inclusion of a new ABI object archive that defines "bar".
    NAME is a symbol defined in an archive.  Return a symbol in the hash
@@ -4753,7 +4942,12 @@
       while ((eh = *p) != NULL)
 	{
 	  *p = NULL;
-	  if (!add_symbol_adjust (eh, info))
+	  if (&eh->elf == htab->elf.hgot)
+	    ;
+	  else if (htab->elf.hgot == NULL
+		   && strcmp (eh->elf.root.root.string, ".TOC.") == 0)
+	    htab->elf.hgot = &eh->elf;
+	  else if (!add_symbol_adjust (eh, info))
 	    return FALSE;
 	  p = &eh->u.next_dot_sym;
 	}
@@ -4781,16 +4975,20 @@
    not to be needed.  */
 
 static bfd_boolean
-ppc64_elf_as_needed_cleanup (bfd *ibfd ATTRIBUTE_UNUSED,
-			     struct bfd_link_info *info)
+ppc64_elf_notice_as_needed (bfd *ibfd,
+			    struct bfd_link_info *info,
+			    enum notice_asneeded_action act)
 {
-  struct ppc_link_hash_table *htab = ppc_hash_table (info);
+  if (act == notice_not_needed)
+    {
+      struct ppc_link_hash_table *htab = ppc_hash_table (info);
 
-  if (htab == NULL)
-    return FALSE;
+      if (htab == NULL)
+	return FALSE;
 
-  htab->dot_syms = NULL;
-  return TRUE;
+      htab->dot_syms = NULL;
+    }
+  return _bfd_elf_notice_as_needed (ibfd, info, act);
 }
 
 /* If --just-symbols against a final linked binary, then assume we need
@@ -4803,10 +5001,8 @@
       && (sec->owner->flags & (EXEC_P | DYNAMIC)) != 0
       && is_ppc64_elf (sec->owner))
     {
-      asection *got = bfd_get_section_by_name (sec->owner, ".got");
-      if (got != NULL
-	  && got->size >= elf_backend_got_header_size
-	  && bfd_get_section_by_name (sec->owner, ".opd") != NULL)
+      if (abiversion (sec->owner) >= 2
+	  || bfd_get_section_by_name (sec->owner, ".opd") != NULL)
 	sec->has_toc_reloc = 1;
     }
   _bfd_elf_link_just_syms (sec, info);
@@ -4956,6 +5152,15 @@
 	 information about the associated function section.  */
       bfd_size_type amt;
 
+      if (abiversion (abfd) == 0)
+	set_abiversion (abfd, 1);
+      else if (abiversion (abfd) == 2)
+	{
+	  info->callbacks->einfo (_("%P: .opd not allowed in ABI version %d\n"),
+				  abiversion (abfd));
+	  bfd_set_error (bfd_error_bad_value);
+	  return FALSE;
+	}
       amt = sec->size * sizeof (*opd_sym_map) / 8;
       opd_sym_map = bfd_zalloc (abfd, amt);
       if (opd_sym_map == NULL)
@@ -4965,10 +5170,6 @@
       ppc64_elf_section_data (sec)->sec_type = sec_opd;
     }
 
-  if (htab->sfpr == NULL
-      && !create_linkage_sections (htab->elf.dynobj, info))
-    return FALSE;
-
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
@@ -4986,6 +5187,13 @@
 	{
 	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
 	  h = elf_follow_link (h);
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
+
+	  if (h == htab->elf.hgot)
+	    sec->has_toc_reloc = 1;
 	}
 
       tls_type = 0;
@@ -5131,6 +5339,14 @@
 	    if (!update_local_sym_info (abfd, symtab_hdr, r_symndx,
 					rel->r_addend, tls_type))
 	      return FALSE;
+
+	  /* We may also need a plt entry if the symbol turns out to be
+	     an ifunc.  */
+	  if (h != NULL && !info->shared && abiversion (abfd) == 2)
+	    {
+	      if (!update_plt_info (abfd, &h->plt.plist, rel->r_addend))
+		return FALSE;
+	    }
 	  break;
 
 	case R_PPC64_PLT16_HA:
@@ -5176,6 +5392,8 @@
 	case R_PPC64_DTPREL16_HA:
 	case R_PPC64_DTPREL16_DS:
 	case R_PPC64_DTPREL16_LO_DS:
+	case R_PPC64_DTPREL16_HIGH:
+	case R_PPC64_DTPREL16_HIGHA:
 	case R_PPC64_DTPREL16_HIGHER:
 	case R_PPC64_DTPREL16_HIGHERA:
 	case R_PPC64_DTPREL16_HIGHEST:
@@ -5336,6 +5554,8 @@
 	case R_PPC64_TPREL16_HA:
 	case R_PPC64_TPREL16_DS:
 	case R_PPC64_TPREL16_LO_DS:
+	case R_PPC64_TPREL16_HIGH:
+	case R_PPC64_TPREL16_HIGHA:
 	case R_PPC64_TPREL16_HIGHER:
 	case R_PPC64_TPREL16_HIGHERA:
 	case R_PPC64_TPREL16_HIGHEST:
@@ -5379,22 +5599,35 @@
 	    }
 	  /* Fall through.  */
 
-	case R_PPC64_REL30:
-	case R_PPC64_REL32:
-	case R_PPC64_REL64:
-	case R_PPC64_ADDR14:
-	case R_PPC64_ADDR14_BRNTAKEN:
-	case R_PPC64_ADDR14_BRTAKEN:
 	case R_PPC64_ADDR16:
 	case R_PPC64_ADDR16_DS:
 	case R_PPC64_ADDR16_HA:
 	case R_PPC64_ADDR16_HI:
+	case R_PPC64_ADDR16_HIGH:
+	case R_PPC64_ADDR16_HIGHA:
 	case R_PPC64_ADDR16_HIGHER:
 	case R_PPC64_ADDR16_HIGHERA:
 	case R_PPC64_ADDR16_HIGHEST:
 	case R_PPC64_ADDR16_HIGHESTA:
 	case R_PPC64_ADDR16_LO:
 	case R_PPC64_ADDR16_LO_DS:
+	  if (h != NULL && !info->shared && abiversion (abfd) == 2
+	      && rel->r_addend == 0)
+	    {
+	      /* We may need a .plt entry if this reloc refers to a
+		 function in a shared lib.  */
+	      if (!update_plt_info (abfd, &h->plt.plist, rel->r_addend))
+		return FALSE;
+	      h->pointer_equality_needed = 1;
+	    }
+	  /* Fall through.  */
+
+	case R_PPC64_REL30:
+	case R_PPC64_REL32:
+	case R_PPC64_REL64:
+	case R_PPC64_ADDR14:
+	case R_PPC64_ADDR14_BRNTAKEN:
+	case R_PPC64_ADDR14_BRTAKEN:
 	case R_PPC64_ADDR24:
 	case R_PPC64_ADDR32:
 	case R_PPC64_UADDR16:
@@ -5434,7 +5667,7 @@
 	  if ((info->shared
 	       && (must_be_dyn_reloc (info, r_type)
 		   || (h != NULL
-		       && (! info->symbolic
+		       && (!SYMBOLIC_BIND (info, h)
 			   || h->root.type == bfd_link_hash_defweak
 			   || !h->def_regular))))
 	      || (ELIMINATE_COPY_RELOCS
@@ -5445,9 +5678,6 @@
 	      || (!info->shared
 		  && ifunc != NULL))
 	    {
-	      struct elf_dyn_relocs *p;
-	      struct elf_dyn_relocs **head;
-
 	      /* We must copy these reloc types into the output file.
 		 Create a reloc section in dynobj and make room for
 		 this reloc.  */
@@ -5464,13 +5694,34 @@
 		 relocations we need for this symbol.  */
 	      if (h != NULL)
 		{
+		  struct elf_dyn_relocs *p;
+		  struct elf_dyn_relocs **head;
+
 		  head = &((struct ppc_link_hash_entry *) h)->dyn_relocs;
+		  p = *head;
+		  if (p == NULL || p->sec != sec)
+		    {
+		      p = bfd_alloc (htab->elf.dynobj, sizeof *p);
+		      if (p == NULL)
+			return FALSE;
+		      p->next = *head;
+		      *head = p;
+		      p->sec = sec;
+		      p->count = 0;
+		      p->pc_count = 0;
+		    }
+		  p->count += 1;
+		  if (!must_be_dyn_reloc (info, r_type))
+		    p->pc_count += 1;
 		}
 	      else
 		{
 		  /* Track dynamic relocs needed for local syms too.
 		     We really need local syms available to do this
 		     easily.  Oh well.  */
+		  struct ppc_dyn_relocs *p;
+		  struct ppc_dyn_relocs **head;
+		  bfd_boolean is_ifunc;
 		  asection *s;
 		  void *vpp;
 		  Elf_Internal_Sym *isym;
@@ -5485,25 +5736,24 @@
 		    s = sec;
 
 		  vpp = &elf_section_data (s)->local_dynrel;
-		  head = (struct elf_dyn_relocs **) vpp;
+		  head = (struct ppc_dyn_relocs **) vpp;
+		  is_ifunc = ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC;
+		  p = *head;
+		  if (p != NULL && p->sec == sec && p->ifunc != is_ifunc)
+		    p = p->next;
+		  if (p == NULL || p->sec != sec || p->ifunc != is_ifunc)
+		    {
+		      p = bfd_alloc (htab->elf.dynobj, sizeof *p);
+		      if (p == NULL)
+			return FALSE;
+		      p->next = *head;
+		      *head = p;
+		      p->sec = sec;
+		      p->ifunc = is_ifunc;
+		      p->count = 0;
+		    }
+		  p->count += 1;
 		}
-
-	      p = *head;
-	      if (p == NULL || p->sec != sec)
-		{
-		  p = bfd_alloc (htab->elf.dynobj, sizeof *p);
-		  if (p == NULL)
-		    return FALSE;
-		  p->next = *head;
-		  *head = p;
-		  p->sec = sec;
-		  p->count = 0;
-		  p->pc_count = 0;
-		}
-
-	      p->count += 1;
-	      if (!must_be_dyn_reloc (info, r_type))
-		p->pc_count += 1;
 	    }
 	  break;
 
@@ -5515,6 +5765,78 @@
   return TRUE;
 }
 
+/* Merge backend specific data from an object file to the output
+   object file when linking.  */
+
+static bfd_boolean
+ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+{
+  unsigned long iflags, oflags;
+
+  if ((ibfd->flags & BFD_LINKER_CREATED) != 0)
+    return TRUE;
+
+  if (!is_ppc64_elf (ibfd) || !is_ppc64_elf (obfd))
+    return TRUE;
+
+  if (!_bfd_generic_verify_endian_match (ibfd, obfd))
+    return FALSE;
+
+  iflags = elf_elfheader (ibfd)->e_flags;
+  oflags = elf_elfheader (obfd)->e_flags;
+
+  if (!elf_flags_init (obfd) || oflags == 0)
+    {
+      elf_flags_init (obfd) = TRUE;
+      elf_elfheader (obfd)->e_flags = iflags;
+    }
+  else if (iflags == oflags || iflags == 0)
+    ;
+  else if (iflags & ~EF_PPC64_ABI)
+    {
+      (*_bfd_error_handler)
+	(_("%B uses unknown e_flags 0x%lx"), ibfd, iflags);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
+  else
+    {
+      (*_bfd_error_handler)
+	(_("%B: ABI version %ld is not compatible with ABI version %ld output"),
+	 ibfd, iflags, oflags);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
+
+  /* Merge Tag_compatibility attributes and any common GNU ones.  */
+  _bfd_elf_merge_object_attributes (ibfd, obfd);
+
+  return TRUE;
+}
+
+static bfd_boolean
+ppc64_elf_print_private_bfd_data (bfd *abfd, void *ptr)
+{
+  /* Print normal ELF private data.  */
+  _bfd_elf_print_private_bfd_data (abfd, ptr);
+
+  if (elf_elfheader (abfd)->e_flags != 0)
+    {
+      FILE *file = ptr;
+
+      /* xgettext:c-format */
+      fprintf (file, _("private flags = 0x%lx:"),
+	       elf_elfheader (abfd)->e_flags);
+
+      if ((elf_elfheader (abfd)->e_flags & EF_PPC64_ABI) != 0)
+	fprintf (file, _(" [abiv%ld]"),
+		 elf_elfheader (abfd)->e_flags & EF_PPC64_ABI);
+      fputc ('\n', file);
+    }
+
+  return TRUE;
+}
+
 /* OFFSET in OPD_SEC specifies a function descriptor.  Return the address
    of the code entry point, and its section.  */
 
@@ -5534,12 +5856,16 @@
      at a final linked executable with addr2line or somesuch.  */
   if (opd_sec->reloc_count == 0)
     {
-      char buf[8];
+      bfd_byte *contents = ppc64_elf_tdata (opd_bfd)->opd.contents;
 
-      if (!bfd_get_section_contents (opd_bfd, opd_sec, buf, offset, 8))
-	return (bfd_vma) -1;
+      if (contents == NULL)
+	{
+	  if (!bfd_malloc_and_get_section (opd_bfd, opd_sec, &contents))
+	    return (bfd_vma) -1;
+	  ppc64_elf_tdata (opd_bfd)->opd.contents = contents;
+	}
 
-      val = bfd_get_64 (opd_bfd, buf);
+      val = bfd_get_64 (opd_bfd, contents + offset);
       if (code_sec != NULL)
 	{
 	  asection *sec, *likely = NULL;
@@ -5571,7 +5897,7 @@
 
   BFD_ASSERT (is_ppc64_elf (opd_bfd));
 
-  relocs = ppc64_elf_tdata (opd_bfd)->opd_relocs;
+  relocs = ppc64_elf_tdata (opd_bfd)->opd.relocs;
   if (relocs == NULL)
     relocs = _bfd_elf_link_read_relocs (opd_bfd, opd_sec, NULL, NULL, TRUE);
 
@@ -5627,11 +5953,30 @@
 
 		  sym_hashes = elf_sym_hashes (opd_bfd);
 		  rh = sym_hashes[symndx - symtab_hdr->sh_info];
-		  rh = elf_follow_link (rh);
-		  BFD_ASSERT (rh->root.type == bfd_link_hash_defined
-			      || rh->root.type == bfd_link_hash_defweak);
-		  val = rh->root.u.def.value;
-		  sec = rh->root.u.def.section;
+		  if (rh != NULL)
+		    {
+		      rh = elf_follow_link (rh);
+		      BFD_ASSERT (rh->root.type == bfd_link_hash_defined
+				  || rh->root.type == bfd_link_hash_defweak);
+		      val = rh->root.u.def.value;
+		      sec = rh->root.u.def.section;
+		    }
+		  else
+		    {
+		      /* Handle the odd case where we can be called
+			 during bfd_elf_link_add_symbols before the
+			 symbol hashes have been fully populated.  */
+		      Elf_Internal_Sym *sym;
+
+		      sym = bfd_elf_get_elf_syms (opd_bfd, symtab_hdr, 1,
+						  symndx, NULL, NULL, NULL);
+		      if (sym == NULL)
+			break;
+
+		      val = sym->st_value;
+		      sec = bfd_section_from_elf_index (opd_bfd, sym->st_shndx);
+		      free (sym);
+		    }
 		}
 	      val += look->r_addend;
 	      if (code_off != NULL)
@@ -6174,7 +6519,7 @@
 savegpr0_tail (bfd *abfd, bfd_byte *p, int r)
 {
   p = savegpr0 (abfd, p, r);
-  bfd_put_32 (abfd, STD_R0_0R1 + 16, p);
+  bfd_put_32 (abfd, STD_R0_0R1 + STK_LR, p);
   p = p + 4;
   bfd_put_32 (abfd, BLR, p);
   return p + 4;
@@ -6190,7 +6535,7 @@
 static bfd_byte *
 restgpr0_tail (bfd *abfd, bfd_byte *p, int r)
 {
-  bfd_put_32 (abfd, LD_R0_0R1 + 16, p);
+  bfd_put_32 (abfd, LD_R0_0R1 + STK_LR, p);
   p = p + 4;
   p = restgpr0 (abfd, p, r);
   bfd_put_32 (abfd, MTLR_R0, p);
@@ -6245,7 +6590,7 @@
 savefpr0_tail (bfd *abfd, bfd_byte *p, int r)
 {
   p = savefpr (abfd, p, r);
-  bfd_put_32 (abfd, STD_R0_0R1 + 16, p);
+  bfd_put_32 (abfd, STD_R0_0R1 + STK_LR, p);
   p = p + 4;
   bfd_put_32 (abfd, BLR, p);
   return p + 4;
@@ -6261,7 +6606,7 @@
 static bfd_byte *
 restfpr0_tail (bfd *abfd, bfd_byte *p, int r)
 {
-  bfd_put_32 (abfd, LD_R0_0R1 + 16, p);
+  bfd_put_32 (abfd, LD_R0_0R1 + STK_LR, p);
   p = p + 4;
   p = restfpr (abfd, p, r);
   bfd_put_32 (abfd, MTLR_R0, p);
@@ -6488,6 +6833,21 @@
   if (htab == NULL)
     return FALSE;
 
+  if (!info->relocatable
+      && htab->elf.hgot != NULL)
+    {
+      _bfd_elf_link_hash_hide_symbol (info, htab->elf.hgot, TRUE);
+      /* Make .TOC. defined so as to prevent it being made dynamic.
+	 The wrong value here is fixed later in ppc64_elf_set_toc.  */
+      htab->elf.hgot->type = STT_OBJECT;
+      htab->elf.hgot->root.type = bfd_link_hash_defined;
+      htab->elf.hgot->root.u.def.value = 0;
+      htab->elf.hgot->root.u.def.section = bfd_abs_section_ptr;
+      htab->elf.hgot->def_regular = 1;
+      htab->elf.hgot->other = ((htab->elf.hgot->other & ~ELF_ST_VISIBILITY (-1))
+			       | STV_HIDDEN);
+    }
+
   if (htab->sfpr == NULL)
     /* We don't have any relocs.  */
     return TRUE;
@@ -6507,6 +6867,25 @@
   return TRUE;
 }
 
+/* Return true if we have dynamic relocs that apply to read-only sections.  */
+
+static bfd_boolean
+readonly_dynrelocs (struct elf_link_hash_entry *h)
+{
+  struct ppc_link_hash_entry *eh;
+  struct elf_dyn_relocs *p;
+
+  eh = (struct ppc_link_hash_entry *) h;
+  for (p = eh->dyn_relocs; p != NULL; p = p->next)
+    {
+      asection *s = p->sec->output_section;
+
+      if (s != NULL && (s->flags & SEC_READONLY) != 0)
+	return TRUE;
+    }
+  return FALSE;
+}
+
 /* Adjust a symbol defined by a dynamic object and referenced by a
    regular object.  The current definition is in some section of the
    dynamic object, but we're not including those sections.  We have to
@@ -6544,6 +6923,26 @@
 	  h->plt.plist = NULL;
 	  h->needs_plt = 0;
 	}
+      else if (abiversion (info->output_bfd) == 2)
+	{
+	  /* After adjust_dynamic_symbol, non_got_ref set in the
+	     non-shared case means that we have allocated space in
+	     .dynbss for the symbol and thus dyn_relocs for this
+	     symbol should be discarded.
+	     If we get here we know we are making a PLT entry for this
+	     symbol, and in an executable we'd normally resolve
+	     relocations against this symbol to the PLT entry.  Allow
+	     dynamic relocs if the reference is weak, and the dynamic
+	     relocs will not cause text relocation.  */
+	  if (!h->ref_regular_nonweak
+	      && h->non_got_ref
+	      && h->type != STT_GNU_IFUNC
+	      && !readonly_dynrelocs (h))
+	    h->non_got_ref = 0;
+
+	  /* If making a plt entry, then we don't need copy relocs.  */
+	  return TRUE;
+	}
     }
   else
     h->plt.plist = NULL;
@@ -6578,26 +6977,12 @@
   if (!h->def_dynamic || !h->ref_regular || h->def_regular)
     return TRUE;
 
-  if (ELIMINATE_COPY_RELOCS)
+  /* If we didn't find any dynamic relocs in read-only sections, then
+     we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
+  if (ELIMINATE_COPY_RELOCS && !readonly_dynrelocs (h))
     {
-      struct ppc_link_hash_entry * eh;
-      struct elf_dyn_relocs *p;
-
-      eh = (struct ppc_link_hash_entry *) h;
-      for (p = eh->dyn_relocs; p != NULL; p = p->next)
-	{
-	  s = p->sec->output_section;
-	  if (s != NULL && (s->flags & SEC_READONLY) != 0)
-	    break;
-	}
-
-      /* If we didn't find any dynamic relocs in read-only sections, then
-	 we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
-      if (p == NULL)
-	{
-	  h->non_got_ref = 0;
-	  return TRUE;
-	}
+      h->non_got_ref = 0;
+      return TRUE;
     }
 
   if (h->plt.plist != NULL)
@@ -6608,7 +6993,7 @@
 	 sections.  Allow them to proceed, but warn that this might
 	 break at runtime.  */
       info->callbacks->einfo
-	(_("%P: copy reloc against `%s' requires lazy plt linking; "
+	(_("%P: copy reloc against `%T' requires lazy plt linking; "
 	   "avoid setting LD_BIND_NOW=1 or upgrade gcc\n"),
 	 h->root.root.string);
     }
@@ -6948,7 +7333,7 @@
 }
 
 /* Handles decrementing dynamic reloc counts for the reloc specified by
-   R_INFO in section SEC.  If LOCAL_SYMS is NULL, then H and SYM_SEC
+   R_INFO in section SEC.  If LOCAL_SYMS is NULL, then H and SYM
    have already been determined.  */
 
 static bfd_boolean
@@ -6957,11 +7342,10 @@
 		  struct bfd_link_info *info,
 		  Elf_Internal_Sym **local_syms,
 		  struct elf_link_hash_entry *h,
-		  asection *sym_sec)
+		  Elf_Internal_Sym *sym)
 {
   enum elf_ppc64_reloc_type r_type;
-  struct elf_dyn_relocs *p;
-  struct elf_dyn_relocs **pp;
+  asection *sym_sec = NULL;
 
   /* Can this reloc be dynamic?  This switch, and later tests here
      should be kept in sync with the code in check_relocs.  */
@@ -6977,6 +7361,8 @@
     case R_PPC64_TPREL16_HA:
     case R_PPC64_TPREL16_DS:
     case R_PPC64_TPREL16_LO_DS:
+    case R_PPC64_TPREL16_HIGH:
+    case R_PPC64_TPREL16_HIGHA:
     case R_PPC64_TPREL16_HIGHER:
     case R_PPC64_TPREL16_HIGHERA:
     case R_PPC64_TPREL16_HIGHEST:
@@ -6998,6 +7384,8 @@
     case R_PPC64_ADDR16_DS:
     case R_PPC64_ADDR16_HA:
     case R_PPC64_ADDR16_HI:
+    case R_PPC64_ADDR16_HIGH:
+    case R_PPC64_ADDR16_HIGHA:
     case R_PPC64_ADDR16_HIGHER:
     case R_PPC64_ADDR16_HIGHERA:
     case R_PPC64_ADDR16_HIGHEST:
@@ -7016,7 +7404,6 @@
   if (local_syms != NULL)
     {
       unsigned long r_symndx;
-      Elf_Internal_Sym *sym;
       bfd *ibfd = sec->owner;
 
       r_symndx = ELF64_R_SYM (r_info);
@@ -7027,7 +7414,7 @@
   if ((info->shared
        && (must_be_dyn_reloc (info, r_type)
 	   || (h != NULL
-	       && (!info->symbolic
+	       && (!SYMBOLIC_BIND (info, h)
 		   || h->root.type == bfd_link_hash_defweak
 		   || !h->def_regular))))
       || (ELIMINATE_COPY_RELOCS
@@ -7040,39 +7427,62 @@
     return TRUE;
 
   if (h != NULL)
-    pp = &((struct ppc_link_hash_entry *) h)->dyn_relocs;
-  else
     {
-      if (sym_sec != NULL)
-	{
-	  void *vpp = &elf_section_data (sym_sec)->local_dynrel;
-	  pp = (struct elf_dyn_relocs **) vpp;
-	}
-      else
-	{
-	  void *vpp = &elf_section_data (sec)->local_dynrel;
-	  pp = (struct elf_dyn_relocs **) vpp;
-	}
+      struct elf_dyn_relocs *p;
+      struct elf_dyn_relocs **pp;
+      pp = &((struct ppc_link_hash_entry *) h)->dyn_relocs;
 
       /* elf_gc_sweep may have already removed all dyn relocs associated
-	 with local syms for a given section.  Don't report a dynreloc
-	 miscount.  */
-      if (*pp == NULL)
+	 with local syms for a given section.  Also, symbol flags are
+	 changed by elf_gc_sweep_symbol, confusing the test above.  Don't
+	 report a dynreloc miscount.  */
+      if (*pp == NULL && info->gc_sections)
 	return TRUE;
-    }
 
-  while ((p = *pp) != NULL)
-    {
-      if (p->sec == sec)
+      while ((p = *pp) != NULL)
 	{
-	  if (!must_be_dyn_reloc (info, r_type))
-	    p->pc_count -= 1;
-	  p->count -= 1;
-	  if (p->count == 0)
-	    *pp = p->next;
-	  return TRUE;
+	  if (p->sec == sec)
+	    {
+	      if (!must_be_dyn_reloc (info, r_type))
+		p->pc_count -= 1;
+	      p->count -= 1;
+	      if (p->count == 0)
+		*pp = p->next;
+	      return TRUE;
+	    }
+	  pp = &p->next;
 	}
-      pp = &p->next;
+    }
+  else
+    {
+      struct ppc_dyn_relocs *p;
+      struct ppc_dyn_relocs **pp;
+      void *vpp;
+      bfd_boolean is_ifunc;
+
+      if (local_syms == NULL)
+	sym_sec = bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+      if (sym_sec == NULL)
+	sym_sec = sec;
+
+      vpp = &elf_section_data (sym_sec)->local_dynrel;
+      pp = (struct ppc_dyn_relocs **) vpp;
+
+      if (*pp == NULL && info->gc_sections)
+	return TRUE;
+
+      is_ifunc = ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC;
+      while ((p = *pp) != NULL)
+	{
+	  if (p->sec == sec && p->ifunc == is_ifunc)
+	    {
+	      p->count -= 1;
+	      if (p->count == 0)
+		*pp = p->next;
+	      return TRUE;
+	    }
+	  pp = &p->next;
+	}
     }
 
   info->callbacks->einfo (_("%P: dynreloc miscount for %B, section %A\n"),
@@ -7405,7 +7815,7 @@
 		  if (!NO_OPD_RELOCS
 		      && !info->relocatable
 		      && !dec_dynrel_count (rel->r_info, sec, info,
-					    NULL, h, sym_sec))
+					    NULL, h, sym))
 		    goto error_ret;
 		}
 	      else
@@ -7500,6 +7910,9 @@
   if (htab == NULL)
     return NULL;
 
+  if (abiversion (info->output_bfd) == 1)
+    htab->opd_abi = 1;
+
   if (*no_multi_toc)
     htab->do_multi_toc = 0;
   else if (!htab->do_multi_toc)
@@ -8012,13 +8425,13 @@
 		      /* If we got rid of a DTPMOD/DTPREL reloc pair then
 			 we'll lose one or two dyn relocs.  */
 		      if (!dec_dynrel_count (rel->r_info, sec, info,
-					     NULL, h, sym_sec))
+					     NULL, h, sym))
 			return FALSE;
 
 		      if (tls_set == (TLS_EXPLICIT | TLS_GD))
 			{
 			  if (!dec_dynrel_count ((rel + 1)->r_info, sec, info,
-						 NULL, h, sym_sec))
+						 NULL, h, sym))
 			    return FALSE;
 			}
 		    }
@@ -8250,7 +8663,7 @@
 	 .  addi ry,rx,addr@toc@l
 	 when addr is within 2G of the toc pointer.  This then means
 	 that the word storing "addr" in the toc is no longer needed.  */
-	 
+
       if (!ppc64_elf_tdata (ibfd)->has_small_toc_reloc
 	  && toc->output_section->rawsize < (bfd_vma) 1 << 31
 	  && toc->reloc_count != 0)
@@ -8283,7 +8696,7 @@
 		  || discarded_section (sym_sec))
 		continue;
 
-	      if (!SYMBOL_CALLS_LOCAL (info, h))
+	      if (!SYMBOL_REFERENCES_LOCAL (info, h))
 		continue;
 
 	      if (h != NULL)
@@ -8372,150 +8785,156 @@
 	    goto error_ret;
 
 	  /* Mark toc entries referenced as used.  */
-	  repeat = 0;
 	  do
-	    for (rel = relstart; rel < relstart + sec->reloc_count; ++rel)
-	      {
-		enum elf_ppc64_reloc_type r_type;
-		unsigned long r_symndx;
-		asection *sym_sec;
-		struct elf_link_hash_entry *h;
-		Elf_Internal_Sym *sym;
-		bfd_vma val;
-		enum {no_check, check_lo, check_ha} insn_check;
+	    {
+	      repeat = 0;
+	      for (rel = relstart; rel < relstart + sec->reloc_count; ++rel)
+		{
+		  enum elf_ppc64_reloc_type r_type;
+		  unsigned long r_symndx;
+		  asection *sym_sec;
+		  struct elf_link_hash_entry *h;
+		  Elf_Internal_Sym *sym;
+		  bfd_vma val;
+		  enum {no_check, check_lo, check_ha} insn_check;
 
-		r_type = ELF64_R_TYPE (rel->r_info);
-		switch (r_type)
-		  {
-		  default:
-		    insn_check = no_check;
-		    break;
+		  r_type = ELF64_R_TYPE (rel->r_info);
+		  switch (r_type)
+		    {
+		    default:
+		      insn_check = no_check;
+		      break;
 
-		  case R_PPC64_GOT_TLSLD16_HA:
-		  case R_PPC64_GOT_TLSGD16_HA:
-		  case R_PPC64_GOT_TPREL16_HA:
-		  case R_PPC64_GOT_DTPREL16_HA:
-		  case R_PPC64_GOT16_HA:
-		  case R_PPC64_TOC16_HA:
-		    insn_check = check_ha;
-		    break;
+		    case R_PPC64_GOT_TLSLD16_HA:
+		    case R_PPC64_GOT_TLSGD16_HA:
+		    case R_PPC64_GOT_TPREL16_HA:
+		    case R_PPC64_GOT_DTPREL16_HA:
+		    case R_PPC64_GOT16_HA:
+		    case R_PPC64_TOC16_HA:
+		      insn_check = check_ha;
+		      break;
 
-		  case R_PPC64_GOT_TLSLD16_LO:
-		  case R_PPC64_GOT_TLSGD16_LO:
-		  case R_PPC64_GOT_TPREL16_LO_DS:
-		  case R_PPC64_GOT_DTPREL16_LO_DS:
-		  case R_PPC64_GOT16_LO:
-		  case R_PPC64_GOT16_LO_DS:
-		  case R_PPC64_TOC16_LO:
-		  case R_PPC64_TOC16_LO_DS:
-		    insn_check = check_lo;
-		    break;
-		  }
+		    case R_PPC64_GOT_TLSLD16_LO:
+		    case R_PPC64_GOT_TLSGD16_LO:
+		    case R_PPC64_GOT_TPREL16_LO_DS:
+		    case R_PPC64_GOT_DTPREL16_LO_DS:
+		    case R_PPC64_GOT16_LO:
+		    case R_PPC64_GOT16_LO_DS:
+		    case R_PPC64_TOC16_LO:
+		    case R_PPC64_TOC16_LO_DS:
+		      insn_check = check_lo;
+		      break;
+		    }
 
-		if (insn_check != no_check)
-		  {
-		    bfd_vma off = rel->r_offset & ~3;
-		    unsigned char buf[4];
-		    unsigned int insn;
+		  if (insn_check != no_check)
+		    {
+		      bfd_vma off = rel->r_offset & ~3;
+		      unsigned char buf[4];
+		      unsigned int insn;
 
-		    if (!bfd_get_section_contents (ibfd, sec, buf, off, 4))
-		      {
-			free (used);
-			goto error_ret;
-		      }
-		    insn = bfd_get_32 (ibfd, buf);
-		    if (insn_check == check_lo
-			? !ok_lo_toc_insn (insn)
-			: ((insn & ((0x3f << 26) | 0x1f << 16))
-			   != ((15u << 26) | (2 << 16)) /* addis rt,2,imm */))
-		      {
-			char str[12];
+		      if (!bfd_get_section_contents (ibfd, sec, buf, off, 4))
+			{
+			  free (used);
+			  goto error_ret;
+			}
+		      insn = bfd_get_32 (ibfd, buf);
+		      if (insn_check == check_lo
+			  ? !ok_lo_toc_insn (insn)
+			  : ((insn & ((0x3f << 26) | 0x1f << 16))
+			     != ((15u << 26) | (2 << 16)) /* addis rt,2,imm */))
+			{
+			  char str[12];
 
-			ppc64_elf_tdata (ibfd)->unexpected_toc_insn = 1;
-			sprintf (str, "%#08x", insn);
-			info->callbacks->einfo
-			  (_("%P: %H: toc optimization is not supported for"
-			     " %s instruction.\n"),
-			   ibfd, sec, rel->r_offset & ~3, str);
-		      }
-		  }
+			  ppc64_elf_tdata (ibfd)->unexpected_toc_insn = 1;
+			  sprintf (str, "%#08x", insn);
+			  info->callbacks->einfo
+			    (_("%P: %H: toc optimization is not supported for"
+			       " %s instruction.\n"),
+			     ibfd, sec, rel->r_offset & ~3, str);
+			}
+		    }
 
-		switch (r_type)
-		  {
-		  case R_PPC64_TOC16:
-		  case R_PPC64_TOC16_LO:
-		  case R_PPC64_TOC16_HI:
-		  case R_PPC64_TOC16_HA:
-		  case R_PPC64_TOC16_DS:
-		  case R_PPC64_TOC16_LO_DS:
-		    /* In case we're taking addresses of toc entries.  */
-		  case R_PPC64_ADDR64:
-		    break;
+		  switch (r_type)
+		    {
+		    case R_PPC64_TOC16:
+		    case R_PPC64_TOC16_LO:
+		    case R_PPC64_TOC16_HI:
+		    case R_PPC64_TOC16_HA:
+		    case R_PPC64_TOC16_DS:
+		    case R_PPC64_TOC16_LO_DS:
+		      /* In case we're taking addresses of toc entries.  */
+		    case R_PPC64_ADDR64:
+		      break;
 
-		  default:
+		    default:
+		      continue;
+		    }
+
+		  r_symndx = ELF64_R_SYM (rel->r_info);
+		  if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
+				  r_symndx, ibfd))
+		    {
+		      free (used);
+		      goto error_ret;
+		    }
+
+		  if (sym_sec != toc)
 		    continue;
-		  }
 
-		r_symndx = ELF64_R_SYM (rel->r_info);
-		if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
-				r_symndx, ibfd))
-		  {
-		    free (used);
-		    goto error_ret;
-		  }
+		  if (h != NULL)
+		    val = h->root.u.def.value;
+		  else
+		    val = sym->st_value;
+		  val += rel->r_addend;
 
-		if (sym_sec != toc)
-		  continue;
+		  if (val >= toc->size)
+		    continue;
 
-		if (h != NULL)
-		  val = h->root.u.def.value;
-		else
-		  val = sym->st_value;
-		val += rel->r_addend;
+		  if ((skip[val >> 3] & can_optimize) != 0)
+		    {
+		      bfd_vma off;
+		      unsigned char opc;
 
-		if (val >= toc->size)
-		  continue;
-
-		if ((skip[val >> 3] & can_optimize) != 0)
-		  {
-		    bfd_vma off;
-		    unsigned char opc;
-
-		    switch (r_type)
-		      {
-		      case R_PPC64_TOC16_HA:
-			break;
-
-		      case R_PPC64_TOC16_LO_DS:
-			off = rel->r_offset + (bfd_big_endian (ibfd) ? -2 : 3);
-			if (!bfd_get_section_contents (ibfd, sec, &opc, off, 1))
-			  {
-			    free (used);
-			    goto error_ret;
-			  }
-			if ((opc & (0x3f << 2)) == (58u << 2))
+		      switch (r_type)
+			{
+			case R_PPC64_TOC16_HA:
 			  break;
-			/* Fall thru */
 
-		      default:
-			/* Wrong sort of reloc, or not a ld.  We may
-			   as well clear ref_from_discarded too.  */
-			skip[val >> 3] = 0;
-		      }
-		  }
+			case R_PPC64_TOC16_LO_DS:
+			  off = rel->r_offset;
+			  off += (bfd_big_endian (ibfd) ? -2 : 3);
+			  if (!bfd_get_section_contents (ibfd, sec, &opc,
+							 off, 1))
+			    {
+			      free (used);
+			      goto error_ret;
+			    }
+			  if ((opc & (0x3f << 2)) == (58u << 2))
+			    break;
+			  /* Fall thru */
 
-		/* For the toc section, we only mark as used if
-		   this entry itself isn't unused.  */
-		if (sec == toc
-		    && !used[val >> 3]
-		    && (used[rel->r_offset >> 3]
-			|| !(skip[rel->r_offset >> 3] & ref_from_discarded)))
-		  /* Do all the relocs again, to catch reference
-		     chains.  */
-		  repeat = 1;
+			default:
+			  /* Wrong sort of reloc, or not a ld.  We may
+			     as well clear ref_from_discarded too.  */
+			  skip[val >> 3] = 0;
+			}
+		    }
 
-		used[val >> 3] = 1;
-	      }
+		  if (sec != toc)
+		    used[val >> 3] = 1;
+		  /* For the toc section, we only mark as used if this
+		     entry itself isn't unused.  */
+		  else if ((used[rel->r_offset >> 3]
+			    || !(skip[rel->r_offset >> 3] & ref_from_discarded))
+			   && !used[val >> 3])
+		    {
+		      /* Do all the relocs again, to catch reference
+			 chains.  */
+		      repeat = 1;
+		      used[val >> 3] = 1;
+		    }
+		}
+	    }
 	  while (repeat);
 
 	  if (elf_section_data (sec)->relocs != relstart)
@@ -8657,7 +9076,7 @@
 			  if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
 			    ppc_howto_init ();
 			  info->callbacks->einfo
-			    (_("%P: %H: %s relocation references "
+			    (_("%P: %H: %s references "
 			       "optimized away TOC entry\n"),
 			     ibfd, sec, rel->r_offset,
 			     ppc64_elf_howto_table[r_type]->name);
@@ -8804,20 +9223,19 @@
   got->size += entsize;
 
   dyn = htab->elf.dynamic_sections_created;
-  if ((info->shared
-       || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
-	    && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
-		|| h->root.type != bfd_link_hash_undefweak))
+  if (h->type == STT_GNU_IFUNC)
+    {
+      htab->elf.irelplt->size += rentsize;
+      htab->got_reli_size += rentsize;
+    }
+  else if ((info->shared
+	    || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
+	   && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+	       || h->root.type != bfd_link_hash_undefweak))
     {
       asection *relgot = ppc64_elf_tdata (gent->owner)->relgot;
       relgot->size += rentsize;
     }
-  else if (h->type == STT_GNU_IFUNC)
-    {
-      asection *relgot = htab->reliplt;
-      relgot->size += rentsize;
-      htab->got_reli_size += rentsize;
-    }
 }
 
 /* This function merges got entries in the same toc group.  */
@@ -8874,35 +9292,40 @@
 	    if (!htab->elf.dynamic_sections_created
 		|| h->dynindx == -1)
 	      {
-		s = htab->iplt;
+		s = htab->elf.iplt;
 		pent->plt.offset = s->size;
-		s->size += PLT_ENTRY_SIZE;
-		s = htab->reliplt;
+		s->size += PLT_ENTRY_SIZE (htab);
+		s = htab->elf.irelplt;
 	      }
 	    else
 	      {
 		/* If this is the first .plt entry, make room for the special
 		   first entry.  */
-		s = htab->plt;
+		s = htab->elf.splt;
 		if (s->size == 0)
-		  s->size += PLT_INITIAL_ENTRY_SIZE;
+		  s->size += PLT_INITIAL_ENTRY_SIZE (htab);
 
 		pent->plt.offset = s->size;
 
 		/* Make room for this entry.  */
-		s->size += PLT_ENTRY_SIZE;
+		s->size += PLT_ENTRY_SIZE (htab);
 
 		/* Make room for the .glink code.  */
 		s = htab->glink;
 		if (s->size == 0)
 		  s->size += GLINK_CALL_STUB_SIZE;
-		/* We need bigger stubs past index 32767.  */
-		if (s->size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
+		if (htab->opd_abi)
+		  {
+		    /* We need bigger stubs past index 32767.  */
+		    if (s->size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
+		      s->size += 4;
+		    s->size += 2*4;
+		  }
+		else
 		  s->size += 4;
-		s->size += 2*4;
 
 		/* We also need to make an entry in the .rela.plt section.  */
-		s = htab->relplt;
+		s = htab->elf.srelplt;
 	      }
 	    s->size += sizeof (Elf64_External_Rela);
 	    doneone = TRUE;
@@ -9080,36 +9503,73 @@
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
       asection *sreloc = elf_section_data (p->sec)->sreloc;
-      if (!htab->elf.dynamic_sections_created)
-	sreloc = htab->reliplt;
+      if (eh->elf.type == STT_GNU_IFUNC)
+	sreloc = htab->elf.irelplt;
       sreloc->size += p->count * sizeof (Elf64_External_Rela);
     }
 
   return TRUE;
 }
 
-/* Find any dynamic relocs that apply to read-only sections.  */
+/* Called via elf_link_hash_traverse from ppc64_elf_size_dynamic_sections
+   to set up space for global entry stubs.  These are put in glink,
+   after the branch table.  */
 
 static bfd_boolean
-readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
+size_global_entry_stubs (struct elf_link_hash_entry *h, void *inf)
 {
-  struct ppc_link_hash_entry *eh;
-  struct elf_dyn_relocs *p;
+  struct bfd_link_info *info;
+  struct ppc_link_hash_table *htab;
+  struct plt_entry *pent;
+  asection *s;
 
-  eh = (struct ppc_link_hash_entry *) h;
-  for (p = eh->dyn_relocs; p != NULL; p = p->next)
+  if (h->root.type == bfd_link_hash_indirect)
+    return TRUE;
+
+  if (!h->pointer_equality_needed)
+    return TRUE;
+
+  if (h->def_regular)
+    return TRUE;
+
+  info = inf;
+  htab = ppc_hash_table (info);
+  if (htab == NULL)
+    return FALSE;
+
+  s = htab->glink;
+  for (pent = h->plt.plist; pent != NULL; pent = pent->next)
+    if (pent->plt.offset != (bfd_vma) -1
+	&& pent->addend == 0)
+      {
+	/* For ELFv2, if this symbol is not defined in a regular file
+	   and we are not generating a shared library or pie, then we
+	   need to define the symbol in the executable on a call stub.
+	   This is to avoid text relocations.  */
+	s->size = (s->size + 15) & -16;
+	h->root.u.def.section = s;
+	h->root.u.def.value = s->size;
+	s->size += 16;
+	break;
+      }
+  return TRUE;
+}
+
+/* Set DF_TEXTREL if we find any dynamic relocs that apply to
+   read-only sections.  */
+
+static bfd_boolean
+maybe_set_textrel (struct elf_link_hash_entry *h, void *info)
+{
+  if (h->root.type == bfd_link_hash_indirect)
+    return TRUE;
+
+  if (readonly_dynrelocs (h))
     {
-      asection *s = p->sec->output_section;
+      ((struct bfd_link_info *) info)->flags |= DF_TEXTREL;
 
-      if (s != NULL && (s->flags & SEC_READONLY) != 0)
-	{
-	  struct bfd_link_info *info = inf;
-
-	  info->flags |= DF_TEXTREL;
-
-	  /* Not an error, just cut short the traversal.  */
-	  return FALSE;
-	}
+      /* Not an error, just cut short the traversal.  */
+      return FALSE;
     }
   return TRUE;
 }
@@ -9117,7 +9577,7 @@
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
-ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ppc64_elf_size_dynamic_sections (bfd *output_bfd,
 				 struct bfd_link_info *info)
 {
   struct ppc_link_hash_table *htab;
@@ -9159,14 +9619,13 @@
       unsigned char *lgot_masks;
       bfd_size_type locsymcount;
       Elf_Internal_Shdr *symtab_hdr;
-      asection *srel;
 
       if (!is_ppc64_elf (ibfd))
 	continue;
 
       for (s = ibfd->sections; s != NULL; s = s->next)
 	{
-	  struct elf_dyn_relocs *p;
+	  struct ppc_dyn_relocs *p;
 
 	  for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next)
 	    {
@@ -9180,9 +9639,9 @@
 		}
 	      else if (p->count != 0)
 		{
-		  srel = elf_section_data (p->sec)->sreloc;
-		  if (!htab->elf.dynamic_sections_created)
-		    srel = htab->reliplt;
+		  asection *srel = elf_section_data (p->sec)->sreloc;
+		  if (p->ifunc)
+		    srel = htab->elf.irelplt;
 		  srel->size += p->count * sizeof (Elf64_External_Rela);
 		  if ((p->sec->output_section->flags & SEC_READONLY) != 0)
 		    info->flags |= DF_TEXTREL;
@@ -9201,7 +9660,6 @@
       end_local_plt = local_plt + locsymcount;
       lgot_masks = (unsigned char *) end_local_plt;
       s = ppc64_elf_tdata (ibfd)->got;
-      srel = ppc64_elf_tdata (ibfd)->relgot;
       for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_masks)
 	{
 	  struct got_entry **pent, *ent;
@@ -9217,19 +9675,25 @@
 		  }
 		else
 		  {
-		    unsigned int num = 1;
+		    unsigned int ent_size = 8;
+		    unsigned int rel_size = sizeof (Elf64_External_Rela);
+
 		    ent->got.offset = s->size;
 		    if ((ent->tls_type & *lgot_masks & TLS_GD) != 0)
-		      num = 2;
-		    s->size += num * 8;
-		    if (info->shared)
-		      srel->size += num * sizeof (Elf64_External_Rela);
-		    else if ((*lgot_masks & PLT_IFUNC) != 0)
 		      {
-			htab->reliplt->size
-			  += num * sizeof (Elf64_External_Rela);
-			htab->got_reli_size
-			  += num * sizeof (Elf64_External_Rela);
+			ent_size *= 2;
+			rel_size *= 2;
+		      }
+		    s->size += ent_size;
+		    if ((*lgot_masks & PLT_IFUNC) != 0)
+		      {
+			htab->elf.irelplt->size += rel_size;
+			htab->got_reli_size += rel_size;
+		      }
+		    else if (info->shared)
+		      {
+			asection *srel = ppc64_elf_tdata (ibfd)->relgot;
+			srel->size += rel_size;
 		      }
 		    pent = &ent->next;
 		  }
@@ -9246,11 +9710,11 @@
 	  for (ent = *local_plt; ent != NULL; ent = ent->next)
 	    if (ent->plt.refcount > 0)
 	      {
-		s = htab->iplt;
+		s = htab->elf.iplt;
 		ent->plt.offset = s->size;
-		s->size += PLT_ENTRY_SIZE;
+		s->size += PLT_ENTRY_SIZE (htab);
 
-		htab->reliplt->size += sizeof (Elf64_External_Rela);
+		htab->elf.irelplt->size += sizeof (Elf64_External_Rela);
 	      }
 	    else
 	      ent->plt.offset = (bfd_vma) -1;
@@ -9260,6 +9724,12 @@
   /* Allocate global sym .plt and .got entries, and space for global
      sym dynamic relocs.  */
   elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info);
+  /* Stash the end of glink branch table.  */
+  if (htab->glink != NULL)
+    htab->glink->rawsize = htab->glink->size;
+
+  if (!htab->opd_abi && !info->shared)
+    elf_link_hash_traverse (&htab->elf, size_global_entry_stubs, info);
 
   first_tlsld = NULL;
   for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
@@ -9307,9 +9777,9 @@
       if (s == htab->brlt || s == htab->relbrlt)
 	/* These haven't been allocated yet;  don't strip.  */
 	continue;
-      else if (s == htab->got
-	       || s == htab->plt
-	       || s == htab->iplt
+      else if (s == htab->elf.sgot
+	       || s == htab->elf.splt
+	       || s == htab->elf.iplt
 	       || s == htab->glink
 	       || s == htab->dynbss)
 	{
@@ -9326,7 +9796,7 @@
 	{
 	  if (s->size != 0)
 	    {
-	      if (s != htab->relplt)
+	      if (s != htab->elf.srelplt)
 		relocs = TRUE;
 
 	      /* We use the reloc_count field as a counter if we need
@@ -9376,7 +9846,7 @@
 	continue;
 
       s = ppc64_elf_tdata (ibfd)->got;
-      if (s != NULL && s != htab->got)
+      if (s != NULL && s != htab->elf.sgot)
 	{
 	  if (s->size == 0)
 	    s->flags |= SEC_EXCLUDE;
@@ -9405,6 +9875,8 @@
 
   if (htab->elf.dynamic_sections_created)
     {
+      bfd_boolean tls_opt;
+
       /* Add some entries to the .dynamic section.  We fill in the
 	 values later, in ppc64_elf_finish_dynamic_sections, but we
 	 must add the entries now so that we get the correct size for
@@ -9419,7 +9891,7 @@
 	    return FALSE;
 	}
 
-      if (htab->plt != NULL && htab->plt->size != 0)
+      if (htab->elf.splt != NULL && htab->elf.splt->size != 0)
 	{
 	  if (!add_dynamic_entry (DT_PLTGOT, 0)
 	      || !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -9429,18 +9901,21 @@
 	    return FALSE;
 	}
 
-      if (NO_OPD_RELOCS)
+      if (NO_OPD_RELOCS && abiversion (output_bfd) <= 1)
 	{
 	  if (!add_dynamic_entry (DT_PPC64_OPD, 0)
 	      || !add_dynamic_entry (DT_PPC64_OPDSZ, 0))
 	    return FALSE;
 	}
 
-      if (!htab->no_tls_get_addr_opt
-	  && htab->tls_get_addr_fd != NULL
-	  && htab->tls_get_addr_fd->elf.plt.plist != NULL
-	  && !add_dynamic_entry (DT_PPC64_TLSOPT, 0))
-	return FALSE;
+      tls_opt = (!htab->no_tls_get_addr_opt
+		 && htab->tls_get_addr_fd != NULL
+		 && htab->tls_get_addr_fd->elf.plt.plist != NULL);
+      if (tls_opt || !htab->opd_abi)
+	{
+	  if (!add_dynamic_entry (DT_PPC64_OPT, tls_opt ? PPC64_OPT_TLS : 0))
+	    return FALSE;
+	}
 
       if (relocs)
 	{
@@ -9452,7 +9927,7 @@
 	  /* If any dynamic relocs apply to a read-only section,
 	     then we need a DT_TEXTREL entry.  */
 	  if ((info->flags & DF_TEXTREL) == 0)
-	    elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, info);
+	    elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info);
 
 	  if ((info->flags & DF_TEXTREL) != 0)
 	    {
@@ -9466,6 +9941,19 @@
   return TRUE;
 }
 
+/* Return TRUE if symbol should be hashed in the `.gnu.hash' section.  */
+
+static bfd_boolean
+ppc64_elf_hash_symbol (struct elf_link_hash_entry *h)
+{
+  if (h->plt.plist != NULL
+      && !h->def_regular
+      && !h->pointer_equality_needed)
+    return FALSE;
+
+  return _bfd_elf_hash_symbol (h);
+}
+
 /* Determine the type of stub needed, if any, for a call.  */
 
 static inline enum ppc_stub_type
@@ -9473,7 +9961,8 @@
 		  const Elf_Internal_Rela *rel,
 		  struct ppc_link_hash_entry **hash,
 		  struct plt_entry **plt_ent,
-		  bfd_vma destination)
+		  bfd_vma destination,
+		  unsigned long local_off)
 {
   struct ppc_link_hash_entry *h = *hash;
   bfd_vma location;
@@ -9542,7 +10031,7 @@
   if (r_type != R_PPC64_REL24)
     max_branch_offset = 1 << 15;
 
-  if (branch_offset + max_branch_offset >= 2 * max_branch_offset)
+  if (branch_offset + max_branch_offset >= 2 * max_branch_offset - local_off)
     /* We need a stub.  Figure out whether a long_branch or plt_branch
        is needed later.  */
     return ppc_stub_long_branch;
@@ -9559,9 +10048,9 @@
    the appropriate glink entry if so.
 
    .	fake dep barrier	compare
-   .	ld 11,xxx(2)		ld 11,xxx(2)
-   .	mtctr 11		mtctr 11
-   .	xor 11,11,11		ld 2,xxx+8(2)
+   .	ld 12,xxx(2)		ld 12,xxx(2)
+   .	mtctr 12		mtctr 12
+   .	xor 11,12,12		ld 2,xxx+8(2)
    .	add 2,2,11		cmpldi 2,0
    .	ld 2,xxx+8(2)		bnectr+
    .	bctr			b <glink_entry>
@@ -9581,19 +10070,23 @@
 	       struct ppc_stub_hash_entry *stub_entry,
 	       bfd_vma off)
 {
-  unsigned size = PLT_CALL_STUB_SIZE;
+  unsigned size = 12;
 
-  if (!(ALWAYS_EMIT_R2SAVE
-	|| stub_entry->stub_type == ppc_stub_plt_call_r2save))
-    size -= 4;
-  if (!htab->plt_static_chain)
-    size -= 4;
-  if (htab->plt_thread_safe)
-    size += 8;
-  if (PPC_HA (off) == 0)
-    size -= 4;
-  if (PPC_HA (off + 8 + 8 * htab->plt_static_chain) != PPC_HA (off))
+  if (ALWAYS_EMIT_R2SAVE
+      || stub_entry->stub_type == ppc_stub_plt_call_r2save)
     size += 4;
+  if (PPC_HA (off) != 0)
+    size += 4;
+  if (htab->opd_abi)
+    {
+      size += 4;
+      if (htab->plt_static_chain)
+	size += 4;
+      if (htab->plt_thread_safe)
+	size += 8;
+      if (PPC_HA (off + 8 + 8 * htab->plt_static_chain) != PPC_HA (off))
+	size += 4;
+    }
   if (stub_entry->h != NULL
       && (stub_entry->h == htab->tls_get_addr_fd
 	  || stub_entry->h == htab->tls_get_addr)
@@ -9627,12 +10120,14 @@
 		bfd_byte *p, bfd_vma offset, Elf_Internal_Rela *r)
 {
   bfd *obfd = htab->stub_bfd;
+  bfd_boolean plt_load_toc = htab->opd_abi;
   bfd_boolean plt_static_chain = htab->plt_static_chain;
   bfd_boolean plt_thread_safe = htab->plt_thread_safe;
   bfd_boolean use_fake_dep = plt_thread_safe;
   bfd_vma cmp_branch_off = 0;
 
   if (!ALWAYS_USE_FAKE_DEP
+      && plt_load_toc
       && plt_thread_safe
       && !(stub_entry->h != NULL
 	   && (stub_entry->h == htab->tls_get_addr_fd
@@ -9640,12 +10135,13 @@
 	   && !htab->no_tls_get_addr_opt))
     {
       bfd_vma pltoff = stub_entry->plt_ent->plt.offset & ~1;
-      bfd_vma pltindex = (pltoff - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE;
+      bfd_vma pltindex = ((pltoff - PLT_INITIAL_ENTRY_SIZE (htab))
+			  / PLT_ENTRY_SIZE (htab));
       bfd_vma glinkoff = GLINK_CALL_STUB_SIZE + pltindex * 8;
       bfd_vma to, from;
 
-      if (pltindex > 32767)
-	glinkoff += (pltindex - 32767) * 4;
+      if (pltindex > 32768)
+	glinkoff += (pltindex - 32768) * 4;
       to = (glinkoff
 	    + htab->glink->output_offset
 	    + htab->glink->output_section->vma);
@@ -9674,44 +10170,51 @@
 	  r[1].r_offset = r[0].r_offset + 4;
 	  r[1].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_LO_DS);
 	  r[1].r_addend = r[0].r_addend;
-	  if (PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset))
+	  if (plt_load_toc)
 	    {
-	      r[2].r_offset = r[1].r_offset + 4;
-	      r[2].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_LO);
-	      r[2].r_addend = r[0].r_addend;
-	    }
-	  else
-	    {
-	      r[2].r_offset = r[1].r_offset + 8 + 8 * use_fake_dep;
-	      r[2].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_LO_DS);
-	      r[2].r_addend = r[0].r_addend + 8;
-	      if (plt_static_chain)
+	      if (PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset))
 		{
-		  r[3].r_offset = r[2].r_offset + 4;
-		  r[3].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_LO_DS);
-		  r[3].r_addend = r[0].r_addend + 16;
+		  r[2].r_offset = r[1].r_offset + 4;
+		  r[2].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_LO);
+		  r[2].r_addend = r[0].r_addend;
+		}
+	      else
+		{
+		  r[2].r_offset = r[1].r_offset + 8 + 8 * use_fake_dep;
+		  r[2].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_LO_DS);
+		  r[2].r_addend = r[0].r_addend + 8;
+		  if (plt_static_chain)
+		    {
+		      r[3].r_offset = r[2].r_offset + 4;
+		      r[3].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_LO_DS);
+		      r[3].r_addend = r[0].r_addend + 16;
+		    }
 		}
 	    }
 	}
       if (ALWAYS_EMIT_R2SAVE
 	  || stub_entry->stub_type == ppc_stub_plt_call_r2save)
-	bfd_put_32 (obfd, STD_R2_40R1, p),			p += 4;
-      bfd_put_32 (obfd, ADDIS_R12_R2 | PPC_HA (offset), p),	p += 4;
-      bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p),	p += 4;
-      if (PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset))
+	bfd_put_32 (obfd, STD_R2_0R1 + STK_TOC (htab), p),	p += 4;
+      bfd_put_32 (obfd, ADDIS_R11_R2 | PPC_HA (offset), p),	p += 4;
+      bfd_put_32 (obfd, LD_R12_0R11 | PPC_LO (offset), p),	p += 4;
+      if (plt_load_toc
+	  && PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset))
 	{
-	  bfd_put_32 (obfd, ADDI_R12_R12 | PPC_LO (offset), p),	p += 4;
+	  bfd_put_32 (obfd, ADDI_R11_R11 | PPC_LO (offset), p),	p += 4;
 	  offset = 0;
 	}
-      bfd_put_32 (obfd, MTCTR_R11, p),				p += 4;
-      if (use_fake_dep)
+      bfd_put_32 (obfd, MTCTR_R12, p),				p += 4;
+      if (plt_load_toc)
 	{
-	  bfd_put_32 (obfd, XOR_R11_R11_R11, p),		p += 4;
-	  bfd_put_32 (obfd, ADD_R12_R12_R11, p),		p += 4;
+	  if (use_fake_dep)
+	    {
+	      bfd_put_32 (obfd, XOR_R2_R12_R12, p),		p += 4;
+	      bfd_put_32 (obfd, ADD_R11_R11_R2, p),		p += 4;
+	    }
+	  bfd_put_32 (obfd, LD_R2_0R11 | PPC_LO (offset + 8), p), p += 4;
+	  if (plt_static_chain)
+	    bfd_put_32 (obfd, LD_R11_0R11 | PPC_LO (offset + 16), p), p += 4;
 	}
-      bfd_put_32 (obfd, LD_R2_0R12 | PPC_LO (offset + 8), p),	p += 4;
-      if (plt_static_chain)
-	bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset + 16), p), p += 4;
     }
   else
     {
@@ -9721,49 +10224,56 @@
 	      || stub_entry->stub_type == ppc_stub_plt_call_r2save)
 	    r[0].r_offset += 4;
 	  r[0].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_DS);
-	  if (PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset))
+	  if (plt_load_toc)
 	    {
-	      r[1].r_offset = r[0].r_offset + 4;
-	      r[1].r_info = ELF64_R_INFO (0, R_PPC64_TOC16);
-	      r[1].r_addend = r[0].r_addend;
-	    }
-	  else
-	    {
-	      r[1].r_offset = r[0].r_offset + 8 + 8 * use_fake_dep;
-	      r[1].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_DS);
-	      r[1].r_addend = r[0].r_addend + 8 + 8 * plt_static_chain;
-	      if (plt_static_chain)
+	      if (PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset))
 		{
-		  r[2].r_offset = r[1].r_offset + 4;
-		  r[2].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_DS);
-		  r[2].r_addend = r[0].r_addend + 8;
+		  r[1].r_offset = r[0].r_offset + 4;
+		  r[1].r_info = ELF64_R_INFO (0, R_PPC64_TOC16);
+		  r[1].r_addend = r[0].r_addend;
+		}
+	      else
+		{
+		  r[1].r_offset = r[0].r_offset + 8 + 8 * use_fake_dep;
+		  r[1].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_DS);
+		  r[1].r_addend = r[0].r_addend + 8 + 8 * plt_static_chain;
+		  if (plt_static_chain)
+		    {
+		      r[2].r_offset = r[1].r_offset + 4;
+		      r[2].r_info = ELF64_R_INFO (0, R_PPC64_TOC16_DS);
+		      r[2].r_addend = r[0].r_addend + 8;
+		    }
 		}
 	    }
 	}
       if (ALWAYS_EMIT_R2SAVE
 	  || stub_entry->stub_type == ppc_stub_plt_call_r2save)
-	bfd_put_32 (obfd, STD_R2_40R1, p),			p += 4;
-      bfd_put_32 (obfd, LD_R11_0R2 | PPC_LO (offset), p),	p += 4;
-      if (PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset))
+	bfd_put_32 (obfd, STD_R2_0R1 + STK_TOC (htab), p),	p += 4;
+      bfd_put_32 (obfd, LD_R12_0R2 | PPC_LO (offset), p),	p += 4;
+      if (plt_load_toc
+	  && PPC_HA (offset + 8 + 8 * plt_static_chain) != PPC_HA (offset))
 	{
 	  bfd_put_32 (obfd, ADDI_R2_R2 | PPC_LO (offset), p),	p += 4;
 	  offset = 0;
 	}
-      bfd_put_32 (obfd, MTCTR_R11, p),				p += 4;
-      if (use_fake_dep)
+      bfd_put_32 (obfd, MTCTR_R12, p),				p += 4;
+      if (plt_load_toc)
 	{
-	  bfd_put_32 (obfd, XOR_R11_R11_R11, p),		p += 4;
-	  bfd_put_32 (obfd, ADD_R2_R2_R11, p),			p += 4;
+	  if (use_fake_dep)
+	    {
+	      bfd_put_32 (obfd, XOR_R11_R12_R12, p),		p += 4;
+	      bfd_put_32 (obfd, ADD_R2_R2_R11, p),		p += 4;
+	    }
+	  if (plt_static_chain)
+	    bfd_put_32 (obfd, LD_R11_0R2 | PPC_LO (offset + 16), p), p += 4;
+	  bfd_put_32 (obfd, LD_R2_0R2 | PPC_LO (offset + 8), p), p += 4;
 	}
-      if (plt_static_chain)
-	bfd_put_32 (obfd, LD_R11_0R2 | PPC_LO (offset + 16), p), p += 4;
-      bfd_put_32 (obfd, LD_R2_0R2 | PPC_LO (offset + 8), p),	p += 4;
     }
-  if (plt_thread_safe && !use_fake_dep)
+  if (plt_load_toc && plt_thread_safe && !use_fake_dep)
     {
       bfd_put_32 (obfd, CMPLDI_R2_0, p),			p += 4;
       bfd_put_32 (obfd, BNECTR_P4, p),				p += 4;
-      bfd_put_32 (obfd, B_DOT + cmp_branch_off, p),		p += 4;
+      bfd_put_32 (obfd, B_DOT | (cmp_branch_off & 0x3fffffc), p), p += 4;
     }
   else
     bfd_put_32 (obfd, BCTR, p),					p += 4;
@@ -9779,11 +10289,9 @@
 #define ADD_R3_R12_R13	0x7c6c6a14
 #define BEQLR		0x4d820020
 #define MR_R3_R0	0x7c030378
-#define MFLR_R11	0x7d6802a6
 #define STD_R11_0R1	0xf9610000
 #define BCTRL		0x4e800421
 #define LD_R11_0R1	0xe9610000
-#define LD_R2_0R1	0xe8410000
 #define MTLR_R11	0x7d6803a6
 
 static inline bfd_byte *
@@ -9801,15 +10309,15 @@
   bfd_put_32 (obfd, BEQLR, p),			p += 4;
   bfd_put_32 (obfd, MR_R3_R0, p),		p += 4;
   bfd_put_32 (obfd, MFLR_R11, p),		p += 4;
-  bfd_put_32 (obfd, STD_R11_0R1 + 32, p),	p += 4;
+  bfd_put_32 (obfd, STD_R11_0R1 + STK_LINKER (htab), p), p += 4;
 
   if (r != NULL)
     r[0].r_offset += 9 * 4;
   p = build_plt_stub (htab, stub_entry, p, offset, r);
   bfd_put_32 (obfd, BCTRL, p - 4);
 
-  bfd_put_32 (obfd, LD_R11_0R1 + 32, p),	p += 4;
-  bfd_put_32 (obfd, LD_R2_0R1 + 40, p),		p += 4;
+  bfd_put_32 (obfd, LD_R11_0R1 + STK_LINKER (htab), p),	p += 4;
+  bfd_put_32 (obfd, LD_R2_0R1 + STK_TOC (htab), p),	p += 4;
   bfd_put_32 (obfd, MTLR_R11, p),		p += 4;
   bfd_put_32 (obfd, BLR, p),			p += 4;
 
@@ -9858,13 +10366,15 @@
       /* Support linking -R objects.  Get the toc pointer from the
 	 opd entry.  */
       char buf[8];
+      if (!htab->opd_abi)
+	return r2off;
       asection *opd = stub_entry->h->elf.root.u.def.section;
       bfd_vma opd_off = stub_entry->h->elf.root.u.def.value;
 
       if (strcmp (opd->name, ".opd") != 0
 	  || opd->reloc_count != 0)
 	{
-	  info->callbacks->einfo (_("%P: cannot find opd entry toc for %s\n"),
+	  info->callbacks->einfo (_("%P: cannot find opd entry toc for `%T'\n"),
 				  stub_entry->h->elf.root.root.string);
 	  bfd_set_error (bfd_error_bad_value);
 	  return 0;
@@ -9910,9 +10420,11 @@
     case ppc_stub_long_branch:
     case ppc_stub_long_branch_r2off:
       /* Branches are relative.  This is where we are going to.  */
-      off = dest = (stub_entry->target_value
-		    + stub_entry->target_section->output_offset
-		    + stub_entry->target_section->output_section->vma);
+      dest = (stub_entry->target_value
+	      + stub_entry->target_section->output_offset
+	      + stub_entry->target_section->output_section->vma);
+      dest += PPC64_LOCAL_ENTRY_OFFSET (stub_entry->other);
+      off = dest;
 
       /* And this is where we are coming from.  */
       off -= (stub_entry->stub_offset
@@ -9929,7 +10441,7 @@
 	      htab->stub_error = TRUE;
 	      return FALSE;
 	    }
-	  bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
+	  bfd_put_32 (htab->stub_bfd, STD_R2_0R1 + STK_TOC (htab), loc);
 	  loc += 4;
 	  size = 12;
 	  if (PPC_HA (r2off) != 0)
@@ -9946,8 +10458,9 @@
 
       if (off + (1 << 25) >= (bfd_vma) (1 << 26))
 	{
-	  info->callbacks->einfo (_("%P: long branch stub `%s' offset overflow\n"),
-				  stub_entry->root.string);
+	  info->callbacks->einfo
+	    (_("%P: long branch stub `%s' offset overflow\n"),
+	     stub_entry->root.string);
 	  htab->stub_error = TRUE;
 	  return FALSE;
 	}
@@ -10014,6 +10527,8 @@
       dest = (stub_entry->target_value
 	      + stub_entry->target_section->output_offset
 	      + stub_entry->target_section->output_section->vma);
+      if (stub_entry->stub_type != ppc_stub_plt_branch_r2off)
+	dest += PPC64_LOCAL_ENTRY_OFFSET (stub_entry->other);
 
       bfd_put_64 (htab->brlt->owner, dest,
 		  htab->brlt->contents + br_entry->offset);
@@ -10067,7 +10582,7 @@
       if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
 	{
 	  info->callbacks->einfo
-	    (_("%P: linkage table error against `%s'\n"),
+	    (_("%P: linkage table error against `%T'\n"),
 	     stub_entry->root.string);
 	  bfd_set_error (bfd_error_bad_value);
 	  htab->stub_error = TRUE;
@@ -10100,53 +10615,54 @@
 	  if (PPC_HA (off) != 0)
 	    {
 	      size = 16;
-	      bfd_put_32 (htab->stub_bfd, ADDIS_R12_R2 | PPC_HA (off), loc);
+	      bfd_put_32 (htab->stub_bfd, ADDIS_R11_R2 | PPC_HA (off), loc);
 	      loc += 4;
-	      bfd_put_32 (htab->stub_bfd, LD_R11_0R12 | PPC_LO (off), loc);
+	      bfd_put_32 (htab->stub_bfd, LD_R12_0R11 | PPC_LO (off), loc);
 	    }
 	  else
 	    {
 	      size = 12;
-	      bfd_put_32 (htab->stub_bfd, LD_R11_0R2 | PPC_LO (off), loc);
+	      bfd_put_32 (htab->stub_bfd, LD_R12_0R2 | PPC_LO (off), loc);
 	    }
 	}
       else
 	{
 	  bfd_vma r2off = get_r2off (info, stub_entry);
 
-	  if (r2off == 0)
+	  if (r2off == 0 && htab->opd_abi)
 	    {
 	      htab->stub_error = TRUE;
 	      return FALSE;
 	    }
 
-	  bfd_put_32 (htab->stub_bfd, STD_R2_40R1, loc);
+	  bfd_put_32 (htab->stub_bfd, STD_R2_0R1 + STK_TOC (htab), loc);
 	  loc += 4;
-	  size = 20;
+	  size = 16;
 	  if (PPC_HA (off) != 0)
 	    {
 	      size += 4;
-	      bfd_put_32 (htab->stub_bfd, ADDIS_R12_R2 | PPC_HA (off), loc);
+	      bfd_put_32 (htab->stub_bfd, ADDIS_R11_R2 | PPC_HA (off), loc);
 	      loc += 4;
-	      bfd_put_32 (htab->stub_bfd, LD_R11_0R12 | PPC_LO (off), loc);
-	      loc += 4;
+	      bfd_put_32 (htab->stub_bfd, LD_R12_0R11 | PPC_LO (off), loc);
 	    }
 	  else
-	    {
-	      bfd_put_32 (htab->stub_bfd, LD_R11_0R2 | PPC_LO (off), loc);
-	      loc += 4;
-	    }
+	    bfd_put_32 (htab->stub_bfd, LD_R12_0R2 | PPC_LO (off), loc);
 
 	  if (PPC_HA (r2off) != 0)
 	    {
 	      size += 4;
-	      bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
 	      loc += 4;
+	      bfd_put_32 (htab->stub_bfd, ADDIS_R2_R2 | PPC_HA (r2off), loc);
 	    }
-	  bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
+	  if (PPC_LO (r2off) != 0)
+	    {
+	      size += 4;
+	      loc += 4;
+	      bfd_put_32 (htab->stub_bfd, ADDI_R2_R2 | PPC_LO (r2off), loc);
+	    }
 	}
       loc += 4;
-      bfd_put_32 (htab->stub_bfd, MTCTR_R11, loc);
+      bfd_put_32 (htab->stub_bfd, MTCTR_R12, loc);
       loc += 4;
       bfd_put_32 (htab->stub_bfd, BCTR, loc);
       break;
@@ -10176,11 +10692,11 @@
       if (dest >= (bfd_vma) -2)
 	abort ();
 
-      plt = htab->plt;
+      plt = htab->elf.splt;
       if (!htab->elf.dynamic_sections_created
 	  || stub_entry->h == NULL
 	  || stub_entry->h->elf.dynindx == -1)
-	plt = htab->iplt;
+	plt = htab->elf.iplt;
 
       dest += plt->output_offset + plt->output_section->vma;
 
@@ -10191,13 +10707,16 @@
 	  bfd_byte *rl;
 
 	  rela.r_offset = dest;
-	  rela.r_info = ELF64_R_INFO (0, R_PPC64_JMP_IREL);
+	  if (htab->opd_abi)
+	    rela.r_info = ELF64_R_INFO (0, R_PPC64_JMP_IREL);
+	  else
+	    rela.r_info = ELF64_R_INFO (0, R_PPC64_IRELATIVE);
 	  rela.r_addend = (stub_entry->target_value
 			   + stub_entry->target_section->output_offset
 			   + stub_entry->target_section->output_section->vma);
 
-	  rl = (htab->reliplt->contents
-		+ (htab->reliplt->reloc_count++
+	  rl = (htab->elf.irelplt->contents
+		+ (htab->elf.irelplt->reloc_count++
 		   * sizeof (Elf64_External_Rela)));
 	  bfd_elf64_swap_reloca_out (info->output_bfd, &rela, rl);
 	  stub_entry->plt_ent->plt.offset |= 1;
@@ -10210,7 +10729,7 @@
       if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
 	{
 	  info->callbacks->einfo
-	    (_("%P: linkage table error against `%s'\n"),
+	    (_("%P: linkage table error against `%T'\n"),
 	     stub_entry->h != NULL
 	     ? stub_entry->h->elf.root.root.string
 	     : "<local sym>");
@@ -10327,11 +10846,11 @@
       off = stub_entry->plt_ent->plt.offset & ~(bfd_vma) 1;
       if (off >= (bfd_vma) -2)
 	abort ();
-      plt = htab->plt;
+      plt = htab->elf.splt;
       if (!htab->elf.dynamic_sections_created
 	  || stub_entry->h == NULL
 	  || stub_entry->h->elf.dynindx == -1)
-	plt = htab->iplt;
+	plt = htab->elf.iplt;
       off += (plt->output_offset
 	      + plt->output_section->vma
 	      - elf_gp (plt->output_section->owner)
@@ -10343,10 +10862,11 @@
       if (info->emitrelocations)
 	{
 	  stub_entry->stub_sec->reloc_count
-	    += (2
-		+ (PPC_HA (off) != 0)
-		+ (htab->plt_static_chain
-		   && PPC_HA (off + 16) == PPC_HA (off)));
+	    += ((PPC_HA (off) != 0)
+		+ (htab->opd_abi
+		   ? 2 + (htab->plt_static_chain
+			  && PPC_HA (off + 16) == PPC_HA (off))
+		   : 1));
 	  stub_entry->stub_sec->flags |= SEC_RELOC;
 	}
     }
@@ -10355,6 +10875,7 @@
       /* ppc_stub_long_branch or ppc_stub_plt_branch, or their r2off
 	 variants.  */
       bfd_vma r2off = 0;
+      bfd_vma local_off = 0;
 
       off = (stub_entry->target_value
 	     + stub_entry->target_section->output_offset
@@ -10372,7 +10893,7 @@
       if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
 	{
 	  r2off = get_r2off (info, stub_entry);
-	  if (r2off == 0)
+	  if (r2off == 0 && htab->opd_abi)
 	    {
 	      htab->stub_error = TRUE;
 	      return FALSE;
@@ -10383,8 +10904,13 @@
 	  off -= size - 4;
 	}
 
-      /* If the branch offset if too big, use a ppc_stub_plt_branch.  */
-      if (off + (1 << 25) >= (bfd_vma) (1 << 26))
+      local_off = PPC64_LOCAL_ENTRY_OFFSET (stub_entry->other);
+
+      /* If the branch offset if too big, use a ppc_stub_plt_branch.
+	 Do the same for -R objects without function descriptors.  */
+      if (off + (1 << 25) >= (bfd_vma) (1 << 26) - local_off
+	  || (stub_entry->stub_type == ppc_stub_long_branch_r2off
+	      && r2off == 0))
 	{
 	  struct ppc_branch_hash_entry *br_entry;
 
@@ -10435,12 +10961,14 @@
 	    }
 	  else
 	    {
-	      size = 20;
+	      size = 16;
 	      if (PPC_HA (off) != 0)
 		size += 4;
 
 	      if (PPC_HA (r2off) != 0)
 		size += 4;
+	      if (PPC_LO (r2off) != 0)
+		size += 4;
 	    }
 	}
       else if (info->emitrelocations)
@@ -10477,9 +11005,6 @@
   htab->add_stub_section = add_stub_section;
   htab->layout_sections_again = layout_sections_again;
 
-  if (htab->brlt == NULL)
-    return 0;
-
   /* Find the top input section id.  */
   for (input_bfd = info->input_bfds, top_id = 3;
        input_bfd != NULL;
@@ -10532,8 +11057,7 @@
 {
   struct ppc_link_hash_table *htab = ppc_hash_table (info);
 
-  elf_gp (info->output_bfd) = ppc64_elf_toc (info->output_bfd);
-  htab->toc_curr = elf_gp (info->output_bfd);
+  htab->toc_curr = ppc64_elf_set_toc (info, info->output_bfd);
   htab->toc_bfd = NULL;
   htab->toc_first_sec = NULL;
 }
@@ -10694,8 +11218,8 @@
     }
 
   /* Zap sizes of got sections.  */
-  htab->reliplt->rawsize = htab->reliplt->size;
-  htab->reliplt->size -= htab->got_reli_size;
+  htab->elf.irelplt->rawsize = htab->elf.irelplt->size;
+  htab->elf.irelplt->size -= htab->got_reli_size;
   htab->got_reli_size = 0;
 
   for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
@@ -10727,7 +11251,7 @@
       unsigned char *lgot_masks;
       bfd_size_type locsymcount;
       Elf_Internal_Shdr *symtab_hdr;
-      asection *s, *srel;
+      asection *s;
 
       if (!is_ppc64_elf (ibfd))
 	continue;
@@ -10743,26 +11267,31 @@
       end_local_plt = local_plt + locsymcount;
       lgot_masks = (unsigned char *) end_local_plt;
       s = ppc64_elf_tdata (ibfd)->got;
-      srel = ppc64_elf_tdata (ibfd)->relgot;
       for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_masks)
 	{
 	  struct got_entry *ent;
 
 	  for (ent = *lgot_ents; ent != NULL; ent = ent->next)
 	    {
-	      unsigned int num = 1;
+	      unsigned int ent_size = 8;
+	      unsigned int rel_size = sizeof (Elf64_External_Rela);
+
 	      ent->got.offset = s->size;
 	      if ((ent->tls_type & *lgot_masks & TLS_GD) != 0)
-		num = 2;
-	      s->size += num * 8;
-	      if (info->shared)
-		srel->size += num * sizeof (Elf64_External_Rela);
-	      else if ((*lgot_masks & PLT_IFUNC) != 0)
 		{
-		  htab->reliplt->size
-		    += num * sizeof (Elf64_External_Rela);
-		  htab->got_reli_size
-		    += num * sizeof (Elf64_External_Rela);
+		  ent_size *= 2;
+		  rel_size *= 2;
+		}
+	      s->size += ent_size;
+	      if ((*lgot_masks & PLT_IFUNC) != 0)
+		{
+		  htab->elf.irelplt->size += rel_size;
+		  htab->got_reli_size += rel_size;
+		}
+	      else if (info->shared)
+		{
+		  asection *srel = ppc64_elf_tdata (ibfd)->relgot;
+		  srel->size += rel_size;
 		}
 	    }
 	}
@@ -10792,7 +11321,7 @@
 	}
     }
 
-  done_something = htab->reliplt->rawsize != htab->reliplt->size;
+  done_something = htab->elf.irelplt->rawsize != htab->elf.irelplt->size;
   if (!done_something)
     for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
       {
@@ -10980,7 +11509,10 @@
 	     need a plt_branch stub.  A plt_branch stub uses r2.  */
 	  else if (dest - (isec->output_offset
 			   + isec->output_section->vma
-			   + rel->r_offset) + (1 << 25) >= (2 << 25))
+			   + rel->r_offset) + (1 << 25)
+		   >= (2u << 25) - PPC64_LOCAL_ENTRY_OFFSET (h
+							     ? h->other
+							     : sym->st_other))
 	    {
 	      ret = 1;
 	      break;
@@ -11074,42 +11606,25 @@
 
   if (htab->multi_toc_needed)
     {
-      /* If a code section has a function that uses the TOC then we need
-	 to use the right TOC (obviously).  Also, make sure that .opd gets
-	 the correct TOC value for R_PPC64_TOC relocs that don't have or
-	 can't find their function symbol (shouldn't ever happen now).
-	 Also specially treat .fixup for the linux kernel.  .fixup
-	 contains branches, but only back to the function that hit an
-	 exception.  */
-      if (isec->has_toc_reloc
-	  || (isec->flags & SEC_CODE) == 0
-	  || strcmp (isec->name, ".fixup") == 0)
+      /* Analyse sections that aren't already flagged as needing a
+	 valid toc pointer.  Exclude .fixup for the linux kernel.
+	 .fixup contains branches, but only back to the function that
+	 hit an exception.  */
+      if (!(isec->has_toc_reloc
+	    || (isec->flags & SEC_CODE) == 0
+	    || strcmp (isec->name, ".fixup") == 0
+	    || isec->call_check_done))
 	{
-	  if (elf_gp (isec->owner) != 0)
-	    htab->toc_curr = elf_gp (isec->owner);
-	}
-      else
-	{
-	  if (!isec->call_check_done
-	      && toc_adjusting_stub_needed (info, isec) < 0)
+	  if (toc_adjusting_stub_needed (info, isec) < 0)
 	    return FALSE;
-	  /* If we make a local call from this section, ie. a branch
-	     without a following nop, then we have no place to put a
-	     toc restoring insn.  We must use the same toc group as
-	     the callee.
-	     Testing makes_toc_func_call actually tests for *any*
-	     calls to functions that need a good toc pointer.  A more
-	     precise test would be better, as this one will set
-	     incorrect values for pasted .init/.fini fragments.
-	     (Fixed later in check_pasted_section.)  */
-	  if (isec->makes_toc_func_call
-	      && elf_gp (isec->owner) != 0)
-	    htab->toc_curr = elf_gp (isec->owner);
 	}
+      /* Make all sections use the TOC assigned for this object file.
+	 This will be wrong for pasted sections;  We fix that in
+	 check_pasted_section().  */
+      if (elf_gp (isec->owner) != 0)
+	htab->toc_curr = elf_gp (isec->owner);
     }
 
-  /* Functions that don't use the TOC can belong in any TOC group.
-     Use the last TOC base.  */
   htab->stub_group[isec->id].toc_off = htab->toc_curr;
   return TRUE;
 }
@@ -11294,6 +11809,7 @@
 {
   if (isec->size == 0
       && isec->output_section->size == 0
+      && !(isec->output_section->flags & SEC_KEEP)
       && !bfd_section_removed_from_list (info->output_bfd,
 					 isec->output_section)
       && elf_section_data (isec->output_section)->dynindx == 0)
@@ -11324,9 +11840,13 @@
 
   htab->plt_static_chain = plt_static_chain;
   htab->plt_stub_align = plt_stub_align;
-  if (plt_thread_safe == -1)
+  if (plt_thread_safe == -1 && !info->executable)
+    plt_thread_safe = 1;
+  if (!htab->opd_abi)
+    plt_thread_safe = 0;
+  else if (plt_thread_safe == -1)
     {
-      const char *const thread_starter[] =
+      static const char *const thread_starter[] =
 	{
 	  "pthread_create",
 	  /* libstdc++ */
@@ -11342,7 +11862,7 @@
 	  "GOMP_parallel_loop_dynamic_start",
 	  "GOMP_parallel_loop_guided_start",
 	  "GOMP_parallel_loop_runtime_start",
-	  "GOMP_parallel_sections_start", 
+	  "GOMP_parallel_sections_start",
 	};
       unsigned i;
 
@@ -11430,6 +11950,7 @@
 		  asection *sym_sec, *code_sec;
 		  bfd_vma sym_value, code_value;
 		  bfd_vma destination;
+		  unsigned long local_off;
 		  bfd_boolean ok_dest;
 		  struct ppc_link_hash_entry *hash;
 		  struct ppc_link_hash_entry *fdh;
@@ -11506,12 +12027,16 @@
 		    }
 
 		  destination = 0;
+		  local_off = 0;
 		  if (ok_dest)
 		    {
 		      sym_value += irela->r_addend;
 		      destination = (sym_value
 				     + sym_sec->output_offset
 				     + sym_sec->output_section->vma);
+		      local_off = PPC64_LOCAL_ENTRY_OFFSET (hash
+							    ? hash->elf.other
+							    : sym->st_other);
 		    }
 
 		  code_sec = sym_sec;
@@ -11548,7 +12073,8 @@
 		  /* Determine what (if any) linker stub is needed.  */
 		  plt_ent = NULL;
 		  stub_type = ppc_type_of_stub (section, irela, &hash,
-						&plt_ent, destination);
+						&plt_ent, destination,
+						local_off);
 
 		  if (stub_type != ppc_stub_plt_call)
 		    {
@@ -11648,7 +12174,7 @@
 		    }
 		  stub_entry->h = hash;
 		  stub_entry->plt_ent = plt_ent;
-		  stub_entry->addend = irela->r_addend;
+		  stub_entry->other = hash ? hash->elf.other : sym->st_other;
 
 		  if (stub_entry->h != NULL)
 		    htab->stub_globals += 1;
@@ -11757,7 +12283,7 @@
    move, we'll be called again.  Provide a value for TOCstart.  */
 
 bfd_vma
-ppc64_elf_toc (bfd *obfd)
+ppc64_elf_set_toc (struct bfd_link_info *info, bfd *obfd)
 {
   asection *s;
   bfd_vma TOCstart;
@@ -11808,9 +12334,88 @@
   if (s != NULL)
     TOCstart = s->output_section->vma + s->output_offset;
 
+  _bfd_set_gp_value (obfd, TOCstart);
+
+  if (info != NULL && s != NULL && is_ppc64_elf (obfd))
+    {
+      struct ppc_link_hash_table *htab = ppc_hash_table (info);
+
+      if (htab != NULL
+	  && htab->elf.hgot != NULL)
+	{
+	  htab->elf.hgot->root.u.def.value = TOC_BASE_OFF;
+	  htab->elf.hgot->root.u.def.section = s;
+	}
+    }
   return TOCstart;
 }
 
+/* Called via elf_link_hash_traverse from ppc64_elf_build_stubs to
+   write out any global entry stubs.  */
+
+static bfd_boolean
+build_global_entry_stubs (struct elf_link_hash_entry *h, void *inf)
+{
+  struct bfd_link_info *info;
+  struct ppc_link_hash_table *htab;
+  struct plt_entry *pent;
+  asection *s;
+
+  if (h->root.type == bfd_link_hash_indirect)
+    return TRUE;
+
+  if (!h->pointer_equality_needed)
+    return TRUE;
+
+  if (h->def_regular)
+    return TRUE;
+
+  info = inf;
+  htab = ppc_hash_table (info);
+  if (htab == NULL)
+    return FALSE;
+
+  s = htab->glink;
+  for (pent = h->plt.plist; pent != NULL; pent = pent->next)
+    if (pent->plt.offset != (bfd_vma) -1
+	&& pent->addend == 0)
+      {
+	bfd_byte *p;
+	asection *plt;
+	bfd_vma off;
+
+	p = s->contents + h->root.u.def.value;
+	plt = htab->elf.splt;
+	if (!htab->elf.dynamic_sections_created
+	    || h->dynindx == -1)
+	  plt = htab->elf.iplt;
+	off = pent->plt.offset + plt->output_offset + plt->output_section->vma;
+	off -= h->root.u.def.value + s->output_offset + s->output_section->vma;
+
+	if (off + 0x80008000 > 0xffffffff || (off & 3) != 0)
+	  {
+	    info->callbacks->einfo
+	      (_("%P: linkage table error against `%T'\n"),
+	       h->root.root.string);
+	    bfd_set_error (bfd_error_bad_value);
+	    htab->stub_error = TRUE;
+	  }
+
+	if (PPC_HA (off) != 0)
+	  {
+	    bfd_put_32 (s->owner, ADDIS_R12_R12 | PPC_HA (off), p);
+	    p += 4;
+	  }
+	bfd_put_32 (s->owner, LD_R12_0R12 | PPC_LO (off), p);
+	p += 4;
+	bfd_put_32 (s->owner, MTCTR_R12, p);
+	p += 4;
+	bfd_put_32 (s->owner, BCTR, p);
+	break;
+      }
+  return TRUE;
+}
+
 /* Build all the stubs associated with the current output file.
    The stubs are kept in a hash table attached to the main linker
    hash table.  This function is called via gldelf64ppc_finish.  */
@@ -11871,7 +12476,9 @@
 	      h->non_elf = 0;
 	    }
 	}
-      plt0 = htab->plt->output_section->vma + htab->plt->output_offset - 16;
+      plt0 = (htab->elf.splt->output_section->vma
+	      + htab->elf.splt->output_offset
+	      - 16);
       if (info->emitrelocations)
 	{
 	  Elf_Internal_Rela *r = get_relocs (htab->glink, 1);
@@ -11886,26 +12493,56 @@
       plt0 -= htab->glink->output_section->vma + htab->glink->output_offset;
       bfd_put_64 (htab->glink->owner, plt0, p);
       p += 8;
-      bfd_put_32 (htab->glink->owner, MFLR_R12, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, BCL_20_31, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, MFLR_R11, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, LD_R2_M16R11, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, MTLR_R12, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, ADD_R12_R2_R11, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, LD_R11_0R12, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, LD_R2_0R12 | 8, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, MTCTR_R11, p);
-      p += 4;
-      bfd_put_32 (htab->glink->owner, LD_R11_0R12 | 16, p);
-      p += 4;
+      if (htab->opd_abi)
+	{
+	  bfd_put_32 (htab->glink->owner, MFLR_R12, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, BCL_20_31, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, MFLR_R11, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, LD_R2_0R11 | (-16 & 0xfffc), p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, MTLR_R12, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, ADD_R11_R2_R11, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, LD_R12_0R11, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, LD_R2_0R11 | 8, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, MTCTR_R12, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, LD_R11_0R11 | 16, p);
+	  p += 4;
+	}
+      else
+	{
+	  bfd_put_32 (htab->glink->owner, MFLR_R0, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, BCL_20_31, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, MFLR_R11, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, LD_R2_0R11 | (-16 & 0xfffc), p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, MTLR_R0, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, SUB_R12_R12_R11, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, ADD_R11_R2_R11, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, ADDI_R0_R12 | (-48 & 0xffff), p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, LD_R12_0R11, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, SRDI_R0_R0_2, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, MTCTR_R12, p);
+	  p += 4;
+	  bfd_put_32 (htab->glink->owner, LD_R11_0R11 | 8, p);
+	  p += 4;
+	}
       bfd_put_32 (htab->glink->owner, BCTR, p);
       p += 4;
       while (p - htab->glink->contents < GLINK_CALL_STUB_SIZE)
@@ -11916,26 +12553,33 @@
 
       /* Build the .glink lazy link call stubs.  */
       indx = 0;
-      while (p < htab->glink->contents + htab->glink->size)
+      while (p < htab->glink->contents + htab->glink->rawsize)
 	{
-	  if (indx < 0x8000)
+	  if (htab->opd_abi)
 	    {
-	      bfd_put_32 (htab->glink->owner, LI_R0_0 | indx, p);
-	      p += 4;
-	    }
-	  else
-	    {
-	      bfd_put_32 (htab->glink->owner, LIS_R0_0 | PPC_HI (indx), p);
-	      p += 4;
-	      bfd_put_32 (htab->glink->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
-	      p += 4;
+	      if (indx < 0x8000)
+		{
+		  bfd_put_32 (htab->glink->owner, LI_R0_0 | indx, p);
+		  p += 4;
+		}
+	      else
+		{
+		  bfd_put_32 (htab->glink->owner, LIS_R0_0 | PPC_HI (indx), p);
+		  p += 4;
+		  bfd_put_32 (htab->glink->owner, ORI_R0_R0_0 | PPC_LO (indx),
+			      p);
+		  p += 4;
+		}
 	    }
 	  bfd_put_32 (htab->glink->owner,
 		      B_DOT | ((htab->glink->contents - p + 8) & 0x3fffffc), p);
 	  indx++;
 	  p += 4;
 	}
-      htab->glink->rawsize = p - htab->glink->contents;
+
+      /* Build .glink global entry stubs.  */
+      if (htab->glink->size > htab->glink->rawsize)
+	elf_link_hash_traverse (&htab->elf, build_global_entry_stubs, info);
     }
 
   if (htab->brlt->size != 0)
@@ -12039,7 +12683,7 @@
 	  bfd_put_32 (htab->elf.dynobj, val, p);
 	  p += 4;
 	  /* .glink size.  */
-	  bfd_put_32 (htab->elf.dynobj, htab->glink->rawsize - 8, p);
+	  bfd_put_32 (htab->elf.dynobj, htab->glink->size - 8, p);
 	  p += 4;
 	  /* Augmentation.  */
 	  p += 1;
@@ -12089,7 +12733,6 @@
       }
 
   if (stub_sec != NULL
-      || htab->glink->rawsize != htab->glink->size
       || (htab->glink_eh_frame != NULL
 	  && htab->glink_eh_frame->rawsize != htab->glink_eh_frame->size))
     {
@@ -12249,7 +12892,7 @@
   for (; rel < relend; rel++)
     {
       enum elf_ppc64_reloc_type r_type;
-      bfd_vma addend, orig_addend;
+      bfd_vma addend;
       bfd_reloc_status_type r;
       Elf_Internal_Sym *sym;
       asection *sec;
@@ -12264,11 +12907,13 @@
       bfd_vma relocation;
       bfd_boolean unresolved_reloc;
       bfd_boolean warned;
+      enum { DEST_NORMAL, DEST_OPD, DEST_STUB } reloc_dest;
       unsigned int insn;
       unsigned int mask;
       struct ppc_stub_hash_entry *stub_entry;
       bfd_vma max_br_offset;
       bfd_vma from;
+      const Elf_Internal_Rela orig_rel = *rel;
 
       r_type = ELF64_R_TYPE (rel->r_info);
       r_symndx = ELF64_R_SYM (rel->r_info);
@@ -12288,7 +12933,6 @@
       sym_name = NULL;
       unresolved_reloc = FALSE;
       warned = FALSE;
-      orig_addend = rel->r_addend;
 
       if (r_symndx < symtab_hdr->sh_info)
 	{
@@ -12322,12 +12966,41 @@
 	}
       else
 	{
+	  bfd_boolean ignored;
+
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h_elf, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  sym_name = h_elf->root.root.string;
 	  sym_type = h_elf->type;
+	  if (sec != NULL
+	      && sec->owner == output_bfd
+	      && strcmp (sec->name, ".opd") == 0)
+	    {
+	      /* This is a symbol defined in a linker script.  All
+		 such are defined in output sections, even those
+		 defined by simple assignment from a symbol defined in
+		 an input section.  Transfer the symbol to an
+		 appropriate input .opd section, so that a branch to
+		 this symbol will be mapped to the location specified
+		 by the opd entry.  */
+	      struct bfd_link_order *lo;
+	      for (lo = sec->map_head.link_order; lo != NULL; lo = lo->next)
+		if (lo->type == bfd_indirect_link_order)
+		  {
+		    asection *isec = lo->u.indirect.section;
+		    if (h_elf->root.u.def.value >= isec->output_offset
+			&& h_elf->root.u.def.value < (isec->output_offset
+						      + isec->size))
+		      {
+			h_elf->root.u.def.value -= isec->output_offset;
+			h_elf->root.u.def.section = isec;
+			sec = isec;
+			break;
+		      }
+		  }
+	    }
 	}
       h = (struct ppc_link_hash_entry *) h_elf;
 
@@ -12340,6 +13013,14 @@
       if (info->relocatable)
 	continue;
 
+      if (h != NULL && &h->elf == htab->elf.hgot)
+	{
+	  relocation = (TOCstart
+			+ htab->stub_group[input_section->id].toc_off);
+	  sec = bfd_abs_section_ptr;
+	  unresolved_reloc = FALSE;
+	}
+
       /* TLS optimizations.  Replace instruction sequences and relocs
 	 based on information we collected in tls_optimize.  We edit
 	 RELOCS so that --emit-relocs will output something sensible
@@ -12394,8 +13075,8 @@
 	  else
 	    info->callbacks->einfo
 	      (!IS_PPC64_TLS_RELOC (r_type)
-	       ? _("%P: %H: %s used with TLS symbol %s\n")
-	       : _("%P: %H: %s used with non-TLS symbol %s\n"),
+	       ? _("%P: %H: %s used with TLS symbol `%T'\n")
+	       : _("%P: %H: %s used with non-TLS symbol `%T'\n"),
 	       input_bfd, input_section, rel->r_offset,
 	       ppc64_elf_howto_table[r_type]->name,
 	       sym_name);
@@ -12795,12 +13476,46 @@
 	      rel->r_info = ELF64_R_INFO (r_symndx, r_type);
 	    }
 	  break;
+
+	case R_PPC64_REL16_HA:
+	  /* If we are generating a non-PIC executable, edit
+	     .	0:	addis 2,12,.TOC.-0b@ha
+	     .		addi 2,2,.TOC.-0b@l
+	     used by ELFv2 global entry points to set up r2, to
+	     .		lis 2,.TOC.@ha
+	     .		addi 2,2,.TOC.@l
+	     if .TOC. is in range.  */
+	  if (!info->shared
+	      && h != NULL && &h->elf == htab->elf.hgot
+	      && rel + 1 < relend
+	      && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_REL16_LO)
+	      && rel[1].r_offset == rel->r_offset + 4
+	      && rel[1].r_addend == rel->r_addend + 4
+	      && relocation + 0x80008000 <= 0xffffffff)
+	    {
+	      unsigned int insn1, insn2;
+	      bfd_vma offset = rel->r_offset - d_offset;
+	      insn1 = bfd_get_32 (output_bfd, contents + offset);
+	      insn2 = bfd_get_32 (output_bfd, contents + offset + 4);
+	      if ((insn1 & 0xffff0000) == 0x3c4c0000 /* addis 2,12 */
+		  && (insn2 & 0xffff0000) == 0x38420000 /* addi 2,2 */)
+		{
+		  r_type = R_PPC64_ADDR16_HA;
+		  rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+		  rel->r_addend -= d_offset;
+		  rel[1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_ADDR16_LO);
+		  rel[1].r_addend -= d_offset + 4;
+		  bfd_put_32 (output_bfd, 0x3c400000, contents + offset);
+		}
+	    }
+	  break;
 	}
 
       /* Handle other relocations that tweak non-addend part of insn.  */
       insn = 0;
       max_br_offset = 1 << 25;
       addend = rel->r_addend;
+      reloc_dest = DEST_NORMAL;
       switch (r_type)
 	{
 	default:
@@ -12816,7 +13531,8 @@
 	      insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
 	      if (insn == NOP
 		  || insn == CROR_151515 || insn == CROR_313131)
-		bfd_put_32 (input_bfd, STD_R2_40R1,
+		bfd_put_32 (input_bfd,
+			    STD_R2_0R1 + STK_TOC (htab),
 			    contents + rel->r_offset);
 	    }
 	  break;
@@ -12850,7 +13566,8 @@
 	      && h->oh != NULL
 	      && h->oh->is_func_descriptor)
 	    fdh = ppc_follow_link (h->oh);
-	  stub_entry = ppc_get_stub_entry (input_section, sec, fdh, rel, htab);
+	  stub_entry = ppc_get_stub_entry (input_section, sec, fdh, &orig_rel,
+					   htab);
 	  if (stub_entry != NULL
 	      && (stub_entry->stub_type == ppc_stub_plt_call
 		  || stub_entry->stub_type == ppc_stub_plt_call_r2save
@@ -12859,74 +13576,90 @@
 	    {
 	      bfd_boolean can_plt_call = FALSE;
 
+	      /* All of these stubs will modify r2, so there must be a
+		 branch and link followed by a nop.  The nop is
+		 replaced by an insn to restore r2.  */
 	      if (rel->r_offset + 8 <= input_section->size)
 		{
-		  unsigned long nop;
-		  nop = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
-		  if (nop == NOP
-		      || nop == CROR_151515 || nop == CROR_313131)
+		  unsigned long br;
+
+		  br = bfd_get_32 (input_bfd,
+				   contents + rel->r_offset);
+		  if ((br & 1) != 0)
 		    {
-		      if (h != NULL
-			  && (h == htab->tls_get_addr_fd
-			      || h == htab->tls_get_addr)
-			  && !htab->no_tls_get_addr_opt)
+		      unsigned long nop;
+
+		      nop = bfd_get_32 (input_bfd,
+					contents + rel->r_offset + 4);
+		      if (nop == NOP
+			  || nop == CROR_151515 || nop == CROR_313131)
 			{
-			  /* Special stub used, leave nop alone.  */
+			  if (h != NULL
+			      && (h == htab->tls_get_addr_fd
+				  || h == htab->tls_get_addr)
+			      && !htab->no_tls_get_addr_opt)
+			    {
+			      /* Special stub used, leave nop alone.  */
+			    }
+			  else
+			    bfd_put_32 (input_bfd,
+					LD_R2_0R1 + STK_TOC (htab),
+					contents + rel->r_offset + 4);
+			  can_plt_call = TRUE;
 			}
-		      else
-			bfd_put_32 (input_bfd, LD_R2_40R1,
-				    contents + rel->r_offset + 4);
+		    }
+		}
+
+	      if (!can_plt_call && h != NULL)
+		{
+		  const char *name = h->elf.root.root.string;
+
+		  if (*name == '.')
+		    ++name;
+
+		  if (strncmp (name, "__libc_start_main", 17) == 0
+		      && (name[17] == 0 || name[17] == '@'))
+		    {
+		      /* Allow crt1 branch to go via a toc adjusting
+			 stub.  Other calls that never return could do
+			 the same, if we could detect such.  */
 		      can_plt_call = TRUE;
 		    }
 		}
 
 	      if (!can_plt_call)
 		{
-		  if (stub_entry->stub_type == ppc_stub_plt_call
-		      || stub_entry->stub_type == ppc_stub_plt_call_r2save)
+		  /* g++ as of 20130507 emits self-calls without a
+		     following nop.  This is arguably wrong since we
+		     have conflicting information.  On the one hand a
+		     global symbol and on the other a local call
+		     sequence, but don't error for this special case.
+		     It isn't possible to cheaply verify we have
+		     exactly such a call.  Allow all calls to the same
+		     section.  */
+		  asection *code_sec = sec;
+
+		  if (get_opd_info (sec) != NULL)
 		    {
-		      /* If this is a plain branch rather than a branch
-			 and link, don't require a nop.  However, don't
-			 allow tail calls in a shared library as they
-			 will result in r2 being corrupted.  */
-		      unsigned long br;
-		      br = bfd_get_32 (input_bfd, contents + rel->r_offset);
-		      if (info->executable && (br & 1) == 0)
-			can_plt_call = TRUE;
-		      else
-			stub_entry = NULL;
+		      bfd_vma off = (relocation + addend
+				     - sec->output_section->vma
+				     - sec->output_offset);
+
+		      opd_entry_value (sec, off, &code_sec, NULL, FALSE);
 		    }
-		  else if (h != NULL
-			   && strcmp (h->elf.root.root.string,
-				      ".__libc_start_main") == 0)
-		    {
-		      /* Allow crt1 branch to go via a toc adjusting stub.  */
-		      can_plt_call = TRUE;
-		    }
-		  else
-		    {
-		      if (strcmp (input_section->output_section->name,
-				  ".init") == 0
-			  || strcmp (input_section->output_section->name,
-				     ".fini") == 0)
-			info->callbacks->einfo
-			  (_("%P: %H: automatic multiple TOCs "
-			     "not supported using your crt files; "
-			     "recompile with -mminimal-toc or upgrade gcc\n"),
-			   input_bfd, input_section, rel->r_offset);
-		      else
-			info->callbacks->einfo
-			  (_("%P: %H: sibling call optimization to `%s' "
-			     "does not allow automatic multiple TOCs; "
-			     "recompile with -mminimal-toc or "
-			     "-fno-optimize-sibling-calls, "
-			     "or make `%s' extern\n"),
-			   input_bfd, input_section, rel->r_offset,
-			   sym_name,
-			   sym_name);
-		      bfd_set_error (bfd_error_bad_value);
-		      ret = FALSE;
-		    }
+		  if (code_sec == input_section)
+		    can_plt_call = TRUE;
+		}
+
+	      if (!can_plt_call)
+		{
+		  info->callbacks->einfo
+		    (_("%P: %H: call to `%T' lacks nop, can't restore toc; "
+		       "recompile with -fPIC"),
+		     input_bfd, input_section, rel->r_offset, sym_name);
+
+		  bfd_set_error (bfd_error_bad_value);
+		  ret = FALSE;
 		}
 
 	      if (can_plt_call
@@ -12949,6 +13682,7 @@
 		{
 		  relocation = dest;
 		  addend = 0;
+		  reloc_dest = DEST_OPD;
 		}
 	    }
 
@@ -12958,6 +13692,10 @@
 		  + input_section->output_offset
 		  + input_section->output_section->vma);
 
+	  relocation += PPC64_LOCAL_ENTRY_OFFSET (fdh
+						  ? fdh->elf.other
+						  : sym->st_other);
+
 	  if (stub_entry != NULL
 	      && (stub_entry->stub_type == ppc_stub_long_branch
 		  || stub_entry->stub_type == ppc_stub_plt_branch)
@@ -12976,6 +13714,7 @@
 			    + stub_entry->stub_sec->output_offset
 			    + stub_entry->stub_sec->output_section->vma);
 	      addend = 0;
+	      reloc_dest = DEST_STUB;
 
  	      if ((stub_entry->stub_type == ppc_stub_plt_call
 		   || stub_entry->stub_type == ppc_stub_plt_call_r2save)
@@ -13033,7 +13772,7 @@
 	{
 	default:
 	  info->callbacks->einfo
-	    (_("%P: %B: unknown relocation type %d for symbol %s\n"),
+	    (_("%P: %B: unknown relocation type %d for `%T'\n"),
 	     input_bfd, (int) r_type, sym_name);
 
 	  bfd_set_error (bfd_error_bad_value);
@@ -13110,7 +13849,7 @@
 		    if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared,
 							  &h->elf)
 			|| (info->shared
-			    && SYMBOL_CALLS_LOCAL (info, &h->elf)))
+			    && SYMBOL_REFERENCES_LOCAL (info, &h->elf)))
 		      /* This is actually a static link, or it is a
 			 -Bsymbolic link and the symbol is defined
 			 locally, or the symbol was forced to be local
@@ -13118,6 +13857,7 @@
 		      ;
 		    else
 		      {
+			BFD_ASSERT (h->elf.dynindx != -1);
 			indx = h->elf.dynindx;
 			unresolved_reloc = FALSE;
 		      }
@@ -13131,7 +13871,7 @@
 		  }
 
 		for (; ent != NULL; ent = ent->next)
-		  if (ent->addend == orig_addend
+		  if (ent->addend == orig_rel.r_addend
 		      && ent->owner == input_bfd
 		      && ent->tls_type == tls_type)
 		    break;
@@ -13165,15 +13905,15 @@
 		ifunc = (h != NULL
 			 ? h->elf.type == STT_GNU_IFUNC
 			 : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC);
-		if ((info->shared || indx != 0)
-		    && (h == NULL
-			|| (tls_type == (TLS_TLS | TLS_LD)
-			    && !h->elf.def_dynamic)
-			|| ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
-			|| h->elf.root.type != bfd_link_hash_undefweak))
+		if (ifunc)
+		  relgot = htab->elf.irelplt;
+		else if ((info->shared || indx != 0)
+			 && (h == NULL
+			     || (tls_type == (TLS_TLS | TLS_LD)
+				 && !h->elf.def_dynamic)
+			     || ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
+			     || h->elf.root.type != bfd_link_hash_undefweak))
 		  relgot = ppc64_elf_tdata (ent->owner)->relgot;
-		else if (ifunc)
-		  relgot = htab->reliplt;
 		if (relgot != NULL)
 		  {
 		    outrel.r_offset = (got->output_section->vma
@@ -13280,17 +14020,18 @@
 	     symbol.  This happens when statically linking PIC code,
 	     or when using -Bsymbolic.  Go find a match if there is a
 	     PLT entry.  */
-	  if (htab->plt != NULL)
+	  if (htab->elf.splt != NULL)
 	    {
 	      struct plt_entry *ent;
 	      for (ent = h->elf.plt.plist; ent != NULL; ent = ent->next)
-		if (ent->addend == orig_addend
-		    && ent->plt.offset != (bfd_vma) -1)
+		if (ent->plt.offset != (bfd_vma) -1
+		    && ent->addend == orig_rel.r_addend)
 		  {
-		    relocation = (htab->plt->output_section->vma
-				  + htab->plt->output_offset
+		    relocation = (htab->elf.splt->output_section->vma
+				  + htab->elf.splt->output_offset
 				  + ent->plt.offset);
 		    unresolved_reloc = FALSE;
+		    break;
 		  }
 	    }
 	  break;
@@ -13350,6 +14091,8 @@
 	case R_PPC64_TPREL16_HA:
 	case R_PPC64_TPREL16_DS:
 	case R_PPC64_TPREL16_LO_DS:
+	case R_PPC64_TPREL16_HIGH:
+	case R_PPC64_TPREL16_HIGHA:
 	case R_PPC64_TPREL16_HIGHER:
 	case R_PPC64_TPREL16_HIGHERA:
 	case R_PPC64_TPREL16_HIGHEST:
@@ -13384,6 +14127,8 @@
 	case R_PPC64_DTPREL16_HA:
 	case R_PPC64_DTPREL16_DS:
 	case R_PPC64_DTPREL16_LO_DS:
+	case R_PPC64_DTPREL16_HIGH:
+	case R_PPC64_DTPREL16_HIGHA:
 	case R_PPC64_DTPREL16_HIGHER:
 	case R_PPC64_DTPREL16_HIGHERA:
 	case R_PPC64_DTPREL16_HIGHEST:
@@ -13416,6 +14161,8 @@
 	case R_PPC64_ADDR16_DS:
 	case R_PPC64_ADDR16_HA:
 	case R_PPC64_ADDR16_HI:
+	case R_PPC64_ADDR16_HIGH:
+	case R_PPC64_ADDR16_HIGHA:
 	case R_PPC64_ADDR16_HIGHER:
 	case R_PPC64_ADDR16_HIGHERA:
 	case R_PPC64_ADDR16_HIGHEST:
@@ -13487,10 +14234,13 @@
 
 	      if (skip)
 		memset (&outrel, 0, sizeof outrel);
-	      else if (!SYMBOL_CALLS_LOCAL (info, &h->elf)
+	      else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
 		       && !is_opd
 		       && r_type != R_PPC64_TOC)
-		outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
+		{
+		  BFD_ASSERT (h->elf.dynindx != -1);
+		  outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
+		}
 	      else
 		{
 		  /* This symbol is local, or marked to become local,
@@ -13539,8 +14289,8 @@
 			  : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
 			{
 			  info->callbacks->einfo
-			    (_("%P: %H: relocation %s for indirect "
-			       "function %s unsupported\n"),
+			    (_("%P: %H: %s for indirect "
+			       "function `%T' unsupported\n"),
 			     input_bfd, input_section, rel->r_offset,
 			     ppc64_elf_howto_table[r_type]->name,
 			     sym_name);
@@ -13584,8 +14334,10 @@
 		}
 
 	      sreloc = elf_section_data (input_section)->sreloc;
-	      if (!htab->elf.dynamic_sections_created)
-		sreloc = htab->reliplt;
+	      if (h != NULL
+		  ? h->elf.type == STT_GNU_IFUNC
+		  : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+		sreloc = htab->elf.irelplt;
 	      if (sreloc == NULL)
 		abort ();
 
@@ -13644,7 +14396,7 @@
 	  /* These ones haven't been implemented yet.  */
 
 	  info->callbacks->einfo
-	    (_("%P: %B: relocation %s is not supported for symbol %s\n"),
+	    (_("%P: %B: %s is not supported for `%T'\n"),
 	     input_bfd,
 	     ppc64_elf_howto_table[r_type]->name, sym_name);
 
@@ -13725,21 +14477,20 @@
 	default:
 	  break;
 
-	case R_PPC64_ADDR16_HA:
 	case R_PPC64_REL16_HA:
+	case R_PPC64_ADDR16_HA:
+	case R_PPC64_ADDR16_HIGHA:
 	case R_PPC64_ADDR16_HIGHERA:
 	case R_PPC64_ADDR16_HIGHESTA:
 	case R_PPC64_TOC16_HA:
 	case R_PPC64_SECTOFF_HA:
 	case R_PPC64_TPREL16_HA:
-	case R_PPC64_DTPREL16_HA:
-	case R_PPC64_TPREL16_HIGHER:
+	case R_PPC64_TPREL16_HIGHA:
 	case R_PPC64_TPREL16_HIGHERA:
-	case R_PPC64_TPREL16_HIGHEST:
 	case R_PPC64_TPREL16_HIGHESTA:
-	case R_PPC64_DTPREL16_HIGHER:
+	case R_PPC64_DTPREL16_HA:
+	case R_PPC64_DTPREL16_HIGHA:
 	case R_PPC64_DTPREL16_HIGHERA:
-	case R_PPC64_DTPREL16_HIGHEST:
 	case R_PPC64_DTPREL16_HIGHESTA:
 	  /* It's just possible that this symbol is a weak symbol
 	     that's not actually defined anywhere. In that case,
@@ -13814,7 +14565,7 @@
 				      rel->r_offset) != (bfd_vma) -1)
 	{
 	  info->callbacks->einfo
-	    (_("%P: %H: unresolvable %s relocation against symbol `%s'\n"),
+	    (_("%P: %H: unresolvable %s against `%T'\n"),
 	     input_bfd, input_section, rel->r_offset,
 	     ppc64_elf_howto_table[(int) r_type]->name,
 	     h->elf.root.root.string);
@@ -13831,8 +14582,21 @@
 
       if (r != bfd_reloc_ok)
 	{
-	  if (sym_name == NULL)
-	    sym_name = "(null)";
+	  char *more_info = NULL;
+	  const char *reloc_name = ppc64_elf_howto_table[r_type]->name;
+
+	  if (reloc_dest != DEST_NORMAL)
+	    {
+	      more_info = bfd_malloc (strlen (reloc_name) + 8);
+	      if (more_info != NULL)
+		{
+		  strcpy (more_info, reloc_name);
+		  strcat (more_info, (reloc_dest == DEST_OPD
+				      ? " (OPD)" : " (stub)"));
+		  reloc_name = more_info;
+		}
+	    }
+
 	  if (r == bfd_reloc_overflow)
 	    {
 	      if (warned)
@@ -13851,21 +14615,21 @@
 		}
 
 	      if (!((*info->callbacks->reloc_overflow)
-		    (info, (h ? &h->elf.root : NULL), sym_name,
-		     ppc64_elf_howto_table[r_type]->name,
-		     orig_addend, input_bfd, input_section, rel->r_offset)))
+		    (info, &h->elf.root, sym_name,
+		     reloc_name, orig_rel.r_addend,
+		     input_bfd, input_section, rel->r_offset)))
 		return FALSE;
 	    }
 	  else
 	    {
 	      info->callbacks->einfo
-		(_("%P: %H: %s reloc against `%s': error %d\n"),
+		(_("%P: %H: %s against `%T': error %d\n"),
 		 input_bfd, input_section, rel->r_offset,
-		 ppc64_elf_howto_table[r_type]->name,
-		 sym_name,
-		 (int) r);
+		 reloc_name, sym_name, (int) r);
 	      ret = FALSE;
 	    }
+	  if (more_info != NULL)
+	    free (more_info);
 	}
     }
 
@@ -13879,8 +14643,8 @@
       bfd_size_type amt;
       amt = input_section->reloc_count * sizeof (Elf_Internal_Rela);
       rel = bfd_alloc (input_bfd, amt);
-      BFD_ASSERT (ppc64_elf_tdata (input_bfd)->opd_relocs == NULL);
-      ppc64_elf_tdata (input_bfd)->opd_relocs = rel;
+      BFD_ASSERT (ppc64_elf_tdata (input_bfd)->opd.relocs == NULL);
+      ppc64_elf_tdata (input_bfd)->opd.relocs = rel;
       if (rel == NULL)
 	return FALSE;
       memcpy (rel, relocs, amt);
@@ -13950,30 +14714,57 @@
 			&& h->def_regular
 			&& (h->root.type == bfd_link_hash_defined
 			    || h->root.type == bfd_link_hash_defweak));
-	    rela.r_offset = (htab->iplt->output_section->vma
-			     + htab->iplt->output_offset
+	    rela.r_offset = (htab->elf.iplt->output_section->vma
+			     + htab->elf.iplt->output_offset
 			     + ent->plt.offset);
-	    rela.r_info = ELF64_R_INFO (0, R_PPC64_JMP_IREL);
+	    if (htab->opd_abi)
+	      rela.r_info = ELF64_R_INFO (0, R_PPC64_JMP_IREL);
+	    else
+	      rela.r_info = ELF64_R_INFO (0, R_PPC64_IRELATIVE);
 	    rela.r_addend = (h->root.u.def.value
 			     + h->root.u.def.section->output_offset
 			     + h->root.u.def.section->output_section->vma
 			     + ent->addend);
-	    loc = (htab->reliplt->contents
-		   + (htab->reliplt->reloc_count++
+	    loc = (htab->elf.irelplt->contents
+		   + (htab->elf.irelplt->reloc_count++
 		      * sizeof (Elf64_External_Rela)));
 	  }
 	else
 	  {
-	    rela.r_offset = (htab->plt->output_section->vma
-			     + htab->plt->output_offset
+	    rela.r_offset = (htab->elf.splt->output_section->vma
+			     + htab->elf.splt->output_offset
 			     + ent->plt.offset);
 	    rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
 	    rela.r_addend = ent->addend;
-	    loc = (htab->relplt->contents
-		   + ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE)
-		      / (PLT_ENTRY_SIZE / sizeof (Elf64_External_Rela))));
+	    loc = (htab->elf.srelplt->contents
+		   + ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE (htab))
+		      / PLT_ENTRY_SIZE (htab) * sizeof (Elf64_External_Rela)));
 	  }
 	bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+
+	if (!htab->opd_abi)
+	  {
+	    if (!h->def_regular)
+	      {
+		/* Mark the symbol as undefined, rather than as
+		   defined in glink.  Leave the value if there were
+		   any relocations where pointer equality matters
+		   (this is a clue for the dynamic linker, to make
+		   function pointer comparisons work between an
+		   application and shared library), otherwise set it
+		   to zero.  */
+		sym->st_shndx = SHN_UNDEF;
+		if (!h->pointer_equality_needed)
+		  sym->st_value = 0;
+		else if (!h->ref_regular_nonweak)
+		  {
+		    /* This breaks function pointer comparisons, but
+		       that is better than breaking tests for a NULL
+		       function pointer.  */
+		    sym->st_value = 0;
+		  }
+	      }
+	  }
       }
 
   if (h->needs_copy)
@@ -14003,9 +14794,15 @@
    dynamic linker, before writing them out.  */
 
 static enum elf_reloc_type_class
-ppc64_elf_reloc_type_class (const Elf_Internal_Rela *rela)
+ppc64_elf_reloc_type_class (const struct bfd_link_info *info,
+			    const asection *rel_sec,
+			    const Elf_Internal_Rela *rela)
 {
   enum elf_ppc64_reloc_type r_type;
+  struct ppc_link_hash_table *htab = ppc_hash_table (info);
+
+  if (rel_sec == htab->elf.irelplt)
+    return reloc_class_ifunc;
 
   r_type = ELF64_R_TYPE (rela->r_info);
   switch (r_type)
@@ -14042,7 +14839,7 @@
     {
       Elf64_External_Dyn *dyncon, *dynconend;
 
-      if (sdyn == NULL || htab->got == NULL)
+      if (sdyn == NULL || htab->elf.sgot == NULL)
 	abort ();
 
       dyncon = (Elf64_External_Dyn *) sdyn->contents;
@@ -14066,7 +14863,7 @@
 		 of glink rather than the first entry point, which is
 		 what ld.so needs, and now have a bigger stub to
 		 support automatic multiple TOCs.  */
-	      dyn.d_un.d_ptr += GLINK_CALL_STUB_SIZE - 32;
+	      dyn.d_un.d_ptr += GLINK_CALL_STUB_SIZE - 8 * 4;
 	      break;
 
 	    case DT_PPC64_OPD:
@@ -14076,6 +14873,11 @@
 	      dyn.d_un.d_ptr = s->vma;
 	      break;
 
+	    case DT_PPC64_OPT:
+	      if (htab->do_multi_toc && htab->multi_toc_needed)
+		dyn.d_un.d_val |= PPC64_OPT_MULTI_TOC;
+	      break;
+
 	    case DT_PPC64_OPDSZ:
 	      s = bfd_get_section_by_name (output_bfd, ".opd");
 	      if (s == NULL)
@@ -14084,23 +14886,23 @@
 	      break;
 
 	    case DT_PLTGOT:
-	      s = htab->plt;
+	      s = htab->elf.splt;
 	      dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
 	      break;
 
 	    case DT_JMPREL:
-	      s = htab->relplt;
+	      s = htab->elf.srelplt;
 	      dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
 	      break;
 
 	    case DT_PLTRELSZ:
-	      dyn.d_un.d_val = htab->relplt->size;
+	      dyn.d_un.d_val = htab->elf.srelplt->size;
 	      break;
 
 	    case DT_RELASZ:
 	      /* Don't count procedure linkage table relocs in the
 		 overall reloc count.  */
-	      s = htab->relplt;
+	      s = htab->elf.srelplt;
 	      if (s == NULL)
 		continue;
 	      dyn.d_un.d_val -= s->size;
@@ -14110,7 +14912,7 @@
 	      /* We may not be using the standard ELF linker script.
 		 If .rela.plt is the first .rela section, we adjust
 		 DT_RELA to not include it.  */
-	      s = htab->relplt;
+	      s = htab->elf.srelplt;
 	      if (s == NULL)
 		continue;
 	      if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
@@ -14123,23 +14925,23 @@
 	}
     }
 
-  if (htab->got != NULL && htab->got->size != 0)
+  if (htab->elf.sgot != NULL && htab->elf.sgot->size != 0)
     {
       /* Fill in the first entry in the global offset table.
 	 We use it to hold the link-time TOCbase.  */
       bfd_put_64 (output_bfd,
 		  elf_gp (output_bfd) + TOC_BASE_OFF,
-		  htab->got->contents);
+		  htab->elf.sgot->contents);
 
       /* Set .got entry size.  */
-      elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 8;
+      elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 8;
     }
 
-  if (htab->plt != NULL && htab->plt->size != 0)
+  if (htab->elf.splt != NULL && htab->elf.splt->size != 0)
     {
       /* Set .plt entry size.  */
-      elf_section_data (htab->plt->output_section)->this_hdr.sh_entsize
-	= PLT_ENTRY_SIZE;
+      elf_section_data (htab->elf.splt->output_section)->this_hdr.sh_entsize
+	= PLT_ENTRY_SIZE (htab);
     }
 
   /* brlt is SEC_LINKER_CREATED, so we need to write out relocs for
diff --git a/bfd/elf64-ppc.h b/bfd/elf64-ppc.h
index 2728b27..06c655f 100644
--- a/bfd/elf64-ppc.h
+++ b/bfd/elf64-ppc.h
@@ -19,7 +19,7 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
-void ppc64_elf_init_stub_bfd
+bfd_boolean ppc64_elf_init_stub_bfd
   (bfd *, struct bfd_link_info *);
 bfd_boolean ppc64_elf_edit_opd
   (struct bfd_link_info *, bfd_boolean);
@@ -31,8 +31,8 @@
   (struct bfd_link_info *);
 bfd_boolean ppc64_elf_has_small_toc_reloc
   (asection *);
-bfd_vma ppc64_elf_toc
-  (bfd *);
+bfd_vma ppc64_elf_set_toc
+  (struct bfd_link_info *, bfd *);
 int ppc64_elf_setup_section_lists
   (struct bfd_link_info *, asection *(*) (const char *, asection *),
    void (*) (void));
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 8512fc0..601aa43 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -43,7 +43,7 @@
 {
   HOWTO (R_390_NONE,		/* type */
 	 0,			/* rightshift */
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* size (0 = byte, 1 = 2 byte, 2 = 4 byte) */
 	 0,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
@@ -171,7 +171,14 @@
 	s390_elf_ldisp_reloc, "R_390_TLS_GOTIE20", FALSE, 0,0x0fffff00, FALSE),
   HOWTO(R_390_IRELATIVE, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_390_IRELATIVE", FALSE, 0, MINUS_ONE, FALSE),
-
+  HOWTO(R_390_PC12DBL,   1, 1, 12,  TRUE, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_390_PC12DBL",  FALSE, 0,0x00000fff, TRUE),
+  HOWTO(R_390_PLT12DBL,  1, 1, 12,  TRUE, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_390_PLT12DBL", FALSE, 0,0x00000fff, TRUE),
+  HOWTO(R_390_PC24DBL,   1, 2, 24,  TRUE, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_390_PC24DBL",  FALSE, 0,0x00ffffff, TRUE),
+  HOWTO(R_390_PLT24DBL,  1, 2, 24,  TRUE, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_390_PLT24DBL", FALSE, 0,0x00ffffff, TRUE),
 };
 
 /* GNU extension to record C++ vtable hierarchy.  */
@@ -222,10 +229,18 @@
       return &elf_howto_table[(int) R_390_GOT16];
     case BFD_RELOC_16_PCREL:
       return &elf_howto_table[(int) R_390_PC16];
+    case BFD_RELOC_390_PC12DBL:
+      return &elf_howto_table[(int) R_390_PC12DBL];
+    case BFD_RELOC_390_PLT12DBL:
+      return &elf_howto_table[(int) R_390_PLT12DBL];
     case BFD_RELOC_390_PC16DBL:
       return &elf_howto_table[(int) R_390_PC16DBL];
     case BFD_RELOC_390_PLT16DBL:
       return &elf_howto_table[(int) R_390_PLT16DBL];
+    case BFD_RELOC_390_PC24DBL:
+      return &elf_howto_table[(int) R_390_PC24DBL];
+    case BFD_RELOC_390_PLT24DBL:
+      return &elf_howto_table[(int) R_390_PLT24DBL];
     case BFD_RELOC_390_PC32DBL:
       return &elf_howto_table[(int) R_390_PC32DBL];
     case BFD_RELOC_390_PLT32DBL:
@@ -415,7 +430,7 @@
       relocation -= reloc_entry->address;
     }
 
-  insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); 
+  insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
   insn |= (relocation & 0xfff) << 16 | (relocation & 0xff000) >> 4;
   bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
 
@@ -699,7 +714,7 @@
   struct elf_s390_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_s390_link_hash_table);
 
-  ret = (struct elf_s390_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf_s390_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -711,16 +726,6 @@
       return NULL;
     }
 
-  ret->elf.sgot = NULL;
-  ret->elf.sgotplt = NULL;
-  ret->elf.srelgot = NULL;
-  ret->elf.splt = NULL;
-  ret->elf.srelplt = NULL;
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->tls_ldm_got.refcount = 0;
-  ret->sym_cache.abfd = NULL;
-
   return &ret->elf.root;
 }
 
@@ -937,6 +942,9 @@
 	    {
 	      struct plt_entry *plt;
 
+	      if (htab->elf.dynobj == NULL)
+		htab->elf.dynobj = abfd;
+
 	      if (!s390_elf_create_ifunc_sections (htab->elf.dynobj, info))
 		return FALSE;
 
@@ -957,6 +965,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       /* Create got section and local_got_refcounts array if they
@@ -1040,7 +1052,9 @@
 	     are done.  */
 	  break;
 
+	case R_390_PLT12DBL:
 	case R_390_PLT16DBL:
+	case R_390_PLT24DBL:
 	case R_390_PLT32:
 	case R_390_PLT32DBL:
 	case R_390_PLT64:
@@ -1179,8 +1193,10 @@
 	case R_390_16:
 	case R_390_32:
 	case R_390_64:
+	case R_390_PC12DBL:
 	case R_390_PC16:
 	case R_390_PC16DBL:
+	case R_390_PC24DBL:
 	case R_390_PC32:
 	case R_390_PC32DBL:
 	case R_390_PC64:
@@ -1226,7 +1242,9 @@
 	  if ((info->shared
 	       && (sec->flags & SEC_ALLOC) != 0
 	       && ((ELF64_R_TYPE (rel->r_info) != R_390_PC16
+		    && ELF64_R_TYPE (rel->r_info) != R_390_PC12DBL
 		    && ELF64_R_TYPE (rel->r_info) != R_390_PC16DBL
+		    && ELF64_R_TYPE (rel->r_info) != R_390_PC24DBL
 		    && ELF64_R_TYPE (rel->r_info) != R_390_PC32
 		    && ELF64_R_TYPE (rel->r_info) != R_390_PC32DBL
 		    && ELF64_R_TYPE (rel->r_info) != R_390_PC64)
@@ -1303,6 +1321,8 @@
 
 	      p->count += 1;
 	      if (ELF64_R_TYPE (rel->r_info) == R_390_PC16
+		  || ELF64_R_TYPE (rel->r_info) == R_390_PC12DBL
+		  || ELF64_R_TYPE (rel->r_info) == R_390_PC16DBL
 		  || ELF64_R_TYPE (rel->r_info) == R_390_PC16DBL
 		  || ELF64_R_TYPE (rel->r_info) == R_390_PC32
 		  || ELF64_R_TYPE (rel->r_info) == R_390_PC32DBL
@@ -1474,7 +1494,9 @@
 	case R_390_32:
 	case R_390_64:
 	case R_390_PC16:
+	case R_390_PC12DBL:
 	case R_390_PC16DBL:
+	case R_390_PC24DBL:
 	case R_390_PC32:
 	case R_390_PC32DBL:
 	case R_390_PC64:
@@ -1482,7 +1504,9 @@
 	    break;
 	  /* Fall through */
 
+	case R_390_PLT12DBL:
 	case R_390_PLT16DBL:
+	case R_390_PLT24DBL:
 	case R_390_PLT32:
 	case R_390_PLT32DBL:
 	case R_390_PLT64:
@@ -2306,6 +2330,11 @@
 
 	      switch (r_type)
 		{
+		case R_390_PLTOFF16:
+		case R_390_PLTOFF32:
+		case R_390_PLTOFF64:
+		  relocation -= htab->elf.sgot->output_section->vma;
+		  break;
 		case R_390_GOTPLT12:
 		case R_390_GOTPLT16:
 		case R_390_GOTPLT20:
@@ -2345,11 +2374,12 @@
       else
 	{
 	  bfd_boolean warned ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -2467,6 +2497,37 @@
 				  base_got->contents + off);
 		      h->got.offset |= 1;
 		    }
+
+		  if ((h->def_regular
+		       && info->shared
+		       && SYMBOL_REFERENCES_LOCAL (info, h))
+		      /* lgrl rx,sym@GOTENT -> larl rx, sym */
+		      && ((r_type == R_390_GOTENT
+			   && (bfd_get_16 (input_bfd,
+					   contents + rel->r_offset - 2)
+			       & 0xff0f) == 0xc408)
+			  /* lg rx, sym@GOT(r12) -> larl rx, sym */
+			  || (r_type == R_390_GOT20
+			      && (bfd_get_32 (input_bfd,
+					      contents + rel->r_offset - 2)
+				  & 0xff00f000) == 0xe300c000
+			      && bfd_get_8 (input_bfd,
+					    contents + rel->r_offset + 3) == 0x04)))
+
+		    {
+		      unsigned short new_insn =
+			(0xc000 | (bfd_get_8 (input_bfd,
+					      contents + rel->r_offset - 1) & 0xf0));
+		      bfd_put_16 (output_bfd, new_insn,
+				  contents + rel->r_offset - 2);
+		      r_type = R_390_PC32DBL;
+		      rel->r_addend = 2;
+		      howto = elf_howto_table + r_type;
+		      relocation = h->root.u.def.value
+			+ h->root.u.def.section->output_section->vma
+			+ h->root.u.def.section->output_offset;
+		      goto do_relocation;
+		    }
 		}
 	      else
 		unresolved_reloc = FALSE;
@@ -2548,7 +2609,9 @@
 	  unresolved_reloc = FALSE;
 	  break;
 
+	case R_390_PLT12DBL:
 	case R_390_PLT16DBL:
+	case R_390_PLT24DBL:
 	case R_390_PLT32:
 	case R_390_PLT32DBL:
 	case R_390_PLT64:
@@ -2561,7 +2624,7 @@
 	    break;
 
 	  if (h->plt.offset == (bfd_vma) -1
-	      || (htab->elf.splt == NULL && htab->elf.iplt == NULL))
+	      || (htab->elf.splt == NULL && !s390_is_ifunc_symbol_p (h)))
 	    {
 	      /* We didn't make a PLT entry for this symbol.  This
 		 happens when statically linking PIC code, or when
@@ -2587,9 +2650,9 @@
 
 	  /* For local symbols or if we didn't make a PLT entry for
 	     this symbol resolve the symbol directly.  */
-	  if (   h == NULL
+	  if (h == NULL
 	      || h->plt.offset == (bfd_vma) -1
-	      || htab->elf.splt == NULL)
+	      || (htab->elf.splt == NULL && !s390_is_ifunc_symbol_p (h)))
 	    {
 	      relocation -= htab->elf.sgot->output_section->vma;
 	      break;
@@ -2613,7 +2676,9 @@
 	case R_390_32:
 	case R_390_64:
 	case R_390_PC16:
+	case R_390_PC12DBL:
 	case R_390_PC16DBL:
+	case R_390_PC24DBL:
 	case R_390_PC32:
 	case R_390_PC32DBL:
 	case R_390_PC64:
@@ -2687,7 +2752,9 @@
 		   || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 		   || h->root.type != bfd_link_hash_undefweak)
 	       && ((r_type != R_390_PC16
+		    && r_type != R_390_PC12DBL
 		    && r_type != R_390_PC16DBL
+		    && r_type != R_390_PC24DBL
 		    && r_type != R_390_PC32
 		    && r_type != R_390_PC32DBL
 		    && r_type != R_390_PC64)
@@ -2729,7 +2796,9 @@
 	      else if (h != NULL
 		       && h->dynindx != -1
 		       && (r_type == R_390_PC16
+			   || r_type == R_390_PC12DBL
 			   || r_type == R_390_PC16DBL
+			   || r_type == R_390_PC24DBL
 			   || r_type == R_390_PC32
 			   || r_type == R_390_PC32DBL
 			   || r_type == R_390_PC64
@@ -3166,6 +3235,13 @@
 
     do_relocation:
 
+      /* When applying a 24 bit reloc we need to start one byte
+	 earlier.  Otherwise the 32 bit get/put bfd operations might
+	 access a byte after the actual section.  */
+      if (r_type == R_390_PC24DBL
+	  || r_type == R_390_PLT24DBL)
+	rel->r_offset--;
+
       if (r_type == R_390_20
 	  || r_type == R_390_GOT20
 	  || r_type == R_390_GOTPLT20
@@ -3506,7 +3582,7 @@
     }
 
   /* Mark some specially defined symbols as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == htab->elf.hdynamic
       || h == htab->elf.hgot
       || h == htab->elf.hplt)
     sym->st_shndx = SHN_ABS;
@@ -3518,7 +3594,9 @@
    dynamic linker, before writing them out.  */
 
 static enum elf_reloc_type_class
-elf_s390_reloc_type_class (const Elf_Internal_Rela *rela)
+elf_s390_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			   const asection *rel_sec ATTRIBUTE_UNUSED,
+			   const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF64_R_TYPE (rela->r_info))
     {
@@ -3615,8 +3693,9 @@
 		       - htab->elf.splt->output_section->vma - 6)/2,
 		      htab->elf.splt->contents + 8);
 	}
-      elf_section_data (htab->elf.splt->output_section)
-	->this_hdr.sh_entsize = PLT_ENTRY_SIZE;
+      if (elf_section_data (htab->elf.splt->output_section) != NULL)
+	elf_section_data (htab->elf.splt->output_section)->this_hdr.sh_entsize
+	  = PLT_ENTRY_SIZE;
     }
 
   if (htab->elf.sgotplt)
@@ -3754,7 +3833,6 @@
 #define elf_backend_relocate_section	      elf_s390_relocate_section
 #define elf_backend_size_dynamic_sections     elf_s390_size_dynamic_sections
 #define elf_backend_init_index_section	      _bfd_elf_init_1_index_section
-#define elf_backend_reloc_type_class	      elf_s390_reloc_type_class
 #define elf_backend_plt_sym_val		      elf_s390_plt_sym_val
 #define elf_backend_add_symbol_hook           elf_s390_add_symbol_hook
 
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index ce5436d..e70887b 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -2424,6 +2424,10 @@
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  /* PR15323, ref flags aren't set for references in the same
+	     object.  */
+	  h->root.non_ir_ref = 1;
 	}
 
       /* Some relocs require a global offset table.  */
@@ -3069,7 +3073,7 @@
 {
   struct elf_link_hash_table *ret;
 
-  ret = (struct elf_link_hash_table *) bfd_malloc (sizeof (* ret));
+  ret = (struct elf_link_hash_table *) bfd_zmalloc (sizeof (* ret));
   if (ret == (struct elf_link_hash_table *) NULL)
     return NULL;
 
@@ -3769,7 +3773,7 @@
     }
 
   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
-  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+  if (h == elf_hash_table (info)->hdynamic
       || h == elf_hash_table (info)->hgot)
     sym->st_shndx = SHN_ABS;
 
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index e9b76e5..65e3907 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -765,7 +765,9 @@
 }
 
 static enum elf_reloc_type_class
-elf64_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
+elf64_sparc_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			      const asection *rel_sec ATTRIBUTE_UNUSED,
+			      const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF64_R_TYPE (rela->r_info))
     {
diff --git a/bfd/elf64-tilegx.c b/bfd/elf64-tilegx.c
index bd5f653..1043346 100644
--- a/bfd/elf64-tilegx.c
+++ b/bfd/elf64-tilegx.c
@@ -38,11 +38,11 @@
     return FALSE;
 
   /* pr_cursig */
-  elf_tdata (abfd)->core_signal =
+  elf_tdata (abfd)->core->signal =
     bfd_get_16 (abfd, note->descdata + TILEGX_PRSTATUS_OFFSET_PR_CURSIG);
 
   /* pr_pid */
-  elf_tdata (abfd)->core_pid =
+  elf_tdata (abfd)->core->pid =
     bfd_get_32 (abfd, note->descdata + TILEGX_PRSTATUS_OFFSET_PR_PID);
 
   /* pr_reg */
@@ -60,9 +60,9 @@
   if (note->descsz != TILEGX_PRPSINFO_SIZEOF)
     return FALSE;
 
-  elf_tdata (abfd)->core_program
+  elf_tdata (abfd)->core->program
     = _bfd_elfcore_strndup (abfd, note->descdata + TILEGX_PRPSINFO_OFFSET_PR_FNAME, 16);
-  elf_tdata (abfd)->core_command
+  elf_tdata (abfd)->core->command
     = _bfd_elfcore_strndup (abfd, note->descdata + TILEGX_PRPSINFO_OFFSET_PR_PSARGS, ELF_PR_PSARGS_SIZE);
 
 
@@ -70,7 +70,7 @@
      onto the end of the args in some (at least one anyway)
      implementations, so strip it off if it exists.  */
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index a29ba8a..860546e 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1,6 +1,6 @@
 /* X86-64 specific support for ELF
    Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010, 2011, 2012
+   2010, 2011, 2012, 2013
    Free Software Foundation, Inc.
    Contributed by Jan Hubicka <jh@suse.cz>.
 
@@ -148,8 +148,12 @@
   HOWTO(R_X86_64_PLTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_PLTOFF64", FALSE, MINUS_ONE,
 	MINUS_ONE, FALSE),
-  EMPTY_HOWTO (32),
-  EMPTY_HOWTO (33),
+  HOWTO(R_X86_64_SIZE32, 0, 2, 32, FALSE, 0, complain_overflow_unsigned,
+	bfd_elf_generic_reloc, "R_X86_64_SIZE32", FALSE, 0xffffffff, 0xffffffff,
+	FALSE),
+  HOWTO(R_X86_64_SIZE64, 0, 4, 64, FALSE, 0, complain_overflow_unsigned,
+	bfd_elf_generic_reloc, "R_X86_64_SIZE64", FALSE, MINUS_ONE, MINUS_ONE,
+	FALSE),
   HOWTO(R_X86_64_GOTPC32_TLSDESC, 0, 2, 32, TRUE, 0,
 	complain_overflow_bitfield, bfd_elf_generic_reloc,
 	"R_X86_64_GOTPC32_TLSDESC",
@@ -168,12 +172,18 @@
   HOWTO(R_X86_64_RELATIVE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_X86_64_RELATIVE64", FALSE, MINUS_ONE,
 	MINUS_ONE, FALSE),
+  HOWTO(R_X86_64_PC32_BND, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+	bfd_elf_generic_reloc, "R_X86_64_PC32_BND", FALSE, 0xffffffff, 0xffffffff,
+	TRUE),
+  HOWTO(R_X86_64_PLT32_BND, 0, 2, 32, TRUE, 0, complain_overflow_signed,
+	bfd_elf_generic_reloc, "R_X86_64_PLT32_BND", FALSE, 0xffffffff, 0xffffffff,
+	TRUE),
 
   /* We have a gap in the reloc numbers here.
      R_X86_64_standard counts the number up to this point, and
      R_X86_64_vt_offset is the value to subtract from a reloc type of
      R_X86_64_GNU_VT* to form an index into this table.  */
-#define R_X86_64_standard (R_X86_64_IRELATIVE + 1)
+#define R_X86_64_standard (R_X86_64_PLT32_BND + 1)
 #define R_X86_64_vt_offset (R_X86_64_GNU_VTINHERIT - R_X86_64_standard)
 
 /* GNU extension to record C++ vtable hierarchy.  */
@@ -195,6 +205,7 @@
   (   ((TYPE) == R_X86_64_PC8)		\
    || ((TYPE) == R_X86_64_PC16)		\
    || ((TYPE) == R_X86_64_PC32)		\
+   || ((TYPE) == R_X86_64_PC32_BND)	\
    || ((TYPE) == R_X86_64_PC64))
 
 /* Map BFD relocs to the x86_64 elf relocs.  */
@@ -238,10 +249,14 @@
   { BFD_RELOC_X86_64_GOTPC64,	R_X86_64_GOTPC64, },
   { BFD_RELOC_X86_64_GOTPLT64,	R_X86_64_GOTPLT64, },
   { BFD_RELOC_X86_64_PLTOFF64,	R_X86_64_PLTOFF64, },
+  { BFD_RELOC_SIZE32,		R_X86_64_SIZE32, },
+  { BFD_RELOC_SIZE64,		R_X86_64_SIZE64, },
   { BFD_RELOC_X86_64_GOTPC32_TLSDESC, R_X86_64_GOTPC32_TLSDESC, },
   { BFD_RELOC_X86_64_TLSDESC_CALL, R_X86_64_TLSDESC_CALL, },
   { BFD_RELOC_X86_64_TLSDESC,	R_X86_64_TLSDESC, },
   { BFD_RELOC_X86_64_IRELATIVE,	R_X86_64_IRELATIVE, },
+  { BFD_RELOC_X86_64_PC32_BND,	R_X86_64_PC32_BND,},
+  { BFD_RELOC_X86_64_PLT32_BND,	R_X86_64_PLT32_BND,},
   { BFD_RELOC_VTABLE_INHERIT,	R_X86_64_GNU_VTINHERIT, },
   { BFD_RELOC_VTABLE_ENTRY,	R_X86_64_GNU_VTENTRY, },
 };
@@ -342,10 +357,10 @@
 
       case 296:		/* sizeof(istruct elf_prstatus) on Linux/x32 */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
+	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
 
 	/* pr_reg */
 	offset = 72;
@@ -355,11 +370,11 @@
 
       case 336:		/* sizeof(istruct elf_prstatus) on Linux/x86_64 */
 	/* pr_cursig */
-	elf_tdata (abfd)->core_signal
+	elf_tdata (abfd)->core->signal
 	  = bfd_get_16 (abfd, note->descdata + 12);
 
 	/* pr_pid */
-	elf_tdata (abfd)->core_lwpid
+	elf_tdata (abfd)->core->lwpid
 	  = bfd_get_32 (abfd, note->descdata + 32);
 
 	/* pr_reg */
@@ -383,20 +398,20 @@
 	return FALSE;
 
       case 124:		/* sizeof(struct elf_prpsinfo) on Linux/x32 */
-	elf_tdata (abfd)->core_pid
+	elf_tdata (abfd)->core->pid
 	  = bfd_get_32 (abfd, note->descdata + 12);
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	  = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
 	break;
 
       case 136:		/* sizeof(struct elf_prpsinfo) on Linux/x86_64 */
-	elf_tdata (abfd)->core_pid
+	elf_tdata (abfd)->core->pid
 	  = bfd_get_32 (abfd, note->descdata + 24);
-	elf_tdata (abfd)->core_program
+	elf_tdata (abfd)->core->program
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
-	elf_tdata (abfd)->core_command
+	elf_tdata (abfd)->core->command
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
     }
 
@@ -405,7 +420,7 @@
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -449,7 +464,7 @@
 	}
       else
 	{
-	  prpsinfo_t data;
+	  prpsinfo64_t data;
 	  memset (&data, 0, sizeof (data));
 	  strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
 	  strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
@@ -490,7 +505,7 @@
 	}
       else
 	{
-	  prstatus_t prstat;
+	  prstatus64_t prstat;
 	  memset (&prstat, 0, sizeof (prstat));
 	  prstat.pr_pid = pid;
 	  prstat.pr_cursig = cursig;
@@ -622,9 +637,11 @@
   unsigned int eh_frame_plt_size;
 };
 
+#define get_elf_x86_64_arch_data(bed) \
+  ((const struct elf_x86_64_backend_data *) (bed)->arch_data)
+
 #define get_elf_x86_64_backend_data(abfd) \
-  ((const struct elf_x86_64_backend_data *) \
-   get_elf_backend_data (abfd)->arch_data)
+  get_elf_x86_64_arch_data (get_elf_backend_data (abfd))
 
 #define GET_PLT_ENTRY_SIZE(abfd) \
   get_elf_x86_64_backend_data (abfd)->plt_entry_size
@@ -882,7 +899,7 @@
   struct elf_x86_64_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_x86_64_link_hash_table);
 
-  ret = (struct elf_x86_64_link_hash_table *) bfd_malloc (amt);
+  ret = (struct elf_x86_64_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -895,18 +912,6 @@
       return NULL;
     }
 
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->plt_eh_frame = NULL;
-  ret->sym_cache.abfd = NULL;
-  ret->tlsdesc_plt = 0;
-  ret->tlsdesc_got = 0;
-  ret->tls_ld_got.refcount = 0;
-  ret->sgotplt_jump_table_size = 0;
-  ret->tls_module_base = NULL;
-  ret->next_jump_slot_index = 0;
-  ret->next_irelative_index = 0;
-
   if (ABI_64_P (abfd))
     {
       ret->r_info = elf64_r_info;
@@ -950,7 +955,7 @@
     htab_delete (htab->loc_hash_table);
   if (htab->loc_hash_memory)
     objalloc_free ((struct objalloc *) htab->loc_hash_memory);
-  _bfd_generic_link_hash_table_free (hash);
+  _bfd_elf_link_hash_table_free (hash);
 }
 
 /* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
@@ -1093,6 +1098,7 @@
 {
   unsigned int val;
   unsigned long r_symndx;
+  bfd_boolean largepic = FALSE;
   struct elf_link_hash_entry *h;
   bfd_vma offset;
   struct elf_x86_64_link_hash_table *htab;
@@ -1130,16 +1136,32 @@
 	     can transit to different access model.  For 32bit, only
 		leaq foo@tlsgd(%rip), %rdi
 		.word 0x6666; rex64; call __tls_get_addr
-	     can transit to different access model.  */
+	     can transit to different access model.  For largepic
+	     we also support:
+	        leaq foo@tlsgd(%rip), %rdi
+	        movabsq $__tls_get_addr@pltoff, %rax
+	        addq $rbx, %rax
+	        call *%rax.  */
 
 	  static const unsigned char call[] = { 0x66, 0x66, 0x48, 0xe8 };
 	  static const unsigned char leaq[] = { 0x66, 0x48, 0x8d, 0x3d };
 
-	  if ((offset + 12) > sec->size
-	      || memcmp (contents + offset + 4, call, 4) != 0)
+	  if ((offset + 12) > sec->size)
 	    return FALSE;
 
-	  if (ABI_64_P (abfd))
+	  if (memcmp (contents + offset + 4, call, 4) != 0)
+	    {
+	      if (!ABI_64_P (abfd)
+		  || (offset + 19) > sec->size
+		  || offset < 3
+		  || memcmp (contents + offset - 3, leaq + 1, 3) != 0
+		  || memcmp (contents + offset + 4, "\x48\xb8", 2) != 0
+		  || memcmp (contents + offset + 14, "\x48\x01\xd8\xff\xd0", 5)
+		     != 0)
+		return FALSE;
+	      largepic = TRUE;
+	    }
+	  else if (ABI_64_P (abfd))
 	    {
 	      if (offset < 4
 		  || memcmp (contents + offset - 4, leaq, 4) != 0)
@@ -1157,16 +1179,31 @@
 	  /* Check transition from LD access model.  Only
 		leaq foo@tlsld(%rip), %rdi;
 		call __tls_get_addr
-	     can transit to different access model.  */
+	     can transit to different access model.  For largepic
+	     we also support:
+	        leaq foo@tlsld(%rip), %rdi
+	        movabsq $__tls_get_addr@pltoff, %rax
+	        addq $rbx, %rax
+	        call *%rax.  */
 
 	  static const unsigned char lea[] = { 0x48, 0x8d, 0x3d };
 
 	  if (offset < 3 || (offset + 9) > sec->size)
 	    return FALSE;
 
-	  if (memcmp (contents + offset - 3, lea, 3) != 0
-	      || 0xe8 != *(contents + offset + 4))
+	  if (memcmp (contents + offset - 3, lea, 3) != 0)
 	    return FALSE;
+
+	  if (0xe8 != *(contents + offset + 4))
+	    {
+	      if (!ABI_64_P (abfd)
+		  || (offset + 19) > sec->size
+		  || memcmp (contents + offset + 4, "\x48\xb8", 2) != 0
+		  || memcmp (contents + offset + 14, "\x48\x01\xd8\xff\xd0", 5)
+		     != 0)
+		return FALSE;
+	      largepic = TRUE;
+	    }
 	}
 
       r_symndx = htab->r_sym (rel[1].r_info);
@@ -1178,8 +1215,10 @@
 	 may be versioned.  */
       return (h != NULL
 	      && h->root.root.string != NULL
-	      && (ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PC32
-		  || ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PLT32)
+	      && (largepic
+		  ? ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PLTOFF64
+		  : (ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PC32
+		     || ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PLT32))
 	      && (strncmp (h->root.root.string,
 			   "__tls_get_addr", 14) == 0));
 
@@ -1418,6 +1457,7 @@
       struct elf_link_hash_entry *h;
       Elf_Internal_Sym *isym;
       const char *name;
+      bfd_boolean size_reloc;
 
       r_symndx = htab->r_sym (rel->r_info);
       r_type = ELF32_R_TYPE (rel->r_info);
@@ -1511,8 +1551,10 @@
 	    case R_X86_64_32:
 	    case R_X86_64_64:
 	    case R_X86_64_PC32:
+	    case R_X86_64_PC32_BND:
 	    case R_X86_64_PC64:
 	    case R_X86_64_PLT32:
+	    case R_X86_64_PLT32_BND:
 	    case R_X86_64_GOTPCREL:
 	    case R_X86_64_GOTPCREL64:
 	      if (htab->elf.dynobj == NULL)
@@ -1522,82 +1564,9 @@
 	      break;
 	    }
 
-	  /* Since STT_GNU_IFUNC symbol must go through PLT, we handle
-	     it here if it is defined in a non-shared object.  */
-	  if (h->type == STT_GNU_IFUNC
-	      && h->def_regular)
-	    {
-	      /* It is referenced by a non-shared object. */
-	      h->ref_regular = 1;
-	      h->needs_plt = 1;
-
-	      /* STT_GNU_IFUNC symbol must go through PLT.  */
-	      h->plt.refcount += 1;
-
-	      /* STT_GNU_IFUNC needs dynamic sections.  */
-	      if (htab->elf.dynobj == NULL)
-		htab->elf.dynobj = abfd;
-
-	      switch (r_type)
-		{
-		default:
-		  if (h->root.root.string)
-		    name = h->root.root.string;
-		  else
-		    name = bfd_elf_sym_name (abfd, symtab_hdr, isym,
-					     NULL);
-		  (*_bfd_error_handler)
-		    (_("%B: relocation %s against STT_GNU_IFUNC "
-		       "symbol `%s' isn't handled by %s"), abfd,
-		     x86_64_elf_howto_table[r_type].name,
-		     name, __FUNCTION__);
-		  bfd_set_error (bfd_error_bad_value);
-		  return FALSE;
-
-		case R_X86_64_32:
-		  if (ABI_64_P (abfd))
-		    goto not_pointer;
-		case R_X86_64_64:
-		  h->non_got_ref = 1;
-		  h->pointer_equality_needed = 1;
-		  if (info->shared)
-		    {
-		      /* We must copy these reloc types into the output
-			 file.  Create a reloc section in dynobj and
-			 make room for this reloc.  */
-		      sreloc = _bfd_elf_create_ifunc_dyn_reloc
-			(abfd, info, sec, sreloc,
-			 &((struct elf_x86_64_link_hash_entry *) h)->dyn_relocs);
-		      if (sreloc == NULL)
-			return FALSE;
-		    }
-		  break;
-
-		case R_X86_64_32S:
-		case R_X86_64_PC32:
-		case R_X86_64_PC64:
-not_pointer:
-		  h->non_got_ref = 1;
-		  if (r_type != R_X86_64_PC32
-		      && r_type != R_X86_64_PC64)
-		    h->pointer_equality_needed = 1;
-		  break;
-
-		case R_X86_64_PLT32:
-		  break;
-
-		case R_X86_64_GOTPCREL:
-		case R_X86_64_GOTPCREL64:
-		  h->got.refcount += 1;
-		  if (htab->elf.sgot == NULL
-		      && !_bfd_elf_create_got_section (htab->elf.dynobj,
-						       info))
-		    return FALSE;
-		  break;
-		}
-
-	      continue;
-	    }
+	  /* It is referenced by a non-shared object. */
+	  h->ref_regular = 1;
+	  h->root.non_ir_ref = 1;
 	}
 
       if (! elf_x86_64_tls_transition (info, abfd, sec, NULL,
@@ -1718,6 +1687,7 @@
 		    (*_bfd_error_handler)
 		      (_("%B: '%s' accessed both as normal and thread local symbol"),
 		       abfd, name);
+		    bfd_set_error (bfd_error_bad_value);
 		    return FALSE;
 		  }
 	      }
@@ -1747,6 +1717,7 @@
 	  break;
 
 	case R_X86_64_PLT32:
+	case R_X86_64_PLT32_BND:
 	  /* This symbol requires a procedure linkage table entry.  We
 	     actually build the entry in adjust_dynamic_symbol,
 	     because this might be a case of linking PIC code which is
@@ -1773,6 +1744,11 @@
 	    }
 	  goto create_got;
 
+	case R_X86_64_SIZE32:
+	case R_X86_64_SIZE64:
+	  size_reloc = TRUE;
+	  goto do_size;
+
 	case R_X86_64_32:
 	  if (!ABI_64_P (abfd))
 	    goto pointer;
@@ -1802,6 +1778,7 @@
 	case R_X86_64_PC8:
 	case R_X86_64_PC16:
 	case R_X86_64_PC32:
+	case R_X86_64_PC32_BND:
 	case R_X86_64_PC64:
 	case R_X86_64_64:
 pointer:
@@ -1818,10 +1795,14 @@
 	      /* We may need a .plt entry if the function this reloc
 		 refers to is in a shared lib.  */
 	      h->plt.refcount += 1;
-	      if (r_type != R_X86_64_PC32 && r_type != R_X86_64_PC64)
+	      if (r_type != R_X86_64_PC32
+		  && r_type != R_X86_64_PC32_BND
+		  && r_type != R_X86_64_PC64)
 		h->pointer_equality_needed = 1;
 	    }
 
+	  size_reloc = FALSE;
+do_size:
 	  /* If we are creating a shared library, and this is a reloc
 	     against a global symbol, or a non PC relative reloc
 	     against a local symbol, then we need to copy the reloc
@@ -1922,7 +1903,8 @@
 		}
 
 	      p->count += 1;
-	      if (IS_X86_64_PCREL_TYPE (r_type))
+	      /* Count size relocation as PC-relative relocation.  */
+	      if (IS_X86_64_PCREL_TYPE (r_type) || size_reloc)
 		p->pc_count += 1;
 	    }
 	  break;
@@ -2099,13 +2081,17 @@
 	case R_X86_64_PC8:
 	case R_X86_64_PC16:
 	case R_X86_64_PC32:
+	case R_X86_64_PC32_BND:
 	case R_X86_64_PC64:
+	case R_X86_64_SIZE32:
+	case R_X86_64_SIZE64:
 	  if (info->shared
 	      && (h == NULL || h->type != STT_GNU_IFUNC))
 	    break;
 	  /* Fall thru */
 
 	case R_X86_64_PLT32:
+	case R_X86_64_PLT32_BND:
 	case R_X86_64_PLTOFF64:
 	  if (h != NULL)
 	    {
@@ -2134,10 +2120,44 @@
 {
   struct elf_x86_64_link_hash_table *htab;
   asection *s;
+  struct elf_x86_64_link_hash_entry *eh;
+  struct elf_dyn_relocs *p;
 
   /* STT_GNU_IFUNC symbol must go through PLT. */
   if (h->type == STT_GNU_IFUNC)
     {
+      /* All local STT_GNU_IFUNC references must be treate as local
+	 calls via local PLT.  */
+      if (h->ref_regular
+	  && SYMBOL_CALLS_LOCAL (info, h))
+	{
+	  bfd_size_type pc_count = 0, count = 0;
+	  struct elf_dyn_relocs **pp;
+
+	  eh = (struct elf_x86_64_link_hash_entry *) h;
+	  for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+	    {
+	      pc_count += p->pc_count;
+	      p->count -= p->pc_count;
+	      p->pc_count = 0;
+	      count += p->count;
+	      if (p->count == 0)
+		*pp = p->next;
+	      else
+		pp = &p->next;
+	    }
+
+	  if (pc_count || count)
+	    {
+	      h->needs_plt = 1;
+	      h->non_got_ref = 1;
+	      if (h->plt.refcount <= 0)
+		h->plt.refcount = 1;
+	      else
+		h->plt.refcount += 1;
+	    }
+	}
+
       if (h->plt.refcount <= 0)
 	{
 	  h->plt.offset = (bfd_vma) -1;
@@ -2214,9 +2234,6 @@
 
   if (ELIMINATE_COPY_RELOCS)
     {
-      struct elf_x86_64_link_hash_entry * eh;
-      struct elf_dyn_relocs *p;
-
       eh = (struct elf_x86_64_link_hash_entry *) h;
       for (p = eh->dyn_relocs; p != NULL; p = p->next)
 	{
@@ -2296,6 +2313,7 @@
     return _bfd_elf_allocate_ifunc_dyn_relocs (info, h,
 					       &eh->dyn_relocs,
 					       plt_entry_size,
+					       plt_entry_size,
 					       GOT_ENTRY_SIZE);
   else if (htab->elf.dynamic_sections_created
 	   && h->plt.refcount > 0)
@@ -2317,7 +2335,7 @@
 	  /* If this is the first .plt entry, make room for the special
 	     first entry.  */
 	  if (s->size == 0)
-	    s->size += plt_entry_size;
+	    s->size = plt_entry_size;
 
 	  h->plt.offset = s->size;
 
@@ -2572,6 +2590,154 @@
   return TRUE;
 }
 
+/* Convert
+   mov foo@GOTPCREL(%rip), %reg
+   to
+   lea foo(%rip), %reg
+   with the local symbol, foo.  */
+
+static bfd_boolean
+elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
+			       struct bfd_link_info *link_info)
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  Elf_Internal_Rela *internal_relocs;
+  Elf_Internal_Rela *irel, *irelend;
+  bfd_byte *contents;
+  struct elf_x86_64_link_hash_table *htab;
+  bfd_boolean changed_contents;
+  bfd_boolean changed_relocs;
+  bfd_signed_vma *local_got_refcounts;
+
+  /* Don't even try to convert non-ELF outputs.  */
+  if (!is_elf_hash_table (link_info->hash))
+    return FALSE;
+
+  /* Nothing to do if there are no codes, no relocations or no output.  */
+  if ((sec->flags & (SEC_CODE | SEC_RELOC)) != (SEC_CODE | SEC_RELOC)
+      || sec->reloc_count == 0
+      || discarded_section (sec))
+    return TRUE;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+
+  /* Load the relocations for this section.  */
+  internal_relocs = (_bfd_elf_link_read_relocs
+		     (abfd, sec, NULL, (Elf_Internal_Rela *) NULL,
+		      link_info->keep_memory));
+  if (internal_relocs == NULL)
+    return FALSE;
+
+  htab = elf_x86_64_hash_table (link_info);
+  changed_contents = FALSE;
+  changed_relocs = FALSE;
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+
+  /* Get the section contents.  */
+  if (elf_section_data (sec)->this_hdr.contents != NULL)
+    contents = elf_section_data (sec)->this_hdr.contents;
+  else
+    {
+      if (!bfd_malloc_and_get_section (abfd, sec, &contents))
+	goto error_return;
+    }
+
+  irelend = internal_relocs + sec->reloc_count;
+  for (irel = internal_relocs; irel < irelend; irel++)
+    {
+      unsigned int r_type = ELF32_R_TYPE (irel->r_info);
+      unsigned int r_symndx = htab->r_sym (irel->r_info);
+      unsigned int indx;
+      struct elf_link_hash_entry *h;
+
+      if (r_type != R_X86_64_GOTPCREL)
+	continue;
+
+      /* Get the symbol referred to by the reloc.  */
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  Elf_Internal_Sym *isym;
+
+	  isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+					abfd, r_symndx);
+
+	  /* STT_GNU_IFUNC must keep R_X86_64_GOTPCREL relocation.  */
+	  if (ELF_ST_TYPE (isym->st_info) != STT_GNU_IFUNC
+	      && bfd_get_8 (input_bfd,
+			    contents + irel->r_offset - 2) == 0x8b)
+	    {
+	      bfd_put_8 (output_bfd, 0x8d,
+			 contents + irel->r_offset - 2);
+	      irel->r_info = htab->r_info (r_symndx, R_X86_64_PC32);
+	      if (local_got_refcounts != NULL
+		  && local_got_refcounts[r_symndx] > 0)
+		local_got_refcounts[r_symndx] -= 1;
+	      changed_contents = TRUE;
+	      changed_relocs = TRUE;
+	    }
+	  continue;
+	}
+
+      indx = r_symndx - symtab_hdr->sh_info;
+      h = elf_sym_hashes (abfd)[indx];
+      BFD_ASSERT (h != NULL);
+
+      while (h->root.type == bfd_link_hash_indirect
+	     || h->root.type == bfd_link_hash_warning)
+	h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+      /* STT_GNU_IFUNC must keep R_X86_64_GOTPCREL relocation.  We also
+	 avoid optimizing _DYNAMIC since ld.so may use its link-time
+	 address.  */
+      if (h->def_regular
+	  && h->type != STT_GNU_IFUNC
+	  && h != htab->elf.hdynamic
+	  && SYMBOL_REFERENCES_LOCAL (link_info, h)
+	  && bfd_get_8 (input_bfd,
+			contents + irel->r_offset - 2) == 0x8b)
+	{
+	  bfd_put_8 (output_bfd, 0x8d,
+		     contents + irel->r_offset - 2);
+	  irel->r_info = htab->r_info (r_symndx, R_X86_64_PC32);
+	  if (h->got.refcount > 0)
+	    h->got.refcount -= 1;
+	  changed_contents = TRUE;
+	  changed_relocs = TRUE;
+	}
+    }
+
+  if (contents != NULL
+      && elf_section_data (sec)->this_hdr.contents != contents)
+    {
+      if (!changed_contents && !link_info->keep_memory)
+	free (contents);
+      else
+	{
+	  /* Cache the section contents for elf_link_input_bfd.  */
+	  elf_section_data (sec)->this_hdr.contents = contents;
+	}
+    }
+
+  if (elf_section_data (sec)->relocs != internal_relocs)
+    {
+      if (!changed_relocs)
+	free (internal_relocs);
+      else
+	elf_section_data (sec)->relocs = internal_relocs;
+    }
+
+  return TRUE;
+
+ error_return:
+  if (contents != NULL
+      && elf_section_data (sec)->this_hdr.contents != contents)
+    free (contents);
+  if (internal_relocs != NULL
+      && elf_section_data (sec)->relocs != internal_relocs)
+    free (internal_relocs);
+  return FALSE;
+}
+
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -2626,6 +2792,9 @@
 	{
 	  struct elf_dyn_relocs *p;
 
+	  if (!elf_x86_64_convert_mov_to_lea (ibfd, s, info))
+	    return FALSE;
+
 	  for (p = (struct elf_dyn_relocs *)
 		    (elf_section_data (s)->local_dynrel);
 	       p != NULL;
@@ -2766,15 +2935,10 @@
 
   if (htab->elf.sgotplt)
     {
-      struct elf_link_hash_entry *got;
-      got = elf_link_hash_lookup (elf_hash_table (info),
-				  "_GLOBAL_OFFSET_TABLE_",
-				  FALSE, FALSE, FALSE);
-
       /* Don't allocate .got.plt section if there are no GOT nor PLT
 	 entries and there is no refeence to _GLOBAL_OFFSET_TABLE_.  */
-      if ((got == NULL
-	   || !got->ref_regular_nonweak)
+      if ((htab->elf.hgot == NULL
+	   || !htab->elf.hgot->ref_regular_nonweak)
 	  && (htab->elf.sgotplt->size
 	      == get_elf_backend_data (output_bfd)->got_header_size)
 	  && (htab->elf.splt == NULL
@@ -2795,7 +2959,7 @@
       && _bfd_elf_eh_frame_present (info))
     {
       const struct elf_x86_64_backend_data *arch_data
-	= (const struct elf_x86_64_backend_data *) bed->arch_data;
+	= get_elf_x86_64_arch_data (bed);
       htab->plt_eh_frame->size = arch_data->eh_frame_plt_size;
     }
 
@@ -2867,7 +3031,7 @@
       && htab->plt_eh_frame->contents != NULL)
     {
       const struct elf_x86_64_backend_data *arch_data
-	= (const struct elf_x86_64_backend_data *) bed->arch_data;
+	= get_elf_x86_64_arch_data (bed);
 
       memcpy (htab->plt_eh_frame->contents,
 	      arch_data->eh_frame_plt, htab->plt_eh_frame->size);
@@ -3098,14 +3262,18 @@
       bfd_reloc_status_type r;
       int tls_type;
       asection *base_got;
+      bfd_vma st_size;
 
       r_type = ELF32_R_TYPE (rel->r_info);
       if (r_type == (int) R_X86_64_GNU_VTINHERIT
 	  || r_type == (int) R_X86_64_GNU_VTENTRY)
 	continue;
 
-      if (r_type >= R_X86_64_max)
+      if (r_type >= (int) R_X86_64_standard)
 	{
+	  (*_bfd_error_handler)
+	    (_("%B: unrecognized relocation (0x%x) in section `%A'"),
+	     input_bfd, input_section, r_type);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -3128,6 +3296,7 @@
 
 	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym,
 						&sec, rel);
+	  st_size = sym->st_size;
 
 	  /* Relocate against local STT_GNU_IFUNC symbol.  */
 	  if (!info->relocatable
@@ -3146,11 +3315,13 @@
       else
 	{
 	  bfd_boolean warned ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
+	  st_size = h->size;
 	}
 
       if (sec != NULL && discarded_section (sec))
@@ -3160,14 +3331,22 @@
       if (info->relocatable)
 	continue;
 
-      if (rel->r_addend == 0
-	  && r_type == R_X86_64_64
-	  && !ABI_64_P (output_bfd))
+      if (rel->r_addend == 0 && !ABI_64_P (output_bfd))
 	{
-	  /* For x32, treat R_X86_64_64 like R_X86_64_32 and zero-extend
-	     it to 64bit if addend is zero.  */
-	  r_type = R_X86_64_32;
-	  memset (contents + rel->r_offset + 4, 0, 4);
+	  if (r_type == R_X86_64_64)
+	    {
+	      /* For x32, treat R_X86_64_64 like R_X86_64_32 and
+		 zero-extend it to 64bit if addend is zero.  */
+	      r_type = R_X86_64_32;
+	      memset (contents + rel->r_offset + 4, 0, 4);
+	    }
+	  else if (r_type == R_X86_64_SIZE64)
+	    {
+	      /* For x32, treat R_X86_64_SIZE64 like R_X86_64_SIZE32 and
+		 zero-extend it to 64bit if addend is zero.  */
+	      r_type = R_X86_64_SIZE32;
+	      memset (contents + rel->r_offset + 4, 0, 4);
+	    }
 	}
 
       /* Since STT_GNU_IFUNC symbol must go through PLT, we handle
@@ -3279,8 +3458,10 @@
 		}
 	      /* FALLTHROUGH */
 	    case R_X86_64_PC32:
+	    case R_X86_64_PC32_BND:
 	    case R_X86_64_PC64:
 	    case R_X86_64_PLT32:
+	    case R_X86_64_PLT32_BND:
 	      goto do_relocation;
 
 	    case R_X86_64_GOTPCREL:
@@ -3525,6 +3706,7 @@
 	  break;
 
 	case R_X86_64_PLT32:
+	case R_X86_64_PLT32_BND:
 	  /* Relocation is to the entry for this symbol in the
 	     procedure linkage table.  */
 
@@ -3548,9 +3730,16 @@
 	  unresolved_reloc = FALSE;
 	  break;
 
+	case R_X86_64_SIZE32:
+	case R_X86_64_SIZE64:
+	  /* Set to symbol size.  */
+	  relocation = st_size;
+	  goto direct;
+
 	case R_X86_64_PC8:
 	case R_X86_64_PC16:
 	case R_X86_64_PC32:
+	case R_X86_64_PC32_BND:
 	  if (info->shared
 	      && (input_section->flags & SEC_ALLOC) != 0
 	      && (input_section->flags & SEC_READONLY) != 0
@@ -3558,7 +3747,8 @@
 	    {
 	      bfd_boolean fail = FALSE;
 	      bfd_boolean branch
-		= (r_type == R_X86_64_PC32
+		= ((r_type == R_X86_64_PC32
+		    || r_type == R_X86_64_PC32_BND)
 		   && is_32bit_relative_branch (contents, rel->r_offset));
 
 	      if (SYMBOL_REFERENCES_LOCAL (info, h))
@@ -3620,6 +3810,7 @@
 	  /* FIXME: The ABI says the linker should make sure the value is
 	     the same when it's zeroextended to 64 bit.	 */
 
+direct:
 	  if ((input_section->flags & SEC_ALLOC) == 0)
 	    break;
 
@@ -3627,7 +3818,9 @@
 	       && (h == NULL
 		   || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 		   || h->root.type != bfd_link_hash_undefweak)
-	       && (! IS_X86_64_PCREL_TYPE (r_type)
+	       && ((! IS_X86_64_PCREL_TYPE (r_type)
+		      && r_type != R_X86_64_SIZE32
+		      && r_type != R_X86_64_SIZE64)
 		   || ! SYMBOL_CALLS_LOCAL (info, h)))
 	      || (ELIMINATE_COPY_RELOCS
 		  && !info->shared
@@ -3813,8 +4006,26 @@
 		     .word 0x6666; rex64; call __tls_get_addr
 		     into:
 		     movl %fs:0, %eax
-		     leaq foo@tpoff(%rax), %rax */
-		  if (ABI_64_P (output_bfd))
+		     leaq foo@tpoff(%rax), %rax
+		     For largepic, change:
+		     leaq foo@tlsgd(%rip), %rdi
+		     movabsq $__tls_get_addr@pltoff, %rax
+		     addq %rbx, %rax
+		     call *%rax
+		     into:
+		     movq %fs:0, %rax
+		     leaq foo@tpoff(%rax), %rax
+		     nopw 0x0(%rax,%rax,1) */
+		  int largepic = 0;
+		  if (ABI_64_P (output_bfd)
+		      && contents[roff + 5] == (bfd_byte) '\xb8')
+		    {
+		      memcpy (contents + roff - 3,
+			      "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x8d\x80"
+			      "\0\0\0\0\x66\x0f\x1f\x44\0", 22);
+		      largepic = 1;
+		    }
+		  else if (ABI_64_P (output_bfd))
 		    memcpy (contents + roff - 4,
 			    "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x8d\x80\0\0\0",
 			    16);
@@ -3824,8 +4035,8 @@
 			    15);
 		  bfd_put_32 (output_bfd,
 			      elf_x86_64_tpoff (info, relocation),
-			      contents + roff + 8);
-		  /* Skip R_X86_64_PC32/R_X86_64_PLT32.  */
+			      contents + roff + 8 + largepic);
+		  /* Skip R_X86_64_PC32/R_X86_64_PLT32/R_X86_64_PLTOFF64.  */
 		  rel++;
 		  continue;
 		}
@@ -4060,8 +4271,26 @@
 		     .word 0x6666; rex64; call __tls_get_addr@plt
 		     into:
 		     movl %fs:0, %eax
-		     addq foo@gottpoff(%rip), %rax */
-		  if (ABI_64_P (output_bfd))
+		     addq foo@gottpoff(%rip), %rax
+		     For largepic, change:
+		     leaq foo@tlsgd(%rip), %rdi
+		     movabsq $__tls_get_addr@pltoff, %rax
+		     addq %rbx, %rax
+		     call *%rax
+		     into:
+		     movq %fs:0, %rax
+		     addq foo@gottpoff(%rax), %rax
+		     nopw 0x0(%rax,%rax,1) */
+		  int largepic = 0;
+		  if (ABI_64_P (output_bfd)
+		      && contents[roff + 5] == (bfd_byte) '\xb8')
+		    {
+		      memcpy (contents + roff - 3,
+			      "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x03\x05"
+			      "\0\0\0\0\x66\x0f\x1f\x44\0", 22);
+		      largepic = 1;
+		    }
+		  else if (ABI_64_P (output_bfd))
 		    memcpy (contents + roff - 4,
 			    "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x03\x05\0\0\0",
 			    16);
@@ -4073,12 +4302,13 @@
 		  relocation = (htab->elf.sgot->output_section->vma
 				+ htab->elf.sgot->output_offset + off
 				- roff
+				- largepic
 				- input_section->output_section->vma
 				- input_section->output_offset
 				- 12);
 		  bfd_put_32 (output_bfd, relocation,
-			      contents + roff + 8);
-		  /* Skip R_X86_64_PLT32.  */
+			      contents + roff + 8 + largepic);
+		  /* Skip R_X86_64_PLT32/R_X86_64_PLTOFF64.  */
 		  rel++;
 		  continue;
 		}
@@ -4140,16 +4370,29 @@
 		 For 64bit, we change it into:
 		 .word 0x6666; .byte 0x66; movq %fs:0, %rax.
 		 For 32bit, we change it into:
-		 nopl 0x0(%rax); movl %fs:0, %eax.  */
+		 nopl 0x0(%rax); movl %fs:0, %eax.
+		 For largepic, change:
+		 leaq foo@tlsgd(%rip), %rdi
+		 movabsq $__tls_get_addr@pltoff, %rax
+		 addq %rbx, %rax
+		 call *%rax
+		 into:
+		 data32 data32 data32 nopw %cs:0x0(%rax,%rax,1)
+		 movq %fs:0, %eax */
 
 	      BFD_ASSERT (r_type == R_X86_64_TPOFF32);
-	      if (ABI_64_P (output_bfd))
+	      if (ABI_64_P (output_bfd)
+		  && contents[rel->r_offset + 5] == (bfd_byte) '\xb8')
+		memcpy (contents + rel->r_offset - 3,
+			"\x66\x66\x66\x66\x2e\x0f\x1f\x84\0\0\0\0\0"
+			"\x64\x48\x8b\x04\x25\0\0\0", 22);
+	      else if (ABI_64_P (output_bfd))
 		memcpy (contents + rel->r_offset - 3,
 			"\x66\x66\x66\x64\x48\x8b\x04\x25\0\0\0", 12);
 	      else
 		memcpy (contents + rel->r_offset - 3,
 			"\x0f\x1f\x40\x00\x64\x8b\x04\x25\0\0\0", 12);
-	      /* Skip R_X86_64_PC32/R_X86_64_PLT32.  */
+	      /* Skip R_X86_64_PC32/R_X86_64_PLT32/R_X86_64_PLTOFF64.  */
 	      rel++;
 	      continue;
 	    }
@@ -4198,6 +4441,11 @@
 	  relocation = elf_x86_64_tpoff (info, relocation);
 	  break;
 
+	case R_X86_64_DTPOFF64:
+	  BFD_ASSERT ((input_section->flags & SEC_CODE) == 0);
+	  relocation -= elf_x86_64_dtpoff_base (info);
+	  break;
+
 	default:
 	  break;
 	}
@@ -4316,7 +4564,7 @@
 	  || plt == NULL
 	  || gotplt == NULL
 	  || relplt == NULL)
-	return FALSE;
+	abort ();
 
       /* Get the index in the procedure linkage table which
 	 corresponds to this symbol.  This is the index of this symbol
@@ -4534,7 +4782,9 @@
    dynamic linker, before writing them out.  */
 
 static enum elf_reloc_type_class
-elf_x86_64_reloc_type_class (const Elf_Internal_Rela *rela)
+elf_x86_64_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			     const asection *rel_sec ATTRIBUTE_UNUSED,
+			     const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {
@@ -4788,10 +5038,8 @@
    is called when elfcode.h finds a section with an unknown type.  */
 
 static bfd_boolean
-elf_x86_64_section_from_shdr (bfd *abfd,
-				Elf_Internal_Shdr *hdr,
-				const char *name,
-				int shindex)
+elf_x86_64_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
+			      const char *name, int shindex)
 {
   if (hdr->sh_type != SHT_X86_64_UNWIND)
     return FALSE;
@@ -4906,49 +5154,33 @@
 }
 
 static bfd_boolean
-elf_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
-			 struct elf_link_hash_entry **sym_hash ATTRIBUTE_UNUSED,
-			 struct elf_link_hash_entry *h,
-			 Elf_Internal_Sym *sym,
+elf_x86_64_merge_symbol (struct elf_link_hash_entry *h,
+			 const Elf_Internal_Sym *sym,
 			 asection **psec,
-			 bfd_vma *pvalue ATTRIBUTE_UNUSED,
-			 unsigned int *pold_alignment ATTRIBUTE_UNUSED,
-			 bfd_boolean *skip ATTRIBUTE_UNUSED,
-			 bfd_boolean *override ATTRIBUTE_UNUSED,
-			 bfd_boolean *type_change_ok ATTRIBUTE_UNUSED,
-			 bfd_boolean *size_change_ok ATTRIBUTE_UNUSED,
-			 bfd_boolean *newdyn ATTRIBUTE_UNUSED,
-			 bfd_boolean *newdef,
-			 bfd_boolean *newdyncommon ATTRIBUTE_UNUSED,
-			 bfd_boolean *newweak ATTRIBUTE_UNUSED,
-			 bfd *abfd ATTRIBUTE_UNUSED,
-			 asection **sec,
-			 bfd_boolean *olddyn ATTRIBUTE_UNUSED,
-			 bfd_boolean *olddef,
-			 bfd_boolean *olddyncommon ATTRIBUTE_UNUSED,
-			 bfd_boolean *oldweak ATTRIBUTE_UNUSED,
+			 bfd_boolean newdef,
+			 bfd_boolean olddef,
 			 bfd *oldbfd,
-			 asection **oldsec)
+			 const asection *oldsec)
 {
   /* A normal common symbol and a large common symbol result in a
      normal common symbol.  We turn the large common symbol into a
      normal one.  */
-  if (!*olddef
+  if (!olddef
       && h->root.type == bfd_link_hash_common
-      && !*newdef
-      && bfd_is_com_section (*sec)
-      && *oldsec != *sec)
+      && !newdef
+      && bfd_is_com_section (*psec)
+      && oldsec != *psec)
     {
       if (sym->st_shndx == SHN_COMMON
-	  && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) != 0)
+	  && (elf_section_flags (oldsec) & SHF_X86_64_LARGE) != 0)
 	{
 	  h->root.u.c.p->section
 	    = bfd_make_section_old_way (oldbfd, "COMMON");
 	  h->root.u.c.p->section->flags = SEC_ALLOC;
 	}
       else if (sym->st_shndx == SHN_X86_64_LCOMMON
-	       && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) == 0)
-	*psec = *sec = bfd_com_section_ptr;
+	       && (elf_section_flags (oldsec) & SHF_X86_64_LARGE) == 0)
+	*psec = bfd_com_section_ptr;
     }
 
   return TRUE;
@@ -5136,6 +5368,14 @@
 
 /* Native Client support.  */
 
+static bfd_boolean
+elf64_x86_64_nacl_elf_object_p (bfd *abfd)
+{
+  /* Set the right machine number for a NaCl x86-64 ELF64 file.  */
+  bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64_nacl);
+  return TRUE;
+}
+
 #undef	TARGET_LITTLE_SYM
 #define	TARGET_LITTLE_SYM		bfd_elf64_x86_64_nacl_vec
 #undef	TARGET_LITTLE_NAME
@@ -5172,7 +5412,7 @@
     0x41, 0xff, 0xe3,             	/* jmpq *%r11			*/
 
     /* 9-byte nop sequence to pad out to the next 32-byte boundary.  */
-    0x2e, 0x0f, 0x1f, 0x84, 0, 0, 0, 0, 0, /* nopl %cs:0x0(%rax,%rax,1)	*/
+    0x66, 0x0f, 0x1f, 0x84, 0, 0, 0, 0, 0, /* nopw 0x0(%rax,%rax,1)	*/
 
     /* 32 bytes of nop to pad out to the standard size.  */
     0x66, 0x66, 0x66, 0x66, 0x66, 0x66,    /* excess data32 prefixes	*/
@@ -5268,15 +5508,27 @@
 #undef	elf_backend_arch_data
 #define	elf_backend_arch_data	&elf_x86_64_nacl_arch_bed
 
+#undef	elf_backend_object_p
+#define elf_backend_object_p			elf64_x86_64_nacl_elf_object_p
 #undef	elf_backend_modify_segment_map
 #define	elf_backend_modify_segment_map		nacl_modify_segment_map
 #undef	elf_backend_modify_program_headers
 #define	elf_backend_modify_program_headers	nacl_modify_program_headers
+#undef	elf_backend_final_write_processing
+#define elf_backend_final_write_processing	nacl_final_write_processing
 
 #include "elf64-target.h"
 
 /* Native Client x32 support.  */
 
+static bfd_boolean
+elf32_x86_64_nacl_elf_object_p (bfd *abfd)
+{
+  /* Set the right machine number for a NaCl x86-64 ELF32 file.  */
+  bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x64_32_nacl);
+  return TRUE;
+}
+
 #undef  TARGET_LITTLE_SYM
 #define TARGET_LITTLE_SYM		bfd_elf32_x86_64_nacl_vec
 #undef  TARGET_LITTLE_NAME
@@ -5297,7 +5549,7 @@
 
 #undef elf_backend_object_p
 #define elf_backend_object_p \
-  elf32_x86_64_elf_object_p
+  elf32_x86_64_nacl_elf_object_p
 
 #undef elf_backend_bfd_from_remote_memory
 #define elf_backend_bfd_from_remote_memory \
@@ -5316,6 +5568,7 @@
 #undef	elf_backend_size_info
 #undef	elf_backend_modify_segment_map
 #undef	elf_backend_modify_program_headers
+#undef	elf_backend_final_write_processing
 
 /* Intel L1OM support.  */
 
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 30bda73..e296c5c 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -495,13 +495,10 @@
   Elf_Internal_Shdr *i_shdrp;	/* Section header table, internal form */
   unsigned int shindex;
   const struct elf_backend_data *ebd;
-  struct bfd_preserve preserve;
   asection *s;
   bfd_size_type amt;
   const bfd_target *target;
 
-  preserve.marker = NULL;
-
   /* Read in the ELF header in external format.  */
 
   if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
@@ -539,9 +536,6 @@
       goto got_wrong_format_error;
     }
 
-  if (!bfd_preserve_save (abfd, &preserve))
-    goto got_no_match;
-
   target = abfd->xvec;
 
   /* Allocate an instance of the elf_obj_tdata structure and hook it up to
@@ -549,7 +543,6 @@
 
   if (! (*target->_bfd_set_format[bfd_object]) (abfd))
     goto got_no_match;
-  preserve.marker = elf_tdata (abfd);
 
   /* Now that we know the byte order, swap in the rest of the header */
   i_ehdrp = elf_elfheader (abfd);
@@ -842,25 +835,12 @@
 	    s->flags |= SEC_DEBUGGING;
 	}
     }
-
-  bfd_preserve_finish (abfd, &preserve);
   return target;
 
  got_wrong_format_error:
-  /* There is way too much undoing of half-known state here.  The caller,
-     bfd_check_format_matches, really shouldn't iterate on live bfd's to
-     check match/no-match like it does.  We have to rely on that a call to
-     bfd_default_set_arch_mach with the previously known mach, undoes what
-     was done by the first bfd_default_set_arch_mach (with mach 0) here.
-     For this to work, only elf-data and the mach may be changed by the
-     target-specific elf_backend_object_p function.  Note that saving the
-     whole bfd here and restoring it would be even worse; the first thing
-     you notice is that the cached bfd file position gets out of sync.  */
   bfd_set_error (bfd_error_wrong_format);
 
  got_no_match:
-  if (preserve.marker != NULL)
-    bfd_preserve_restore (abfd, &preserve);
   return NULL;
 }
 
@@ -1091,6 +1071,7 @@
     {
       Elf_Internal_Shdr i_shdr;
       Elf_External_Shdr x_shdr;
+      bfd_byte *contents, *free_contents;
 
       i_shdr = *i_shdrp[count];
       i_shdr.sh_offset = 0;
@@ -1098,28 +1079,36 @@
       elf_swap_shdr_out (abfd, &i_shdr, &x_shdr);
       (*process) (&x_shdr, sizeof x_shdr, arg);
 
-      /* PR ld/12451:
-	 Process the section's contents, if it has some.  Read them in if necessary.  */
-      if (i_shdr.contents)
-	(*process) (i_shdr.contents, i_shdr.sh_size, arg);
-      else if (i_shdr.sh_type != SHT_NOBITS)
+      /* Process the section's contents, if it has some.
+	 PR ld/12451: Read them in if necessary.  */
+      if (i_shdr.sh_type == SHT_NOBITS)
+	continue;
+      free_contents = NULL;
+      contents = i_shdr.contents;
+      if (contents == NULL)
 	{
 	  asection *sec;
 
 	  sec = bfd_section_from_elf_index (abfd, count);
 	  if (sec != NULL)
 	    {
-	      if (sec->contents == NULL)
+	      contents = sec->contents;
+	      if (contents == NULL)
 		{
 		  /* Force rereading from file.  */
 		  sec->flags &= ~SEC_IN_MEMORY;
-		  if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
+		  if (!bfd_malloc_and_get_section (abfd, sec, &free_contents))
 		    continue;
+		  contents = free_contents;
 		}
-	      if (sec->contents != NULL)
-		(*process) (sec->contents, i_shdr.sh_size, arg);
 	    }
 	}
+      if (contents != NULL)
+	{
+	  (*process) (contents, i_shdr.sh_size, arg);
+	  if (free_contents != NULL)
+	    free (free_contents);
+	}
     }
 
   return TRUE;
@@ -1163,9 +1152,9 @@
 	verhdr = NULL;
       else
 	verhdr = &elf_tdata (abfd)->dynversym_hdr;
-      if ((elf_tdata (abfd)->dynverdef_section != 0
+      if ((elf_dynverdef (abfd) != 0
 	   && elf_tdata (abfd)->verdef == NULL)
-	  || (elf_tdata (abfd)->dynverref_section != 0
+	  || (elf_dynverref (abfd) != 0
 	      && elf_tdata (abfd)->verref == NULL))
 	{
 	  if (!_bfd_elf_slurp_version_tables (abfd, FALSE))
diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index 81980c0..429c09c 100644
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -22,19 +22,19 @@
 char*
 elf_core_file_failing_command (bfd *abfd)
 {
-  return elf_tdata (abfd)->core_command;
+  return elf_tdata (abfd)->core->command;
 }
 
 int
 elf_core_file_failing_signal (bfd *abfd)
 {
-  return elf_tdata (abfd)->core_signal;
+  return elf_tdata (abfd)->core->signal;
 }
 
 int
 elf_core_file_pid (bfd *abfd)
 {
-  return elf_tdata (abfd)->core_pid;
+  return elf_tdata (abfd)->core->pid;
 }
 
 bfd_boolean
@@ -51,7 +51,7 @@
     }
 
   /* See if the name in the corefile matches the executable name.  */
-  corename = elf_tdata (core_bfd)->core_program;
+  corename = elf_tdata (core_bfd)->core->program;
   if (corename != NULL)
     {
       const char* execname = strrchr (exec_bfd->filename, '/');
@@ -84,11 +84,8 @@
   Elf_Internal_Phdr *i_phdrp;	/* Elf program header, internal form.  */
   unsigned int phindex;
   const struct elf_backend_data *ebd;
-  struct bfd_preserve preserve;
   bfd_size_type amt;
 
-  preserve.marker = NULL;
-
   /* Read in the ELF header in external format.  */
   if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
     {
@@ -123,13 +120,9 @@
       goto wrong;
     }
 
-  if (!bfd_preserve_save (abfd, &preserve))
-    goto fail;
-
   /* Give abfd an elf_obj_tdata.  */
   if (! (*abfd->xvec->_bfd_set_format[bfd_core]) (abfd))
     goto fail;
-  preserve.marker = elf_tdata (abfd);
 
   /* Swap in the rest of the header, now that we have the byte order.  */
   i_ehdrp = elf_elfheader (abfd);
@@ -294,7 +287,7 @@
   {
     bfd_size_type high = 0;
     struct stat statbuf;
-    for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex) 
+    for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
       {
 	Elf_Internal_Phdr *p = i_phdrp + phindex;
 	if (p->p_filesz)
@@ -315,27 +308,13 @@
 	  }
       }
   }
-  
+
   /* Save the entry point from the ELF header.  */
   bfd_get_start_address (abfd) = i_ehdrp->e_entry;
-
-  bfd_preserve_finish (abfd, &preserve);
   return abfd->xvec;
 
 wrong:
-  /* There is way too much undoing of half-known state here.  The caller,
-     bfd_check_format_matches, really shouldn't iterate on live bfd's to
-     check match/no-match like it does.  We have to rely on that a call to
-     bfd_default_set_arch_mach with the previously known mach, undoes what
-     was done by the first bfd_default_set_arch_mach (with mach 0) here.
-     For this to work, only elf-data and the mach may be changed by the
-     target-specific elf_backend_object_p function.  Note that saving the
-     whole bfd here and restoring it would be even worse; the first thing
-     you notice is that the cached bfd file position gets out of sync.  */
   bfd_set_error (bfd_error_wrong_format);
-
 fail:
-  if (preserve.marker != NULL)
-    bfd_preserve_restore (abfd, &preserve);
   return NULL;
 }
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 574b6e2..6fa62f9 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1,7 +1,5 @@
 /* ELF linking support for BFD.
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright 1995-2013 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -87,7 +85,8 @@
   h->def_regular = 1;
   h->non_elf = 0;
   h->type = STT_OBJECT;
-  h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
+  if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
+    h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
 
   bed = get_elf_backend_data (abfd);
   (*bed->elf_backend_hide_symbol) (info, h, TRUE);
@@ -187,6 +186,7 @@
   flagword flags;
   asection *s;
   const struct elf_backend_data *bed;
+  struct elf_link_hash_entry *h;
 
   if (! is_elf_hash_table (info->hash))
     return FALSE;
@@ -254,7 +254,9 @@
      section.  We don't want to define it if there is no .dynamic
      section, since on some ELF platforms the start up code examines it
      to decide how to initialize the process.  */
-  if (!_bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC"))
+  h = _bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC");
+  elf_hash_table (info)->hdynamic = h;
+  if (h == NULL)
     return FALSE;
 
   if (info->emit_hash)
@@ -569,10 +571,11 @@
 
   h->def_regular = 1;
 
-  if (provide && hidden)
+  if (hidden)
     {
       bed = get_elf_backend_data (output_bfd);
-      h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
+      if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
+	h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
       (*bed->elf_backend_hide_symbol) (info, h, TRUE);
     }
 
@@ -892,54 +895,30 @@
     }
 }
 
-/* Mark if a symbol has a definition in a dynamic object or is
-   weak in all dynamic objects.  */
+/* This function is called when we want to merge a new symbol with an
+   existing symbol.  It handles the various cases which arise when we
+   find a definition in a dynamic object, or when there is already a
+   definition in a dynamic object.  The new symbol is described by
+   NAME, SYM, PSEC, and PVALUE.  We set SYM_HASH to the hash table
+   entry.  We set POLDBFD to the old symbol's BFD.  We set POLD_WEAK
+   if the old symbol was weak.  We set POLD_ALIGNMENT to the alignment
+   of an old common symbol.  We set OVERRIDE if the old symbol is
+   overriding a new definition.  We set TYPE_CHANGE_OK if it is OK for
+   the type to change.  We set SIZE_CHANGE_OK if it is OK for the size
+   to change.  By OK to change, we mean that we shouldn't warn if the
+   type or size does change.  */
 
-static void
-_bfd_elf_mark_dynamic_def_weak (struct elf_link_hash_entry *h,
-				asection *sec, int bind)
-{
-  if (!h->dynamic_def)
-    {
-      if (!bfd_is_und_section (sec))
-	h->dynamic_def = 1;
-      else
-	{
-	  /* Check if this symbol is weak in all dynamic objects. If it
-	     is the first time we see it in a dynamic object, we mark
-	     if it is weak. Otherwise, we clear it.  */
-	  if (!h->ref_dynamic)
-	    {
-	      if (bind == STB_WEAK)
-		h->dynamic_weak = 1;
-	    }
-	  else if (bind != STB_WEAK)
-	    h->dynamic_weak = 0;
-	}
-    }
-}
-
-/* This function is called when we want to define a new symbol.  It
-   handles the various cases which arise when we find a definition in
-   a dynamic object, or when there is already a definition in a
-   dynamic object.  The new symbol is described by NAME, SYM, PSEC,
-   and PVALUE.  We set SYM_HASH to the hash table entry.  We set
-   OVERRIDE if the old symbol is overriding a new definition.  We set
-   TYPE_CHANGE_OK if it is OK for the type to change.  We set
-   SIZE_CHANGE_OK if it is OK for the size to change.  By OK to
-   change, we mean that we shouldn't warn if the type or size does
-   change.  We set POLD_ALIGNMENT if an old common symbol in a dynamic
-   object is overridden by a regular object.  */
-
-bfd_boolean
+static bfd_boolean
 _bfd_elf_merge_symbol (bfd *abfd,
 		       struct bfd_link_info *info,
 		       const char *name,
 		       Elf_Internal_Sym *sym,
 		       asection **psec,
 		       bfd_vma *pvalue,
-		       unsigned int *pold_alignment,
 		       struct elf_link_hash_entry **sym_hash,
+		       bfd **poldbfd,
+		       bfd_boolean *pold_weak,
+		       unsigned int *pold_alignment,
 		       bfd_boolean *skip,
 		       bfd_boolean *override,
 		       bfd_boolean *type_change_ok,
@@ -961,15 +940,6 @@
   sec = *psec;
   bind = ELF_ST_BIND (sym->st_info);
 
-  /* Silently discard TLS symbols from --just-syms.  There's no way to
-     combine a static TLS block with a new TLS block for this executable.  */
-  if (ELF_ST_TYPE (sym->st_info) == STT_TLS
-      && sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
-    {
-      *skip = TRUE;
-      return TRUE;
-    }
-
   if (! bfd_is_und_section (sec))
     h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE);
   else
@@ -981,11 +951,6 @@
 
   bed = get_elf_backend_data (abfd);
 
-  /* This code is for coping with dynamic objects, and is only useful
-     if we are doing an ELF link.  */
-  if (!(*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
-    return TRUE;
-
   /* For merging, we only care about real symbols.  But we need to make
      sure that indirect symbol dynamic flags are updated.  */
   hi = h;
@@ -993,35 +958,19 @@
 	 || h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
-  /* We have to check it for every instance since the first few may be
-     refereences and not all compilers emit symbol type for undefined
-     symbols.  */
-  bfd_elf_link_mark_dynamic_symbol (info, h, sym);
-
-  /* If we just created the symbol, mark it as being an ELF symbol.
-     Other than that, there is nothing to do--there is no merge issue
-     with a newly defined symbol--so we just return.  */
-
-  if (h->root.type == bfd_link_hash_new)
-    {
-      h->non_elf = 0;
-      return TRUE;
-    }
-
   /* OLDBFD and OLDSEC are a BFD and an ASECTION associated with the
      existing symbol.  */
 
+  oldbfd = NULL;
+  oldsec = NULL;
   switch (h->root.type)
     {
     default:
-      oldbfd = NULL;
-      oldsec = NULL;
       break;
 
     case bfd_link_hash_undefined:
     case bfd_link_hash_undefweak:
       oldbfd = h->root.u.undef.abfd;
-      oldsec = NULL;
       break;
 
     case bfd_link_hash_defined:
@@ -1033,13 +982,68 @@
     case bfd_link_hash_common:
       oldbfd = h->root.u.c.p->section->owner;
       oldsec = h->root.u.c.p->section;
+      if (pold_alignment)
+	*pold_alignment = h->root.u.c.p->alignment_power;
       break;
     }
+  if (poldbfd && *poldbfd == NULL)
+    *poldbfd = oldbfd;
 
   /* Differentiate strong and weak symbols.  */
   newweak = bind == STB_WEAK;
   oldweak = (h->root.type == bfd_link_hash_defweak
 	     || h->root.type == bfd_link_hash_undefweak);
+  if (pold_weak)
+    *pold_weak = oldweak;
+
+  /* This code is for coping with dynamic objects, and is only useful
+     if we are doing an ELF link.  */
+  if (!(*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
+    return TRUE;
+
+  /* We have to check it for every instance since the first few may be
+     references and not all compilers emit symbol type for undefined
+     symbols.  */
+  bfd_elf_link_mark_dynamic_symbol (info, h, sym);
+
+  /* NEWDYN and OLDDYN indicate whether the new or old symbol,
+     respectively, is from a dynamic object.  */
+
+  newdyn = (abfd->flags & DYNAMIC) != 0;
+
+  /* ref_dynamic_nonweak and dynamic_def flags track actual undefined
+     syms and defined syms in dynamic libraries respectively.
+     ref_dynamic on the other hand can be set for a symbol defined in
+     a dynamic library, and def_dynamic may not be set;  When the
+     definition in a dynamic lib is overridden by a definition in the
+     executable use of the symbol in the dynamic lib becomes a
+     reference to the executable symbol.  */
+  if (newdyn)
+    {
+      if (bfd_is_und_section (sec))
+	{
+	  if (bind != STB_WEAK)
+	    {
+	      h->ref_dynamic_nonweak = 1;
+	      hi->ref_dynamic_nonweak = 1;
+	    }
+	}
+      else
+	{
+	  h->dynamic_def = 1;
+	  hi->dynamic_def = 1;
+	}
+    }
+
+  /* If we just created the symbol, mark it as being an ELF symbol.
+     Other than that, there is nothing to do--there is no merge issue
+     with a newly defined symbol--so we just return.  */
+
+  if (h->root.type == bfd_link_hash_new)
+    {
+      h->non_elf = 0;
+      return TRUE;
+    }
 
   /* In cases involving weak versioned symbols, we may wind up trying
      to merge a symbol with itself.  Catch that here, to avoid the
@@ -1053,11 +1057,6 @@
 	  || !h->def_regular))
     return TRUE;
 
-  /* NEWDYN and OLDDYN indicate whether the new or old symbol,
-     respectively, is from a dynamic object.  */
-
-  newdyn = (abfd->flags & DYNAMIC) != 0;
-
   olddyn = FALSE;
   if (oldbfd != NULL)
     olddyn = (oldbfd->flags & DYNAMIC) != 0;
@@ -1142,35 +1141,29 @@
 
       if (tdef && ntdef)
 	(*_bfd_error_handler)
-	  (_("%s: TLS definition in %B section %A mismatches non-TLS definition in %B section %A"),
+	  (_("%s: TLS definition in %B section %A "
+	     "mismatches non-TLS definition in %B section %A"),
 	   tbfd, tsec, ntbfd, ntsec, h->root.root.string);
       else if (!tdef && !ntdef)
 	(*_bfd_error_handler)
-	  (_("%s: TLS reference in %B mismatches non-TLS reference in %B"),
+	  (_("%s: TLS reference in %B "
+	     "mismatches non-TLS reference in %B"),
 	   tbfd, ntbfd, h->root.root.string);
       else if (tdef)
 	(*_bfd_error_handler)
-	  (_("%s: TLS definition in %B section %A mismatches non-TLS reference in %B"),
+	  (_("%s: TLS definition in %B section %A "
+	     "mismatches non-TLS reference in %B"),
 	   tbfd, tsec, ntbfd, h->root.root.string);
       else
 	(*_bfd_error_handler)
-	  (_("%s: TLS reference in %B mismatches non-TLS definition in %B section %A"),
+	  (_("%s: TLS reference in %B "
+	     "mismatches non-TLS definition in %B section %A"),
 	   tbfd, ntbfd, ntsec, h->root.root.string);
 
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
 
-  /* We need to remember if a symbol has a definition in a dynamic
-     object or is weak in all dynamic objects. Internal and hidden
-     visibility will make it unavailable to dynamic objects.  */
-  if (newdyn)
-    {
-      _bfd_elf_mark_dynamic_def_weak (h, sec, bind);
-      if (h != hi)
-	_bfd_elf_mark_dynamic_def_weak (hi, sec, bind);
-    }
-
   /* If the old symbol has non-default visibility, we ignore the new
      definition from a dynamic object.  */
   if (newdyn
@@ -1197,7 +1190,7 @@
       /* If the new symbol with non-default visibility comes from a
 	 relocatable file and the old definition comes from a dynamic
 	 object, we remove the old definition.  */
-      if ((*sym_hash)->root.type == bfd_link_hash_indirect)
+      if (hi->root.type == bfd_link_hash_indirect)
 	{
 	  /* Handle the case where the old dynamic definition is
 	     default versioned.  We need to copy the symbol info from
@@ -1205,32 +1198,31 @@
 	     was referenced before.  */
 	  if (h->ref_regular)
 	    {
-	      struct elf_link_hash_entry *vh = *sym_hash;
-
-	      vh->root.type = h->root.type;
+	      hi->root.type = h->root.type;
 	      h->root.type = bfd_link_hash_indirect;
-	      (*bed->elf_backend_copy_indirect_symbol) (info, vh, h);
-	      /* Protected symbols will override the dynamic definition
-		 with default version.  */
-	      if (ELF_ST_VISIBILITY (sym->st_other) == STV_PROTECTED)
+	      (*bed->elf_backend_copy_indirect_symbol) (info, hi, h);
+
+	      h->root.u.i.link = (struct bfd_link_hash_entry *) hi;
+	      if (ELF_ST_VISIBILITY (sym->st_other) != STV_PROTECTED)
 		{
-		  h->root.u.i.link = (struct bfd_link_hash_entry *) vh;
-		  vh->dynamic_def = 1;
-		  vh->ref_dynamic = 1;
+		  /* If the new symbol is hidden or internal, completely undo
+		     any dynamic link state.  */
+		  (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+		  h->forced_local = 0;
+		  h->ref_dynamic = 0;
 		}
 	      else
-		{
-		  h->root.type = vh->root.type;
-		  vh->ref_dynamic = 0;
-		  /* We have to hide it here since it was made dynamic
-		     global with extra bits when the symbol info was
-		     copied from the old dynamic definition.  */
-		  (*bed->elf_backend_hide_symbol) (info, vh, TRUE);
-		}
-	      h = vh;
+		h->ref_dynamic = 1;
+
+	      h->def_dynamic = 0;
+	      /* FIXME: Should we check type and size for protected symbol?  */
+	      h->size = 0;
+	      h->type = 0;
+
+	      h = hi;
 	    }
 	  else
-	    h = *sym_hash;
+	    h = hi;
 	}
 
       /* If the old symbol was undefined before, then it will still be
@@ -1262,16 +1254,12 @@
       else
 	h->ref_dynamic = 1;
       h->def_dynamic = 0;
-      h->dynamic_def = 0;
       /* FIXME: Should we check type and size for protected symbol?  */
       h->size = 0;
       h->type = 0;
       return TRUE;
     }
 
-  if (bind == STB_GNU_UNIQUE)
-    h->unique_global = 1;
-
   /* If a new weak symbol definition comes from a regular file and the
      old symbol comes from a dynamic library, we treat the new one as
      strong.  Similarly, an old weak symbol definition from a regular
@@ -1357,15 +1345,12 @@
 
   /* We now know everything about the old and new symbols.  We ask the
      backend to check if we can merge them.  */
-  if (bed->merge_symbol
-      && !bed->merge_symbol (info, sym_hash, h, sym, psec, pvalue,
-			     pold_alignment, skip, override,
-			     type_change_ok, size_change_ok,
-			     &newdyn, &newdef, &newdyncommon, &newweak,
-			     abfd, &sec,
-			     &olddyn, &olddef, &olddyncommon, &oldweak,
-			     oldbfd, &oldsec))
-    return FALSE;
+  if (bed->merge_symbol != NULL)
+    {
+      if (!bed->merge_symbol (h, sym, psec, newdef, olddef, oldbfd, oldsec))
+	return FALSE;
+      sec = *psec;
+    }
 
   /* If both the old and the new symbols look like common symbols in a
      dynamic object, set the size of the symbol to the larger of the
@@ -1514,8 +1499,8 @@
 	  *type_change_ok = TRUE;
 	}
 
-      if ((*sym_hash)->root.type == bfd_link_hash_indirect)
-	flip = *sym_hash;
+      if (hi->root.type == bfd_link_hash_indirect)
+	flip = hi;
       else
 	/* This union may have been set to be non-NULL when this symbol
 	   was seen in a dynamic object.  We must force the union to be
@@ -1560,8 +1545,8 @@
       *size_change_ok = TRUE;
       *type_change_ok = TRUE;
 
-      if ((*sym_hash)->root.type == bfd_link_hash_indirect)
-	flip = *sym_hash;
+      if (hi->root.type == bfd_link_hash_indirect)
+	flip = hi;
       else
 	h->verinfo.vertree = NULL;
     }
@@ -1588,7 +1573,7 @@
 
 /* This function is called to create an indirect symbol from the
    default for the symbol with the default version if needed. The
-   symbol is described by H, NAME, SYM, PSEC, VALUE, and OVERRIDE.  We
+   symbol is described by H, NAME, SYM, SEC, and VALUE.  We
    set DYNSYM if the new indirect symbol is dynamic.  */
 
 static bfd_boolean
@@ -1597,10 +1582,10 @@
 			     struct elf_link_hash_entry *h,
 			     const char *name,
 			     Elf_Internal_Sym *sym,
-			     asection **psec,
-			     bfd_vma *value,
-			     bfd_boolean *dynsym,
-			     bfd_boolean override)
+			     asection *sec,
+			     bfd_vma value,
+			     bfd **poldbfd,
+			     bfd_boolean *dynsym)
 {
   bfd_boolean type_change_ok;
   bfd_boolean size_change_ok;
@@ -1611,9 +1596,10 @@
   const struct elf_backend_data *bed;
   bfd_boolean collect;
   bfd_boolean dynamic;
+  bfd_boolean override;
   char *p;
   size_t len, shortlen;
-  asection *sec;
+  asection *tmp_sec;
 
   /* If this symbol has a version, and it is the default version, we
      create an indirect symbol from the default name to the fully
@@ -1623,24 +1609,6 @@
   if (p == NULL || p[1] != ELF_VER_CHR)
     return TRUE;
 
-  if (override)
-    {
-      /* We are overridden by an old definition. We need to check if we
-	 need to create the indirect symbol from the default name.  */
-      hi = elf_link_hash_lookup (elf_hash_table (info), name, TRUE,
-				 FALSE, FALSE);
-      BFD_ASSERT (hi != NULL);
-      if (hi == h)
-	return TRUE;
-      while (hi->root.type == bfd_link_hash_indirect
-	     || hi->root.type == bfd_link_hash_warning)
-	{
-	  hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
-	  if (hi == h)
-	    return TRUE;
-	}
-    }
-
   bed = get_elf_backend_data (abfd);
   collect = bed->collect;
   dynamic = (abfd->flags & DYNAMIC) != 0;
@@ -1658,9 +1626,9 @@
      actually going to define an indirect symbol.  */
   type_change_ok = FALSE;
   size_change_ok = FALSE;
-  sec = *psec;
-  if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
-			      NULL, &hi, &skip, &override,
+  tmp_sec = sec;
+  if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &tmp_sec, &value,
+			      &hi, poldbfd, NULL, NULL, &skip, &override,
 			      &type_change_ok, &size_change_ok))
     return FALSE;
 
@@ -1734,6 +1702,12 @@
       ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
       (*bed->elf_backend_copy_indirect_symbol) (info, ht, hi);
 
+      /* A reference to the SHORTNAME symbol from a dynamic library
+	 will be satisfied by the versioned symbol at runtime.  In
+	 effect, we have a reference to the versioned symbol.  */
+      ht->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak;
+      hi->dynamic_def |= ht->dynamic_def;
+
       /* See if the new flags lead us to realize that the symbol must
 	 be dynamic.  */
       if (! *dynsym)
@@ -1767,9 +1741,9 @@
   /* Once again, merge with any existing symbol.  */
   type_change_ok = FALSE;
   size_change_ok = FALSE;
-  sec = *psec;
-  if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
-			      NULL, &hi, &skip, &override,
+  tmp_sec = sec;
+  if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &tmp_sec, &value,
+			      &hi, NULL, NULL, NULL, &skip, &override,
 			      &type_change_ok, &size_change_ok))
     return FALSE;
 
@@ -1803,6 +1777,8 @@
       if (hi->root.type == bfd_link_hash_indirect)
 	{
 	  (*bed->elf_backend_copy_indirect_symbol) (info, h, hi);
+	  h->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak;
+	  hi->dynamic_def |= h->dynamic_def;
 
 	  /* See if the new flags lead us to realize that the symbol
 	     must be dynamic.  */
@@ -2501,7 +2477,7 @@
       && !h->def_regular
       && h->ref_regular
       && !h->def_dynamic
-      && (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
+      && (h->root.u.def.section->owner->flags & (DYNAMIC | BFD_PLUGIN)) == 0)
     h->def_regular = 1;
 
   /* If -Bsymbolic was used (which means to bind references to global
@@ -3083,19 +3059,17 @@
 		       bfd_boolean do_it)
 {
   struct elf_link_hash_table *hash_table;
-  bfd_size_type oldsize;
   bfd_size_type strindex;
 
   if (!_bfd_elf_link_create_dynstrtab (abfd, info))
     return -1;
 
   hash_table = elf_hash_table (info);
-  oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
   strindex = _bfd_elf_strtab_add (hash_table->dynstr, soname, FALSE);
   if (strindex == (bfd_size_type) -1)
     return -1;
 
-  if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr))
+  if (_bfd_elf_strtab_refcount (hash_table->dynstr, strindex) != 1)
     {
       asection *sdyn;
       const struct elf_backend_data *bed;
@@ -3343,6 +3317,18 @@
   return ibed->relocs_compatible == obed->relocs_compatible;
 }
 
+/* Make a special call to the linker "notice" function to tell it that
+   we are about to handle an as-needed lib, or have finished
+   processing the lib.  */ 
+
+bfd_boolean
+_bfd_elf_notice_as_needed (bfd *ibfd,
+			   struct bfd_link_info *info,
+			   enum notice_asneeded_action act)
+{
+  return (*info->callbacks->notice) (info, NULL, ibfd, NULL, act, 0, NULL);
+}
+
 /* Add symbols from an ELF object file to the linker hash table.  */
 
 static bfd_boolean
@@ -3372,13 +3358,13 @@
   unsigned int old_size = 0;
   unsigned int old_count = 0;
   void *old_tab = NULL;
-  void *old_hash;
   void *old_ent;
   struct bfd_link_hash_entry *old_undefs = NULL;
   struct bfd_link_hash_entry *old_undefs_tail = NULL;
   long old_dynsymcount = 0;
+  bfd_size_type old_dynstr_size = 0;
   size_t tabsize = 0;
-  size_t hashsize = 0;
+  asection *s;
 
   htab = elf_hash_table (info);
   bed = get_elf_backend_data (abfd);
@@ -3420,75 +3406,64 @@
      symbol.  This differs from .gnu.warning sections, which generate
      warnings when they are included in an output file.  */
   /* PR 12761: Also generate this warning when building shared libraries.  */
-  if (info->executable || info->shared)
+  for (s = abfd->sections; s != NULL; s = s->next)
     {
-      asection *s;
+      const char *name;
 
-      for (s = abfd->sections; s != NULL; s = s->next)
+      name = bfd_get_section_name (abfd, s);
+      if (CONST_STRNEQ (name, ".gnu.warning."))
 	{
-	  const char *name;
+	  char *msg;
+	  bfd_size_type sz;
 
-	  name = bfd_get_section_name (abfd, s);
-	  if (CONST_STRNEQ (name, ".gnu.warning."))
+	  name += sizeof ".gnu.warning." - 1;
+
+	  /* If this is a shared object, then look up the symbol
+	     in the hash table.  If it is there, and it is already
+	     been defined, then we will not be using the entry
+	     from this shared object, so we don't need to warn.
+	     FIXME: If we see the definition in a regular object
+	     later on, we will warn, but we shouldn't.  The only
+	     fix is to keep track of what warnings we are supposed
+	     to emit, and then handle them all at the end of the
+	     link.  */
+	  if (dynamic)
 	    {
-	      char *msg;
-	      bfd_size_type sz;
+	      struct elf_link_hash_entry *h;
 
-	      name += sizeof ".gnu.warning." - 1;
+	      h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE);
 
-	      /* If this is a shared object, then look up the symbol
-		 in the hash table.  If it is there, and it is already
-		 been defined, then we will not be using the entry
-		 from this shared object, so we don't need to warn.
-		 FIXME: If we see the definition in a regular object
-		 later on, we will warn, but we shouldn't.  The only
-		 fix is to keep track of what warnings we are supposed
-		 to emit, and then handle them all at the end of the
-		 link.  */
-	      if (dynamic)
-		{
-		  struct elf_link_hash_entry *h;
+	      /* FIXME: What about bfd_link_hash_common?  */
+	      if (h != NULL
+		  && (h->root.type == bfd_link_hash_defined
+		      || h->root.type == bfd_link_hash_defweak))
+		continue;
+	    }
 
-		  h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE);
+	  sz = s->size;
+	  msg = (char *) bfd_alloc (abfd, sz + 1);
+	  if (msg == NULL)
+	    goto error_return;
 
-		  /* FIXME: What about bfd_link_hash_common?  */
-		  if (h != NULL
-		      && (h->root.type == bfd_link_hash_defined
-			  || h->root.type == bfd_link_hash_defweak))
-		    {
-		      /* We don't want to issue this warning.  Clobber
-			 the section size so that the warning does not
-			 get copied into the output file.  */
-		      s->size = 0;
-		      continue;
-		    }
-		}
+	  if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
+	    goto error_return;
 
-	      sz = s->size;
-	      msg = (char *) bfd_alloc (abfd, sz + 1);
-	      if (msg == NULL)
-		goto error_return;
+	  msg[sz] = '\0';
 
-	      if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
-		goto error_return;
+	  if (! (_bfd_generic_link_add_one_symbol
+		 (info, abfd, name, BSF_WARNING, s, 0, msg,
+		  FALSE, bed->collect, NULL)))
+	    goto error_return;
 
-	      msg[sz] = '\0';
+	  if (!info->relocatable && info->executable)
+	    {
+	      /* Clobber the section size so that the warning does
+		 not get copied into the output file.  */
+	      s->size = 0;
 
-	      if (! (_bfd_generic_link_add_one_symbol
-		     (info, abfd, name, BSF_WARNING, s, 0, msg,
-		      FALSE, bed->collect, NULL)))
-		goto error_return;
-
-	      if (! info->relocatable)
-		{
-		  /* Clobber the section size so that the warning does
-		     not get copied into the output file.  */
-		  s->size = 0;
-
-		  /* Also set SEC_EXCLUDE, so that symbols defined in
-		     the warning section don't get copied to the output.  */
-		  s->flags |= SEC_EXCLUDE;
-		}
+	      /* Also set SEC_EXCLUDE, so that symbols defined in
+		 the warning section don't get copied to the output.  */
+	      s->flags |= SEC_EXCLUDE;
 	    }
 	}
     }
@@ -3514,7 +3489,6 @@
     goto error_return;
   else
     {
-      asection *s;
       const char *soname = NULL;
       char *audit = NULL;
       struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
@@ -3704,7 +3678,7 @@
 	return TRUE;
 
       /* Save the DT_AUDIT entry for the linker emulation code. */
-      elf_dt_audit (abfd) = audit; 
+      elf_dt_audit (abfd) = audit;
     }
 
   /* If this is a dynamic object, we always link against the .dynsym
@@ -3733,7 +3707,7 @@
       extsymoff = hdr->sh_info;
     }
 
-  sym_hash = NULL;
+  sym_hash = elf_sym_hashes (abfd);
   if (extsymcount != 0)
     {
       isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
@@ -3741,13 +3715,16 @@
       if (isymbuf == NULL)
 	goto error_return;
 
-      /* We store a pointer to the hash table entry for each external
-	 symbol.  */
-      amt = extsymcount * sizeof (struct elf_link_hash_entry *);
-      sym_hash = (struct elf_link_hash_entry **) bfd_alloc (abfd, amt);
       if (sym_hash == NULL)
-	goto error_free_sym;
-      elf_sym_hashes (abfd) = sym_hash;
+	{
+	  /* We store a pointer to the hash table entry for each
+	     external symbol.  */
+	  amt = extsymcount * sizeof (struct elf_link_hash_entry *);
+	  sym_hash = (struct elf_link_hash_entry **) bfd_zalloc (abfd, amt);
+	  if (sym_hash == NULL)
+	    goto error_free_sym;
+	  elf_sym_hashes (abfd) = sym_hash;
+	}
     }
 
   if (dynamic)
@@ -3797,8 +3774,7 @@
 	}
 
       tabsize = htab->root.table.size * sizeof (struct bfd_hash_entry *);
-      hashsize = extsymcount * sizeof (struct elf_link_hash_entry *);
-      old_tab = bfd_malloc (tabsize + entsize + hashsize);
+      old_tab = bfd_malloc (tabsize + entsize);
       if (old_tab == NULL)
 	goto error_free_vers;
 
@@ -3810,22 +3786,20 @@
 
       /* Make a special call to the linker "notice" function to
 	 tell it that we are about to handle an as-needed lib.  */
-      if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
-				       notice_as_needed, 0, NULL))
+      if (!(*bed->notice_as_needed) (abfd, info, notice_as_needed))
 	goto error_free_vers;
 
-      /* Clone the symbol table and sym hashes.  Remember some
-	 pointers into the symbol table, and dynamic symbol count.  */
-      old_hash = (char *) old_tab + tabsize;
-      old_ent = (char *) old_hash + hashsize;
+      /* Clone the symbol table.  Remember some pointers into the
+	 symbol table, and dynamic symbol count.  */
+      old_ent = (char *) old_tab + tabsize;
       memcpy (old_tab, htab->root.table.table, tabsize);
-      memcpy (old_hash, sym_hash, hashsize);
       old_undefs = htab->root.undefs;
       old_undefs_tail = htab->root.undefs_tail;
       old_table = htab->root.table.table;
       old_size = htab->root.table.size;
       old_count = htab->root.table.count;
       old_dynsymcount = htab->dynsymcount;
+      old_dynstr_size = _bfd_elf_strtab_size (htab->dynstr);
 
       for (i = 0; i < htab->root.table.size; i++)
 	{
@@ -3863,18 +3837,18 @@
       bfd_boolean size_change_ok;
       bfd_boolean type_change_ok;
       bfd_boolean new_weakdef;
+      bfd_boolean new_weak;
+      bfd_boolean old_weak;
       bfd_boolean override;
       bfd_boolean common;
       unsigned int old_alignment;
       bfd *old_bfd;
-      bfd * undef_bfd = NULL;
 
       override = FALSE;
 
       flags = BSF_NO_FLAGS;
       sec = NULL;
       value = isym->st_value;
-      *sym_hash = NULL;
       common = bed->common_definition (isym);
 
       bind = ELF_ST_BIND (isym->st_info);
@@ -3987,6 +3961,13 @@
 	  goto error_free_vers;
 	}
 
+      /* Silently discard TLS symbols from --just-syms.  There's
+	 no way to combine a static TLS block with a new TLS block
+	 for this exec