Patchwork CFT: [build] Move shlib support to toplevel libgcc

login
register
mail settings
Submitter Rainer Orth
Date Nov. 2, 2011, 12:29 p.m.
Message ID <yddaa8eaesc.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/123263/
State New
Headers show

Comments

Rainer Orth - Nov. 2, 2011, 12:29 p.m.
Paolo Bonzini <bonzini@gnu.org> writes:

> The patch is okay after it has been bootstrapped on IA64/VMS and Win32.

Here's the version I've checked in after Joseph's approval and final
regtesting (of the whole libgcc series) on i386-pc-solaris2.11,
sparc-sun-solaris2.11, x86_64-unknown-linux-gnu, i386-apple-darwin9.8.0,
and powerpc-apple-darwin9.8.0.

	Rainer


2011-07-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	PR translation/45116
	* Makefile.in (slibdir): Remove, don't export.
	(SHLIB_NM_FLAGS): Remove.
	(libgcc.mvars): Don't emit SHLIB_LINK, SHLIB_INSTALL,
	SHLIB_DLLDIR, SHLIB_EXT, SHLIB_MKMAP, SHLIB_MKMAP_OPTS,
	SHLIB_MAPFILES, SHLIB_NM_FLAGS.
	(DRIVER_DEFINES): Test SHLIB instead of SHLIB_LINK.
	(gcc.o): Pass SHLIB instead of SHLIB_LINK.
	(gccspec.o): Likewise.
	(installdirs): Don't create $(DESTDIR)$(slibdir).
	* configure.ac (slibdir): Remove.
	* configure: Regenerate.
	* libgcc-libsystem.ver: Move to ../libgcc/config.
	* mkmap-flat.awk, mkmap-symver.awk: Move to ../libgcc.
	* config/libgcc-glibc.ver: Move to ../libgcc/config.
	* config/t-libunwind (SHLIB_LC): Remove.
	* config/t-linux (SHLIB_MAPFILES): Remove.
	* config/t-slibgcc-dummy: Rename to config/t-slibgcc.
	* config/t-slibgcc-elf-ver: Remove.
	* config/t-slibgcc-libgcc, config/t-slibgcc-nolc-override: Move to
	../libgcc/config.
	* config/alpha/libgcc-alpha-ldbl.ver, config/alpha/t-linux: Move
	to ../libgcc/config/alpha.
	* config/alpha/t-vms (shlib_version, SHLIB_EXT, SHLIB_OBJS,
	SHLIB_NAME, SHLIB_MULTILIB, SHLIB_INSTALL, SHLIB_SYMVEC,
	SHLIB_SYMVECX2, SHLIB_LINK): Remove.
	* config/arm/libgcc-bpabi.ver: Move to ../libgcc/config/arm.
	* config/arm/t-bpabi (SHLIB_MAPFILES): Remove.
	* config/arm/t-netbsd (SHLIB_EXT, SHLIB_NAME, SHLIB_SONAME,
	SHLIB_OBJS, SHLIB_LINK, SHLIB_INSTALL): Remove.
	* config/arm/t-symbian (SHLIB_LC): Remove.
	* config/bfin/libgcc-bfin.ver: Move to
	../libgcc/config/bfin/libgcc-glibc.ver.
	* config/bfin/t-bfin-linux (SHLIB_MAPFILES): Remove.
	* config/c6x/libgcc-c6xeabi.ver: Move to
	../libgcc/config/c6x/libgcc-eabi.ver.
	* config/c6x/t-c6x-elf (SHLIB_MAPFILES): Remove.
	* config/cris/libgcc.ver: Move to
	../libgcc/config/cris/libgcc-glibc.ver.
	* config/cris/t-linux (SHLIB_MAPFILES): Remove.
	* config/frv/libgcc-frv.ver: Move to ../libgcc/config/frv.
	* config/frv/t-linux (SHLIB_MAPFILES): Remove.
	* config/i386/darwin-libgcc.10.4.ver: Move to
	../libgcc/config/i386/libgcc-darwin.10.4.ver.
	* config/i386/darwin-libgcc.10.5.ver: Move to
	../libgcc/config/i386/libgcc-darwin.10.5.ver.
	* config/i386/libgcc-glibc.ver: Move to ../libgcc/config/i386.
	* config/i386/t-cygming (SHLIB_EXT, SHLIB_IMPLIB, SHLIB_SOVERSION,
	SHLIB_SONAME, SHLIB_MAP, SHLIB_OBJS, SHLIB_DIR, SHLIB_SLIBDIR_QUAL)
	SHLIB_PTHREAD_CFLAG, SHLIB_PTHREAD_LDFLAG, SHLIB_LINK,
	SHLIB_INSTALL, SHLIB_MKMAP, SHLIB_MKMAP_OPTS, SHLIB_MAPFILES):
	Remove.
	* config/i386/t-cygwin (SHLIB_LC, SHLIB_EH_EXTENSION,
	SHLIB_IMPLIB, SHLIB_SONAME, SHLIB_MKMAP_OPTS): Remove.
	* config/i386/t-dlldir, config/i386/t-dlldir-x: Move to
	../libgcc/config/i386.
	* config/i386/t-dw2-eh, config/i386/t-sjlj-eh: Move to
	../libgcc/config/i386.
	* config/i386/t-linux: Move to ../libgcc/config/i386.
	* config/i386/t-mingw-pthread: Move to ../libgcc/config/i386.
	* config/i386/t-mingw-w32 (SHLIB_LC): Remove.
	* config/i386/t-mingw-w64: Likewise.
	* config/i386/t-mingw32: Remove.
	* config/ia64/libgcc-glibc.ver, config/ia64/libgcc-ia64.ver: Move
	to ../libgcc/config/ia64.
	* config/ia64/t-glibc: Remove.
	* config/ia64/t-hpux (SHLIB_EXT, SHLIB_LINK, SHLIB_INSTALL): Remove.
	* config/ia64/t-ia64 (SHLIB_MAPFILES): Remove.
	* config/ia64/t-vms (shlib_version, SHLIB_EXT, SHLIB_OBJS,
	SHLIB_NAME, SHLIB_MULTILIB, SHLIB_INSTALL, SHLIB_LINK): Remove.
	* config/ia64/vms_symvec_libgcc_s.opt: Remove.
	* config/m32r/libgcc-glibc.ver: Move to ../libgcc/config/m32r.
	* config/m32r/t-linux (SHLIB_MAPFILES): Remove.
	* config/m68k/t-slibgcc-elf-ver: Move to ../libgcc/config/m68k.
	* config/mips/t-libgcc-mips16 (SHLIB_MAPFILES): Remove.
	* config/pa/t-hpux-shlib: Move to ../libgcc/config/pa/t-slibgcc-hpux.
	* config/pa/t-slibgcc-dwarf-ver, config/pa/t-slibgcc-sjsj-ver:
	Move to ../libgcc/config/pa.
	* config/rs6000/darwin-libgcc.10.4.ver: Move to
	../libgcc/config/rs6000/libgcc-darwin.10.4.ver.
	* config/rs6000/darwin-libgcc.10.5.ver: Move to
	../libgcc/config/rs6000/libgcc-darwin.10.5.ver.
	* config/rs6000/t-aix43 (SHLIB_EXT, SHLIB_LINK, SHLIB_INSTALL,
	SHLIB_LIBS, SHLIB_MKMAP, SHLIB_NM_FLAGS, AR_FLAGS_FOR_TARGET): Remove.
	* config/rs6000/t-aix52: Likewise.
	* config/sh/libgcc-excl.ver, config/sh/libgcc-glibc.ver: Move to
	../libgcc/config/sh.
	* config/sparc/libgcc-sparc-glibc.ver: Move to
	../libgcc/config/sparc/libgcc-glibc.ver.
	* config/sparc/t-linux: Move to ../libgcc/config/sparc.
	* config/xtensa/t-linux (SHLIB_MAPFILES): Remove.
	* config/xtensa/libgcc-xtensa.ver: Move to
	../libgcc/config/xtensa/libgcc-glibc.ver.
	* config.gcc (*-*-freebsd*): Replace t-slibgcc-elf-ver with
	t-slibgcc in tmake_file.
	Remove t-slibgcc-nolc-override for *-*-freebsd[34],
	*-*-freebsd[34].* with pthreads.
	(*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu,
	*-*-knetbsd*-gnu, *-*-gnu*, *-*-kopensolaris*-gnu): Replace
	t-slibgcc-elf-ver with t-slibgcc in tmake_file.
	(*-*-netbsd*): Likewise.
	(*-*-solaris2*): Replace t-slibgcc-dummy with t-slibgcc in tmake_file.
	(*-*-*vms*): Add t-slibgcc to tmake_file.
	(alpha*-*-linux*): Remove alpha/t-linux from tmake_file.
	(alpha*-dec-osf5.1*): Replace t-slibgcc-dummy with t-slibgcc in
	tmake_file.
	(arm*-*-linux*): Remove t-slibgcc-libgcc from tmake_file for
	arm*-*-linux-*eabi.
	(bfin*-linux-uclibc*): Replace t-slibgcc-dummy with t-slibgcc in
	tmake_file.
	(crisv32-*-linux*, cris-*-linux*): Likewise.
	(hppa*-*-linux*): Remove t-slibgcc-libgcc, pa/t-slibgcc-sjlj-ver,
	pa/t-slibgcc-dwarf-ver from tmake_file.
	(hppa[12]*-*-hpux10*): Replace pa/t-hpux-shlib with t-slibgcc in
	tmake_file.
	Remove pa/t-slibgcc-sjlj-ver, pa/t-slibgcc-dwarf-ver from tmake_file.
	(hppa*64*-*-hpux11*): Likewise.
	(hppa[12]*-*-hpux11*): Likewise.
	(i[34567]86-*-darwin*): Replace t-slibgcc-dummy in t-slibgcc in
	tmake_file.
	(x86_64-*-darwin*): Likewise.
	(i[34567]86-*-cygwin*): Remove tmake_eh_file, tmake_dlldir_file.
	Add t-slibgcc to tmake_file.
	(i[34567]86-*-mingw*, x86_64-*-mingw*): Likewise.
	Remove i386/t-mingw32 from tmake_file unless x86_64-w64-*,
	i[34567]86-w64-*.
	Remove i386/t-mingw-pthread from tmake_file.
	(ia64*-*-linux*): Remove ia64/t-glibc from tmake_file.
	(ia64*-*-hpux*): Add t-slibgcc to tmake_file.
	(ia64-hp-*vms*): Likewise.
	(m32r-*-linux*): Replace t-slibgcc-elf-ver with t-slibgcc in
	tmake_file.
	(m32rle-*-linux*): Likewise.
	(m68k-*-linux*): Remove m68k/t-slibgcc-elf-ver from tmake_file.
	(microblaze*-linux*): Remove t-slibgcc-elf-ver,
	t-slibgcc-nolc-override from tmake_file.
	(mips-sgi-irix6.5*): Replace t-slibgcc-dummy with t-slibgcc in
	tmake_file.
	(powerpc-*-darwin*): Likewise.
	(powerpc64-*-darwin*): Likewise.
	(powerpc-*-freebsd*): Remove t-slibgcc-libgcc from tmake_file.
	(powerpc-*-linux*, powerpc64-*-linux*): Likewise.
	(rs6000-ibm-aix4.[3456789]*, powerpc-ibm-aix4.[3456789]*): Add
	t-slibgcc to tmake_file.
	(rs6000-ibm-aix5.1.*, powerpc-ibm-aix5.1.*): Likewise.
	(rs6000-ibm-aix5.2.*, powerpc-ibm-aix5.2.*): Likewise.
	(rs6000-ibm-aix5.3.*, powerpc-ibm-aix5.3.*): Likewise.
	(rs6000-ibm-aix[6789].*, powerpc-ibm-aix[6789].*): Likewise.
	(sparc-*-linux*): Remove sparc/t-linux from tmake_file.
	(sparc64-*-linux*): Likewise.
	(tic6x-*-uclinux): Replace t-slibgcc-elf-ver with t-slibgcc in
	tmake_file.
	(i[34567]86-*-linux*, x86_64-*-linux*, i[34567]86-*-kfreebsd*-gnu,
	x86_64-*-kfreebsd*-gnu, i[34567]86-*-gnu*): Remove i386/t-linux
	from tmake_file.

	gcc/cp:
	* Make-lang.in (g++spec.o): Pass SHLIB instead of SHLIB_LINK.

	gcc/fortran:
	* Makef-lang.in (gfortranspec.o): Pass SHLIB instead of SHLIB_LINK.

	gcc/go:
	* Make-lang.in (gospec.o): Pass SHLIB instead of SHLIB_LINK.

	gcc/java:
	* Make-lang.in (jvspec.o): Pass SHLIB instead of SHLIB_LINK.

	libgcc:
	* Makefile.in (SHLIB_NM_FLAGS): Set.
	* mkmap-flat.awk, mkmap-symver.awk: New files.
	* configure.ac (libgcc_cv_lib_sjlj_exceptions): Check for SjLj
	exceptions.
	* configure: Regenerate.
	* config/libgcc-glibc.ver: New file.
	* config/libgcc-libsystem.ver: New file.
	* config/t-libunwind (SHLIB_LC): Set.
	* config/t-linux: New file.
	* config/t-slibgcc (INSTALL_SHLIB): New.
	(SHLIB_INSTALL): Use it.
	* config/t-slibgcc-darwin (SHLIB_MKMAP): Use $(srcdir) to refer
	to mkmap-symver.awk.
	(SHLIB_MAPFILES): Don't append, adapt pathname.
	(SHLIB_VERPFX): Set.
	* config/t-slibgcc-elf-ver (SHLIB_MKMAP): Use $(srcdir) to refer
	to mkmap-symver.awk.
	* config/t-slibgcc-gld-nover, config/t-slibgcc-hpux,
	config/t-slibgcc-libgcc, config/t-slibgcc-vms: New files.
	* config/alpha/libgcc-alpha-ldbl.ver, config/alpha/t-linux: New files.
	* config/alpha/t-slibgcc-osf (SHLIB_MKMAP): Use $(srcdir) to refer
	to mkmap-flat.awk.
	* config/arm/t-bpabi (SHLIB_MAPFILES): Set.
	* config/bfin/libgcc-glibc.ver, config/bfin/t-linux: New files.
	* config/c6x/libgcc-eabi.ver, config/c6x/t-elf: New files.
	* config/cris/libgcc-glibc.ver, config/cris/t-linux: New files.
	* config/frv/libgcc-frv.ver, config/frv/t-linux: New files.
	* config/i386/libgcc-darwin.10.4.ver,
	config/i386/libgcc-darwin.10.5.ver, config/i386/libgcc-glibc.ver:
	New files.
	* config/i386/t-darwin: Remove.
	* config/i386/t-darwin64: Likewise.
	* config/i386/t-dw2-eh, config/i386/t-sjlj-eh: New files.
	* config/i386/t-slibgcc-cygming, config/i386/t-cygwin,
	config/i386/t-dlldir, config/i386/t-dlldir-x: New files.
	* config/i386/t-linux: New file.
	* config/i386/t-mingw32: New file.
	* config/ia64/libgcc-glibc.ver, config/ia64/libgcc-ia64.ver: New files.
	* config/ia64/t-glibc: Rename to ...
	* config/ia64/t-linux: ... this.
	(SHLIB_MAPFILES): Set.
	* config/ia64/t-glibc-libunwind: Rename to ...
	* config/ia64/t-linux-libunwind: ... this.
	* config/ia64/t-ia64 (SHLIB_MAPFILES): Set.
	* config/ia64/t-slibgcc-hpux: New file.
	* config/m32r/libgcc-glibc.ver, config/m32r/t-linux: New files.
	* config/m68k/t-slibgcc-elf-ver: New file.
	* config/mips/t-mips16 (SHLIB_MAPFILES): Set.
	* config/mips/t-slibgcc-irix (SHLIB_MKMAP): Use $(srcdir) to refer
	to mkmap-flat.awk.
	* config/pa/t-slibgcc-hpux: New file.
	* config/pa/t-slibgcc-dwarf-ver, config/pa/t-slibgcc-sjsj-ver: New
	files.
	* config/rs6000/libgcc-darwin.10.4.ver,
	config/rs6000/libgcc-darwin.10.5.ver: New files.
	* config/rs6000/libgcc-ppc-glibc.ver: Rename to
	config/rs6000/libgcc-glibc.ver.
	* config/rs6000/libgcc-ppc64.ver: Rename to
	config/rs6000/libgcc-ibm-ldouble.ver.
	* config/rs6000/t-darwin (SHLIB_VERPFX): Remove.
	* config/rs6000/t-ibm-ldouble (SHLIB_MAPFILES): Adapt filename.
	* config/rs6000/t-ldbl128: Rename to ...
	* config/rs6000/t-linux: ... this.
	(SHLIB_MAPFILES): Adapt filename.
	* config/rs6000/t-slibgcc-aix: New file.
	* config/sh/libgcc-excl.ver, config/sh/libgcc-glibc.ver: New files.
	* config/sh/t-linux (SHLIB_MAPFILES): Use $(srcdir) to refer to
	libgcc-excl.ver, libgcc-glibc.ver.
	(SHLIB_LINK, SHLIB_INSTALL): Remove.
	* config/sparc/libgcc-glibc.ver: New file.
	* config/sparc/t-linux: New file.
	* config/xtensa/libgcc-glibc.ver, config/xtensa/t-linux: New files.
	* config.host (*-*-freebsd*): Add t-slibgcc, t-slibgcc-gld,
	t-slibgcc-elf-ver to tmake_file.
	Add t-slibgcc-nolc-override to tmake_file for posix threads on
	*-*-freebsd[34].
	(*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu,
	*-*-gnu*, *-*-kopensolaris*-gnu): Add t-slibgcc, t-slibgcc-gld,
	t-slibgcc-elf-ver, t-linux to tmake_file.
	(*-*-netbsd*): Add t-slibgcc, t-slibgcc-gld, t-slibgcc-elf-ver to
	tmake_file.
	(alpha*-*-linux*): Add alpha/t-linux to tmake_file.
	(alpha64-dec-*vms*): Add t-slibgcc-vms to tmake_file.
	(alpha*-dec-*vms*): Likewise.
	(arm*-*-freebsd*): Append to tmake_file.
	(arm*-*-netbsdelf*): Add t-slibgcc-gld-nover to tmake_file.
	(arm*-*-linux*): Add t-slibgcc-libgcc to tmake_file for
	arm*-*-linux-*eabi.
	(arm*-*-eabi*, arm*-*-symbianelf*): Add t-slibgcc-nolc-override to
	tmake_file for arm*-*-symbianelf*.
	(bfin*-linux-uclibc*): Append to tmake_file, add bfin/t-linux.
	(cris-*-linux*, crisv32-*-linux*): Append to tmake_file, add
	cris/t-linux.
	(frv-*-*linux*): Append to tmake_file, add frv/t-linux.
	(hppa*-*-linux*): Add t-slibgcc-libgcc, pa/t-slibgcc-sjlj-ver,
	pa/t-slibgcc-dwarf-ver to tmake_file.
	(hppa[12]*-*-hpux10*): Add t-slibgcc, pa/t-slibgcc-sjlj-ver,
	pa/t-slibgcc-dwarf-ver, t-slibgcc-hpux, pa/t-slibgcc-hpux to tmake_file.
	(hppa*64*-*-hpux11*): Likewise.
	(hppa[12]*-*-hpux11*): Likewise.
	(x86_64-*-darwin*): Don't override tmake_file, but only keep
	i386/t-crtpc, i386/t-crtfm.
	(i[34567]86-*-cygwin*): Set tmake_eh_file, tmake_dlldir_file.
	Prepend $tmake_eh_file, $tmake_dlldir_file, i386/t-slibgcc-cygming
	to tmake_file.
	Add i386/t-cygwin to tmake_file.
	Prepent i386/t-mingw-pthread to tmake_file for posix threads.
	(i[34567]86-*-mingw*): Set tmake_eh_file, tmake_dlldir_file.
	Prepend $tmake_eh_file, $tmake_dlldir_file, i386/t-slibgcc-cygming
	to tmake_file.
	Add i386/t-mingw32 to tmake_file.
	(x86_64-*-mingw*): Likewise.
	(ia64*-*-freebsd*): Append to tmake_file.
	(ia64*-*-linux*): Append to tmake_file.
	Replace ia64/t-glibc by ia64/t-linux.
	Replace ia64/t-glibc-libunwind by ia64/t-linux-libunwind if using
	system libunwind.
	(ia64*-*-hpux*): Add t-slibgcc, ia64/t-slibgcc-hpux,
	t-slibgcc-hpux to tmake_file.
	(ia64-hp-*vms*): Add t-slibgcc-vms to tmake_file.
	(m32r-*-linux*): Append to tmake_file, add m32r/t-linux.
	(m32rle-*-linux*): Likewise.
	(m68k-*-linux*)): Add m68k/t-slibgcc-elf-ver to tmake_file unless
	sjlj exceptions.
	(microblaze*-linux*): New case.
	Append to tmake_file, add t-slibgcc-nolc-override.
	(powerpc-*-freebsd*): Add t-slibgcc-libgcc to tmake_file.
	(powerpc-*-linux*, powerpc64-*-linux*): Likewise.
	Replace rs6000/t-ldbl128 by rs6000/t-linux in tmake_file.
	(rs6000-ibm-aix4.[3456789]*, powerpc-ibm-aix4.[3456789]*): Add
	rs6000/t-slibgcc-aix to tmake_file.
	(rs6000-ibm-aix5.1.*, powerpc-ibm-aix5.1.*): Likewise.
	(rs6000-ibm-aix[56789].*, powerpc-ibm-aix[56789].*): Likewise.
	(sh-*-elf*, sh[12346l]*-*-elf*, sh-*-linux*)
	(sh[2346lbe]*-*-linux*, sh-*-netbsdelf*, shl*-*-netbsdelf*)
	(sh5-*-netbsd*, sh5l*-*-netbsd*, sh64-*-netbsd*)
	(sh64l*-*-netbsd*): Add t-slibgcc-libgcc to tmake_file for
	sh*-*-linux*.
	(sparc-*-linux*): Append to tmake_file for *-leon*.
	Add sparc/t-linux to tmake_file for non-Leon targets.
	(sparc64-*-linux*): Add sparc/t-linux to tmake_file.
	(tic6x-*-uclinux): New case.
	Add t-slibgcc, t-slibgcc-gld, t-slibgcc-elf-ver to tmake_file.
	(tic6x-*-*): Add c6x/t-elf to tmake_file.
	(xtensa*-*-linux*): Append to tmake_file, add xtensa/t-linux.
	(am33_2.0-*-linux*): Append to tmake_file.
	(i[34567]86-*-linux*, x86_64-*-linux*, i[34567]86-*-kfreebsd*-gnu)
	(i[34567]86-*-knetbsd*-gnu, i[34567]86-*-gnu*): Also handle
	x86_64-*-kfreebsd*-gnu.
	Add i386/t-linux to tmake_file.

