This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem with crosstool 0.28-pre28 supplied patch for gcc 3.3.[23]softfloat on ARM


Lennert wrote:
I think [http://kegel.com/crosstool/crosstool-0.28-rc26/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch,
which was based on Nico's patch, is] subtly buggy in the case where neither -mhard-float
nor -msoft-float is used while compiling. Look at this spec file patch
fragment, for example:


#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
What do you think "%{msoft-float:-mfpu=softfpa -mfpu=softvfp}" does?


If you think that it evaluates to '-mfpu=softvfp' in case there is
no -msoft-float given, you're wrong -- as it is, it either evaluates
to '-mfpu=softfpa -mfpu=softvfp' (if -msoft-float is specified), or
to '' (if -msoft-float is not specified.)

I think that Nicolas Pitre's original intention was that -mhard-float
results in -mfpu=fpa, -msoft-float gives you -mfpu=softfpa (for binary
compatibility with older stuff) and no -mxxxx-float option specified
gives -mfpu=softvfp.  (Right?)

But try compiling a gcc 3.3.3 ARM softfloat toolchain with crosstool
0.28-pre28 and then generating some binaries.  You'll be able to see
(using objdump --all | grep private) that the resulting binaries are
not marked softfloat at all, which gives all kinds of trouble when you
try to link them against binaries which _are_ marked softfloat.  After
applying the patch below, the resulting binaries are indeed marked as
softvfp as they should.

Any objections against the patch?  (I've not yet verified whether it
still does the right thing in the -mhard-float case.) ...
>>
>> diff -urN crosstool-0.28-rc28.orig/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch crosstool-0.28-rc28.softfloat/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch
>>
>> --- crosstool-0.28-rc28.orig/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch   2004-05-30 07:45:49.000000000 +0200
>> +++ crosstool-0.28-rc28.softfloat/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch    2004-07-15 04:25:23.821969984 +0200
>> @@ -31,7 +31,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}"
>> ++%{mapcs-float:-mfloat} %{mhard-float:-mfpu=fpa} %{!mhard-float:%{msoft-float:-mfpu=softfpa}} %{!mhard-float:%{!msoft-float:-mfpu=softvfp}}
> ...

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.
I guess what I should have asked was:
1) have you gotten any feedback on the patch from Nicolas Pitre?
2) does gcc-3.4.x have a similar problem?

Thanks,
Dan

p.s. Here's Lennert's full patch (possibly with tabs munged, apologies):

diff -urN crosstool-0.28-rc28.orig/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch crosstool-0.28-rc28.softfloat/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch
--- crosstool-0.28-rc28.orig/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch	2004-05-30 07:45:49.000000000 +0200
+++ crosstool-0.28-rc28.softfloat/patches/gcc-3.3.2/gcc-3.3.2-arm-softfloat.patch	2004-07-15 04:25:23.821969984 +0200
@@ -31,7 +31,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}"
++%{mapcs-float:-mfloat} %{mhard-float:-mfpu=fpa} %{!mhard-float:%{msoft-float:-mfpu=softfpa}} %{!mhard-float:%{!msoft-float:-mfpu=softvfp}}
  #endif

  #ifndef ASM_SPEC
@@ -43,7 +43,7 @@
  #endif

 -#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} %{!mhard-float:-mno-fpu}"
-+#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} %{!mhard-float:-mfpu=softfpa -mfpu=softvfp}"
++#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} %{hard-float:-mfpu=fpa} %{!mhard-float:%{msoft-float:-mfpu=softfpa}} %{!mhard-float:%{!msoft-float:-mfpu=softvfp}}"

  #ifndef MULTILIB_DEFAULTS
  #define MULTILIB_DEFAULTS \
@@ -74,7 +74,7 @@
 +#undef  SUBTARGET_EXTRA_ASM_SPEC
 +#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
 +  %{mhard-float:-mfpu=fpa} \
-+  %{!mhard-float: %{msoft-float:-mfpu=softfpa -mfpu=softvfp}}"
++  %{!mhard-float: %{msoft-float:-mfpu=softfpa}} %{!mhard-float: %{!msoft-float:-mfpu=softvfp}}"

#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"

diff -urN crosstool-0.28-rc28.orig/patches/gcc-3.3.3/gcc-3.3.2-arm-softfloat.patch crosstool-0.28-rc28.softfloat/patches/gcc-3.3.3/gcc-3.3.2-arm-softfloat.patch
--- crosstool-0.28-rc28.orig/patches/gcc-3.3.3/gcc-3.3.2-arm-softfloat.patch	2004-06-24 06:49:24.000000000 +0200
+++ crosstool-0.28-rc28.softfloat/patches/gcc-3.3.3/gcc-3.3.2-arm-softfloat.patch	2004-07-15 04:26:35.417661109 +0200
@@ -31,7 +31,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}"
++%{mapcs-float:-mfloat} %{mhard-float:-mfpu=fpa} %{!mhard-float:%{msoft-float:-mfpu=softfpa}} %{!mhard-float:%{!msoft-float:-mfpu=softvfp}}"
  #endif

  #ifndef ASM_SPEC
@@ -43,7 +43,7 @@
  #endif

 -#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} %{!mhard-float:-mno-fpu}"
-+#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} %{!mhard-float:-mfpu=softfpa -mfpu=softvfp}"
++#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} %{mhard-float:-mfpu=fpa} %{!mhard-float:%{msoft-float:-mfpu=softfpa}} %{!mhard-float:%{!msoft-float:-mfpu=softvfp}}"

  #ifndef MULTILIB_DEFAULTS
  #define MULTILIB_DEFAULTS \
@@ -74,7 +74,7 @@
 +#undef  SUBTARGET_EXTRA_ASM_SPEC
 +#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
 +  %{mhard-float:-mfpu=fpa} \
-+  %{!mhard-float: %{msoft-float:-mfpu=softfpa -mfpu=softvfp}}"
++  %{!mhard-float: %{msoft-float:-mfpu=softfpa}} %{!mhard-float: %{!msoft-float:-mfpu=softvfp}}"

#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"


-- My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]