Commit Graph

21447 Commits

Author SHA1 Message Date
Florian Weimer d8425e116c nss_files: Avoid large buffers with many host addresses [BZ #22078]
The previous implementation had at least a quadratic space
requirement in the number of host addresses and aliases.
2017-10-11 07:07:51 +02:00
Florian Weimer 78e806fd8c nss_files: Use struct scratch_buffer for gethostbyname [BZ #18023] 2017-10-11 07:01:34 +02:00
Joseph Myers 0ff64d3a18 Use generic alias macros in ldbl-opt.
This patch fixes ldbl-opt code to use generic libm alias macros in
preparation for getting _FloatN / _FloatNx aliases where appropriate.

Four functions are affected, that undefine and redefine alias macros
before including the implementations they wrap in such a way that
_FloatN / _FloatNx aliases would not appear.  s_clog10l.c undefines
and redefined declare_mgen_alias, so just needs a
libm_alias_ldouble_other call added.  w_exp10l_compat.c undefines and
redefines weak_alias, but in fact does not need to do so, since
math/w_exp10l_compat.c uses libm_alias_ldouble and does not use
weak_alias other than through that, so the undefines and redefines of
weak_alias are removed.  w_lgamma_compatl.c and w_remainderl_compat.c
are made to use libm_alias_ldouble_other in conjunction with restoring
the original definition of weak_alias so this is effective.

Tested with build-many-glibcs.py.  Installed stripped shared libraries
are unchanged by this patch.

	* sysdeps/ieee754/ldbl-opt/s_clog10l.c: Use
	libm_alias_ldouble_other.
	* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c (weak_alias): Do not
	undefine and redefine.
	[LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)]
	(exp10l): Do not define here.
	* sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c [BUILD_LGAMMA]
	(weak_alias): Undefine and redefine.
	[BUILD_LGAMMA]: Use libm_alias_ldouble_other.
	* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c
	[LIBM_SVID_COMPAT] (weak_alias): Undefine and redefine here.
	[LIBM_SVID_COMPAT]: Use libm_alias_ldouble_other.
2017-10-11 02:51:39 +00:00
Joseph Myers 541f19baf8 Use libm_alias_* in soft-fp.
This patch makes the soft-fp implementations of fma functions use the
libm_alias_* macros.

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

	* soft-fp/fmadf4.c: Include <libm-alias-double.h>.
	[!__fma] (fma): Define using libm_alias_double.
	* soft-fp/fmasf4.c: Include <libm-alias-float.h>.
	[!__fmaf] (fmaf): Define using libm_alias_float.
	* soft-fp/fmatf4.c: Include <libm-alias-ldouble.h>.
	(fmal): Define using libm_alias_ldouble.
2017-10-11 00:03:46 +00:00
Joseph Myers 24b6515d87 Add libm_alias_*_other_r macros.
Some libm functions are unable to use the generic alias macros such as
libm_alias_double because they have special symbol versioning
requirements for the main float, double or long double public names.

To facilitate adding _FloatN / _FloatNx function aliases in future,
it's still desirable to have generic macros those functions can use as
far as possible.  This patch adds macros such as
libm_alias_double_other, which only define names for _FloatN /
_FloatNx aliases, not for float / double / long double.  As present,
all these new macros do nothing, but they are called in the
appropriate places in macros such as libm_alias_double.  This patch
also arranges for lgamma implementations, and the recently added
optimized float function implementations, to use the new macros to
make them ready for addition of _FloatN / _FloatNx aliases.

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

	* sysdeps/generic/libm-alias-double.h (libm_alias_double_other_r):
	New macro.
	(libm_alias_double_other): Likewise.
	(libm_alias_double_r): Use libm_alias_double_other_r.
	* sysdeps/generic/libm-alias-float.h (libm_alias_float_other_r):
	New macro.
	(libm_alias_float_other): Likewise.
	(libm_alias_float_r): Use libm_alias_float_other_r.
	* sysdeps/generic/libm-alias-float128.h
	(libm_alias_float128_other_r): New macro.
	(libm_alias_float128_other): Likewise.
	(libm_alias_float128_r): Use libm_alias_float128_other_r.
	* sysdeps/generic/libm-alias-ldouble.h
	(libm_alias_ldouble_other_r): New macro.
	(libm_alias_ldouble_other): Likewise.
	(libm_alias_ldouble_r): Use libm_alias_ldouble_other_r.
	* sysdeps/ieee754/ldbl-opt/libm-alias-double.h
	(libm_alias_double_other_r): New macro.
	(libm_alias_double_other): Likewise.
	(libm_alias_double_r): Use libm_alias_double_other_r.
	* sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h
	(libm_alias_ldouble_other_r): New macro.
	(libm_alias_ldouble_other): Likewise.
	(libm_alias_ldouble_r): Use libm_alias_ldouble_other_r.
	* math/w_lgamma_main.c: Include <libm-alias-double.h>.
	[!USE_AS_COMPAT]: Use libm_alias_double_other.
	* math/w_lgammaf_main.c: Include <libm-alias-float.h>.
	[!USE_AS_COMPAT]: Use libm_alias_float_other.
	* math/w_lgammal_main.c: Include <libm-alias-ldouble.h>.
	[!USE_AS_COMPAT]: Use libm_alias_ldouble_other.
	* math/w_exp2f.c: Use libm_alias_float_other.
	* math/w_expf.c: Likewise.
	* math/w_log2f.c: Likewise.
	* math/w_logf.c: Likewise.
	* math/w_powf.c: Likewise.
	* sysdeps/ieee754/flt-32/e_exp2f.c: Include <libm-alias-float.h>.
	[!__exp2f]: Use libm_alias_float_other.
	* sysdeps/ieee754/flt-32/e_expf.c: Include <libm-alias-float.h>.
	[!__expf]: Use libm_alias_float_other.
	* sysdeps/ieee754/flt-32/e_log2f.c: Include <libm-alias-float.h>.
	[!__log2f]: Use libm_alias_float_other.
	* sysdeps/ieee754/flt-32/e_logf.c: Include <libm-alias-float.h>.
	[!__logf]: Use libm_alias_float_other.
	* sysdeps/ieee754/flt-32/e_powf.c: Include <libm-alias-float.h>.
	[!__powf]: Use libm_alias_float_other.
2017-10-10 21:29:11 +00:00
Florian Weimer 8ed70de2fa nss_files: Refactor gethostbyname3 multi case into separate function
This is in preparation of further cleanup work.
2017-10-10 11:50:42 +02:00
Joseph Myers a8dce6197a Use generic macros for lgamma_r function aliases.
Continuing the use of generic macros for defining libm function
aliases, in preparation for adding more _FloatN / _FloatNx function
names, this patch makes the lgamma_r functions use such macros.

declare_mgen_alias_r becomes a standard macro in math-type-macros.h
instead of being locally defined in w_lgamma_r_templace.c.  This in
turn must be defined by each math-type-macros-<type>.h.  Rather than
providing an unused default in math-type-macros.h, that header is made
to give an error if math-type-macros-<type>.h failed to define
declare_mgen_alias or declare_mgen_alias_r.  The compat lgamma_r
wrappers are updated similarly.  The ldbl-opt versions are removed as
no longer needed.

Tested for x86_64, and with build-many-glibcs.py.  Installed stripped
shared libraries are unchanged except for powerpc64le (where the usual
issue applies that an ldbl-opt long double function previously used
long_double_symbol unconditionally and now the symbol versions on
powerpc64le mean weak_alias is used instead, resulting in the same
symbol versions in the final shared library but still enough
difference in the input objects for that library not to be
byte-identical).

	* sysdeps/generic/math-type-macros.h [!declare_mgen_alias]: Give
	error.  Remove default definition of declare_mgen_alias.
	[!declare_mgen_alias_r]: Likewise.
	* sysdeps/generic/math-type-macros-double.h
	[!declare_mgen_alias_r] (declare_mgen_alias_r): New macro.
	* sysdeps/generic/math-type-macros-float.h [!declare_mgen_alias_r]
	(declare_mgen_alias_r): Likewise.
	* sysdeps/generic/math-type-macros-float128.h
	[!declare_mgen_alias_r] (declare_mgen_alias_r): Likewise.
	* sysdeps/generic/math-type-macros-ldouble.h
	[!declare_mgen_alias_r] (declare_mgen_alias_r): Likewise.
	* math/w_lgamma_r_template.c (declare_mgen_alias_r_x): Remove
	macro.
	(declare_mgen_alias_r_s): Likewise.
	(declare_mgen_alias_r): Likewise.
	* math/w_lgamma_r_compat.c: Include <libm-alias-double.h>.
	(lgamma_r): Define using libm_alias_double_r.
	* math/w_lgammaf_r_compat.c: Include <libm-alias-float.h>.
	(lgammaf_r): Define using libm_alias_float_r.
	* math/w_lgammal_r_compat.c: Include <libm-alias-ldouble.h>.
	(lgammal_r): Define using libm_alias_ldouble_r.
	* sysdeps/ieee754/ldbl-opt/w_lgamma_r_compat.c: Remove file.
	* sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
2017-10-09 22:04:18 +00:00
Adhemerval Zanella bedac13671 posix: remove glob internal bogus extern decl
Sync with gnulib f586d709f07.  Checked on x86_64-linux-gnu.

	* lib/glob.c (__glob_pattern_type): Remove now-spurious
	extern declaration.
2017-10-09 14:55:26 -03:00
Joseph Myers c7509db215 Remove ldbl-opt w_scalbln.c.
The ldbl-opt version of w_scalbln.c is not in fact needed; it handles
compat symbol versions for libc, but this file isn't built for libc,
only for libm.  This patch removes this file.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by this patch.

	* sysdeps/ieee754/ldbl-opt/w_scalbln.c: Remove file.
2017-10-09 16:52:56 +00:00
Jonathan Wakely d6c064e914 Ensure C99 and C11 interfaces are available for C++ [BZ #21326]
This patch ensures that the C99 and C11 features required by C++ are
defined according to the value of the __cplusplus macro, and not just
because G++ always defines _GNU_SOURCE.  This will allow G++ to stop
defining _GNU_SOURCE some day, without causing the C99 and C11
interfaces to disappear for C++ programs.

	[BZ #21326]
	* include/features.h [__cplusplus >= 201103] (__USE_ISOC99): Define.
	[__cplusplus >= 201703] (__USE_ISOCXX17, __USE_ISOC11): Define.
	* math/Makefile (test-math-cxx11): New test.
	* math/test-math-cxx11.cc: New file.
2017-10-09 16:18:11 +02:00
Christian Brauner 645ac9aaf8 openpty: use TIOCGPTPEER to open slave side fd
Newer kernels expose the ioctl TIOCGPTPEER [1] call to userspace which allows to
safely allocate a file descriptor for a pty slave based solely on the master
file descriptor. This allows us to avoid path-based operations and makes this
function a lot safer in the face of devpts mounts in different mount namespaces.

[1]: https://patchwork.kernel.org/patch/9760743/

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-10-08 17:47:58 +02:00
Christian Brauner 98e0742024 openpty: close slave pty fd on error
When openpty() failed only the master fd was closed so far. Let's close the
slave fd as well. Also, let's unify the error handling.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-10-08 17:46:19 +02:00
Joseph Myers f85a176f3f Use libm_alias_double in ldbl-128, ldbl-96 fma.
This patch makes the ldbl-128 and ldbl-96 implementations of fma use
libm_alias_double.

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

	* sysdeps/ieee754/ldbl-128/s_fma.c: Include <libm-alias-double.h>.
	[!__fma] (fma): Define using libm_alias_double.
	* sysdeps/ieee754/ldbl-96/s_fma.c: Include <libm-alias-double.h>.
	[!__fma] (fma): Define using libm_alias_double.
2017-10-06 20:23:58 +00:00
Joseph Myers fd3b4e7c8a Use libm_alias_ldouble for ldbl-128 functions.
This patch makes ldbl-128 functions use libm_alias_ldouble to define
function aliases.  float128_private.h is updated accordingly.  Most of
the ldbl-64-128 wrappers are removed as no longer needed with this
change (leaving those that involve versioning for functions in libc or
that shouldn't be exported from libm for _Float128 / _Float64x types
with the same format as long double).

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

	* sysdeps/ieee754/float128/float128_private.h: Include
	<libm-alias-ldouble.h> and <libm-alias-float128.h>.
	(libm_alias_ldouble_r): Undefine and redefine.
	* sysdeps/ieee754/ldbl-128/s_asinhl.c: Include
	<libm-alias-ldouble.h>.
	(asinhl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_atanl.c: Include
	<libm-alias-ldouble.h>.
	(atanl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_cbrtl.c: Include
	<libm-alias-ldouble.h>.
	(cbrtl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_ceill.c: Include
	<libm-alias-ldouble.h>.
	(ceill): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_copysignl.c: Include
	<libm-alias-ldouble.h>.
	(copysignl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_cosl.c: Include
	<libm-alias-ldouble.h>.
	(cosl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_erfl.c: Include
	<libm-alias-ldouble.h>.
	(erfl): Define using libm_alias_ldouble.
	(erfcl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_expm1l.c: Include
	<libm-alias-ldouble.h>.
	(expm1l): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_fabsl.c: Include
	<libm-alias-ldouble.h>.
	(fabsl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_floorl.c: Include
	<libm-alias-ldouble.h>.
	(floorl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_fmal.c: Include
	<libm-alias-ldouble.h>.
	(fmal): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_frexpl.c: Include
	<libm-alias-ldouble.h>.
	(frexpl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_fromfpl.c (fromfpl): Define using
	libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_fromfpl_main.c: Include
	<libm-alias-ldouble.h>.
	* sysdeps/ieee754/ldbl-128/s_fromfpxl.c (fromfpxl): Define using
	libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_getpayloadl.c: Include
	<libm-alias-ldouble.h>.
	(getpayloadl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c: Include
	<libm-alias-ldouble.h>.
	(llrintl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c: Include
	<libm-alias-ldouble.h>.
	(llroundl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_logbl.c: Include
	<libm-alias-ldouble.h>.
	(logbl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c: Include
	<libm-alias-ldouble.h>.
	(lrintl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c: Include
	<libm-alias-ldouble.h>.
	(lroundl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_modfl.c: Include
	<libm-alias-ldouble.h>.
	(modfl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Include
	<libm-alias-ldouble.h>.
	(nearbyintl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_nextafterl.c: Include
	<libm-alias-ldouble.h>.
	(nextafterl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_nextupl.c: Include
	<libm-alias-ldouble.h>.
	(nextupl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_remquol.c: Include
	<libm-alias-ldouble.h>.
	(remquol): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_rintl.c: Include
	<libm-alias-ldouble.h>.
	(rintl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_roundevenl.c: Include
	<libm-alias-ldouble.h>.
	(roundevenl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_roundl.c: Include
	<libm-alias-ldouble.h>.
	(roundl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_setpayloadl.c (setpayloadl): Define
	using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c: Include
	<libm-alias-ldouble.h>.
	* sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c (setpayloadsigl):
	Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_sincosl.c: Include
	<libm-alias-ldouble.h>.
	(sincosl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_sinl.c: Include
	<libm-alias-ldouble.h>.
	(sinl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_tanhl.c: Include
	<libm-alias-ldouble.h>.
	(tanhl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_tanl.c: Include
	<libm-alias-ldouble.h>.
	(tanl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_totalorderl.c: Include
	<libm-alias-ldouble.h>.
	(totalorderl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Include
	<libm-alias-ldouble.h>.
	(totalordermagl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_truncl.c: Include
	<libm-alias-ldouble.h>.
	(truncl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_ufromfpl.c (ufromfpl): Define using
	libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-128/s_ufromfpxl.c (ufromfpxl): Define using
	libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-64-128/s_copysignl.c: Include
	<libm-alias-ldouble.h>.
	(weak_alias): Do not undefine and redefine.
	[IS_IN (libc)] (libm_alias_ldouble): Undefine and redefine.
	(copysignl): Define with long_double_symbol only if [IS_IN
	(libc)].
	* sysdeps/ieee754/ldbl-64-128/s_frexpl.c: Include
	<libm-alias-ldouble.h>.
	(weak_alias): Do not undefine and redefine.
	[IS_IN (libc)] (libm_alias_ldouble): Undefine and redefine.
	(frexpl): Define with long_double_symbol only if [IS_IN (libc)].
	* sysdeps/ieee754/ldbl-64-128/s_modfl.c: Include
	<libm-alias-ldouble.h>.
	(weak_alias): Do not undefine and redefine.
	[IS_IN (libc)] (libm_alias_ldouble): Undefine and redefine.
	(modfl): Define with long_double_symbol only if [IS_IN (libc)].
	* sysdeps/ieee754/ldbl-64-128/s_asinhl.c: Remove file.
	* sysdeps/ieee754/ldbl-64-128/s_atanl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_cbrtl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_ceill.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_cosl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_erfl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_expm1l.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_fabsl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_floorl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_logbl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_remquol.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_rintl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_roundl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_sincosl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_sinl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_tanhl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_tanl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_truncl.c: Likewise.
2017-10-06 17:45:05 +00:00
Carlos O'Donell 1e26d35193 malloc: Fix tcache leak after thread destruction [BZ #22111]
The malloc tcache added in 2.26 will leak all of the elements remaining
in the cache and the cache structure itself when a thread exits. The
defect is that we do not set tcache_shutting_down early enough, and the
thread simply recreates the tcache and places the elements back onto a
new tcache which is subsequently lost as the thread exits (unfreed
memory). The fix is relatively simple, move the setting of
tcache_shutting_down earlier in tcache_thread_freeres. We add a test
case which uses mallinfo and some heuristics to look for unaccounted for
memory usage between the start and end of a thread start/join loop. It
is very reliable at detecting that there is a leak given the number of
iterations.  Without the fix the test will consume 122MiB of leaked
memory.
2017-10-06 09:31:52 -07:00
Rajalakshmi Srinivasaraghavan d138676258 Missed changelog entry 2017-10-06 21:39:32 +05:30
Joseph Myers 6dff198369 Remove redundant ldbl-64-128 files.
Various source files in ldbl-64-128 are redundant, because they wrap
files that no longer provide public symbols that need special
versioning (those symbols having moved to separate errno-setting
wrappers), or, in the case of w_scalblnl.c, because the type-generic
template now does everything required (it deals with symbol versioning
for use in libm, and this file is never built for libc anyway - the
compat scalbln* symbols in libc, as opposed to scalbn*, are only for
i386 and m68k and are aliases to the corresponding scalbn* symbols).
This patch removes those redundant files.

Tested with build-many-glibcs.py (for all ldbl-64-128 configurations)
that installed stripped shared libraries are unchanged by this patch.

	* sysdeps/ieee754/ldbl-64-128/e_ilogbl.c: Remove file.
	* sysdeps/ieee754/ldbl-64-128/s_log1pl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_scalblnl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/s_scalbnl.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/w_scalblnl.c: Likewise.
2017-10-06 15:02:12 +00:00
Joseph Myers 0db0b931cf Update ARM libm-test-ulps.
* sysdeps/arm/libm-test-ulps: Update.
2017-10-05 22:17:30 +00:00
Joseph Myers 86f9568af6 Use libm_alias_ldouble for ldbl-96 functions.
This patch makes ldbl-96 functions use libm_alias_ldouble to define
function aliases.

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

	* sysdeps/ieee754/ldbl-96/s_asinhl.c: Include
	<libm-alias-ldouble.h>.
	(asinhl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_cbrtl.c: Include
	<libm-alias-ldouble.h>.
	(cbrtl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_copysignl.c: Include
	<libm-alias-ldouble.h>.
	(copysignl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_cosl.c: Include
	<libm-alias-ldouble.h>.
	(cosl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_erfl.c: Include
	<libm-alias-ldouble.h>.
	(erfl): Define using libm_alias_ldouble.
	(erfcl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c: Include
	<libm-alias-ldouble.h>.
	(fmal): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_frexpl.c: Include
	<libm-alias-ldouble.h>.
	(frexpl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_fromfpl.c (fromfpl): Define using
	libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_fromfpl_main.c: Include
	<libm-alias-ldouble.h>.
	* sysdeps/ieee754/ldbl-96/s_fromfpxl.c (fromfpxl): Define using
	libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_getpayloadl.c: Include
	<libm-alias-ldouble.h>.
	(getpayloadl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_llrintl.c: Include
	<libm-alias-ldouble.h>.
	(llrintl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c: Include
	<libm-alias-ldouble.h>.
	(llroundl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_lrintl.c: Include
	<libm-alias-ldouble.h>.
	(lrintl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_lroundl.c: Include
	<libm-alias-ldouble.h>.
	(lroundl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_modfl.c: Include
	<libm-alias-ldouble.h>.
	(modfl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_nextupl.c: Include
	<libm-alias-ldouble.h>.
	(nextupl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_remquol.c: Include
	<libm-alias-ldouble.h>.
	(remquol): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_roundevenl.c: Include
	<libm-alias-ldouble.h>.
	(roundevenl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_roundl.c: Include
	<libm-alias-ldouble.h>.
	(roundl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_setpayloadl.c (setpayloadl): Define
	using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_setpayloadl_main.c: Include
	<libm-alias-ldouble.h>.
	* sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c: Include
	<libm-alias-ldouble.h>.
	(setpayloadsigl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_sincosl.c: Include
	<libm-alias-ldouble.h>.
	(sincosl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_sinl.c: Include
	<libm-alias-ldouble.h>.
	(sinl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_tanhl.c: Include
	<libm-alias-ldouble.h>.
	(tanhl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_tanl.c: Include
	<libm-alias-ldouble.h>.
	(tanl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_totalorderl.c: Include
	<libm-alias-ldouble.h>.
	(totalorderl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Include
	<libm-alias-ldouble.h>.
	(totalordermagl): Define using libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_ufromfpl.c (ufromfpl): Define using
	libm_alias_ldouble.
	* sysdeps/ieee754/ldbl-96/s_ufromfpxl.c (ufromfpxl): Define using
	libm_alias_ldouble.
2017-10-05 21:13:40 +00:00
Siddhesh Poyarekar dd5bc7f1b3 aarch64: Optimized implementation of memmove for Qualcomm Falkor
This is an optimized memmove implementation for the Qualcomm Falkor
processor core.  Due to the way the falkor memcpy needs to be written,
code cannot be easily shared between memmove and memcpy like in case
of other aarch64 memcpy implementations due to which this routine is
separate.  The underlying principle is the same as that of memcpy
where it tries to use registers with the same lower 4 bits for
fetching the same stream, thus optimizing hardware prefetcher
performance.

The memcpy copy loop copies 64 bytes at a time using the same register
pair since that's the way to train the hardware prefetcher on the
falkor core.  memmove cannot quite do that since it needs to avoid
overlaps, so it does the next best thing, i.e. has a 32 byte loop with
a 32 byte end (prefetch a loop ahead to account for overlapping
locations) with register pairs that alias so that they hit the same
prefetcher.  Due to this difference in loop size, they have to
currently be separate implementations but efforts are on to try and
get memmove to fall back into memcpy whenever it can without simply
duplicating all of the code.

Performance:

The routine fares around 20-25% better than the generic memmove for
most medium to large sizes (i.e. > 128 bytes) for the new walking
memmove benchmark (memmove-walk) with an unexplained regression
between 1K and 2K.  The minor regression is something worth looking
into for us, but the remaining gains are significant enough that we
would like this included upstream as we looking into the cause for the
regression.  Here is a snippet of the numbers as generated from the
microbenchmark by the compare_strings script.  Comparisons are against
__memmove_generic:

Function: memmove
Variant: walk
                                    __memmove_thunderx	__memmove_falkor	__memmove_generic
========================================================================================================================
<snip>
                        length=16384:  12508800.00 (  6.09%)	 11486800.00 ( 13.76%)	 13319600.00
                        length=16400:  13614200.00 ( -0.67%)	 11585000.00 ( 14.33%)	 13523600.00
                        length=16385:  13448400.00 (  0.10%)	 11732700.00 ( 12.84%)	 13461200.00
                        length=16399:  13594100.00 ( -0.22%)	 11859600.00 ( 12.57%)	 13564400.00
                        length=16386:  13211600.00 (  1.13%)	 11503800.00 ( 13.91%)	 13362400.00
                        length=16398:  13218600.00 (  2.12%)	 11573200.00 ( 14.30%)	 13504700.00
                        length=16387:  13510900.00 ( -0.37%)	 11744200.00 ( 12.76%)	 13461300.00
                        length=16397:  13603700.00 ( -0.15%)	 11878200.00 ( 12.55%)	 13583200.00
                        length=16388:  13461700.00 ( -0.13%)	 11558000.00 ( 14.03%)	 13444100.00
                        length=16396:  13517500.00 ( -0.03%)	 11561300.00 ( 14.45%)	 13513900.00
                        length=16389:  13534100.00 (  0.17%)	 11756800.00 ( 13.28%)	 13556900.00
                        length=16395:  13585600.00 (  0.11%)	 11791800.00 ( 13.30%)	 13601200.00
                        length=16390:  13480100.00 ( -0.13%)	 11685500.00 ( 13.20%)	 13462100.00
                        length=16394:  13529900.00 ( -0.23%)	 11549800.00 ( 14.43%)	 13498200.00
                        length=16391:  13595400.00 ( -0.26%)	 11768200.00 ( 13.22%)	 13560600.00
                        length=16393:  13567000.00 (  0.20%)	 11779700.00 ( 13.35%)	 13594700.00
                        length=32768:  71308800.00 ( -6.53%)	 50220800.00 ( 24.98%)	 66939200.00
                        length=32784:  72100800.00 (-11.55%)	 50114100.00 ( 22.47%)	 64636300.00
                        length=32769:  71767000.00 ( -7.10%)	 51238400.00 ( 23.54%)	 67010000.00
                        length=32783:  70113700.00 (-40.95%)	 51129000.00 ( -2.78%)	 49744400.00
                        length=32770:  71367600.00 ( -6.52%)	 50244700.00 ( 25.01%)	 67000900.00
                        length=32782:  64366700.00 (  4.71%)	 50101400.00 ( 25.83%)	 67545600.00
                        length=32771:  71440100.00 ( -6.51%)	 51263900.00 ( 23.57%)	 67074900.00
                        length=32781:  66993000.00 (  0.34%)	 51108300.00 ( 23.97%)	 67220300.00
                        length=32772:  71443900.00 (-60.50%)	 50062100.00 (-12.47%)	 44512600.00
                        length=32780:  71759100.00 ( -6.58%)	 50263200.00 ( 25.35%)	 67328600.00
                        length=32773:  71714900.00 (-33.21%)	 51076600.00 (  5.12%)	 53835400.00
                        length=32779:  71756900.00 ( -6.56%)	 51290800.00 ( 23.83%)	 67337800.00
                        length=32774:  59689300.00 (-34.55%)	 50068400.00 (-12.86%)	 44363300.00
                        length=32778:  71847500.00 (-18.20%)	 50084100.00 ( 17.61%)	 60786500.00
                        length=32775:  71599300.00 ( -6.54%)	 51278200.00 ( 23.70%)	 67204800.00
                        length=32777:  71862900.00 (-60.85%)	 51094000.00 (-14.36%)	 44677900.00
                        length=65536: 282848000.00 ( -6.60%)	199187000.00 ( 24.93%)	265325000.00
                        length=65552: 243285000.00 (-41.61%)	198512000.00 (-15.54%)	171805000.00
                        length=65537: 255415000.00 (-23.47%)	202499000.00 (  2.11%)	206858000.00
                        length=65551: 280122000.00 (-62.95%)	203349000.00 (-18.29%)	171911000.00
                        length=65538: 283676000.00 (-14.46%)	198368000.00 ( 19.96%)	247848000.00
                        length=65550: 275566000.00 (-51.76%)	198494000.00 ( -9.31%)	181581000.00
                        length=65539: 283699000.00 ( -6.58%)	203453000.00 ( 23.57%)	266195000.00
                        length=65549: 286572000.00 ( -6.65%)	202607000.00 ( 24.60%)	268712000.00
                        length=65540: 283710000.00 ( -6.59%)	199161000.00 ( 25.17%)	266160000.00
                        length=65548: 237573000.00 ( 11.48%)	198462000.00 ( 26.06%)	268395000.00
                        length=65541: 284150000.00 ( -6.58%)	203273000.00 ( 23.75%)	266600000.00
                        length=65547: 286250000.00 ( -6.70%)	202594000.00 ( 24.48%)	268263000.00
                        length=65542: 284167000.00 ( -6.60%)	199122000.00 ( 25.31%)	266584000.00
                        length=65546: 285656000.00 ( -6.59%)	198443000.00 ( 25.95%)	268002000.00
                        length=65543: 284600000.00 ( -6.58%)	203247000.00 ( 23.89%)	267030000.00
                        length=65545: 285665000.00 ( -6.40%)	202575000.00 ( 24.55%)	268472000.00
<snip>

	* sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add
	memmove_falkor.
	* sysdeps/aarch64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Likewise.
	* sysdeps/aarch64/multiarch/memmove.c: Likewise.
	* sysdeps/aarch64/multiarch/memmove_falkor.S: New file.
2017-10-05 22:20:23 +05:30
Siddhesh Poyarekar 5bfb04042d benchtests: Memory walking benchmark for memmove
This benchmark is an attempt to eliminate cache effects from string
benchmarks.  The benchmark walks both ways through a large memory area
and copies different sizes of memory and alignments one at a time
instead of looping around in the same memory area.  This is a good
metric to have alongside the simple memmove benchmark (which is only
really useful for smaller sizes) especially for larger sizes where the
likelihood of the call being done only once is pretty high.

This benchmark is different from memcpy in that it also tests
overlapping copies.

	* benchtests/bench-memmove-walk.c: New file.
	* benchtests/Makefile (string-benchset): Add it.
2017-10-05 22:20:23 +05:30
Siddhesh Poyarekar 36bb8edf51 benchtests: Memory walking benchmark for memset
This benchmark is an attempt to eliminate cache effects from string
benchmarks.  The benchmark walks backward through a large memory area
and sets different sizes of memory and alignments one at a time
instead of looping around in the same memory area.  This is a good
metric to have alongside the simple memset benchmark (which is only
really useful for smaller sizes) especially for larger sizes where the
likelihood of the call being done only once is pretty high.

	* benchtests/bench-memset-walk.c: New file.
	* benchtests/Makefile (string-benchset): Add it.
2017-10-05 22:20:23 +05:30
Siddhesh Poyarekar 9ec87fd2b1 benchtests: Memory walking benchmark for memcpy
This benchmark is an attempt to eliminate cache effects from string
benchmarks.  The benchmark walks both ways through a large memory area
and copies different sizes of memory and alignments one at a time
instead of looping around in the same memory area.  This is a good
metric to have alongside the other memcpy benchmarks, especially for
larger sizes where the likelihood of the call being done only once is
pretty high.

	* benchtests/bench-memcpy-walk.c: New file.
	* benchtests/Makefile (string-benchset): Add it.
2017-10-05 22:20:23 +05:30
Florian Weimer 1e9522c61c nscd: Eliminate compilation time dependency in the build output
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-10-05 18:14:57 +02:00
Joseph Myers 644d38570a Remove add-ons mechanism.
glibc has an add-ons mechanism to allow additional software to be
integrated into the glibc build.  Such add-ons may be within the glibc
source tree, or outside it at a path passed to the --enable-add-ons
configure option.

localedata and crypt were once add-ons, distributed in separate
release tarballs, but long since stopped using that mechanism.
Linuxthreads was always an add-on.  Ports spent some time as an add-on
with separate release tarballs, then was first moved into the glibc
source tree, then had its sysdeps files moved into the main sysdeps
hierarchy so the add-ons mechanism was no longer used.  NPTL spent
some time as an add-on in the main glibc tree before stopping using
the add-on mechanism.  libidn used to have separate release tarballs
but no longer does so, but still uses the add-ons mechanism within the
glibc source tree.  Various other software has supported building with
the add-ons mechanism at times in the past, but I don't think any is
still widely used.

Add-ons involve significant, little-used complexity in the glibc build
system, and make it hard to understand what the space of possible
glibc configurations is.  This patch removes the add-ons mechanism.
libidn is now built via the Subdirs mechanism to cause any
configuration using sysdeps/unix/inet to build libidn; HAVE_LIBIDN
(which effectively means shared libraries are available) is now
defined via sysdeps/unix/inet/configure.  Various references to
add-ons around the source tree are removed (in the case of maint.texi,
the example list of sysdeps directories is still very out of date).

Externally maintained ports should now put their files in the normal
sysdeps directory structure rather than being arranged as add-ons;
they probably need to change e.g. elf.h anyway, rather than actually
being able to work just as a drop-in subtree.  Hurd libpthread should
be arranged similarly to NPTL, so some files might go in a
hurd-pthreads (or similar) top-level directory in glibc, while sysdeps
files should go in the normal sysdeps directory structure (possibly in
hurd or hurd-pthreads subdirectories, just as there are nptl
subdirectories in the sysdeps tree).

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

	* configure.ac (--enable-add-ons): Remove option.
	(machine): Do not mention add-ons in comment.
	(LIBC_PRECONFIGURE): Likewise.
	(add_ons): Remove variable and sanity checks and logic to locate
	add-ons.
	(add_ons_automatic): Remove variable.
	(configured_add_ons): Likewise.
	(add_ons_sfx): Likewise.
	(add_ons_pfx): Likewise.
	(add_on_subdirs): Likewise.
	(sysnames_add_ons): Likewise.  Remove loop over add-ons and
	consideration of add-ons in Implies handling.
	(sysdeps_add_ons): Likewise.
	* configure: Regenerated.
	* libidn/configure.ac: Remove.
	* libidn/configure: Likewise.
	* sysdeps/unix/inet/configure.ac: New file.
	* sysdeps/unix/inet/configure: New generated file.
	* sysdeps/unix/inet/Subdirs: Add libidn.
	* Makeconfig (sysdeps-srcdirs): Remove variable.
	(+sysdep_dirs): Do not include $(sysdeps-srcdirs).
	($(common-objpfx)config.status): Do not depend on add-on files.
	($(common-objpfx)shlib-versions.v.i): Do not mention add-ons in
	comment.
	(all-subdirs): Do not include $(add-on-subdirs).
	* Makefile (dist-prepare): Do not use $(sysdeps-add-ons).
	* config.make.in (add-ons): Remove variable.
	(add-on-subdirs): Likewise.
	(sysdeps-add-ons): Likewise.
	* manual/Makefile (add-chapters): Remove.
	($(objpfx)texis): Do not depend on $(add-chapters).
	(nonexamples): Do not handle $(add-chapters).
	(examples): Do not handle $(add-ons).
	(chapters.% top-menu.%): Do not pass '$(add-chapters)' to
	libc-texinfo.sh.
	* manual/install.texi (Installation): Do not mention add-ons.
	(--enable-add-ons): Do not document configure option.
	* INSTALL: Regenerated.
	* manual/libc-texinfo.sh: Do not handle $2 add-ons argument.
	* manual/maint.texi (Hierarchy Conventions): Do not mention
	add-ons.
	* scripts/build-many-glibcs.py (Glibc.build_glibc): Do not use
	--enable-add-ons.
	* scripts/gen-sorted.awk: Do not handle Subdirs files from
	add-ons.
	* scripts/test-installation.pl: Do not handle glibc-compat add-on.
	* sysdeps/nptl/Makeconfig: Do not mention add-ons in comment.
2017-10-05 15:58:13 +00:00
Andreas Schwab 19f82f3586 Always do locking when iterating over list of streams (bug 15142)
_IO_list_all should only be traversed while locking list_all_lock.
2017-10-05 17:26:05 +02:00
Florian Weimer 91e7cf982d abort: Do not flush stdio streams [BZ #15436] 2017-10-05 14:48:16 +02:00
Florian Weimer 0c25125780 tst-gmon: Build with -fno-omit-frame-pointer
If glibc is built with -fomit-frame-pointer to undo the effect of
configuring GCC with --enable-frame-pointer, using -pg by itself results
in a build failure:

gcc: error: -pg and -fomit-frame-pointer are incompatible
2017-10-05 14:34:45 +02:00
Stefan Liebler 7ea59e3e5d S390: Regenerate ULPs
Updated ulps file.

ChangeLog:

	* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2017-10-05 12:50:49 +02:00
Florian Weimer 84d0e6f052 support_format_hostent: Add more error information for NETDB_INTERNAL 2017-10-05 12:20:19 +02:00
H.J. Lu ee417882e0 Don't use hidden visibility in libc.a with PIE on i386
On i386, when multi-arch is enabled, all external functions must be
called via PIC PLT in PIE, which requires setting up EBX register,
since they may be IFUNC functions.

	* config.h.in (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New.
	* include/libc-symbols.h (__hidden_proto_hiddenattr): Add check
	for PIC and NO_HIDDEN_EXTERN_FUNC_IN_PIE.
	* sysdeps/i386/configure.ac (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New
	AC_DEFINE if multi-arch is enabled.
	* sysdeps/i386/configure: Regenerated.
2017-10-04 17:18:42 -07:00
H.J. Lu a67029ff12 Use $(DEFAULT-LDFLAGS-$(@F)) in +link-static-before-libc
Use $(LDFLAGS-$(@F)) with tst-tls1-static-non-pie may not be sufficient
when static PIE is built by default.  Use $(DEFAULT-LDFLAGS-$(@F)) in
+link-static-before-libc to make sure that tst-tls1-static-non-pie is
always built as non-PIE static executable and make sure that crt1.o is
used with tst-tls1-static-non-pie.

	* Makeconfig (+link-static-before-libc): Use
	$(DEFAULT-LDFLAGS-$(@F)).
	* elf/Makefile (CRT-tst-tls1-static-non-pie): New.
	(LDFLAGS-tst-tls1-static-non-pie): Renamed to ...
	(DEFAULT-LDFLAGS-tst-tls1-static-non-pie): This.
2017-10-04 17:16:04 -07:00
H.J. Lu 5dba84b324 Add a test for main () in a shared object
Verify that crt1.o can be used with main () in a shared object.

	* elf/Makefile (tests): Add tst-main1.
	(modules-names): Add tst-main1mod.
	($(objpfx)tst-main1): New.
	(CRT-tst-main1): Likewise.
	(LDFLAGS-tst-main1): Likewise.
	(LDLIBS-tst-main1): Likewise.
	(tst-main1mod.so-no-z-defs): Likewise.
	* elf/tst-main1.c: New file.
	* elf/tst-main1mod.c: Likewise.
2017-10-04 15:40:49 -07:00
H.J. Lu 758f1bfa2a test-math-iscanonical.cc: Return errors != 0
Since not all non-zero error counts are errors, return errors != 0
instead.

	* math/test-math-iscanonical.cc (do_test): Return errors != 0.
2017-10-04 14:31:16 -07:00
Joseph Myers 7e16a5d1d1 Use libm_alias_double for dbl-64 fma.
This patch makes dbl-64 fma use libm_alias_double.  The ldbl-opt
version is removed.  The sparc32 version no longer needs to handle
compat symbols, while alpha needs a new wrapper to avoid getting the
ldbl-128 version (where ldbl-opt is earlier in the list of sysdeps
directories, so previously fma came from there).

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

	* sysdeps/ieee754/dbl-64/s_fma.c: Include <libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/ieee754/ldbl-opt/s_fma.c: Remove file.
	* sysdeps/sparc/sparc32/fpu/s_fma.c: Do not include
	<math_ldbl_opt.h>.
	(fmal): Do not define as compat symbol here.
	* sysdeps/alpha/fpu/s_fma.c: New file.
2017-10-04 20:32:48 +00:00
Szabolcs Nagy db4f87bad4 aarch64: don't use MIN in dl-machine.h
MIN is used, but param.h may not be included, so expand its
single use inline.

	* sysdeps/aarch64/dl-machine.h (elf_machine_rela): Expand MIN.
2017-10-04 17:49:38 +01:00
Joseph Myers 32d372d548 Restore sparc32 copysignl, fabsl, fmal compat symbols (bug 22229).
32-bit SPARC libm should have compat symbols for copysignl
(GLIBC_2.0), fabsl (GLIBC_2.0), fmal (GLIBC_2.1), pointing to the
double functions; they were present in glibc 2.8, for example, but are
now missing, probably when optimized SPARC function implementations
were added without appropriate compat symbol handling.  The same
applies to copysignl in libc.  This patch restores those compat
symbols.

Tested with build-many-glibcs.py for sparcv9-linux-gnu.

	[BZ #22229]
	* sysdeps/sparc/sparc32/fpu/s_copysign.S: Include
	<math_ldbl_opt.h>
	(copysignl): Define as compat symbol at version GLIBC_2_0 for libm
	and libc.
	* sysdeps/sparc/sparc32/fpu/s_fabs.S: Include <math_ldbl_opt.h>.
	(fabsl): Define as compat symbol at version GLIBC_2_0 for libm.
	* sysdeps/sparc/sparc32/fpu/s_fma.c: Include <math_ldbl_opt.h>.
	(fmal): Define as compat symbol at version GLIBC_2_1 for libm.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S:
	Include <math_ldbl_opt.h>
	(copysignl): Define as compat symbol at version GLIBC_2_0 for libm
	and libc.
	(compat_symbol): Undefine and redefine.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.S: Include
	<math_ldbl_opt.h>
	(fabsl): Define as compat symbol at version GLIBC_2_0 for libm.
	(compat_symbol): Undefine and redefine.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c
	[HAVE_AS_VIS3_SUPPORT]: Include <math_ldbl_opt.h>.
	[HAVE_AS_VIS3_SUPPORT] (fmal): Define as compat symbol at version
	GLIBC_2_1 for libm.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Add
	GLIBC_2.0 copysignl symbol.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Add
	GLIBC_2.0 copysignl and fabsl and GLIBC_2.1 fmal symbols.
2017-10-04 16:46:05 +00:00
Joseph Myers 72d13ed1bd Remove alpha nearbyint wrapper.
Given my recent changes, sysdeps/alpha/fpu/s_nearbyint.c is no longer
needed: it just includes the dbl-64/wordsize-64 version, which is the
one that would be used anyway, and defines a compat symbol,
duplicating the same compat symbol defined by the dbl-64/wordsize-64
version through use of libm_alias_double.  Thus, this patch removes
the redundant wrapper.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for alpha.

	* sysdeps/alpha/fpu/s_nearbyint.c: Remove file.
2017-10-04 15:57:53 +00:00
Florian Weimer 11c4f5010c crypt: Adjust check-local-headers.sh for nspr4 include directory [BZ #17956] 2017-10-04 15:49:06 +02:00
Guido Trentalancia 57b4af1955 crypt: Use NSPR header files in addition to NSS header files [BZ #17956]
When configuring and building GNU libc using the Mozilla NSS library
for cryptography (--enable-nss-crypt option), also include the
NSPR header files along with the Mozilla NSS library header files.

Finally, when running the check-local-headers test, ignore the
Mozilla NSPR library header files (used by the Mozilla NSS library).
2017-10-04 15:02:35 +02:00
Andreas Schwab 64d1e08ea8 Move nss_compat from nis to nss subdir and install it unconditionally
This has been tested that local lookup still works with and
without an installed libnss_nis, and that NIS lookup works when
libnss_nis is available.
2017-10-04 14:20:48 +02:00
Szabolcs Nagy 86c27ade1e [BZ #22244] Fix yn(n,0) without SVID wrapper
Without SVID compat wrapper yn(n,0) and ynf(n,0) does not raise
the divide-by-zero excpetion and it may return inf with the wrong
sign for n < 0.

	[BZ #22244]
	* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_yn): Fix x == 0 case.
	* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_ynf): Likewise.
2017-10-04 10:15:12 +01:00
Szabolcs Nagy 8f8f8ef7ab [BZ #22243] fix log2(0) and log(10) in downward rounding
On 64bit targets if the SVID compat wrapper is suppressed (e.g. static linking)
then log2(0) and log10(0) returned inf instead of -inf.

	[BZ #22243]
	* sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c (__ieee754_log10): Use fabs.
	* sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c (__ieee754_log2): Likewise.
2017-10-04 10:13:56 +01:00
H.J. Lu 955774751b i386: Use "movl main@GOT(%ebx), %eax" in start.S
Don't use "leal main@GOTOFF(%ebx), %eax" since main may be in a
shared object.  Linker will convert "movl main@GOT(%ebx), %eax"
to "leal main@GOTOFF(%ebx), %eax" if main is defined locally.

	* sysdeps/i386/start.S: Replace "leal main@GOT(%ebx), %eax" with
	"movl main@GOTOFF(%ebx), %eax".
2017-10-03 17:54:30 -07:00
H.J. Lu 02d2d8927d Revert x86: Allow undefined _DYNAMIC in static executable
This code is used in non-PIE static executable and static PIE.  It checks
if _DYNAMIC is undefined before using it to compute load address.  But
not all targets can convert access _DYNAMIC via GOT, which needs dynamic
relocation, to PC-relative at link-time.

	* sysdeps/i386/dl-machine.h (elf_machine_load_address): Don't
	allow undefined _DYNAMIC in PIE libc.a.
	* sysdeps/x86_64/dl-machine.h (elf_machine_load_address):
	Likewse.
2017-10-03 17:49:09 -07:00
H.J. Lu 0c609d19e3 mips: Don't check _DYNAMIC in elf_machine_load_address
Since mips can't convert access _DYNAMIC via GOT, which needs dynamic
relocation, to PC-relative at link-time, don't check _DYNAMIC in
elf_machine_load_address.

        * sysdeps/mips/dl-machine.h (elf_machine_load_address): Don't
        check _DYNAMIC.
2017-10-03 17:47:51 -07:00
H.J. Lu c34a19ed4b arm: Don't check _DYNAMIC in elf_machine_load_address
Since arm can't convert access _DYNAMIC via GOT, which needs dynamic
relocation, to PC-relative at link-time, don't check _DYNAMIC in
elf_machine_load_address.

	* sysdeps/arm/dl-machine.h (elf_machine_load_address): Don't
	check _DYNAMIC.
2017-10-03 17:46:07 -07:00
H.J. Lu cdd4155d6c test-math-iscanonical.cc: Replace bool with int
Fix GCC 7 compilation error:

test-math-iscanonical.cc: In function ‘void check_type()’:
test-math-iscanonical.cc:33:11: error: use of an operand of type ‘bool’ in ‘operator++’ is deprecated [-Werror=deprecated]
     errors++;
           ^~

	* math/test-math-iscanonical.cc (error): Replace bool with int.
2017-10-03 17:41:47 -07:00
Joseph Myers d8f619b393 Use libm_alias_double for dbl-64 modf.
This patch makes dbl-64 modf use libm_alias_double.  Both the dbl-64
and dbl-64/wordsize-64 versions are changed, and the ldbl-opt version
is changed to define the libc compat symbol only.  Because of
multiarch wrappers, the changed implementations are made not to define
aliases at all if __modf is defined as a macro, as with other
functions, so avoiding duplicate compat symbols while allowing those
wrappers to be simplified.

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

	* sysdeps/ieee754/dbl-64/s_modf.c: Include <libm-alias-double.h>.
	(modf): Define using libm_alias_double, only if [!__modf].
	* sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double, only if [!__modf].
	* sysdeps/ieee754/ldbl-opt/s_modf.c (modfl): Only define libc
	compat symbol here.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-ppc32.c
	(weak_alias): Do not undefine and redefine.
	(strong_alias): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c
	(weak_alias): Likewise.
	(strong_alias): Likewise.
2017-10-03 23:46:23 +00:00
Joseph Myers 4699cb8b5f Use libm_alias_double for dbl-64 logb.
This patch makes dbl-64 logb use libm_alias_double.  Both the dbl-64
and dbl-64/wordsize-64 versions are changed, and the ldbl-opt version
is removed.  Because of multiarch wrappers, the changed
implementations are made not to define aliases at all if __logb is
defined as a macro, as with other functions, so avoiding duplicate
compat symbols while allowing those wrappers to be simplified.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged (except on alpha
where changes from using the wordsize-64 version are expected).

	* sysdeps/ieee754/dbl-64/s_logb.c: Include <libm-alias-double.h>.
	(logb): Define using libm_alias_double, only if [!__logb].
	* sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double, only if [!__logb].
	* sysdeps/ieee754/ldbl-opt/s_logb.c: Remove file.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-ppc32.c
	(weak_alias): Do not undefine and redefine.
	(strong_alias): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c
	(weak_alias): Likewise.
	(strong_alias): Likewise.
2017-10-03 23:44:41 +00:00
H.J. Lu bcc4e4bb31 tile: Check SHARED instead PIC for SYSCALL_ERROR_NAME
For static PIE code, PIC is defined and SHARED is undefined.  We
should check SHARED instead PIC for SYSCALL_ERROR_NAME.

	* sysdeps/unix/sysv/linux/tile/sysdep.h (SYSCALL_ERROR_NAME):
	Check SHARED instead PIC.
2017-10-03 14:54:55 -07:00
Joseph Myers 7f1cbdf8ed Use libm_alias_float for dbl-64 fmaf.
This patch makes the implementation of fmaf in the dbl-64 directory
use libm_alias float.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

	* sysdeps/ieee754/dbl-64/s_fmaf.c: Include <libm-alias-float.h>.
	[!__fmaf] (fmaf): Define using libm_alias_float.
2017-10-03 21:01:33 +00:00
Joseph Myers 39793865ec Use libm_alias_double for dbl-64 frexp.
This patch makes dbl-64 frexp use libm_alias_double.  Both the dbl-64
and dbl-64/wordsize-64 versions are changed; the ldbl-opt version is
made to define only the libc frexpl compat symbol, now the generic
code handles the libm compat symbol automatically.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

	* sysdeps/ieee754/dbl-64/s_frexp.c: Include <libm-alias-double.h>.
	(frexp): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c: Include
	<libm-alias-double.h>.
	(frexp): Define using libm_alias_double.
	* sysdeps/ieee754/ldbl-opt/s_frexp.c (frexpl): Only define libc
	compat symbol here.
2017-10-03 20:56:46 +00:00
Gabriel F. T. Gomes aa0235dfde Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm (bug 22235)
All representations of floating-point numbers in types with IEC 60559
binary exchange format are canonical.  On the other hand, types with IEC
60559 extended formats, such as those implemented under ldbl-96 and
ldbl-128ibm, contain representations that are not canonical.

TS 18661-1 introduced the type-generic macro iscanonical, which returns
whether a floating-point value is canonical or not.  In Glibc, this
type-generic macro is implemented using the macro __MATH_TG, which, when
support for float128 is enabled, relies on __builtin_types_compatible_p
to select between floating-point types.  However, this use of
iscanonical breaks C++ applications, because the builtin is only
available in C mode.

This patch provides a C++ implementation of iscanonical that relies on
function overloading, rather than builtins, to select between
floating-point types.

Unlike the C++ implementations for iszero and issignaling, this
implementation ignores __NO_LONG_DOUBLE_MATH.  The double type always
matches IEC 60559 double format, which is always canonical.  Thus, when
double and long double are the same (__NO_LONG_DOUBLE_MATH), iscanonical
always returns 1 and is not implemented with __MATH_TG.

Tested for powerpc64, powerpc64le and x86_64.

	[BZ #22235]
	* math/math.h: Trivial fix for unbalanced parentheses in comment.
	* math/Makefile [CXX] (tests): Add test-math-iscanonical.cc.
	(CFLAGS-test-math-iscanonical.cc): New variable.
	* math/test-math-iscanonical.cc: New file.
	* sysdeps/ieee754/ldbl-96/bits/iscanonical.h (iscanonical):
	Provide a C++ implementation based on function overloading,
	rather than using __MATH_TG, which uses C-only builtins.
	* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h (iscanonical):
	Likewise.
	* sysdeps/powerpc/powerpc64le/Makefile
	(CFLAGS-test-math-iscanonical.cc): New variable.
2017-10-03 16:01:37 -03:00
Joseph Myers a1132b5e56 Use libm_alias_double for more dbl-64 functions.
This patch makes more dbl-64 functions use libm_alias_double to define
function aliases.  Specifically, it makes the change for functions
with dbl-64/wordsize-64 versions, changing both the dbl-64 and
dbl-64/wordsize-64 versions and removing the ldbl-opt wrappers.
Functions are excluded from this patch if there are complications
because of versions of those functions also present in libc, or
architecture-specific wrappers round these files.

Tested for x86_64, and with build-many-glibcs.py.  Installed stripped
shared libraries are unchanged except for alpha (where increased use
of dbl-64/wordsize-64 files, where previously ldbl-opt files that
wrapped dbl-64 files were used, was expected to result in different,
better code).

	* sysdeps/ieee754/dbl-64/s_ceil.c: Include <libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_floor.c: Include <libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_llround.c: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_lround.c: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_nearbyint.c: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_remquo.c: Include
	<libm-alias-double.h>.
	(remquo): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_rint.c: Include <libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_round.c: Include <libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_trunc.c: Include <libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	[_LP64] (lround): Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Include
	<libm-alias-double.h>.
	[!_LP64] (lround): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c: Include
	<libm-alias-double.h>.
	(remquo): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_round.c: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/ieee754/ldbl-opt/s_ceil.c: Remove file.
	* sysdeps/ieee754/ldbl-opt/s_floor.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_llround.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_lround.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_remquo.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_rint.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_round.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_trunc.c: Likewise.
2017-10-03 17:47:35 +00:00
Szabolcs Nagy f275f64e7e fix drem symbol for static linking and new targets
The compat remainder code is no longer built for !LIBM_SVID_COMPAT targets,
but the legacy drem, dremf and dreml symbols should be still defined since
removing them may break existing code, so keep them as aliases in the
non-compat remainder code.

	* math/w_remainder.c: New file.
	* math/w_remainderf.c: New file.
	* math/w_remainderl.c: New file.
2017-10-03 14:31:59 +01:00
H.J. Lu b8818ab592 ld.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP
(&_dl_main_map) is used instead of (&bootstrap_map) to bootstrap static
PIE.  Define BOOTSTRAP_MAP with (&_dl_main_map) to avoid hardcode to
(&bootstrap_map).

	* elf/rtld.c (BOOTSTRAP_MAP): New.
	(RESOLVE_MAP): Replace (&bootstrap_map) with BOOTSTRAP_MAP.
	* sysdeps/hppa/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
	Likewise.
	* sysdeps/ia64/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
	Likewise.
	* sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
	Likewise.
2017-10-03 01:55:12 -07:00
Samuel Thibault 3d1870fa33 Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN
On the Hurd, the rtld needs to see its own dumb versions of a few functions
(defined in sysdeps/mach/hurd/dl-sysdep.c) overridden by libc's versions once
loaded. rtld should thus not have hidden attribute for these.  To achieve this,
the Hurd port used to just define NO_HIDDEN, which disables it completely. For
now, this changes that to disabling it for all rtld functions, for simplicity.

See Roland's comment on https://sourceware.org/bugzilla/show_bug.cgi?id=15605#c5

The ld.so numbers remain at

  8 .rel.plt      000000c8  00000c24  00000c24  00000c24  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .plt          000001a0  00000cf0  00000cf0  00000cf0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .plt.got      00000010  00000e90  00000e90  00000e90  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 18 .got.plt      00000070  0002d000  0002d000  0002c000  2**2
                  CONTENTS, ALLOC, LOAD, DATA

which is about 3 times as much as on Linux.

The libc.so numbers get divided by 3 (the remainings are mostly RPC stub calls)

	* include/libc-symbols.h [NO_RTLD_HIDDEN] (rtld_hidden_proto,
	rtld_hidden_tls_proto, rtld_hidden_def, rtld_hidden_weak,
	rtld_hidden_rtld_hidden_ver, data_def, rtld_hidden_data_weak,
	rtld_hidden_data_ver): Define to empty.
	* include/assert.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__assert_fail,
	__assert_perror_fail): Likewise.
	* include/dirent.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
	(__rewinddir): Likewise.
	* include/libc-internal.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
	(__profile_frequency): Likewise.
	* include/setjmp.h (__sigsetjmp): Likewise.
	* include/signal.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__sigaction,
	__libc_sigaction): Likewise.
	* include/stdlib.h [NO_RTLD_HIDDEN] (unsetenv, __strtoul_internal): Do
	not set hidden attribute.
	* include/string.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__stpcpy, __strdup,
	__strerror_t, __strsep_g, memchr, memcmp, memcpy, memmove, memset,
	rawmemchr, stpcpy, strchr, strcmp, strlen, strnlen, strsep): Likewise.
	* include/sys/stat.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__fxstat,
	__fxstat64, __lxstat, __lxstat64, __xstat, __xstat64,
	__fxstatat64): Likewise.
	* include/sys/utsname.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
	(__uname): Likewise.
	* include/sysdeps/generic/_itoa.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
	(_itoa_upper_digits, _itoa_lower_digits): Likewise.
	* sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Do not set.
	(NO_RTLD_HIDDEN): Set.
	* sysdeps/mach/hurd/configure: Refresh.
	* config.h.in: Refresh.
2017-10-03 01:33:38 +02:00
Joseph Myers 38722448c6 Use libm_alias_double for dbl-64 atan, tan.
This patch makes the dbl-64 atan and tan implementations use
libm_alias_double, removing the corresponding ldbl-opt wrappers.

Tested for x86_64, and with build-many-glibcs.py.  Installed stripped
shared libraries are unchanged on non-ldbl-opt platforms.  For
ldbl-opt configurations, the patch has the effect of causing
compat_symbol to define atanl and tanl in terms of __atan and __tan
instead of in terms of atan and tan, which is enough to change the
installed stripped libm.so.

	* sysdeps/ieee754/dbl-64/s_atan.c: Include <libm-alias-double.h>.
	(atan): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_tan.c: Include <libm-alias-double.h>.
	(tan): Define using libm_alias_double.
	* sysdeps/ieee754/ldbl-opt/s_atan.c: Remove file.
	* sysdeps/ieee754/ldbl-opt/s_tan.c: Likewise.
2017-10-02 23:16:56 +00:00
Joseph Myers 527cd19c3d Make dbl-64 atan and tan into weak aliases.
This patch converts the dbl-64 implementations of atan and tan into
weak aliases of __atan and __tan, in preparation for making them use
libm_alias_double.  Consequent changes are made to the x86_64
multiarch versions wrapping round them (with the dbl-64 functions,
like other such functions, being made not to define their aliases at
all if __atan or __tan are defined as macros by an including file).

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

	* sysdeps/ieee754/dbl-64/s_atan.c (atan): Rename to __atan and
	define as weak alias of __atan.  Do not define any aliases if
	[__atan].
	[NO_LONG_DOUBLE] (__atanl): Define as strong alias of __atan.
	[NO_LONG_DOUBLE] (atanl): Define as weak alias of __atanl.
	* sysdeps/ieee754/dbl-64/s_tan.c (tan): Rename to __tan and define
	as weak alias of __tan.  Do not define any aliases if [__tan].
	[NO_LONG_DOUBLE] (__tanl): Define as strong alias of __tan.
	[NO_LONG_DOUBLE] (tanl): Define as weak alias of __tanl.
	* sysdeps/x86_64/fpu/multiarch/s_atan-avx.c (atan): Rename to
	__atan.
	* sysdeps/x86_64/fpu/multiarch/s_atan-fma.c (atan): Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_atan-fma4.c (atan): Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_atan.c (atan): Rename to __atan
	and define as weak alias of __atan.
	* sysdeps/x86_64/fpu/multiarch/s_tan-avx.c (tan): Rename to
	__atan.
	* sysdeps/x86_64/fpu/multiarch/s_tan-fma.c (tan): Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_tan-fma4.c (tan): Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_tan.c (tan): Rename to __tan and
	define as weak alias of __tan.
2017-10-02 20:20:52 +00:00
Szabolcs Nagy bdc5c59214 fix gamma symbol for static linking and new targets
The lgamma compat code is no longer built for !LIBM_SVID_COMPAT targets,
but the legacy gamma, gammaf and gammal symbols should be still defined,
so make them aliases to the non-compat lgamma code.

	* math/w_lgamma.c: New file.
	* math/w_lgammaf.c: New file.
	* math/w_lgammal.c: New file.
2017-10-02 17:33:13 +01:00
Szabolcs Nagy bd4430c2a6 Do not wrap logf, log2f and powf
The new generic logf, log2f and powf code don't need wrappers any more,
they set errno inline so only use the wrappers on targets that need it.

	* sysdeps/ieee754/flt-32/e_log2f.c (__log2f): Define without wrapper.
	* sysdeps/ieee754/flt-32/e_logf.c (__logf): Likewise
	* sysdeps/ieee754/flt-32/e_powf.c (__powf): Likewise
	* sysdeps/ieee754/flt-32/w_log2f.c: New file.
	* sysdeps/ieee754/flt-32/w_logf.c: New file.
	* sysdeps/ieee754/flt-32/w_powf.c: New file.
	* sysdeps/i386/fpu/w_log2f.c: New file.
	* sysdeps/i386/fpu/w_logf.c: New file.
	* sysdeps/i386/fpu/w_powf.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_log2f.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_logf.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_powf.c: New file.
2017-10-02 14:39:38 +01:00
Szabolcs Nagy f7a0b063e7 Do not wrap expf and exp2f
The new generic expf and exp2f code don't need wrappers any more, they
set errno inline, so only use the wrappers on targets that need it.
(If the wrapper is needed, then the top level wrapper code is included,
otherwise empty w_exp*f.c is used to suppress the wrapper.)

A powerpc64 expf implementation includes the expf c code directly which
needed some changes.

	* sysdeps/ieee754/flt-32/e_exp2f.c (__exp2f): Define without wrapper.
	* sysdeps/ieee754/flt-32/e_expf.c (__expf): Likewise
	* sysdeps/ieee754/flt-32/w_exp2f.c: New file.
	* sysdeps/ieee754/flt-32/w_expf.c: New file.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c: Update for
	the new expf code.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c: New file.
	* sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_exp2f.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_expf.c: New file.
	* sysdeps/i386/fpu/w_exp2f.c: New file.
	* sysdeps/i386/fpu/w_expf.c: New file.
	* sysdeps/i386/i686/fpu/multiarch/w_expf.c: New file.
	* sysdeps/x86_64/fpu/w_expf.c: New file.
2017-10-02 14:38:54 +01:00
Szabolcs Nagy 72d3d28108 New symbol version for logf, log2f and powf without SVID compat
This patch changes the logf, log2f and powf error handling semantics
to only set errno accoring to POSIX rules. New symbol version is
introduced at GLIBC_2.27.

The old wrappers are kept for compat symbols.

ia64 needed assembly change to have the new and compat versioned
symbol map to the same function.

All linux libm abilists are updated.

	* math/Versions (logf): New libm symbol at GLIBC_2.27.
	(log2f): Likewise.
	(powf): Likewise.
	* math/w_log2f.c: New file.
	* math/w_logf.c: New file.
	* math/w_powf.c: New file.
	* math/w_log2f_compat.c (__log2f_compat): For compat symbol only.
	* math/w_logf_compat.c (__logf_compat): Likewise.
	* math/w_powf_compat.c (__powf_compat): Likewise.
	* sysdeps/ia64/fpu/e_log2f.S: Add versioned symbols.
	* sysdeps/ia64/fpu/e_logf.S: Likewise.
	* sysdeps/ia64/fpu/e_powf.S: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2017-10-02 14:38:03 +01:00
Rajalakshmi Srinivasaraghavan 59ba2d2b54 powerpc: Optimize memrchr for power8
Vectorized loops are used for sizes greater than 32B to improve
performance over power7 optimization.  This shows as an average
of 25% improvement depending on the position of search
character.  The performance is same for shorter strings.
2017-10-02 17:31:13 +05:30
H.J. Lu 397286ea93 Hide internal fadvise64/fallocate64 functions [BZ #18822]
Hide internal fadvise64/fallocate64 functions to allow direct access
within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/posix_fadvise64.c
	(__posix_fadvise64_l64): Add Add libc_hidden_proto and
	libc_hidden_def.
	* sysdeps/unix/sysv/linux/posix_fallocate64.c
	(__posix_fallocate64_l64): Likewise.
2017-10-01 18:06:04 -07:00
H.J. Lu d0a4512bd4 Hide internal __sched_setaffinity_new function [BZ #18822]
Hide internal __sched_setaffinity_new function to allow direct access
within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/sched_setaffinity.c
	(__sched_setaffinity_new): Add libc_hidden_proto and
	libc_hidden_def.
2017-10-01 18:03:59 -07:00
H.J. Lu c0769f7031 Hide internal __glob64 function [BZ #18822]
Hide internal __glob64 function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/glob.h (__glob64): Add libc_hidden_proto.
	* sysdeps/unix/sysv/linux/glob64.c (__glob64): Add
	libc_hidden_def.
2017-10-01 18:02:10 -07:00
H.J. Lu 0e7d5b6e24 Hide internal __new_getrlimit function [BZ #18822]
Hide internal __new_getrlimit function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/getrlimit64.c (__new_getrlimit): Add
	attribute_hidden.
2017-10-01 18:00:07 -07:00
H.J. Lu bde06c87b7 Hide internal __new_exitfn function [BZ #18822]
Hide internal __new_exitfn function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* stdlib/exit.h (__new_exitfn): Add attribute_hidden.
2017-10-01 17:58:24 -07:00
H.J. Lu fa4265909e Hide internal __moncontrol function [BZ #18822]
Hide internal __moncontrol function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* mon/gmon.c (__moncontrol): Add libc_hidden_proto and
	libc_hidden_def.
2017-10-01 17:57:02 -07:00
H.J. Lu 2f8a05d826 Hide internal __libc_print_version function [BZ #18822]
Hide internal __libc_print_version function to allow direct access
within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* csu/version.c (__libc_print_version): Add attribute_hidden.
2017-10-01 17:55:30 -07:00
H.J. Lu 7bfd08ac5b Hide internal __init_misc function [BZ #18822]
Hide internal __init_misc function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/libc-internal.h (__init_misc): Add attribute_hidden.
2017-10-01 17:53:55 -07:00
H.J. Lu 0e1fd06cde Hide internal __setfpucw function [BZ #18822]
Hide internal __setfpucw function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/fpu_control.h (__setfpucw): Add attribute_hidden.
2017-10-01 17:52:15 -07:00
H.J. Lu 36e7ae1e9d Hide internal __nis_hash function [BZ #18822]
Hide internal __nis_hash function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* nscd/nscd_helper.c (__nis_hash): New prototype.
2017-10-01 17:49:59 -07:00
H.J. Lu 87078544f2 Hide internal __tcgetattr function [BZ #18822]
Hide internal __tcgetattr function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/termios.h (__tcgetattr): Add libc_hidden_proto.
	* sysdeps/unix/bsd/tcgetattr.c (__tcgetattr): Add
	libc_hidden_def.
	* sysdeps/unix/sysv/linux/tcgetattr.c (__tcgetattr): Likewise.
	* termios/tcgetattr.c (__tcgetattr): Likewise.
2017-10-01 17:48:24 -07:00
H.J. Lu dd3121df08 Hide internal __setrlimit function [BZ #18822]
Hide internal __setrlimit function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/sys/resource.h (__setrlimit): Add libc_hidden_proto.
	* resource/setrlimit.c (__setrlimit): Add libc_hidden_def.
	* sysdeps/mach/hurd/setrlimit.c (__setrlimit): Likewise.
	* sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Likewise.
	* sysdeps/unix/sysv/linux/setrlimit64.c (__GI___setrlimit): New.
2017-10-01 17:46:54 -07:00
H.J. Lu 047d1a81fd Hide internal __vstrfmon_l function [BZ #18822]
Hide internal __vstrfmon_l function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/monetary.h (__vstrfmon_l): Add attribute_hidden.
2017-10-01 17:45:07 -07:00
H.J. Lu fd331b1179 Hide internal __sched_setparam function [BZ #18822]
Hide internal __sched_setparam function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

__GI___sched_setparam is defined when sysdeps/unix/syscalls.list is
used to generate sched_setparam.  Otherwise libc_hidden_def is needed
explicitly.

	[BZ #18822]
	* include/sched.h (__sched_setparam): Add libc_hidden_proto.
	* posix/sched_setp.c (__sched_setparam): Add libc_hidden_def.
2017-10-01 17:43:25 -07:00
H.J. Lu 57f859bdb7 Hide internal __hash_string function [BZ #18822]
Hide internal __hash_string function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* intl/hash-string.h (__hash_string): Add attribute_hidden.
2017-10-01 17:41:34 -07:00
H.J. Lu d19033298f Hide internal __hasmntopt function [BZ #18822]
Hide internal __hasmntopt function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/mntent.h (__hasmntopt): Add libc_hidden_proto.
	* misc/mntent_r.c (__hasmntopt): Add libc_hidden_def.
2017-10-01 17:37:42 -07:00
H.J. Lu b4744101f3 Hide internal __ifreq function [BZ #18822]
Hide internal __ifreq function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/ifreq.h: New file.
	* sysdeps/generic/ifreq.h (__if_nextreq): Removed.
	(__ifreq): Likewise.
	* sysdeps/mach/hurd/ifreq.h (__if_nextreq): Removed.
	(__ifreq): Likewise.
2017-10-01 17:35:46 -07:00
H.J. Lu 43b7dfd1b6 Hide internal idna functions [BZ #18822]
Hide internal idna functions to allow direct access within libc.so and
libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/idna.h: New file.
	* inet/getnameinfo.c: Include <idna.h> instead of
	<libidn/idna.h>.
	(__idna_to_unicode_lzlz): Removed.
	* sysdeps/posix/getaddrinfo.c: Include <idna.h> instead of
	<libidn/idna.h>.
	(__idna_to_ascii_lz): Removed.
	(__idna_to_unicode_lzlz): Likewise.
2017-10-01 17:33:22 -07:00
H.J. Lu 2c0cd8f81f Hide internal __gettextparse function [BZ #18822]
Hide internal __gettextparse function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/plural-exp.h: New file.
	* intl/plural-exp.c: Include <plural-exp.h> instead of
	"plural-exp.h".
2017-10-01 17:31:05 -07:00
H.J. Lu 8369d216dc Hide internal __get_sol function [BZ #18822]
Hide internal __get_sol function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/getsourcefilter.c: Include
	"getsourcefilter.h".
	* sysdeps/unix/sysv/linux/getsourcefilter.h: New file.
	* sysdeps/unix/sysv/linux/setsourcefilter.c: Include
	"getsourcefilter.h".
	(__get_sol): Removed.
2017-10-01 16:12:24 -07:00
H.J. Lu a0aef7830e Move hidden_proto (__dl_iterate_phdr) to include/link.h [BZ #18822]
__dl_iterate_phdr is hidden and should be accessed directly within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* elf/dl-iteratephdr.c (hidden_proto (__dl_iterate_phdr)): Moved
	to ...
	* include/link.h (hidden_proto (__dl_iterate_phdr)): Here.
2017-10-01 16:09:38 -07:00
H.J. Lu 3ee8209be7 Hide internal __bsd_getpt function [BZ #18822]
Hide internal __bsd_getpt function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/getpt.c (__bsd_getpt): Add
	attribute_hidden.
2017-10-01 16:08:42 -07:00
H.J. Lu 6036fc38bf Hide internal __fopen_maybe_mmap function [BZ #18822]
Hide internal __fopen_maybe_mmap function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* libio/iolibio.h (__fopen_maybe_mmap): Add attribute_hidden.
2017-10-01 16:07:47 -07:00
H.J. Lu fe84fed048 Hide internal __tdestroy function [BZ #18822]
Hide internal __tdestroy function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/search.h (__tdestroy): Add libc_hidden_proto.
	* misc/tsearch.c (__tdestroy): Add libc_hidden_def.
2017-10-01 16:06:58 -07:00
H.J. Lu 048dd6813f Hide internal __assert_fail_base function [BZ #18822]
Hide internal __assert_fail_base function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/assert.h (__assert_fail_base): Add attribute_hidden.
2017-10-01 16:06:13 -07:00
H.J. Lu 6e342af6e7 Hide internal __sysinfo function [BZ #18822]
Hide internal __sysinfo function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h (__sysinfo): Add
	attribute_hidden.
2017-10-01 16:05:28 -07:00
H.J. Lu 6a088436d4 Hide internal signal functions [BZ #18822]
Hide internal signal functions to allow direct access within libc.so and
libc.a without using GOT nor PLT.

__GI___kill and __GI___sigaltstack are defined when syscalls.list is
used to generate them.  Otherwise libc_hidden_def is needed explicitly.

	[BZ #18822]
	* include/signal.h (__kill): Add libc_hidden_proto.
	(__sigblock): Likewise.
	(__sigprocmask): Likewise.
	(__sigaltstack): Likewise.
	* signal/kill.c (__kill): Add libc_hidden_def.
	* signal/sigblock.c (__sigblock): Likewise.
	* signal/sigprocmask.c (__sigprocmask): Likewise.
	* sysdeps/mach/hurd/kill.c (__kill): Likewise.
	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
	* sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise.
	* sysdeps/posix/sigblock.c (__sigblock): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
	(__sigprocmask): Likewise.
	* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask):
	Likewise.
	* /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
	(__sigprocmask): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask):
	Likewise.
2017-10-01 16:04:41 -07:00
H.J. Lu 78cf1d74d2 Hide internal __strsep function [BZ #18822]
Hide internal __strsep function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/string.h (__strsep): Add libc_hidden_proto.
	* string/strsep.c (__strsep): Add libc_hidden_def.
2017-10-01 16:03:41 -07:00
H.J. Lu 85b358949d Hide __posix_spawn_file_actions_realloc/__spawni [BZ #18822]
Hide internal __posix_spawn_file_actions_realloc and /__spawni functions
to allow direct access within libc.so and libc.a without using GOT nor
PLT.

	[BZ #18822]
	* posix/spawn_int.h (__posix_spawn_file_actions_realloc): Add
	attribute_hidden.
	(__spawni): Likewise.
2017-10-01 16:02:54 -07:00
H.J. Lu 225f7eec85 Hide internal __mremap function [BZ #18822]
Hide internal __mremap function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

__GI___mremap is defined when sysdeps/unix/syscalls.list is used to
generate mremap.  Otherwise libc_hidden_def is needed explicitly.

	[BZ #18822]
	* include/sys/mman.h (__mremap): Add libc_hidden_proto.
	* sysdeps/unix/sysv/linux/m68k/mremap.S (__mremap): Add
	libc_hidden_def.
2017-10-01 16:02:04 -07:00
H.J. Lu 372fe247b1 Hide internal __malloc_check_init function [BZ #18822]
Hide internal __malloc_check_init function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/malloc.h (__malloc_check_init): Add attribute_hidden.
2017-10-01 16:00:36 -07:00
H.J. Lu 9e5ee8b839 Hide internal __ioctl function [BZ #18822]
Hide internal __ioctl function to allow direct access within libc.so and
libc.a without using GOT nor PLT.

__GI___ioctl is defined when sysdeps/unix/syscalls.list is used to
generate ioctl.  Otherwise libc_hidden_def is needed explicitly.

	[BZ #18822]
	* include/sys/ioctl.h (__ioctl): Add libc_hidden_proto.
	* misc/ioctl.c (__ioctl): Add libc_hidden_def.
	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/ioctl.S (__ioctl): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S (__ioctl): Likewise.
2017-10-01 15:59:06 -07:00
H.J. Lu 2ff16592d8 Mark internal intl functions with attribute_hidden [BZ #18822]
Mark internal intl functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* intl/gettextP.h (__dcngettext): Add attribute_hidden.
	(__dcigettext): Likewise.
2017-10-01 15:58:20 -07:00
H.J. Lu b5648377d9 Hide internal sysinfo functions [BZ #18822]
Hide internal sysinfo functions to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/sys/sysinfo.h (__get_nprocs_conf): Add
	libc_hidden_proto.
	(__get_nprocs): Likewise.
	(__get_phys_pages): Likewise.
	(__get_avphys_pages): Likewise.
	(__get_child_max): Add attribute_hidden.
	* misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def.
	(__get_nprocs): Likewise.
	(__get_phys_pages): Likewise.
	(__get_avphys_pages): Likewise.
	* sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add
	libc_hidden_def.
	(__get_nprocs): Likewise.
	(__get_phys_pages): Likewise.
	(__get_avphys_pages): Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add
	libc_hidden_def.
	(__get_nprocs_conf): Likewise.
	(__get_phys_pages): Likewise.
	(__get_avphys_pages): Likewise.
2017-10-01 15:57:21 -07:00
H.J. Lu 0389a6aaae Mark internal netlink functions with attribute_hidden [BZ #18822]
Mark internal netlink functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_open): Add
	attribute_hidden.
	(__netlink_close): Likewise.
	(__netlink_free_handle): Likewise.
	(__netlink_request): Likewise.
2017-10-01 15:56:27 -07:00
H.J. Lu d48354d860 Mark internal rpc functions with attribute_hidden [BZ #18822]
Mark internal rpc functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/rpc/rpc.h (__rpc_thread_variables): Add
	attribute_hidden.
	(__rpc_thread_svc_cleanup): Likewise.
	(__rpc_thread_clnt_cleanup): Likewise.
	(__rpc_thread_key_cleanup): Likewise.
2017-10-01 15:55:15 -07:00
H.J. Lu d6daff1261 Hide __readv and __writev [BZ #18822]
Hide internal __readv and __writev functions to allow direct access
within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/sys/uio.h (__readv): Add libc_hidden_proto.
	(__writev): Likewise.
	* misc/readv.c (__readv): Add libc_hidden_def.
	* misc/writev.c (__writev): Likewise.
	* sysdeps/posix/readv.c (__readv): Likewise.
	* sysdeps/posix/writev.c (__writev): Likewise.
	* sysdeps/unix/sysv/linux/readv.c: Include <sys/uio.h>.
	(__readv): Likewise.
	* sysdeps/unix/sysv/linux/writev.c: Include <sys/uio.h>.
	(__writev): Likewise.
2017-10-01 15:54:10 -07:00
H.J. Lu b68f862056 Hide internal regex functions [BZ #18822]
Hide internal regex functions to allow direct access within libc.so and
libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/regex.h (__re_compile_fastmap): Add attribute_hidden.
	(__regcomp): Add libc_hidden_proto.
	(__regexec): Likewise.
	(__regfree): Likewise.
	* posix/regcomp.c (__regcomp): Add libc_hidden_def.
	(__regfree): Likewise.
	* posix/regexec.c (__regexec): Likewise.
2017-10-01 15:53:15 -07:00
H.J. Lu 59c04e6763 Mark internal utmp functions with attribute_hidden [BZ #18822]
Mark internal utmp functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/utmp.h (__updwtmp): Add libc_hidden_proto.
	(__getutent): Likewise.
	(__getutid): Likewise.
	(__getutline): Likewise.
	(__pututline): Likewise.
	(__getutent_r): Likewise.
	(__getutid_r): Likewise.
	(__getutline_r): Likewise.
	(__utmpname): Add attribute_hidden.
	(__setutent): Likewise.
	(__endutent): Likewise.
	* login/getutent.c (__getutent): Add libc_hidden_def.
	* login/getutent_r.c (__getutent_r): Likewise.
	(__pututline): Likewise.
	* login/getutid.c (__getutid): Likewise.
	* login/getutid_r.c (__getutid_r): Likewise.
	* login/getutline.c (__getutline): Likewise.
	* login/getutline_r.c (__getutline_r): Likewise.
	* login/updwtmp.c (__updwtmp): Likewise.
2017-10-01 15:51:56 -07:00
H.J. Lu 4587a421c5 Mark internal dirent functions with attribute_hidden [BZ #18822]
Mark internal dirent functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.  __readdir64
is hidden with libc_hidden_proto and libc_hidden_def since the exported
readdir64 is an alias of __readdir64.

	[BZ #18822]
	* include/dirent.h (__opendir): Always add attribute_hidden.
	(__fdopendir): Likewise.
	(__closedir): Likewise.
	(__readdir): Likewise.
	(__readdir64): Add libc_hidden_proto.
	* sysdeps/mach/hurd/readdir64.c (__readdir64): Add libc_hidden_def.
	* sysdeps/unix/sysv/linux/i386/readdir64.c (__readdir64): Likewise.
	* sysdeps/unix/sysv/linux/readdir64.c (__readdir64): Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/readdir.c (__GI___readdir64):
	New alias.
2017-10-01 15:51:11 -07:00
H.J. Lu 9635ce6962 Mark internal getXXXbyYYY functions with attribute_hidden [BZ #18822]
Mark internal getXXXbyYYY functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/aliases.h (__getaliasbyname_r): Add attribute_hidden.
	* include/netdb.h (__gethostbyaddr_r): Likewise.
	(__gethostbyname_r): Likewise.
	(__gethostbyname2_r): Likewise.
	(__getnetbyaddr_r): Likewise.
	(__getnetbyname_r): Likewise.
	(__getservbyname_r): Likewise.
	(__getservbyport_r): Likewise.
	(__getprotobyname_r): Likewise.
	(__getprotobynumber_r): Likewise.
	(__getnetgrent_r): Likewise.
	* include/rpc/netdb.h (__getrpcbyname_r): Likewise.
	(__getrpcbynumber_r): Likewise.
	* nss/getXXbyYY.c (INTERNAL (REENTRANT_NAME)): Likewise.
2017-10-01 15:21:00 -07:00
H.J. Lu 2e0a69097d Mark internal stdio functions with attribute_hidden [BZ #18822]
Mark internal stdio functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/stdio.h (__fcloseall): Add attribute_hidden.
	(__getline): Likewise.
	(__path_search): Likewise.
	(__gen_tempname): Likewise.
	(__libc_message): Likewise.
	(__flockfile): Likewise.
	(__funlockfile): Likewise.
	(__fxprintf): Likewise.
	(__fxprintf_nocancel): Likewise.
2017-10-01 15:20:13 -07:00
H.J. Lu 94fd682c9b Mark internal gshadow functions with attribute_hidden [BZ #18822]
Mark internal gshadow functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/gshadow.h (__fgetsgent_r): Add attribute_hidden.
	(__sgetsgent_r): Likewise.
2017-10-01 15:19:17 -07:00
H.J. Lu e1b33bba7c Mark internal statfs functions with attribute_hidden [BZ #18822]
Mark internal statfs functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/sys/statfs.h (__fstatfs): Add attribute_hidden.
	(__statfs64): Likewise.
	(__fstatfs64): Likewise.
	* include/sys/statvfs.h (__statvfs64): Likewise.
	(__fstatvfs64): Likewise.
	* sysdeps/unix/sysv/linux/pathconf.h (__statfs_link_max): Likewise.
	(__statfs_filesize_max): Likewise.
	(__statfs_symlinks): Likewise.
	(__statfs_chown_restricted): Likewise.
2017-10-01 15:18:25 -07:00
H.J. Lu b0f5678494 Mark internal time functions with attribute_hidden [BZ #18822]
Mark internal time functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/time.h (__tzstring): Add attribute_hidden.
	(__tzfile_read): Likewise.
	(__tzfile_compute): Likewise.
	(__tzfile_default): Likewise.
	(__tzset_parse_tz): Likewise.
	(__offtime): Likewise.
	(__asctime_r): Likewise.
	(__tzset): Likewise.
	(__tz_convert): Likewise.
	(__getdate_r): Likewise.
	(__getclktck): Likewise.
2017-10-01 15:17:32 -07:00
H.J. Lu a4338d994f Mark internal nscd functions with attribute_hidden [BZ #18822]
Mark internal nscd functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* nscd/nscd-client.h (__nscd_get_map_ref): Add attribute_hidden.
	(__nscd_unmap): Likewise.
	(__nscd_cache_search): Likewise.
	(__nscd_get_nl_timestamp): Likewise.
	(__nscd_getpwnam_r): Likewise.
	(__nscd_getpwuid_r): Likewise.
	(__nscd_getgrnam_r): Likewise.
	(__nscd_getgrgid_r): Likewise.
	(__nscd_gethostbyname_r): Likewise.
	(__nscd_gethostbyname2_r): Likewise.
	(__nscd_gethostbyaddr_r): Likewise.
	(__nscd_getai): Likewise.
	(__nscd_getgrouplist): Likewise.
	(__nscd_getservbyname_r): Likewise.
	(__nscd_getservbyport_r): Likewise.
	(__nscd_innetgr): Likewise.
	(__nscd_setnetgrent): Likewise.
2017-10-01 15:16:27 -07:00
H.J. Lu a2ca165230 Mark internal gmp functions with attribute_hidden [BZ #18822]
Mark internal gmp functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/gmp.h: Declare internal functions only if _ISOMAC is
	undefined.
	(__mpn_extract_double): Add attribute_hidden.
	(__mpn_extract_long_double): Likewise.
	(__mpn_extract_float128): Likewise.
	(__mpn_construct_float): Likewise.
	(__mpn_construct_double): Likewise.
	(__mpn_construct_long_double): Likewise.
	(__mpn_construct_float128): Likewise.
	(mpn_add_1): Likewise.
	(mpn_addmul_1): Likewise.
	(mpn_add_n): Likewise.
	(mpn_cmp): Likewise.
	(mpn_divrem): Likewise.
	(mpn_lshift): Likewise.
	(mpn_mul): Likewise.
	(mpn_mul_1): Likewise.
	(mpn_rshift): Likewise.
	(mpn_sub_1): Likewise.
	(mpn_submul_1): Likewise.
	(mpn_sub_n): Likewise.
2017-10-01 15:15:30 -07:00
H.J. Lu 44af8a32c3 Mark internal wchar functions with attribute_hidden [BZ #18822]
Mark internal wchar functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/wchar.h (__wcsnlen): Add attribute_hidden.
	(__wcscat): Likewise.
	(__btowc): Likewise.
	(__wcrtomb): Likewise.
	(__mbsrtowcs): Likewise.
	(__wcsrtombs): Likewise.
	(__mbsnrtowcs): Likewise.
	(__wcsnrtombs): Likewise.
	(__wcsncpy): Likewise.
	(__wcpncpy): Likewise.
	(__wmemcpy): Likewise.
	(__wmempcpy): Likewise.
	(__wmemmove): Likewise.
	(__wcschrnul): Likewise.
	(__vfwscanf): Likewise.
	(__vswprintf): Likewise.
	(__fwprintf): Likewise.
	(__vfwprintf): Likewise.
2017-10-01 15:14:33 -07:00
H.J. Lu 783cd767af Mark internal grp/pwd/shadow functions with attribute_hidden [BZ #18822]
Mark internal grp/pwd/shadow functions with attribute_hidden to allow
direct access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/grp.h (__fgetgrent_r): Add attribute_hidden.
	(__getgrgid_r): Likewise.
	(__getgrnam_r): Likewise.
	* include/pwd.h (__getpwuid_r): Likewise.
	(__getpwnam_r): Likewise.
	(__fgetpwent_r): Likewise.
	* include/shadow.h (__getspnam_r): Likewise.
	(__sgetspent_r): Likewise.
	(__fgetspent_r): Likewise.
2017-10-01 15:13:13 -07:00
H.J. Lu 7ec4b39ac4 Mark internal unistd functions with attribute_hidden [BZ #18822]
Mark internal unistd functions with attribute_hidden to allow direct
access to them within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/unistd.h (__access): Add attribute_hidden.
	(__lseek64): Likewise.
	(__libc_pread64): Likewise.
	(__pipe2): Likewise.
	(__sleep): Likewise.
	(__chdir): Likewise.
	(__fchdir): Likewise.
	(__getcwd): Likewise.
	(__rmdir): Likewise.
	(__execvpe): Likewise.
	(__execve): Likewise.
	(__setsid): Likewise.
	(__getuid): Likewise.
	(__geteuid): Likewise.
	(__getgid): Likewise.
	(__getegid): Likewise.
	(__getgroups): Likewise.
	(__group_member): Likewise.
	(__ttyname_r): Likewise.
	(__isatty): Likewise.
	(__readlink): Likewise.
	(__unlink): Likewise.
	(__gethostname): Likewise.
	(__profil): Likewise.
	(__getdtablesize): Likewise.
	(__brk): Likewise.
	(__ftruncate): Likewise.
	(__ftruncate64): Likewise.
2017-10-01 15:12:04 -07:00
H.J. Lu 8345a76018 Mark internal argp functions with attribute_hidden [BZ #18822]
Mark internal argp functions with attribute_hidden to allow direct
access to them within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* argp/argp-fmtstream.c: Include <argp-fmtstream.h>.
	* argp/argp-fs-xinl.c: Likewise.
	* argp/argp-help.c: Include <argp.h> and <argp-fmtstream.h>.
	* argp/argp-parse.c: Include <argp.h>.
	* argp/argp-xinl.c: Likewise.
	* include/argp-fmtstream.h: New file.
	* include/argp.h (__argp_error): Add attribute_hidden.
	(__argp_failure): Likewise.
	(__argp_input): Likewise.
	(__argp_state_help): Likewise.
2017-10-01 15:10:27 -07:00
H.J. Lu c26dd7c600 Mark ____wcsto*_l_internal functions with attribute_hidden [BZ #18822]
Mark ____wcsto*_l_internal functions with attribute_hidden to allow
direct access to them within libc.so and libc.a without using GOT nor
PLT.

	[BZ #18822]
	* include/wchar.h (____wcstof_l_internal): New prototype.
	(____wcstod_l_internal): Likewise.
	(____wcstold_l_internal): Likewise.
	(____wcstol_l_internal): Likewise.
	(____wcstoul_l_internal): Likewise.
	(____wcstoll_l_internal): Likewise.
	(____wcstoull_l_internal): Likewise.
	(____wcstof128_l_internal): Likewise.
	* sysdeps/ieee754/float128/wcstof128.c
	(____wcstof128_l_internal): Removed.
	* sysdeps/ieee754/float128/wcstof128_l.c
	(____wcstof128_l_internal): Likewise.
	* wcsmbs/wcstod.c (____wcstod_l_internal): Likewise.
	* wcsmbs/wcstod_l.c (____wcstod_l_internal): Likewise.
	* wcsmbs/wcstof.c (____wcstof_l_internal): Likewise.
	* wcsmbs/wcstof_l.c (____wcstof_l_internal): Likewise.
	* wcsmbs/wcstol_l.c (____wcstol_l_internal): Likewise.
	* wcsmbs/wcstold.c (____wcstold_l_internal): Likewise.
	* wcsmbs/wcstold_l.c (____wcstold_l_internal): Likewise.
	* wcsmbs/wcstoll_l.c (____wcstoll_l_internal): Likewise.
	* wcsmbs/wcstoul_l.c (____wcstoul_l_internal): Likewise.
	* wcsmbs/wcstoull_l.c (____wcstoull_l_internal): Likewise.
2017-10-01 15:09:28 -07:00
H.J. Lu 3aff56444e Mark __internal_statvfs[64] with attribute_hidden [BZ #18822]
Mark __internal_statvfs[64] with attribute_hidden to allow direct access
to them within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/fstatvfs.c: Include "internal_statvfs.h"
	instead of <sys/statvfs.h>.
	(__internal_statvfs): Removed.
	* sysdeps/unix/sysv/linux/fstatvfs64.c Include "internal_statvfs.h"
	instead of <sys/statvfs.h>.
	(__internal_statvfs64): Removed.
	* sysdeps/unix/sysv/linux/internal_statvfs.c: Include
	"internal_statvfs.h" instead of <sys/statvfs.h>.
	* sysdeps/unix/sysv/linux/internal_statvfs.h: New file.
	* sysdeps/unix/sysv/linux/statvfs.c Include "internal_statvfs.h"
	instead of <sys/statvfs.h>.
	(__internal_statvfs): Removed.
	* sysdeps/unix/sysv/linux/statvfs64.c Include "internal_statvfs.h"
	instead of <sys/statvfs.h>.
	(__internal_statvfs64): Removed.
2017-10-01 15:08:32 -07:00
H.J. Lu 8bcdb7e0c5 Mark internal functions with attribute_hidden [BZ #18822]
Mark internal functions with attribute_hidden to allow direct access to
internal functions within libc.so and libc.a without using GOT nor PLT.

Size comparison of libc.so:

On x86-64:
        text	   data	    bss	    dec	    hex
Before: 1728577	  20584	  17088	1766249	 1af369
After : 1728593	  20584	  17088	1766265	 1af379

The only change is __gconv_release_shlib in iconv/gconv_dl.c is inlined
since it is hidden, which increases the code size of gconv_dl.os by 18
bytes.

On i686:
        text	   data	    bss	    dec	    hex
Before: 1869039	  11444	  11112	1891595	 1cdd0b
After : 1868635	  11444	  11112	1891191	 1cdb77

The code size is decreased by avoiding GOT/PLT for hidden functions.

	[BZ #18822]
	* iconv/gconv_int.h (__gconv_open): Add attribute_hidden.
	(__gconv_close): Likewise.
	(__gconv): Likewise.
	(__gconv_find_transform): Likewise.
	(__gconv_lookup_cache): Likewise.
	(__gconv_compare_alias_cache): Likewise.
	(__gconv_load_cache): Likewise.
	(__gconv_get_path): Likewise.
	(__gconv_close_transform): Likewise.
	(__gconv_release_cache): Likewise.
	(__gconv_find_shlib): Likewise.
	(__gconv_release_shlib): Likewise.
	(__gconv_get_builtin_trans): Likewise.
	(__gconv_compare_alias): Likewise.
	* include/dlfcn.h (_dlerror_run): Likewise.
	* include/stdio.h (__fortify_fail_abort): Likewise.
	* include/time.h (__tz_compute): Likewise.
	(__strptime_internal): Likewise.
	* intl/gettextP.h (_nl_find_domain): Likewise.
	(_nl_load_domain): Likewise.
	(_nl_find_msg): Likewise.
	* intl/plural-exp.h (FREE_EXPRESSION): Likewise.
	(EXTRACT_PLURAL_EXPRESSION): Likewise.
	* locale/coll-lookup.h (__collidx_table_lookup): Likewise.
	* resolv/gai_misc.h (__gai_enqueue_request): Likewise.
	(__gai_find_request): Likewise.
	(__gai_remove_request): Likewise.
	(__gai_notify): Likewise.
	(__gai_notify_only): Likewise.
	* sysdeps/generic/aio_misc.h (__aio_sigqueue): Likewise.
	* sysdeps/generic/ldsodefs.h (_dl_fini): Likewise.
	(_dl_non_dynamic_init): Likewise.
	(_dl_aux_init): Likewise.
	* sysdeps/i386/machine-gmon.h (mcount_internal): Likewise.
	* sysdeps/unix/sysv/linux/i386/olddirent.h (__old_getdents64):
	Likewise.
	* wcsmbs/wcsmbsload.h (__wcsmbs_load_conv): Likewise.
	(__wcsmbs_clone_conv): Likewise.
	(__wcsmbs_named_conv): Likewise.
2017-10-01 15:07:23 -07:00
H.J. Lu 8ed3b64330 Mark internal stdlib functions with attribute_hidden [BZ #18822]
Mark internal stdlib functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.  __realpath
is hidden with libc_hidden_proto and libc_hidden_def since the exported
realpath is an alias of __realpath.

	[BZ #18822]
	* include/stdlib.h (__random): Add attribute_hidden.
	(__random_r): Likewise.
	(__srandom_r): Likewise.
	(__initstate_r): Likewise.
	(__setstate_r): Likewise.
	(__erand48_r): Likewise.
	(__nrand48_r): Likewise.
	(__jrand48_r): Likewise.
	(__srand48_r): Likewise.
	(__seed48_r): Likewise.
	(__lcong48_r): Likewise.
	(__drand48_iterate): Likewise.
	(__setenv): Likewise.
	(__unsetenv): Likewise.
	(__clearenv): Likewise.
	(__ptsname_r): Likewise.
	(__posix_openpt): Likewise.
	(__add_to_environ): Likewise.
	(__realpath): Add libc_hidden_proto.
	(__ecvt_r): Likewise.
	(__fcvt_r): Likewise.
	(__qecvt_r): Likewise.
	(__qfcvt_r): Likewise.
	* misc/efgcvt_r.c (cvt_symbol_1): Add libc_hidden_def (local).
	* stdlib/canonicalize.c (__realpath): Add libc_hidden_def.
2017-10-01 14:34:54 -07:00
H.J. Lu ef9b6f73f4 Mark 3 *_internal functions with attribute_hidden [BZ #18822]
Mark __ptsname_internal, __mktime_internal and __fopen_internal with
attribute_hidden to allow direct access to them within libc.so and
libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/stdlib.h (__ptsname_internal): Add attribute_hidden.
	* include/time.h (__mktime_internal): Likewise.
	* libio/iolibio.h (__fopen_internal): Likewise.
2017-10-01 14:34:40 -07:00
John David Anglin 8da92e722c Fix return pointer save and PIC register restore in __getcontext and
__setcontext on hppa.

	* sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Save return
	pointer in frame.
	* sysdeps/unix/sysv/linux/hppa/setcontext.S (__setcontext): Likewise.
	Correct offset used to restore PIC register.
2017-10-01 11:58:04 -04:00
John David Anglin 388784cfdd Fix hppa text relocations in libc.so
[BZ libc/22165]
	* sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Use PIC
	code to load address of __getcontext_ret when generating PIC code.
2017-09-30 19:02:57 -04:00
H.J. Lu 2000067a4b Add a test for non-PIE static executable
tst-tls1-static-non-pie is built with $(no-pie-ldflag) to make it a
non-PIE static executable, regardless if --enable-static-pie is used
to configure glibc.

	* elf/Makefile (tests-static-internal): Add
	tst-tls1-static-non-pie.
	(LDFLAGS-tst-tls1-static-non-pie): New.
	* elf/tst-tls1-static-non-pie.c: New file.
2017-09-30 01:39:32 -07:00
Joseph Myers 1e2bffd05c Use libm_alias_double for some dbl-64 functions.
Continuing the move of libm aliases to common macros that can create
_FloatN / _FloatNx aliases in future, this patch converts some dbl-64
functions to using libm_alias_double, thereby eliminating the need for
some ldbl-opt wrappers.

This patch deliberately limits what functions are converted so that it
can be verified by comparison of stipped binaries.  Specifically, atan
and tan are excluded because they first need converting to being weak
aliases; fma is omitted as it has additional complications with
versions in other directories (removing the ldbl-opt version can
e.g. cause the ldbl-128 version to be used instead of dbl-64); and
functions that have both dbl-64/wordsize-64 and ldbl-opt versions are
excluded because ldbl-opt currently always wraps dbl-64 function
versions, so changing those will result in platforms using both
ldbl-opt and dbl-64/wordsize-64 (i.e. alpha) starting to use the
dbl-64/wordsize-64 versions of those functions (which is good, as an
optimization, but still best separated from the present patch to get
better validation).

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

	* sysdeps/ieee754/dbl-64/s_asinh.c: Include <libm-alias-double.h>.
	(asinh): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_cbrt.c: Include <libm-alias-double.h>.
	(cbrt): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_copysign.c: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_erf.c: Include <libm-alias-double.h>.
	(erf): Define using libm_alias_double.
	(erfc): Likewise.
	* sysdeps/ieee754/dbl-64/s_expm1.c: Include <libm-alias-double.h>.
	(expm1): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_fabs.c: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_fromfp.c (fromfp): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_fromfp_main.c: Include
	<libm-alias-double.h>.
	* sysdeps/ieee754/dbl-64/s_fromfpx.c (fromfpx): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_getpayload.c: Include
	<libm-alias-double.h>.
	(getpayload): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_nextup.c: Include
	<libm-alias-double.h>.
	(nextup): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_roundeven.c: Include
	<libm-alias-double.h>.
	(roundeven): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_setpayload.c (setpayload): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_setpayload_main.c: Include
	<libm-alias-double.h>.
	* sysdeps/ieee754/dbl-64/s_setpayloadsig.c (setpayloadsig): Define
	using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_sin.c: Include <libm-alias-double.h>.
	(cos): Define using libm_alias_double.
	(sin): Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c: Include
	<libm-alias-double.h>.
	(sincos): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_tanh.c: Include <libm-alias-double.h>.
	(tanh): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_totalorder.c: Include
	<libm-alias-double.h>.
	(totalorder): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_totalordermag.c: Include
	<libm-alias-double.h>.
	(totalordermag): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_ufromfp.c (ufromfp): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/s_ufromfpx.c (ufromfpx): Define using
	libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c: Include
	<libm-alias-double.h>.
	(getpayload): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Include
	<libm-alias-double.h>.
	(roundeven): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c: Include
	<libm-alias-double.h>.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include
	<libm-alias-double.h>.
	(totalorder): Define using libm_alias_double.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include
	<libm-alias-double.h>.
	(totalordermag): Define using libm_alias_double.
	* sysdeps/ieee754/ldbl-opt/s_copysign.c (copysignl): Only define
	libc compat symbol here.
	* sysdeps/ieee754/ldbl-opt/s_asinh.c: Remove file.
	* sysdeps/ieee754/ldbl-opt/s_cbrt.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_erf.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_expm1.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_fabs.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_llrint.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_lrint.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_sin.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_sincos.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_tanh.c: Likewise.
2017-09-29 23:54:33 +00:00
H.J. Lu 8172aad937 arm: Update elf_machine_load_address for static PIE
When --enable-static-pie is used to configure glibc, we need to use
_dl_relocate_static_pie to compute load address in static PIE.

	* sysdeps/arm/dl-machine.h (elf_machine_load_address): Use
	_dl_relocate_static_pie instead of _dl_start to compute load
	address in static PIE.  Return 0 if _DYNAMIC is undefined for
	static executable.
2017-09-29 16:23:33 -07:00
H.J. Lu 54464e749d mips: Update elf_machine_load_address for static PIE
mips uses a local label to compute load address, which works with static
PIE.  We just need to return 0 if _DYNAMIC is undefined for static
executable.

	* sysdeps/mips/dl-machine.h (elf_machine_dynamic): Return 0 if
	_DYNAMIC is undefined for static executable.
2017-09-29 16:22:00 -07:00
H.J. Lu f6c5e5bce0 arm: Check PIC instead of SHARED in start.S
Since start.o may be compiled as PIC, we should check PIC instead of
SHARED.

	* sysdeps/arm/start.S (_start): Check PIC instead of SHARED.
2017-09-29 16:20:39 -07:00
Joseph Myers 2f92505d20 Update x86_64 libm-test-ulps.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.
2017-09-29 18:03:48 +00:00
Wilco Dijkstra bd8d53bb33 Use fabs(f/l) rather than __fabs
A few math functions still use __fabs(f/l) rather than fabs, which
means they won't be inlined. Rename them so they are inlined.
Also add -fno-builtin-fabsl to nofpu powerpc makefile to work around
BZ #29253.

	* sysdeps/ieee754/dbl-64/e_lgamma_r.c
	(__ieee754_lgamma_r): Use fabs rather than __fabs.
	* sysdeps/ieee754/dbl-64/e_log10.c (__ieee754_log10): Likewise.
	* sysdeps/ieee754/dbl-64/e_log2.c (__ieee754_log2): Likewise.
	* sysdeps/ieee754/flt-32/e_lgammaf_r.c
	(__ieee754_lgammaf_r): Use fabsf rather than __fabsf.
	* sysdeps/ieee754/flt-32/e_log10f.c (__ieee754_log10f): Likewise.
	* sysdeps/ieee754/flt-32/e_log2f.c (__ieee754_log2f): Likewise.
	* sysdeps/ieee754/ldbl-128/e_lgammal_r.c
	(__ieee754_lgammal_r): Use fabsl rather than __fabsl.
	* sysdeps/ieee754/ldbl-128/e_log10l.c (__ieee754_log10l): Likewise.
	* sysdeps/ieee754/ldbl-128/e_log2l.c (__ieee754_log2l): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
	(__ieee754_lgammal_r): Use fabsl rather than __fabsl.
	* sysdeps/ieee754/ldbl-128ibm/e_log10l.c (__ieee754_log10l): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_log2l.c (__ieee754_log2l): Likewise.
	* sysdeps/powerpc/nofpu/Makefile: Add -fno-builtin-fabsl for BZ #29253.
2017-09-29 18:54:24 +01:00
Wilco Dijkstra fffb150735 Remove old cimag inlines
Remove old cimag inlines that are only used in GCC 2.96 or older.

	* math/bits/cmathcalls.h (cimag): Remove inline.
	(creal): Remove inline.
	(conj): Remove inline.
2017-09-29 17:53:57 +01:00
Szabolcs Nagy 4ea49f4c08 New generic powf
without wrapper on aarch64:
powf reciprocal-throughput: 4.2x faster
powf latency: 2.6x faster
old worst-case error: 1.11 ulp
new worst-case error: 0.82 ulp
aarch64 .text size: -780 bytes
aarch64 .rodata size: +144 bytes

powf(x,y) is implemented as exp2(y*log2(x)) with the same algorithms
that are used in exp2f and log2f, except that the log2f polynomial is
larger for extra precision and its output (and exp2f input) may be
scaled by a power of 2 (POWF_SCALE) to simplify the argument reduction
step of exp2 (possible when efficient round and convert toint operation
is available).

The special case handling tries to minimize the checks in the hot path.
When the input of exp2_inline is checked, int arithmetics is used as
that was faster on the tested aarch64 cores.

	* math/Makefile (type-float-routines): Add e_powf_log2_data.
	* sysdeps/ieee754/flt-32/e_powf.c: New implementation.
	* sysdeps/ieee754/flt-32/e_powf_log2_data.c: New file.
	* sysdeps/ieee754/flt-32/math_config.h (__powf_log2_data): Define.
	(issignalingf_inline): Likewise.
	(POWF_LOG2_TABLE_BITS): Likewise.
	(POWF_LOG2_POLY_ORDER): Likewise.
	(POWF_SCALE_BITS): Likewise.
	(POWF_SCALE): Likewise.
	* sysdeps/i386/fpu/e_powf_log2_data.c: New file.
	* sysdeps/ia64/fpu/e_powf_log2_data.c: New file.
	* sysdeps/m68k/m680x0/fpu/e_powf_log2_data.c: New file.
2017-09-29 17:30:53 +01:00
Szabolcs Nagy 875c76c704 New generic log2f
Similar to the new logf: double precision arithmetics and a small
lookup table is used. The argument reduction step is the same as in
the new logf.

without wrapper on aarch64:
log2f reciprocal-throughput: 2.3x faster
log2f latency: 2.1x faster
old worst case error: 1.72 ulp
new worst case error: 0.75 ulp
aarch64 .text size: -252 bytes
aarch64 .rodata size: +244 bytes

	* math/Makefile (type-float-routines): Add e_log2f_data.
	* sysdeps/ieee754/flt-32/e_log2f.c: New implementation.
	* sysdeps/ieee754/flt-32/e_log2f_data.c: New file.
	* sysdeps/ieee754/flt-32/math_config.h (__log2f_data): Define.
	(LOG2F_TABLE_BITS, LOG2F_POLY_ORDER): Define.
	* sysdeps/i386/fpu/e_log2f_data.c: New file.
	* sysdeps/ia64/fpu/e_log2f_data.c: New file.
	* sysdeps/m68k/m680x0/fpu/e_log2f_data.c: New file.
2017-09-29 17:17:41 +01:00
Szabolcs Nagy 90c42e40d0 missed ChangeLog entry 2017-09-29 11:48:40 +01:00
H.J. Lu 4088d8dd29 x86: Allow undefined _DYNAMIC in static executable
When --enable-static-pie is used to build static PIE, _DYNAMIC is used
to compute the load address of static PIE.  But _DYNAMIC is undefined
when creating static executable.  This patch makes _DYNAMIC weak in PIE
libc.a so that it can be undefined.

	* sysdeps/i386/dl-machine.h (elf_machine_load_address): Allow
	undefined _DYNAMIC in PIE libc.a.
	* sysdeps/x86_64/dl-machine.h (elf_machine_load_address):
	Likewse.
2017-09-28 15:28:12 -07:00
Wilco Dijkstra 4d3693ec1c Remove ancient __signbit inlines
Remove __signbit inlines from mathinline.h.  Math.h already uses
the builtin when supported, so additional inlines are only used
on pre 4.0 GCCs.  Similarly remove ancient copysign and fabs
inlines.

	* sysdeps/alpha/fpu/bits/mathinline.h: Delete file.
	* sysdeps/ia64/fpu/bits/mathinline.h: Delete file.
	* sysdeps/m68k/coldfire/fpu/bits/mathinline.h: Delete file.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h: (__signbitf): Remove.
	(__signbit): Remove.
	(__signbitl): Remove.
	* sysdeps/powerpc/bits/mathinline.h (__signbitf): Remove.
	(__signbit): Remove.
	(__signbitl): Remove.
	* sysdeps/s390/fpu/bits/mathinline.h: (__signbitf): Remove.
	(__signbit): Remove.
	(__signbitl): Remove
	* sysdeps/sparc/fpu/bits/mathinline.h (__signbitf): Remove.
	(__signbit): Remove.
	(__signbitl): Remove.
	* sysdeps/tile/bits/mathinline.h: Delete file.
	* sysdeps/x86/fpu/bits/mathinline.h (__signbitf): Remove.
	(__signbit): Remove.
	(__signbitl): Remove.
2017-09-28 19:52:13 +01:00
Wilco Dijkstra 1e6d07234f Simplify C99 isgreater macros
Simplify the C99 isgreater macros.  Although some support was added
in GCC 2.97, not all targets added support until GCC 3.1.  Therefore
only use the builtins in math.h from GCC 3.1 onwards, and defer to
generic macros otherwise.  Improve the generic isunordered macro
to use compares rather than call fpclassify twice - this is not only
faster but also correct for signaling NaNs.

	* math/math.h: Improve handling of C99 isgreater macros.
	* sysdeps/alpha/fpu/bits/mathinline.h: Remove isgreater macros.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h: Likewise.
	* sysdeps/powerpc/bits/mathinline.h: Likewise.
	* sysdeps/sparc/fpu/bits/mathinline.h: Likewise.
	* sysdeps/x86/fpu/bits/mathinline.h: Likewise.
2017-09-28 19:43:54 +01:00
Szabolcs Nagy b2f03cf3a4 AArch64: update libm-test-ulps
Update for new expf and logf.

	* sysdeps/aarch64/libm-test-ulps: Update.
2017-09-28 15:28:46 +01:00
Joseph Myers f124cb3811 Fix nearbyint arithmetic moved before feholdexcept (bug 22225).
In <https://sourceware.org/ml/libc-alpha/2013-05/msg00722.html> I
remarked on the possibility of arithmetic in various nearbyint
implementations being scheduled before feholdexcept calls, resulting
in spurious "inexact" exceptions.

I'm now actually observing this occurring in glibc built for ARM with
GCC 7 (in fact, both copies of the same addition/subtraction sequence
being combined and moved out before the conditionals and
feholdexcept/fesetenv pairs), resulting in test failures.

This patch makes the nearbyint implementations with this particular
feholdexcept / arithmetic / fesetenv pattern consistently use
math_opt_barrier on the function argument when first used in
arithmetic, and also consistently use math_force_eval before fesetenv
(the latter was generally already done, but the dbl-64/wordsize-64
implementation used math_opt_barrier instead, and as
math_opt_barrier's intended effect is through its output value being
used, such a use that doesn't use the return value is suspect).

Tested for x86_64 (--disable-multi-arch so more of these
implementations get used), and for ARM in a configuration where I saw
the problem scheduling.

	[BZ #22225]
	* sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use
	math_opt_barrier on argument when doing arithmetic on it.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c (__nearbyint):
	Likewise.  Use math_force_eval not math_opt_barrier after
	arithmetic.
	* sysdeps/ieee754/flt-32/s_nearbyintf.c (__nearbyintf): Use
	math_opt_barrier on argument when doing arithmetic on it.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl):
	Likewise.
2017-09-28 01:59:02 +00:00
H.J. Lu 7edd06916d Update sysdeps/unix/sysv/linux/ifaddrs.c
Fix

../sysdeps/unix/sysv/linux/ifaddrs.c:835:27: error: ‘getifaddrs’ aliased to undefined symbol ‘__getifaddrs’
 weak_alias (__getifaddrs, getifaddrs)
                           ^
../sysdeps/unix/sysv/linux/ifaddrs.c:844:28: error: ‘freeifaddrs’ aliased to undefined symbol ‘__freeifaddrs’
 weak_alias (__freeifaddrs, freeifaddrs)

caused by

commit 4009ddc692
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Thu Sep 28 00:19:18 2017 +0200

    hurd: Fix `getifaddrs' and `freeifaddrs' symbol exposition

	* sysdeps/unix/sysv/linux/ifaddrs.c (__getifaddrs): Add
	libc_hidden_def.
	(__freeifaddrs): Likewise.
2017-09-27 17:18:32 -07:00
Samuel Thibault 4009ddc692 hurd: Fix `getifaddrs' and `freeifaddrs' symbol exposition
from `freeaddrinfo'.

`getifaddrs' and `freeifaddrs' are not in POSIX, they should not be
exposed along `freeaddrinfo' (through `__check_pf') which is POSIX.

	* include/ifaddrs.h (__getifaddrs, __freeifaddrs): New declarations,
	and use libc_hidden_def on them.
	* inet/ifaddrs.c (__getifaddrs, __freeifaddrs): Use libc_hidden_def on
	them.
	* sysdeps/gnu/ifaddrs.c (__getifaddrs, __freeifaddrs): Likewise.
	* inet/check_pf.c (__check_pf): Use __getifaddrs and __freeifaddrs
	instead of getifaddrs and freeifaddrs.
2017-09-28 01:05:18 +02:00
Samuel Thibault 64a4af28a6 hurd: Fix `seekdir' symbol exposition from `rewinddir'
`seekdir' is MISC || XOPEN, it should not be exposed along `rewinddir' which
is POSIX.

	* include/dirent.h (__seekdir): New declaration.
	* sysdeps/mach/hurd/seekdir.c (seekdir): Rename to __seekdir and
	redefine as weak alias.
	* sysdeps/mach/hurd/rewinddir.c (__rewinddir): Use __seekdir instead
	of seekdir.
2017-09-28 00:49:59 +02:00
Samuel Thibault 52a1f1814e hurd: Fix `revoke' symbol exposition from `unlockpt'
`revoke' is MISC only, it should not be exposed along `unlockpt' which is
XOPEN.

	* include/unistd.h (__revoke): New declaration.
	* misc/revoke.c (revoke): Rename to __revoke, and redefine as weak
	alias.
	* sysdeps/mach/hurd/revoke.c (revoke): Likewise.
	* sysdeps/unix/bsd/unlockpt.c (unlockpt): Use __revoke instead of
	revoke.
2017-09-28 00:49:05 +02:00
Samuel Thibault 2c7bbfaf4e hurd: Fix dirfd symbol exposition from ftw
dirfd is XOPEN2K8 only, it should not be exposed along ftw which is earlier.

	* include/dirent.h (__dirfd): New declaration.
	* dirent/dirfd.c (dirfd): Rename to __dirfd, and redefine as weak
	alias.
	* sysdeps/posix/dirfd/dirfd.c (dirfd): Likewise.
	* sysdeps/mach/hurd/dirfd.c (dirfd): Likewise.
	* io/ftw.c (open_dir_stream, ftw_dir): Use __dirfd instead of dirfd.
2017-09-28 00:49:05 +02:00
H.J. Lu 825adeeed1 Mark __dso_handle as hidden [BZ #18822]
Since __dso_handle is always defined by either crtbegin.o from GCC or
dso_handle.c, it should be marked as hidden and be passed directly.

	[BZ #18822]
	* dlfcn/modatexit.c (foo): Remove __dso_handle check.
	* dlfcn/modcxaatexit.c: Include <dso_handle.h>.
	(__dso_handle): Remove declaration.
	* dlfcn/tstatexit.c (__dso_handle): Removed.
	(main): Don't check __dso_handle.
	* dlfcn/tstcxaatexit.c (__dso_handle): Removed.
	(main): Don't check __dso_handle.
	* include/dso_handle.h: New file.
	* malloc/mtrace.c: Include <dso_handle.h>.
	(mtrace): Pass __dso_handle directly.
	* nptl/pthread_atfork.c: Include <dso_handle.h>.
	(__dso_handle): Remove declaration.
	(__pthread_atfork): Pass __dso_handle directly.
	* nptl/tst-atfork2mod.c: Include <dso_handle.h>.
	(__dso_handle): Removed.
	* posix/wordexp-test.c: Include <dso_handle.h>.
	(__dso_handle): Remove declaration.
	(__app_register_atfork): Pass __dso_handle directly.
	* stdlib/at_quick_exit.c: Include <dso_handle.h>.
	(__dso_handle): Remove declaration.
	(at_quick_exit): Pass __dso_handle directly.
	* stdlib/atexit.c: Include <dso_handle.h>.
	(__dso_handle): Remove declaration.
	(atexit): Pass __dso_handle directly.
	* stdlib/tst-tls-atexit-lib.c: Include <dso_handle.h>.
	(__dso_handle): Removed.
2017-09-26 16:53:44 -07:00
Joseph Myers bfb0deb355 Fix make-syscalls.sh VDSO support for GCC 8.
sysdeps/unix/make-syscalls.sh has support, used only by x32, for
generating IFUNCs for kernel VDSO symbols.  This support creates
IFUNCs by setting symbol types manually, which is bad for debug info
and does not work with current GCC mainline because it results in
errors from the checks on types of function aliases.

This patch fixes it to use the common __ifunc macro, which uses the
ifunc attribute when available and so works with GCC mainline.  Note
however that the original error resulted from an indirect inclusion of
a header declaring __gettimeofday from the generated sources, and
using __ifunc now relies on such an indirect inclusion remaining as it
means use of __typeof to determine the correct types.  If glibc's
headers change in such a way as to remove that indirect inclusion, it
will become necessary to change the syscalls.list syntax for VDSO
syscalls so the name of the header to include can be specified.

Tested (compilation only) with build-many-glibcs.py that this fixes
the build for x32 with GCC mainline.

	* sysdeps/unix/make-syscalls.sh: Use __ifunc to define symbols
	using VDSO.
2017-09-26 21:21:01 +00:00
Alexey Makhalov cebcb9f864 Fix range check in do_tunable_update_val
Current implementation of tunables does not set arena_max and arena_test
values. Any value provided by glibc.malloc.arena_max and
glibc.malloc.arena_test parameters is ignored.

These tunables have minval value set to 1 (see elf/dl-tunables.list file)
and undefined maxval value. In that case default value (which is 0. see
scripts/gen-tunables.awk) is being used to set maxval.

For instance, generated tunable_list[] entry for arena_max is:
(gdb) p *cur
$1 = {name = 0x7ffff7df6217 "glibc.malloc.arena_max",
 type = {type_code = TUNABLE_TYPE_SIZE_T, min = 1, max = 0},
  val = {numval = 0, strval = 0x0}, initialized = false,
   security_level = TUNABLE_SECLEVEL_SXID_IGNORE,
    env_alias = 0x7ffff7df622e "MALLOC_ARENA_MAX"}

As a result, any value of glibc.malloc.arena_max is ignored by
TUNABLE_SET_VAL_IF_VALID_RANGE macro
  __type min = (__cur)->type.min;                    <- initialized to 1
  __type max = (__cur)->type.max;                    <- initialized to 0!
  if (min == max)                                    <- false
    {
      min = __default_min;
      max = __default_max;
    }
  if ((__type) (__val) >= min && (__type) (val) <= max)  <- false
    {
      (__cur)->val.numval = val;
      (__cur)->initialized = true;
    }

Assigning correct min/max values at a build time fixes a problem.
Plus, a bit of optimization: Setting of default min/max values for the
given type at a run time might be eliminated.

	* elf/dl-tunables.c (do_tunable_update_val): Range checking fix.
	* scripts/gen-tunables.awk: Set unspecified minval and/or maxval
	values to correct default value for given type.
2017-09-27 02:44:09 +05:30
H.J. Lu 592d5c7539 Skip PT_DYNAMIC segment with p_filesz == 0 [BZ #22101]
ELF objects generated with "objcopy --only-keep-debug" have

Type     Offset  VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
DYNAMIC  0x0+e28 0x0+200e40 0x0+200e40 0x0+    0x0+1a0 RW  0x8

with 0 file size. ld.so should skip such PT_DYNAMIC segments.

Without a PT_DYNAMIC segment the loading of the shared object will
fail, and therefore ldd on such objects will also fail instead of
crashing. This provides better diagnostics for tooling that is
attempting to inspect the invalid shared objects which may just
contain debug information.

	[BZ #22101]
	* elf/Makefile (tests): Add tst-debug1.
	($(objpfx)tst-debug1): New.
	($(objpfx)tst-debug1.out): Likewise.
	($(objpfx)tst-debug1mod1.so): Likewise.
	* elf/dl-load.c (_dl_map_object_from_fd): Skip PT_DYNAMIC segment
	with p_filesz == 0.
	* elf/tst-debug1.c: New file.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-09-26 13:50:01 -07:00
Joseph Myers 2d9193f2f5 Use generic __ifunc for SPARC.
glibc fails to build with GCC mainline for SPARC because of the use of
manually-created IFUNCs, which fail the tests of compatibility of
function alias types.  This patch changes sparc-ifunc.h to use the
generic __ifunc in defining sparc_libm_ifunc.  The generic __ifunc can
use the GCC ifunc attribute when available, so ensuring
type-correctness as well as better debug info than when setting symbol
types in asm statements.

Note that for this to fix the build with GCC mainline the GCC patch
<https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01779.html>, or
building GCC with --enable-gnu-indirect-function, is also needed.

Tested (compilation only) with build-many-glibcs.py (sparc64-linux-gnu
and sparcv9-linux-gnu, with GCC 8 with the above patch, and also with
GCC 7).

	* sysdeps/sparc/sparc-ifunc.h [!__ASSEMBLER__] (sparc_libm_ifunc):
	Define using __ifunc.
2017-09-26 19:49:33 +00:00
Tulio Magno Quites Machado Filho 4c5a7a02b6 powerpc: Regenerate ULPs for expf() and exp2f()
Remove all entries for expf() and exp2f() and regenerate them.

	* sysdeps/powerpc/fpu/libm-test-ulps: Regenerate expf() and
	exp2f() values.
2017-09-26 16:13:33 -03:00