Patchwork CFT: [build] Move soft-fp support to toplevel libgcc

login
register
mail settings
Submitter Rainer Orth
Date July 12, 2011, 5:22 p.m.
Message ID <ydd7h7nv2fo.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/104413/
State New
Headers show

Comments

Rainer Orth - July 12, 2011, 5:22 p.m.
Another libgcc move that allows for some simplification is soft-fp.
This patch does that, noticing that there are primarily two variants of
the soft-fp config snippets: one for sf and df only, and another one for
tf.  I'm using those, accounting for the remaining differences by having
them in the usual target snippets.

One odd thing out is that the lm32 snippet misses

softfp_exclude_libgcc2 := y

compared to the new t-softfp-sfdf.  I'm currently handling this since I
cannot tell if this is intentional or just an accident.

I'm also moving rs6000/darwin-ldouble.c which uses soft-fp.h, renaming
it to ibm-ldouble.c since that's what it is: there's nothing
Darwin-specific in the file and IBM invented the format.  It's even
called ibm_extended in real.c, but I've kept the ldouble part since it
is more expressive.

I'm using libgcc/config/rs6000/t-freebsd to undo rs6000/t-ppccomm, but
one could instead not include ibm-ldouble.c in t-ppccomm and make all
PowerPC targets explicitly use t-ppccomm-ldbl.

Bootstrapped on i386-pc-solaris2.11 and x86_64-unknown-linux without
regressions, bootstraps on i386-apple-darwin9.8.0 and
powerpc-apple-darwin9.8.0 are still running.

Ok for mainline if those pass?

Thanks.
	Rainer


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

	gcc:
	* config/soft-fp: Move to ../libgcc.
	* Makefile.in (SFP_MACHINE): Remove.
	(libgcc-support): Remove $(SFP_MACHINE) dependency.
	* config/arm/sfp-machine.h: Move to ../libgcc/config/arm.
	* config/arm/t-arm-softfp: Move to
	../libgcc/config/arm/t-softfp.
	* config/i386/sfp-machine.h: Move to ../libgcc/config/i386.
	* config/i386/t-fprules-softfp: Move to
	../libgcc/config/t-softfp-tf.
	* config/ia64/sfp-machine.h: Move to ../libgcc/config/ia64.
	* config/ia64/t-fprules-softfp: Remove.
	* config/lm32/sfp-machine.h: Move to ../libgcc/config/lm32.
	* config/lm32/t-fprules-softfp: Remove.
	* config/moxie/sfp-machine.h: Remove.
	* config/moxie/t-moxie-softfp: Remove.
	* config/rs6000/darwin-ldouble-format: Move to
	../libgcc/config/rs6000/ibm-ldouble-format.
	* config/rs6000/darwin-ldouble.c: Move to
	../libgcc/config/rs6000/ibm-ldouble.c
	* config/rs6000/libgcc-ppc-glibc.ver: Move to ../libgcc/config/rs6000.
	* config/rs6000/libgcc-ppc64.ver: Likewise.
	* config/rs6000/sfp-machine.h: Likewise.
	* config/rs6000/t-aix43 (SHLIB_MAPFILES): Remove
	$(srcdir)/config/rs6000/libgcc-ppc64.ver.
	(LIB2FUNCS_EXTRA): Remove.
	(TARGET_LIBGCC2_CFLAGS): Remove.
	* config/rs6000/t-aix52: Likewise
	* config/rs6000/t-darwin (LIB2FUNCS_EXTRA): Remove
	$(srcdir)/config/rs6000/darwin-ldouble.c.
	(SHLIB_MAPFILES): Remove.
	* config/rs6000/t-darwin64 (LIB2FUNCS_EXTRA): Remove
	$(srcdir)/config/rs6000/darwin-ldouble.c.
	* config/rs6000/t-fprules-softfp: Move to
	../libgcc/config/t-softfp-sfdf.
	* config/rs6000/t-freebsd: Move to ../libgcc/config/rs6000.
	* config/rs6000/t-linux64 (softfp_wrap_start, softfp_wrap_end): Remove.
	* config/rs6000/t-ppccomm (LIB2FUNCS_EXTRA): Remove
	$(srcdir)/config/rs6000/darwin-ldouble.c.
	* config/score/sfp-machine.h: Move to ../libgcc/config/score.
	* config/score/t-score-softfp: Remove.
	* config.gcc (arm*-*-linux*): Remove arm/t-arm-softfp,
	soft-fp/t-softfp from tmake_file.
	(arm*-*-uclinux*): Likewise.
	(arm*-*-ecos-elf): Likewise.
	(arm*-*-eabi*): Likewise.
	(arm*-*-rtems*): Likewise.
	(arm*-*-elf): Likewise.
	(lm32-*-elf*): Remove lm32/t-fprules-softfp, soft-fp/t-softfp from
	tmake_file.
	(lm32-*-rtems*): Likewise.
	(lm32-*-uclinux*): Likewise.
	(moxie-*-elf): Remove moxie/t-moxie-softfp, soft-fp/t-softfp from
	tmake_file.
	(moxie-*-uclinux*): Likewise.
	(moxie-*-rtems*): Likewise.
	(powerpc-*-freebsd*): Remove rs6000/t-freebsd,
	rs6000/t-fprules-softfp, soft-fp/t-softfp from tmake_file.
	(powerpc-*-linux*): Remove rs6000/t-fprules-softfp,
	soft-fp/t-softfp from tmake_file.
	(score-*-elf): Remove score/t-score-softfp, soft-fp/t-softfp from
	tmake_file.
	(i[34567]86-*-darwin*): Remove i386/t-fprules-softfp,
	soft-fp/t-softfp from tmake_file.
	(i[34567]86-*-linux*): Likewise.
	(i[34567]86-*-solaris2*): Likewise.
	(i[34567]86-*-cygwin*): Likewise.
	(i[34567]86-*-freebsd*): Likewise.
	(ia64*-*-linux*): Remove ia64/t-fprules-softfp, soft-fp/t-softfp
	from tmake_file.

	libgcc:
	* config/t-softfp: Remove.
	* soft-fp: Moved from ../gcc/config.
	* soft-fp/README: Remove t-softfp reference.
	* soft-fp/t-softfp: Move to config/t-softfp.
	(softfp_machine_header): Remove.
	(softfp_file_list): Remove config subdir.
	(soft-fp-objects): New variable.
	($(soft-fp-objects)): Set INTERNAL_CFLAGS.
	(LIB2FUNCS_EXTRA): Add to LIB2ADD instead.
	(SFP_MACHINE, $(SFP_MACHINE)): Remove.
	* config/t-softfp-sfdf: New file.
	* config/t-softfp-tf: New file.
	* config/no-sfp-machine.h: New file.
	* config/arm/sfp-machine.h: New file.
	* config/arm/t-softfp: New file.
	* config/i386/32/t-fprules-softfp: Rename to ...
	* config/i386/32/t-softfp: ... this.
	(tifunctions): Remove config subdir.
	* config/i386/64/t-softfp-compat (tf-functions): Remove config
	subdir.
	* config/i386/64/eqtf2.c: Likewise.
	* config/i386/64/getf2.c: Likewise.
	* config/i386/64/letf2.c: Likewise.
	* config/ia64/sft-machine.h: New file.
	* config/ia64/t-fprules-softfp: Rename to ...
	* config/ia64/t-softfp: ... this.
	* config/lm32/sfp-machine.h: New file.
	* config/lm32/t-softfp: New file.
	* config/moxie/t-moxie-softfp: Remove.
	* config/rs6000/ibm-ldouble-format: New file.
	* config/rs6000/ibm-ldouble.c: New file.
	* config/rs6000/libgcc-ppc-glibc.ver: New file
	* config/rs6000/libgcc-ppc64.ver: New file
	* config/rs6000/sfp-machine.h: New file.
	* config/rs6000/t-freebsd: New file.
	* config/rs6000/t-ibm-ldouble: New file.
	* config/rs6000/t-ldbl128: Use $(srcdir) to refer to
	libgcc-ppc-glibc.ver.
	* config/rs6000/t-linux64: New file.
	* config/rs6000/t-ppccomm (LIB2ADD): Add
	$(srcdir)/config/rs6000/ibm-ldouble.c.
	* config/rs6000/t-ppccomm-ldbl: New file.
	* config/score/sfp-machine.h: New file.
	* config.host (sfp_machine_header): Explain.
	(arm*-*-linux*): Add t-softfp-sfdf, arm/t-softfp, t-softfp to
	tmake_file.
	(arm*-*-uclinux*): Likewise.
	(arm*-*-ecos-elf): Likewise.
	(arm*-*-eabi*): Likewise.
	(arm*-*-rtems*): Likewise.
	(arm*-*-elf): Likewise.
	(ia64*-*-linux*): Add t-softfp-tf, t-softfp to tmake_file.
	(lm32-*-elf*): Add t-softfp-sfdf, lm32/t-softfp, t-softfp to tmake_file.
	(lm32-*-uclinux*): Likewise.
	(moxie-*-*): Replace moxie/t-moxie-softfp by t-softfp-sfdf, t-softfp.
	(powerpc-*-darwin*): Add rs6000/t-ibm-ldouble to tmake_file.
	(powerpc64-*-darwin*): Likewise.
	(powerpc-*-freebsd*): Add t-softfp-sfdf, t-softfp to tmake_file.
	(powerpc-*-eabisimaltivec*): Add rs6000/t-ppccomm-ldbl to
	tmake_file.
	(powerpc-*-eabisim*): Likewise.
	(powerpc-*-elf*): Likewise.
	(powerpc-*-eabialtivec*): Likewise.
	(powerpc-xilinx-eabi*): Likewise.
	(powerpc-*-rtems*): Likewise.
	(powerpc-*-linux*): Add t-softfp-sfdf, t-softfp to tmake_file.
	(powerpc-wrs-vxworks): Add rs6000/t-ppccomm-ldbl to tmake_file.
	(powerpcle-*-elf*): Likewise.
	(powerpcle-*-eabisim*): Likewise.
	(powerpcle-*-eabi*): Likewise.
	(rs6000-ibm-aix4.[3456789]*): Add rs6000/t-ibm-ldouble to
	tmake_file.
	(rs6000-ibm-aix5.1.*): Likewise.
	(rs6000-ibm-aix[56789].*): Likewise.
	(score-*-elf): Add t-softfp-sfdf, t-softfp to tmake_file.
	(i[34567]86-*-darwin*): Add t-softfp-tf, t-softfp to tmake_file.
	* configure.ac (sfp_machine_header): Provide default if unset.
	Substitute.
	Link sfp-machine.h to config/$sfp_machine_header.
	* configure: Regenerate.

