[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#525261: use of FPU_SETCW or FPU_GETCW causes illegal instruction on armel



clone 525261 -1
reassign -1 gerris
retitle -1 gerris should use <fenv.h> instead of <fpu_control.h>
thanks

Martin Guy a écrit :
> Package: glibc
> Version: 2.9-7
> 
> /usr/include/fpu_control.h on armel defines FPU_[SG]ETCW as VFP
> coprocessor instructions, whereas armel is soft-float.
> 
> #define _FPU_GETCW(cw) \
>   __asm__ __volatile__ ("mrc p10, 7, %0, cr1, cr0, 0" : "=r" (cw))
> /* This is fmxr fpscr, %0.  */
> #define _FPU_SETCW(cw) \
>   __asm__ __volatile__ ("mcr p10, 7, %0, cr1, cr0, 0" : : "r" (cw))
> 
> Packages that use these cause an illegal instruction trap on hardware
> that does not have a VFP unit (and misleadingly set the FPU control
> word on those that do, while softfloat remains unaffected).
> 
> This was highlighted by build failure of gerris - see Drew Parsons' messages in
> http://lists.debian.org/debian-arm/2009/04/msg00018.html
> He suggests that the right thing for fpu_control.h may be simply not
> to define these macros but I don't know if that's right.
> 

According to upstream these macros from fpu_control.h are inherently
nonportable and should only be used by code that knows it is being built
for a particular FPU and knows about how to use it.  Normal code should
use <fenv.h> instead.

The solution is probably to not define those macros on ARM EABI, so that
it causes a build failure. I am therefore cloning the bug tho gerris, so
that <fenv.h> is used instead of <fpu_control.h>.

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net



Reply to: