From f94527d72b2e4e7fe0f0339d0a35aaa91646401b Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Wed, 13 Sep 2017 18:14:26 +0100
Subject: [PATCH 6/7] Do not wrap logf, log2f and powf

The new generic logf, log2f and powf code don't need wrappers any more,
they set errno inline so only use the wrappers on targets that need it.

2017-09-19  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* sysdeps/ieee754/flt-32/e_log2f.c (__log2f): Define without wrapper.
	* sysdeps/ieee754/flt-32/e_logf.c (__logf): Likewise
	* sysdeps/ieee754/flt-32/e_powf.c (__powf): Likewise
	* sysdeps/ieee754/flt-32/w_log2f.c: New file.
	* sysdeps/ieee754/flt-32/w_logf.c: New file.
	* sysdeps/ieee754/flt-32/w_powf.c: New file.
	* sysdeps/i386/fpu/w_log2f.c: New file.
	* sysdeps/i386/fpu/w_logf.c: New file.
	* sysdeps/i386/fpu/w_powf.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_log2f.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_logf.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_powf.c: New file.
---
 sysdeps/i386/fpu/w_log2f.c        | 1 +
 sysdeps/i386/fpu/w_logf.c         | 1 +
 sysdeps/i386/fpu/w_powf.c         | 1 +
 sysdeps/ieee754/flt-32/e_log2f.c  | 7 +++++--
 sysdeps/ieee754/flt-32/e_logf.c   | 7 +++++--
 sysdeps/ieee754/flt-32/e_powf.c   | 7 +++++--
 sysdeps/ieee754/flt-32/w_log2f.c  | 1 +
 sysdeps/ieee754/flt-32/w_logf.c   | 1 +
 sysdeps/ieee754/flt-32/w_powf.c   | 1 +
 sysdeps/m68k/m680x0/fpu/w_log2f.c | 1 +
 sysdeps/m68k/m680x0/fpu/w_logf.c  | 1 +
 sysdeps/m68k/m680x0/fpu/w_powf.c  | 1 +
 12 files changed, 24 insertions(+), 6 deletions(-)
 create mode 100644 sysdeps/i386/fpu/w_log2f.c
 create mode 100644 sysdeps/i386/fpu/w_logf.c
 create mode 100644 sysdeps/i386/fpu/w_powf.c
 create mode 100644 sysdeps/ieee754/flt-32/w_log2f.c
 create mode 100644 sysdeps/ieee754/flt-32/w_logf.c
 create mode 100644 sysdeps/ieee754/flt-32/w_powf.c
 create mode 100644 sysdeps/m68k/m680x0/fpu/w_log2f.c
 create mode 100644 sysdeps/m68k/m680x0/fpu/w_logf.c
 create mode 100644 sysdeps/m68k/m680x0/fpu/w_powf.c

diff --git a/sysdeps/i386/fpu/w_log2f.c b/sysdeps/i386/fpu/w_log2f.c
new file mode 100644
index 0000000000..3f5c71cec2
--- /dev/null
+++ b/sysdeps/i386/fpu/w_log2f.c
@@ -0,0 +1 @@
+#include <sysdeps/../math/w_log2f.c>
diff --git a/sysdeps/i386/fpu/w_logf.c b/sysdeps/i386/fpu/w_logf.c
new file mode 100644
index 0000000000..ea48d1356e
--- /dev/null
+++ b/sysdeps/i386/fpu/w_logf.c
@@ -0,0 +1 @@
+#include <sysdeps/../math/w_logf.c>
diff --git a/sysdeps/i386/fpu/w_powf.c b/sysdeps/i386/fpu/w_powf.c
new file mode 100644
index 0000000000..d133216f5b
--- /dev/null
+++ b/sysdeps/i386/fpu/w_powf.c
@@ -0,0 +1 @@
+#include <sysdeps/../math/w_powf.c>
diff --git a/sysdeps/ieee754/flt-32/e_log2f.c b/sysdeps/ieee754/flt-32/e_log2f.c
index 6c42f27843..a3506dcfd1 100644
--- a/sysdeps/ieee754/flt-32/e_log2f.c
+++ b/sysdeps/ieee754/flt-32/e_log2f.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <stdint.h>
+#include <shlib-compat.h>
 #include "math_config.h"
 
 /*
@@ -34,7 +35,7 @@ Relative error: 1.9 * 2^-26 (before rounding.)
 #define OFF 0x3f330000
 
 float
-__ieee754_log2f (float x)
+__log2f (float x)
 {
   /* double_t for better performance on targets with FLT_EVAL_METHOD==2.  */
   double_t z, r, r2, p, y, y0, invc, logc;
