Merge pull request #198 from gufe44/netbsd-fix-openlibm_weak_reference

Netbsd fix openlibm weak reference
This commit is contained in:
Viral B. Shah 2019-10-26 10:28:11 -04:00 committed by GitHub
commit 97de1a46a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 72 additions and 56 deletions

View File

@ -12,37 +12,49 @@
#endif /* !defined(__BEGIN_DECLS) */
#ifdef __GNUC__
#ifndef __strong_reference
#ifdef __APPLE__
#define __strong_reference(sym,aliassym) __weak_reference(sym,aliassym)
#if defined(__strong_alias) && defined(__NetBSD__)
#define openlibm_strong_reference(sym,alias) __strong_alias(alias,sym)
#elif defined(__strong_reference)
#define openlibm_strong_reference(sym,alias) __strong_reference(sym,alias)
#else
#define __strong_reference(sym,aliassym) \
#ifdef __APPLE__
#define openlibm_strong_reference(sym,aliassym) openlibm_weak_reference(sym,aliassym)
#else
#define openlibm_strong_reference(sym,aliassym) \
OLM_DLLEXPORT extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
#endif /* __APPLE__ */
#endif /* __strong_reference */
#ifdef __wasm__
# define __weak_reference(sym,alias) __strong_reference(sym,alias)
# define openlibm_weak_reference(sym,alias) openlibm_strong_reference(sym,alias)
#endif
#ifndef __weak_reference
#if defined(__weak_alias) && defined(__NetBSD__)
#define openlibm_weak_reference(sym,alias) __weak_alias(alias,sym)
#elif defined(__weak_reference)
#define openlibm_weak_reference(sym,alias) __weak_reference(sym,alias)
#else
#ifdef __ELF__
#ifdef __STDC__
#define __weak_reference(sym,alias) \
#define openlibm_weak_reference(sym,alias) \
__asm__(".weak " #alias); \
__asm__(".equ " #alias ", " #sym)
#ifndef __warn_references
#define __warn_references(sym,msg) \
#ifdef __warn_references
#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
#else
#define openlibm_warn_references(sym,msg) \
__asm__(".section .gnu.warning." #sym); \
__asm__(".asciz \"" msg "\""); \
__asm__(".previous")
#endif /* __warn_references */
#else
#define __weak_reference(sym,alias) \
#define openlibm_weak_reference(sym,alias) \
__asm__(".weak alias"); \
__asm__(".equ alias, sym")
#ifndef __warn_references
#define __warn_references(sym,msg) \
#ifdef __warn_references
#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
#else
#define openlibm_warn_references(sym,msg) \
__asm__(".section .gnu.warning.sym"); \
__asm__(".asciz \"msg\""); \
__asm__(".previous")
@ -50,30 +62,34 @@
#endif /* __STDC__ */
#elif defined(__clang__) /* CLANG */
#ifdef __STDC__
#define __weak_reference(sym,alias) \
#define openlibm_weak_reference(sym,alias) \
__asm__(".weak_reference " #alias); \
__asm__(".set " #alias ", " #sym)
#else
#define __weak_reference(sym,alias) \
#define openlibm_weak_reference(sym,alias) \
__asm__(".weak_reference alias");\
__asm__(".set alias, sym")
#endif
#else /* !__ELF__ */
#ifdef __STDC__
#define __weak_reference(sym,alias) \
#define openlibm_weak_reference(sym,alias) \
__asm__(".stabs \"_" #alias "\",11,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0")
#ifndef __warn_references
#define __warn_references(sym,msg) \
#ifdef __warn_references
#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
#else
#define openlibm_warn_references(sym,msg) \
__asm__(".stabs \"" msg "\",30,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0")
#endif /* __warn_references */
#else
#define __weak_reference(sym,alias) \
#define openlibm_weak_reference(sym,alias) \
__asm__(".stabs \"_/**/alias\",11,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#ifndef __warn_references
#define __warn_references(sym,msg) \
#ifdef __warn_references
#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
#else
#define openlibm_warn_references(sym,msg) \
__asm__(".stabs msg,30,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#endif /* __warn_references */

View File

@ -107,5 +107,5 @@ __ieee754_acos(double x)
}
#if LDBL_MANT_DIG == 53
__weak_reference(acos, acosl);
openlibm_weak_reference(acos, acosl);
#endif

View File

@ -113,5 +113,5 @@ __ieee754_asin(double x)
}
#if LDBL_MANT_DIG == 53
__weak_reference(asin, asinl);
openlibm_weak_reference(asin, asinl);
#endif

View File

@ -125,5 +125,5 @@ __ieee754_atan2(double y, double x)
}
#if LDBL_MANT_DIG == 53
__weak_reference(atan2, atan2l);
openlibm_weak_reference(atan2, atan2l);
#endif

View File

@ -127,5 +127,5 @@ __ieee754_hypot(double x, double y)
}
#if LDBL_MANT_DIG == 53
__weak_reference(hypot, hypotl);
openlibm_weak_reference(hypot, hypotl);
#endif

View File

@ -75,5 +75,5 @@ __ieee754_remainder(double x, double p)
}
#if LDBL_MANT_DIG == 53
__weak_reference(remainder, remainderl);
openlibm_weak_reference(remainder, remainderl);
#endif

View File

@ -189,7 +189,7 @@ __ieee754_sqrt(double x)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(sqrt, sqrtl);
openlibm_weak_reference(sqrt, sqrtl);
#endif
/*

View File

@ -120,5 +120,5 @@ atan(double x)
}
#if LDBL_MANT_DIG == 53
__weak_reference(atan, atanl);
openlibm_weak_reference(atan, atanl);
#endif

View File

@ -114,5 +114,5 @@ cbrt(double x)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(cbrt, cbrtl);
openlibm_weak_reference(cbrt, cbrtl);
#endif

View File

@ -73,5 +73,5 @@ ceil(double x)
}
#if LDBL_MANT_DIG == 53
__weak_reference(ceil, ceill);
openlibm_weak_reference(ceil, ceill);
#endif

View File

@ -85,5 +85,5 @@ cos(double x)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(cos, cosl);
openlibm_weak_reference(cos, cosl);
#endif

View File

@ -43,5 +43,5 @@ cproj(double complex z)
}
#if LDBL_MANT_DIG == 53
__weak_reference(cproj, cprojl);
openlibm_weak_reference(cproj, cprojl);
#endif

View File

@ -110,5 +110,5 @@ csqrt(double complex z)
}
#if LDBL_MANT_DIG == 53
__weak_reference(csqrt, csqrtl);
openlibm_weak_reference(csqrt, csqrtl);
#endif

View File

@ -392,5 +392,5 @@ exp2(double x)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(exp2, exp2l);
openlibm_weak_reference(exp2, exp2l);
#endif

View File

@ -74,5 +74,5 @@ floor(double x)
}
#if LDBL_MANT_DIG == 53
__weak_reference(floor, floorl);
openlibm_weak_reference(floor, floorl);
#endif

View File

@ -280,5 +280,5 @@ fma(double x, double y, double z)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(fma, fmal);
openlibm_weak_reference(fma, fmal);
#endif

View File

@ -52,5 +52,5 @@ frexp(double x, int *eptr)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(frexp, frexpl);
openlibm_weak_reference(frexp, frexpl);
#endif

View File

@ -63,4 +63,4 @@ __isinfl(long double e)
}
#endif
__weak_reference(__isinff, isinff);
openlibm_weak_reference(__isinff, isinff);

View File

@ -64,4 +64,4 @@ __isnanl(long double e)
}
#endif
__weak_reference(__isnanf, isnanf);
openlibm_weak_reference(__isnanf, isnanf);

View File

@ -45,5 +45,5 @@ logb(double x)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(logb, logbl);
openlibm_weak_reference(logb, logbl);
#endif

View File

@ -120,5 +120,5 @@ nanf(const char *s)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(nan, nanl);
openlibm_weak_reference(nan, nanl);
#endif

View File

@ -77,7 +77,7 @@ nextafter(double x, double y)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(nextafter, nexttoward);
__weak_reference(nextafter, nexttowardl);
__weak_reference(nextafter, nextafterl);
openlibm_weak_reference(nextafter, nexttoward);
openlibm_weak_reference(nextafter, nexttowardl);
openlibm_weak_reference(nextafter, nextafterl);
#endif

View File

@ -77,4 +77,4 @@ nextafterl(long double x, long double y)
return ux.e;
}
__strong_reference(nextafterl, nexttowardl);
openlibm_strong_reference(nextafterl, nexttowardl);

View File

@ -154,5 +154,5 @@ fixup:
}
#if LDBL_MANT_DIG == 53
__weak_reference(remquo, remquol);
openlibm_weak_reference(remquo, remquol);
#endif

View File

@ -88,5 +88,5 @@ rint(double x)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(rint, rintl);
openlibm_weak_reference(rint, rintl);
#endif

View File

@ -59,8 +59,8 @@ scalbn (double x, int n)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(scalbn, ldexpl);
__weak_reference(scalbn, scalbnl);
openlibm_weak_reference(scalbn, ldexpl);
openlibm_weak_reference(scalbn, scalbnl);
#endif
__strong_reference(scalbn, ldexp);
openlibm_strong_reference(scalbn, ldexp);

View File

@ -54,4 +54,4 @@ scalbnf (float x, int n)
return x*twom25;
}
__strong_reference(scalbnf, ldexpf);
openlibm_strong_reference(scalbnf, ldexpf);

View File

@ -67,4 +67,4 @@ scalbnl (long double x, int n)
return u.e*0x1p-128;
}
__strong_reference(scalbnl, ldexpl);
openlibm_strong_reference(scalbnl, ldexpl);

View File

@ -85,5 +85,5 @@ sin(double x)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(sin, sinl);
openlibm_weak_reference(sin, sinl);
#endif

View File

@ -146,5 +146,5 @@ sincos(double x, double * s, double * c)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(sincos, sincosl);
openlibm_weak_reference(sincos, sincosl);
#endif

View File

@ -79,5 +79,5 @@ tan(double x)
}
#if (LDBL_MANT_DIG == 53)
__weak_reference(tan, tanl);
openlibm_weak_reference(tan, tanl);
#endif

View File

@ -63,5 +63,5 @@ trunc(double x)
}
#if LDBL_MANT_DIG == 53
__weak_reference(trunc, truncl);
openlibm_weak_reference(trunc, truncl);
#endif

View File

@ -21,5 +21,5 @@ cabs(double complex z)
}
#if LDBL_MANT_DIG == 53
__weak_reference(cabs, cabsl);
openlibm_weak_reference(cabs, cabsl);
#endif