Cygwin: don't export _feinitialise from newlib

Use the more official fesetenv(FE_DFL_ENV) from _dll_crt0, thus
allowing to drop the _feinitialise declaration from fenv.h.

Provide a no-op _feinitialise in Cygwin as exportable symbol for really
old applications when _feinitialise was called from mainCRTStartup in
crt0.o.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-03-24 11:06:58 +01:00
parent 3b22d72255
commit cc19109af9
5 changed files with 8 additions and 12 deletions

View file

@ -170,11 +170,6 @@ int fegetprec (void);
int fesetprec (int __prec); int fesetprec (int __prec);
#endif #endif
#ifdef __INSIDE_CYGWIN__
/* Cygwin-internal ONLY. */
extern void _feinitialise ();
#endif
#endif /* __CYGWIN__ */ #endif /* __CYGWIN__ */
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -63,10 +63,8 @@ static inline bool use_sse(void)
return false; return false;
} }
#ifndef __CYGWIN__
/* forward declaration */ /* forward declaration */
static void _feinitialise (void); static void _feinitialise (void);
#endif
/* This function enables traps for each of the exceptions as indicated /* This function enables traps for each of the exceptions as indicated
by the parameter except. The individual exceptions are described in by the parameter except. The individual exceptions are described in
@ -451,10 +449,7 @@ fesetprec (int prec)
#endif #endif
/* Set up the FPU and SSE environment at the start of execution. */ /* Set up the FPU and SSE environment at the start of execution. */
#ifndef __CYGWIN__ static void
static
#endif
void
_feinitialise (void) _feinitialise (void)
{ {
extern fenv_t __fe_dfl_env; extern fenv_t __fe_dfl_env;

View file

@ -288,6 +288,7 @@ DLL_OFILES:= \
exec.o \ exec.o \
external.o \ external.o \
fcntl.o \ fcntl.o \
fenv.o \
fhandler.o \ fhandler.o \
fhandler_clipboard.o \ fhandler_clipboard.o \
fhandler_console.o \ fhandler_console.o \

View file

@ -1085,7 +1085,7 @@ _dll_crt0 ()
fork_info->alloc_stack (); fork_info->alloc_stack ();
#endif #endif
_feinitialise (); fesetenv (FE_DFL_ENV);
_main_tls = &_my_tls; _main_tls = &_my_tls;
_main_tls->call ((DWORD (*) (void *, void *)) dll_crt0_1, NULL); _main_tls->call ((DWORD (*) (void *, void *)) dll_crt0_1, NULL);
} }

5
winsup/cygwin/fenv.c Normal file
View file

@ -0,0 +1,5 @@
/* no-op function as entry point for applications built between
2010-09-11 and 2011-03-16. That's the timeframe of _feinitialise
being called from mainCRTStartup in crt0.o. */
void _feinitialise (void)
{}