Patch

# HG changeset patch
# Parent 3af925c367b7790a9eb200d705fda901b5da2177
Move shlib support to toplevel libgcc

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -612,8 +612,6 @@  prefix_to_exec_prefix := \
 dollar = @dollar@
 # Used in install-cross.
 gcc_tooldir = @gcc_tooldir@
-# Used to install the shared libgcc.
-slibdir = @slibdir@
 # Since gcc_tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
 build_tooldir = $(exec_prefix)/$(target_noncanonical)
 # Directory in which the compiler finds target-independent g++ includes.
@@ -696,9 +694,6 @@  CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(IN
   -fno-stack-protector \
   $(INHIBIT_LIBC_CFLAGS)
 
-# nm flags to list global symbols in libgcc object files.
-SHLIB_NM_FLAGS = -pg
-
 # List of extra executables that should be compiled for this target machine
 # that are used for compiling from source code to object code.
 # The rules for compiling them should be in the t-* file for the machine.
@@ -1137,7 +1132,6 @@  export NM_FOR_TARGET
 export STRIP_FOR_TARGET
 export RANLIB_FOR_TARGET
 export libsubdir
-export slibdir
 
 FLAGS_TO_PASS = \
 	"ADA_CFLAGS=$(ADA_CFLAGS)" \
@@ -1909,14 +1903,6 @@  libgcc.mvars: config.status Makefile $(L
 	echo LIB2_SIDITI_CONV_FUNCS = '$(LIB2_SIDITI_CONV_FUNCS)' >> tmp-libgcc.mvars
 	echo LIB2_DIVMOD_FUNCS = '$(LIB2_DIVMOD_FUNCS)' >> tmp-libgcc.mvars
 	echo GCC_EXTRA_PARTS = '$(GCC_EXTRA_PARTS)' >> tmp-libgcc.mvars
-	echo SHLIB_LINK = '$(subst $(GCC_FOR_TARGET),$$(GCC_FOR_TARGET),$(SHLIB_LINK))' >> tmp-libgcc.mvars
-	echo SHLIB_INSTALL = '$(SHLIB_INSTALL)' >> tmp-libgcc.mvars
-	echo SHLIB_DLLDIR = '$(SHLIB_DLLDIR)' >> tmp-libgcc.mvars
-	echo SHLIB_EXT = '$(SHLIB_EXT)' >> tmp-libgcc.mvars
-	echo SHLIB_MKMAP = '$(call srcdirify,$(SHLIB_MKMAP))' >> tmp-libgcc.mvars
-	echo SHLIB_MKMAP_OPTS = '$(SHLIB_MKMAP_OPTS)' >> tmp-libgcc.mvars
-	echo SHLIB_MAPFILES = '$(call srcdirify,$(SHLIB_MAPFILES))' >> tmp-libgcc.mvars
-	echo SHLIB_NM_FLAGS = '$(SHLIB_NM_FLAGS)' >> tmp-libgcc.mvars
 	echo LIBGCC2_CFLAGS = '$(LIBGCC2_CFLAGS)' >> tmp-libgcc.mvars
 	echo TARGET_LIBGCC2_CFLAGS = '$(TARGET_LIBGCC2_CFLAGS)' >> tmp-libgcc.mvars
 	echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars
@@ -2186,20 +2172,20 @@  DRIVER_DEFINES = \
   -DTOOLDIR_BASE_PREFIX=\"$(libsubdir_to_prefix)$(prefix_to_exec_prefix)\" \
   @TARGET_SYSTEM_ROOT_DEFINE@ \
   $(VALGRIND_DRIVER_DEFINES) \
-  `test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
+  `test "X$${SHLIB}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
   -DCONFIGURE_SPECS="\"@CONFIGURE_SPECS@\""
 
 gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \
     Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \
     configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H) $(VEC_H) $(PARAMS_H)
-	(SHLIB_LINK='$(SHLIB_LINK)'; \
+	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
   $(DRIVER_DEFINES) \
   -c $(srcdir)/gcc.c $(OUTPUT_OPTION))
 
 gccspec.o: gccspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
     $(OPTS_H)
-	(SHLIB_LINK='$(SHLIB_LINK)'; \
+	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
   $(DRIVER_DEFINES) \
   -c $(srcdir)/gccspec.c $(OUTPUT_OPTION))
@@ -4609,7 +4595,6 @@  installdirs:
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
 	$(mkinstalldirs) $(DESTDIR)$(includedir)
 	$(mkinstalldirs) $(DESTDIR)$(infodir)
-	$(mkinstalldirs) $(DESTDIR)$(slibdir)
 	$(mkinstalldirs) $(DESTDIR)$(man1dir)
 	$(mkinstalldirs) $(DESTDIR)$(man7dir)
 
diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -559,7 +559,7 @@  case ${target} in
   extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
   fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'`
   tm_defines="${tm_defines} FBSD_MAJOR=${fbsd_major}"
-  tmake_file="t-slibgcc-elf-ver t-freebsd"
+  tmake_file="t-freebsd t-slibgcc"
   case ${enable_threads} in
     no)
       fbsd_tm_file="${fbsd_tm_file} freebsd-nthr.h"
@@ -567,13 +567,6 @@  case ${target} in
     "" | yes | posix)
       thread_file='posix'
       tmake_file="${tmake_file} t-freebsd-thread"
-      # Before 5.0, FreeBSD can't bind shared libraries to -lc
-      # when "optionally" threaded via weak pthread_* checks.
-      case ${target} in
-        *-*-freebsd[34] | *-*-freebsd[34].*)
-          tmake_file="${tmake_file} t-slibgcc-nolc-override"
-          ;;
-      esac
       ;;
     *)
       echo 'Unknown thread configuration for FreeBSD'
@@ -599,7 +592,7 @@  case ${target} in
   case ${enable_threads} in
     "" | yes | posix) thread_file='posix' ;;
   esac
-  tmake_file="t-slibgcc-elf-ver t-linux"
+  tmake_file="t-linux t-slibgcc"
   case $target in
     *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-kopensolaris*-gnu)
       :;;
@@ -647,7 +640,7 @@  case ${target} in
   esac
   ;;
 *-*-netbsd*)
-  tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic"
+  tmake_file="t-libc-ok t-netbsd t-libgcc-pic t-slibgcc"
   gas=yes
   gnu_ld=yes
 
@@ -730,7 +723,7 @@  case ${target} in
     tm_file="usegas.h ${tm_file}"
   fi
   tm_p_file="${tm_p_file} sol2-protos.h"
-  tmake_file="${tmake_file} t-sol2 t-slibgcc-dummy"
+  tmake_file="${tmake_file} t-sol2 t-slibgcc"
   c_target_objs="${c_target_objs} sol2-c.o"
   cxx_target_objs="${cxx_target_objs} sol2-c.o sol2-cxx.o"
   extra_objs="sol2.o sol2-stubs.o"
@@ -744,7 +737,7 @@  case ${target} in
 *-*-*vms*)
   extra_options="${extra_options} vms/vms.opt"
   xmake_file=vms/x-vms
-  tmake_file="vms/t-vms"
+  tmake_file="vms/t-vms t-slibgcc"
   extra_objs="vms.o"
   target_gtfiles="$target_gtfiles \$(srcdir)/config/vms/vms.c"
   tm_p_file="${tm_p_file} vms/vms-protos.h"
@@ -777,7 +770,7 @@  alpha*-*-linux*)
 	tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h"
 	extra_options="${extra_options} alpha/elf.opt"
 	target_cpu_default="MASK_GAS"
-	tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee alpha/t-linux"
+	tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee"
 	extra_parts="${extra_parts} crtfastmath.o"
 	;;
 alpha*-*-freebsd*)
@@ -814,7 +807,7 @@  alpha*-dec-osf5.1*)
 		extra_passes="mips-tfile mips-tdump"
 	fi
 	use_collect2=yes
-	tmake_file="t-slibgcc-dummy"
+	tmake_file="t-slibgcc"
 	tm_file="${tm_file} alpha/osf5.h"
 	tm_defines="${tm_defines} TARGET_SUPPORT_ARCH=1"
 	extra_options="${extra_options} rpath.opt alpha/osf5.opt"
@@ -862,7 +855,7 @@  arm*-*-linux*)			# ARM GNU/Linux with EL
 	arm*-*-linux-*eabi)
 	    tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
 	    libgcc_tm_file="$libgcc_tm_file arm/bpabi-lib.h"
-	    tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"
+	    tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
 	    # Define multilib configuration for arm-linux-androideabi.
 	    case ${target} in
 	    *-androideabi)
@@ -969,7 +962,7 @@  bfin*-uclinux*)
 	;;
 bfin*-linux-uclibc*)
 	tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h"
-	tmake_file="t-slibgcc-elf-ver bfin/t-bfin-linux"
+	tmake_file="bfin/t-bfin-linux t-slibgcc"
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
 	use_collect2=no
 	;;
@@ -1001,7 +994,7 @@  cris-*-elf | cris-*-none)
 crisv32-*-linux* | cris-*-linux*)
 	tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h cris/linux.h"
 	# We need to avoid using t-linux, so override default tmake_file
-	tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux"
+	tmake_file="cris/t-cris cris/t-linux t-slibgcc"
 	extra_options="${extra_options} cris/linux.opt"
 	case $target in
 	  cris-*-*)
@@ -1069,13 +1062,7 @@  hppa*-*-linux*)
 	target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS"
 	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h pa/pa-linux.h \
 		 pa/pa32-regs.h pa/pa32-linux.h"
-	tmake_file="${tmake_file} pa/t-linux t-slibgcc-libgcc"
-	# Set the libgcc version number
-	if test x$sjlj = x1; then
-	    tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
-	else
-	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
-	fi
+	tmake_file="${tmake_file} pa/t-linux"
 	;;
 # port not yet contributed.
 #hppa*-*-openbsd*)
@@ -1098,7 +1085,7 @@  hppa[12]*-*-hpux10*)
 	esac
 	use_gcc_stdint=provide
 	tm_file="${tm_file} hpux-stdint.h"
-	tmake_file="pa/t-pa-hpux10 pa/t-pa-hpux pa/t-hpux-shlib"
+	tmake_file="pa/t-pa-hpux10 pa/t-pa-hpux t-slibgcc"
 	case ${enable_threads} in
 	  "")
 	    if test x$have_pthread_h = xyes ; then
