public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] fix internal __ieee754_expf and __ieee754_logf calls
Date: Fri, 20 Oct 2017 09:19:00 -0000	[thread overview]
Message-ID: <20171020091920.15876.qmail@sourceware.org> (raw)

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

commit 56e494c074ef1c790e455f10c37337c6009c814c
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Oct 17 12:41:20 2017 +0100

    fix internal __ieee754_expf and __ieee754_logf calls
    
    The recently added new math code inlines error handling instead of using
    error handling wrappers around __ieee754* internal symbols, and thus the
    __ieee754* symbols are no longer provided.
    
    However __ieee754_expf and __ieee754_logf are used in the implementation
    of a number of other math functions.  These symbols are safe to redirect
    to the external expf and logf symbols, because those names are always
    reserved when single precision math functions are reserved and the
    additional error handling code is either not reached or there will be
    an error in the final result that will override an internal spurious
    errno setting.
    
    For consistency all of __ieee754_expf, __ieee754_logf and __ieee754_powf
    are redirected using a macro.

Diff:
---
 newlib/libm/common/fdlibm.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/newlib/libm/common/fdlibm.h b/newlib/libm/common/fdlibm.h
index 821e4de..4523e8b 100644
--- a/newlib/libm/common/fdlibm.h
+++ b/newlib/libm/common/fdlibm.h
@@ -225,6 +225,17 @@ extern float __ieee754_scalbf __P((float,int));
 extern float __ieee754_scalbf __P((float,float));
 #endif
 
+#if !__OBSOLETE_MATH
+/* The new math code does not provide separate wrapper function
+   for error handling, so the extern symbol is called directly.
+   This is valid as long as there are no namespace issues (the
+   extern symbol is reserved whenever the caller is reserved)
+   and there are no observable error handling side effects.  */
+# define __ieee754_expf(x) expf(x)
+# define __ieee754_logf(x) logf(x)
+# define __ieee754_powf(x,y) powf(x,y)
+#endif
+
 /* float versions of fdlibm kernel functions */
 extern float __kernel_sinf __P((float,float,int));
 extern float __kernel_cosf __P((float,float));


                 reply	other threads:[~2017-10-20  9:19 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=20171020091920.15876.qmail@sourceware.org \
    --to=corinna@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).