Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <gnu@the-meissners.org>2000-07-28 20:27:55 +0400
committerMichael Meissner <gnu@the-meissners.org>2000-07-28 20:27:55 +0400
commit7c110b172c257ab253d317d5ad58f4c557d9cfd9 (patch)
treed9b284c4cbeb1777d25e52a1e791e7144f87c016
parentb7d9755e164749c429a5e00608aeb9930e1727ce (diff)
Declare __infinity as an array to work around problems with small data support
-rw-r--r--newlib/ChangeLog8
-rw-r--r--newlib/libc/include/math.h16
-rw-r--r--newlib/libm/math/s_infconst.c6
-rw-r--r--newlib/libm/mathfp/s_infconst.c6
4 files changed, 27 insertions, 9 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index e81a73ea1..ec72e9c7e 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
Thu Jul 27 10:46:01 2000 Christopher Faylor <cgf@cygnus.com>
* libc/include/math.h: Use appropriate dll import linkage for
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index cd03945c9..6a6440dc7 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -21,13 +21,23 @@ union __dmath
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)
-extern const union __dmath __infinity;
+#define __INFINITY_DECL__
#else
-extern __declspec(dllimport) const union __dmath __infinity;
+#define __INFINITY_DECL__ __declspec(dllimport)
+#endif
#endif
-#define HUGE_VAL (__infinity.d)
+extern __INFINITY_DECL__ const union __dmath __infinity[];
+
+#define HUGE_VAL (__infinity[0].d)
#endif /* ! defined (HUGE_VAL) */
diff --git a/newlib/libm/math/s_infconst.c b/newlib/libm/math/s_infconst.c
index 85b3b689c..e6b86d497 100644
--- a/newlib/libm/math/s_infconst.c
+++ b/newlib/libm/math/s_infconst.c
@@ -6,10 +6,10 @@
#ifndef _DOUBLE_IS_32BITS
#ifdef __IEEE_BIG_ENDIAN
-const union __dmath __infinity = { 0x7ff00000, 0 };
+const union __dmath __infinity[1] = {{ 0x7ff00000, 0 }};
#else
-const union __dmath __infinity = { 0, 0x7ff00000 };
+const union __dmath __infinity[1] = {{ 0, 0x7ff00000 }};
#endif
#else /* defined (_DOUBLE_IS_32BITS) */
-const union __dmath __infinity = { 0x7f800000, 0 };
+const union __dmath __infinity[1] = {{ 0x7f800000, 0 }};
#endif /* defined (_DOUBLE_IS_32BITS) */
diff --git a/newlib/libm/mathfp/s_infconst.c b/newlib/libm/mathfp/s_infconst.c
index 85b3b689c..e6b86d497 100644
--- a/newlib/libm/mathfp/s_infconst.c
+++ b/newlib/libm/mathfp/s_infconst.c
@@ -6,10 +6,10 @@
#ifndef _DOUBLE_IS_32BITS
#ifdef __IEEE_BIG_ENDIAN
-const union __dmath __infinity = { 0x7ff00000, 0 };
+const union __dmath __infinity[1] = {{ 0x7ff00000, 0 }};
#else
-const union __dmath __infinity = { 0, 0x7ff00000 };
+const union __dmath __infinity[1] = {{ 0, 0x7ff00000 }};
#endif
#else /* defined (_DOUBLE_IS_32BITS) */
-const union __dmath __infinity = { 0x7f800000, 0 };
+const union __dmath __infinity[1] = {{ 0x7f800000, 0 }};
#endif /* defined (_DOUBLE_IS_32BITS) */