@@ -1109,12 +1096,6 @@  hppa[12]*-*-hpux10*)
 	    tmake_file="${tmake_file} pa/t-dce-thr"
 	    ;;
 	esac
-	# Set the libgcc version number
-	if test x$sjlj = x1; then
-	    tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
-	else
-	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
-	fi
 	use_collect2=yes
 	gas=yes
 	if test "x$with_dwarf2" != x; then
@@ -1147,13 +1128,7 @@  hppa*64*-*-hpux11*)
 	extra_options="${extra_options} pa/pa-hpux.opt \
 		       pa/pa-hpux1010.opt pa/pa64-hpux.opt hpux11.opt"
 	need_64bit_hwint=yes
-	tmake_file="pa/t-pa64 pa/t-pa-hpux pa/t-hpux-shlib"
-	# Set the libgcc version number
-	if test x$sjlj = x1; then
-	    tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
-	else
-	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
-	fi
+	tmake_file="pa/t-pa64 pa/t-pa-hpux t-slibgcc"
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o \
 		     libgcc_stub.a"
 	case x${enable_threads} in
@@ -1193,13 +1168,7 @@  hppa[12]*-*-hpux11*)
 		extra_options="${extra_options} pa/pa-hpux1131.opt"
 		;;
 	esac
-	tmake_file="pa/t-pa-hpux11 pa/t-pa-hpux pa/t-hpux-shlib"
-	# Set the libgcc version number
-	if test x$sjlj = x1; then
-	    tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
-	else
-	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
-	fi
+	tmake_file="pa/t-pa-hpux11 pa/t-pa-hpux t-slibgcc"
 	extra_parts="libgcc_stub.a"
 	case x${enable_threads} in
 	x | xyes | xposix )
@@ -1227,12 +1196,12 @@  i[34567]86-*-darwin*)
 	need_64bit_isa=yes
 	# Baseline choice for a machine that allows m64 support.
 	with_cpu=${with_cpu:-core2}
-	tmake_file="${tmake_file} t-slibgcc-dummy"
+	tmake_file="${tmake_file} t-slibgcc"
 	libgcc_tm_file="$libgcc_tm_file i386/darwin-lib.h"
 	;;
 x86_64-*-darwin*)
 	with_cpu=${with_cpu:-core2}
-	tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-dummy"
+	tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc"
 	tm_file="${tm_file} ${cpu_type}/darwin64.h"
 	libgcc_tm_file="$libgcc_tm_file i386/darwin-lib.h"
 	;;
@@ -1460,19 +1429,7 @@  i[4567]86-wrs-vxworks|i[4567]86-wrs-vxwo
 i[34567]86-*-cygwin*)
 	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h"
 	xm_file=i386/xm-cygwin.h
-	# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
-	if test x$sjlj = x0; then
-		tmake_eh_file="i386/t-dw2-eh"
-	else
-		tmake_eh_file="i386/t-sjlj-eh"
-	fi
-	# Shared libgcc DLL install dir depends on cross/native build.
-	if test x${host} = x${target} ; then
-		tmake_dlldir_file="i386/t-dlldir"
-	else
-		tmake_dlldir_file="i386/t-dlldir-x"
-	fi
-	tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-cygming i386/t-cygwin"
+	tmake_file="${tmake_file} i386/t-cygming i386/t-cygwin t-slibgcc"
 	target_gtfiles="\$(srcdir)/config/i386/winnt.c"
 	extra_options="${extra_options} i386/cygming.opt"
 	extra_objs="winnt.o winnt-stubs.o"
@@ -1525,19 +1482,7 @@  i[34567]86-*-mingw* | x86_64-*-mingw*)
 			;;
 	esac
 	tm_file="${tm_file} i386/mingw-stdint.h"
-	# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
-	if test x$sjlj = x0; then
-		tmake_eh_file="i386/t-dw2-eh"
-	else
-		tmake_eh_file="i386/t-sjlj-eh"
-	fi
-	# Shared libgcc DLL install dir depends on cross/native build.
-	if test x${host} = x${target} ; then
-		tmake_dlldir_file="i386/t-dlldir"
-	else
-		tmake_dlldir_file="i386/t-dlldir-x"
-	fi
-	tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-cygming"
+	tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
         case ${target} in
                x86_64-w64-*)
                		tmake_file="${tmake_file} i386/t-mingw-w64"
@@ -1545,9 +1490,6 @@  i[34567]86-*-mingw* | x86_64-*-mingw*)
 	       i[34567]86-w64-*)
 			tmake_file="${tmake_file} i386/t-mingw-w32"
 			;;
-               *)
-               		tmake_file="${tmake_file} i386/t-mingw32"
-                     	;;
 	esac
         native_system_header_dir=/mingw/include
 	target_gtfiles="\$(srcdir)/config/i386/winnt.c"
@@ -1570,7 +1512,6 @@  i[34567]86-*-mingw* | x86_64-*-mingw*)
 	    ;;
 	  posix)
 	    thread_file='posix'
-	    tmake_file="i386/t-mingw-pthread ${tmake_file}"
 	    ;;
 	esac
 	case ${target} in
@@ -1616,13 +1557,13 @@  ia64*-*-freebsd*)
 	;;
 ia64*-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h"
-	tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc"
+	tmake_file="${tmake_file} ia64/t-ia64 t-libunwind"
 	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
 	;;
 ia64*-*-hpux*)
 	tm_file="${tm_file} dbxelf.h elfos.h ia64/sysv4.h ia64/hpux.h"
-	tmake_file="ia64/t-ia64 ia64/t-hpux"
+	tmake_file="ia64/t-ia64 ia64/t-hpux t-slibgcc"
 	target_cpu_default="MASK_GNU_AS"
 	case x$enable_threads in
 	x | xyes | xposix )
@@ -1687,7 +1628,7 @@  m32r-*-rtems*)
 m32r-*-linux*)
 	tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} m32r/linux.h"
 	# We override the tmake_file for linux -- why?
-	tmake_file="t-slibgcc-elf-ver m32r/t-linux"
+	tmake_file="m32r/t-linux t-slibgcc"
 	gnu_ld=yes
 	if test x$enable_threads = xyes; then
 		thread_file='posix'
@@ -1696,7 +1637,7 @@  m32r-*-linux*)
 m32rle-*-linux*)
 	tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m32r/little.h ${tm_file} m32r/linux.h"
 	# We override the tmake_file for linux -- why?
-	tmake_file="t-slibgcc-elf-ver m32r/t-linux"
+	tmake_file="m32r/t-linux t-slibgcc"
 	gnu_ld=yes
 	if test x$enable_threads = xyes; then
 		thread_file='posix'
@@ -1772,11 +1713,6 @@  m68k-*-linux*)		# Motorola m68k's runnin
 	extra_options="${extra_options} m68k/ieee.opt"
 	tm_defines="${tm_defines} MOTOROLA=1"
 	tmake_file="${tmake_file} m68k/t-floatlib m68k/t-linux m68k/t-mlibs"
-	# if not configured with --enable-sjlj-exceptions, bump the
-	# libgcc version number
-	if test x$sjlj != x1; then
-	    tmake_file="$tmake_file m68k/t-slibgcc-elf-ver"
-	fi
 	;;
 m68k-*-rtems*)
 	default_m68k_cpu=68020
@@ -1807,7 +1743,7 @@  microblaze*-linux*)
 	tm_file="${tm_file} dbxelf.h gnu-user.h linux.h microblaze/linux.h"
 	c_target_objs="${c_target_objs} microblaze-c.o"
 	cxx_target_objs="${cxx_target_objs} microblaze-c.o"
-	tmake_file="${tmake_file} t-slibgcc-elf-ver t-slibgcc-nolc-override t-linux microblaze/t-microblaze"
+	tmake_file="${tmake_file} t-linux microblaze/t-microblaze"
         extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o crtbeginT.o"
 	;;
 microblaze*-*-*)
@@ -1818,7 +1754,7 @@  microblaze*-*-*)
         ;;
 mips-sgi-irix6.5*)
 	tm_file="elfos.h ${tm_file} mips/iris6.h"
-	tmake_file="mips/t-irix6 t-slibgcc-dummy"
+	tmake_file="mips/t-irix6 t-slibgcc"
 	extra_options="${extra_options} rpath.opt mips/iris6.opt"
 	target_cpu_default="MASK_ABICALLS"
 	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32"
@@ -2045,19 +1981,18 @@  powerpc-*-darwin*)
 	  *-darwin[0-6]*)
 	    ;;
 	esac
-	tmake_file="${tmake_file} t-slibgcc-dummy"
+	tmake_file="${tmake_file} t-slibgcc"
 	extra_headers=altivec.h
 	;;
 powerpc64-*-darwin*)
 	extra_options="${extra_options} ${cpu_type}/darwin.opt"
-	tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc-dummy"
+	tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc"
 	tm_file="${tm_file} ${cpu_type}/darwin8.h ${cpu_type}/darwin64.h"
 	extra_headers=altivec.h
 	;;
 powerpc-*-freebsd*)
 	tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} rs6000/sysv4.h rs6000/freebsd.h"
 	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
-	tmake_file="${tmake_file} t-slibgcc-libgcc"
 	extra_options="${extra_options} rs6000/sysv4.opt"
 	;;
 powerpc-*-netbsd*)
@@ -2143,7 +2078,6 @@  powerpc-*-linux* | powerpc64-*-linux*)
 		tm_file="${tm_file} rs6000/linux.h glibc-stdint.h"
 		;;
 	esac
-	tmake_file="${tmake_file} t-slibgcc-libgcc"
 	case ${target} in
 	    powerpc*-*-linux*altivec*)
 		tm_file="${tm_file} rs6000/linuxaltivec.h" ;;
@@ -2200,7 +2134,7 @@  powerpcle-*-eabi*)
 	;;
 rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
 	tm_file="rs6000/biarch64.h ${tm_file} rs6000/aix.h rs6000/aix43.h rs6000/xcoff.h rs6000/aix-stdint.h"
-	tmake_file=rs6000/t-aix43
+	tmake_file="rs6000/t-aix43 t-slibgcc"
 	extra_options="${extra_options} rs6000/aix64.opt"
 	use_collect2=yes
 	thread_file='aix'
@@ -2210,7 +2144,7 @@  rs6000-ibm-aix4.[3456789]* | powerpc-ibm
 rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*)
 	tm_file="rs6000/biarch64.h ${tm_file} rs6000/aix.h rs6000/aix51.h rs6000/xcoff.h rs6000/aix-stdint.h"
 	extra_options="${extra_options} rs6000/aix64.opt"
-	tmake_file=rs6000/t-aix43
+	tmake_file="rs6000/t-aix43 t-slibgcc"
 	use_collect2=yes
 	thread_file='aix'
 	use_gcc_stdint=wrap
@@ -2218,7 +2152,7 @@  rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1
 	;;
 rs6000-ibm-aix5.2.* | powerpc-ibm-aix5.2.*)
 	tm_file="${tm_file} rs6000/aix.h rs6000/aix52.h rs6000/xcoff.h rs6000/aix-stdint.h"
-	tmake_file=rs6000/t-aix52
+	tmake_file="rs6000/t-aix52 t-slibgcc"
 	extra_options="${extra_options} rs6000/aix64.opt"
 	use_collect2=yes
 	thread_file='aix'
@@ -2227,7 +2161,7 @@  rs6000-ibm-aix5.2.* | powerpc-ibm-aix5.2
 	;;
 rs6000-ibm-aix5.3.* | powerpc-ibm-aix5.3.*)
 	tm_file="${tm_file} rs6000/aix.h rs6000/aix53.h rs6000/xcoff.h rs6000/aix-stdint.h"
-	tmake_file=rs6000/t-aix52
+	tmake_file="rs6000/t-aix52 t-slibgcc"
 	extra_options="${extra_options} rs6000/aix64.opt"
 	use_collect2=yes
 	thread_file='aix'
@@ -2236,7 +2170,7 @@  rs6000-ibm-aix5.3.* | powerpc-ibm-aix5.3
 	;;
 rs6000-ibm-aix[6789].* | powerpc-ibm-aix[6789].*)
 	tm_file="${tm_file} rs6000/aix.h rs6000/aix61.h rs6000/xcoff.h rs6000/aix-stdint.h"
-	tmake_file=rs6000/t-aix52
+	tmake_file="rs6000/t-aix52 t-slibgcc"
 	extra_options="${extra_options} rs6000/aix64.opt"
 	use_collect2=yes
 	thread_file='aix'
@@ -2494,7 +2428,7 @@  sparc-*-linux*)
 		tmake_file="${tmake_file} sparc/t-sparc sparc/t-leon3"
 		;;
 	    *)
-		tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux"
+		tmake_file="${tmake_file} sparc/t-sparc"
 		;;
 	esac
 	if test x$enable_targets = xall; then
@@ -2540,7 +2474,7 @@  sparc64-*-rtems*)
 sparc64-*-linux*)
 	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default-64.h sparc/linux64.h"
 	extra_options="${extra_options} sparc/long-double-switch.opt"
-	tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux sparc/t-linux64"
+	tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64"
 	extra_parts="${extra_parts} crtfastmath.o"
 	;;
 sparc64-*-freebsd*|ultrasparc-*-freebsd*)
@@ -2591,7 +2525,7 @@  tic6x-*-uclinux)
 	tm_file="${tm_file} dbxelf.h tm-dwarf2.h glibc-stdint.h"
 	tm_file="${tm_file} ./sysroot-suffix.h"
 	libgcc_tm_file="${libgcc_tm_file} c6x/c6x-abi.h"
-	tmake_file="t-slibgcc-elf-ver t-sysroot-suffix"
+	tmake_file="t-sysroot-suffix t-slibgcc"
 	tmake_file="${tmake_file} c6x/t-c6x c6x/t-c6x-elf c6x/t-c6x-uclinux"
 	use_collect2=no
 	;;
@@ -3607,7 +3541,6 @@  case ${target} in
 	i[34567]86-*-linux* | x86_64-*-linux* | \
 	  i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
 	  i[34567]86-*-gnu*)
-		tmake_file="${tmake_file} i386/t-linux"
 		;;
 	i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
 		;;
diff --git a/gcc/config/alpha/t-vms b/gcc/config/alpha/t-vms
--- a/gcc/config/alpha/t-vms
+++ b/gcc/config/alpha/t-vms
@@ -1,5 +1,5 @@ 
 # Copyright (C) 1996, 1997, 1998, 2001, 2002,
-# 2007, 2009 Free Software Foundation, Inc.
+# 2007, 2009, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -35,31 +35,3 @@  MULTILIB_DIRNAMES = ev6
 MULTILIB_OSDIRNAMES = ev6
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
-
-shlib_version:=$(shell echo $(BASEVER_c) | sed -e 's/\./,/' -e 's/\.//g')
-SHLIB_EXT = .exe
-SHLIB_OBJS = @shlib_objs@
-SHLIB_NAME = @shlib_base_name@.exe
-SHLIB_MULTILIB =
-SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(libsubdir)/$(SHLIB_NAME)
-SHLIB_SYMVEC = \
-  grep -F -e "\$$BSS\$$" -e "\$$DATA\$$" -e " sdata " -e " data.rel " -e " data.rel.ro " -e " sbss " \
-        -e "\$$LINK\$$" -e "\$$READONLY\$$" | \
-  sed -e "s/.*\$$LINK\$$   \(.*\)/SYMBOL_VECTOR=(\1=PROCEDURE)/" \
-      -e "s/.*\$$DATA\$$   \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
-      -e "s/.* sbss     \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
-      -e "s/.* sdata    \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
-      -e "s/.* data.rel \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
-      -e "s/.* data.rel.ro \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
-      -e "s/.*\$$BSS\$$    \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
-      -e "s/.*\$$READONLY\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/"
-SHLIB_SYMVECX2 := $(subst $$,$$$$,$(SHLIB_SYMVEC))
-SHLIB_LINK = \
-  echo "case_sensitive=yes" > SYMVEC_$$$$$$$$.opt; \
-  objdump --syms $(SHLIB_OBJS) | \
-  $(SHLIB_SYMVECX2) >> SYMVEC_$$$$$$$$.opt ; \
-  echo "case_sensitive=NO" >> SYMVEC_$$$$$$$$.opt; \
-  $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -nodefaultlibs \
-  -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
-  --for-linker=SYMVEC_$$$$$$$$.opt \
-  --for-linker=gsmatch=equal,$(shlib_version)
diff --git a/gcc/config/arm/t-bpabi b/gcc/config/arm/t-bpabi
--- a/gcc/config/arm/t-bpabi
+++ b/gcc/config/arm/t-bpabi
@@ -24,8 +24,4 @@  LIB2FUNCS_EXTRA = $(srcdir)/config/arm/b
 		  $(srcdir)/config/arm/unaligned-funcs.c
 
 LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
