about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/internal/libm.h2
-rw-r--r--src/math/jnf.c1
-rw-r--r--src/math/lgamma.c5
-rw-r--r--src/math/lgamma_r.c4
-rw-r--r--src/math/lgammaf.c5
-rw-r--r--src/math/lgammaf_r.c4
-rw-r--r--src/math/lgammal.c18
7 files changed, 25 insertions, 14 deletions
diff --git a/src/internal/libm.h b/src/internal/libm.h
index 021c4e2a..2c2191f6 100644
--- a/src/internal/libm.h
+++ b/src/internal/libm.h
@@ -20,6 +20,8 @@
 
 #include "longdbl.h"
 
+#include "libc.h"
+
 union fshape {
 	float value;
 	uint32_t bits;
diff --git a/src/math/jnf.c b/src/math/jnf.c
index 648db32b..b0b36e6b 100644
--- a/src/math/jnf.c
+++ b/src/math/jnf.c
@@ -13,6 +13,7 @@
  * ====================================================
  */
 
+#define _GNU_SOURCE
 #include "libm.h"
 
 static const float
diff --git a/src/math/lgamma.c b/src/math/lgamma.c
index 9af7eee4..17b5aff0 100644
--- a/src/math/lgamma.c
+++ b/src/math/lgamma.c
@@ -1,9 +1,10 @@
-#define _GNU_SOURCE
 #include "libm.h"
 
+double __lgamma_r(double, int *);
+
 double lgamma(double x)
 {
-	return lgamma_r(x, &signgam);
+	return __lgamma_r(x, &signgam);
 }
 
 // FIXME
diff --git a/src/math/lgamma_r.c b/src/math/lgamma_r.c
index 6baa0e52..a8ef1956 100644
--- a/src/math/lgamma_r.c
+++ b/src/math/lgamma_r.c
@@ -199,7 +199,7 @@ static double sin_pi(double x)
 }
 
 
-double lgamma_r(double x, int *signgamp)
+double __lgamma_r(double x, int *signgamp)
 {
 	double t,y,z,nadj,p,p1,p2,p3,q,r,w;
 	int32_t hx;
@@ -313,3 +313,5 @@ double lgamma_r(double x, int *signgamp)
 		r = nadj - r;
 	return r;
 }
+
+weak_alias(__lgamma_r, lgamma_r);
diff --git a/src/math/lgammaf.c b/src/math/lgammaf.c
index aed98ba4..93253534 100644
--- a/src/math/lgammaf.c
+++ b/src/math/lgammaf.c
@@ -1,9 +1,10 @@
-#define _GNU_SOURCE
 #include "libm.h"
 
+float __lgammaf_r(float, int *);
+
 float lgammaf(float x)
 {
-	return lgamma_r(x, &signgam);
+	return __lgammaf_r(x, &signgam);
 }
 
 // FIXME
diff --git a/src/math/lgammaf_r.c b/src/math/lgammaf_r.c
index c6280f5b..f1adcf69 100644
--- a/src/math/lgammaf_r.c
+++ b/src/math/lgammaf_r.c
@@ -134,7 +134,7 @@ static float sin_pif(float x)
 }
 
 
-float lgammaf_r(float x, int *signgamp)
+float __lgammaf_r(float x, int *signgamp)
 {
 	float t,y,z,nadj,p,p1,p2,p3,q,r,w;
 	int32_t hx;
@@ -248,3 +248,5 @@ float lgammaf_r(float x, int *signgamp)
 		r = nadj - r;
 	return r;
 }
+
+weak_alias(__lgammaf_r, lgammaf_r);
diff --git a/src/math/lgammal.c b/src/math/lgammal.c
index a33707ad..5dd851a6 100644
--- a/src/math/lgammal.c
+++ b/src/math/lgammal.c
@@ -88,15 +88,10 @@
 #define _GNU_SOURCE
 #include "libm.h"
 
-long double lgammal(long double x)
-{
-	return lgammal_r(x, &signgam);
-}
-
 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
-long double lgammal_r(long double x, int *sg)
+long double __lgammal_r(long double x, int *sg)
 {
-	return lgamma_r(x, sg);
+	return __lgamma_r(x, sg);
 }
 #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
 static const long double
@@ -266,7 +261,7 @@ static long double sin_pi(long double x)
 	return -y;
 }
 
-long double lgammal_r(long double x, int *sg) {
+long double __lgammal_r(long double x, int *sg) {
 	long double t, y, z, nadj, p, p1, p2, q, r, w;
 	int i, ix;
 	uint32_t se, i0, i1;
@@ -392,3 +387,10 @@ long double lgammal_r(long double x, int *sg) {
 	return r;
 }
 #endif
+
+long double lgammal(long double x)
+{
+	return __lgammal_r(x, &signgam);
+}
+
+weak_alias(__lgammal_r, lgammal_r);