diff --git a/gcc/config/soft-fp/adddf3.c b/libgcc/soft-fp/adddf3.c
rename from gcc/config/soft-fp/adddf3.c
rename to libgcc/soft-fp/adddf3.c
diff --git a/gcc/config/soft-fp/addsf3.c b/libgcc/soft-fp/addsf3.c
rename from gcc/config/soft-fp/addsf3.c
rename to libgcc/soft-fp/addsf3.c
diff --git a/gcc/config/soft-fp/addtf3.c b/libgcc/soft-fp/addtf3.c
rename from gcc/config/soft-fp/addtf3.c
rename to libgcc/soft-fp/addtf3.c
diff --git a/gcc/config/soft-fp/divdf3.c b/libgcc/soft-fp/divdf3.c
rename from gcc/config/soft-fp/divdf3.c
rename to libgcc/soft-fp/divdf3.c
diff --git a/gcc/config/soft-fp/divsf3.c b/libgcc/soft-fp/divsf3.c
rename from gcc/config/soft-fp/divsf3.c
rename to libgcc/soft-fp/divsf3.c
diff --git a/gcc/config/soft-fp/divtf3.c b/libgcc/soft-fp/divtf3.c
rename from gcc/config/soft-fp/divtf3.c
rename to libgcc/soft-fp/divtf3.c
diff --git a/gcc/config/soft-fp/double.h b/libgcc/soft-fp/double.h
rename from gcc/config/soft-fp/double.h
rename to libgcc/soft-fp/double.h
diff --git a/gcc/config/soft-fp/eqdf2.c b/libgcc/soft-fp/eqdf2.c
rename from gcc/config/soft-fp/eqdf2.c
rename to libgcc/soft-fp/eqdf2.c
diff --git a/gcc/config/soft-fp/eqsf2.c b/libgcc/soft-fp/eqsf2.c
rename from gcc/config/soft-fp/eqsf2.c
rename to libgcc/soft-fp/eqsf2.c
diff --git a/gcc/config/soft-fp/eqtf2.c b/libgcc/soft-fp/eqtf2.c
rename from gcc/config/soft-fp/eqtf2.c
rename to libgcc/soft-fp/eqtf2.c
diff --git a/gcc/config/soft-fp/extenddftf2.c b/libgcc/soft-fp/extenddftf2.c
rename from gcc/config/soft-fp/extenddftf2.c
rename to libgcc/soft-fp/extenddftf2.c
diff --git a/gcc/config/soft-fp/extended.h b/libgcc/soft-fp/extended.h
rename from gcc/config/soft-fp/extended.h
rename to libgcc/soft-fp/extended.h
diff --git a/gcc/config/soft-fp/extendsfdf2.c b/libgcc/soft-fp/extendsfdf2.c
rename from gcc/config/soft-fp/extendsfdf2.c
rename to libgcc/soft-fp/extendsfdf2.c
diff --git a/gcc/config/soft-fp/extendsftf2.c b/libgcc/soft-fp/extendsftf2.c
rename from gcc/config/soft-fp/extendsftf2.c
rename to libgcc/soft-fp/extendsftf2.c
diff --git a/gcc/config/soft-fp/extendxftf2.c b/libgcc/soft-fp/extendxftf2.c
rename from gcc/config/soft-fp/extendxftf2.c
rename to libgcc/soft-fp/extendxftf2.c
diff --git a/gcc/config/soft-fp/fixdfdi.c b/libgcc/soft-fp/fixdfdi.c
rename from gcc/config/soft-fp/fixdfdi.c
rename to libgcc/soft-fp/fixdfdi.c
diff --git a/gcc/config/soft-fp/fixdfsi.c b/libgcc/soft-fp/fixdfsi.c
rename from gcc/config/soft-fp/fixdfsi.c
rename to libgcc/soft-fp/fixdfsi.c
diff --git a/gcc/config/soft-fp/fixdfti.c b/libgcc/soft-fp/fixdfti.c
rename from gcc/config/soft-fp/fixdfti.c
rename to libgcc/soft-fp/fixdfti.c
diff --git a/gcc/config/soft-fp/fixsfdi.c b/libgcc/soft-fp/fixsfdi.c
rename from gcc/config/soft-fp/fixsfdi.c
rename to libgcc/soft-fp/fixsfdi.c
diff --git a/gcc/config/soft-fp/fixsfsi.c b/libgcc/soft-fp/fixsfsi.c
rename from gcc/config/soft-fp/fixsfsi.c
rename to libgcc/soft-fp/fixsfsi.c
diff --git a/gcc/config/soft-fp/fixsfti.c b/libgcc/soft-fp/fixsfti.c
rename from gcc/config/soft-fp/fixsfti.c
rename to libgcc/soft-fp/fixsfti.c
diff --git a/gcc/config/soft-fp/fixtfdi.c b/libgcc/soft-fp/fixtfdi.c
rename from gcc/config/soft-fp/fixtfdi.c
rename to libgcc/soft-fp/fixtfdi.c
diff --git a/gcc/config/soft-fp/fixtfsi.c b/libgcc/soft-fp/fixtfsi.c
rename from gcc/config/soft-fp/fixtfsi.c
rename to libgcc/soft-fp/fixtfsi.c
diff --git a/gcc/config/soft-fp/fixtfti.c b/libgcc/soft-fp/fixtfti.c
rename from gcc/config/soft-fp/fixtfti.c
rename to libgcc/soft-fp/fixtfti.c
diff --git a/gcc/config/soft-fp/fixunsdfdi.c b/libgcc/soft-fp/fixunsdfdi.c
rename from gcc/config/soft-fp/fixunsdfdi.c
rename to libgcc/soft-fp/fixunsdfdi.c
diff --git a/gcc/config/soft-fp/fixunsdfsi.c b/libgcc/soft-fp/fixunsdfsi.c
rename from gcc/config/soft-fp/fixunsdfsi.c
rename to libgcc/soft-fp/fixunsdfsi.c
diff --git a/gcc/config/soft-fp/fixunsdfti.c b/libgcc/soft-fp/fixunsdfti.c
rename from gcc/config/soft-fp/fixunsdfti.c
rename to libgcc/soft-fp/fixunsdfti.c
diff --git a/gcc/config/soft-fp/fixunssfdi.c b/libgcc/soft-fp/fixunssfdi.c
rename from gcc/config/soft-fp/fixunssfdi.c
rename to libgcc/soft-fp/fixunssfdi.c
diff --git a/gcc/config/soft-fp/fixunssfsi.c b/libgcc/soft-fp/fixunssfsi.c
rename from gcc/config/soft-fp/fixunssfsi.c
rename to libgcc/soft-fp/fixunssfsi.c
diff --git a/gcc/config/soft-fp/fixunssfti.c b/libgcc/soft-fp/fixunssfti.c
rename from gcc/config/soft-fp/fixunssfti.c
rename to libgcc/soft-fp/fixunssfti.c
diff --git a/gcc/config/soft-fp/fixunstfdi.c b/libgcc/soft-fp/fixunstfdi.c
rename from gcc/config/soft-fp/fixunstfdi.c
rename to libgcc/soft-fp/fixunstfdi.c
diff --git a/gcc/config/soft-fp/fixunstfsi.c b/libgcc/soft-fp/fixunstfsi.c
rename from gcc/config/soft-fp/fixunstfsi.c
rename to libgcc/soft-fp/fixunstfsi.c
diff --git a/gcc/config/soft-fp/fixunstfti.c b/libgcc/soft-fp/fixunstfti.c
rename from gcc/config/soft-fp/fixunstfti.c
rename to libgcc/soft-fp/fixunstfti.c
diff --git a/gcc/config/soft-fp/floatdidf.c b/libgcc/soft-fp/floatdidf.c
rename from gcc/config/soft-fp/floatdidf.c
rename to libgcc/soft-fp/floatdidf.c
diff --git a/gcc/config/soft-fp/floatdisf.c b/libgcc/soft-fp/floatdisf.c
rename from gcc/config/soft-fp/floatdisf.c
rename to libgcc/soft-fp/floatdisf.c
diff --git a/gcc/config/soft-fp/floatditf.c b/libgcc/soft-fp/floatditf.c
rename from gcc/config/soft-fp/floatditf.c
rename to libgcc/soft-fp/floatditf.c
diff --git a/gcc/config/soft-fp/floatsidf.c b/libgcc/soft-fp/floatsidf.c
rename from gcc/config/soft-fp/floatsidf.c
rename to libgcc/soft-fp/floatsidf.c
diff --git a/gcc/config/soft-fp/floatsisf.c b/libgcc/soft-fp/floatsisf.c
rename from gcc/config/soft-fp/floatsisf.c
rename to libgcc/soft-fp/floatsisf.c
diff --git a/gcc/config/soft-fp/floatsitf.c b/libgcc/soft-fp/floatsitf.c
rename from gcc/config/soft-fp/floatsitf.c
rename to libgcc/soft-fp/floatsitf.c
diff --git a/gcc/config/soft-fp/floattidf.c b/libgcc/soft-fp/floattidf.c
rename from gcc/config/soft-fp/floattidf.c
rename to libgcc/soft-fp/floattidf.c
diff --git a/gcc/config/soft-fp/floattisf.c b/libgcc/soft-fp/floattisf.c
rename from gcc/config/soft-fp/floattisf.c
rename to libgcc/soft-fp/floattisf.c
diff --git a/gcc/config/soft-fp/floattitf.c b/libgcc/soft-fp/floattitf.c
rename from gcc/config/soft-fp/floattitf.c
rename to libgcc/soft-fp/floattitf.c
diff --git a/gcc/config/soft-fp/floatundidf.c b/libgcc/soft-fp/floatundidf.c
rename from gcc/config/soft-fp/floatundidf.c
rename to libgcc/soft-fp/floatundidf.c
diff --git a/gcc/config/soft-fp/floatundisf.c b/libgcc/soft-fp/floatundisf.c
rename from gcc/config/soft-fp/floatundisf.c
rename to libgcc/soft-fp/floatundisf.c
diff --git a/gcc/config/soft-fp/floatunditf.c b/libgcc/soft-fp/floatunditf.c
rename from gcc/config/soft-fp/floatunditf.c
rename to libgcc/soft-fp/floatunditf.c
diff --git a/gcc/config/soft-fp/floatunsidf.c b/libgcc/soft-fp/floatunsidf.c
rename from gcc/config/soft-fp/floatunsidf.c
rename to libgcc/soft-fp/floatunsidf.c
diff --git a/gcc/config/soft-fp/floatunsisf.c b/libgcc/soft-fp/floatunsisf.c
rename from gcc/config/soft-fp/floatunsisf.c
rename to libgcc/soft-fp/floatunsisf.c
diff --git a/gcc/config/soft-fp/floatunsitf.c b/libgcc/soft-fp/floatunsitf.c
rename from gcc/config/soft-fp/floatunsitf.c
rename to libgcc/soft-fp/floatunsitf.c
diff --git a/gcc/config/soft-fp/floatuntidf.c b/libgcc/soft-fp/floatuntidf.c
rename from gcc/config/soft-fp/floatuntidf.c
rename to libgcc/soft-fp/floatuntidf.c
diff --git a/gcc/config/soft-fp/floatuntisf.c b/libgcc/soft-fp/floatuntisf.c
rename from gcc/config/soft-fp/floatuntisf.c
rename to libgcc/soft-fp/floatuntisf.c
diff --git a/gcc/config/soft-fp/floatuntitf.c b/libgcc/soft-fp/floatuntitf.c
rename from gcc/config/soft-fp/floatuntitf.c
rename to libgcc/soft-fp/floatuntitf.c
diff --git a/gcc/config/soft-fp/gedf2.c b/libgcc/soft-fp/gedf2.c
rename from gcc/config/soft-fp/gedf2.c
rename to libgcc/soft-fp/gedf2.c
diff --git a/gcc/config/soft-fp/gesf2.c b/libgcc/soft-fp/gesf2.c
rename from gcc/config/soft-fp/gesf2.c
rename to libgcc/soft-fp/gesf2.c
diff --git a/gcc/config/soft-fp/getf2.c b/libgcc/soft-fp/getf2.c
rename from gcc/config/soft-fp/getf2.c
rename to libgcc/soft-fp/getf2.c
diff --git a/gcc/config/soft-fp/ledf2.c b/libgcc/soft-fp/ledf2.c
rename from gcc/config/soft-fp/ledf2.c
rename to libgcc/soft-fp/ledf2.c
diff --git a/gcc/config/soft-fp/lesf2.c b/libgcc/soft-fp/lesf2.c
rename from gcc/config/soft-fp/lesf2.c
rename to libgcc/soft-fp/lesf2.c
diff --git a/gcc/config/soft-fp/letf2.c b/libgcc/soft-fp/letf2.c
rename from gcc/config/soft-fp/letf2.c
rename to libgcc/soft-fp/letf2.c
diff --git a/gcc/config/soft-fp/muldf3.c b/libgcc/soft-fp/muldf3.c
rename from gcc/config/soft-fp/muldf3.c
rename to libgcc/soft-fp/muldf3.c
diff --git a/gcc/config/soft-fp/mulsf3.c b/libgcc/soft-fp/mulsf3.c
rename from gcc/config/soft-fp/mulsf3.c
rename to libgcc/soft-fp/mulsf3.c
diff --git a/gcc/config/soft-fp/multf3.c b/libgcc/soft-fp/multf3.c
rename from gcc/config/soft-fp/multf3.c
rename to libgcc/soft-fp/multf3.c
diff --git a/gcc/config/soft-fp/negdf2.c b/libgcc/soft-fp/negdf2.c
rename from gcc/config/soft-fp/negdf2.c
rename to libgcc/soft-fp/negdf2.c
diff --git a/gcc/config/soft-fp/negsf2.c b/libgcc/soft-fp/negsf2.c
rename from gcc/config/soft-fp/negsf2.c
rename to libgcc/soft-fp/negsf2.c
diff --git a/gcc/config/soft-fp/negtf2.c b/libgcc/soft-fp/negtf2.c
rename from gcc/config/soft-fp/negtf2.c
rename to libgcc/soft-fp/negtf2.c
diff --git a/gcc/config/soft-fp/op-1.h b/libgcc/soft-fp/op-1.h
rename from gcc/config/soft-fp/op-1.h
rename to libgcc/soft-fp/op-1.h
diff --git a/gcc/config/soft-fp/op-2.h b/libgcc/soft-fp/op-2.h
rename from gcc/config/soft-fp/op-2.h
rename to libgcc/soft-fp/op-2.h
diff --git a/gcc/config/soft-fp/op-4.h b/libgcc/soft-fp/op-4.h
rename from gcc/config/soft-fp/op-4.h
rename to libgcc/soft-fp/op-4.h
diff --git a/gcc/config/soft-fp/op-8.h b/libgcc/soft-fp/op-8.h
rename from gcc/config/soft-fp/op-8.h
rename to libgcc/soft-fp/op-8.h
diff --git a/gcc/config/soft-fp/op-common.h b/libgcc/soft-fp/op-common.h
rename from gcc/config/soft-fp/op-common.h
rename to libgcc/soft-fp/op-common.h
diff --git a/gcc/config/soft-fp/quad.h b/libgcc/soft-fp/quad.h
rename from gcc/config/soft-fp/quad.h
rename to libgcc/soft-fp/quad.h
diff --git a/gcc/config/soft-fp/single.h b/libgcc/soft-fp/single.h
rename from gcc/config/soft-fp/single.h
rename to libgcc/soft-fp/single.h
diff --git a/gcc/config/soft-fp/soft-fp.h b/libgcc/soft-fp/soft-fp.h
rename from gcc/config/soft-fp/soft-fp.h
rename to libgcc/soft-fp/soft-fp.h
diff --git a/gcc/config/soft-fp/subdf3.c b/libgcc/soft-fp/subdf3.c
rename from gcc/config/soft-fp/subdf3.c
rename to libgcc/soft-fp/subdf3.c
diff --git a/gcc/config/soft-fp/subsf3.c b/libgcc/soft-fp/subsf3.c
rename from gcc/config/soft-fp/subsf3.c
rename to libgcc/soft-fp/subsf3.c
diff --git a/gcc/config/soft-fp/subtf3.c b/libgcc/soft-fp/subtf3.c
rename from gcc/config/soft-fp/subtf3.c
rename to libgcc/soft-fp/subtf3.c
diff --git a/gcc/config/soft-fp/truncdfsf2.c b/libgcc/soft-fp/truncdfsf2.c
rename from gcc/config/soft-fp/truncdfsf2.c
rename to libgcc/soft-fp/truncdfsf2.c
diff --git a/gcc/config/soft-fp/trunctfdf2.c b/libgcc/soft-fp/trunctfdf2.c
rename from gcc/config/soft-fp/trunctfdf2.c
rename to libgcc/soft-fp/trunctfdf2.c
diff --git a/gcc/config/soft-fp/trunctfsf2.c b/libgcc/soft-fp/trunctfsf2.c
rename from gcc/config/soft-fp/trunctfsf2.c
rename to libgcc/soft-fp/trunctfsf2.c
diff --git a/gcc/config/soft-fp/trunctfxf2.c b/libgcc/soft-fp/trunctfxf2.c
rename from gcc/config/soft-fp/trunctfxf2.c
rename to libgcc/soft-fp/trunctfxf2.c
diff --git a/gcc/config/soft-fp/unorddf2.c b/libgcc/soft-fp/unorddf2.c
rename from gcc/config/soft-fp/unorddf2.c
rename to libgcc/soft-fp/unorddf2.c
diff --git a/gcc/config/soft-fp/unordsf2.c b/libgcc/soft-fp/unordsf2.c
rename from gcc/config/soft-fp/unordsf2.c
rename to libgcc/soft-fp/unordsf2.c
diff --git a/gcc/config/soft-fp/unordtf2.c b/libgcc/soft-fp/unordtf2.c
rename from gcc/config/soft-fp/unordtf2.c
rename to libgcc/soft-fp/unordtf2.c
Thomas Schwinge - July 13, 2011, 9:51 a.m.
Hallo Rainer!

