Chris Metcalf e59c94fa0e math: add LDBL_CLASSIFY_COMPAT support
If a platform does not define "long-double-fcts = yes" in its
Makefiles and it does define __NO_LONG_DOUBLE_MATH in its installed
headers, it will currently create exported symbols for __finitel,
__isinfl, and __isnanl that can't be reached from userspace by
correct use of the finite(), isinf(), or isnan() macros in <math.h>.

To avoid this situation, by default for such platforms we now no
longer export these symbols, thus causing appropriate link-time
errors.  However, for platforms that previously exported these
symbols, we continue to do so as compat symbols; this is enabled
by adding LDBL_CLASSIFY_COMPAT to math_private.h for the platform.

For tile, remove the now-unnecessary exports of those functions from
libc and libm.
2015-12-03 13:00:46 -05:00

40 lines
1011 B
C

/* @(#)s_isnan.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/*
* isnan(x) returns 1 is x is nan, else 0;
* no branching!
*/
#include <math.h>
#include <math_private.h>
#include <shlib-compat.h>
#include <stdint.h>
#undef __isnan
int __isnan(double x)
{
int64_t hx;
EXTRACT_WORDS64(hx,x);
hx &= UINT64_C(0x7fffffffffffffff);
hx = UINT64_C(0x7ff0000000000000) - hx;
return (int)(((uint64_t)hx)>>63);
}
hidden_def (__isnan)
weak_alias (__isnan, isnan)
#ifdef NO_LONG_DOUBLE
# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
# endif
weak_alias (__isnan, isnanl)
#endif