Skip to content

Commit 4f559d4

Browse files
authored
Replace a few remaining __strong_reference uses (#210)
__strong_alias is an ELF feature that is not available on Darwin/MachO. We have openlibm_strong_reference to paper over these differences, but we weren't using it consistently. In particular, we were still using it to define long double -> double aliases on platforms where these are the same type (e.g. aarch64). This didn't used to matter, because the only such platform we supported was always Linux and thus ELF. This patch fixes these instances thus fixing the build on Apple Silicon.
1 parent 5b0e7e9 commit 4f559d4

9 files changed

Lines changed: 24 additions & 10 deletions

File tree

src/cdefs-compat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#define openlibm_strong_reference(sym,aliassym) openlibm_weak_reference(sym,aliassym)
2222
#else
2323
#define openlibm_strong_reference(sym,aliassym) \
24-
OLM_DLLEXPORT extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
24+
OLM_DLLEXPORT extern __typeof (aliassym) aliassym __attribute__ ((__alias__ (#sym)));
2525
#endif /* __APPLE__ */
2626
#endif /* __strong_reference */
2727

src/s_cacos.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
#include <openlibm_complex.h>
5151
#include <openlibm_math.h>
5252

53+
#include "math_private.h"
54+
5355
double complex
5456
cacos(double complex z)
5557
{
@@ -61,5 +63,5 @@ cacos(double complex z)
6163
}
6264

6365
#if LDBL_MANT_DIG == DBL_MANT_DIG
64-
__strong_alias(cacosl, cacos);
66+
openlibm_strong_reference(cacos, cacosl);
6567
#endif /* LDBL_MANT_DIG == DBL_MANT_DIG */

src/s_cacosh.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include <openlibm_complex.h>
4747
#include <openlibm_math.h>
4848

49+
#include "math_private.h"
50+
4951
double complex
5052
cacosh(double complex z)
5153
{
@@ -56,5 +58,5 @@ cacosh(double complex z)
5658
}
5759

5860
#if LDBL_MANT_DIG == DBL_MANT_DIG
59-
__strong_alias(cacoshl, cacosh);
61+
openlibm_strong_reference(cacosh, cacoshl);
6062
#endif /* LDBL_MANT_DIG == DBL_MANT_DIG */

src/s_casin.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
#include <openlibm_complex.h>
5454
#include <openlibm_math.h>
5555

56+
#include "math_private.h"
57+
5658
double complex
5759
casin(double complex z)
5860
{
@@ -130,5 +132,5 @@ casin(double complex z)
130132
}
131133

132134
#if LDBL_MANT_DIG == DBL_MANT_DIG
133-
__strong_alias(casinl, casin);
135+
openlibm_strong_reference(casin, casinl);
134136
#endif /* LDBL_MANT_DIG == DBL_MANT_DIG */

src/s_casinh.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include <openlibm_complex.h>
4747
#include <openlibm_math.h>
4848

49+
#include "math_private.h"
50+
4951
double complex
5052
casinh(double complex z)
5153
{
@@ -56,5 +58,5 @@ casinh(double complex z)
5658
}
5759

5860
#if LDBL_MANT_DIG == DBL_MANT_DIG
59-
__strong_alias(casinhl, casinh);
61+
openlibm_strong_reference(casinh, casinhl);
6062
#endif /* LDBL_MANT_DIG == DBL_MANT_DIG */

src/s_catan.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
#include <openlibm_complex.h>
6767
#include <openlibm_math.h>
6868

69+
#include "math_private.h"
70+
6971
#define MAXNUM 1.0e308
7072

7173
static const double DP1 = 3.14159265160560607910E0;
@@ -127,5 +129,5 @@ catan(double complex z)
127129
}
128130

129131
#if LDBL_MANT_DIG == DBL_MANT_DIG
130-
__strong_alias(catanl, catan);
132+
openlibm_strong_reference(catan, catanl);
131133
#endif /* LDBL_MANT_DIG == DBL_MANT_DIG */

src/s_catanh.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include <openlibm_complex.h>
4747
#include <openlibm_math.h>
4848

49+
#include "math_private.h"
50+
4951
double complex
5052
catanh(double complex z)
5153
{
@@ -56,5 +58,5 @@ catanh(double complex z)
5658
}
5759

5860
#if LDBL_MANT_DIG == DBL_MANT_DIG
59-
__strong_alias(catanhl, catanh);
61+
openlibm_strong_reference(catanh, catanhl);
6062
#endif /* LDBL_MANT_DIG == DBL_MANT_DIG */

src/s_clog.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* If z = x + iy, r = sqrt( x**2 + y**2 ),
3939
* then
4040
* w = log(r) + i arctan(y/x).
41-
*
41+
*
4242
* The arctangent ranges from -PI to +PI.
4343
*
4444
*
@@ -58,6 +58,8 @@
5858
#include <openlibm_complex.h>
5959
#include <openlibm_math.h>
6060

61+
#include "math_private.h"
62+
6163
double complex
6264
clog(double complex z)
6365
{
@@ -73,5 +75,5 @@ clog(double complex z)
7375
}
7476

7577
#if LDBL_MANT_DIG == DBL_MANT_DIG
76-
__strong_alias(clogl, clog);
78+
openlibm_strong_reference(clog, clogl);
7779
#endif /* LDBL_MANT_DIG == DBL_MANT_DIG */

src/s_cpow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ cpow(double complex a, double complex z)
7474
}
7575

7676
#if LDBL_MANT_DIG == DBL_MANT_DIG
77-
__strong_alias(cpowl, cpow);
77+
openlibm_strong_reference(cpow, cpowl);
7878
#endif /* LDBL_MANT_DIG == DBL_MANT_DIG */

0 commit comments

Comments
 (0)