diff mbox

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

Message ID yddsjpimw5y.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Aug. 3, 2011, 2:01 p.m. UTC
Joseph,

> 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.)

thanks for the thorough explanation.  Based on that, I've changed the
default in t-softfp-sfdf and added a separate t-softfp-excl for those
targets that currently need it.

> 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.

Indeed, that simplifies the file quite a bit.

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

We've got two uses left right now:

* libgcc/config/arm/t-softfp has #ifdef __ARM_ARCH_6M__.  One could
  probably use AC_EGREP_CPP([__ARM_ARCH_6M__], , [arm_arch_6m=true]) in
  configure.ac instead, but this is completely untested.

* libgcc/config/rs6000/t-linux64 has #ifndef __powerpc64__.  Again, one
  could either check for __powerpc64__ or perform a long_type_size check
  along the double_type_size etc. checks in the fp-bit patch.

I'm impartial about how to handle this, but would rather get the patch
in and perform cleanup later than delay even more.

> 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.

True: I had already done so on Solaris/x86 with pvs -dsvo output, and
repeated the exercise on Linux/x86_64 with the readelf invocation from
libstdc++-v3/scripts/extract_symvers.in.  No change in both cases.

So here's the resulting patch, incorporating e.g. the c6x port that has
been committed since the original one.

As the two others, bootstrapped without regressions on
x86_64-unknown-linux-gnu.  Bootstraps on i386-pc-solaris2.10,
sparc-sun-solaris2.11, alpha-dec-osf5.1b, mips-sgi-irix6.5, and
i386-apple-darwin9.8.0 still running.

Ok for mainline if they pass?

Thanks.
        Rainer


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

Comments

Paolo Bonzini Aug. 5, 2011, 6:53 a.m. UTC | #1
On 08/03/2011 04:01 PM, Rainer Orth wrote:
>> Configure tests could also make a better replacement for softfp_wrap_start
>> and softfp_wrap_end.
>
> We've got two uses left right now:
>
> * libgcc/config/arm/t-softfp has #ifdef __ARM_ARCH_6M__.  One could
>    probably use AC_EGREP_CPP([__ARM_ARCH_6M__], , [arm_arch_6m=true]) in
>    configure.ac instead, but this is completely untested.

It would have to be something like this:

AC_EGREP_CPP([win win win], [#ifdef __ARM_ARCH_6M__
win win win
#endif], [arm_arch_6m=true])

However, this cannot be in config.host because that file is sourced 
rather than m4_included.

Alternatively, we can make a list of desired symbols and test them in 
configure.ac:

arm-*-*)
   ...
   libgcc_cpp_symbols="$libgcc_cpp_symbols __ARM_ARCH_6M__"
   tmake_file="$tm_file arm/t-softfp"
   ;;

...

# in configure.ac:
# Look for preprocessor symbols that can be useful
cpp_symbols=
if test -n "$libgcc_cpp_symbols"; then
   for i in $libgcc_cpp_symbols; do
     AC_EGREP_CPP([win win win], [#ifdef $i
       win win win
     #endif], [AS_VAR_APPEND([cpp_symbols], [ $i])])
   done
fi
AC_SUBST([cpp_symbols])

...

# config/arm/t-softfp
ifneq ($(filter __ARM_ARCH_6M__, $(cpp_symbols)),)
include ../t-softfp-sfdf
include ../t-softfp-excl
include ../t-softfp
endif

> * libgcc/config/rs6000/t-linux64 has #ifndef __powerpc64__.  Again, one
>    could either check for __powerpc64__ or perform a long_type_size check
>    along the double_type_size etc. checks in the fp-bit patch.

Yes, that's better than using a preprocessor symbol in this case:

> I'm impartial about how to handle this, but would rather get the patch
> in and perform cleanup later than delay even more.

Agreed.

> As the two others, bootstrapped without regressions on
> x86_64-unknown-linux-gnu.  Bootstraps on i386-pc-solaris2.10,
> sparc-sun-solaris2.11, alpha-dec-osf5.1b, mips-sgi-irix6.5, and
> i386-apple-darwin9.8.0 still running.
>
> Ok for mainline if they pass?

Yes, thank you very much!

Paolo
Rainer Orth Aug. 5, 2011, 9:50 a.m. UTC | #2
Paolo Bonzini <bonzini@gnu.org> writes:

> On 08/03/2011 04:01 PM, Rainer Orth wrote:
>>> Configure tests could also make a better replacement for softfp_wrap_start
>>> and softfp_wrap_end.
>>
>> We've got two uses left right now:
>>
>> * libgcc/config/arm/t-softfp has #ifdef __ARM_ARCH_6M__.  One could
>>    probably use AC_EGREP_CPP([__ARM_ARCH_6M__], , [arm_arch_6m=true]) in
>>    configure.ac instead, but this is completely untested.
>
> It would have to be something like this:
>
> AC_EGREP_CPP([win win win], [#ifdef __ARM_ARCH_6M__
> win win win
> #endif], [arm_arch_6m=true])
>
> However, this cannot be in config.host because that file is sourced rather
> than m4_included.

It was meant to go into configure.ac directly.

> Alternatively, we can make a list of desired symbols and test them in
> configure.ac:
>
> arm-*-*)
>   ...
>   libgcc_cpp_symbols="$libgcc_cpp_symbols __ARM_ARCH_6M__"
>   tmake_file="$tm_file arm/t-softfp"
>   ;;
>
> ...
>
> # in configure.ac:
> # Look for preprocessor symbols that can be useful
> cpp_symbols=
> if test -n "$libgcc_cpp_symbols"; then
>   for i in $libgcc_cpp_symbols; do
>     AC_EGREP_CPP([win win win], [#ifdef $i
>       win win win
>     #endif], [AS_VAR_APPEND([cpp_symbols], [ $i])])
>   done
> fi
> AC_SUBST([cpp_symbols])
>
> ...
>
> # config/arm/t-softfp
> ifneq ($(filter __ARM_ARCH_6M__, $(cpp_symbols)),)
> include ../t-softfp-sfdf
> include ../t-softfp-excl
> include ../t-softfp
> endif

That looks like a very useful and general approach.

>> * libgcc/config/rs6000/t-linux64 has #ifndef __powerpc64__.  Again, one
>>    could either check for __powerpc64__ or perform a long_type_size check
>>    along the double_type_size etc. checks in the fp-bit patch.
>
> Yes, that's better than using a preprocessor symbol in this case:

Ok.

>> I'm impartial about how to handle this, but would rather get the patch
>> in and perform cleanup later than delay even more.
>
> Agreed.

Fine, thanks.  I'll work on the cleanups after I've beaten the whole
series in shape.  Right now, I've got those:

* SHLIB_* is close.

* crtstuff.c and extra_parts need a look-over.

* LIB1* and LIB2*/LIBGCC2* likewise.

* Before TARGET_LIBGCC2_CFLAGS can be removed,
  gcc/ada/gcc-interface/Makefile.in's use of it (which only needs
  PICFLAG, AFAICT) needs changing.  Right now, only three libraries may
  be built PIC, but don't use libtool: libiberty, libgcc_s, and
  libgnat/libgnarl.  Since I very much doubt that moving them to use
  libtool will get much traction, I suggest to at least centralize
  configuration of PICFLAG (in toplevel config/picflag.m4).  I've got an
  initial patch for that, but need to merge the data from libiberty and
  libgcc to complete it.

>> As the two others, bootstrapped without regressions on
>> x86_64-unknown-linux-gnu.  Bootstraps on i386-pc-solaris2.10,
>> sparc-sun-solaris2.11, alpha-dec-osf5.1b, mips-sgi-irix6.5, and
>> i386-apple-darwin9.8.0 still running.
>>
>> Ok for mainline if they pass?
>
> Yes, thank you very much!

Thanks, both for the review and the helpful suggestions.

	Rainer
diff mbox

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -734,9 +734,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 =
 
@@ -1864,7 +1861,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
@@ -868,7 +868,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"
@@ -886,12 +885,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
@@ -917,17 +914,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"
@@ -1025,17 +1019,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*)
@@ -1651,16 +1645,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}"
@@ -2048,8 +2042,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*)
@@ -2135,7 +2129,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" ;;
@@ -2269,7 +2263,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* | \
@@ -2571,7 +2565,6 @@  tic6x-*-elf)
 	tm_file="${tm_file} dbxelf.h tm-dwarf2.h newlib-stdint.h"
 	libgcc_tm_file="${libgcc_tm_file} c6x/c6x-abi.h"
 	tmake_file="c6x/t-c6x c6x/t-c6x-elf"
-	tmake_file="${tmake_file} c6x/t-c6x-softfp soft-fp/t-softfp"
 	use_collect2=no
 	;;
 tic6x-*-uclinux)
@@ -2581,7 +2574,6 @@  tic6x-*-uclinux)
 	libgcc_tm_file="${libgcc_tm_file} c6x/c6x-abi.h"
 	tmake_file="t-slibgcc-elf-ver t-sysroot-suffix"
 	tmake_file="${tmake_file} c6x/t-c6x c6x/t-c6x-elf c6x/t-c6x-uclinux"
-	tmake_file="${tmake_file} c6x/t-c6x-softfp soft-fp/t-softfp"
 	use_collect2=no
 	;;
 v850*-*-*)
@@ -3585,24 +3577,19 @@  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"
+		tmake_file="${tmake_file} 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/c6x/t-c6x-softfp b/gcc/config/c6x/t-c6x-softfp
deleted file mode 100644
--- a/gcc/config/c6x/t-c6x-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 := c6x/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/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 = \
@@ -36,8 +35,5 @@  LIB2FUNCS_STATIC_EXTRA = \
 # 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".