-
-# Add the BPABI names.
-SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver
-
 EXTRA_HEADERS += $(srcdir)/ginclude/unwind-arm-common.h
diff --git a/gcc/config/arm/t-netbsd b/gcc/config/arm/t-netbsd
--- a/gcc/config/arm/t-netbsd
+++ b/gcc/config/arm/t-netbsd
@@ -1,5 +1,5 @@ 
 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006 Free Software Foundation, Inc.
+# 2006, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -22,26 +22,3 @@ 
 TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fpic
 LIBGCC2_DEBUG_CFLAGS = -g0
 LIB2FUNCS_EXTRA = $(srcdir)/config/floatunsidf.c $(srcdir)/config/floatunsisf.c
-
-# Build a shared libgcc library.
-SHLIB_EXT = .so
-SHLIB_NAME = @shlib_base_name@.so
-SHLIB_SONAME = @shlib_base_name@.so.1
-SHLIB_OBJS = @shlib_objs@
-
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-	-Wl,-soname,$(SHLIB_SONAME) \
-	-o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \
-	rm -f $(SHLIB_SONAME) && \
-	if [ -f $(SHLIB_NAME) ]; then \
-	  mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \
-	else true; fi && \
-	mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \
-	$(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME)
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
-SHLIB_INSTALL = \
-	$$(mkinstalldirs) $$(DESTDIR)$$(slibdir); \
-	$(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(slibdir)/$(SHLIB_SONAME); \
-	rm -f $$(DESTDIR)$$(slibdir)/$(SHLIB_NAME); \
-	$(LN_S) $(SHLIB_SONAME) $$(DESTDIR)$$(slibdir)/$(SHLIB_NAME)
diff --git a/gcc/config/arm/t-symbian b/gcc/config/arm/t-symbian
--- a/gcc/config/arm/t-symbian
+++ b/gcc/config/arm/t-symbian
@@ -41,9 +41,5 @@  LIB2FUNCS_STATIC_EXTRA = $(srcdir)/confi
 MULTILIB_OPTIONS     = mfloat-abi=softfp
 MULTILIB_DIRNAMES    = softfp
 
-# There is no C library to link against on Symbian OS -- at least when 
-# building GCC.
-SHLIB_LC = 
-
 # Symbian OS provides its own startup code.
 EXTRA_MULTILIB_PARTS=
diff --git a/gcc/config/bfin/t-bfin-linux b/gcc/config/bfin/t-bfin-linux
--- a/gcc/config/bfin/t-bfin-linux
+++ b/gcc/config/bfin/t-bfin-linux
@@ -49,8 +49,6 @@  MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?b
 MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf561-none
 MULTILIB_MATCHES+=mcpu?bf532-none=mcpu?bf592-none
 
-SHLIB_MAPFILES=$(srcdir)/config/bfin/libgcc-bfin.ver
-
 EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o
 
 # This rule uses MULTILIB_MATCHES to generate a definition of
diff --git a/gcc/config/c6x/t-c6x-elf b/gcc/config/c6x/t-c6x-elf
--- a/gcc/config/c6x/t-c6x-elf
+++ b/gcc/config/c6x/t-c6x-elf
@@ -63,5 +63,3 @@  EXTRA_MULTILIB_PARTS = crtbegin.o crtend
 CRTSTUFF_T_CFLAGS = -msdata=none
 CRTSTUFF_T_CFLAGS_S = -msdata=none
 TARGET_LIBGCC2_CFLAGS = -msdata=none
-
-SHLIB_MAPFILES += $(srcdir)/config/c6x/libgcc-c6xeabi.ver
diff --git a/gcc/config/cris/t-linux b/gcc/config/cris/t-linux
--- a/gcc/config/cris/t-linux
+++ b/gcc/config/cris/t-linux
@@ -1,6 +1,5 @@ 
 TARGET_LIBGCC2_CFLAGS += -fPIC
 CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS)
-SHLIB_MAPFILES += $(srcdir)/config/cris/libgcc.ver
 
 # We *know* we have a limits.h in the glibc library, with extra
 # definitions needed for e.g. libgfortran.
diff --git a/gcc/config/frv/t-linux b/gcc/config/frv/t-linux
--- a/gcc/config/frv/t-linux
+++ b/gcc/config/frv/t-linux
@@ -1,4 +1,4 @@ 
-# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2007, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -28,6 +28,3 @@  EXTRA_MULTILIB_PARTS =
 
 CRTSTUFF_T_CFLAGS = -fPIC
 TARGET_LIBGCC2_CFLAGS = -fPIC
-
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver \
-		 $(srcdir)/config/frv/libgcc-frv.ver
diff --git a/gcc/config/i386/t-cygming b/gcc/config/i386/t-cygming
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/i386/t-cygming
@@ -1,4 +1,5 @@ 
-# Copyright (C) 2003, 2005, 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011
+# Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -54,63 +55,3 @@  msformat-c.o: $(srcdir)/config/i386/msfo
 	$(srcdir)/config/i386/msformat-c.c
 
 STMP_FIXINC=stmp-fixinc
-
-# Build a shared libgcc library for PECOFF with a DEF file
-# with the GNU linker.
-#
-# mkmap-flat.awk is used with the pe_dll option to produce a DEF instead
-# of an ELF map file.
-#
-# Warning: If SHLIB_SOVERSION or SHLIB_SONAME are updated, LIBGCC_SONAME
-# in mingw32.h and SHLIB_MKMAP_OPTS below must be updated also.
-
-SHLIB_EXT = .dll
-SHLIB_IMPLIB = @shlib_base_name@.a
-SHLIB_SOVERSION = 1
-SHLIB_SONAME = @shlib_base_name@_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
-SHLIB_MAP = @shlib_map_file@
-SHLIB_OBJS = @shlib_objs@
-SHLIB_DIR = @multilib_dir@/shlib
-SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
-# SHLIB_DLLDIR is defined by including one of either t-dlldir or t-dlldir-x
-# (native/cross build respectively) in the tmake_file list in gcc/config.gcc.
-ifndef SHLIB_DLLDIR
-$(error SHLIB_DLLDIR must be defined)
-endif
-ifndef SHLIB_PTHREAD_CFLAG
-SHLIB_PTHREAD_CFLAG =
-endif
-ifndef SHLIB_PTHREAD_LDFLAG
-SHLIB_PTHREAD_LDFLAG =
-endif
-
-SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
-	if [ ! -d $(SHLIB_DIR) ]; then \
-		mkdir $(SHLIB_DIR); \
-	else true; fi && \
-	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(SHLIB_PTHREAD_CFLAG) \
-	-shared -nodefaultlibs \
-	$(SHLIB_MAP).def \
-	-Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \
-	-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
-	$(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) && \
-	if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
-	  mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
-		$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
-	else true; fi && \
-	mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
-	mv $(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp $(SHLIB_DIR)/$(SHLIB_IMPLIB)
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
-SHLIB_INSTALL = \
-	$$(mkinstalldirs) $$(DESTDIR)$$(SHLIB_DLLDIR) \
-	  $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
-	$(INSTALL) $(SHLIB_DIR)/$(SHLIB_SONAME) \
-	  $$(DESTDIR)$$(SHLIB_DLLDIR)/$(SHLIB_SONAME); \
-	$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \
-	  $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB)
-SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
-# We'd like to use SHLIB_SONAME here too, but shlib_base_name
-# does not get substituted before mkmap-flat.awk is run.
-SHLIB_MKMAP_OPTS = -v pe_dll=libgcc_s_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
diff --git a/gcc/config/i386/t-cygwin b/gcc/config/i386/t-cygwin
--- a/gcc/config/i386/t-cygwin
+++ b/gcc/config/i386/t-cygwin
@@ -1,4 +1,4 @@ 
-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010, 2011
 # Free Software Foundation, Inc.
 #
 # This file is part of GCC.
@@ -22,18 +22,3 @@ 
 # first.
 LIBGCC2_INCLUDES += -I$(srcdir)/../winsup/include \
 	-I$(srcdir)/../winsup/cygwin/include
-
-# Cygwin-specific parts of LIB_SPEC
-SHLIB_LC = -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32
-
-# We have already included one of the t-{dw2,sjlj}-eh fragments for EH_MODEL
-SHLIB_EH_EXTENSION = $(subst -dw2,,-$(EH_MODEL))
-
-# Cygwin uses different conventions than MinGW; override generic SHLIB_ def'ns here.
-SHLIB_IMPLIB = @shlib_base_name@$(SHLIB_EXT).a
-SHLIB_SONAME = cyggcc_s$(SHLIB_EH_EXTENSION)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
-# This must match the definitions of SHLIB_SONAME/SHLIB_SOVERSION and LIBGCC_SONAME.
-# We'd like to use SHLIB_SONAME here too, and we can, since
-# we don't rely on shlib_base_name substitution for it.
-SHLIB_MKMAP_OPTS = -v pe_dll=$(SHLIB_SONAME)
-
diff --git a/gcc/config/i386/t-mingw-w32 b/gcc/config/i386/t-mingw-w32
--- a/gcc/config/i386/t-mingw-w32
+++ b/gcc/config/i386/t-mingw-w32
@@ -2,8 +2,5 @@  MULTILIB_OPTIONS = m64/m32
 MULTILIB_DIRNAMES = 64 32
 MULTILIB_OSDIRNAMES = ../lib64 ../lib
 
-# MinGW-specific parts of LIB_SPEC
-SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
-
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i386/t-mingw-w64 b/gcc/config/i386/t-mingw-w64
--- a/gcc/config/i386/t-mingw-w64
+++ b/gcc/config/i386/t-mingw-w64
@@ -2,8 +2,5 @@  MULTILIB_OPTIONS = m64/m32
 MULTILIB_DIRNAMES = 64 32
 MULTILIB_OSDIRNAMES = ../lib ../lib32
 
-# MinGW-specific parts of LIB_SPEC
-SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
-
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i386/t-mingw32 b/gcc/config/i386/t-mingw32
deleted file mode 100644
--- a/gcc/config/i386/t-mingw32
+++ /dev/null
@@ -1,2 +0,0 @@ 
-# MinGW-specific parts of LIB_SPEC
-SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
diff --git a/gcc/config/ia64/t-glibc b/gcc/config/ia64/t-glibc
deleted file mode 100644
--- a/gcc/config/ia64/t-glibc
+++ /dev/null
@@ -1,1 +0,0 @@ 
-SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-glibc.ver
diff --git a/gcc/config/ia64/t-hpux b/gcc/config/ia64/t-hpux
--- a/gcc/config/ia64/t-hpux
+++ b/gcc/config/ia64/t-hpux
@@ -49,25 +49,3 @@  LIBGCC1_TEST =
 # the HP-UX libunwind library.
 
 T_CFLAGS += -DUSE_LIBUNWIND_EXCEPTIONS
