long double (was "strtold?")

Ken Werner ken@linux.vnet.ibm.com
Thu Apr 2 00:02:00 GMT 2009


On Monday 30 March 2009 22:42:17 Jeff Johnston wrote:
> > All in all it looks like implementing small wrapper functions that just
> > call their counterparts seems to be the way to go - as you suggested. : )
>
> Ok, great.  It should not be a code-size issue as you earlier
> mentioned.  Any application that calls
> a C library function has to expect something gets linked in.  A small
> stub that calls another function
> is hardly surprising.

The attached patch adds these wrapper functions. I initially intended to use 
the AC_TYPE_LONG_DOUBLE_WIDER macro in newlib/libm/configure.in but there is no 
AC_CONFIG_HEADERS and I guess there is a reason for that. Therefore I guarded 
the code itself. Maybe there is a better solution - just let me know. : )

> > For the SPU target I'd like to use GCC aliasing to save code size and
> > don't pay the penalty of an extra function call. I'll post a patch as
> > soon as I find some time.
>
> If you do an SPU-only solution, a preferred way would be to add a
> machine/math.h extension to math.h and then have a
> libc/spu/machine/math.h file.  In libc/include/machine have a math.h
> that defaults to empty for everyone else.

I did so and aliased the long double functions within the existent .c files of 
the SPUs math implementation since they have to be in the same translation 
unit. Unfortunately the wrappers that have been added for the common code are 
visible on the SPU target too which result in duplicate definitions. It looks 
like the overlaying of target specific math routines is made by file names. 
Adding empty files seems not be an option. Is there a nice way to do it?

> -- Jeff J.
Regards
Ken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: longdouble.patch
Type: text/x-patch
Size: 78450 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20090402/31c92cc9/attachment.bin>


More information about the Newlib mailing list