gcc 3.3.5 arm-elf .. which multilib for soft-float?

Joel Sherrill <joel@OARcorp.com> joel.sherrill@OARcorp.com
Tue Nov 2 12:25:00 GMT 2004


Richard Earnshaw wrote:
> On Tue, 2004-11-02 at 00:21, Joel Sherrill  wrote:
> 
>>Hi,
>>
>>It looks like btween gcc 3.3.3 and 3.3.5, the file config/arm/t-arm-elf
>>was reworked.  I am getting linking errors which indicate that the
>>default libc.a is hard-float.
>>
>>The gcc documentation states that -mhard-float is the default for the
>>compiler and I only see these libc.a's
>>
> 
> 
> -mhard-float has *never* been the default for the arm-elf
> configuration.  In fact, AFAIK the only supported configuration of gcc
> on ARM that still uses the FPA hard-float format is Linux.

I rather suspected this because I didn't recall any RTEMS user CPU model
I had ever looked at having hard float.

But the gcc documentation states that hard-float is ALWAYS the default:

`-mhard-float'
      Generate output containing floating point instructions.  This is
      the default.

`-msoft-float'
      Generate output containing library calls for floating point.
      *Warning:* the requisite libraries are not available for all ARM
      targets.  Normally the facilities of the machine's usual C
      compiler are used, but this cannot be done directly in
      cross-compilation.  You must make your own arrangements to provide
      suitable library functions for cross-compilation.

      `-msoft-float' changes the calling convention in the output file;
      therefore, it is only useful if you compile _all_ of a program with
      this option.  In particular, you need to compile `libgcc.a', the
      library that comes with GCC, with `-msoft-float' in order for this
      to work.


>>./lib/thumb/libc.a
>>./lib/libc.a
>>
> 
> 
> Hard float doesn't (can't) work with Thumb (there are no instructions to
> access the co-processor space).  Building the hard-float libraries is
> disabled by default because virtually nobody wants them (why would they?
> soft-float code runs faster when you don't have an FPA, and the only
> chip to have that was the ARM7500FE).

OK.  I suspected that about the FPA and Thumb.

Given all that, why can't I link code when I use the -msoft-float flag.
 From your description, it is redundant but it results in a string
of link errors like this:

/../../arm-rtems4.7/bin/ld: failed to merge target specific data of file 
/opt/rtems-4.7/lib/gcc-lib/arm-rtems4.7/3.3.5/libgcc.a(_pack_sf.o)

$ cat j.c
#include <math.h>
float f( float x)
{
   return sin(x);

}

$ /opt/rtems-4.7/bin/arm-rtems4.7-gcc j.c -O2 -lm
# WORKS
$ /opt/rtems-4.7/bin/arm-rtems4.7-gcc -msoft-float  j.c -O2 -lm
# FAILS with ERRORS

Shouldn't specifying -msoft-float still result in a correct
program that links.  Specifying CPU FLAGS which match the default
multilib should still work.

--joel



More information about the Gcc mailing list