On Tue, 12 Jul 2011 19:22:51 +0200, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:
> 2011-07-09  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	gcc: [...]
> 	* config.gcc ([...]
> 	(i[34567]86-*-darwin*): Remove i386/t-fprules-softfp,
> 	soft-fp/t-softfp from tmake_file.
> 	(i[34567]86-*-linux*): Likewise.
> 	[...]

>  	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-fprules-softfp soft-fp/t-softfp i386/t-linux"
>  		;;

This also removes i386/t-linux from tmake_file, which might not be what
you intended?


Grüße,
 Thomas
Rainer Orth - July 13, 2011, 10:02 a.m.
Hi Thomas,

>>  	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-fprules-softfp soft-fp/t-softfp i386/t-linux"
>>  		;;
>
> This also removes i386/t-linux from tmake_file, which might not be what
> you intended?

indeed not.  Will fix in my local copy.

Thanks for noticing.

	Rainer
Joseph S. Myers - July 21, 2011, 7:47 p.m.
On Tue, 12 Jul 2011, Rainer Orth wrote:

> One odd thing out is that the lm32 snippet misses
> 
> softfp_exclude_libgcc2 := y
> 
> compared to the new t-softfp-sfdf.  I'm currently handling this since I
> cannot tell if this is intentional or just an accident.

The general rule is that softfp_exclude_libgcc2 := y is to be avoided 
where possible - and after this move it should be possible (in separate 
patches) to eliminate the remaining instances of it.

Specifically, if all multilibs for a target are soft-float and using 
soft-fp, then you shouldn't need softfp_exclude_libgcc2 := y, because it's 
more efficient to implement the floating-point functions from libgcc2.c 
directly using soft-fp instead of through the libgcc2.c wrappers around 
other operations that will end up calling soft-fp functions.  The use of 
softfp_exclude_libgcc2 := y is if a target has both hard and soft float 
multilibs, because the libgcc2.c versions are better for the hard float 
multilibs and it wasn't easy to choose between them based on the multilib.

With soft-fp configuration in the toplevel libgcc directory, the libgcc 
configure script can select different configuration files depending on the 
multilib.  For the soft-float multilibs it can select the soft-fp files 
and disable the libgcc2.c versions of these functions.  For hard-float 
multilibs, the functions outside libgcc2.c aren't really needed as they 
won't actually be called; for ABI compatibility they should stay in libgcc 
if they were already there, but it would be best to keep the size of 
libgcc down by compiling them from trivial code such as "float __addsf3 
(float a, float b) { return a + b; }".  (Some cases such as Power e500v1 - 
hardware "float", software "double" - are more complicated, but the same 
general principles still apply.)