-
-SHLIB_EXT = .so
-# Must include -lunwind in the link, so that libgcc_s.so has the necessary
-# DT_NEEDED entry for libunwind.
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-	-Wl,+h,@shlib_base_name@.so.0 \
-	-o @multilib_dir@/@shlib_base_name@.so @multilib_flags@ \
-	@shlib_objs@ -lunwind -lc && \
-	rm -f @multilib_dir@/@shlib_base_name@.so.0 && \
-	$(LN_S) @shlib_base_name@.so @multilib_dir@/@shlib_base_name@.so.0
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
-SHLIB_INSTALL = \
-        $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \
-	$(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.so \
-	$$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so.0; \
-	rm -f $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so; \
-	$(LN_S) @shlib_base_name@.so.0 \
-	$$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so; \
-	chmod +x $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so
-
-SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
diff --git a/gcc/config/ia64/t-ia64 b/gcc/config/ia64/t-ia64
--- a/gcc/config/ia64/t-ia64
+++ b/gcc/config/ia64/t-ia64
@@ -38,8 +38,6 @@  LIB1ASMFUNCS  = __divxf3 __divdf3 __divs
 # to support the Intel assembler.
 #LIBGCC2_DEBUG_CFLAGS = -g1 -P
 
-SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64.ver
-
 # Effectively disable the crtbegin/end rules using crtstuff.c
 T = disable
 
diff --git a/gcc/config/ia64/t-vms b/gcc/config/ia64/t-vms
--- a/gcc/config/ia64/t-vms
+++ b/gcc/config/ia64/t-vms
@@ -31,17 +31,3 @@  CRTSTUFF_T_CFLAGS_S = -O0
 $(T)crtinitS.o: $(srcdir)/config/ia64/vms-crtinit.asm $(GCC_PASSES)
 	$(GCC_FOR_TARGET) -I. -c -o $(T)crtinitS.o -x assembler-with-cpp \
 		$(srcdir)/config/ia64/vms-crtinit.asm
-
-# Shared library macros
-shlib_version:=$(shell echo $(BASEVER_c) | sed -e 's/\./,/' -e 's/\.//g')
-SHLIB_EXT = .exe
-SHLIB_OBJS = @shlib_objs@
-SHLIB_NAME = @shlib_base_name@.exe
-SHLIB_MULTILIB =
-SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(libsubdir)/$(SHLIB_ NAME)
-SHLIB_LINK = \
-  $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -nodefaultlibs \
-  -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
-  --for-linker=$(srcdir)/config/ia64/VMS_SYMVEC_@shlib_base_name@.opt \
-  --for-linker=gsmatch=equal,$(shlib_version)
-
diff --git a/gcc/config/ia64/vms_symvec_libgcc_s.opt b/gcc/config/ia64/vms_symvec_libgcc_s.opt
deleted file mode 100644
--- a/gcc/config/ia64/vms_symvec_libgcc_s.opt
+++ /dev/null
@@ -1,89 +0,0 @@ 
-! Symbol vector listing all the universal symbols to be exported when
-! building libgcc_s.exe shareable image on IVMS for Gcc 3.4.5.
-! It would be better to auto-generate this file.
-
-case_sensitive=yes
-SYMBOL_VECTOR=(__divdf3=PROCEDURE)
-SYMBOL_VECTOR=(__divdi3=PROCEDURE)
-SYMBOL_VECTOR=(__divsf3=PROCEDURE)
-SYMBOL_VECTOR=(__divsi3=PROCEDURE)
-SYMBOL_VECTOR=(__divxf3=PROCEDURE)
-SYMBOL_VECTOR=(__moddi3=PROCEDURE)
-SYMBOL_VECTOR=(__modsi3=PROCEDURE)
-SYMBOL_VECTOR=(__ia64_nonlocal_goto=PROCEDURE)
-SYMBOL_VECTOR=(__ia64_restore_stack_nonlocal=PROCEDURE)
-SYMBOL_VECTOR=(__ia64_save_stack_nonlocal=PROCEDURE)
-SYMBOL_VECTOR=(__ia64_trampoline=PROCEDURE)
-SYMBOL_VECTOR=(__udivdi3=PROCEDURE)
-SYMBOL_VECTOR=(__udivsi3=PROCEDURE)
-SYMBOL_VECTOR=(__umoddi3=PROCEDURE)
-SYMBOL_VECTOR=(__umodsi3=PROCEDURE)
-SYMBOL_VECTOR=(__absvti2=PROCEDURE)
-SYMBOL_VECTOR=(__absvdi2=PROCEDURE)
-SYMBOL_VECTOR=(__absvsi2=PROCEDURE)
-SYMBOL_VECTOR=(__addvti3=PROCEDURE)
-SYMBOL_VECTOR=(__addvdi3=PROCEDURE)
-SYMBOL_VECTOR=(__addvsi3=PROCEDURE)
-SYMBOL_VECTOR=(__ashlti3=PROCEDURE)
-SYMBOL_VECTOR=(__ashrti3=PROCEDURE)
-SYMBOL_VECTOR=(__clear_cache=PROCEDURE)
-SYMBOL_VECTOR=(__clzti2=PROCEDURE)
-SYMBOL_VECTOR=(__clzdi2=PROCEDURE)
-SYMBOL_VECTOR=(__cmpti2=PROCEDURE)
-SYMBOL_VECTOR=(__ctzti2=PROCEDURE)
-SYMBOL_VECTOR=(__ctzdi2=PROCEDURE)
-SYMBOL_VECTOR=(__divti3=PROCEDURE)
-SYMBOL_VECTOR=(__enable_execute_stack=PROCEDURE)
-SYMBOL_VECTOR=(__ffsti2=PROCEDURE)
-SYMBOL_VECTOR=(__ffsdi2=PROCEDURE)
-SYMBOL_VECTOR=(__fixdfti=PROCEDURE)
-SYMBOL_VECTOR=(__fixsfti=PROCEDURE)
-SYMBOL_VECTOR=(__fixunsdfti=PROCEDURE)
-SYMBOL_VECTOR=(__fixunsdfdi=PROCEDURE)
-SYMBOL_VECTOR=(__fixunssfti=PROCEDURE)
-SYMBOL_VECTOR=(__fixunssfdi=PROCEDURE)
-SYMBOL_VECTOR=(__floattidf=PROCEDURE)
-SYMBOL_VECTOR=(__floattisf=PROCEDURE)
-SYMBOL_VECTOR=(__lshrti3=PROCEDURE)
-SYMBOL_VECTOR=(__modti3=PROCEDURE)
-SYMBOL_VECTOR=(__multi3=PROCEDURE)
-SYMBOL_VECTOR=(__mulvti3=PROCEDURE)
-SYMBOL_VECTOR=(__mulvdi3=PROCEDURE)
-SYMBOL_VECTOR=(__mulvsi3=PROCEDURE)
-SYMBOL_VECTOR=(__negti2=PROCEDURE)
-SYMBOL_VECTOR=(__negvti2=PROCEDURE)
-SYMBOL_VECTOR=(__negvdi2=PROCEDURE)
-SYMBOL_VECTOR=(__negvsi2=PROCEDURE)
-SYMBOL_VECTOR=(__parityti2=PROCEDURE)
-SYMBOL_VECTOR=(__paritydi2=PROCEDURE)
-SYMBOL_VECTOR=(__popcountti2=PROCEDURE)
-SYMBOL_VECTOR=(__popcountdi2=PROCEDURE)
-SYMBOL_VECTOR=(__subvti3=PROCEDURE)
-SYMBOL_VECTOR=(__subvdi3=PROCEDURE)
-SYMBOL_VECTOR=(__subvsi3=PROCEDURE)
-SYMBOL_VECTOR=(__ucmpti2=PROCEDURE)
-SYMBOL_VECTOR=(__udiv_w_sdiv=PROCEDURE)
-SYMBOL_VECTOR=(__udivti3=PROCEDURE)
-SYMBOL_VECTOR=(__udivmodti4=PROCEDURE)
-SYMBOL_VECTOR=(__umodti3=PROCEDURE)
-SYMBOL_VECTOR=(__gthread_active_p=PROCEDURE)
-SYMBOL_VECTOR=(__gthread_mutex_lock=PROCEDURE)
-SYMBOL_VECTOR=(__gthread_mutex_unlock=PROCEDURE)
-SYMBOL_VECTOR=(__gcc_personality_v0=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetGR=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_SetGR=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetIP=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetIPInfo=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_SetIP=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetLanguageSpecificData=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetRegionStart=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_FindEnclosingFunction=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetCFA=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_GetBSP=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_RaiseException=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_ForcedUnwind=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_Resume=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_Resume_or_Rethrow=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_DeleteException=PROCEDURE)
-SYMBOL_VECTOR=(_Unwind_Backtrace=PROCEDURE)
-case_sensitive=NO
diff --git a/gcc/config/m32r/t-linux b/gcc/config/m32r/t-linux
--- a/gcc/config/m32r/t-linux
+++ b/gcc/config/m32r/t-linux
@@ -41,5 +41,3 @@  INSTALL_ASSERT_H =
 LIBGCC1 = 
 CROSS_LIBGCC1 =
 LIBGCC1_TEST =
-
-SHLIB_MAPFILES += $(srcdir)/config/m32r/libgcc-glibc.ver
diff --git a/gcc/config/mips/t-libgcc-mips16 b/gcc/config/mips/t-libgcc-mips16
--- a/gcc/config/mips/t-libgcc-mips16
+++ b/gcc/config/mips/t-libgcc-mips16
@@ -37,6 +37,3 @@  LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m1
 	_m16stubsc9 _m16stubsc10 \
 	_m16stubdc0 _m16stubdc1 _m16stubdc2 _m16stubdc5 _m16stubdc6 \
 	_m16stubdc9 _m16stubdc10
-
-# Version these symbols if building libgcc.so.
-SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
diff --git a/gcc/config/rs6000/t-aix43 b/gcc/config/rs6000/t-aix43
--- a/gcc/config/rs6000/t-aix43
+++ b/gcc/config/rs6000/t-aix43
@@ -47,32 +47,3 @@  MULTILIB_MATCHES	= mcpu?power=mcpu?power
 
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
-
-# Build a shared libgcc library.
-SHLIB_EXT = .a
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-	-Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \
-	@multilib_flags@ @shlib_objs@ -lc \
-	`case @multilib_dir@ in \
-	*pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \
-	*) echo -lc ;; esac` ; \
-	rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \
-	$(AR_CREATE_FOR_TARGET) @multilib_dir@/tmp-@shlib_base_name@.a \
-	@multilib_dir@/shr.o ; \
-	mv @multilib_dir@/tmp-@shlib_base_name@.a \
-	   @multilib_dir@/@shlib_base_name@.a ; \
-	rm -f @multilib_dir@/shr.o
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
-SHLIB_INSTALL = \
-	$$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \
-	$(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \
-		$$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/
-SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac`
-SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
-SHLIB_NM_FLAGS = -Bpg -X32_64
-
-# Either 32-bit and 64-bit objects in archives.
-AR_FLAGS_FOR_TARGET = -X32_64
-
diff --git a/gcc/config/rs6000/t-aix52 b/gcc/config/rs6000/t-aix52
--- a/gcc/config/rs6000/t-aix52
+++ b/gcc/config/rs6000/t-aix52
@@ -28,31 +28,3 @@  MULTILIB_MATCHES	=
 
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
-
-# Build a shared libgcc library.
-SHLIB_EXT = .a
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-	-Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \
-	@multilib_flags@ @shlib_objs@ -lc \
-	`case @multilib_dir@ in \
-	*pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
-	*) echo -lc ;; esac` ; \
-	rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \
-	$(AR_CREATE_FOR_TARGET) @multilib_dir@/tmp-@shlib_base_name@.a \
-	@multilib_dir@/shr.o ; \
-	mv @multilib_dir@/tmp-@shlib_base_name@.a \
-	   @multilib_dir@/@shlib_base_name@.a ; \
-	rm -f @multilib_dir@/shr.o
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
-SHLIB_INSTALL = \
-	$$(mkinstalldirs) $$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@; \
-	$(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \
-		$$(DESTDIR)$$(slibdir)@shlib_slibdir_qual@/
-SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac`
-SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
-SHLIB_NM_FLAGS = -Bpg -X32_64
-
-# Either 32-bit and 64-bit objects in archives.
-AR_FLAGS_FOR_TARGET = -X32_64
diff --git a/gcc/config/t-libunwind b/gcc/config/t-libunwind
--- a/gcc/config/t-libunwind
+++ b/gcc/config/t-libunwind
@@ -17,11 +17,6 @@ 
 # <http://www.gnu.org/licenses/>.
 
 # Use the system libunwind library.
-#
-# Override the default value from t-slibgcc-elf-ver and mention -lunwind
-# so that the resulting libgcc_s.so has the necessary DT_NEEDED entry for
-# libunwind.
-SHLIB_LC = -lunwind -lc
 
 T_CFLAGS += -DUSE_LIBUNWIND_EXCEPTIONS
 TARGET_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
diff --git a/gcc/config/t-linux b/gcc/config/t-linux
--- a/gcc/config/t-linux
+++ b/gcc/config/t-linux
@@ -21,7 +21,3 @@ 
 CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
 # Compile libgcc2.a with pic.
 TARGET_LIBGCC2_CFLAGS = -fPIC
-
-# Override t-slibgcc-elf-ver to export some libgcc symbols with
-# the symbol versions that glibc used.
-SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
diff --git a/gcc/config/t-slibgcc-dummy b/gcc/config/t-slibgcc
rename from gcc/config/t-slibgcc-dummy
rename to gcc/config/t-slibgcc
--- a/gcc/config/t-slibgcc-dummy
+++ b/gcc/config/t-slibgcc
@@ -1,3 +1,2 @@ 
-# SHLIB_LINK must be non-empty so ENABLE_SHARED_LIBGCC is defined correctly
-# in DRIVER_DEFINES if libgcc configuration has been moved to toplevel.
-SHLIB_LINK = dummy
+# Cause ENABLE_SHARED_LIBGCC to be defined in gcc/Makefile.in (DRIVER_DEFINES).
+SHLIB = true
diff --git a/gcc/config/t-slibgcc-elf-ver b/gcc/config/t-slibgcc-elf-ver
deleted file mode 100644
--- a/gcc/config/t-slibgcc-elf-ver
+++ /dev/null
@@ -1,56 +0,0 @@ 
-# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC 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, or (at your option)
-# any later version.
-#
-# GCC 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 GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# Build a shared libgcc library for ELF with symbol versioning
-# with the GNU linker.
-
-SHLIB_EXT = .so
-SHLIB_SOLINK = @shlib_base_name@.so
-SHLIB_SOVERSION = 1
-SHLIB_SONAME = @shlib_base_name@.so.$(SHLIB_SOVERSION)
-SHLIB_MAP = @shlib_map_file@
-SHLIB_OBJS = @shlib_objs@
-SHLIB_DIR = @multilib_dir@
-SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
-SHLIB_LC = -lc
-SHLIB_MAKE_SOLINK = $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
-SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
-	$$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
-
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-	-Wl,--soname=$(SHLIB_SONAME) \
-	-Wl,--version-script=$(SHLIB_MAP) \
-	-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
-	$(SHLIB_OBJS) $(SHLIB_LC) && \
-	rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
-	if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
-	  mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
-		$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
-	else true; fi && \
-	mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
-	$(SHLIB_MAKE_SOLINK)
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
-SHLIB_INSTALL = \
-	$$(mkinstalldirs) $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
-	$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SONAME) \
-	  $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
-	rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
-	$(SHLIB_INSTALL_SOLINK)
-SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
diff --git a/gcc/config/xtensa/t-linux b/gcc/config/xtensa/t-linux
--- a/gcc/config/xtensa/t-linux
+++ b/gcc/config/xtensa/t-linux
@@ -1,3 +1,1 @@ 
 EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
-
-SHLIB_MAPFILES += $(srcdir)/config/xtensa/libgcc-xtensa.ver
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4921,18 +4921,6 @@  AC_ARG_ENABLE(version-specific-runtime-l
                 [specify that runtime libraries should be
                  installed in a compiler-specific directory])])
 
-AC_ARG_WITH(slibdir,
-[AS_HELP_STRING([--with-slibdir=DIR], [shared libraries in DIR @<:@LIBDIR@:>@])],
-slibdir="$with_slibdir",
-if test "${enable_version_specific_runtime_libs+set}" = set; then
-  slibdir='$(libsubdir)'
-elif test "$host" != "$target"; then
-  slibdir='$(build_tooldir)/lib'
-else
-  slibdir='$(libdir)'
-fi)
-AC_SUBST(slibdir)
-
 # Substitute configuration variables
 AC_SUBST(subdirs)
 AC_SUBST(srcdir)
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -55,7 +55,7 @@  c++: cc1plus$(exeext)
 
 g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
     $(CONFIG_H) $(OPTS_H)
-	(SHLIB_LINK='$(SHLIB_LINK)'; \
+	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(INCLUDES) $(srcdir)/cp/g++spec.c)
 
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -79,7 +79,7 @@  fortran: f951$(exeext)
 
 gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \
 	$(CONFIG_H) coretypes.h intl.h $(OPTS_H)
-	(SHLIB_LINK='$(SHLIB_LINK)'; \
+	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
 
diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in
--- a/gcc/go/Make-lang.in
+++ b/gcc/go/Make-lang.in
@@ -32,7 +32,7 @@  go: go1$(exeext)
 
 gospec.o: $(srcdir)/go/gospec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
     $(CONFIG_H) opts.h
-	(SHLIB_LINK='$(SHLIB_LINK)'; \
+	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(INCLUDES) $(srcdir)/go/gospec.c)
 
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -58,7 +58,7 @@  JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-
 
 jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
   $(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h $(OPTS_H)
-	(SHLIB_LINK='$(SHLIB_LINK)'; \
+	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))
 
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -279,6 +279,9 @@  LIB2ADDEH = $(srcdir)/unwind-dw2.c $(src
 LIB2ADDEHSTATIC = $(LIB2ADDEH)
 LIB2ADDEHSHARED = $(LIB2ADDEH)
 
+# nm flags to list global symbols in libgcc object files.
+SHLIB_NM_FLAGS = -pg
+
 # Don't build libunwind by default.
 LIBUNWIND =
 SHLIBUNWIND_LINK =
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -179,13 +179,25 @@  case ${host} in
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
   # configuration.
-  tmake_file="$tmake_file t-eh-dw2-dip"
+  tmake_file="$tmake_file t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
+  case ${target_thread_file} in
+    posix)
+      # Before 5.0, FreeBSD can't bind shared libraries to -lc
+      # when "optionally" threaded via weak pthread_* checks.
+      case ${host} in
+        *-*-freebsd[34] | *-*-freebsd[34].*)
+          tmake_file="${tmake_file} t-slibgcc-nolc-override"
+          ;;
+      esac
+      ;;
+  esac
   ;;
 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
-  tmake_file="$tmake_file t-eh-dw2-dip"
+  tmake_file="$tmake_file t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
   ;;
 *-*-netbsd*)
+  tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
   ;;
 *-*-openbsd*)
   ;;
@@ -239,7 +251,7 @@  esac
 
 case ${host} in
 alpha*-*-linux*)
-	tmake_file="${tmake_file} t-crtfm"
+	tmake_file="${tmake_file} t-crtfm alpha/t-linux"
 	extra_parts="$extra_parts crtfastmath.o"
 	md_unwind_header=alpha/linux-unwind.h
 	;;
@@ -262,26 +274,27 @@  alpha*-dec-osf5.1*)
 	md_unwind_header=alpha/osf5-unwind.h
 	;;
 alpha64-dec-*vms*)
-	tmake_file="vms/t-vms vms/t-vms64 alpha/t-vms"
+	tmake_file="vms/t-vms vms/t-vms64 alpha/t-vms t-slibgcc-vms"
 	md_unwind_header=alpha/vms-unwind.h
 	;;
 alpha*-dec-*vms*)
-	tmake_file="vms/t-vms alpha/t-vms"
+	tmake_file="vms/t-vms alpha/t-vms t-slibgcc-vms"
 	md_unwind_header=alpha/vms-unwind.h
 	;;
 arm-wrs-vxworks)
 	tmake_file=t-fdpbit
 	;;
 arm*-*-freebsd*)
-	tmake_file=t-fdpbit
+	tmake_file="$tmake_file t-fdpbit"
 	;;
 arm*-*-netbsdelf*)
+	tmake_file="$tmake_file t-slibgcc-gld-nover"
 	;;
 arm*-*-linux*)			# ARM GNU/Linux with ELF
 	tmake_file="${tmake_file} t-fixedpoint-gnu-prefix"
 	case ${host} in
 	arm*-*-linux-*eabi)
-	  tmake_file="${tmake_file} arm/t-bpabi"
+	  tmake_file="${tmake_file} arm/t-bpabi t-slibgcc-libgcc"
 	  unwind_header=config/arm/unwind-arm.h
 	  ;;
 	esac
@@ -307,7 +320,7 @@  arm*-*-eabi* | arm*-*-symbianelf* )
 	  tmake_file="${tmake_file} arm/t-bpabi"
 	  ;;
 	arm*-*-symbianelf*)
-	  tmake_file="${tmake_file} arm/t-symbian"
+	  tmake_file="${tmake_file} arm/t-symbian t-slibgcc-nolc-override"
 	  ;;
 	esac
 	tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
@@ -336,7 +349,7 @@  bfin*-uclinux*)
 	md_unwind_header=bfin/linux-unwind.h
         ;;
 bfin*-linux-uclibc*)
-	tmake_file=t-fdpbit
+	tmake_file="$tmake_file t-fdpbit bfin/t-linux"
 	# No need to build crtbeginT.o on uClibc systems.  Should probably
 	# be moved to the OS specific section above.
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
@@ -353,7 +366,7 @@  crisv32-*-elf | crisv32-*-none | cris-*-
 	extra_parts="crtbegin.o crtend.o"
 	;;
 cris-*-linux* | crisv32-*-linux*)
-	tmake_file=t-fdpbit
+	tmake_file="$tmake_file t-fdpbit cris/t-linux"
 	;;
 fido-*-elf)
 	;;
@@ -364,7 +377,7 @@  frv-*-elf)
 	tmake_file=t-fdpbit
 	;;
 frv-*-*linux*)
