PATCH : SH target fails on isnan() for m4-single-only
J. Johnston
jjohnstn@cygnus.com
Thu Nov 1 11:50:00 GMT 2001
Arati Dikey wrote:
>
> Hi,
> My toolchain is built using -binutils 2.11.2, gcc-2.95.3, newlib-1.9.0
> (--enable-hw-fp)
> When tested with normal floating point operations like
>
> float f1,f2,f3,f4,f5;
> char szMessage[400];
>
> long count=0;
> long cutoff=10000;
>
> f1 = (float)pi;
> f2 = naturalno;
> f3 = f1*f2;
> f4 = f1/f2;
> f5 = 3.546328763478;
>
> sprintf(szMessage,"f1 = %3.6f f2 = %3.6f f3= %3.6f f4 = %3.6f f5 =
> %3.6f",f1,f2,f3,f4,f5);
>
> This program when compiled with -m4-single-only by sh-elf-gcc gives the
> following error :
> sh-elf-ld -To6.lnk -o o6.out start.o o6.o -lc -lgcc -lc -lgcc
> /usr/sh-run/sh-elf2.95.3patch/sh-elf/lib/m4-single-only/libc.a(vfprintf.o):
> In function `vfprintf_r':
> /home/kpit/fsfsrc/newlib-1.9.0/newlib/libc/stdio/vfprintf.c:639: undefined
> reference to `isinf'
> /home/kpit/fsfsrc/newlib-1.9.0/newlib/libc/stdio/vfprintf.c:639: undefined
> reference to `isnan'
> make: *** [o6.out] Error 1
> Ensured that -L option to sh-elf-ld is proper.
>
> After studying files in math and mathfp directory, I have written the
> following patch.
> Please guide me on this.
>
The attached modified version of your patch has been applied with the following
ChangeLog.
2001-11-01 Arati Dikey <aratidikey@hotmail.com>
* libm/mathfp/sf_isinf.c (isinff): Change to use _DEFUN macro.
[_DOUBLE_IS_32BITS](isinf): New function that calls isinff.
* libm/mathfp/sf_isnan.c (isnanf): Change to use _DEFUN macro.
[_DOUBLE_IS_32BITS](isnan): New function that calls isnanf.
-- Jeff J.
Index: libm/mathfp/sf_isinf.c
===================================================================
RCS file: /cvs/src/src/newlib/libm/mathfp/sf_isinf.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sf_isinf.c
--- libm/mathfp/sf_isinf.c 2000/02/17 19:39:52 1.1.1.1
+++ libm/mathfp/sf_isinf.c 2001/11/01 19:41:38
@@ -18,7 +18,9 @@
#include "fdlibm.h"
#include "zmath.h"
-int isinff (float x)
+int
+_DEFUN (isinff, (float),
+ float x)
{
__uint32_t wx;
int exp;
@@ -31,3 +33,16 @@
else
return (0);
}
+
+#ifdef _DOUBLE_IS_32BITS
+
+int
+_DEFUN (isinf, (double),
+ double x)
+{
+ return isinff ((float) x);
+}
+
+#endif /* defined(_DOUBLE_IS_32BITS) */
+
+
Index: libm/mathfp/sf_isnan.c
===================================================================
RCS file: /cvs/src/src/newlib/libm/mathfp/sf_isnan.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sf_isnan.c
--- libm/mathfp/sf_isnan.c 2000/02/17 19:39:52 1.1.1.1
+++ libm/mathfp/sf_isnan.c 2001/11/01 19:41:38
@@ -18,7 +18,9 @@
#include "fdlibm.h"
#include "zmath.h"
-int isnanf (float x)
+int
+_DEFUN (isnanf, (float),
+ float x)
{
__int32_t wx;
int exp;
@@ -31,3 +33,16 @@
else
return (0);
}
+
+
+#ifdef _DOUBLE_IS_32BITS
+
+int
+_DEFUN (isnan, (double),
+ double x)
+{
+ return isnanf((float) x);
+}
+
+#endif /* defined(_DOUBLE_IS_32BITS) */
+
More information about the Newlib
mailing list