[uClibc]ARM floating-point and setjmp/longjmp

Shane Nay shane at minirl.com
Thu Feb 21 07:06:48 UTC 2002


There are two solutions-
1) Softfloat toolchain-  Basically you compile everything with 
-msoft-softfloat and link it with libfloat.a.
2) Hardfloat toolchain- Use a kernel with support for floating points.

Basically the way the hardfloat solution works is that you get that 
illegal instruction error which floats to the kernel, the kernel 
checks the source of the error and does the computation itself.

The advantage of the hardfloat solution is that the code size per 
application is reduced.  The advantage of the softfloat solution is 
that it gives better performance because you don't have to raise an 
exception for each floating point computation.

If you want further help with hardfloat, you will have to post all 
the details of your operating system enviroment.

Thanks,
Shane Nay.

On Wednesday 20 February 2002 12:56, Stefan Soucek wrote:
> Hi,
>
> I ran into the problem of crashing our system with an "illegal
> instruction" when running the setjmp_test.c in uClibc. We are using
> an MMU-less ARM (v4 arch) w/o hardware floating-point support. We
> want software FP though, and therefore have
>
> HAS_FLOATING_POINT = true
>
> in Config.arm. It turns out that this setting translates into a
>
> #define __UCLIBC_HAS_FLOATS__ 1
>
> However, in arm/setjmp.S the opcode SFM is used to store the FP
> registers and in arm/__longjmp.S its counterpart LFM to restore
> them if __UCLIBC_HAS_FLOATS__ is defined. e.g. from setjmp.S:
>
> __sigsetjmp:
> 	/* Save registers */
> #ifdef __UCLIBC_HAS_FLOATS__NOTWITHARM9TDMI
> 	sfmea   f4, 4, [r0]!
> #endif
>
> This throws an "illegal instruction" on systems that don't have the
> FP hardware support.
>
> I fixed this temporariliy by removing the FP opcodes and the set
> jump test runs happily ever after. My intuition to solve the
> problem would be to introduce some config variable like HAVE_FPU
> which turns into a __UCLIBC_HAS_FPU__ and use the latter in
> __sigsetjmp and __longjmp instead.
>
> What do you guys think?
>
> -Stefan



More information about the uClibc mailing list