-	tmake_file=t-fdpbit
+	tmake_file="$tmake_file t-fdpbit frv/t-linux"
 	;;
 h8300-*-rtems*)
 	tmake_file=t-fpbit
@@ -375,15 +388,46 @@  h8300-*-elf*)
 hppa*64*-*-linux*)
 	;;
 hppa*-*-linux*)
+	tmake_file="$tmake_file t-slibgcc-libgcc"
+	# Set the libgcc version number
+	if test x$enable_sjlj_exceptions = xyes; then
+	    tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
+	else
+	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
+	fi
 	md_unwind_header=pa/linux-unwind.h
 	;;
 hppa[12]*-*-hpux10*)
+	tmake_file="$tmake_file t-slibgcc"
+	# Set the libgcc version number
+	if test x$enable_sjlj_exceptions = xyes; then
+	    tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
+	else
+	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
+	fi
+	tmake_file="$tmake_file pa/t-slibgcc-hpux t-slibgcc-hpux"
 	md_unwind_header=pa/hpux-unwind.h
 	;;
 hppa*64*-*-hpux11*)
+	tmake_file="$tmake_file t-slibgcc"
+	# Set the libgcc version number
+	if test x$enable_sjlj_exceptions = xyes; then
+	    tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
+	else
+	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
+	fi
+	tmake_file="$tmake_file pa/t-slibgcc-hpux t-slibgcc-hpux"
 	md_unwind_header=pa/hpux-unwind.h
 	;;
 hppa[12]*-*-hpux11*)
+	tmake_file="$tmake_file t-slibgcc"
+	# Set the libgcc version number
+	if test x$enable_sjlj_exceptions = xyes; then
+	    tmake_file="$tmake_file pa/t-slibgcc-sjlj-ver"
+	else
+	    tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver"
+	fi
+	tmake_file="$tmake_file pa/t-slibgcc-hpux t-slibgcc-hpux"
 	md_unwind_header=pa/hpux-unwind.h
 	;;
 i[34567]86-*-darwin*)
@@ -391,7 +435,7 @@  i[34567]86-*-darwin*)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	;;
 x86_64-*-darwin*)
-	tmake_file="t-darwin ${cpu_type}/t-darwin64 i386/t-crtpc i386/t-crtfm t-slibgcc-darwin"
+	tmake_file="$tmake_file i386/t-crtpc i386/t-crtfm"
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	;;
 i[34567]86-*-elf*)
@@ -449,15 +493,56 @@  i[4567]86-wrs-vxworks|i[4567]86-wrs-vxwo
 	;;
 i[34567]86-*-cygwin*)
 	extra_parts="crtbegin.o crtend.o crtfastmath.o"
-	tmake_file="i386/t-cygming i386/t-crtfm t-dfprules"
+	# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
+	if test x$enable_sjlj_exceptions = xyes; then
+		tmake_eh_file="i386/t-sjlj-eh"
+	else
+		tmake_eh_file="i386/t-dw2-eh"
+	fi
+	# Shared libgcc DLL install dir depends on cross/native build.
+	if test x${build} = x${host} ; then
+		tmake_dlldir_file="i386/t-dlldir"
+	else
+		tmake_dlldir_file="i386/t-dlldir-x"
+	fi
+	tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-slibgcc-cygming i386/t-cygming i386/t-cygwin i386/t-crtfm t-dfprules"
+	case ${target_thread_file} in
+	  posix)
+	    tmake_file="i386/t-mingw-pthread $tmake_file"
+	    ;;
+	esac
 	;;
 i[34567]86-*-mingw*)
 	extra_parts="crtbegin.o crtend.o crtfastmath.o"
-	tmake_file="i386/t-cygming i386/t-crtfm t-dfprules"
+	# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
+	if test x$enable_sjlj_exceptions = xyes; then
+		tmake_eh_file="i386/t-sjlj-eh"
+	else
+		tmake_eh_file="i386/t-dw2-eh"
+	fi
+	# Shared libgcc DLL install dir depends on cross/native build.
+	if test x${build} = x${host} ; then
+		tmake_dlldir_file="i386/t-dlldir"
+	else
+		tmake_dlldir_file="i386/t-dlldir-x"
+	fi
+	tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-slibgcc-cygming i386/t-cygming i386/t-mingw32 i386/t-crtfm t-dfprules"
 	md_unwind_header=i386/w32-unwind.h
 	;;
 x86_64-*-mingw*)
-	tmake_file="t-dfprules i386/t-crtfm"
+	# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
+	if test x$enable_sjlj_exceptions = xyes; then
+		tmake_eh_file="i386/t-sjlj-eh"
+	else
+		tmake_eh_file="i386/t-dw2-eh"
+	fi
+	# Shared libgcc DLL install dir depends on cross/native build.
+	if test x${build} = x${host} ; then
+		tmake_dlldir_file="i386/t-dlldir"
+	else
+		tmake_dlldir_file="i386/t-dlldir-x"
+	fi
+	tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-slibgcc-cygming i386/t-mingw32 t-dfprules i386/t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
 	;;
 i[34567]86-*-interix3*)
@@ -468,21 +553,21 @@  ia64*-*-elf*)
 	;;
 ia64*-*-freebsd*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 ia64/t-eh-ia64 t-crtfm"
+	tmake_file="$tmake_file ia64/t-ia64 ia64/t-eh-ia64 t-crtfm"
 	;;
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-eh-ia64 t-libunwind ia64/t-glibc"
+	tmake_file="$tmake_file ia64/t-ia64 t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-eh-ia64 t-libunwind ia64/t-linux"
 	if test x$with_system_libunwind != xyes ; then
-		tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
+		tmake_file="${tmake_file} t-libunwind-elf ia64/t-linux-libunwind"
 	fi
 	md_unwind_header=ia64/linux-unwind.h
 	;;
 ia64*-*-hpux*)
-	tmake_file="ia64/t-hpux"
+	tmake_file="ia64/t-hpux t-slibgcc ia64/t-slibgcc-hpux t-slibgcc-hpux"
 	;;
 ia64-hp-*vms*)
-	tmake_file="vms/t-vms vms/t-vms64 ia64/t-eh-ia64 ia64/t-vms"
+	tmake_file="vms/t-vms vms/t-vms64 ia64/t-eh-ia64 ia64/t-vms t-slibgcc-vms"
 	md_unwind_header=ia64/vms-unwind.h
 	;;
 iq2000*-*-elf*)
@@ -503,10 +588,10 @@  m32rle-*-elf*)
 	tmake_file=t-fdpbit
 	;;
 m32r-*-linux*)
-	tmake_file=t-fdpbit
+	tmake_file="$tmake_file t-fdpbit m32r/t-linux"
  	;;
 m32rle-*-linux*)
-	tmake_file=t-fdpbit
+	tmake_file="$tmake_file t-fdpbit m32r/t-linux"
 	;;
 m68k-*-elf*)
 	;;
@@ -520,6 +605,11 @@  m68k-*-uclinux*)		# Motorola m68k/ColdFi
 m68k-*-linux*)			# Motorola m68k's running GNU/Linux
 				# with ELF format using glibc 2
 				# aka the GNU/Linux C library 6.
+	# If not configured with --enable-sjlj-exceptions, bump the
+	# libgcc version number.
+	if test x$enable_sjlj_exceptions != xyes; then
+	    tmake_file="$tmake_file m68k/t-slibgcc-elf-ver"
+	fi
 	md_unwind_header=m68k/linux-unwind.h
 	;;
 m68k-*-rtems*)
@@ -527,6 +617,9 @@  m68k-*-rtems*)
 mcore-*-elf)
 	tmake_file=t-fdpbit
 	;;
+microblaze*-linux*)
+        tmake_file="$tmake_file t-slibgcc-nolc-override microblaze/t-microblaze t-fdpbit"
+	;;
 microblaze*-*-*)
         tmake_file="microblaze/t-microblaze t-fdpbit"
 	;;
@@ -627,7 +720,7 @@  powerpc64-*-darwin*)
 	extra_parts="$extra_parts crt2.o"
 	;;
 powerpc-*-freebsd*)
-	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-freebsd t-softfp-sfdf t-softfp-excl t-softfp"
+	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-freebsd t-softfp-sfdf t-softfp-excl t-softfp t-slibgcc-libgcc"
 	;;
 powerpc-*-netbsd*)
 	;;
@@ -656,7 +749,7 @@  powerpc-*-rtems*)
 	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpc-*-linux* | powerpc64-*-linux*)
-	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ldbl128 t-softfp-sfdf t-softfp-excl t-dfprules rs6000/t-ppc64-fp t-softfp"
+	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-linux t-softfp-sfdf t-softfp-excl t-dfprules rs6000/t-ppc64-fp t-softfp t-slibgcc-libgcc"
 	md_unwind_header=rs6000/linux-unwind.h
 	;;
 powerpc-wrs-vxworks|powerpc-wrs-vxworksae)
@@ -676,15 +769,15 @@  powerpcle-*-eabi*)
 	;;
 rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
 	md_unwind_header=rs6000/aix-unwind.h
-	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble"
+	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble rs6000/t-slibgcc-aix"
 	;;
 rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*)
 	md_unwind_header=rs6000/aix-unwind.h
-	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble"
+	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble rs6000/t-slibgcc-aix"
 	;;
 rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
 	md_unwind_header=rs6000/aix-unwind.h
-	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble"
+	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble rs6000/t-slibgcc-aix"
 	;;
 rx-*-elf)
 	extra_parts="crtbegin.o crtend.o"
@@ -711,7 +804,7 @@  sh-*-elf* | sh[12346l]*-*-elf* | \
    sh64-*-netbsd* | sh64l*-*-netbsd*)
 	case ${host} in
 	sh*-*-linux*)
-		tmake_file="${tmake_file} sh/t-linux t-fdpbit"
+		tmake_file="${tmake_file} t-slibgcc-libgcc sh/t-linux t-fdpbit"
 		md_unwind_header=sh/linux-unwind.h
 		;;
 	sh*-*-netbsd*)
@@ -749,7 +842,10 @@  sparc-*-elf*)
 sparc-*-linux*)		# SPARC's running GNU/Linux, libc6
 	case ${host} in
 	*-leon*)
-		tmake_file=t-fdpbit
+		tmake_file="${tmake_file} t-fdpbit"
+		;;
+	*)
+		tmake_file="${tmake_file} sparc/t-linux"
 		;;
 	esac
 	extra_parts="$extra_parts crtfastmath.o"
@@ -781,7 +877,7 @@  sparc64-*-freebsd*|ultrasparc-*-freebsd*
 	;;
 sparc64-*-linux*)		# 64-bit SPARC's running GNU/Linux
 	extra_parts="$extra_parts crtfastmath.o"
-	tmake_file="${tmake_file} t-crtfm"
+	tmake_file="${tmake_file} t-crtfm sparc/t-linux"
 	md_unwind_header=sparc/linux-unwind.h
 	;;
 sparc64-*-netbsd*)
@@ -789,8 +885,12 @@  sparc64-*-netbsd*)
 spu-*-elf*)
 	tmake_file="t-fdpbit spu/t-elf"
 	;;
+tic6x-*-uclinux)
+	tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp c6x/t-elf t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-gnu-prefix"
+	unwind_header=config/c6x/unwind-c6x.h
+	;;
 tic6x-*-*)
-	tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp t-gnu-prefix c6x/t-c6x-elf"
+	tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp c6x/t-elf t-gnu-prefix"
 	unwind_header=config/c6x/unwind-c6x.h
 	;;
 v850*-*-*)
@@ -809,12 +909,12 @@  xtensa*-*-elf*)
 	tmake_file=xtensa/t-xtensa
 	;;
 xtensa*-*-linux*)
-	tmake_file=xtensa/t-xtensa
+	tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux"
 	md_unwind_header=xtensa/linux-unwind.h
 	;;
 am33_2.0-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
-	tmake_file=t-fdpbit
+	tmake_file="$tmake_file t-fdpbit"
 	;;
 m32c-*-elf*|m32c-*-rtems*)
  	;;
@@ -829,9 +929,10 @@  esac
 
 case ${host} in
 i[34567]86-*-linux* | x86_64-*-linux* | \
-  i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | \
+  i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
+  i[34567]86-*-knetbsd*-gnu | \
   i[34567]86-*-gnu*)
-	tmake_file="${tmake_file} t-tls"
+	tmake_file="${tmake_file} t-tls i386/t-linux"
 	if test "$libgcc_cv_cfi" = "yes"; then
 		tmake_file="${tmake_file} t-stack i386/t-stack-i386"
 	fi
diff --git a/gcc/config/alpha/libgcc-alpha-ldbl.ver b/libgcc/config/alpha/libgcc-alpha-ldbl.ver
rename from gcc/config/alpha/libgcc-alpha-ldbl.ver
rename to libgcc/config/alpha/libgcc-alpha-ldbl.ver
diff --git a/gcc/config/alpha/t-linux b/libgcc/config/alpha/t-linux
rename from gcc/config/alpha/t-linux
rename to libgcc/config/alpha/t-linux
diff --git a/libgcc/config/alpha/t-slibgcc-osf b/libgcc/config/alpha/t-slibgcc-osf
--- a/libgcc/config/alpha/t-slibgcc-osf
+++ b/libgcc/config/alpha/t-slibgcc-osf
@@ -22,7 +22,7 @@ 
 SHLIB_LDFLAGS = -Wl,-msym -Wl,-set_version,gcc.1 -Wl,-soname,$(SHLIB_SONAME) \
 	-Wl,-hidden -Wl,-input,$(SHLIB_MAP)
 
-SHLIB_MKMAP = $(gcc_srcdir)/mkmap-flat.awk
+SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
 SHLIB_MKMAP_OPTS = -v osf_export=1
 # Needed so mkmap-flat.awk can parse the nm output.
 SHLIB_NM_FLAGS = -Bg
diff --git a/gcc/config/arm/libgcc-bpabi.ver b/libgcc/config/arm/libgcc-bpabi.ver
rename from gcc/config/arm/libgcc-bpabi.ver
rename to libgcc/config/arm/libgcc-bpabi.ver
diff --git a/libgcc/config/arm/t-bpabi b/libgcc/config/arm/t-bpabi
--- a/libgcc/config/arm/t-bpabi
+++ b/libgcc/config/arm/t-bpabi
@@ -1,3 +1,6 @@ 
 LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \
   $(srcdir)/config/arm/libunwind.S \
   $(srcdir)/config/arm/pr-support.c $(srcdir)/unwind-c.c