In addition to the cases for whether TFmode is involved that you noted, 
there are cases for whether TImode is involved as well.  See 
libgcc/config/i386/32/t-fprules-softfp.  With the move to toplevel, that 
file has a kludge to remove TImode functions that has no good reason to 
exist; the 32-bit multilibs should simply not include "ti" in 
softfp_int_modes, rather than including it then overriding some of the 
variables generated from that setting.

Configure tests could also make a better replacement for softfp_wrap_start 
and softfp_wrap_end.

Given the complexity of the symbol versioning setup for this code for 
x86-linux (32-bit and 64-bit) it would be a good idea to verify that the 
exported symbols in shared libgcc are the same, at the same versions, 
before and after the patch, for each of 32-bit and 64-bit.

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -731,9 +731,6 @@  LIB2FUNCS_STATIC_EXTRA =
 # List of functions not to build from libgcc2.c.
 LIB2FUNCS_EXCLUDE =
 
-# Target sfp-machine.h file.
-SFP_MACHINE =
-
 # Program to convert libraries.
 LIBCONVERT =
 
@@ -1862,7 +1859,7 @@  srcdirify = $(patsubst $$(libgcc_objdir)
 GCC_EXTRA_PARTS := $(sort $(EXTRA_MULTILIB_PARTS) $(EXTRA_PARTS))
 
 libgcc-support: libgcc.mvars stmp-int-hdrs $(TCONFIG_H) \
-	$(MACHMODE_H) $(LIB2ADD) $(LIB2ADD_ST) gcov-iov.h $(SFP_MACHINE)
+	$(MACHMODE_H) $(LIB2ADD) $(LIB2ADD_ST) gcov-iov.h
 
 libgcc.mvars: config.status Makefile $(LIB2ADD) $(LIB2ADD_ST) specs \
 		xgcc$(exeext)
diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -861,7 +861,6 @@  arm*-*-linux*)			# ARM GNU/Linux with EL
 	esac
 	with_tls=${with_tls:-gnu}
 	tm_file="$tm_file arm/aout.h arm/arm.h"
-	tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp"
 	;;
 arm*-*-uclinux*)		# ARM ucLinux
 	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/uclinux-elf.h glibc-stdint.h"
@@ -879,12 +878,10 @@  arm*-*-uclinux*)		# ARM ucLinux
 	    default_use_cxa_atexit=yes
 	esac
 	tm_file="$tm_file arm/aout.h arm/arm.h"
-	tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp"
 	;;
 arm*-*-ecos-elf)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h"
 	tmake_file="arm/t-arm arm/t-arm-elf"
-	tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp"
 	;;
 arm*-*-eabi* | arm*-*-symbianelf* )
 	# The BPABI long long divmod functions return a 128-bit value in
@@ -910,17 +907,14 @@  arm*-*-eabi* | arm*-*-symbianelf* )
 	  ;;
 	esac
 	tm_file="${tm_file} arm/aout.h arm/arm.h"
-	tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp"
 	;;
 arm*-*-rtems*)
 	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/rtems-elf.h rtems.h newlib-stdint.h"
 	tmake_file="arm/t-arm arm/t-arm-elf t-rtems arm/t-rtems"
-	tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp"
 	;;
 arm*-*-elf)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h"
 	tmake_file="arm/t-arm arm/t-arm-elf"
-	tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp"
 	;;
 arm*-wince-pe*)
 	tm_file="arm/semi.h arm/aout.h arm/arm.h arm/coff.h dbxcoff.h arm/pe.h arm/wince-pe.h"
@@ -1019,17 +1013,17 @@  moxie-*-elf)
 	gnu_ld=yes
 	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
 	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
-	tmake_file="${tmake_file} moxie/t-moxie moxie/t-moxie-softfp soft-fp/t-softfp"
+	tmake_file="${tmake_file} moxie/t-moxie"
 	;;
 moxie-*-uclinux*)
 	gas=yes
 	gnu_ld=yes
 	tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h moxie/uclinux.h"
 	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
-	tmake_file="${tmake_file} moxie/t-moxie moxie/t-moxie-softfp soft-fp/t-softfp"
+	tmake_file="${tmake_file} moxie/t-moxie"
 	;;
 moxie-*-rtems*)
-	tmake_file="${tmake_file} moxie/t-moxie moxie/t-moxie-softfp soft-fp/t-softfp t-rtems"
+	tmake_file="${tmake_file} moxie/t-moxie t-rtems"
 	tm_file="moxie/moxie.h dbxelf.h elfos.h moxie/rtems.h rtems.h newlib-stdint.h"
 	;;
 h8300-*-rtems*)
@@ -1659,16 +1653,16 @@  iq2000*-*-elf*)
         ;;
 lm32-*-elf*)
         tm_file="dbxelf.h elfos.h ${tm_file}"
-	tmake_file="${tmake_file} lm32/t-lm32 lm32/t-fprules-softfp soft-fp/t-softfp"
+	tmake_file="${tmake_file} lm32/t-lm32"
         ;;
 lm32-*-rtems*)
 	tm_file="dbxelf.h elfos.h ${tm_file} lm32/rtems.h rtems.h newlib-stdint.h"
-	tmake_file="${tmake_file} lm32/t-lm32 lm32/t-fprules-softfp soft-fp/t-softfp"
+	tmake_file="${tmake_file} lm32/t-lm32"
 	tmake_file="${tmake_file} t-rtems"
          ;;
 lm32-*-uclinux*)
         tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h lm32/uclinux-elf.h"
-	tmake_file="${tmake_file} lm32/t-lm32 lm32/t-fprules-softfp soft-fp/t-softfp"
+	tmake_file="${tmake_file} lm32/t-lm32"
         ;;
 m32r-*-elf*)
 	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
@@ -2053,8 +2047,8 @@  powerpc64-*-darwin*)
 	;;
 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 rs6000/t-freebsd"
-	tmake_file="${tmake_file} t-slibgcc-libgcc rs6000/t-fprules-softfp soft-fp/t-softfp"
+	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*)
@@ -2140,7 +2134,7 @@  powerpc-*-linux* | powerpc64-*-linux*)
 		tm_file="${tm_file} rs6000/linux.h glibc-stdint.h"
 		;;
 	esac
-	tmake_file="${tmake_file} t-slibgcc-libgcc rs6000/t-fprules-softfp soft-fp/t-softfp"
+	tmake_file="${tmake_file} t-slibgcc-libgcc"
 	case ${target} in
 	    powerpc*-*-linux*altivec*)
 		tm_file="${tm_file} rs6000/linuxaltivec.h" ;;
@@ -2271,7 +2265,7 @@  score-*-elf)
 	gnu_ld=yes
         tm_file="dbxelf.h elfos.h score/elf.h score/score.h newlib-stdint.h"
 	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
-        tmake_file="${tmake_file} score/t-score-elf score/t-score-softfp soft-fp/t-softfp"
+        tmake_file="${tmake_file} score/t-score-elf"
         ;;
 sh-*-elf* | sh[12346l]*-*-elf* | \
   sh-*-linux* | sh[2346lbe]*-*-linux* | \
@@ -3546,24 +3540,18 @@  case ${target} in
 		;;
 
 	i[34567]86-*-darwin* | x86_64-*-darwin*)
-		tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
 		;;
 	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-fprules-softfp soft-fp/t-softfp i386/t-linux"
 		;;
 	i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
-		tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
 		;;
 	i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
-		tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
 		;;
 	i[34567]86-*-freebsd* | x86_64-*-freebsd*)
-		tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
 		;;
 	ia64*-*-linux*)
-		tmake_file="${tmake_file} ia64/t-fprules-softfp soft-fp/t-softfp"
 		;;
 
 	mips*-*-*)