@@ -85,4 +86,6 @@ __ieee754_log2f (float x)
   y = y * r2 + p;
   return (float) y;
 }
-strong_alias (__ieee754_log2f, __log2f_finite)
+strong_alias (__log2f, __ieee754_log2f)
+strong_alias (__log2f, __log2f_finite)
+versioned_symbol (libm, __log2f, log2f, GLIBC_2_27);
diff --git a/sysdeps/ieee754/flt-32/e_logf.c b/sysdeps/ieee754/flt-32/e_logf.c
index b8d262441f..ba537d5236 100644
--- a/sysdeps/ieee754/flt-32/e_logf.c
+++ b/sysdeps/ieee754/flt-32/e_logf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <stdint.h>
+#include <shlib-compat.h>
 #include "math_config.h"
 
 /*
@@ -35,7 +36,7 @@ Relative error: 1.957 * 2^-26 (before rounding.)
 #define OFF 0x3f330000
 
 float
-__ieee754_logf (float x)
+__logf (float x)
 {
   /* double_t for better performance on targets with FLT_EVAL_METHOD==2.  */
   double_t z, r, r2, y, y0, invc, logc;
@@ -84,4 +85,6 @@ __ieee754_logf (float x)
   y = y * r2 + (y0 + r);
   return (float) y;
 }
-strong_alias (__ieee754_logf, __logf_finite)
+strong_alias (__logf, __ieee754_logf)
+strong_alias (__logf, __logf_finite)
+versioned_symbol (libm, __logf, logf, GLIBC_2_27);
diff --git a/sysdeps/ieee754/flt-32/e_powf.c b/sysdeps/ieee754/flt-32/e_powf.c
index 644a18d05e..4368f49be2 100644
--- a/sysdeps/ieee754/flt-32/e_powf.c
+++ b/sysdeps/ieee754/flt-32/e_powf.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <stdint.h>
+#include <shlib-compat.h>
 #include "math_config.h"
 
 /*
@@ -139,7 +140,7 @@ zeroinfnan (uint32_t ix)
 }
 
 float
-__ieee754_powf (float x, float y)
+__powf (float x, float y)
 {
   unsigned long sign_bias = 0;
   uint32_t ix, iy;
@@ -214,4 +215,6 @@ __ieee754_powf (float x, float y)
     }
   return (float) exp2_inline (ylogx, sign_bias);
 }
-strong_alias (__ieee754_powf, __powf_finite)
+strong_alias (__powf, __ieee754_powf)
+strong_alias (__powf, __powf_finite)
+versioned_symbol (libm, __powf, powf, GLIBC_2_27);
diff --git a/sysdeps/ieee754/flt-32/w_log2f.c b/sysdeps/ieee754/flt-32/w_log2f.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ieee754/flt-32/w_log2f.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ieee754/flt-32/w_logf.c b/sysdeps/ieee754/flt-32/w_logf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ieee754/flt-32/w_logf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ieee754/flt-32/w_powf.c b/sysdeps/ieee754/flt-32/w_powf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ieee754/flt-32/w_powf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/m68k/m680x0/fpu/w_log2f.c b/sysdeps/m68k/m680x0/fpu/w_log2f.c
new file mode 100644
index 0000000000..3f5c71cec2
--- /dev/null
+++ b/sysdeps/m68k/m680x0/fpu/w_log2f.c
@@ -0,0 +1 @@
+#include <sysdeps/../math/w_log2f.c>
diff --git a/sysdeps/m68k/m680x0/fpu/w_logf.c b/sysdeps/m68k/m680x0/fpu/w_logf.c
new file mode 100644
index 0000000000..ea48d1356e
--- /dev/null
+++ b/sysdeps/m68k/m680x0/fpu/w_logf.c
@@ -0,0 +1 @@
+#include <sysdeps/../math/w_logf.c>
diff --git a/sysdeps/m68k/m680x0/fpu/w_powf.c b/sysdeps/m68k/m680x0/fpu/w_powf.c
new file mode 100644
index 0000000000..d133216f5b
--- /dev/null
+++ b/sysdeps/m68k/m680x0/fpu/w_powf.c
@@ -0,0 +1 @@
+#include <sysdeps/../math/w_powf.c>
-- 
2.11.0

