This is the mail archive of the newlib-cvs@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] fix internal __ieee754_expf and __ieee754_logf calls


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));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]