diff --git a/gcc/config/ia64/t-fprules-softfp b/gcc/config/ia64/t-fprules-softfp
deleted file mode 100644
--- a/gcc/config/ia64/t-fprules-softfp
+++ /dev/null
@@ -1,6 +0,0 @@ 
-softfp_float_modes := tf
-softfp_int_modes := si di ti
-softfp_extensions := sftf dftf xftf
-softfp_truncations := tfsf tfdf tfxf
-softfp_machine_header := ia64/sfp-machine.h
-softfp_exclude_libgcc2 := n
diff --git a/gcc/config/lm32/t-fprules-softfp b/gcc/config/lm32/t-fprules-softfp
deleted file mode 100644
--- a/gcc/config/lm32/t-fprules-softfp
+++ /dev/null
@@ -1,5 +0,0 @@ 
-softfp_float_modes := sf df
-softfp_int_modes := si di
-softfp_extensions := sfdf
-softfp_truncations := dfsf
-softfp_machine_header := lm32/sfp-machine.h
diff --git a/gcc/config/moxie/sfp-machine.h b/gcc/config/moxie/sfp-machine.h
deleted file mode 100644
--- a/gcc/config/moxie/sfp-machine.h
+++ /dev/null
@@ -1,57 +0,0 @@ 
-#define _FP_W_TYPE_SIZE		32
-#define _FP_W_TYPE		unsigned long
-#define _FP_WS_TYPE		signed long
-#define _FP_I_TYPE		long
-
-/* The type of the result of a floating point comparison.  This must
-   match `__libgcc_cmp_return__' in GCC for the target.  */
-typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
-#define CMPtype __gcc_CMPtype
-
-#define _FP_MUL_MEAT_S(R,X,Y)				\
-  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
-#define _FP_MUL_MEAT_D(R,X,Y)				\
-  _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
-#define _FP_MUL_MEAT_Q(R,X,Y)				\
-  _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
-
-#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_loop(S,R,X,Y)
-#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
-#define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_4_udiv(Q,R,X,Y)
-
-#define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
-#define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1), -1
-#define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
-#define _FP_NANSIGN_S		0
-#define _FP_NANSIGN_D		0
-#define _FP_NANSIGN_Q		0
-
-#define _FP_KEEPNANFRACP 1
-
-/* Someone please check this.  */
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
-  do {								\
-    if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)		\
-	&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs))	\
-      {								\
-	R##_s = Y##_s;						\
-	_FP_FRAC_COPY_##wc(R,Y);				\
-      }								\
-    else							\
-      {								\
-	R##_s = X##_s;						\
-	_FP_FRAC_COPY_##wc(R,X);				\
-      }								\
-    R##_c = FP_CLS_NAN;						\
-  } while (0)
-
-#define	__LITTLE_ENDIAN	1234
-#define	__BIG_ENDIAN	4321
-
-# define __BYTE_ORDER __BIG_ENDIAN
-
-/* Define ALIASNAME as a strong alias for NAME.  */
-# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
-# define _strong_alias(name, aliasname) \
-  extern __typeof (name) aliasname __attribute__ ((alias (#name)));
-
diff --git a/gcc/config/moxie/t-moxie-softfp b/gcc/config/moxie/t-moxie-softfp
deleted file mode 100644
--- a/gcc/config/moxie/t-moxie-softfp
+++ /dev/null
@@ -1,9 +0,0 @@ 
-softfp_float_modes := sf df
-softfp_int_modes := si di
-softfp_extensions := sfdf
-softfp_truncations := dfsf
-softfp_machine_header := moxie/sfp-machine.h
-softfp_exclude_libgcc2 := y
-
-# softfp seems to be missing a whole bunch of prototypes.
-TARGET_LIBGCC2_CFLAGS += -Wno-missing-prototypes
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
@@ -70,13 +70,9 @@  SHLIB_INSTALL = \
 		$$(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 $(srcdir)/config/rs6000/libgcc-ppc64.ver
+SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
 SHLIB_NM_FLAGS = -Bpg -X32_64
 
-# GCC 128-bit long double support routines.
-LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/darwin-ldouble.c
-TARGET_LIBGCC2_CFLAGS = -mlong-double-128
-
 # 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
@@ -51,12 +51,8 @@  SHLIB_INSTALL = \
 		$$(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 $(srcdir)/config/rs6000/libgcc-ppc64.ver
+SHLIB_MAPFILES = $$(libgcc_objdir)/libgcc-std.ver
 SHLIB_NM_FLAGS = -Bpg -X32_64
 
-# GCC 128-bit long double support routines.
-LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/darwin-ldouble.c
-TARGET_LIBGCC2_CFLAGS = -mlong-double-128
-
 # Either 32-bit and 64-bit objects in archives.
 AR_FLAGS_FOR_TARGET = -X32_64
diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin
--- a/gcc/config/rs6000/t-darwin
+++ b/gcc/config/rs6000/t-darwin
@@ -19,7 +19,6 @@ 
 
 LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/darwin-tramp.asm \
 	$(srcdir)/config/darwin-64.c \
-	$(srcdir)/config/rs6000/darwin-ldouble.c \
 	$(srcdir)/config/rs6000/darwin-world.asm
 
 LIB2FUNCS_STATIC_EXTRA = \
@@ -38,9 +37,6 @@  DARWIN_EXTRA_CRT_BUILD_CFLAGS = -mlongca
 # works around this by not having any temporary file names.
 TARGET_LIBGCC2_CFLAGS = -Wa,-force_cpusubtype_ALL -pipe -mmacosx-version-min=10.4
 
-# Export the _xlq* symbols from darwin-ldouble.c.
-SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc64.ver
-
 darwin-fpsave.o:	$(srcdir)/config/rs6000/darwin-asm.h
 darwin-tramp.o:		$(srcdir)/config/rs6000/darwin-asm.h
 
diff --git a/gcc/config/rs6000/t-darwin64 b/gcc/config/rs6000/t-darwin64
--- a/gcc/config/rs6000/t-darwin64
+++ b/gcc/config/rs6000/t-darwin64
@@ -2,7 +2,6 @@  LIB2_SIDITI_CONV_FUNCS=yes
 
 LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/darwin-tramp.asm \
 	$(srcdir)/config/darwin-64.c \
-	$(srcdir)/config/rs6000/darwin-ldouble.c \
 	$(srcdir)/config/rs6000/darwin-world.asm
 
 MULTILIB_OPTIONS = m32
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -35,6 +35,3 @@  MULTILIB_EXCEPTIONS     = m64/msoft-floa
 MULTILIB_EXCLUSIONS     = m64/!m32/msoft-float
 MULTILIB_OSDIRNAMES	= ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof
 MULTILIB_MATCHES        = $(MULTILIB_MATCHES_FLOAT)
-
-softfp_wrap_start := '\#ifndef __powerpc64__'
-softfp_wrap_end := '\#endif'
diff --git a/gcc/config/rs6000/t-ppccomm b/gcc/config/rs6000/t-ppccomm
--- a/gcc/config/rs6000/t-ppccomm
+++ b/gcc/config/rs6000/t-ppccomm
@@ -1,7 +1,7 @@ 
 # Common support for PowerPC ELF targets (both EABI and SVR4).
 #
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2006, 2007,
-# 2008 Free Software Foundation, Inc.
+# 2008, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -19,7 +19,7 @@ 
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-LIB2FUNCS_EXTRA += tramp.S $(srcdir)/config/rs6000/darwin-ldouble.c
+LIB2FUNCS_EXTRA += tramp.S
 
 # These can't end up in shared libgcc
 LIB2FUNCS_STATIC_EXTRA = eabi.S
diff --git a/gcc/config/score/t-score-softfp b/gcc/config/score/t-score-softfp
deleted file mode 100644
--- a/gcc/config/score/t-score-softfp
+++ /dev/null
@@ -1,9 +0,0 @@ 
-softfp_float_modes := sf df
-softfp_int_modes := si di
-softfp_extensions := sfdf
-softfp_truncations := dfsf
-softfp_machine_header := score/sfp-machine.h
-softfp_exclude_libgcc2 := y
-
-# softfp seems to be missing a whole bunch of prototypes.
-TARGET_LIBGCC2_CFLAGS += -Wno-missing-prototypes
diff --git a/gcc/config/soft-fp/t-softfp b/gcc/config/soft-fp/t-softfp
deleted file mode 100644
--- a/gcc/config/soft-fp/t-softfp
+++ /dev/null
@@ -1,107 +0,0 @@ 
-# Copyright (C) 2006, 2007 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/>.
-
-# Targets using soft-fp should define the following variables:
-#
-# softfp_float_modes: a list of soft-float floating-point modes,
-#                     e.g. sf df
-# softfp_int_modes: a list of integer modes for which to define conversions,
-#                   e.g. si di
-# softfp_extensions: a list of extensions between floating-point modes,
-#                    e.g. sfdf
-# softfp_truncations: a list of truncations between floating-point modes,
-#                     e.g. dfsf
-# softfp_machine_header: the target sfp-machine.h file (relative to config/),
-#                        e.g. rs6000/sfp-machine.h
-#
-# Extensions and truncations should include those where only one mode
-# is a soft-float mode; for example, sftf where sf is hard-float and
-# tf is soft-float.
-#
-# If the libgcc2.c functions should not be replaced, also define:
-#
-# softfp_exclude_libgcc2 := y
-#
-# Avoiding replacing the libgcc2.c functions is a temporary measure
-# for targets with both hard-float and soft-float multilibs, since
-# these variables apply for all multilibs.  With toplevel libgcc,
-# soft-fp can be used conditionally on the multilib instead.
-#
-# If the code should not be compiled at all for some multilibs, define:
-#
-# softfp_wrap_start: text to put at the start of wrapper source files,
-#                    output with echo
-#                    e.g. '#ifndef __powerpc64__'
-# softfp_wrap_end: text to put at the end of wrapper source files,
-#                  e.g. '#endif'
-#
-# This is another temporary measure.
-
-softfp_float_funcs = add$(m)3 div$(m)3 eq$(m)2 ge$(m)2 le$(m)2 mul$(m)3 \
-  neg$(m)2 sub$(m)3 unord$(m)2
-softfp_floatint_funcs = fix$(m)$(i) fixuns$(m)$(i) \
-  float$(i)$(m) floatun$(i)$(m)
-
-softfp_func_list := \
-  $(foreach m,$(softfp_float_modes), \
-              $(softfp_float_funcs) \
-              $(foreach i,$(softfp_int_modes), \
-                          $(softfp_floatint_funcs))) \
-  $(foreach e,$(softfp_extensions),extend$(e)2) \
-  $(foreach t,$(softfp_truncations),trunc$(t)2)
-
-ifeq ($(softfp_exclude_libgcc2),y)
-# This list is taken from mklibgcc.in and doesn't presently allow for
-# 64-bit targets where si should become di and di should become ti.
-softfp_func_list := $(filter-out floatdidf floatdisf fixunsdfsi fixunssfsi \
-  fixunsdfdi fixdfdi fixunssfdi fixsfdi fixxfdi fixunsxfdi \
-  floatdixf fixunsxfsi fixtfdi fixunstfdi floatditf \
-  floatundidf floatundisf floatundixf floatunditf,$(softfp_func_list))
-endif
-
-ifeq ($(softfp_wrap_start),)
-softfp_file_list := \
-  $(addsuffix .c,$(addprefix $(srcdir)/config/soft-fp/,$(softfp_func_list)))
-else
-softfp_file_list := $(addsuffix .c,$(softfp_func_list))
-
-$(softfp_file_list):
-	echo $(softfp_wrap_start) > $@
-	echo '#include "config/soft-fp/$@"' >> $@
-	echo $(softfp_wrap_end) >> $@
-endif
-
-LIB2FUNCS_EXTRA += $(softfp_file_list)
-
-ifneq ($(softfp_exclude_libgcc2),y)
-# Functions in libgcc2.c are excluded for each soft-float mode (a
-# target may have both soft-float and hard-float modes), for the fixed
-# list of integer modes (si and di) for which libgcc2.c defines any
-# such functions.  Depending on the target, the si and di symbols may
-# in fact define di and ti functions.
-
-LIB2FUNCS_EXCLUDE += \
-  $(addprefix _,$(foreach m,$(softfp_float_modes), \
-                            $(foreach i,si di, \
-                                        $(softfp_floatint_funcs))))
-endif
-
-SFP_MACHINE := sfp-machine.h
-
-$(SFP_MACHINE): $(srcdir)/config/$(softfp_machine_header)
-	cp $(srcdir)/config/$(softfp_machine_header) $(SFP_MACHINE)
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -54,6 +54,9 @@ 
 #			subdirectory will be ignored.
 #  md_unwind_header	The name of a header file defining
 #			MD_FALLBACK_FRAME_STATE_FOR.
+#  sfp_machine_header	The name of a sfp-machine.h header file for soft-fp.
+#  			Defaults to "$cpu_type/sfp-machine.h" if it exists,
+#			no-sfp-machine.h otherwise.
 #  tmake_file		A list of machine-description-specific
 #			makefile-fragments, if different from
 #			"$cpu_type/t-$cpu_type".
@@ -275,6 +278,7 @@  arm*-*-linux*)			# ARM GNU/Linux with EL
 	  unwind_header=config/arm/unwind-arm.h
 	  ;;
 	esac
+	tmake_file="$tmake_file t-softfp-sfdf arm/t-softfp t-softfp"
 	;;
 arm*-*-uclinux*)		# ARM ucLinux
 	case ${host} in
@@ -283,8 +287,10 @@  arm*-*-uclinux*)		# ARM ucLinux
 	  unwind_header=config/arm/unwind-arm.h
 	  ;;
 	esac
+	tmake_file="$tmake_file t-softfp-sfdf arm/t-softfp t-softfp"
 	;;
 arm*-*-ecos-elf)
+	tmake_file="$tmake_file t-softfp-sfdf arm/t-softfp t-softfp"
 	;;
 arm*-*-eabi* | arm*-*-symbianelf* )
 	case ${host} in
