public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org, newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: don't export _feinitialise from newlib
Date: Tue, 13 Apr 2021 10:56:52 +0000 (GMT)	[thread overview]
Message-ID: <20210413105652.BCC2F3943541@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=cc19109af966331f76cc8b6fd7c92eec36dc2276

commit cc19109af966331f76cc8b6fd7c92eec36dc2276
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Mar 24 11:06:58 2021 +0100

    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>

Diff:
---
 newlib/libc/machine/shared_x86/sys/fenv.h | 5 -----
 newlib/libm/machine/shared_x86/fenv.c     | 7 +------
 winsup/cygwin/Makefile.in                 | 1 +
 winsup/cygwin/dcrt0.cc                    | 2 +-
 winsup/cygwin/fenv.c                      | 5 +++++
 5 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/newlib/libc/machine/shared_x86/sys/fenv.h b/newlib/libc/machine/shared_x86/sys/fenv.h
index e0408fe5b..243cac27a 100644
--- a/newlib/libc/machine/shared_x86/sys/fenv.h
+++ b/newlib/libc/machine/shared_x86/sys/fenv.h
@@ -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
diff --git a/newlib/libm/machine/shared_x86/fenv.c b/newlib/libm/machine/shared_x86/fenv.c
index 8d1f1ad7f..ccc08e2d8 100644
--- a/newlib/libm/machine/shared_x86/fenv.c
+++ b/newlib/libm/machine/shared_x86/fenv.c
@@ -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;
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index ff6798867..73d9b37fd 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -288,6 +288,7 @@ DLL_OFILES:= \
 	exec.o \
 	external.o \
 	fcntl.o \
+	fenv.o \
 	fhandler.o \
 	fhandler_clipboard.o \
 	fhandler_console.o \
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 810017956..d4a08d18b 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -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);
 }
diff --git a/winsup/cygwin/fenv.c b/winsup/cygwin/fenv.c
new file mode 100644
index 000000000..80f7cc52c
--- /dev/null
+++ b/winsup/cygwin/fenv.c
@@ -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)
+{}


                 reply	other threads:[~2021-04-13 10:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210413105652.BCC2F3943541@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).