Răsfoiți Sursa

alpha: stop bits/wordsize.h from deciding long double math

alpha is the only port whose bits/wordsize.h defines
__NO_LONG_DOUBLE_MATH, from the absence of __LONG_DOUBLE_128__.  That
macro decides whether libm provides the long double entry points -- and
wordsize.h is not in the include chain of math.h.  It is reached only
through math_private.h, so it speaks to the library build and not to the
programs that link against it.

The result is a library that provides part of the long double interface.
Preprocessing every libm file that tests the macro, with
UCLIBC_HAS_LONG_DOUBLE_MATH=y, 25 of them see it and drop their function
-- acoshl, atanhl, hypotl, sqrtl, expl, lgammal, tgammal and the rest of
the w_*l.c files -- while four do not and keep theirs:
ldouble_wrappers.c, w_cabs.c, cexp.c and sincos.c.  So
cabsl is built and calls a hypotl that was not, and any program reaching
cabsl fails to link:

  libc.a(w_cabs.os): in function `__GI_cabsl':
  (.text+0x88): undefined reference to `__GI_hypotl'

Anything reaching cabsl therefore fails to build, and so does anything
calling the long double entry points.  Meanwhile math.h, which never
sees the macro, declares all of them.

The config already has a mechanism for this, and it works: alpha's own
bits/mathdef.h defines __NO_LONG_DOUBLE_MATH when
__UCLIBC_HAS_LONG_DOUBLE_MATH__ is absent, and mathdef.h *is* included by
math.h.  Checked by building with the option genuinely off: all five of
the files above then see the macro, headers and library agreeing.  So the
block in wordsize.h decides nothing that is not decided better elsewhere,
and __LONG_DOUBLE_MATH_OPTIONAL, which it also sets, is read nowhere in
the tree.

Providing the long double functions is right here in any case: this
toolchain has __SIZEOF_LONG_DOUBLE__ 8, so long double is double on
alpha and the wrappers in ldouble_wrappers.c lose nothing.

Built for alpha with the option on: acoshl, asinhl, atanhl, hypotl,
cabsl, sqrtl, expl, lgammal, tgammal and exp10l all present, and the link
above resolves.  Programs calling those entry points build against the
result and give the expected values under qemu-alpha.

Signed-off-by: Ramin Moussavi <lordrasmus@gmail.com>
ramin 3 zile în urmă
părinte
comite
3f2ef085d8
1 a modificat fișierele cu 0 adăugiri și 11 ștergeri
  1. 0 11
      libc/sysdeps/linux/alpha/bits/wordsize.h

+ 0 - 11
libc/sysdeps/linux/alpha/bits/wordsize.h

@@ -16,14 +16,3 @@
    <http://www.gnu.org/licenses/>.  */
 
 #define __WORDSIZE	64
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal that we didn't used to have a `long double'. The changes all
-   the `long double' function variants to be redirects to the double
-   functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL	1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH		1
-# endif
-#endif