@@ -297,10 +303,13 @@  arm*-*-eabi* | arm*-*-symbianelf* )
 	  unwind_header=config/arm/unwind-arm.h
 	  ;;
 	esac
+	tmake_file="$tmake_file t-softfp-sfdf arm/t-softfp t-softfp"
 	;;
 arm*-*-rtems*)
+	tmake_file="$tmake_file t-softfp-sfdf arm/t-softfp t-softfp"
 	;;
 arm*-*-elf)
+	tmake_file="$tmake_file t-softfp-sfdf arm/t-softfp t-softfp"
 	;;
 arm*-wince-pe*)
 	;;
@@ -310,7 +319,6 @@  avr-*-rtems*)
 avr-*-*)
 	# Make HImode functions for AVR
 	tmake_file="${cpu_type}/t-avr t-fpbit"
-
 	;;
 bfin*-elf*)
 	tmke_file=t-fdpbit
@@ -459,7 +467,7 @@  ia64*-*-freebsd*)
 	;;
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
+	tmake_file="ia64/t-ia64 t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
 	if test x$with_system_libunwind != xyes ; then
 		tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
 	fi
@@ -477,11 +485,11 @@  iq2000*-*-elf*)
         ;;
 lm32-*-elf*|lm32-*-rtems*)
         extra_parts="crtbegin.o crtend.o crti.o crtn.o"
-        tmake_file="lm32/t-lm32 lm32/t-elf t-softfp"
+        tmake_file="lm32/t-lm32 lm32/t-elf t-softfp-sfdf lm32/t-softfp t-softfp"
 	;;
 lm32-*-uclinux*)
         extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
-        tmake_file="lm32/t-lm32 lm32/t-uclinux t-softfp"
+        tmake_file="lm32/t-lm32 lm32/t-uclinux t-softfp-sfdf lm32/t-softfp t-softfp"
 	;;	
 m32r-*-elf*|m32r-*-rtems*)
 	tmake_file=t-fdpbit
@@ -582,7 +590,7 @@  mn10300-*-*)
 	tmake_file=t-fdpbit
 	;;
 moxie-*-*)
-	tmake_file="moxie/t-moxie moxie/t-moxie-softfp"
+	tmake_file="moxie/t-moxie t-softfp-sfdf t-softfp"
 	extra_parts="crtbegin.o crtend.o crti.o crtn.o"
 	;;
 pdp11-*-*)
@@ -601,11 +609,13 @@  powerpc-*-darwin*)
 	  md_unwind_header=rs6000/darwin-unwind.h
 	  ;;
 	esac
+	tmake_file="$tmake_file rs6000/t-ibm-ldouble"
 	;;
 powerpc64-*-darwin*)
+	tmake_file="$tmake_file rs6000/t-ibm-ldouble"
 	;;
 powerpc-*-freebsd*)
-	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-freebsd t-softfp"
+	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-freebsd t-softfp-sfdf t-softfp"
 	;;
 powerpc-*-netbsd*)
 	;;
@@ -613,56 +623,56 @@  powerpc-*-eabispe*)
 	tmake_file="${tmake_file} rs6000/t-ppccomm t-fdpbit"
 	;;
 powerpc-*-eabisimaltivec*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpc-*-eabisim*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpc-*-elf*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpc-*-eabialtivec*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpc-xilinx-eabi*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpc-*-eabi*)
 	tmake_file="${tmake_file} rs6000/t-ppccomm t-fdpbit"
 	;;
 powerpc-*-rtems*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpc-*-linux* | powerpc64-*-linux*)
-	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ldbl128 t-softfp t-dfprules rs6000/t-ppc64-fp"
+	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ldbl128 t-softfp-sfdf t-dfprules rs6000/t-ppc64-fp t-softfp"
 	md_unwind_header=rs6000/linux-unwind.h
 	;;
 powerpc-wrs-vxworks|powerpc-wrs-vxworksae)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpc-*-lynxos*)
 	tmake_file=t-fdpbit
 	;;
 powerpcle-*-elf*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpcle-*-eabisim*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 powerpcle-*-eabi*)
-	tmake_file=t-fdpbit
+	tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
 	;;
 rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
 	md_unwind_header=rs6000/aix-unwind.h
-	tmake_file="t-fdpbit rs6000/t-ppc64-fp"
+	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble"
 	;;
 rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*)
 	md_unwind_header=rs6000/aix-unwind.h
-	tmake_file="t-fdpbit rs6000/t-ppc64-fp"
+	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble"
 	;;
 rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
 	md_unwind_header=rs6000/aix-unwind.h
-	tmake_file="t-fdpbit rs6000/t-ppc64-fp"
+	tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-ibm-ldouble"
 	;;
 rx-*-elf)
 	extra_parts="crtbegin.o crtend.o"
@@ -681,6 +691,7 @@  s390x-ibm-tpf*)
 	md_unwind_header=s390/tpf-unwind.h
 	;;
 score-*-elf)
+	tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
         ;;
 sh-*-elf* | sh[12346l]*-*-elf* | \
   sh-*-linux* | sh[2346lbe]*-*-linux* | \
@@ -817,8 +828,9 @@  i[34567]86-*-darwin* | x86_64-*-darwin* 
   i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
   i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw* | \
   i[34567]86-*-freebsd* | x86_64-*-freebsd*)
+  	tmake_file="${tmake_file} t-softfp-tf t-softfp"
 	if test "${host_address}" = 32; then
-		tmake_file="${tmake_file} t-softfp i386/${host_address}/t-fprules-softfp"
+		tmake_file="${tmake_file} i386/${host_address}/t-softfp"
 	fi
 	;;
 esac
diff --git a/gcc/config/arm/sfp-machine.h b/libgcc/config/arm/sfp-machine.h
rename from gcc/config/arm/sfp-machine.h
rename to libgcc/config/arm/sfp-machine.h
diff --git a/gcc/config/arm/t-arm-softfp b/libgcc/config/arm/t-softfp
rename from gcc/config/arm/t-arm-softfp
rename to libgcc/config/arm/t-softfp
--- a/gcc/config/arm/t-arm-softfp
+++ b/libgcc/config/arm/t-softfp
@@ -1,29 +1,2 @@ 
-# Copyright (C) 2008 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/>.
-
-softfp_float_modes := sf df
-softfp_int_modes := si di
-softfp_extensions := sfdf
-softfp_truncations := dfsf
-softfp_machine_header := arm/sfp-machine.h
-softfp_exclude_libgcc2 := y
 softfp_wrap_start := '\#ifdef __ARM_ARCH_6M__'
 softfp_wrap_end := '\#endif'
