problem with crosstool 0.28-pre28 supplied patch for gcc 3.3.[23] softfloat on ARM
Lennert Buytenhek
buytenh@wantstofly.org
Sun Aug 8 21:00:00 GMT 2004
On Sun, Aug 08, 2004 at 10:58:49AM -0700, Dan Kegel wrote:
> > I still haven't applied this one, but I'd like to before 0.28.
> > Lennert, can you dig up or create a gcc bugzilla entry for this one, too?
>
> Oh, crap, that wouldn't make any sense; your patch is against my/Nico's
> patch, so the gcc folks wouldn't know what to make of it.
Yeah.
Nicolas Pitre released this patch for softfloat support against gcc 3.3:
http://lists.arm.linux.org.uk/pipermail/linux-arm/2003-October/006436.html
This is what I understand of float-on-arm in general:
- FPA is big endian float word ordering, even on little endian platforms.
- VFP is native endian float word ordering.
This is what I understood of Nicolas' intention:
- -mhard-float would give the same behaviour as before the patch
- -msoft-float would give FPA behaviour
- no option would give VFP
(Is this accurate?)
Then I find that crosstool 0.28-rc28 contains a patch from Robert Schwebel,
which is basically Nicolas' patch with two such hunks added:
<patch>
diff -urN gcc-3.3.2/gcc/config/arm/elf.h gcc-3.3.2-ptx/gcc/config/arm/elf.h
--- gcc-3.3.2/gcc/config/arm/elf.h 2002-11-21 22:29:24.000000000 +0100
+++ gcc-3.3.2-ptx/gcc/config/arm/elf.h 2004-01-31 12:27:28.000000000 +0100
@@ -46,7 +46,7 @@
#ifndef SUBTARGET_ASM_FLOAT_SPEC
#define SUBTARGET_ASM_FLOAT_SPEC "\
-%{mapcs-float:-mfloat} %{msoft-float:-mno-fpu}"
+%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa -mfpu=softvfp}"
#endif
#ifndef ASM_SPEC
</patch>
Robert justifies this patch with:
# The patch had to be extended by the first two hunks below, otherwhise
# the compiler claimed a mixup of old and new style FPU options while
# compiling U-Boot.
But it didn't seem right to me -- it would seem that when -msoft-float
is specified, it evaluates to "-mfpu=softfpa -mfpu=softvfp" (essentially
specifying two conflicting options) and otherwise to "", no?
In any case, binaries generated with crosstool 0.28-rc28's
arm-softfloat-linux gcc 3.3.3 are not marked softfloat at all.
So I changed the abovementioned hunk to this:
<patch>
diff -urN gcc-3.3.2/gcc/config/arm/elf.h gcc-3.3.2-ptx/gcc/config/arm/elf.h
--- gcc-3.3.2/gcc/config/arm/elf.h 2002-11-21 22:29:24.000000000 +0100
+++ gcc-3.3.2-ptx/gcc/config/arm/elf.h 2004-01-31 12:27:28.000000000 +0100
@@ -46,7 +46,7 @@
#ifndef SUBTARGET_ASM_FLOAT_SPEC
#define SUBTARGET_ASM_FLOAT_SPEC "\
-%{mapcs-float:-mfloat} %{msoft-float:-mno-fpu}"
+%{mapcs-float:-mfloat} %{mhard-float:-mfpu=fpa} %{!mhard-float:%{msoft-float:-mfpu=softfpa}} %{!mhard-float:%{!msoft-float:-mfpu=softvfp}}"
#endif
#ifndef ASM_SPEC
</patch>
I'm not sure that this is right either, but it did give me the
behaviour of marking binaries -fpu=softvfp by default, which is I
think what Nicolas had intended. I went the route of building my
userland (Fedora Core 2) with VFP.
> I guess what I should have asked was:
> 1) have you gotten any feedback on the patch from Nicolas Pitre?
No.
> 2) does gcc-3.4.x have a similar problem?
gcc 3.4.0 has this (gcc/config/arm/elf.h):
#ifndef SUBTARGET_ASM_FLOAT_SPEC
#define SUBTARGET_ASM_FLOAT_SPEC "\
%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
#endif
No mention of VFP. So I guess that FPA is the official cast-in-stone-now
standard float ordering format on Linux/ARM. And perhaps crosstool should
indeed generate FPA binaries, if only because of backward compatibility and
ABI stuff. I guess I should have used FPA also from the start.
In either case, Robert's patch seems wrong.
cheers,
Lennert
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list