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:
authorDanny Smith <dannysmith@users.sourceforge.net>2002-04-17 06:34:25 +0400
committerDanny Smith <dannysmith@users.sourceforge.net>2002-04-17 06:34:25 +0400
commitf6446dd058b461627d9bfece6bb77114fd1b68e1 (patch)
treeeb6291c183d87ab659e39cbd2df36d9c56f19be4
parent7211acadc0a5b3d1a341e91a6c1eff8f993b81a0 (diff)
* crt1.c: Revert changes of 2002-04-16. Use _fpreset again.
* msvcrt.def (_fpreset): Mark as DATA so that only _imp___fpreset is exported. * msvcrt20.def (_fpreset): Likewise. * msvcrt40.def (_fpreset): Likewise. * crtdll.def (_fpreset): Likewise. * CRT_fp10.c (_fpreset): Overide library _fpreset with one that calls fninit. (fpreset): Add oldname alias. (__CRT_PC): Delete definition. _fpreset does it now. * CRT_fp8.c (_fpreset): Force use of library _imp___fpreset. (fpreset): Add oldname alias. (__CRT_PC): Delete definition. * moldname.def.in: Comment out fpreset. * moldname-msvcrt.def: Regenerate. * moldname-crtdll.def: Regenerate. * include/fenv.h (FE_DFL_ENV): Define as (fenv_t*)0. * mingwex/fesetenv.c (FE_DFL_ENV): Use it to set environment with the _fpreset determined by startup CRT_fp object.
-rw-r--r--winsup/mingw/CRT_fp10.c14
-rw-r--r--winsup/mingw/CRT_fp8.c16
-rw-r--r--winsup/mingw/ChangeLog22
-rw-r--r--winsup/mingw/crt1.c20
-rw-r--r--winsup/mingw/crtdll.def2
-rw-r--r--winsup/mingw/include/fenv.h6
-rw-r--r--winsup/mingw/mingwex/fesetenv.c26
-rw-r--r--winsup/mingw/moldname-crtdll.def3
-rw-r--r--winsup/mingw/moldname-msvcrt.def3
-rw-r--r--winsup/mingw/moldname.def.in3
-rw-r--r--winsup/mingw/msvcrt.def2
-rw-r--r--winsup/mingw/msvcrt20.def2
-rw-r--r--winsup/mingw/msvcrt40.def2
13 files changed, 76 insertions, 45 deletions
diff --git a/winsup/mingw/CRT_fp10.c b/winsup/mingw/CRT_fp10.c
index 0527aeb03..a13fb0096 100644
--- a/winsup/mingw/CRT_fp10.c
+++ b/winsup/mingw/CRT_fp10.c
@@ -1,12 +1,16 @@
/*
* CRT_FP10.c
*
- * This object file defines __CRT_PC to have a value of 10,
- * which will set default floating point precesion to 64-bit mantissa
+ * This defines _fpreset as asm ("fnint"). Calls to _fpreset
+ * will set default floating point precesion to 64-bit mantissa
* at app startup.
*
- * Linking in CRT_FP10.o before libmingw.a will override the value
- * set by CRT_FP8.o.
+ * Linking in CRT_FP10.o before libmingw.a will override the definition
+ * set in CRT_FP8.o.
*/
-unsigned int __CRT_PC = 10;
+/* Override library _fpreset() with asm fninit */
+void _fpreset (void)
+ { __asm__ ( "fninit" ) ;}
+
+void __attribute__ ((alias ("_fpreset"))) fpreset(void);
diff --git a/winsup/mingw/CRT_fp8.c b/winsup/mingw/CRT_fp8.c
index d375fef88..d772d759a 100644
--- a/winsup/mingw/CRT_fp8.c
+++ b/winsup/mingw/CRT_fp8.c
@@ -1,10 +1,18 @@
/*
* CRT_FP8.c
*
- * This object file defines __CRT_PC to have a value of 8, which
- * set default floating point precesion to 53-bit mantissa at app startup.
+ * This forces calls of _fpreset to the MSVCRT function
+ * exported from dll. Effectively it make default
+ * precison same as apps built with MSVC (53-bit mantissa).
+
*
- * To change to 64-bit mantissa, link in CRT_FP10.o before libmningw.a.
+ * To change to 64-bit mantissa, link in CRT_FP10.o before libmingw.a.
*/
- unsigned int __CRT_PC = 8;
+/* Link against the _fpreset visible in import lib */
+
+extern void (*_imp___fpreset)(void) ;
+void _fpreset (void)
+{ (*_imp___fpreset)(); }
+
+void __attribute__ ((alias ("_fpreset"))) fpreset(void);
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index cb9e1fa70..cdfe46e54 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,3 +1,25 @@
+2002-04-17 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * crt1.c: Revert changes of 2002-04-16. Use _fpreset again.
+ * msvcrt.def (_fpreset): Mark as DATA so that only
+ _imp___fpreset is exported.
+ * msvcrt20.def (_fpreset): Likewise.
+ * msvcrt40.def (_fpreset): Likewise.
+ * crtdll.def (_fpreset): Likewise.
+ * CRT_fp10.c (_fpreset): Overide library _fpreset with one
+ that calls fninit.
+ (fpreset): Add alias.
+ (__CRT_PC): Delete definition. _fpreset does it now.
+ * CRT_fp8.c (_fpreset): Force use of library _imp___fpreset.
+ (fpreset): Add alias.
+ (__CRT_PC): Delete definition.
+ * moldname.def.in: Comment out fpreset.
+ * moldname-msvcrt.def: Regenerate.
+ * moldname-crtdll.def: Regenerate.
+ * include/fenv.h (FE_DFL_ENV): Define as (fenv_t*)0.
+ * mingwex/fesetenv.c (FE_DFL_ENV): Use it to set environment
+ with the _fpreset determined by startup CRT_fp object.
+
2002-04-16 Danny Smith <dannysmith@users.sourceforge.net>
* CRT_fp8.c: New file.
diff --git a/winsup/mingw/crt1.c b/winsup/mingw/crt1.c
index b572c4f34..f91f1da28 100644
--- a/winsup/mingw/crt1.c
+++ b/winsup/mingw/crt1.c
@@ -61,21 +61,6 @@ __MINGW_IMPORT void __set_app_type(int);
*/
extern unsigned int _CRT_fmode;
-/*
- * If the user links in CRT_fp10.o or a different object
- * defining __CRT_PC this will override default FP precison set
- * in CRT_fp8.o in libmingw.a.
- */
-extern unsigned int __CRT_PC;
-static inline void
-__CRT_fesetenv (void)
-{
- if (__CRT_PC == 8)
- _fpreset();
- else
- __asm__ volatile ("fninit");
-}
-
static void
_mingw32_init_fmode ()
{
@@ -151,7 +136,7 @@ _gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
{
signal (SIGFPE, SIG_IGN);
if (reset_fpu)
- __CRT_fesetenv();
+ _fpreset ();
action = EXCEPTION_CONTINUE_EXECUTION;
}
else if (old_handler != SIG_DFL)
@@ -187,7 +172,7 @@ __mingw_CRTStartup ()
/*
* Initialize floating point unit.
*/
- __CRT_fesetenv();
+ _fpreset (); /* Supplied by the runtime library. */
/*
* Set up __argc, __argv and _environ.
@@ -246,3 +231,4 @@ WinMainCRTStartup ()
#endif
__mingw_CRTStartup ();
}
+
diff --git a/winsup/mingw/crtdll.def b/winsup/mingw/crtdll.def
index 00ff624c8..694547471 100644
--- a/winsup/mingw/crtdll.def
+++ b/winsup/mingw/crtdll.def
@@ -285,7 +285,7 @@ _flushall
_fmode_dll DATA
_fpclass
_fpieee_flt
-_fpreset
+_fpreset DATA
_fputchar
_fputwchar
_fsopen
diff --git a/winsup/mingw/include/fenv.h b/winsup/mingw/include/fenv.h
index 471bdcc4d..eed440314 100644
--- a/winsup/mingw/include/fenv.h
+++ b/winsup/mingw/include/fenv.h
@@ -53,9 +53,9 @@ typedef struct
/* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */
#define FE_PC53_ENV ((const fenv_t *)-2)
-/* The FE_DFL_ENV macro is required by standard. *
-/* For now, define the MSVCRT version as default. */
-#define FE_DFL_ENV FE_PC53_ENV
+/* The FE_DFL_ENV macro is required by standard.
+ fesetenv will use the environment set at app startup.*/
+#define FE_DFL_ENV ((const fenv_t *) 0)
#ifndef RC_INVOKED
#ifdef __cplusplus
diff --git a/winsup/mingw/mingwex/fesetenv.c b/winsup/mingw/mingwex/fesetenv.c
index c8f07613e..b3d5c5f05 100644
--- a/winsup/mingw/mingwex/fesetenv.c
+++ b/winsup/mingw/mingwex/fesetenv.c
@@ -10,21 +10,29 @@
exceptions.
*/
+extern void (*_imp___fpreset)( void ) ;
+
int fesetenv (const fenv_t * envp)
{
if (envp == FE_PC64_ENV)
-/*
- * fninit initializes the control register to 0x37f,
- * the status register to zero and the tag word to 0FFFFh.
- * The other registers are unaffected.
- */
+ /*
+ * fninit initializes the control register to 0x37f,
+ * the status register to zero and the tag word to 0FFFFh.
+ * The other registers are unaffected.
+ */
__asm__ ("fninit");
else if (envp == FE_PC53_ENV)
-/*
- * MS _fpreset() does same *except* it sets control word
- * to 0x27f (53-bit precison).
- */
+ /*
+ * MS _fpreset() does same *except* it sets control word
+ * to 0x27f (53-bit precison).
+ * We force calling _fpreset in msvcrt.dll
+ */
+
+ (*_imp___fpreset)();
+
+ else if (envp == FE_DFL_ENV)
+ /* Use the choice made at app startup */
_fpreset();
else
diff --git a/winsup/mingw/moldname-crtdll.def b/winsup/mingw/moldname-crtdll.def
index f27fa1562..669900b31 100644
--- a/winsup/mingw/moldname-crtdll.def
+++ b/winsup/mingw/moldname-crtdll.def
@@ -54,7 +54,8 @@ fgetchar
fgetwchar
filelength
fileno
-fpreset
+; Alias fpreset is set in CRT_fp10,c and CRT_fp8.c.
+; fpreset
fputchar
fputwchar
fstat
diff --git a/winsup/mingw/moldname-msvcrt.def b/winsup/mingw/moldname-msvcrt.def
index f6e90755a..f3f7da3f3 100644
--- a/winsup/mingw/moldname-msvcrt.def
+++ b/winsup/mingw/moldname-msvcrt.def
@@ -54,7 +54,8 @@ fgetchar
fgetwchar
filelength
fileno
-fpreset
+; Alias fpreset is set in CRT_fp10,c and CRT_fp8.c.
+; fpreset
fputchar
fputwchar
fstat
diff --git a/winsup/mingw/moldname.def.in b/winsup/mingw/moldname.def.in
index c0032aff6..1c88b0a56 100644
--- a/winsup/mingw/moldname.def.in
+++ b/winsup/mingw/moldname.def.in
@@ -54,7 +54,8 @@ fgetchar
fgetwchar
filelength
fileno
-fpreset
+; Alias fpreset is set in CRT_fp10,c and CRT_fp8.c.
+; fpreset
fputchar
fputwchar
fstat
diff --git a/winsup/mingw/msvcrt.def b/winsup/mingw/msvcrt.def
index 8a1b87210..8d3e1a8cc 100644
--- a/winsup/mingw/msvcrt.def
+++ b/winsup/mingw/msvcrt.def
@@ -210,7 +210,7 @@ _flushall
_fmode DATA
_fpclass
_fpieee_flt
-_fpreset
+_fpreset DATA
_fputchar
_fputwchar
_fsopen
diff --git a/winsup/mingw/msvcrt20.def b/winsup/mingw/msvcrt20.def
index 2f27ea04b..77ff49510 100644
--- a/winsup/mingw/msvcrt20.def
+++ b/winsup/mingw/msvcrt20.def
@@ -181,7 +181,7 @@ _flushall
_fmode
_fpclass
_fpieee_flt
-_fpreset
+_fpreset DATA
_fputchar
_fputwchar
_fsopen
diff --git a/winsup/mingw/msvcrt40.def b/winsup/mingw/msvcrt40.def
index 7b1d2e84e..936aff962 100644
--- a/winsup/mingw/msvcrt40.def
+++ b/winsup/mingw/msvcrt40.def
@@ -163,7 +163,7 @@ _flushall
_fmode
_fpclass
_fpieee_flt
-_fpreset
+_fpreset DATA
_fputchar
_fputwchar
_fsopen