-
-# softfp seems to be missing a whole bunch of prototypes.
-TARGET_LIBGCC2_CFLAGS += -Wno-missing-prototypes
diff --git a/libgcc/config/i386/32/t-fprules-softfp b/libgcc/config/i386/32/t-softfp
rename from libgcc/config/i386/32/t-fprules-softfp
rename to libgcc/config/i386/32/t-softfp
--- a/libgcc/config/i386/32/t-fprules-softfp
+++ b/libgcc/config/i386/32/t-softfp
@@ -1,6 +1,6 @@ 
 # Filter out TImode functions
 tifunctions = fixtfti.c fixunstfti.c floattitf.c floatuntitf.c
-tifunctions := $(addprefix $(gcc_srcdir)/config/soft-fp/, $(tifunctions))
+tifunctions := $(addprefix $(srcdir)/soft-fp/, $(tifunctions))
 
 LIB2ADD := $(filter-out $(tifunctions), $(LIB2ADD))
 
diff --git a/libgcc/config/i386/64/eqtf2.c b/libgcc/config/i386/64/eqtf2.c
--- a/libgcc/config/i386/64/eqtf2.c
+++ b/libgcc/config/i386/64/eqtf2.c
@@ -2,7 +2,7 @@ 
 #define __netf2 __netf2_shared
 #endif
 
-#include "config/soft-fp/eqtf2.c"
+#include "soft-fp/eqtf2.c"
 
 #ifdef SHARED
 #undef __netf2
diff --git a/libgcc/config/i386/64/getf2.c b/libgcc/config/i386/64/getf2.c
--- a/libgcc/config/i386/64/getf2.c
+++ b/libgcc/config/i386/64/getf2.c
@@ -2,7 +2,7 @@ 
 #define __gttf2 __gttf2_shared
 #endif
 
-#include "config/soft-fp/getf2.c"
+#include "soft-fp/getf2.c"
 
 #ifdef SHARED
 #undef __gttf2
diff --git a/libgcc/config/i386/64/letf2.c b/libgcc/config/i386/64/letf2.c
--- a/libgcc/config/i386/64/letf2.c
+++ b/libgcc/config/i386/64/letf2.c
@@ -2,7 +2,7 @@ 
 #define __lttf2 __lttf2_shared
 #endif
 
-#include "config/soft-fp/letf2.c"
+#include "soft-fp/letf2.c"
 
 #ifdef SHARED
 #undef __lttf2
diff --git a/libgcc/config/i386/64/t-softfp-compat b/libgcc/config/i386/64/t-softfp-compat
--- a/libgcc/config/i386/64/t-softfp-compat
+++ b/libgcc/config/i386/64/t-softfp-compat
@@ -4,7 +4,7 @@ 
 
 # Filter out the following TFmode functions.
 tf-compats = getf2.c letf2.c eqtf2.c
-tf-functions := $(addprefix $(gcc_srcdir)/config/soft-fp/, $(tf-compats))
+tf-functions := $(addprefix $(srcdir)/soft-fp/, $(tf-compats))
 LIB2ADD := $(filter-out $(tf-functions), $(LIB2ADD))
 LIB2ADD += $(addprefix $(srcdir)/config/i386/64/, $(tf-compats))
 
diff --git a/gcc/config/i386/sfp-machine.h b/libgcc/config/i386/sfp-machine.h
rename from gcc/config/i386/sfp-machine.h
rename to libgcc/config/i386/sfp-machine.h
diff --git a/gcc/config/ia64/sfp-machine.h b/libgcc/config/ia64/sfp-machine.h
rename from gcc/config/ia64/sfp-machine.h
rename to libgcc/config/ia64/sfp-machine.h
diff --git a/libgcc/config/ia64/t-fprules-softfp b/libgcc/config/ia64/t-softfp
rename from libgcc/config/ia64/t-fprules-softfp
rename to libgcc/config/ia64/t-softfp
diff --git a/gcc/config/lm32/sfp-machine.h b/libgcc/config/lm32/sfp-machine.h
rename from gcc/config/lm32/sfp-machine.h
rename to libgcc/config/lm32/sfp-machine.h
diff --git a/libgcc/config/lm32/t-softfp b/libgcc/config/lm32/t-softfp
new file mode 100644
--- /dev/null
+++ b/libgcc/config/lm32/t-softfp
@@ -0,0 +1,1 @@ 
+softfp_exclude_libgcc2 := n
diff --git a/libgcc/config/moxie/t-moxie-softfp b/libgcc/config/moxie/t-moxie-softfp
deleted file mode 100644
--- a/libgcc/config/moxie/t-moxie-softfp
+++ /dev/null
@@ -1,9 +0,0 @@ 
-softfp_float_modes := sf df
-softfp_int_modes := si di
-softfp_extensions := sfdf
-softfp_truncations := dfsf
-softfp_machine_header := moxie/sfp-machine.h
-softfp_exclude_libgcc2 := y
-
-# softfp seems to be missing a whole bunch of prototypes.
-TARGET_LIBGCC2_CFLAGS += -Wno-missing-prototypes
diff --git a/libgcc/config/no-sfp-machine.h b/libgcc/config/no-sfp-machine.h
new file mode 100644
--- /dev/null
+++ b/libgcc/config/no-sfp-machine.h
@@ -0,0 +1,1 @@ 
+/* Dummy sfp-machine.h header for targets that don't need one.  */
diff --git a/gcc/config/rs6000/darwin-ldouble-format b/libgcc/config/rs6000/ibm-ldouble-format
rename from gcc/config/rs6000/darwin-ldouble-format
rename to libgcc/config/rs6000/ibm-ldouble-format
diff --git a/gcc/config/rs6000/darwin-ldouble.c b/libgcc/config/rs6000/ibm-ldouble.c
rename from gcc/config/rs6000/darwin-ldouble.c
rename to libgcc/config/rs6000/ibm-ldouble.c
--- a/gcc/config/rs6000/darwin-ldouble.c
+++ b/libgcc/config/rs6000/ibm-ldouble.c
@@ -1,5 +1,5 @@ 
 /* 128-bit long double support routines for Darwin.
-   Copyright (C) 1993, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   Copyright (C) 1993, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -364,9 +364,9 @@  __gcc_qunord (double a, double aa, doubl
   return __unorddf2 (a, c);
 }
 
-#include "config/soft-fp/soft-fp.h"
-#include "config/soft-fp/double.h"
-#include "config/soft-fp/quad.h"
+#include "soft-fp/soft-fp.h"
+#include "soft-fp/double.h"
+#include "soft-fp/quad.h"
 
 /* Compute floating point multiply-subtract with higher (quad) precision.  */
 static double
diff --git a/gcc/config/rs6000/libgcc-ppc-glibc.ver b/libgcc/config/rs6000/libgcc-ppc-glibc.ver
rename from gcc/config/rs6000/libgcc-ppc-glibc.ver
rename to libgcc/config/rs6000/libgcc-ppc-glibc.ver
diff --git a/gcc/config/rs6000/libgcc-ppc64.ver b/libgcc/config/rs6000/libgcc-ppc64.ver
rename from gcc/config/rs6000/libgcc-ppc64.ver
rename to libgcc/config/rs6000/libgcc-ppc64.ver
diff --git a/gcc/config/rs6000/sfp-machine.h b/libgcc/config/rs6000/sfp-machine.h
rename from gcc/config/rs6000/sfp-machine.h
rename to libgcc/config/rs6000/sfp-machine.h
diff --git a/gcc/config/rs6000/t-freebsd b/libgcc/config/rs6000/t-freebsd
rename from gcc/config/rs6000/t-freebsd
rename to libgcc/config/rs6000/t-freebsd
--- a/gcc/config/rs6000/t-freebsd
+++ b/libgcc/config/rs6000/t-freebsd
@@ -18,8 +18,5 @@ 
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-# We do not want to build darwin-ldouble.c, so set the LIB2FUNCS_EXTRA again. 
-# Invoke this file after rs6000/t-ppccomm.
-
-LIB2FUNCS_EXTRA = tramp.S
-
+# We do not want to build ibm-ldouble.c.
+LIB2ADD := $(filter-out ibm-ldouble.c, $(LIB2ADD))
diff --git a/libgcc/config/rs6000/t-ibm-ldouble b/libgcc/config/rs6000/t-ibm-ldouble
new file mode 100644
--- /dev/null
+++ b/libgcc/config/rs6000/t-ibm-ldouble
@@ -0,0 +1,6 @@ 
+# GCC 128-bit long double support routines.
+LIB2ADD += $(srcdir)/config/rs6000/ibm-ldouble.c
+
+HOST_LIBGCC2_CFLAGS += -mlong-double-128
+
+SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc64.ver
diff --git a/libgcc/config/rs6000/t-ldbl128 b/libgcc/config/rs6000/t-ldbl128
--- a/libgcc/config/rs6000/t-ldbl128
+++ b/libgcc/config/rs6000/t-ldbl128
@@ -1,3 +1,3 @@ 
-SHLIB_MAPFILES += $(gcc_srcdir)/config/rs6000/libgcc-ppc-glibc.ver
+SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc-glibc.ver
 
 HOST_LIBGCC2_CFLAGS += -mlong-double-128
diff --git a/libgcc/config/rs6000/t-linux64 b/libgcc/config/rs6000/t-linux64
new file mode 100644
--- /dev/null
+++ b/libgcc/config/rs6000/t-linux64
@@ -0,0 +1,2 @@ 
+softfp_wrap_start := '\#ifndef __powerpc64__'
+softfp_wrap_end := '\#endif'
diff --git a/libgcc/config/rs6000/t-ppccomm b/libgcc/config/rs6000/t-ppccomm
--- a/libgcc/config/rs6000/t-ppccomm
+++ b/libgcc/config/rs6000/t-ppccomm
@@ -1,3 +1,5 @@ 
+LIB2ADD += $(srcdir)/config/rs6000/ibm-ldouble.c
+
 LIB2ADD_ST += crtsavfpr.S crtresfpr.S \
   crtsavgpr.S crtresgpr.S \
   crtresxfpr.S crtresxgpr.S \