@@ -282,6 +285,7 @@  arm*-*-linux*)			# ARM GNU/Linux with EL
 	  unwind_header=config/arm/unwind-arm.h
 	  ;;
 	esac
+	tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
 	;;
 arm*-*-uclinux*)		# ARM ucLinux
 	tmake_file="${tmake_file} t-fixedpoint-gnu-prefix"
@@ -291,8 +295,10 @@  arm*-*-uclinux*)		# ARM ucLinux
 	  unwind_header=config/arm/unwind-arm.h
 	  ;;
 	esac
+	tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
 	;;
 arm*-*-ecos-elf)
+	tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
 	;;
 arm*-*-eabi* | arm*-*-symbianelf* )
 	tmake_file="${tmake_file} t-fixedpoint-gnu-prefix"
@@ -304,11 +310,14 @@  arm*-*-eabi* | arm*-*-symbianelf* )
 	  tmake_file="${tmake_file} arm/t-symbian"
 	  ;;
 	esac
+	tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
 	unwind_header=config/arm/unwind-arm.h
 	;;
 arm*-*-rtems*)
+	tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
 	;;
 arm*-*-elf)
+	tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
 	;;
 arm*-wince-pe*)
 	;;
@@ -318,7 +327,6 @@  avr-*-rtems*)
 avr-*-*)
 	# Make HImode functions for AVR
 	tmake_file="${cpu_type}/t-avr t-fpbit"
-
 	;;
 bfin*-elf*)
 	tmke_file=t-fdpbit
@@ -464,7 +472,7 @@  ia64*-*-freebsd*)
 	;;
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 t-crtfm 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-crtfm 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
@@ -482,11 +490,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 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 t-softfp"
 	;;	
 m32r-*-elf*|m32r-*-rtems*)
 	tmake_file=t-fdpbit
@@ -587,7 +595,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-excl t-softfp"
 	extra_parts="crtbegin.o crtend.o crti.o crtn.o"
 	;;
 pdp11-*-*)
@@ -606,13 +614,15 @@  powerpc-*-darwin*)
 	  md_unwind_header=rs6000/darwin-unwind.h
 	  ;;
 	esac
+	tmake_file="$tmake_file rs6000/t-ibm-ldouble"
 	extra_parts="$extra_parts crt2.o"
 	;;
 powerpc64-*-darwin*)
+	tmake_file="$tmake_file rs6000/t-ibm-ldouble"
 	extra_parts="$extra_parts crt2.o"
 	;;
 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-excl t-softfp"
 	;;
 powerpc-*-netbsd*)
 	;;
@@ -620,56 +630,56 @@  powerpc-*-eabispe*)
 	tmake_file="${tmake_file} rs6000/t-ppccomm"
 	;;
 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-softfp-excl 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"
@@ -688,6 +698,7 @@  s390x-ibm-tpf*)
 	md_unwind_header=s390/tpf-unwind.h
 	;;
 score-*-elf)
+	tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp"
         ;;
 sh-*-elf* | sh[12346l]*-*-elf* | \
   sh-*-linux* | sh[2346lbe]*-*-linux* | \
@@ -774,7 +785,7 @@  spu-*-elf*)
 	tmake_file="t-fdpbit spu/t-elf"
 	;;
 tic6x-*-*)
-	tmake_file="${tmake_file} t-gnu-prefix"
+	tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl t-softfp t-gnu-prefix"
 	;;
 v850*-*-*)
 	tmake_file=t-fdpbit
@@ -829,8 +840,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"
 	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
+	tmake_file="${tmake_file} t-softfp"
 	;;
 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/gcc/config/c6x/sfp-machine.h b/libgcc/config/c6x/sfp-machine.h
rename from gcc/config/c6x/sfp-machine.h
rename to libgcc/config/c6x/sfp-machine.h
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,8 +1,5 @@ 
-# Filter out TImode functions
-tifunctions = fixtfti.c fixunstfti.c floattitf.c floatuntitf.c
-tifunctions := $(addprefix $(gcc_srcdir)/config/soft-fp/, $(tifunctions))
-
-LIB2ADD := $(filter-out $(tifunctions), $(LIB2ADD))
+# Omit TImode functions
+softfp_int_modes := si di
 
 # Provide fallbacks for __builtin_copysignq and __builtin_fabsq.
 LIB2ADD += $(srcdir)/config/i386/32/tf-signs.c
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/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/libgcc/config/t-softfp-excl b/libgcc/config/t-softfp-excl
new file mode 100644
--- /dev/null
+++ b/libgcc/config/t-softfp-excl
@@ -0,0 +1,1 @@ 
+softfp_exclude_libgcc2 := y
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
+softfp_exclude_libgcc2 := n
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.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -273,6 +273,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}
@@ -292,6 +303,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