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]

Patch to override small data support for __infinity


Note, I'm not sure whether I'm on the newlib mailing list or not, so
make sure I'm on any replies.  I was doing a port that provided small
data support, and __infinity was thought to be in the small data area
by the caller, but it wasn't by the library, due to different -G n
switches.  This patch forces the compiler to always use the most
general method of accessing the value.

2000-07-21  Michael Meissner  <meissner@redhat.com>

	* libc/include/math.h (__infinity): Declare as an array without
	bounds to get around small data support.
	* libm/math/s_infconst.c (__infinity): Ditto.

*** newlib/libc/include/math.h.~1~	Thu Feb 17 14:39:46 2000
--- newlib/libc/include/math.h	Fri Jul 21 20:39:49 2000
*************** union __dmath
*** 21,29 ****
    double d;
  };
  
! extern const union __dmath __infinity;
  
! #define HUGE_VAL (__infinity.d)
  
  #endif /* ! defined (HUGE_VAL) */
  
--- 21,32 ----
    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.  */
! extern 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 21 20:39:21 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

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