diff --git a/libgcc/config/rs6000/t-ppccomm-ldbl b/libgcc/config/rs6000/t-ppccomm-ldbl
new file mode 100644
--- /dev/null
+++ b/libgcc/config/rs6000/t-ppccomm-ldbl
@@ -0,0 +1,1 @@ 
+LIB2ADD += $(srcdir)/config/rs6000/ibm-ldouble.c
diff --git a/gcc/config/score/sfp-machine.h b/libgcc/config/score/sfp-machine.h
rename from gcc/config/score/sfp-machine.h
rename to libgcc/config/score/sfp-machine.h
diff --git a/libgcc/config/t-softfp b/libgcc/config/t-softfp
--- a/libgcc/config/t-softfp
+++ b/libgcc/config/t-softfp
@@ -1,14 +1,109 @@ 
+# Copyright (C) 2006, 2007, 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/>.
+
+# Targets using soft-fp should define the following variables:
+#
+# softfp_float_modes: a list of soft-float floating-point modes,
+#                     e.g. sf df
+# softfp_int_modes: a list of integer modes for which to define conversions,
+#                   e.g. si di
+# softfp_extensions: a list of extensions between floating-point modes,
+#                    e.g. sfdf
+# softfp_truncations: a list of truncations between floating-point modes,
+#                     e.g. dfsf
+#
+# Extensions and truncations should include those where only one mode
+# is a soft-float mode; for example, sftf where sf is hard-float and
+# tf is soft-float.
+#
+# If the libgcc2.c functions should not be replaced, also define:
+#
+# softfp_exclude_libgcc2 := y
+#
+# Avoiding replacing the libgcc2.c functions is a temporary measure
+# for targets with both hard-float and soft-float multilibs, since
+# these variables apply for all multilibs.  With toplevel libgcc,
+# soft-fp can be used conditionally on the multilib instead.
+#
+# If the code should not be compiled at all for some multilibs, define:
+#
+# softfp_wrap_start: text to put at the start of wrapper source files,
+#                    output with echo
+#                    e.g. '#ifndef __powerpc64__'
+# softfp_wrap_end: text to put at the end of wrapper source files,
+#                  e.g. '#endif'
+#
+# This is another temporary measure.
+
+softfp_float_funcs = add$(m)3 div$(m)3 eq$(m)2 ge$(m)2 le$(m)2 mul$(m)3 \
+  neg$(m)2 sub$(m)3 unord$(m)2
+softfp_floatint_funcs = fix$(m)$(i) fixuns$(m)$(i) \
+  float$(i)$(m) floatun$(i)$(m)
+
+softfp_func_list := \
+  $(foreach m,$(softfp_float_modes), \
+              $(softfp_float_funcs) \
+              $(foreach i,$(softfp_int_modes), \
+                          $(softfp_floatint_funcs))) \
+  $(foreach e,$(softfp_extensions),extend$(e)2) \
+  $(foreach t,$(softfp_truncations),trunc$(t)2)
+
+ifeq ($(softfp_exclude_libgcc2),y)
+# This list is taken from mklibgcc.in and doesn't presently allow for
+# 64-bit targets where si should become di and di should become ti.
+softfp_func_list := $(filter-out floatdidf floatdisf fixunsdfsi fixunssfsi \
+  fixunsdfdi fixdfdi fixunssfdi fixsfdi fixxfdi fixunsxfdi \
+  floatdixf fixunsxfsi fixtfdi fixunstfdi floatditf \
+  floatundidf floatundisf floatundixf floatunditf,$(softfp_func_list))
+endif
+
+ifeq ($(softfp_wrap_start),)
+softfp_file_list := \
+  $(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_func_list)))
+else
+softfp_file_list := $(addsuffix .c,$(softfp_func_list))
+
+$(softfp_file_list):
+	echo $(softfp_wrap_start) > $@
+	echo '#include "soft-fp/$@"' >> $@
+	echo $(softfp_wrap_end) >> $@
+endif
+
 # Disable missing prototype and type limit warnings.  The prototypes
 # for the functions in the soft-fp files have not been brought across
 # from glibc.
 
-# cfr. srcdirify in gcc/Makefile.in
-soft-fp-files = $(filter $(gcc_srcdir)/config/soft-fp/%, $(LIB2ADD)) \
-	$(filter $(gcc_objdir)/config/soft-fp/%, $(LIB2ADD))
-
-soft-fp-objects-base = $(basename $(notdir $(soft-fp-files)))
-
-soft-fp-objects = $(addsuffix $(objext), $(soft-fp-objects-base)) \
-  $(addsuffix _s$(objext), $(soft-fp-objects-base))
+soft-fp-objects = $(addsuffix $(objext), $(softfp_file_list)) \
+  $(addsuffix _s$(objext), $(softfp_file_list))
 
 $(soft-fp-objects) : INTERNAL_CFLAGS += -Wno-missing-prototypes -Wno-type-limits
+
+LIB2ADD += $(softfp_file_list)
+
+ifneq ($(softfp_exclude_libgcc2),y)
+# Functions in libgcc2.c are excluded for each soft-float mode (a
+# target may have both soft-float and hard-float modes), for the fixed
+# list of integer modes (si and di) for which libgcc2.c defines any
+# such functions.  Depending on the target, the si and di symbols may
+# in fact define di and ti functions.
+
+LIB2FUNCS_EXCLUDE += \
+  $(addprefix _,$(foreach m,$(softfp_float_modes), \
+                            $(foreach i,si di, \
+                                        $(softfp_floatint_funcs))))
+endif
diff --git a/gcc/config/rs6000/t-fprules-softfp b/libgcc/config/t-softfp-sfdf
rename from gcc/config/rs6000/t-fprules-softfp
rename to libgcc/config/t-softfp-sfdf
--- a/gcc/config/rs6000/t-fprules-softfp
+++ b/libgcc/config/t-softfp-sfdf
@@ -2,5 +2,4 @@  softfp_float_modes := sf df
 softfp_int_modes := si di
 softfp_extensions := sfdf
 softfp_truncations := dfsf
-softfp_machine_header := rs6000/sfp-machine.h
 softfp_exclude_libgcc2 := y
diff --git a/gcc/config/i386/t-fprules-softfp b/libgcc/config/t-softfp-tf
rename from gcc/config/i386/t-fprules-softfp
rename to libgcc/config/t-softfp-tf
--- a/gcc/config/i386/t-fprules-softfp
+++ b/libgcc/config/t-softfp-tf
@@ -2,5 +2,4 @@  softfp_float_modes := tf
 softfp_int_modes := si di ti
 softfp_extensions := sftf dftf xftf
 softfp_truncations := tfsf tfdf tfxf
-softfp_machine_header := i386/sfp-machine.h
 softfp_exclude_libgcc2 := n
diff --git a/libgcc/configure b/libgcc/configure
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -557,6 +557,7 @@  asm_hidden_op
 extra_parts
 cpu_type
 tmake_file
+sfp_machine_header
 set_use_emutls
 set_have_cc_tls
 vis_hide
@@ -3986,6 +3987,17 @@  if test "$enable_tls $gcc_cv_use_emutls"
 fi
 
 
+# Conditionalize the sfp-machine.h header for this target machine.
+if test -z "${sfp_machine_header}"; then
+	sfp_machine_header=$cpu_type/sfp-machine.h
+	if test -f ${srcdir}/config/${sfp_machine_header}; then
+		:
+	else
+		sfp_machine_header=no-sfp-machine.h
+	fi
+fi
+
+
 # Conditionalize the makefile for this target machine.
 tmake_file_=
 for f in ${tmake_file}
@@ -4008,6 +4020,8 @@  ac_config_links="$ac_config_links unwind
 
 ac_config_links="$ac_config_links md-unwind-support.h:config/$md_unwind_header"
 
+ac_config_links="$ac_config_links sfp-machine.h:config/$sfp_machine_header"
+
 
 # We need multilib support.
 ac_config_files="$ac_config_files Makefile"
@@ -4736,6 +4750,7 @@  do
     "enable-execute-stack.c") CONFIG_LINKS="$CONFIG_LINKS enable-execute-stack.c:$enable_execute_stack" ;;
     "unwind.h") CONFIG_LINKS="$CONFIG_LINKS unwind.h:$unwind_header" ;;
     "md-unwind-support.h") CONFIG_LINKS="$CONFIG_LINKS md-unwind-support.h:config/$md_unwind_header" ;;
+    "sfp-machine.h") CONFIG_LINKS="$CONFIG_LINKS sfp-machine.h:config/$sfp_machine_header" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
 
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -266,6 +266,17 @@  if test "$enable_tls $gcc_cv_use_emutls"
 fi
 AC_SUBST(set_use_emutls)
 
+# Conditionalize the sfp-machine.h header for this target machine.
+if test -z "${sfp_machine_header}"; then
+	sfp_machine_header=$cpu_type/sfp-machine.h
+	if test -f ${srcdir}/config/${sfp_machine_header}; then
+		:
+	else
+		sfp_machine_header=no-sfp-machine.h
+	fi
+fi
+AC_SUBST(sfp_machine_header)
+
 # Conditionalize the makefile for this target machine.
 tmake_file_=
 for f in ${tmake_file}
@@ -285,6 +296,7 @@  AC_SUBST(asm_hidden_op)
 AC_CONFIG_LINKS([enable-execute-stack.c:$enable_execute_stack])
 AC_CONFIG_LINKS([unwind.h:$unwind_header])
 AC_CONFIG_LINKS([md-unwind-support.h:config/$md_unwind_header])
+AC_CONFIG_LINKS([sfp-machine.h:config/$sfp_machine_header])
 
 # We need multilib support.
 AC_CONFIG_FILES([Makefile])
diff --git a/gcc/config/soft-fp/README b/libgcc/soft-fp/README
rename from gcc/config/soft-fp/README
rename to libgcc/soft-fp/README
--- a/gcc/config/soft-fp/README
+++ b/libgcc/soft-fp/README
@@ -1,4 +1,4 @@ 
-Except for t-softfp, conversions involving TImode and conversions involving
+Except for conversions involving TImode and conversions involving
 XFmode, the files in this directory are part of the GNU C Library, not part
 of GCC.  As described at <http://gcc.gnu.org/codingconventions.html>, changes
 should be made to the GNU C Library and the changed files then imported