This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Updated patch for dealing with __infinity and small data areas
- To: newlib at sources dot redhat dot com
- Subject: Updated patch for dealing with __infinity and small data areas
- From: Michael Meissner <meissner at redhat dot com>
- Date: Fri, 28 Jul 2000 12:30:20 -0400
I've applied the following patch after feedback from Jeff Johnson.
2000-07-28 Michael Meissner <meissner@redhat.com>
* libc/include/math.h (__infinity): Declare as an array without
bounds to get around small data support. Rewrite Cygwin support
to be more general.
* libm/math/s_infconst.c (__infinity): Ditto.
* libm/mathfp/s_infconst.c (__infinity): Ditto.
*** newlib/libc/include/math.h.~1~ Fri Jul 28 12:23:56 2000
--- newlib/libc/include/math.h Fri Jul 28 11:25:19 2000
*************** union __dmath
*** 21,33 ****
double d;
};
#if !defined(__CYGWIN__) || defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB)
! extern const union __dmath __infinity;
#else
! extern __declspec(dllimport) const union __dmath __infinity;
#endif
! #define HUGE_VAL (__infinity.d)
#endif /* ! defined (HUGE_VAL) */
--- 21,43 ----
double d;
};
+ /* Declare this as an array without bounds so that no matter what small data
+ support a port and/or library has, this reference will be via the general
+ method for accessing globals.
+
+ Also under Cygwin, the library exports a pointer to the real value, so we
+ need to properly dereference it. */
+ #ifndef __INFINITY_DECL__
#if !defined(__CYGWIN__) || defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB)
! #define __INFINITY_DECL__
#else
! #define __INFINITY_DECL__ __declspec(dllimport)
! #endif
#endif
! extern __INFINITY_DECL__ const union __dmath __infinity[];
!
! #define HUGE_VAL (__infinity[0].d)
#endif /* ! defined (HUGE_VAL) */
*** newlib/libm/math/s_infconst.c.~1~ Thu Feb 17 14:39:51 2000
--- newlib/libm/math/s_infconst.c Fri Jul 28 10:38:40 2000
***************
*** 6,15 ****
#ifndef _DOUBLE_IS_32BITS
#ifdef __IEEE_BIG_ENDIAN
! const union __dmath __infinity = { 0x7ff00000, 0 };
#else
! const union __dmath __infinity = { 0, 0x7ff00000 };
#endif
#else /* defined (_DOUBLE_IS_32BITS) */
! const union __dmath __infinity = { 0x7f800000, 0 };
#endif /* defined (_DOUBLE_IS_32BITS) */
--- 6,15 ----
#ifndef _DOUBLE_IS_32BITS
#ifdef __IEEE_BIG_ENDIAN
! const union __dmath __infinity[1] = {{ 0x7ff00000, 0 }};
#else
! const union __dmath __infinity[1] = {{ 0, 0x7ff00000 }};
#endif
#else /* defined (_DOUBLE_IS_32BITS) */
! const union __dmath __infinity[1] = {{ 0x7f800000, 0 }};
#endif /* defined (_DOUBLE_IS_32BITS) */
*** newlib/libm/mathfp/s_infconst.c.~1~ Thu Feb 17 14:39:52 2000
--- newlib/libm/mathfp/s_infconst.c Fri Jul 28 10:38:09 2000
***************
*** 6,15 ****
#ifndef _DOUBLE_IS_32BITS
#ifdef __IEEE_BIG_ENDIAN
! const union __dmath __infinity = { 0x7ff00000, 0 };
#else
! const union __dmath __infinity = { 0, 0x7ff00000 };
#endif
#else /* defined (_DOUBLE_IS_32BITS) */
! const union __dmath __infinity = { 0x7f800000, 0 };
#endif /* defined (_DOUBLE_IS_32BITS) */
--- 6,15 ----
#ifndef _DOUBLE_IS_32BITS
#ifdef __IEEE_BIG_ENDIAN
! const union __dmath __infinity[1] = {{ 0x7ff00000, 0 }};
#else
! const union __dmath __infinity[1] = {{ 0, 0x7ff00000 }};
#endif
#else /* defined (_DOUBLE_IS_32BITS) */
! const union __dmath __infinity[1] = {{ 0x7f800000, 0 }};
#endif /* defined (_DOUBLE_IS_32BITS) */
--
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482