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);
#endif
#ifdef __INSIDE_CYGWIN__
/* Cygwin-internal ONLY. */
extern void _feinitialise ();
#endif
#endif /* __CYGWIN__ */
#ifdef __cplusplus

View File

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

View File

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

View File

@ -1085,7 +1085,7 @@ _dll_crt0 ()
fork_info->alloc_stack ();
#endif
_feinitialise ();
fesetenv (FE_DFL_ENV);
_main_tls = &_my_tls;
_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)
{}