+
+# Add the BPABI names.
+SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver
diff --git a/gcc/config/bfin/libgcc-bfin.ver b/libgcc/config/bfin/libgcc-glibc.ver
rename from gcc/config/bfin/libgcc-bfin.ver
rename to libgcc/config/bfin/libgcc-glibc.ver
diff --git a/libgcc/config/bfin/t-linux b/libgcc/config/bfin/t-linux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/bfin/t-linux
@@ -0,0 +1,1 @@ 
+SHLIB_MAPFILES = $(srcdir)/config/bfin/libgcc-glibc.ver
diff --git a/gcc/config/c6x/libgcc-c6xeabi.ver b/libgcc/config/c6x/libgcc-eabi.ver
rename from gcc/config/c6x/libgcc-c6xeabi.ver
rename to libgcc/config/c6x/libgcc-eabi.ver
diff --git a/libgcc/config/c6x/t-elf b/libgcc/config/c6x/t-elf
new file mode 100644
--- /dev/null
+++ b/libgcc/config/c6x/t-elf
@@ -0,0 +1,1 @@ 
+SHLIB_MAPFILES += $(srcdir)/config/c6x/libgcc-eabi.ver
diff --git a/gcc/config/cris/libgcc.ver b/libgcc/config/cris/libgcc-glibc.ver
rename from gcc/config/cris/libgcc.ver
rename to libgcc/config/cris/libgcc-glibc.ver
diff --git a/libgcc/config/cris/t-linux b/libgcc/config/cris/t-linux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/cris/t-linux
@@ -0,0 +1,2 @@ 
+# Override t-linux default.
+SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/cris/libgcc-glibc.ver
diff --git a/gcc/config/frv/libgcc-frv.ver b/libgcc/config/frv/libgcc-glibc.ver
rename from gcc/config/frv/libgcc-frv.ver
rename to libgcc/config/frv/libgcc-glibc.ver
diff --git a/libgcc/config/frv/t-linux b/libgcc/config/frv/t-linux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/frv/t-linux
@@ -0,0 +1,1 @@ 
+SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/frv/libgcc-glibc.ver
diff --git a/gcc/config/i386/darwin-libgcc.10.4.ver b/libgcc/config/i386/libgcc-darwin.10.4.ver
rename from gcc/config/i386/darwin-libgcc.10.4.ver
rename to libgcc/config/i386/libgcc-darwin.10.4.ver
diff --git a/gcc/config/i386/darwin-libgcc.10.5.ver b/libgcc/config/i386/libgcc-darwin.10.5.ver
rename from gcc/config/i386/darwin-libgcc.10.5.ver
rename to libgcc/config/i386/libgcc-darwin.10.5.ver
diff --git a/gcc/config/i386/libgcc-glibc.ver b/libgcc/config/i386/libgcc-glibc.ver
rename from gcc/config/i386/libgcc-glibc.ver
rename to libgcc/config/i386/libgcc-glibc.ver
diff --git a/libgcc/config/i386/t-cygwin b/libgcc/config/i386/t-cygwin
new file mode 100644
--- /dev/null
+++ b/libgcc/config/i386/t-cygwin
@@ -0,0 +1,13 @@ 
+# Cygwin-specific parts of LIB_SPEC
+SHLIB_LC = -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32
+
+# We have already included one of the t-{dw2,sjlj}-eh fragments for EH_MODEL
+SHLIB_EH_EXTENSION = $(subst -dw2,,-$(EH_MODEL))
+
+# Cygwin uses different conventions than MinGW; override generic SHLIB_ def'ns here.
+SHLIB_IMPLIB = @shlib_base_name@$(SHLIB_EXT).a
+SHLIB_SONAME = cyggcc_s$(SHLIB_EH_EXTENSION)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
+# This must match the definitions of SHLIB_SONAME/SHLIB_SOVERSION and LIBGCC_SONAME.
+# We'd like to use SHLIB_SONAME here too, and we can, since
+# we don't rely on shlib_base_name substitution for it.
+SHLIB_MKMAP_OPTS = -v pe_dll=$(SHLIB_SONAME)
diff --git a/libgcc/config/i386/t-darwin b/libgcc/config/i386/t-darwin
deleted file mode 100644
--- a/libgcc/config/i386/t-darwin
+++ /dev/null
@@ -1,1 +0,0 @@ 
-SHLIB_VERPFX = $(gcc_srcdir)/config/i386/darwin-libgcc
diff --git a/libgcc/config/i386/t-darwin64 b/libgcc/config/i386/t-darwin64
deleted file mode 100644
--- a/libgcc/config/i386/t-darwin64
+++ /dev/null
@@ -1,1 +0,0 @@ 
-SHLIB_VERPFX = $(gcc_srcdir)/config/i386/darwin-libgcc
diff --git a/gcc/config/i386/t-dlldir b/libgcc/config/i386/t-dlldir
rename from gcc/config/i386/t-dlldir
rename to libgcc/config/i386/t-dlldir
--- a/gcc/config/i386/t-dlldir
+++ b/libgcc/config/i386/t-dlldir
@@ -1,6 +1,2 @@ 
-
 # In a native build, target DLLs go in bindir, where they can be executed.
-# Note double quoting to prevent variables from being evaluated until install
-# time; we don't want to expand them during libgcc.mvars generation.
-
-SHLIB_DLLDIR = $$(bindir)
+SHLIB_DLLDIR = $(bindir)
diff --git a/gcc/config/i386/t-dlldir-x b/libgcc/config/i386/t-dlldir-x
rename from gcc/config/i386/t-dlldir-x
rename to libgcc/config/i386/t-dlldir-x
--- a/gcc/config/i386/t-dlldir-x
+++ b/libgcc/config/i386/t-dlldir-x
@@ -1,9 +1,3 @@ 
-
 # In a cross build, bindir contains host not target binaries, so target DLLs
 # instead go in toolexeclibdir, alongside other target binaries and static libs.
-# Note double quoting to prevent variables from being evaluated until install
-# time; we don't want to expand them during libgcc.mvars generation, and in
-# any case, $toolexeclibdir is not defined in the gcc/ subdirectory, only in
-# target lib directories.
-
-SHLIB_DLLDIR = $$(toolexeclibdir)
+SHLIB_DLLDIR = $(toolexeclibdir)
diff --git a/gcc/config/i386/t-dw2-eh b/libgcc/config/i386/t-dw2-eh
rename from gcc/config/i386/t-dw2-eh
rename to libgcc/config/i386/t-dw2-eh
diff --git a/gcc/config/i386/t-linux b/libgcc/config/i386/t-linux
rename from gcc/config/i386/t-linux
rename to libgcc/config/i386/t-linux
--- a/gcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -1,5 +1,4 @@ 
 # On 64bit we do not need any exports for glibc for 64-bit libgcc_s.
 # Need to support TImode for x86.  Override the settings from
 # t-slibgcc-elf-ver and t-linux
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver \
-		 $(srcdir)/config/i386/libgcc-glibc.ver
+SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
diff --git a/gcc/config/i386/t-mingw-pthread b/libgcc/config/i386/t-mingw-pthread
rename from gcc/config/i386/t-mingw-pthread
rename to libgcc/config/i386/t-mingw-pthread
diff --git a/libgcc/config/i386/t-mingw32 b/libgcc/config/i386/t-mingw32
new file mode 100644
--- /dev/null
+++ b/libgcc/config/i386/t-mingw32
@@ -0,0 +1,2 @@ 
+# MinGW-specific parts of LIB_SPEC
+SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
diff --git a/gcc/config/i386/t-sjlj-eh b/libgcc/config/i386/t-sjlj-eh
rename from gcc/config/i386/t-sjlj-eh
rename to libgcc/config/i386/t-sjlj-eh
diff --git a/libgcc/config/i386/t-slibgcc-cygming b/libgcc/config/i386/t-slibgcc-cygming
new file mode 100644
--- /dev/null
+++ b/libgcc/config/i386/t-slibgcc-cygming
@@ -0,0 +1,58 @@ 
+# Build a shared libgcc library for PECOFF with a DEF file
+# with the GNU linker.
+#
+# mkmap-flat.awk is used with the pe_dll option to produce a DEF instead
+# of an ELF map file.
+#
+# Warning: If SHLIB_SOVERSION or SHLIB_SONAME are updated, LIBGCC_SONAME
+# in mingw32.h and SHLIB_MKMAP_OPTS below must be updated also.
+
+SHLIB_EXT = .dll
+SHLIB_IMPLIB = @shlib_base_name@.a
+SHLIB_SOVERSION = 1
+SHLIB_SONAME = @shlib_base_name@_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
+SHLIB_MAP = @shlib_map_file@
+SHLIB_OBJS = @shlib_objs@
+SHLIB_DIR = @multilib_dir@/shlib
+SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
+# SHLIB_DLLDIR is defined by including one of either t-dlldir or t-dlldir-x
+# (native/cross build respectively) in the tmake_file list in
+# libgcc/config.host.
+ifndef SHLIB_DLLDIR
+$(error SHLIB_DLLDIR must be defined)
+endif
+ifndef SHLIB_PTHREAD_CFLAG
+SHLIB_PTHREAD_CFLAG =
+endif
+ifndef SHLIB_PTHREAD_LDFLAG
+SHLIB_PTHREAD_LDFLAG =
+endif
+
+SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
+	if [ ! -d $(SHLIB_DIR) ]; then \
+		mkdir $(SHLIB_DIR); \
+	else true; fi && \
+	$(CC) $(LIBGCC2_CFLAGS) $(SHLIB_PTHREAD_CFLAG) \
+	-shared -nodefaultlibs \
+	$(SHLIB_MAP).def \
+	-Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \
+	-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
+	$(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) && \
+	if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
+	  mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
+		$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
+	else true; fi && \
+	mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
+	mv $(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp $(SHLIB_DIR)/$(SHLIB_IMPLIB)
+SHLIB_INSTALL = \
+	$(mkinstalldirs) $(DESTDIR)$(SHLIB_DLLDIR) \
+	  $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
+	$(INSTALL) $(SHLIB_DIR)/$(SHLIB_SONAME) \
+	  $(DESTDIR)$(SHLIB_DLLDIR)/$(SHLIB_SONAME); \
+	$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \
+	  $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB)
+SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
+# We'd like to use SHLIB_SONAME here too, but shlib_base_name
+# does not get substituted before mkmap-flat.awk is run.
+SHLIB_MKMAP_OPTS = -v pe_dll=libgcc_s_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
+SHLIB_MAPFILES = libgcc-std.ver
diff --git a/gcc/config/ia64/libgcc-glibc.ver b/libgcc/config/ia64/libgcc-glibc.ver
rename from gcc/config/ia64/libgcc-glibc.ver
rename to libgcc/config/ia64/libgcc-glibc.ver
diff --git a/gcc/config/ia64/libgcc-ia64.ver b/libgcc/config/ia64/libgcc-ia64.ver
rename from gcc/config/ia64/libgcc-ia64.ver
rename to libgcc/config/ia64/libgcc-ia64.ver
diff --git a/libgcc/config/ia64/t-ia64 b/libgcc/config/ia64/t-ia64
--- a/libgcc/config/ia64/t-ia64
+++ b/libgcc/config/ia64/t-ia64
@@ -13,3 +13,5 @@  crtbeginS.o: $(gcc_srcdir)/config/ia64/c
 crtendS.o: $(gcc_srcdir)/config/ia64/crtend.asm
 	$(CC) $(compile_deps) -I. -I$(gcc_objdir) -c -x assembler-with-cpp \
 		-o $@ -DSHARED $(gcc_srcdir)/config/ia64/crtend.asm
+
+SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64.ver
diff --git a/libgcc/config/ia64/t-glibc b/libgcc/config/ia64/t-linux
rename from libgcc/config/ia64/t-glibc
rename to libgcc/config/ia64/t-linux
--- a/libgcc/config/ia64/t-glibc
+++ b/libgcc/config/ia64/t-linux
@@ -1,3 +1,5 @@ 
 # Use system libunwind library on IA-64 GLIBC based system.
 LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
   $(srcdir)/unwind-compat.c
+
+SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-glibc.ver
diff --git a/libgcc/config/ia64/t-glibc-libunwind b/libgcc/config/ia64/t-linux-libunwind
rename from libgcc/config/ia64/t-glibc-libunwind
rename to libgcc/config/ia64/t-linux-libunwind
diff --git a/libgcc/config/ia64/t-slibgcc-hpux b/libgcc/config/ia64/t-slibgcc-hpux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/ia64/t-slibgcc-hpux
@@ -0,0 +1,6 @@ 
+# Build a shared libgcc library with the HP-UX linker on IA64.
+
+SHLIB_SOVERSION = 0
+# Must include -lunwind in the link, so that libgcc_s.so has the necessary
+# DT_NEEDED entry for libunwind.
+SHLIB_LC += -lunwind
diff --git a/gcc/config/libgcc-glibc.ver b/libgcc/config/libgcc-glibc.ver
rename from gcc/config/libgcc-glibc.ver
rename to libgcc/config/libgcc-glibc.ver
diff --git a/gcc/libgcc-libsystem.ver b/libgcc/config/libgcc-libsystem.ver
rename from gcc/libgcc-libsystem.ver
rename to libgcc/config/libgcc-libsystem.ver
diff --git a/gcc/config/m32r/libgcc-glibc.ver b/libgcc/config/m32r/libgcc-glibc.ver
rename from gcc/config/m32r/libgcc-glibc.ver
rename to libgcc/config/m32r/libgcc-glibc.ver
diff --git a/libgcc/config/m32r/t-linux b/libgcc/config/m32r/t-linux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/m32r/t-linux
@@ -0,0 +1,1 @@ 
+SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/m32r/libgcc-glibc.ver
diff --git a/gcc/config/m68k/t-slibgcc-elf-ver b/libgcc/config/m68k/t-slibgcc-elf-ver
rename from gcc/config/m68k/t-slibgcc-elf-ver
rename to libgcc/config/m68k/t-slibgcc-elf-ver
diff --git a/gcc/config/mips/libgcc-mips16.ver b/libgcc/config/mips/libgcc-mips16.ver
rename from gcc/config/mips/libgcc-mips16.ver
rename to libgcc/config/mips/libgcc-mips16.ver
diff --git a/libgcc/config/mips/t-mips16 b/libgcc/config/mips/t-mips16
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -1,2 +1,5 @@ 
 SYNC = yes
 SYNC_CFLAGS = -mno-mips16
+
+# Version these symbols if building libgcc.so.
+SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
diff --git a/libgcc/config/mips/t-slibgcc-irix b/libgcc/config/mips/t-slibgcc-irix
--- a/libgcc/config/mips/t-slibgcc-irix
+++ b/libgcc/config/mips/t-slibgcc-irix
@@ -3,5 +3,5 @@ 
 SHLIB_LDFLAGS = -Wl,-soname,$(SHLIB_SONAME) \
 	-Wl,-exports_file,$(SHLIB_MAP)
 
-SHLIB_MKMAP = $(gcc_srcdir)/mkmap-flat.awk
+SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
 SHLIB_MAPFILES = libgcc-std.ver
diff --git a/gcc/config/pa/t-slibgcc-dwarf-ver b/libgcc/config/pa/t-slibgcc-dwarf-ver
rename from gcc/config/pa/t-slibgcc-dwarf-ver
rename to libgcc/config/pa/t-slibgcc-dwarf-ver
diff --git a/gcc/config/pa/t-hpux-shlib b/libgcc/config/pa/t-slibgcc-hpux
rename from gcc/config/pa/t-hpux-shlib
rename to libgcc/config/pa/t-slibgcc-hpux
--- a/gcc/config/pa/t-hpux-shlib
+++ b/libgcc/config/pa/t-slibgcc-hpux
@@ -1,4 +1,5 @@ 
-# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004, 2005, 2006, 2011
+# Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -16,31 +17,9 @@ 
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-# Build a shared libgcc library.
+# Build a shared libgcc library with the HP-UX linker on PA.
+
 SHLIB_EXT = .sl
-SHLIB_NAME = @shlib_base_name@$(SHLIB_EXT)
-SHLIB_SOVERSION = 1
+SHLIB_SOLINK = @shlib_base_name@$(SHLIB_EXT)
 SHLIB_SONAME = @shlib_base_name@.$(SHLIB_SOVERSION)
-SHLIB_OBJS = @shlib_objs@
-SHLIB_DIR = @multilib_dir@
-SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
-
-SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared  -nodefaultlibs \
-	-Wl,+h -Wl,$(SHLIB_SONAME) \
-	-o $(SHLIB_DIR)/$(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) && \
-        rm -f $(SHLIB_DIR)/$(SHLIB_SONAME) && \
-	if [ -f $(SHLIB_DIR)/$(SHLIB_NAME) ]; then \
-	  mv -f $(SHLIB_DIR)/$(SHLIB_NAME) $(SHLIB_DIR)/$(SHLIB_NAME).backup; \
-	else true; fi && \
-	mv $(SHLIB_DIR)/$(SHLIB_NAME).tmp $(SHLIB_DIR)/$(SHLIB_NAME) && \
-        $(LN_S) $(SHLIB_NAME) $(SHLIB_DIR)/$(SHLIB_SONAME)
-
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
-SHLIB_INSTALL = \
-        $$(mkinstalldirs) $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
-	$(INSTALL_DATA) -m 555 $(SHLIB_DIR)/$(SHLIB_NAME) \
-	$$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
-        rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_NAME); \
-        $(LN_S) $(SHLIB_SONAME) \
-	$$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_NAME)
+SHLIB_LC =
diff --git a/gcc/config/pa/t-slibgcc-sjlj-ver b/libgcc/config/pa/t-slibgcc-sjlj-ver
rename from gcc/config/pa/t-slibgcc-sjlj-ver
rename to libgcc/config/pa/t-slibgcc-sjlj-ver
diff --git a/gcc/config/rs6000/darwin-libgcc.10.4.ver b/libgcc/config/rs6000/libgcc-darwin.10.4.ver
rename from gcc/config/rs6000/darwin-libgcc.10.4.ver
rename to libgcc/config/rs6000/libgcc-darwin.10.4.ver
diff --git a/gcc/config/rs6000/darwin-libgcc.10.5.ver b/libgcc/config/rs6000/libgcc-darwin.10.5.ver
rename from gcc/config/rs6000/darwin-libgcc.10.5.ver
rename to libgcc/config/rs6000/libgcc-darwin.10.5.ver
diff --git a/libgcc/config/rs6000/libgcc-ppc-glibc.ver b/libgcc/config/rs6000/libgcc-glibc.ver
rename from libgcc/config/rs6000/libgcc-ppc-glibc.ver
rename to libgcc/config/rs6000/libgcc-glibc.ver
diff --git a/libgcc/config/rs6000/libgcc-ppc64.ver b/libgcc/config/rs6000/libgcc-ibm-ldouble.ver
rename from libgcc/config/rs6000/libgcc-ppc64.ver
rename to libgcc/config/rs6000/libgcc-ibm-ldouble.ver
diff --git a/libgcc/config/rs6000/t-darwin b/libgcc/config/rs6000/t-darwin
--- a/libgcc/config/rs6000/t-darwin
+++ b/libgcc/config/rs6000/t-darwin
@@ -6,5 +6,3 @@  crt2.o: $(srcdir)/config/rs6000/darwin-c
 LIB2ADD += $(srcdir)/config/rs6000/ppc64-fp.c
 
 LIB2ADDEH += $(srcdir)/config/rs6000/darwin-fallback.c
