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


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

Re: PATCH : SH target fails on isnan() for m4-single-only


You may want to try linking with libm.a instead of modifying the
header files.

Toshi


> 
> 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.
> 
> 
> Thanks in advance.
> Regards,
> Arati Dikey
> ----------------------------------------------------------------------------
> ---------------------------
> --- /newlib-1.9.0/newlib/libm/mathfp/sf_isnan.c Fri Feb 18 01:09:52 2000
> +++ sf_isnan.c Tue Oct 23 10:13:24 2001
> @@ -18,7 +18,13 @@
> #include "fdlibm.h"
> #include "zmath.h"
> 
> -int isnanf (float x)
> +#ifdef __STDC__
> + int isnanf(float x)
> +#else
> + int isnanf(x)
> + float x;
> +#endif
> {
>   __int32_t wx;
>   int exp;
> @@ -31,3 +37,19 @@
>   else
>     return (0);
> }
> +#ifdef _DOUBLE_IS_32BITS
> +
> +#ifdef __STDC__
> + int isnan(double x)
> +#else
> + int isnan(x)
> + double x;
> +#endif
> +{
> + return isnanf((float) x);
> +}
> +
> +#endif /* defined(_DOUBLE_IS_32BITS) */
> ----------------------------------------------------------------------------
> -------------------------
> --- /newlib-1.9.0/newlib/libm/mathfp/sf_isinf.c Fri Feb 18 01:09:52 2000
> +++ sf_isinf.c Tue Oct 23 10:20:04 2001
> @@ -18,7 +18,13 @@
> #include "fdlibm.h"
> #include "zmath.h"
> 
> -int isinff (float x)
> +#ifdef __STDC__
> + int isinff(float x)
> +#else
> + int isinff(x)
> + float x;
> +#endif
> {
>   __uint32_t wx;
>   int exp;
> @@ -31,3 +37,19 @@
>   else
>     return (0);
> }
> +#ifdef _DOUBLE_IS_32BITS
> +
> +#ifdef __STDC__
> + int isinf(double x)
> +#else
> + int isinf(x)
> + double x;
> +#endif
> +{
> + return isinff((float) x);
> +}
> +
> +#endif /* defined(_DOUBLE_IS_32BITS) */
> 
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
> 
> 


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