Commit Graph

32300 Commits

Author SHA1 Message Date
Szabolcs Nagy 72aa623345 Optimized generic expf and exp2f with wrappers
Based on new expf and exp2f code from
https://github.com/ARM-software/optimized-routines/

with wrapper on aarch64:
expf reciprocal-throughput: 2.3x faster
expf latency: 1.7x faster
without wrapper on aarch64:
expf reciprocal-throughput: 3.3x faster
expf latency: 1.7x faster
without wrapper on aarch64:
exp2f reciprocal-throughput: 2.8x faster
exp2f latency: 1.3x faster
libm.so size on aarch64:
.text size: -152 bytes
.rodata size: -1740 bytes
expf/exp2f worst case nearest rounding error: 0.502 ulp
worst case non-nearest rounding error: 1 ulp

Error checks are inline and errno setting is in separate tail called
functions, but the wrappers are kept in this patch to handle the
_LIB_VERSION==_SVID_ case.  (So e.g. errno is set twice for expf calls
and once for __expf_finite calls on targets where the new code is used.)

Double precision arithmetics is used which is expected to be faster on
most targets (including soft-float) than using single precision and it
is easier to get good precision result with it.

Const data is kept in a separate translation unit which complicates
maintenance a bit, but is expected to give good code for literal loads
on most targets and allows sharing data across expf, exp2f and powf.
(This data is disabled on i386, m68k and ia64 which have their own
expf, exp2f and powf code.)

Some details may need target specific tweaks:
- best convert and round to int operation in the arg reduction may be
different across targets.
- code was optimized on fma target, optimal polynomial eval may be
different without fma.
- gcc does not always generate good code for fp bit representation
access via unions or it may be inherently slow on some targets.

The libm-test-ulps will need adjustment because..
- The argument reduction ideally uses nearest rounded rint, but that is
not efficient on most targets, so the polynomial can get evaluated on a
wider interval in non-nearest rounding mode making 1 ulp errors common
in that case.
- The polynomial is evaluated such that it may have 1 ulp error on
negative tiny inputs with upward rounding.

	* math/Makefile (type-float-routines): Add math_errf and e_exp2f_data.
	* sysdeps/aarch64/fpu/math_private.h (TOINT_INTRINSICS): Define.
	(roundtoint, converttoint): Likewise.
	* sysdeps/ieee754/flt-32/e_expf.c: New implementation.
	* sysdeps/ieee754/flt-32/e_exp2f.c: New implementation.
	* sysdeps/ieee754/flt-32/e_exp2f_data.c: New file.
	* sysdeps/ieee754/flt-32/math_config.h: New file.
	* sysdeps/ieee754/flt-32/math_errf.c: New file.
	* sysdeps/ieee754/flt-32/t_exp2f.h: Remove.
	* sysdeps/i386/fpu/e_exp2f_data.c: New file.
	* sysdeps/i386/fpu/math_errf.c: New file.
	* sysdeps/ia64/fpu/e_exp2f_data.c: New file.
	* sysdeps/ia64/fpu/math_errf.c: New file.
	* sysdeps/m68k/m680x0/fpu/e_exp2f_data.c: New file.
	* sysdeps/m68k/m680x0/fpu/math_errf.c: New file.
2017-09-25 10:44:39 +01:00
Samuel Thibault fcafcd162c hurd: Fix exposition of s/gettimeofday through timespec_s/get
conform/ISO11/time.h/linknamespace complains that using timespec_get exposes
gettimeofday.

conform/POSIX/time.h/linknamespace complains that using clock_settime
exposes settimeofday.

	* sysdeps/unix/clock_gettime.c (realtime_gettime, __clock_gettime): Use
	__gettimeofday instead of gettimeofday.
	* sysdeps/unix/clock_settime.c (__clock_settime): Use __settimeofday
	instead of settimeofday.
2017-09-25 01:55:02 +02:00
Samuel Thibault 6174537c24 resolv_test.c: also cope with CONNREFUSED errors returned by recvfrom
server_thread_udp_process_one already takes care of calling sendto()
instead of xsendto to be able to ignore the case where the client has
closed the socket.  Depending on the TCP/IP stack behavior, this error
could be notified later through recvfrom(), so we need to ignore it
there too.

* support/resolv_test.c (server_thread_udp_process_one): Call recvfrom
instead of xrecvfrom, and ignore ECONNREFUSED errors.
2017-09-25 01:11:43 +02:00
Samuel Thibault b38a42a098 hurd: Fix bits/socket.h conformity
* sysdeps/mach/hurd/bits/socket.h: Include <bits/wordsize.h> instead
	of <limits.h>
	(__need_NULL): Do not define.
	(__ss_aligntype): Use __WORDSIZE instead of ULONG_MAX to determine
	alignment.
	[!__USE_MISC] (pseudo_AF_XTP, pseudo_AF_RTIP, pseudo_AF_PIP,
	CMGROUP_MAX, cmsgcred): Do not define.
	(CMSG_FIRSTHDR, __cmsg_nxthdr): Use (struct cmsghdr *) 0 instead of
	NULL.
	* bits/socket.h: Likewise.
2017-09-24 22:21:41 +02:00
Samuel Thibault 5e6f32531e hurd: Make sure dl-sysdep.c defines proper symbol names
* sysdeps/mach/hurd/dl-sysdep.c (check_no_hidden): New macro.
	(__open, __close, __libc_read, __libc_write, __writev, __libc_lseek64,
	__mmap, __fxstat64, __xstat64, __access, __access_noerrno, __getpid,
	__getcwd, __sbrk, __strtoul_internal, _exit, abort): Use check_no_hidden
	to make sure that these symbols are defined.
2017-09-24 17:54:02 +02:00
Joseph Myers 2f49ce7d62 Use libm_alias_float in flt-32.
This patch makes flt-32 libm functions use libm_alias_float to define
public interfaces (in cases where _Float32 aliases of those interfaces
would be appropriate, so not for finitef / isinff / isnanf).