-
-SHLIB_VERPFX = $(gcc_srcdir)/config/rs6000/darwin-libgcc
diff --git a/libgcc/config/rs6000/t-ibm-ldouble b/libgcc/config/rs6000/t-ibm-ldouble
--- a/libgcc/config/rs6000/t-ibm-ldouble
+++ b/libgcc/config/rs6000/t-ibm-ldouble
@@ -3,4 +3,4 @@  LIB2ADD += $(srcdir)/config/rs6000/ibm-l
 
 HOST_LIBGCC2_CFLAGS += -mlong-double-128
 
-SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc64.ver
+SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ibm-ldouble.ver
diff --git a/libgcc/config/rs6000/t-ldbl128 b/libgcc/config/rs6000/t-linux
rename from libgcc/config/rs6000/t-ldbl128
rename to libgcc/config/rs6000/t-linux
--- a/libgcc/config/rs6000/t-ldbl128
+++ b/libgcc/config/rs6000/t-linux
@@ -1,3 +1,3 @@ 
-SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc-glibc.ver
+SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
 
 HOST_LIBGCC2_CFLAGS += -mlong-double-128
diff --git a/libgcc/config/rs6000/t-slibgcc-aix b/libgcc/config/rs6000/t-slibgcc-aix
new file mode 100644
--- /dev/null
+++ b/libgcc/config/rs6000/t-slibgcc-aix
@@ -0,0 +1,44 @@ 
+# Copyright (C) 2002, 2003, 2004, 2005, 2006,
+# 2008, 2011 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC 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, or (at your option)
+# any later version.
+#
+# GCC 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 GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Build a shared libgcc library.
+SHLIB_EXT = .a
+SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
+	-Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \
+	@multilib_flags@ @shlib_objs@ -lc \
+	`case @multilib_dir@ in \
+	*pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
+	*) echo -lc ;; esac` ; \
+	rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \
+	$(AR_CREATE_FOR_TARGET) @multilib_dir@/tmp-@shlib_base_name@.a \
+	@multilib_dir@/shr.o ; \
+	mv @multilib_dir@/tmp-@shlib_base_name@.a \
+	   @multilib_dir@/@shlib_base_name@.a ; \
+	rm -f @multilib_dir@/shr.o
+SHLIB_INSTALL = \
+	$(mkinstalldirs) $(DESTDIR)$(slibdir)@shlib_slibdir_qual@; \
+	$(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.a \
+		$(DESTDIR)$(slibdir)@shlib_slibdir_qual@/
+SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac`
+SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
+SHLIB_MAPFILES = libgcc-std.ver
+SHLIB_NM_FLAGS = -Bpg -X32_64
+
+# Either 32-bit and 64-bit objects in archives.
+AR_FLAGS_FOR_TARGET = -X32_64
diff --git a/gcc/config/sh/libgcc-excl.ver b/libgcc/config/sh/libgcc-excl.ver
rename from gcc/config/sh/libgcc-excl.ver
rename to libgcc/config/sh/libgcc-excl.ver
diff --git a/gcc/config/sh/libgcc-glibc.ver b/libgcc/config/sh/libgcc-glibc.ver
rename from gcc/config/sh/libgcc-glibc.ver
rename to libgcc/config/sh/libgcc-glibc.ver
diff --git a/libgcc/config/sh/t-linux b/libgcc/config/sh/t-linux
--- a/libgcc/config/sh/t-linux
+++ b/libgcc/config/sh/t-linux
@@ -6,32 +6,5 @@  HOST_LIBGCC2_CFLAGS = -fpic -mieee -DNO_
 # the list from scratch.
 SHLIB_MAPFILES = \
 	libgcc-std.ver \
-	$(gcc_srcdir)/config/sh/libgcc-excl.ver \
-	$(gcc_srcdir)/config/sh/libgcc-glibc.ver
-
-# Override SHLIB_LINK and SHLIB_INSTALL to use linker script
-# libgcc_s.so.
-SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-	-Wl,--soname=@shlib_base_name@.so.1 \
-	-Wl,--version-script=@shlib_map_file@ \
-	-o @multilib_dir@/@shlib_base_name@.so.1.tmp @multilib_flags@ \
-	@shlib_objs@ -lc && \
-	rm -f @multilib_dir@/@shlib_base_name@.so && \
-	if [ -f @multilib_dir@/@shlib_base_name@.so.1 ]; then \
-	  mv -f @multilib_dir@/@shlib_base_name@.so.1 \
-		@multilib_dir@/@shlib_base_name@.so.1.backup; \
-	else true; fi && \
-	mv @multilib_dir@/@shlib_base_name@.so.1.tmp \
-	   @multilib_dir@/@shlib_base_name@.so.1 && \
-	(echo "/* GNU ld script"; \
-	 echo "   Use the shared library, but some functions are only in"; \
-	 echo "   the static library.  */"; \
-	 echo "GROUP ( @shlib_base_name@.so.1 libgcc.a )" \
-	) > @multilib_dir@/@shlib_base_name@.so
-SHLIB_INSTALL = \
-	$(mkinstalldirs) $(DESTDIR)$(slibdir)@shlib_slibdir_qual@; \
-	$(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.so.1 \
-	  $(DESTDIR)$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so.1; \
-	rm -f $(DESTDIR)$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so; \
-	$(INSTALL_DATA) @multilib_dir@/@shlib_base_name@.so \
-	  $(DESTDIR)$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so
+	$(srcdir)/config/sh/libgcc-excl.ver \
+	$(srcdir)/config/sh/libgcc-glibc.ver
diff --git a/gcc/config/sparc/libgcc-sparc-glibc.ver b/libgcc/config/sparc/libgcc-glibc.ver
rename from gcc/config/sparc/libgcc-sparc-glibc.ver
rename to libgcc/config/sparc/libgcc-glibc.ver
diff --git a/gcc/config/sparc/t-linux b/libgcc/config/sparc/t-linux
rename from gcc/config/sparc/t-linux
rename to libgcc/config/sparc/t-linux
--- a/gcc/config/sparc/t-linux
+++ b/libgcc/config/sparc/t-linux
@@ -1,5 +1,4 @@ 
 # Override t-slibgcc-elf-ver to export some libgcc symbols with
 # the symbol versions that glibc used.
 # Avoid the t-linux version file.
-SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver \
-		 $(srcdir)/config/sparc/libgcc-sparc-glibc.ver
+SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/sparc/libgcc-glibc.ver
diff --git a/libgcc/config/t-libunwind b/libgcc/config/t-libunwind
--- a/libgcc/config/t-libunwind
+++ b/libgcc/config/t-libunwind
@@ -1,3 +1,10 @@ 
+# Use the system libunwind library.
+
 LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
   $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
 LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
+
+# Override the default value from t-slibgcc-elf-ver and mention -lunwind
+# so that the resulting libgcc_s.so has the necessary DT_NEEDED entry for
+# libunwind.
+SHLIB_LC = -lunwind -lc
diff --git a/libgcc/config/t-linux b/libgcc/config/t-linux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/t-linux
@@ -0,0 +1,3 @@ 
+# Override t-slibgcc-elf-ver to export some libgcc symbols with
+# the symbol versions that glibc used.
+SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
diff --git a/libgcc/config/t-slibgcc b/libgcc/config/t-slibgcc
--- a/libgcc/config/t-slibgcc
+++ b/libgcc/config/t-slibgcc
@@ -43,9 +43,12 @@  SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -sh
 	else true; fi && \
 	mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
 	$(SHLIB_MAKE_SOLINK)
+
+INSTALL_SHLIB = $(INSTALL_DATA)
+
 SHLIB_INSTALL = \
 	$(mkinstalldirs) $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
-	$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SONAME) \
+	$(INSTALL_SHLIB) $(SHLIB_DIR)/$(SHLIB_SONAME) \
 	  $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
 	rm -f $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
 	$(SHLIB_INSTALL_SOLINK)
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -22,9 +22,10 @@  SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -dy
 	$(SHLIB_VERSTRING) \
 	@multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC)
 
-SHLIB_MKMAP = $(gcc_srcdir)/mkmap-flat.awk
+SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
 SHLIB_MKMAP_OPTS = -v leading_underscore=1
-SHLIB_MAPFILES += libgcc-std.ver $(gcc_srcdir)/libgcc-libsystem.ver
+SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/libgcc-libsystem.ver
+SHLIB_VERPFX = $(srcdir)/config/$(cpu_type)/libgcc-darwin
 
 # we're only going to build the stubs if the target slib is /usr/lib
 # there is no other case in which they're useful in a live system.
diff --git a/libgcc/config/t-slibgcc-elf-ver b/libgcc/config/t-slibgcc-elf-ver
--- a/libgcc/config/t-slibgcc-elf-ver
+++ b/libgcc/config/t-slibgcc-elf-ver
@@ -1,4 +1,4 @@ 
 # Build a shared libgcc library for ELF with symbol versioning.
 
-SHLIB_MKMAP = $(gcc_srcdir)/mkmap-symver.awk
+SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk
 SHLIB_MAPFILES = libgcc-std.ver
diff --git a/libgcc/config/t-slibgcc-gld-nover b/libgcc/config/t-slibgcc-gld-nover
new file mode 100644
--- /dev/null
+++ b/libgcc/config/t-slibgcc-gld-nover
@@ -0,0 +1,3 @@ 
+# Build a shared libgcc library for ELF with the GNU linker.
+
+SHLIB_LDFLAGS = -Wl,--soname=$(SHLIB_SONAME)
diff --git a/libgcc/config/t-slibgcc-hpux b/libgcc/config/t-slibgcc-hpux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/t-slibgcc-hpux
@@ -0,0 +1,7 @@ 
+# Build a shared libgcc library with the HP-UX linker.
+
+SHLIB_LDFLAGS = -Wl,+h,$(SHLIB_SONAME)
+
+INSTALL_SHLIB = $(INSTALL_DATA) -m 555
+
+SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
diff --git a/gcc/config/t-slibgcc-libgcc b/libgcc/config/t-slibgcc-libgcc
rename from gcc/config/t-slibgcc-libgcc
rename to libgcc/config/t-slibgcc-libgcc
--- a/gcc/config/t-slibgcc-libgcc
+++ b/libgcc/config/t-slibgcc-libgcc
@@ -1,4 +1,4 @@ 
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -29,4 +29,4 @@  SHLIB_MAKE_SOLINK = \
 	) > $(SHLIB_DIR)/$(SHLIB_SOLINK)
 SHLIB_INSTALL_SOLINK = \
 	$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SOLINK) \
-	  $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
+	  $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
diff --git a/gcc/config/t-slibgcc-nolc-override b/libgcc/config/t-slibgcc-nolc-override
rename from gcc/config/t-slibgcc-nolc-override
rename to libgcc/config/t-slibgcc-nolc-override
diff --git a/libgcc/config/t-slibgcc-vms b/libgcc/config/t-slibgcc-vms
new file mode 100644
--- /dev/null
+++ b/libgcc/config/t-slibgcc-vms
@@ -0,0 +1,28 @@ 
+shlib_version:=$(shell $(CC) --version 2>&1 | \
+	sed -n 's/^.*(GCC).* \([0-9]*\.[0-9.]*\).*$/\1/p' | \
+	sed -e 's/\./,/' -e 's/\.//g')
+SHLIB_EXT = .exe
+SHLIB_OBJS = @shlib_objs@
+SHLIB_NAME = @shlib_base_name@.exe
+SHLIB_MULTILIB =
+SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $(DESTDIR)$(libsubdir)/$(SHLIB_NAME)
+SHLIB_SYMVEC = \
+  grep -F -e "\$$BSS\$$" -e "\$$DATA\$$" -e " sdata " -e " data.rel " -e " data.rel.ro " -e " sbss " \
+        -e "\$$LINK\$$" -e "\$$READONLY\$$" | \
+  sed -e "s/.*\$$LINK\$$   \(.*\)/SYMBOL_VECTOR=(\1=PROCEDURE)/" \
+      -e "s/.*\$$DATA\$$   \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+      -e "s/.* sbss     \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+      -e "s/.* sdata    \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+      -e "s/.* data.rel \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+      -e "s/.* data.rel.ro \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+      -e "s/.*\$$BSS\$$    \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+      -e "s/.*\$$READONLY\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/"
+SHLIB_LINK = \
+  echo "case_sensitive=yes" > SYMVEC_$$$$.opt; \
+  objdump --syms $(SHLIB_OBJS) | \
+  $(SHLIB_SYMVEC) >> SYMVEC_$$$$.opt ; \
+  echo "case_sensitive=NO" >> SYMVEC_$$$$.opt; \
+  $(CC) $(LIBGCC2_CFLAGS) -nodefaultlibs \
+  -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
+  --for-linker=SYMVEC_$$$$.opt \
+  --for-linker=gsmatch=equal,$(shlib_version)
diff --git a/gcc/config/xtensa/libgcc-xtensa.ver b/libgcc/config/xtensa/libgcc-glibc.ver
rename from gcc/config/xtensa/libgcc-xtensa.ver
rename to libgcc/config/xtensa/libgcc-glibc.ver
diff --git a/libgcc/config/xtensa/t-linux b/libgcc/config/xtensa/t-linux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/xtensa/t-linux
@@ -0,0 +1,1 @@ 
+SHLIB_MAPFILES += $(srcdir)/config/xtensa/libgcc-glibc.ver
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -180,6 +180,60 @@  AC_SUBST(fixed_point)
 # config.gcc also contains tests of with_system_libunwind.
 GCC_CHECK_UNWIND_GETIPINFO
 
+# The sjlj test is almost duplicated here and in libgo/configure.ac (for C),
+# libstdc++-v3/acinclude.m4 and libjava/configure.ac (for C++), and
+# libobjc/configure.ac (for Objective-C).
+# FIXME: This should be centralized in config/sjlj.m4.
+AC_ARG_ENABLE(sjlj-exceptions,
+  AC_HELP_STRING([--enable-sjlj-exceptions],
+		 [force use of builtin_setjmp for exceptions]),
+  [case "$enableval" in
+   yes|no|auto) ;;
+   *) AC_MSG_ERROR([unknown argument to --enable-sjlj-exceptions]) ;;
+   esac],
+  [enable_sjlj_exceptions=auto])
+
+AC_CACHE_CHECK([whether to use setjmp/longjmp exceptions],
+[libgcc_cv_lib_sjlj_exceptions],
+[AC_LANG_CONFTEST(
+  [AC_LANG_SOURCE([
+void bar ();
+void clean (int *);
+void foo ()
+{
+  int i __attribute__ ((cleanup (clean)));
+  bar();
+}
+])])
+CFLAGS_hold=$CFLAGS
+CFLAGS="--save-temps -fexceptions"
+libgcc_cv_lib_sjlj_exceptions=unknown
+AS_IF([ac_fn_c_try_compile],
+  [if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1; then
+    libgcc_cv_lib_sjlj_exceptions=yes
+  elif grep _Unwind_Resume conftest.s >/dev/null 2>&1; then
+    libgcc_cv_lib_sjlj_exceptions=no
+  fi])
+CFLAGS=$CFLAGS_hold
+rm -f conftest*
+])
+
+if test "$enable_sjlj_exceptions" = "auto"; then
+  enable_sjlj_exceptions=$libgcc_cv_lib_sjlj_exceptions
+fi
+
+case $enable_sjlj_exceptions in
+yes)
+  AC_DEFINE(LIBGCC_SJLJ_EXCEPTIONS, 1,
+	[Define if the C compiler is configured for setjmp/longjmp exceptions.])
+  ;;
+no)
+  ;;
+*)
+  AC_MSG_ERROR([unable to detect exception model])
+  ;;
+esac
+
 AC_LIB_PROG_LD_GNU
 
 AC_MSG_CHECKING([for thread model used by GCC])
diff --git a/gcc/mkmap-flat.awk b/libgcc/mkmap-flat.awk
rename from gcc/mkmap-flat.awk
rename to libgcc/mkmap-flat.awk
diff --git a/gcc/mkmap-symver.awk b/libgcc/mkmap-symver.awk
rename from gcc/mkmap-symver.awk
rename to libgcc/mkmap-symver.awk