Tested for x86_64.  Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/ieee754/flt-32/s_asinhf.c: Include <libm-alias-float.h>.
	(asinhf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_atanf.c: Include <libm-alias-float.h>.
	(atanf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_cbrtf.c: Include <libm-alias-float.h>.
	(cbrtf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_ceilf.c: Include <libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_copysignf.c: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_cosf.c: Include <libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_erff.c: Include <libm-alias-float.h>.
	(erff): Define using libm_alias_float.
	(erfcf): Likewise.
	* sysdeps/ieee754/flt-32/s_expm1f.c: Include <libm-alias-float.h>.
	(expm1f): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_fabsf.c: Include <libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_floorf.c: Include <libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_frexpf.c: Include <libm-alias-float.h>.
	(frexpf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_fromfpf.c (fromfpf): Define using
	libm_alias_float.
	* sysdeps/ieee754/flt-32/s_fromfpf_main.c: Include
	<libm-alias-float.h>.
	* sysdeps/ieee754/flt-32/s_fromfpxf.c (fromfpxf): Define using
	libm_alias_float.
	* sysdeps/ieee754/flt-32/s_getpayloadf.c: Include
	<libm-alias-float.h>.
	(getpayloadf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_llroundf.c: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_logbf.c: Include <libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_lroundf.c: Include <libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_modff.c: Include <libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_nearbyintf.c: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_nextafterf.c: Include
	<libm-alias-float.h>.
	(nextafterf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_nextupf.c: Include
	<libm-alias-float.h>.
	(nextupf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_remquof.c: Include
	<libm-alias-float.h>.
	(remquof): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_rintf.c: Include <libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_roundevenf.c: Include
	<libm-alias-float.h>.
	(roundevenf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_roundf.c: Include <libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_setpayloadf.c (setpayloadf): Define
	using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_setpayloadf_main.c: Include
	<libm-alias-float.h>.
	* sysdeps/ieee754/flt-32/s_setpayloadsigf.c (setpayloadsigf):
	Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_sincosf.c: Include
	<libm-alias-float.h>.
	(sincosf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_sinf.c: Include <libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_tanf.c: Include <libm-alias-float.h>.
	(tanf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_tanhf.c: Include <libm-alias-float.h>.
	(tanhf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_totalorderf.c: Include
	<libm-alias-float.h>.
	(totalorderf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_totalordermagf.c: Include
	<libm-alias-float.h>.
	(totalordermagf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_truncf.c: Include <libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/ieee754/flt-32/s_ufromfpf.c (ufromfpf): Define using
	libm_alias_float.
	* sysdeps/ieee754/flt-32/s_ufromfpxf.c (ufromfpxf): Define using
	libm_alias_float.
2017-09-22 20:24:12 +00:00
Gabriel F. T. Gomes c5c4a62609 Let fpclassify use the builtin when optimizing for size in C++ mode (bug 22146)
When optimization for size is on (-Os), fpclassify does not use the
type-generic __builtin_fpclassify builtin, instead it uses __MATH_TG.
However, when library support for float128 is available, __MATH_TG uses
__builtin_types_compatible_p, which is not available in C++ mode.

On the other hand, libstdc++ undefines (in cmath) many macros from
math.h, including fpclassify, so that it can provide its own functions.
However, during its configure tests, libstdc++ just tests for the
availability of the macros (it does not undefine them, nor does it
provide its own functions).

Finally, when libstdc++ is configured with optimization for size
enabled, its configure tests include math.h and get the definition of
fpclassify that uses __MATH_TG (and __builtin_types_compatible_p).
Since libstdc++ does not undefine the macros during its configure tests,
they fail.

This patch lets fpclassify use the builtin in C++ mode, even when
optimization for size is on.  This allows the configure test in
libstdc++ to work.

Tested for powerpc64le and x86_64.

	[BZ #22146]
	math/math.h: Let fpclassify use the builtin in C++ mode, even
	when optimazing for size.
2017-09-22 14:47:16 -03:00
Joseph Myers 2394784665 Remove Banner mechanism.
This patch removes the Banner mechanism, with the last remaining
Banner file replaced by a contrib.texi entry.  This accords with the
principle that the output of running libc.so.6 is not the place to
credit particular contributions (the manual is), and with all other
configuration options not mentioned there, it doesn't seem appropriate
to focus there on the one question of whether the one remaining piece
configured as an add-on was enabled or not.

Tested for x86_64.

	* csu/Makefile (generated): Do not add version-info.h.
	(before-compile): Likewise.
	(all-Banner-files): Remove variable.
	($(objpfx)version-info.h): Remove rule.
	* csu/version.c (banner): Do not include "version-info.h".
	* libidn/Banner: Remove.
	* manual/contrib.texi (Simon Josefsson): New entry.
2017-09-22 17:43:42 +00:00
Gabriel F. T. Gomes 9ac3c68218 Remove conditional on LDBL_MANT_DIG from e_lgammal_r.c
The IEEE 754 implementation of lgammal in sysdeps/ieee754/ldbl-128/ used
to be shared by IBM's implementation in sysdeps/ieee754/ldbl-128ibm/ (by
an inclusion of the source file).  In order for the algorithm to work
for IBM's implementation, a check for LDBL_MANT_DIG was required. Since
the source file is no longer shared, the requirement for the check is
gone.  This patch removes the conditionals.

Tested for powerpc64le and s390x.

	* sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r):
	Remove conditionals on LDBL_MANT_DIG.
	* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
	(__ieee754_lgammal_r): Likewise.
2017-09-21 17:37:40 -03:00
Gabriel F. T. Gomes d2f0ed09f8 ldbl-128ibm: Automatic replacing of _Float128 and L()
The ldbl-128ibm implementation of j0l, j1l, lgammal_r, and cbrtl, as
well as the tables used by expl were copied from ldbl-128.  However, the
original files used _Float128 for the type and L() for the literal
suffix.  This patch uses the following sed command to rewrite _Float128
as long double and L(x) as xL (for e_expl.c, e_j0l.c, e_j1l.c,
e_lgammal_r.c, and t_expl.h):

  sed -i <filename> \
    -e "/^#define _Float128 long double/d" \
    -e "/^#define L(x) x ## L/d" \
    -e "/L(/s/)/L/" \
    -e "/L(/s/L(//" \
    -e "s/_Float128/long double/g"

For sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c, this sed command incorrectly
replaces a few occurrences of L(), so the following command is used
instead:

  sed -i sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c \
    -e "/^#define _Float128 long double/d" \
    -e "/^#define L(x) x ## L/d" \
    -e "s/L(0\.3\{40\})/0.3333333333333333333333333333333333333333L/" \
    -e "s/L(3\.7568280825958912391243e-1)/3.7568280825958912391243e-1L/" \
    -e "/L(/s/)/L/" \
    -e "/L(/s/L(//" \
    -e "s/_Float128/long double/g"

Tested for powerpc64le with patched [1] and unpatched gcc.

[1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html

	* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Remove definitions of
	_Float128 and L().
	* sysdeps/ieee754/ldbl-128ibm/e_j0l.c: Remove definitions of
	_Float128 and L(). Replace _Float128 with long double and L(x)
	with xL, throughout the file.
	* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/t_expl.h: Likewise.
2017-09-21 17:37:39 -03:00
Gabriel F. T. Gomes c5c2e667bf ldbl-128ibm: Copy implementations from ldbl-128 instead of including them
Some files under sysdeps/ieee754/ldbl-128ibm/ are able to reuse the
implementation in sysdeps/ieee754/ldbl-128/ by defining _Float128 to
long double.  This relied on compiler support for _Float128 being
disabled.  On powerpc, such support was disabled by default, however, it
got enabled by default [1] in GCC 8.

This patch copies the implementations from ldbl-128 to ldbl-128ibm.  The
uses of _Float128 and L() are kept intact in this patch and are replaced
with a script in a subsequent patch.

[1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html

Tested for powerpc64 and powerpc64le.

	* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Include tables from
	sysdeps/ieee754/ldbl-128ibm.
	* sysdeps/ieee754/ldbl-128ibm/e_j0l.c: Copy contents from the
	equivalent implementation in sysdeps/ieee754/ldbl-128/ instead
	of including it.  Keep _Float128 and L() intact.  These will be
	reviewed by a separate patch.
	* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/t_expl.h: Likewise.
2017-09-21 17:37:39 -03:00
Gabriel F. T. Gomes e010deb231 powerpc: Add redirection for finitef128, isinf128, and isnanf128
On powerpc64le, compiler support for float128 is not enabled by default
on gcc.  To enable it, the flag -mfloat128 must be passed as a command
line option to the compiler.  This means that only the few files that
actively have -mfloat128 passed as an argument get compiler support for
float128, whereas all other files don't.

When -mfloat128 becomes enabled by default on powerpc [1], all the files
that do not currently have compiler support for float128 enabled during
their compilation, will start to have it.  This will lead to build
errors in s_finite.c, s_isinf.c, and s_isnan.c.

The errors are due to the unintended macro expansion of __finitef128 to
__redirect_finitef128 in math/bits/mathcalls-helper-functions.h.  In
that header, __MATHDECL_1 takes '__finite' and 'f128' as arguments and
concatenates them.  However, since '__finite' has been redefined in
s_finite.c, the function declaration becomes __redirect_finitef128:

    extern int __redirect___finitef128 (_Float128 __value) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));

This declaration itself is OK.  The problem arises when include/math.h
creates the hidden prototype ('hidden_proto (__finitef128)'), which
expands to:

    extern __typeof (__finitef128) __finitef128 __attribute__ ((visibility ("hidden")));

Since __finitef128 is not declared, __typeof fails.  This effect was
already true for the 'float' and 'long double' versions and is now true
for float128.  Likewise for isinsff128 and isnanf128.

This patch defines __finitef128 as __redirect___finitef128 in
sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c, similarly to what's
done for the float and long double versions of these functions, to get
rid of the build error.  Likewise for isinff128 and isnanf128.

[1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html

Tested for powerpc64 and powerpc64le.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
	(__finitef128): Define to __redirect___finitef128.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
	(__isinff128): Define to __redirect___isinff128.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
	(__isnanf128): Define to __redirect___isnanf128.
2017-09-21 17:37:39 -03:00
Gabriel F. T. Gomes ffa448041b powerpc64le: Add -mfloat128 to tst-strtod-nan-locale testcase
On powerpc64le, not all files can have the flag -mfloat128 passed as an
option on the compile command, since that could conflict with other
flags, such as -mno-vsx.  Each file that needs the flag, gets it through
a CFLAGS-filename variable on sysdeps/powerpc/powerpc64le/Makefile.

The test cases tst-strtod-nan-locale and tst-wcstod-nan-locale are
missing this flag.

Tested for powerpc64le.

	* sysdeps/powerpc/powerpc64le/Makefile
	(CFLAGS-tst-strtod-nan-locale.c): New variable.
	(CFLAGS-tst-wcstod-nan-locale.c): New variable.
2017-09-21 17:37:39 -03:00
Paul Pluzhnikov e5e4d7cc05 Fix BZ# 22180.
POSIX requires that dlclose() and exit() be thread safe, therefore
you can have one thread in the middle of dlclose() and another thread
executing exit() without causing any undefined behaviour on the part
of the implementation.

The existing implementation had a flaw that exit() exit handler processing
did not consider a concurrent dlclose() and would not mark already run
exit handlers using the ef_free flavour. The consequence of this is that
a concurrent exit() with dlclose() will run all the exit handlers that
dlclose() had not yet run, but then will block on the loader lock. The
concurrent dlclose() will continue to run all the exit handlers again
(twice) in violation of the Itanium C++ ABI requirements for __cxa_atexit().

This commit fixes this by having exit() mark all handlers with ef_free to
ensure that concurrent dlclose() won't re-run registered exit handlers that
have already run.
2017-09-21 12:14:41 -07:00
Joseph Myers c10c5267a8 Remove non-add-on Banner files.
Various subdirectories of glibc include Banner files to put some text
in the output of executing libc.so.6, under "Available extensions".

Some of those subdirectories (e.g. crypt) may originally have been
add-ons (and so optional, so a particular glibc build might or might
not have included them), but except for libidn they aren't now (or if
only included in some builds, in the case of soft-fp, the inclusion
depends on the architecture for which glibc is configured rather than
having any glibc configuration for which it's an optional feature),
and it doesn't seem useful for the libc.so.6 output to call out a few
features like that.

This patch removes the non-add-on Banner files, updating contrib.texi
where they noted contributions not otherwise mentioned there.

Tested for x86_64.

	* crypt/Banner: Remove file.
	* nptl/Banner: Likewise.
	* resolv/Banner: Likewise.
	* soft-fp/Banner: Likewise.
	* nptl/Makefile ($(objpfx)banner.h): Remove rule.
	($(objpfx)version.d): Remove dependency on banner.h.
	($(objpfx)version.os): Likewise.
	* nptl/version.c (banner): Do not include banner.h.
	* manual/contrib.texi: Update entries for Richard Henderson, Jakub
	Jelinek and BIND code.
2017-09-21 17:49:51 +00:00
Paul Pluzhnikov 1cc9e59a93 Implement xdlopen, xdlsym and xdlclose routines which terminate test
program with appropriate message if the corresponding dlfcn.h routine
returns an error.

Use them in stdlib/tst-tls-atexit.c
2017-09-20 19:37:45 -07:00
Joseph Myers ae8372d7e4 Add SSE4.1 trunc, truncf (bug 20142).
This patch adds SSE4.1 versions of trunc and truncf, using the roundsd
/ roundss instructions, similar to the versions of ceil, floor, rint
and nearbyint functions we already have.  In my testing with the glibc
benchtests these are about 30% faster than the C versions for double,
20% faster for float.

Tested for x86_64.

	[BZ #20142]
	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
	Add s_trunc-c, s_truncf-c, s_trunc-sse4_1 and s_truncf-sse4_1.
	* sysdeps/x86_64/fpu/multiarch/s_trunc-c.c: New file.
	* sysdeps/x86_64/fpu/multiarch/s_trunc-sse4_1.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_trunc.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_truncf-c.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_truncf-sse4_1.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_truncf.c: Likewise.
2017-09-20 16:54:05 +00:00
Paul Pluzhnikov a856d4d4a8 Oops. stdlib/test-atexit-race-common.c should have been part of 26e70aec70 2017-09-20 09:51:02 -07:00
Paul Pluzhnikov 26e70aec70 Fix BZ 14333 2017-09-20 09:31:48 -07:00
Szabolcs Nagy 0525ce4850 Add exp2f and log2f benchmark trace
exp2f and log2f benchmark traces are just copies of the existing
expf and logf traces from wrf_r.

	* benchtests/Makefile: Add exp2f and log2f benchmarks.
	* benchtests/exp2f-inputs: Copy of expf-inputs.
	* benchtests/log2f-inputs: Copy of logf-inputs.
2017-09-20 10:04:12 +01:00
Joseph Myers d82468d100 Fix fexecve build where syscall macros call sizeof.
The recent fexecve changes broke the build on (at least) alpha (maybe
other configurations, that was the first breakage I saw in my
build-many-glibcs.py run):

In file included from ../sysdeps/unix/sysv/linux/alpha/sysdep.h:29:0,
                 from ../sysdeps/alpha/nptl/tls.h:31,
                 from ../include/errno.h:25,
                 from ../sysdeps/unix/sysv/linux/fexecve.c:18:
../sysdeps/unix/sysv/linux/fexecve.c: In function 'fexecve':
../sysdeps/unix/alpha/sysdep.h:203:10: error: 'sizeof' on array function parameter 'argv' will return size of 'char * const*' [-Werror=sizeof-array-argument]
   (sizeof(arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
          ^
../sysdeps/unix/alpha/sysdep.h:302:26: note: in expansion of macro 'syscall_promote'
  register long _tmp_18 = syscall_promote (arg3);  \
                          ^~~~~~~~~~~~~~~
../sysdeps/unix/alpha/sysdep.h:173:2: note: in expansion of macro 'inline_syscall5'
  inline_syscall##nr(__NR_##name, args); \
  ^~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/alpha/sysdep.h:85:2: note: in expansion of macro 'INLINE_SYSCALL1'
  INLINE_SYSCALL1(name, nr, args);    \
  ^~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/fexecve.c:42:3: note: in expansion of macro 'INLINE_SYSCALL'
   INLINE_SYSCALL (execveat, 5, fd, "", argv, envp, AT_EMPTY_PATH);
   ^~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/fexecve.c:33:30: note: declared here
 fexecve (int fd, char *const argv[], char *const envp[])
                              ^~~~

This patch fixes this similarly to previous fixes for such issues: use
&argv[0] and &envp[0] as the syscall macro arguments.  Tested
(compilation only) for alpha-linux-gnu with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/fexecve.c (fexecve) [__NR_execveat]:
	Explicitly take address of first element of array arguments in
	call to INLINE_SYSCALL.
2017-09-19 15:50:38 +00:00
Andreas Schwab 43ffc53a35 Use execveat syscall in fexecve (bug 22134)
By using execveat we no longer depend on /proc.  The execveat syscall was
introduced in 3.19, except for a few late comers.
2017-09-19 16:19:14 +02:00
Wilco Dijkstra a5dcc87e77 Add logf trace
Add a trace for logf.  This is a reduced trace based on 2.8 billion
samples extracted from wrf_r.

	* benchtests/Makefile: Add logf benchmark.
	* benchtests/logf-inputs: Add reduced trace from wrf_r.
2017-09-19 15:14:46 +01:00
Wilco Dijkstra 7024d5446d Add expf trace
Add a trace for expf.  This is a reduced trace based on 2.4 billion
samples extracted from wrf_r.

	* benchtests/Makefile: Add expf benchmark.
	* benchtests/expf-inputs: Add reduced trace from wrf_r.
2017-09-19 15:14:18 +01:00
Wilco Dijkstra ca3a382ea3 Enable unwind info in libc-start.c and backtrace.c
Add unwind info to __libc_start_main so that unwinding continues one
extra level to _start.  Similarly add unwind info to backtrace.
Given many targets require this, do this in a general way.

	* csu/Makefile: Add -funwind-tables to libc-start.c.
	* debug/Makefile: Add -funwind-tables to backtrace.c.
	* sysdeps/aarch64/Makefile: Remove CFLAGS-backtrace.c.
	* sysdeps/arm/Makefile: Likewise.
	* sysdeps/i386/Makefile: Likewise.
	* sysdeps/m68k/Makefile: Likewise.
	* sysdeps/mips/Makefile: Likewise.
	* sysdeps/nios2/Makefile: Likewise.
	* sysdeps/sh/Makefile: Likewise.
	* sysdeps/sparc/Makefile: Likewise.
2017-09-19 15:07:58 +01:00
Joseph Myers eb375def3d Add benchtests for trunc and truncf.
This patch adds benchtests for the trunc and truncf functions.  The
inputs listed are fairly arbitrary; I do not assert they are
representative of any particular application.

	* benchtests/Makefile (bench-math): Add trunc and truncf.
	(CFLAGS-bench-trunc.c): New variable.
	(CFLAGS-bench-truncf.c): Likewise.
	* benchtests/trunc-inputs: New file.
	* benchtests/truncf-inputs: Likewise.
2017-09-19 12:59:01 +00:00
Rajalakshmi Srinivasaraghavan bd17ba29eb powerpc: Avoid misaligned stores in memset
As per the section "3.1.4.2 Alignment Interrupts" of the "POWER8 Processor
User's Manual for the Single-Chip Module", alignment interrupt is reported
for misaligned stores in  Caching-inhibited storage.  As memset is used in
some drivers for DMA (like xorg), this patch avoids misaligned stores for
sizes less than 8 in memset.
2017-09-19 13:55:49 +05:30
Joseph Myers 6d9b0b5a22 Fix powerpc64le problem from last ldbl-opt patch.
This patch fixes a problem on powerpc64le that I missed in initial
testing of my last patch to ldbl-opt.  In the specific case of
powerpc64le, the weak aliases for exp10l and remainderl do not get
defined in the generic wrappers because of how those wrappers
undefine and redefine weak_alias.  This patch restores those aliases
in the ldbl-opt code.

Tested (compilation only) for powerpc64le with build-many-glibcs.py.

	* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c [LIBM_SVID_COMPAT &&
	!LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)] (weak_alias): Undefine and
	redefine.
	[LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)]
	(exp10l): Define as weak alias.
	* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c [LIBM_SVID_COMPAT
	&& !LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (weak_alias): Undefine
	and redefine.
	[LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)]
	(remainderl): Define as weak alias.
2017-09-18 23:26:35 +00:00
Joseph Myers 92892fdbfa Use libm_alias_ldouble in math/.
This patch converts libm function implementations in math/ from using
weak_alias to using libm_alias_ldouble to define public function
names, in cases where it would be appropriate to define _Float128 /
_Float64x aliases for those functions as well (in cases where either
or both of those types exist and have the same ABI as long double).
This eliminates many ldbl-opt wrappers round these function
implementations.

Tested for x86_64, and with build-many-glibcs.py.  All installed
stripped shared libraries are unchanged except for libm.so on
powerpc64le.  As noted for a previous patch, powerpc64le's use of
ldbl-opt means various long double functions get defined using
long_double_symbol which gives them an explicit symbol version in the
object files, and this patch results in some such functions using
weak_alias instead (because powerpc64le never had a previous version
of these functions for long double = double); both produce a valid
libm.so with the same public symbols at the same versions, but macros
expanding to call weak_alias is cleaner in this case.

	* math/s_fmal.c: Include <libm-alias-ldouble.h>.
	(fmal): Define using libm_alias_ldouble.
	* math/w_acoshl_compat.c: Include <libm-alias-ldouble.h>.
	(acoshl): Define using libm_alias_ldouble.
	* math/w_acosl_compat.c: Include <libm-alias-ldouble.h>.
	(acosl): Define using libm_alias_ldouble.
	* math/w_asinl_compat.c: Include <libm-alias-ldouble.h>.
	(asinl): Define using libm_alias_ldouble.
	* math/w_atan2l_compat.c: Include <libm-alias-ldouble.h>.
	(atan2l): Define using libm_alias_ldouble.
	* math/w_atanhl_compat.c: Include <libm-alias-ldouble.h>.
	(atanhl): Define using libm_alias_ldouble.
	* math/w_coshl_compat.c: Include <libm-alias-ldouble.h>.
	(coshl): Define using libm_alias_ldouble.
	* math/w_exp10l_compat.c: Include <libm-alias-ldouble.h>.
	(exp10l): Define using libm_alias_ldouble.
	* math/w_exp2l_compat.c: Include <libm-alias-ldouble.h>.
	(exp2l): Define using libm_alias_ldouble.
	* math/w_expl_compat.c: Include <libm-alias-ldouble.h>.
	(expl): Define using libm_alias_ldouble.
	* math/w_fmodl_compat.c: Include <libm-alias-ldouble.h>.
	(fmodl): Define using libm_alias_ldouble.
	* math/w_hypotl_compat.c: Include <libm-alias-ldouble.h>.
	(hypotl): Define using libm_alias_ldouble.
	* math/w_j0l_compat.c: Include <libm-alias-ldouble.h>.
	(j0l): Define using libm_alias_ldouble.
	(y0l): Likewise.
	* math/w_j1l_compat.c: Include <libm-alias-ldouble.h>.
	(j1l): Define using libm_alias_ldouble.
	(y1l): Likewise.
	* math/w_jnl_compat.c: Include <libm-alias-ldouble.h>.
	(jnl): Define using libm_alias_ldouble.
	(ynl): Likewise.
	* math/w_log10l_compat.c: Include <libm-alias-ldouble.h>.
	(log10l): Define using libm_alias_ldouble.
	* math/w_log2l_compat.c: Include <libm-alias-ldouble.h>.
	(log2l): Define using libm_alias_ldouble.
	* math/w_logl_compat.c: Include <libm-alias-ldouble.h>.
	(logl): Define using libm_alias_ldouble.
	* math/w_powl_compat.c: Include <libm-alias-ldouble.h>.
	(powl): Define using libm_alias_ldouble.
	* math/w_remainderl_compat.c: Include <libm-alias-ldouble.h>.
	(remainderl): Define using libm_alias_ldouble.
	* math/w_sinhl_compat.c: Include <libm-alias-ldouble.h>.
	(sinhl): Define using libm_alias_ldouble.
	* math/w_sqrtl_compat.c: Include <libm-alias-ldouble.h>.
	(sqrtl): Define using libm_alias_ldouble.
	* math/w_tgammal_compat.c: Include <libm-alias-ldouble.h>.
	(tgammal): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c [LIBM_SVID_COMPAT]
	(exp10l): Do not use long_double_symbol here.
	* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c
	[LIBM_SVID_COMPAT] (remainderl): Likewise.
	* sysdeps/ieee754/ldbl-opt/s_fmal.c: Remove.
	* sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise.
2017-09-18 17:51:33 +00:00
Wang Boshi 6cd380dd36 AArch64: use movz/movk instead of literal pools in start.S
eXecute-Only Memory (XOM) is a protection mechanism against some ROP
attacks. XOM sets the code as executable and unreadable, so the access
to any data, like literal pools, in the code section causes the fault
with XOM. The compiler can disable literal pools for C source files,
but not for assembly files, so I use movz/movk instead of literal pools
in start.S for XOM.

I add MOVL macro with movz/movk instructions like movl pseudo-instruction
in armasm, and use the macro instead of literal pools.

	* sysdeps/aarch64/start.S: Use MOVL instead of literal pools.
	* sysdeps/aarch64/sysdep.h (MOVL): Add MOVL macro.
2017-09-18 18:15:47 +01:00
Samuel Thibault 1c6d89e9a4 Add missing libc_hidden_weak/def calls
* io/read.c (read): Add libc_hidden_weak.
	* sysdeps/mach/hurd/read.c (read): Likewise.
	* io/write.c (write): Likewise.
	* sysdeps/mach/hurd/write.c (write): Likewise.
	* io/pread64.c (__pread64): Likewise.
	* sysdeps/mach/hurd/pread64.c (__pread64): Likewise.
	* posix/pread64.c (__pread64): Add libc_hidden_def.
2017-09-17 21:57:39 +02:00
Paul Pluzhnikov c207f7ce73 Add missing space. 2017-09-16 10:55:55 -07:00
Paul Pluzhnikov 35a29136d6 Add missing space. 2017-09-16 10:50:22 -07:00
Siddhesh Poyarekar 140647ea6f benchtests: New -g option to generate graphs in compare_strings.py
The compare_strings.py option unconditionally generates a graph PNG
image of the input data, which can be unnecessary and slow.  Put this
behind an optional flag -g.

	* benchtests/scripts/compare_strings.py: New option -g.
	(draw_graph): Print a message that a graph is being generated.
	(process_results): Generate graph only if -g is passed.
	(main): Process option -g.
2017-09-16 15:24:00 +05:30
Siddhesh Poyarekar 5a6547b7b9 benchtests: Make compare_strings.py output a bit prettier
Make the column widths for the outputs fixed so that they look a
little less messy.  They will still look bad with lots of IFUNCs (like
on x86) but it's still a step forward.

	* benchtests/scripts/compare_strings.py (process_results):
	Better spacing for output.
2017-09-16 15:23:12 +05:30
Siddhesh Poyarekar 06b1de2378 benchtests: Use argparse to parse arguments
Make the script more usable by adding proper command line options
along with a way to query the options.  The script is capable of doing
a bunch of things right now like choosing a base for comparison,
choosing to generate graphs, etc. and they should be accessible via
command line switches.

	* benchtests/scripts/compare_strings.py: Use argparse.
	* benchtests/README: Document existence of compare_strings.py.
2017-09-16 11:47:32 +05:30
Joseph Myers 9ac4470888 Use libm_alias_double in math/.
This patch converts libm function implementations in math/ from using
weak_alias to using libm_alias_double to define public function names,
in cases where it would be appropriate to define _Float64 / _Float32x
aliases for those functions as well.  This eliminates many
NO_LONG_DOUBLE conditionals and ldbl-opt wrappers round these function
implementations.

Tested for x86_64.  Also tested with build-many-glibcs.py.  Binary
differences seen are that the different order in which remainder and
drem symbols get defined as a result of this patch (the same source
file defines the same aliases, but in a different order of definition)
changes the order of symbols in the final libm.so when long double =
double, and for ldbl-opt configurations, the compat symbols for Bessel
functions were previously defined by e.g. "compat_symbol (libm, j0,
j0l, GLIBC_2_0)", which declares j0l as a compat symbol based on j0
and so makes j0l weak because j0 is weak, and are now defined
(indirectly via the relevant macros) based on e.g. __j0, so are no
longer weak because __j0 isn't weak.

	* math/s_fma.c: Include <libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* math/s_nextafter.c: Include <libm-alias-double.h>.
	(nextafter): Define using libm_alias_double.
	* math/w_acos_compat.c: Include <libm-alias-double.h>.
	(acos): Define using libm_alias_double.
	* math/w_acosh_compat.c: Include <libm-alias-double.h>.
	(aocsh): Define using libm_alias_double.
	* math/w_asin_compat.c: Include <libm-alias-double.h>.
	(asin): Define using libm_alias_double.
	* math/w_atan2_compat.c: Include <libm-alias-double.h>.
	(atan2): Define using libm_alias_double.
	* math/w_atanh_compat.c: Include <libm-alias-double.h>.
	(atanh): Define using libm_alias_double.
	* math/w_cosh_compat.c: Include <libm-alias-double.h>.
	(cosh): Define using libm_alias_double.
	* math/w_exp10_compat.c: Include <libm-alias-double.h>.
	(exp10): Define using libm_alias_double.
	* math/w_exp2_compat.c: Include <libm-alias-double.h>.
	(exp2): Define using libm_alias_double.
	* math/w_exp_compat.c: Include <libm-alias-double.h>.
	(exp): Define using libm_alias_double.
	* math/w_fmod_compat.c: Include <libm-alias-double.h>.
	(fmod): Define using libm_alias_double.
	* math/w_hypot_compat.c: Include <libm-alias-double.h>.
	(hypot): Define using libm_alias_double.
	* math/w_j0_compat.c: Include <libm-alias-double.h>.
	(j0): Define using libm_alias_double.
	(y0): Likewise.
	* math/w_j1_compat.c: Include <libm-alias-double.h>.
	(j1): Define using libm_alias_double.
	(y1): Likewise.
	* math/w_jn_compat.c: Include <libm-alias-double.h>.
	(jn): Define using libm_alias_double.
	(yn): Likewise.
	* math/w_log10_compat.c: Include <libm-alias-double.h>.
	(log10): Define using libm_alias_double.
	* math/w_log2_compat.c: Include <libm-alias-double.h>.
	(log2): Define using libm_alias_double.
	* math/w_log_compat.c: Include <libm-alias-double.h>.
	(log): Define using libm_alias_double.
	* math/w_pow_compat.c: Include <libm-alias-double.h>.
	(pow): Define using libm_alias_double.
	* math/w_remainder_compat.c: Include <libm-alias-double.h>.
	(remainder): Define using libm_alias_double.
	* math/w_sinh_compat.c: Include <libm-alias-double.h>.
	(sinh): Define using libm_alias_double.
	* math/w_sqrt_compat.c: Include <libm-alias-double.h>.
	(sqrt): Define using libm_alias_double.
	* math/w_tgamma_compat.c: Include <libm-alias-double.h>.
	(tgamma): Define using libm_alias_double.
	* sysdeps/ieee754/ldbl-opt/s_nextafter.c [LONG_DOUBLE_COMPAT(libm,
	GLIBC_2_0)] (nextafterl): Do not define compat symbol here.
	* sysdeps/ieee754/ldbl-opt/w_exp10_compat.c
	[LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)] (exp10l): Likewise.
	* sysdeps/ieee754/ldbl-opt/w_remainder_compat.c
	[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (remainderl): Likewise.
	* sysdeps/ieee754/ldbl-opt/w_acos_compat.c: Remove.
	* sysdeps/ieee754/ldbl-opt/w_acosh_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_asin_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_atan2_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_atanh_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_cosh_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_fmod_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_hypot_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_j0_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_j1_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_jn_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log10_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log2_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_pow_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_sinh_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_sqrt_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_tgamma_compat.c: Likewise.
2017-09-15 23:10:02 +00:00
Joseph Myers c67a2328c8 Remove ENOSYS math/ function stubs.
The math/ directory has various stub implementations of functions
(generally long double functions, plus sqrtf128) that set errno to
ENOSYS and print a message.

These are a relic of when the long double libm implementation in glibc
was originally incomplete.  They are only present for a limited set of
libm functions, not all those that would need implementing for any
hypothetical new long double format, and only for long double (plus
sqrtf128), not for other floating-point types.  I removed the
corresponding ENOSYS tests in the testsuite in
<https://sourceware.org/ml/libc-alpha/2013-05/msg00599.html>.

I think these stubs are an inherently different case from stubs for
functionality needing OS-specific implementations, since
floating-point formats are generally standardized between modern
processors (a new long double format does not seem likely - I'd expect
new ports all to have long double = binary128 or long double =
binary64 - though _Float16 functions *f16 are entirely possible in
future) and libm functions are generally only expected to fail for
domain / range / pole errors, not for other unknown system-specific
conditions the way the functions needing OS-specific implementations
may fail.

This patch removes these stub implementations.  The effect (which, as
noted above, was actually mostly already the case, given the
incompleteness of the set of stubs, and was certainly the case if you
wanted your libm port to *work* rather than just build) is that any
new long double format needs to provide a full set of functions for
the build to succeed; any port using ldbl-128 needs to provide sqrtl
(possibly using the soft-fp version from another port); any port using
ldbl-96 needs to provide all those functions that all of
x86_64/i386/ia64/m68k provide rather than getting from the ldbl-96
directory; any port with _Float128 as a type with a distinct format
needs to provide sqrtf128.

Tested for x86_64.  Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* math/e_acoshl.c: Remove.
	* math/e_acosl.c: Likewise.
	* math/e_asinl.c: Likewise.
	* math/e_atan2l.c: Likewise.
	* math/e_atanhl.c: Likewise.
	* math/e_coshl.c: Likewise.
	* math/e_expl.c: Likewise.
	* math/e_fmodl.c: Likewise.
	* math/e_gammal_r.c: Likewise.
	* math/e_hypotl.c: Likewise.
	* math/e_j0l.c: Likewise.
	* math/e_j1l.c: Likewise.
	* math/e_jnl.c: Likewise.
	* math/e_lgammal_r.c: Likewise.
	* math/e_log10l.c: Likewise.
	* math/e_log2l.c: Likewise.
	* math/e_logl.c: Likewise.
	* math/e_powl.c: Likewise.
	* math/e_rem_pio2l.c: Likewise.
	* math/e_sinhl.c: Likewise.
	* math/e_sqrtf128.c: Likewise.
	* math/e_sqrtl.c: Likewise.
	* math/k_cosl.c: Likewise.
	* math/k_sinl.c: Likewise.
	* math/k_tanl.c: Likewise.
	* math/s_asinhl.c: Likewise.
	* math/s_atanl.c: Likewise.
	* math/s_cbrtl.c: Likewise.
	* math/s_erfl.c: Likewise.
	* math/s_expm1l.c: Likewise.
	* math/s_log1pl.c: Likewise.
	* math/s_tanhl.c: Likewise.
2017-09-15 20:05:09 +00:00
Tulio Magno Quites Machado Filho 61c45f2505 [BZ #21745] powerpc: build some IFUNC math functions for libc and libm
Some math functions have to be distributed in libc because they're
required by printf.
libc and libm require their own builds of these functions, e.g. libc
functions have to call __stack_chk_fail_local in order to bypass the
PLT, while libm functions have to call __stack_chk_fail.

While math/Makefile treat the generic cases, i.e. s_isinff, the
multiarch Makefile has to treat its own files, i.e. s_isinff-ppc64.

	[BZ #21745]
	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile:
	[$(subdir) = math] (sysdep_calls): New variable.  Has the
	previous contents of sysdep_routines, but re-sorted..
	[$(subdir) = math] (sysdep_routines): Re-use the contents from
	sysdep_calls.
	[$(subdir) = math] (libm-sysdep_routines): Remove the functions
	defined in sysdep_calls and replace by the respective m_* names.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S:
	(compat_symbol): Undefine to avoid duplicated compat symbols in
	libc.
2017-09-15 15:09:19 -03:00
Joseph Myers 5bcdb31529 Use libm_alias_float in math/.
This patch converts libm function implementations in math/ from using
weak_alias to using libm_alias_float to define public function names,
in cases where it would be appropriate to define _Float32 aliases for
those functions as well.  expf and exp2f are omitted from this patch,
given the in-progress patches that would change their symbol
versioning arrangements (at a later stage it will be necessary to add
macros that can be used for functions with such symbol versioning
arrangements - which will apply to lgammaf as well - but for the
initial patches in this area I'm just dealing with easy cases, and any
symbol versioning changes to these functions while the work is in
progress can effectively just undo the libm_alias_* changes as regards
those functions).

Tested for x86_64.  Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* math/s_fmaf.c: Include <libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* math/w_acosf_compat.c: Include <libm-alias-float.h>.
	(acosf): Define using libm_alias_float.
	* math/w_acoshf_compat.c: Include <libm-alias-float.h>.
	(acoshf): Define using libm_alias_float.
	* math/w_asinf_compat.c: Include <libm-alias-float.h>.
	(asinf): Define using libm_alias_float.
	* math/w_atan2f_compat.c: Include <libm-alias-float.h>.
	(atan2f): Define using libm_alias_float.
	* math/w_atanhf_compat.c: Include <libm-alias-float.h>.
	(atanhf): Define using libm_alias_float.
	* math/w_coshf_compat.c: Include <libm-alias-float.h>.
	(coshf): Define using libm_alias_float.
	* math/w_exp10f_compat.c: Include <libm-alias-float.h>.
	(exp10f): Define using libm_alias_float.
	* math/w_fmodf_compat.c: Include <libm-alias-float.h>.
	(fmodf): Define using libm_alias_float.
	* math/w_hypotf_compat.c: Include <libm-alias-float.h>.
	(hypotf): Define using libm_alias_float.
	* math/w_j0f_compat.c: Include <libm-alias-float.h>.
	(j0f): Define using libm_alias_float.
	(y0f): Likewise.
	* math/w_j1f_compat.c: Include <libm-alias-float.h>.
	(j1f): Define using libm_alias_float.
	(y1f): Likewise.
	* math/w_jnf_compat.c: Include <libm-alias-float.h>.
	(jnf): Define using libm_alias_float.
	(ynf): Likewise.
	* math/w_log10f_compat.c: Include <libm-alias-float.h>.
	(log10f): Define using libm_alias_float.
	* math/w_log2f_compat.c: Include <libm-alias-float.h>.
	(log2f): Define using libm_alias_float.
	* math/w_logf_compat.c: Include <libm-alias-float.h>.
	(logf): Define using libm_alias_float.
	* math/w_powf_compat.c: Include <libm-alias-float.h>.
	(powf): Define using libm_alias_float.
	* math/w_remainderf_compat.c: Include <libm-alias-float.h>.
	(remainderf): Define using libm_alias_float.
	* math/w_sinhf_compat.c: Include <libm-alias-float.h>.
	(sinhf): Define using libm_alias_float.
	* math/w_sqrtf_compat.c: Include <libm-alias-float.h>.
	(sqrtf): Define using libm_alias_float.
	* math/w_tgammaf_compat.c: Include <libm-alias-float.h>.
	(tgammaf): Define using libm_alias_float.
2017-09-15 17:12:02 +00:00
Joseph Myers 01f2881245 Make more libm functions into weak aliases.
Many libm functions define the function as __<func> and then define
<func> as a weak alias.  This is not at all limited to cases where
there is an internal call that has namespace reasons to need to call
__<func> instead of <func>.

The common macros for creating libm function aliases work on the basis
of public function names all being aliases; that is, they define
aliases for functions using the above pattern.  Thus, where a function
just defines the public name <func> directly, changing that to be a
weak alias enables a subsequent conversion to the common macros to
retain the exact existing symbols (and so be testable by comparison of
stripped binaries).

This patch converts many existing functions to use the weak alias
pattern, as preparation for subsequent conversions to common macros.
I do expect that _FloatN/_FloatNx function aliases will end up needing
new variants of the common macros that do *not* create the original
float / double / long double name of a function - for cases where that
name is created specially to give it a particular symbol version, for
example - but for functions that can use the most common macros to
create all the public names as aliases, it makes sense for them to do
so.

Regarding the Bessel function wrappers in this patch: only float and
double wrappers are changed because the long double wrappers already
used the weak alias pattern.

Tested for x86_64, and with build-many-glibcs.py.

	* include/math.h (roundeven): Change hidden_proto call to
	__roundeven.
	* math/w_j0_compat.c (j0): Rename to __j0 and define as weak
	alias.
	[NO_LONG_DOUBLE] (__j0l): New strong alias.
	(y0): Rename to __y0 and define as weak alias.
	[NO_LONG_DOUBLE] (__y0l): New strong alias.
	* math/w_j0f_compat.c (j0f): Rename to __j0f and define as weak
	alias.
	(y0f): Rename to __y0f and define as weak alias.
	* math/w_j1_compat.c (j1): Rename to __j1 and define as weak
	alias.
	[NO_LONG_DOUBLE] (__j1l): New strong alias.
	(y1): Rename to __y1 and define as weak alias.
	[NO_LONG_DOUBLE] (__y1l): New strong alias.
	* math/w_j1f_compat.c (j1f): Rename to __j1f and define as weak
	alias.
	(y1f): Rename to __y1f and define as weak alias.
	* math/w_jn_compat.c (jn): Rename to __jn and define as weak
	alias.
	[NO_LONG_DOUBLE] (__jnl): New strong alias.
	(yn): Rename to __yn and define as weak alias.
	[NO_LONG_DOUBLE] (__ynl): New strong alias.
	* math/w_jnf_compat.c (jnf): Rename to __jnf and define as weak
	alias.
	(ynf): Rename to __ynf and define as weak alias.
	* sysdeps/ieee754/dbl-64/s_fromfp.c (FUNC): Define to __fromfp.
	(fromfp): Define as weak alias.
	[NO_LONG_DOUBLE] (__fromfpl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_fromfpx.c (FUNC): Define to __fromfpx.
	(fromfpx): Define as weak alias.
	[NO_LONG_DOUBLE] (__fromfpxl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_getpayload.c (getpayload): Rename to
	__getpayload and define as weak alias.
	[NO_LONG_DOUBLE] (__getpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_roundeven.c (roundeven): Rename to
	__roundeven and define as weak alias.
	[NO_LONG_DOUBLE] (__roundevenl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_setpayload.c (FUNC): Define to
	__setpayload.
	(setpayload): Define as weak alias.
	[NO_LONG_DOUBLE] (__setpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_setpayloadsig.c (FUNC): Define to
	__setpayloadsig.
	(setpayloadsig): Define as weak alias.
	[NO_LONG_DOUBLE] (__setpayloadsigl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_totalorder.c (totalorder): Rename to
	__totalorder and define as weak alias.
	[NO_LONG_DOUBLE] (__totalorderl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_totalordermag.c (totalordermag): Rename
	to __totalordermag and define as weak alias.
	[NO_LONG_DOUBLE] (__totalordermagl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_ufromfp.c (FUNC): Define to __ufromfp.
	(ufromfp): Define as weak alias.
	[NO_LONG_DOUBLE] (__ufromfpl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_ufromfpx.c (FUNC): Define to
	__ufromfpx.
	(ufromfpx): Define as weak alias.
	[NO_LONG_DOUBLE] (__ufromfpxl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c (getpayload):
	Rename to __getpayload and define as weak alias.
	[NO_LONG_DOUBLE] (__getpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c (roundeven):
	Rename to __roundeven and define as weak alias.
	[NO_LONG_DOUBLE] (__roundevenl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c (totalorder):
	Rename to __totalorder and define as weak alias.
	[NO_LONG_DOUBLE] (__totalorderl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
	(totalordermag): Rename to __totalordermag and define as weak
	alias.
	[NO_LONG_DOUBLE] (__totalordermagl): New strong alias.
	* sysdeps/ieee754/float128/float128_private.h (__getpayloadl): New
	macro.
	(__roundevenl): Likewise.
	(__totalorderl): Likewise.
	(__totalordermagl): Likewise
	* sysdeps/ieee754/float128/s_fromfpf128.c (FUNC): Define to
	__fromfpf128.
	(fromfpf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_fromfpxf128.c (FUNC): Define to
	__fromfpxf128.
	(fromfpxf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_setpayloadf128.c (FUNC): Define to
	__setpayloadf128.
	(setpayloadf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_setpayloadsigf128.c (FUNC): Define to
	__setpayloadsigf128.
	(setpayloadsigf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_ufromfpf128.c (FUNC): Define to
	__ufromfpf128.
	(ufromfpf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_ufromfpxf128.c (FUNC): Define to
	__ufromfpxf128.
	(ufromfpxf128): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_fromfpf.c (FUNC): Define to __fromfpf.
	(fromfpf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_fromfpxf.c (FUNC): Define to
	__fromfpxf.
	(fromfpxf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_getpayloadf.c (getpayloadf): Rename to
	__getpayloadf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_roundevenf.c (roundevenf): Rename to
	__roundevenf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_setpayloadf.c (FUNC): Define to
	__setpayloadf.
	(setpayloadf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_setpayloadsigf.c (FUNC): Define to
	__setpayloadsigf.
	(setpayloadsigf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_totalorderf.c (totalorderf): Rename to
	__totalorderf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_totalordermagf.c (totalordermagf):
	Rename to __totalordermagf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_ufromfpf.c (FUNC): Define to
	__ufromfpf.
	(ufromfpf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_ufromfpxf.c (FUNC): Define to
	__ufromfpxf.
	(ufromfpxf): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_getpayloadl.c (getpayloadl): Rename
	to __getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_roundevenl.c (roundevenl): Rename to
	__roundevenl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_totalorderl.c (totalorderl): Rename
	to __totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c (getpayloadl):
	Rename to __getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c (roundevenl): Rename
	to __roundevenl and define as weak alias.  Call __roundeven
	instead of roundeven.
	* sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c (totalorderl):
	Rename to __totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_getpayloadl.c (getpayloadl): Rename to
	__getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_roundevenl.c (roundevenl): Rename to
	__roundevenl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_totalorderl.c (totalorderl): Rename to
	__totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
2017-09-14 22:28:53 +00:00
Siddhesh Poyarekar 503c92c37a benchtests: Reallocate buffers for memset
Keeping the same buffers along with copying the same size of data into
the same location means that the first routine is typically the
slowest since it has to bear the cost of fetching data into to cache.
Reallocating buffers stabilizes numbers by a bit.

	* benchtests/bench-string.h (realloc_bufs): New function.
	(test_init): Call it.
	* benchtests/bench-memset-large.c (do_test): Likewise.
	* benchtests/bench-memset.c (do_test): Likewise.
2017-09-14 22:54:24 +05:30
Siddhesh Poyarekar 29c933fb35 benchtests: Make memset benchmarks print json
Make the memset benchmarks (bench-memset and bench-memset-large) print
their output in JSON so that they can be evaluated using the
compare_strings.py script.

	* benchtests/bench-memset-large.c: Print output in JSON
	format.
	* benchtests/bench-memset.c: Likewise.
2017-09-14 22:54:23 +05:30
Mike FABIAN 799c8d6905 Add new codepage charmaps/IBM858 [BZ #21084]
This code page is identical to code page 850 except that X'D5'
has been changed from LI61 (dotless i) to SC20 (euro symbol).

The code points from /x01 to /x1f in the /localedata/charmaps/IBM858
file have the same mapping as those in localedata/charmaps/ANSI_X3.4-1968.
That means they disagree with with

ftp://ftp.software.ibm.com/software/globalization/gcoc/attachments/CP00858.txt

in that range.
For example, localedata/charmaps/IBM858 and localedata/charmaps/ANSI_X3.4-1968 have:

   “<U0001>     /x01         START OF HEADING (SOH)”

whereas CP00858.txt has:

   “01 SS000000        Smiling Face”

That means that CP00858.txt is not really ASCII-compatible and to make
it ASCII-compatible we deviate fro CP00858.txt in the code points from /x01
to /x1f.

	[BZ #21084]
	* benchtests/strcoll-inputs/filelist#en_US.UTF-8: Add IBM858 and ibm858.c.
	* iconvdata/Makefile: Add IBM858.
	* iconvdata/gconv-modules: Add IBM858.
	* iconvdata/ibm858.c: New file.
	* iconvdata/tst-tables.sh: Add IBM858
	* localedata/charmaps/IBM858: New file.
2017-09-14 15:50:57 +02:00
Akhilesh Kumar fcc82c06dc Removed redundant data (LC_TIME and LC_MESSAGES) for niu_NZ [BZ #22023]
[BZ #22023]
	* locales/niu_NZ (LC_TIME): copy "niu_NU".
	* locales/niu_NZ (LC_MESSAGES): copy "niu_NU".
2017-09-14 13:50:20 +02:00
Akhilesh Kumar f28a0926c5 Fix LC_TELEPHONE for az_AZ [BZ #22112]
[BZ #22112]
	* localedata/locales/az_AZ(LC_TELEPHONE): Fix int_select
	and add tel_int_fmt.
2017-09-14 12:37:13 +02:00
Joseph Myers 02093e6222 Define and use libm_alias_float128.
Continuing the process of setting up common macros for libm function
aliases, with a view to using them to define _FloatN / _FloatNx
aliases in future, this patch adds a libm_alias_float128 macro and
uses it in the type-generic templates.  (_Float128 functions will end
up with _Float64x aliases on powerpc64le, but not on x86_64/x86/ia64
because _Float64x has long double format there, and the macro will
provide a single place for the conditionals for that choice, as well
as for once ldbl-128 functions always build *f128 and need
conditionals for whether to have *l aliases.)

Tested for x86_64.  Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/generic/libm-alias-float128.h: New file.
	* sysdeps/generic/math-type-macros-float128.h: Include
	<libm-alias-float128.h>.
	[!declare_mgen_alias] (declare_mgen_alias): Define macro.
2017-09-14 01:11:46 +00:00
Joseph Myers 1aae75ef80 Define and use libm_alias_ldouble.
Continuing the process of setting up common macros for libm function
aliases, with a view to using them to define _FloatN / _FloatNx
aliases in future, this patch adds a libm_alias_ldouble macro and uses
it in the type-generic templates.

Since math-type-macros-ldouble.h already did the appropriate thing for
each symbol (weak_alias or long_double_symbol), this is just a
straightforward rearrangement of code, to make the required logic
available in a place that can also be used outside of the type-generic
templates in future (in particular, to eliminate various wrappers for
functions in ldbl-opt and ldbl-64-128).

Tested for x86_64.  Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/generic/libm-alias-ldouble.h: New file.
	* sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h: Likewise.
	* sysdeps/ieee754/ldbl-opt/math-type-macros-ldouble.h: Remove.
	* sysdeps/generic/math-type-macros-ldouble.h: Include
	<libm-alias-ldouble.h>.
	[!declare_mgen_alias] (declare_mgen_alias): Define to use
	libm_alias_ldouble.
2017-09-13 22:17:23 +00:00
Szabolcs Nagy bcea7ad608 Move exp compat wrappers under math/
Move exp compat wrappers to math/w_exp{,f,l}_compat.c to be
consistent with other wrappers.

	* sysdeps/ieee754/dbl-64/w_exp_compat.c: Move to...
	* math/w_exp_compat.c: ... here.
	* sysdeps/ieee754/flt-32/w_expf_compat.c: Move to...
	* math/w_expf_compat.c: ... here.
	* sysdeps/ieee754/ldbl-128/w_expl_compat.c: Move to...
	* math/w_expl_compat.c: ... here.
	* sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Remove.
	* sysdeps/ieee754/ldbl-96/w_expl_compat.c: Remove.
	* sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Use the new path.
	* sysdeps/ieee754/ldbl-opt/w_expl_compat.c: Likewise.
2017-09-13 17:22:22 +01:00
Joseph Myers 0fc56478a9 Clear up log1p, ldexp, scalbn, scalbln compat handling.
This patch cleans up how compat symbols / long double versioning are
handled for log1p, ldexp, scalbn and scalbln functions.

The general principle is to do as much as possible through the
type-generic templates.  Previously, when errno-setting wrappers were
added the compat long double symbols were left pointing directly to
the underlying implementations; they are moved to point to the
errno-setting wrappers.  For the functions also present in libc,
compat symbol handling for the libc copies needs to go in ldbl-opt
wrappers, but the type-generic templates can handle it for the libm
copies.  There is no need for w_scalbln_template.c to disable the
creation of an unused internal alias (such code made sense in the
context of patches trying to avoid any changes to generated code for
ease of comparison, but can be removed in a change that specifically
does intend to change details of where symbols point).

Tested for x86_64, and with build-many-glibcs.py.

	* math/w_scalbln_template.c (strong_alias): Do not undefine and
	redefine.
	* sysdeps/ieee754/ldbl-opt/s_ldexp.c (declare_mgen_alias): Remove
	macro.
	(ldexpl): Only define as compat symbol for libc, not libm.
	(scalbnl): Define as compat symbol for libc here.
	* sysdeps/ieee754/ldbl-opt/s_ldexpl.c (declare_mgen_alias): Only
	define for [IS_IN (libc)].
	(__ldexpl_2): Remove alias.
	(ldexpl): Only define with long_double_symbol if [IS_IN (libc)].
	(scalbnl): Likewise.  Use __wrap_scalbnl not __ldexpl_2 as base
	name in long_double_symbol call.
	* sysdeps/ieee754/ldbl-opt/s_log1p.c: Remove file.
	* sysdeps/ieee754/ldbl-opt/s_scalbln.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_scalbn.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log1p.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_scalbln.c (declare_mgen_alias):
	Remove macro.
	[IS_IN (libc) && LONG_DOUBLE_COMPAT (libc, GLIBC_2_1)] (scalblnl):
	Define as compat symbol.
2017-09-13 15:47:26 +00:00