Commit Graph

21245 Commits

Author SHA1 Message Date
Joseph Myers 4f3647e46e Prefer new libm function wrappers for !LIBM_SVID_COMPAT.
The initial obsoletion of SVID libm error handling left the old
wrappers and __kernel_standard still being used for new ports and
static linking, just with macro definitions of _LIB_VERSION and
matherr that meant symbols with those names were never actually used
and the code for different error handling variants could be optimized
out.

This patch cleans things up further by eliminating the
__kernel_standard use for new ports and static linking.  Now, the old
wrappers no longer generate any code in the !LIBM_SVID_COMPAT case,
while the new errno-only wrappers that were added for float128 support
are now also used for float, double and long double in that case.

The changes are generally straightforward.  The w_scalb*_compat
wrappers continue to be used (scalb is obsolescent in the sense of not
being supported for float128, but is present in supported standards -
the 2001 edition of POSIX and earlier XSI versions - so remains
supported for static linking and new ports, as do the float and long
double variants that are existing GNU extensions).  Those wrappers
would only call __kernel_standard in the _LIB_VERSION == _SVID_ case.
Since we would like to be able to compile most of glibc without
optimization, relying on a static function whose only use is under an
if (0) condition being optimized away to avoid an undefined
__kernel_standard reference may not be a good idea.  Thus, the
relevant code in the scalb wrappers has LIBM_SVID_COMPAT conditionals
added to guarantee it's not built at all in the case where
__kernel_standard does not exist.

Just as i386 has its own w_sqrt_compat.c, so w_sqrt.c is also added.
ia64 gets dummy w_*.c to prevent those files being built where they
would conflict with the ia64 libm, as with its existing w_*_compat.c.

Conditions disabling code for !LIBM_SVID_COMPAT are needed in both the
math/ wrappers and in the long double wrappers in ldbl-opt (to avoid
them setting up aliases and symbol versions for undefined symbols).  I
hope that future cleanups to how libm function aliases and symbol
versioning are done will eliminate the need for most of the ldbl-opt
wrappers.

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

	* sysdeps/generic/math-type-macros-double.h: Include
	<math-svid-compat.h>.
	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
	* sysdeps/generic/math-type-macros-float.h: Include
	<math-svid-compat.h>.
	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
	* sysdeps/generic/math-type-macros-ldouble.h: Include
	<math-svid-compat.h>.
	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
	* math/lgamma-compat.h (BUILD_LGAMMA): Include LIBM_SVID_COMPAT
	condition.
	* math/w_acos_compat.c: Condition contents on [LIBM_SVID_COMPAT].
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosh_compat.c: Likewise.
	* math/w_acoshf_compat.c: Likewise.
	* math/w_acoshl_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_atan2_compat.c: Likewise.
	* math/w_atan2f_compat.c: Likewise.
	* math/w_atan2l_compat.c: Likewise.
	* math/w_atanh_compat.c: Likewise.
	* math/w_atanhf_compat.c: Likewise.
	* math/w_atanhl_compat.c: Likewise.
	* math/w_cosh_compat.c: Likewise.
	* math/w_coshf_compat.c: Likewise.
	* math/w_coshl_compat.c: Likewise.
	* math/w_exp10_compat.c: Likewise.
	* math/w_exp10f_compat.c: Likewise.
	* math/w_exp10l_compat.c: Likewise.
	* math/w_exp2_compat.c: Likewise.
	* math/w_exp2f_compat.c: Likewise.
	* math/w_exp2l_compat.c: Likewise.
	* math/w_fmod_compat.c: Likewise.
	* math/w_fmodf_compat.c: Likewise.
	* math/w_fmodl_compat.c: Likewise.
	* math/w_hypot_compat.c: Likewise.
	* math/w_hypotf_compat.c: Likewise.
	* math/w_hypotl_compat.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_jnl_compat.c: Likewise.
	* math/w_lgamma_r_compat.c: Likewise.
	* math/w_lgammaf_r_compat.c: Likewise.
	* math/w_lgammal_r_compat.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* math/w_pow_compat.c: Likewise.
	* math/w_powf_compat.c: Likewise.
	* math/w_powl_compat.c: Likewise.
	* math/w_remainder_compat.c: Likewise.
	* math/w_remainderf_compat.c: Likewise.
	* math/w_remainderl_compat.c: Likewise.
	* math/w_sinh_compat.c: Likewise.
	* math/w_sinhf_compat.c: Likewise.
	* math/w_sinhl_compat.c: Likewise.
	* math/w_sqrt_compat.c: Likewise.
	* math/w_sqrtf_compat.c: Likewise.
	* math/w_sqrtl_compat.c: Likewise.
	* math/w_tgamma_compat.c: Likewise.
	* math/w_tgammaf_compat.c: Likewise.
	* math/w_tgammal_compat.c: Likewise.
	* math/w_scalb_compat.c (sysv_scalb): Condition definition on
	[LIBM_SVID_COMPAT].
	(__scalb): Condition call to sysv_scalb on [LIBM_SVID_COMPAT].
	* math/w_scalbf_compat.c (sysv_scalbf): Condition definition on
	[LIBM_SVID_COMPAT].
	(__scalbf): Condition call to sysv_scalbf on [LIBM_SVID_COMPAT].
	* math/w_scalbl_compat.c (sysv_scalbl): Condition definition on
	[LIBM_SVID_COMPAT].
	(__scalbl): Condition call to sysv_scalbl on [LIBM_SVID_COMPAT].
	* sysdeps/i386/fpu/w_sqrt.c: New file.
	* sysdeps/ia64/fpu/w_acos.c: Likewise.
	* sysdeps/ia64/fpu/w_acosf.c: Likewise.
	* sysdeps/ia64/fpu/w_acosh.c: Likewise.
	* sysdeps/ia64/fpu/w_acoshf.c: Likewise.
	* sysdeps/ia64/fpu/w_acoshl.c: Likewise.
	* sysdeps/ia64/fpu/w_acosl.c: Likewise.
	* sysdeps/ia64/fpu/w_asin.c: Likewise.
	* sysdeps/ia64/fpu/w_asinf.c: Likewise.
	* sysdeps/ia64/fpu/w_asinl.c: Likewise.
	* sysdeps/ia64/fpu/w_atan2.c: Likewise.
	* sysdeps/ia64/fpu/w_atan2f.c: Likewise.
	* sysdeps/ia64/fpu/w_atan2l.c: Likewise.
	* sysdeps/ia64/fpu/w_atanh.c: Likewise.
	* sysdeps/ia64/fpu/w_atanhf.c: Likewise.
	* sysdeps/ia64/fpu/w_atanhl.c: Likewise.
	* sysdeps/ia64/fpu/w_cosh.c: Likewise.
	* sysdeps/ia64/fpu/w_coshf.c: Likewise.
	* sysdeps/ia64/fpu/w_coshl.c: Likewise.
	* sysdeps/ia64/fpu/w_exp.c: Likewise.
	* sysdeps/ia64/fpu/w_exp10.c: Likewise.
	* sysdeps/ia64/fpu/w_exp10f.c: Likewise.
	* sysdeps/ia64/fpu/w_exp10l.c: Likewise.
	* sysdeps/ia64/fpu/w_exp2.c: Likewise.
	* sysdeps/ia64/fpu/w_exp2f.c: Likewise.
	* sysdeps/ia64/fpu/w_exp2l.c: Likewise.
	* sysdeps/ia64/fpu/w_expf.c: Likewise.
	* sysdeps/ia64/fpu/w_expl.c: Likewise.
	* sysdeps/ia64/fpu/w_fmod.c: Likewise.
	* sysdeps/ia64/fpu/w_fmodf.c: Likewise.
	* sysdeps/ia64/fpu/w_fmodl.c: Likewise.
	* sysdeps/ia64/fpu/w_hypot.c: Likewise.
	* sysdeps/ia64/fpu/w_hypotf.c: Likewise.
	* sysdeps/ia64/fpu/w_hypotl.c: Likewise.
	* sysdeps/ia64/fpu/w_lgamma_r.c: Likewise.
	* sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise.
	* sysdeps/ia64/fpu/w_lgammal_r.c: Likewise.
	* sysdeps/ia64/fpu/w_log.c: Likewise.
	* sysdeps/ia64/fpu/w_log10.c: Likewise.
	* sysdeps/ia64/fpu/w_log10f.c: Likewise.
	* sysdeps/ia64/fpu/w_log10l.c: Likewise.
	* sysdeps/ia64/fpu/w_log2.c: Likewise.
	* sysdeps/ia64/fpu/w_log2f.c: Likewise.
	* sysdeps/ia64/fpu/w_log2l.c: Likewise.
	* sysdeps/ia64/fpu/w_logf.c: Likewise.
	* sysdeps/ia64/fpu/w_logl.c: Likewise.
	* sysdeps/ia64/fpu/w_pow.c: Likewise.
	* sysdeps/ia64/fpu/w_powf.c: Likewise.
	* sysdeps/ia64/fpu/w_powl.c: Likewise.
	* sysdeps/ia64/fpu/w_remainder.c: Likewise.
	* sysdeps/ia64/fpu/w_remainderf.c: Likewise.
	* sysdeps/ia64/fpu/w_remainderl.c: Likewise.
	* sysdeps/ia64/fpu/w_sinh.c: Likewise.
	* sysdeps/ia64/fpu/w_sinhf.c: Likewise.
	* sysdeps/ia64/fpu/w_sinhl.c: Likewise.
	* sysdeps/ia64/fpu/w_sqrt.c: Likewise.
	* sysdeps/ia64/fpu/w_sqrtf.c: Likewise.
	* sysdeps/ia64/fpu/w_sqrtl.c: Likewise.
	* sysdeps/ia64/fpu/w_tgamma.c: Likewise.
	* sysdeps/ia64/fpu/w_tgammaf.c: Likewise.
	* sysdeps/ia64/fpu/w_tgammal.c: Likewise.
	* sysdeps/ieee754/dbl-64/w_exp_compat.c: Condition contents on
	[LIBM_SVID_COMPAT].
	* sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
	* sysdeps/ieee754/k_standard.c: Likewise.
	* sysdeps/ieee754/k_standardf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: Condition
	long_double_symbol call on [LIBM_SVID_COMPAT].
	* sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c: Condition
	long_double_symbol and compat_symbol calls on [LIBM_SVID_COMPAT].
2017-09-05 23:35:55 +00:00
Steve Ellcey 05b38d64b1 Fix tests that are testing obsoleted functionality
* include/shlib-compat.h (TEST_COMPAT): New Macro.
	* malloc/tst-mallocstate.c: Convert from test-skeleton
	to test-driver.  Ifdef code using TEST_COMPAT macro.
	* math/test-matherr-2.c: Ifdef test using TEST_COMPAT macro.
	* math/test-matherr.c: Likewise.
2017-09-05 12:24:00 -07:00
Joseph Myers 99d6791899 Fix pcprofiledump cross-endian condition (bug 22086).
debug/pcprofiledump.c contains code that tries to handle other-endian
data.  This uses a condition "(word & 0xfffffff0) == bswap_32
(0xdeb00000)".  This condition is always false (the LHS always has the
low four bits zero, the RHS doesn't); a correct comparison would use
0x0fffffff.  This results in -Werror=tautological-compare build
failures with the tile version of bits/byteswap.h and mainline GCC.

https://sourceware.org/ml/libc-testresults/2017-q3/msg00400.html

pcprofiledump.c: In function 'main':
pcprofiledump.c:118:39: error: bitwise comparison always evaluates to false
[-Werror=tautological-compare]
   int must_swap = (word & 0xfffffff0) == bswap_32 (0xdeb00000);
                                       ^~

This patch fixes the condition.  Tested for x86_64, and with
build-many-glibcs.py that it fixes the build for tilegx-linux-gnu.
(Note that I have not tested the actual pcprofiledump functionality,
native or cross endian, which lacks any testsuite coverage.)

	[BZ #22086]
	* debug/pcprofiledump.c (main): Use byte-swapped mask when
	comparing word with byte-swapped constant.
2017-09-05 15:14:09 +00:00
Mike FABIAN 3f802aeb34 Add miq_NI locale for Miskito
[BZ #20498]
	* locale/iso-639.def: add Miskito.
	* localedata/SUPPORTED: Add miq_NI/UTF-8.
	* localedata/locales/miq_NI: New file.
2017-09-05 15:04:23 +02:00
H.J. Lu 0a587a8a98 Hide __chmod and __mkdir [BZ #18822]
Hide internal __chmod and __mkdir functions to allow direct access
within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/sys/stat.h (__chmod): Add libc_hidden_proto.
	(__mkdir): Likewise.
	* io/chmod.c (__chmod): Add libc_hidden_def.
	* io/mkdir.c (__mkdir): Likewise.
	* sysdeps/mach/hurd/chmod.c (__chmod): Likewise.
	* sysdeps/mach/hurd/mkdir.c (__mkdir): Likewise.
	* sysdeps/unix/sysv/linux/generic/chmod.c (__chmod): Likewise.
	* sysdeps/unix/sysv/linux/generic/mkdir.c (__mkdir): Likewise.
2017-09-04 13:38:51 -07:00
Joseph Myers 1650e19265 Update kernel version in syscall-names.list to 4.13.
As far as I can tell Linux 4.13 does not add any new syscalls not
included in syscall-names.list.  This patch updates the version number
in that file accordingly.

	* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
	version to 4.13.
2017-09-04 20:16:07 +00:00
Joseph Myers f3a129b872 Fix bits/math-finite.h exp10 condition (bug 22082).
bits/math-finite.h handles exp10 if __USE_GNU.  It should use the
condition __GLIBC_USE (IEC_60559_FUNCS_EXT), as in bits/mathcalls.h.
This patch fixes the condition.

Tested for x86_64.

	[BZ #22082]
	* math/bits/math-finite.h (exp10): Redirect if [__GLIBC_USE
	(IEC_60559_FUNCS_EXT)], not [__USE_GNU].
2017-09-04 16:28:23 +00:00
Florian Weimer b38042f514 math.h: Warn about an already-defined log macro
This is a common programming error, and the cause of the problem is not
always obvious.

<tgmath.h> defines a log macro, but it includes <math.h> before that, so
that is compatible with the warning.
2017-09-04 17:56:31 +02:00
Joseph Myers 059b64046e Use Linux 4.13 in build-many-glibcs.py.
* scripts/build-many-glibcs.py (Context.checkout): Default Linux
	kernel version to 4.13.
2017-09-04 15:34:58 +00:00
Samuel Thibault 6547ec0ad8 hurd: fix resolv/tst-resolv-res_init-skeleton.c build
* resolv/tst-resolv-res_init-skeleton.c (run_res_init)
	[!CLONE_NEWUTS]: Fail as unsupported if hostname is not NULL.
2017-09-03 19:44:07 +02:00
Samuel Thibault 492cbbed86 hurd: Fix build ot misc/tst-preadvwritev2-common.c
* misc/tst-preadvwritev2-common.c (RWF_HIPRI, RWF_DSYNC, RWF_SYNC,
	RWF_NOWAIT): Define to 0 if undefined already.
	(do_test_with_invalid_flags): Set invalid_flag to 2 if RWF_SUPPORTED
	boils down to 0.
2017-09-03 17:51:15 +02:00
Samuel Thibault cae3d71212 hurd: Fix rtld's strtoul_internal use through hurdlookup
* sysdeps/mach/hurd/dl-sysdep.c (__strtoul_internal): New
	function.
2017-09-03 14:33:35 +02:00
Samuel Thibault 2ce1f9efd6 hurd: mach/hurd/x86 also needs x86 tunables
* sysdeps/mach/hurd/x86/dl-sysdep.c: New file.
2017-09-03 13:39:33 +02:00
Samuel Thibault 56bf5497c5 hurd: mach/hurd/i386 also needs mach/hurd/x86
* sysdeps/mach/hurd/i386/Implies: Add mach/hurd/x86.
2017-09-03 13:38:09 +02:00
Samuel Thibault 1946d950f2 hurd: fix libm link
* sysdeps/x86/fpu/include/bits/fenv.h [NO_HIDDEN]: Redirect
	__feraiseexcept_renamed to feraiseexcept instead of
	__GI_feraiseexcept.
2017-09-03 05:32:10 +02:00
Samuel Thibault f85958a74d hurd: Fix libc link
This follows db3d848 ('Build divdi3 only for architecture that required
it').

	* sysdeps/mach/hurd/i386/Makefile
	[$(subdir) = csu] (sysdep_routines): New rule: divdi3 object.
	[$(subdir) = csu] (sysdep-only-routines): Likewise.
	[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
2017-09-03 04:58:00 +02:00
Samuel Thibault 127e7773b4 hurd: Fix libc link
* sysdeps/posix/pause.c: Include <sigsetops.h>.
	* sysdeps/posix/system.c: Include <sigsetops.h>.
2017-09-03 04:36:29 +02:00
Samuel Thibault b96aca4d05 hurd: Fix rtld link
* sysdeps/mach/hurd/dl-sysdep.c (__sbrk): New function.
2017-09-03 04:26:31 +02:00
Samuel Thibault 819ea3347e hurd: Fix rtld link
dl-tunables.c now uses __access_noerrno in addition to __access.

	* sysdeps/mach/hurd/dl-sysdep.c (__access_noerrno): New function.
2017-09-03 04:09:54 +02:00
Samuel Thibault 2263ca7ce8 hurd: Fix p{read,write}{,v64}v2.c build
* misc/preadv2.c: Include <errno.h>.
	* misc/preadv64v2.c: Include <errno.h>.
	* misc/pwritev2.c: Include <errno.h>.
	* misc/pwritev64v2.c: Include <errno.h>.
	* sysdeps/posix/preadv2.c: Include <errno.h>.
	* sysdeps/posix/preadv64v2.c: Include <errno.h>.
	Fix <unistd.h> inclusion.
	* sysdeps/posix/pwritev2.c: Include <errno.h>.
	* sysdeps/posix/pwritev64v2.c: Include <errno.h>.
2017-09-03 03:03:40 +02:00
Samuel Thibault ed95bf5638 hurd: Fix p{read,write}v64v2.c build
* sysdeps/posix/preadv64v2.c: Use off64_t instead of off_t.
	* sysdeps/posix/pwritev64v2.c: Use off64_t instead of off_t.
2017-09-03 03:00:55 +02:00
Samuel Thibault dd2b31dec0 hurd: Fix p{read,write}{,v64}v2.c build
* sysdeps/posix/preadv2.c: Use off_t instead of OFF_T.
	* sysdeps/posix/preadv64v2.c: Use off_t instead of OFF_T.
	* sysdeps/posix/pwritev2.c: Use off_t instead of OFF_T.
	* sysdeps/posix/pwritev64v2.c: Use off_t instead of OFF_T.
2017-09-03 02:45:06 +02:00
Samuel Thibault 01969395db hurd: Fix getting ssize_t for <sys/socket.h>
* sysdeps/mach/hurd/bits/socket.h: Include <sys/types.h> instead of
	just <bits/types.h>.
2017-09-03 02:22:00 +02:00
Samuel Thibault 06cf9d31d7 hurd: Fix sigsetops.h macros
* sysdeps/generic/sigsetops.h: Remove spurious #endif.
	(__sigismember, __sigaddset, __sigdelset): Fix referencing set
	parameter.
2017-09-03 01:45:19 +02:00
Samuel Thibault b794e16bcc sysdeps/generic/sigsetops.h: Remove spurious #endif 2017-09-03 01:08:49 +02:00
Joseph Myers 5a80d39d0d Obsolete pow10 functions.
This patch obsoletes the pow10, pow10f and pow10l functions (makes
them into compat symbols, not available for new ports or static
linking).  The exp10 names for these functions are standardized (in TS
18661-4) and were added in the same glibc version (2.1) as pow10 so
source code can change to use them without any loss of portability.
Since pow10 is deliberately not provided for _Float128, only exp10,
this slightly simplifies moving to the new wrapper templates in the
!LIBM_SVID_COMPAT case, by avoiding needing to arrange for pow10,
pow10f and pow10l to be defined by those templates.

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

	* manual/math.texi (pow10): Do not document.
	(pow10f): Likewise.
	(pow10l): Likewise.
	* math/bits/mathcalls.h [__USE_GNU] (pow10): Do not declare.
	* math/bits/math-finite.h [__USE_GNU] (pow10): Likewise.
	* math/libm-test-exp10.inc (pow10_test): Remove.
	(do_test): Do not call pow10.
	* math/w_exp10_compat.c (pow10): Make into compat symbol.
	[NO_LONG_DOUBLE] (pow10l): Likewise.
	* math/w_exp10f_compat.c (pow10f): Likewise.
	* math/w_exp10l_compat.c (pow10l): Likewise.
	* sysdeps/ia64/fpu/e_exp10.S: Include <shlib-compat.h>.
	(pow10): Make into compat symbol.
	* sysdeps/ia64/fpu/e_exp10f.S: Include <shlib-compat.h>.
	(pow10f): Make into compat symbol.
	* sysdeps/ia64/fpu/e_exp10l.S: Include <shlib-compat.h>.
	(pow10l): Make into compat symbol.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove
	pow10.
	(CFLAGS-nldbl-pow10.c): Remove variable..
	* sysdeps/ieee754/ldbl-opt/nldbl-pow10.c: Remove file.
	* sysdeps/ieee754/ldbl-opt/w_exp10_compat.c (pow10l): Condition on
	[SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)].
	* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c (compat_symbol):
	Undefine and redefine.
	(pow10l): Make into compat symbol.
	* sysdeps/aarch64/libm-test-ulps: Remove pow10 ulps.
	* sysdeps/alpha/fpu/libm-test-ulps: Likewise.
	* sysdeps/arm/libm-test-ulps: Likewise.
	* sysdeps/hppa/fpu/libm-test-ulps: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/microblaze/libm-test-ulps: Likewise.
	* sysdeps/mips/mips32/libm-test-ulps: Likewise.
	* sysdeps/mips/mips64/libm-test-ulps: Likewise.
	* sysdeps/nios2/libm-test-ulps: Likewise.
	* sysdeps/powerpc/fpu/libm-test-ulps: Likewise.
	* sysdeps/powerpc/nofpu/libm-test-ulps: Likewise.
	* sysdeps/s390/fpu/libm-test-ulps: Likewise.
	* sysdeps/sh/libm-test-ulps: Likewise.
	* sysdeps/sparc/fpu/libm-test-ulps: Likewise.
	* sysdeps/tile/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-09-01 21:13:18 +00:00
Paul Pluzhnikov 3824fc3891 2017-09-01 Paul Pluzhnikov <ppluzhnikov@google.com>
* stdlib/tst-atexit-common.c (crumbs): Ensure correct size.
2017-09-01 11:35:55 -07:00
H.J. Lu b30082799d Update tst-regex.c/tst-regex2.c for old ChangeLog move
* posix/tst-regex.c (do_test): Replace "../ChangeLog.8" with
	"../ChangeLog.old/ChangeLog.8".
	* posix/tst-regex2.c (do_test): Replace "../ChangeLog.14" with
	"../ChangeLog.old/ChangeLog.14".
2017-09-01 10:20:49 -07:00
H.J. Lu 136fa185fd Credit Ulrich Drepper for libpthread in contrib.texi
* manual/contrib.texi: Credit Ulrich Drepper for the POSIX
	Threads Library.
2017-09-01 10:19:07 -07:00
Joseph Myers c18d50a23b Include <string.h> for strcmp call from sysdeps/unix/sysv/linux/gentempfd.c.
* sysdeps/unix/sysv/linux/gentempfd.c: Include <string.h>.
2017-09-01 17:14:43 +00:00
H.J. Lu bedbd85972 Remove Roland McGrath/Ulrich Drepper et al. from DSO banner
* csu/version.c (banner): Remove "by Roland McGrath et al.".
	* nptl/Banner: Remove "by Ulrich Drepper et al.".
2017-09-01 10:09:21 -07:00
Paul Pluzhnikov 50c66c7acd 2017-09-01 Paul Pluzhnikov <ppluzhnikov@google.com>
* stdlib/tst-atexit-common.c (do_test): Test support for at least
	32 atexit handlers.
2017-09-01 09:31:13 -07:00
Zack Weinberg a617bd119f math/math.h (HUGE_VAL): Improve commentary. 2017-09-01 11:19:47 -04:00
Adhemerval Zanella e0d2eb5a79 linux: Implement tmpfile with O_TMPFILE (BZ#21530)
This patch adds O_TMPFILE support to tmpfile on Linux.  This is
similar to the previous suggestion by Andreas Schwab [1] with the
difference the file descriptor creation is parameterized to
compartmentalize Linux only open flags (O_TMPFILE) on sysdeps.

Checked on x86_64-linux-gnu.

	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
	Andreas Schwab  <schwab@suse.de>

	[BZ #21530]
	* include/stdio.h (__gen_tempfd): New function.
	* stdio-common/Makefile (routines): Add gentempfd.
	* stdio-common/gentempfd.c: New file.
	* sysdeps/unix/sysv/linux/gentempfd.c: Likewise.
	* stdio-common/tmpfile.c (tmpfile): First try to use a system specific
	unnamed file first.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg01293.html
2017-09-01 09:52:47 -03:00
Florian Weimer f4a6be2582 getaddrinfo: Fix error handling in gethosts [BZ #21915] [BZ #21922]
The old code uses errno as the primary indicator for success or
failure.  This is wrong because errno is only set for specific
combinations of the status return value and the h_errno variable.
2017-09-01 09:34:29 +02:00
Florian Weimer 5f8340f583 getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922] 2017-09-01 09:15:36 +02:00
Florian Weimer 65329bd233 support_chroot_create: Add support for /etc/hosts, /etc/host.conf 2017-09-01 08:58:07 +02:00
Florian Weimer a2881ef014 getaddrinfo: In gaih_inet, use h_errno for certain status values only
h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be
accurate at this point.
2017-09-01 08:57:52 +02:00
Florian Weimer ad816a5e00 getaddrinfo: Properly set errno for NSS function lookup failure 2017-09-01 08:57:28 +02:00
Florian Weimer 53250a21b8 getaddrinfo: Use &h_errno has the h_errno pointer
This simplifies the code because it is not necessary to propagate the
temporary h_errno value to the thread-local variable.  It also increases
compatibility with NSS modules which update only one of the two places.
2017-09-01 08:57:07 +02:00
Florian Weimer 924b121c59 getaddrinfo: Use &errno has the errno pointer
Similar code in nss/getXXbyYY_r.c is already using &errno as the
argument.
2017-09-01 08:56:46 +02:00
Steve Ellcey d9ff799a5b ILP32 math changes
* sysdeps/aarch64/fpu/s_llrint.c (OREG_SIZE): New macro.
	* sysdeps/aarch64/fpu/s_llround.c (OREG_SIZE): Likewise.
	* sysdeps/aarch64/fpu/s_llrintf.c (OREGS, IREGS): Remove.
	(IREG_SIZE, OREG_SIZE): New macros.
	* sysdeps/aarch64/fpu/s_llroundf.c: (OREGS, IREGS): Remove.
	(IREG_SIZE, OREG_SIZE): New macros.
	* sysdeps/aarch64/fpu/s_lrintf.c (IREGS): Remove.
	(IREG_SIZE): New macro.
	* sysdeps/aarch64/fpu/s_lroundf.c (IREGS): Remove.
	(IREG_SIZE): New macro.
	* sysdeps/aarch64/fpu/s_lrint.c (get-rounding-mode.h, stdint.h):
	New includes.
	(IREG_SIZE, OREG_SIZE): Initialize if not already set.
	(OREGS, IREGS): Set based on IREG_SIZE and OREG_SIZE.
	(__CONCATX): Handle exceptions correctly on large values that may
	set FE_INVALID.
	* sysdeps/aarch64/fpu/s_lround.c (IREG_SIZE, OREG_SIZE):
	Initialize if not already set.
        (OREGS, IREGS): Set based on IREG_SIZE and OREG_SIZE.
2017-08-31 13:38:11 -07:00
Adhemerval Zanella 102dde842a Remove NO_CANCELLATION macro
The NO_CANCELLATION macro is used currently on generic headers to
define non cancellable syscalls and on Linux fcntl to implement the non
cancellable variation.  Former should be single-handled by not-cancel.h
header and former could be simplified build both cancellable and non
cancellable for default objects and alias the non-cancellable to default
one for rtld ones (since Linux already support cancellation as default).

This patch thus removes the NO_CANCELLATION macro and its usage.  The
generic non cancellable fcntl is route to internal fcntl.

Checked on x86_64-linux-gnu and i686-linux-gnu.  Also checked with
a build again major ABIs.

	* sysdeps/generic/not-cancel.h (NO_CANCELLATION): Remove macro.
	* sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h
	(NO_CANCELLATION): Likewise.
	* sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
	(NO_CANCELLATION): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
	(NO_CANCELLATION): Likewise.
	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (NO_CANCELLATION):
	Likewise
	* sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (NO_CANCELLATION):
	Likewise.
	* sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): Add
	hidden prototype.
	* sysdeps/unix/sysv/linux/fcntl.c (__fcntl_nocancel): Define only
	for !IS_IN (rtld) and remove NO_CANCELLATION usage.
2017-08-31 16:10:34 -03:00
Steve Ellcey 9eee633b68 Change argument type passed to ifunc resolvers
* sysdeps/aarch64/dl-irel.h: (elf_ifunc_invoke): Change argument type
	in resolver call.
2017-08-31 10:34:55 -07:00
Florian Weimer 65284eb7a8 libc-symbols.h: Remove definition of internal_function 2017-08-31 18:52:00 +02:00
Florian Weimer 41ad5ca60e stdlib: Remove internal_function attribute 2017-08-31 18:52:00 +02:00
Florian Weimer 2fa6d086d1 stdio-common: Remove internal_function attribute 2017-08-31 18:52:00 +02:00
Florian Weimer b41bd5bc83 posix: Remove internal_function attribute 2017-08-31 18:52:00 +02:00
Florian Weimer 83b09837ed nptl: Remove internal_function attribute 2017-08-31 18:52:00 +02:00
Florian Weimer 116ac301b1 io: Remove internal_function attribute 2017-08-31 18:52:00 +02:00
Florian Weimer 9da93bd7c6 inet: Remove internal_function attribute 2017-08-31 18:52:00 +02:00
Joseph Myers c0c49d60cf Simplify NAN definitions.
Similar to my patches for HUGE_VAL and INFINITY. this patch eliminates
the bits/nan.h headers.  __builtin_nanf ("") is used to define NAN for
GCC 3.3 and later; the fallback is (0.0f / 0.0f), which is a constant
expression for a quiet NaN of type float, but raises a spurious
"invalid" exception outside static initializers, which seems the best
that can be done purely in standard C.  Again, if anyone actually uses
a compiler with its own incompatible extension for producing a
constant quiet NaN, we can add compiler conditionals.

Tested for x86_64.

	*  math/math.h [__USE_ISOC99] (NAN): Define directly here.  Do not
	include <bits/nan.h>.
	* math/Makefile (headers): Remove bits/nan.h.
	* bits/nan.h: Remove.
	* sysdeps/ieee754/bits/nan.h: Likewise.
	* sysdeps/mips/bits/nan.h: Likewise.
2017-08-31 16:39:25 +00:00
Joseph Myers 5ef1b2138d Simplify INFINITY definitions.
Similar to my patch for HUGE_VAL, this patch eliminates the bits/inf.h
headers and just unconditionally uses the same definitions as the
sysdeps/ieee754 version did (__builtin_inff () for GCC >= 3.3,
otherwise HUGE_VALF), directly in math.h, so removing an unnecessary
level of indirection.

Tested for x86_64.

	* math/math.h [__USE_ISOC99] (INFINITY): Define directly here.  Do
	not include <bits/inf.h>.
	* math/Makefile (headers): Remove bits/inf.h.
	* bits/inf.h: Remove.
	* sysdeps/ieee754/bits/inf.h: Likewise.
2017-08-31 16:12:46 +00:00
Joseph Myers a60eca2e55 Simplify HUGE_VAL definitions.
There are various bits/huge_val*.h headers to define HUGE_VAL and
related macros.  All of them use __builtin_huge_val etc. for GCC 3.3
and later.  Then there are various fallbacks, such as using a large
hex float constant for GCC 2.96 and later, or using unions (with or
without compound literals) to construct the bytes of an infinity, with
this last being the reason for having architecture-specific files.
Supporting TS 18661-3 _FloatN / _FloatNx types that have the same
format as other supported types will mean adding more such macros;
needing to add more headers for them doesn't seem very desirable.

The fallbacks based on bytes of the representation of an infinity do
not meet the standard requirements for a constant expression.  At
least one of them is also wrong: sysdeps/sh/bits/huge_val.h is
producing a mixed-endian representation which does not match what GCC
does.

This patch eliminates all those headers, defining the macros directly
in math.h.  For GCC 3.3 and later, the built-in functions are used as
now.  For other compilers, a large constant 1e10000 (with appropriate
suffix) is used.  This is like the fallback for GCC 2.96 and later,
but without using hex floats (which have no apparent advantage here).
It is unambiguously valid standard C for all floating-point formats
with infinities, which covers all formats supported by glibc or likely
to be supported by glibc in future (C90 DR#025 said that if a
floating-point format represents infinities, all real values lie
within the range of representable values, so the constraints for
constant expressions are not violated), but may generate compiler
warnings and wouldn't handle the TS 18661-1 FENV_ROUND pragma
correctly.  If someone is actually using a compiler with glibc that
does not claim to be GCC 3.3 or later, but which has a better way to
define the HUGE_VAL macros, we can always add compiler conditionals in
with alternative definitions.

I intend to make similar changes for INF and NAN.  The SNAN macros
already just use __builtin_nans etc. with no fallback for compilers
not claiming to be GCC 3.3 or later.

Tested for x86_64.

	* math/math.h: Do not include bits/huge_val.h, bits/huge_valf.h,
	bits/huge_vall.h or bits/huge_val_flt128.h.
	(HUGE_VAL): Define directly here.
	[__USE_ISOC99] (HUGE_VALF): Likewise.
	[__USE_ISOC99] (HUGE_VALL): Likewise.
	[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(HUGE_VAL_F128): Likewise.
	* math/Makefile (headers): Remove bits/huge_val.h,
	bits/huge_valf.h, bits/huge_vall.h and bits/huge_val_flt128.h.
	* bits/huge_val.h: Remove.
	* bits/huge_val_flt128.h: Likewise.
	* bits/huge_valf.h: Likewise.
	* bits/huge_vall.h: Likewise.
	* sysdeps/ia64/bits/huge_vall.h: Likewise.
	* sysdeps/ieee754/bits/huge_val.h: Likewise.
	* sysdeps/ieee754/bits/huge_valf.h: Likewise.
	* sysdeps/m68k/m680x0/bits/huge_vall.h: Likewise.
	* sysdeps/sh/bits/huge_val.h: Likewise.
	* sysdeps/sparc/bits/huge_vall.h: Likewise.
	* sysdeps/x86/bits/huge_vall.h: Likewise.
2017-08-31 15:50:50 +00:00
Florian Weimer 17e00cc69e elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
Florian Weimer 8d2f9410d5 gmon: Remove internal_function attribute 2017-08-31 16:16:07 +02:00
Florian Weimer 86e4919f57 dlfcn: Remove internal_function attribute 2017-08-31 16:12:03 +02:00
Florian Weimer 59bd52b087 resolv: Remove internal_function attribute 2017-08-31 16:07:52 +02:00
Florian Weimer fc3d94979e dirent: Remove internal_function attribute 2017-08-31 16:02:40 +02:00
Florian Weimer 18c54facf1 Linux getcwd: Remove internal_function attribute 2017-08-31 15:59:07 +02:00
Florian Weimer 7e01f080e8 time: Remove the internal_function attribute 2017-08-31 15:59:07 +02:00
Florian Weimer d7ccc6c983 iconv, intl, locale, wcsmbs: Remove internal_function
Also adjust parts of the time subdirectory.
2017-08-31 15:59:06 +02:00
Florian Weimer dab0eecef6 aio: Remove internal_function function attribute 2017-08-31 15:59:06 +02:00
Florian Weimer ab5bf7cf76 misc: Remove internal_function function attribute 2017-08-31 15:59:06 +02:00
Florian Weimer 75b3047eac NSS: Remove internal_function function attribute 2017-08-31 15:59:06 +02:00
Florian Weimer 0c71122c0c malloc: Remove the internal_function attribute 2017-08-31 15:59:06 +02:00
Florian Weimer ca4ec80396 sunrpc: Remove internal_function attribute 2017-08-31 15:59:02 +02:00
Florian Weimer 24cffce736 malloc: Resolve compilation failure in NDEBUG mode
In _int_free, the locked variable is not used if NDEBUG is defined.
2017-08-31 15:34:22 +02:00
H.J. Lu ecd0747df3 Place $(elf-objpfx)sofini.os last [BZ #22051]
Since sofini.os terminates .eh_frame section, it should be placed last.

	[BZ #22051]
	* Makerules (build-module-helper-objlist): Filter out
	$(elf-objpfx)sofini.os.
	(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
	needed.
2017-08-31 06:28:46 -07:00
Florian Weimer 5f0704b66c libio: Assume _LIBC, weak_alias, errno, (__set_)errno &c are defined
Do not define _POSIX_SOURCE.
2017-08-31 14:48:25 +02:00
Florian Weimer 5129873a8e malloc: Change top_check return type to void
After commit ec2c1fcefb,
(malloc: Abort on heap corruption, without a backtrace), the function
always returns 0.
2017-08-31 14:16:52 +02:00
Joseph Myers 4fa9b3bfe6 Fix mcontext_t sigcontext namespace (bug 21457).
This patch completes the ucontext.h namespace fixes by fixing issues
related to the use of struct sigcontext as mcontext_t, and inclusion
of <bits/sigcontext.h> even when struct sigcontext is not so used.

Inclusion of <bits/sigcontext.h> by <sys/ucontext.h> is removed; the
way to get the sigcontext structure is by including <signal.h> (in a
context where __USE_MISC is defined); the sysdeps/generic version of
sys/ucontext.h keeps the inclusion by necessity, with a comment about
how this is not namespace-clean, but the only configuration that used
it, MicroBlaze, gets its own version of the header in this patch.
Where mcontext_t was typedefed to struct sigcontext, the contents of
struct sigcontext are inserted (with appropriate namespace handling to
prefix fields with __ when __USE_MISC is not defined); review should
check that this has been done correctly in each case, whether the
definition of struct sigcontext comes from glibc headers or from the
Linux kernel.  This changes C++ name mangling on affected
architectures (which do not include x86_64/x86).

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

2017-08-14  Joseph Myers  <joseph@codesourcery.com>

	[BZ #21457]
	* sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>.
	* sysdeps/generic/sys/ucontext.h: Add comment about use of struct
	sigcontext and namespace requirements.
	* sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>.
	* sysdeps/m68k/sys/ucontext.h: Likewise.
	* sysdeps/mips/sys/ucontext.h: Likewise.  Include <bits/types.h>.
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	(__ctx): Define earlier.
	(mcontext_t): Define structure contents rather than using struct
	sigcontext.
	* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use
	__glibc_reserved1 instead of __reserved.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	(__ctx): Define earlier.
	(mcontext_t): Define structure contents rather than using struct
	sigcontext.
	* sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use
	mcontext_t instead of struct sigcontext.
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	(__ctx): Define earlier.
	(mcontext_t): Define structure contents rather than using struct
	sigcontext.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	(__ctx): Define earlier.
	(mcontext_t): Define structure contents rather than using struct
	sigcontext.
	* sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use
	mcontext_t instead of struct sigcontext.
	* sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use
	mcontext_t instead of struct sigcontext.
	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	(__ctx): New macro.
	(struct __ia64_fpreg_mcontext): New type.
	(mcontext_t): Define structure contents rather than using struct
	sigcontext.
	(_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext.
	(uc_sigmask): Define using __ctx.
	(uc_stack): Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include
	<bits/sigcontext.h>.
	* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	* sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.
	(__ctx): Define earlier.
	(mcontext_t): Define structure contents rather than using struct
	sigcontext.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
	<bits/sigcontext.h>.  Include <bits/types.h>.
	* conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove.
	(test-xfail-XPG42/sys/wait.h/conform): Likewise.
	(test-xfail-XPG42/ucontext.h/conform): Likewise.
	(test-xfail-UNIX98/signal.h/conform): Likewise.
	(test-xfail-UNIX98/sys/wait.h/conform): Likewise.
	(test-xfail-UNIX98/ucontext.h/conform): Likewise.
	(test-xfail-XOPEN2K/signal.h/conform): Likewise.
	(test-xfail-XOPEN2K/sys/wait.h/conform): Likewise.
	(test-xfail-XOPEN2K/ucontext.h/conform): Likewise.
	(test-xfail-POSIX2008/signal.h/conform): Likewise.
	(test-xfail-POSIX2008/sys/wait.h/conform): Likewise.
	(test-xfail-XOPEN2K8/signal.h/conform): Likewise.
	(test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.
2017-08-30 22:02:04 +00:00
Florian Weimer 5898f4548e dynarray: Set errno on overflow-induced allocation failure
This allows the caller to return directly on such an error, with an
appropriate errno value.
2017-08-30 20:10:56 +02:00
Florian Weimer a9da0bb266 malloc: Remove corrupt arena flag
This is no longer needed because we now abort immediately
once heap corruption is detected.
2017-08-30 20:08:34 +02:00
Florian Weimer ac3ed168d0 malloc: Remove check_action variable [BZ #21754]
Clean up calls to malloc_printerr and trim its argument list.

This also removes a few bits of work done before calling
malloc_printerr (such as unlocking operations).

The tunable/environment variable still enables the lightweight
additional malloc checking, but mallopt (M_CHECK_ACTION)
no longer has any effect.
2017-08-30 20:08:34 +02:00
Steve Ellcey 44bcba80f3 aarch64: Fix tst-makecontext3 in ILP32 mode.
* sysdeps/unix/sysv/linux/aarch64/makecontext.c (__makecontext):
	Use pointer to uint64_t instead of long int for sp.
2017-08-30 09:25:51 -07:00
Florian Weimer ec2c1fcefb malloc: Abort on heap corruption, without a backtrace [BZ #21754]
The stack trace printing caused deadlocks and has been itself been
targeted by code execution exploits.
2017-08-30 16:39:41 +02:00
Florian Weimer 9ce673b69e Do not scale NPTL tests with available number of CPUs
On very large multi-processor systems, creating hundreds of threads
runs into a test time out.  The tests do not seem to benefit from
massive over-scheduling.
2017-08-30 16:20:31 +02:00
Joseph Myers 2f1aef1959 Fix m68k bits/math-inline.h macro namespace (bug 22035).
As shown by build bot failures
<https://sourceware.org/ml/libc-testresults/2017-q3/msg00349.html> the
m68k bits/mathinline.h is not namespace-clean: it fails to compile if
the user has defined macros f or l before it is included, because of
expansions of those arguments to __inline_functions.  This patch
changes the __inline_functions definitions to take not the suffix but
a macro that concatenates it with the function name, to avoid the
spurious macro expansions.

Tested for m68k with build-many-glibcs.py.

	[BZ #22035]
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__inline_functions):
	Define to take a second argument that is a macro that
	concatentates a suffix, not the suffix itself.
	(__CONCAT_d): New macro.
	(__CONCAT_f): Likewise.
	(__CONCAT_l): Likewise.
2017-08-29 21:07:51 +00:00
Paul Pluzhnikov 8325b477b1 2017-08-29 Paul Pluzhnikov <ppluzhnikov@google.com>
* stdlib/tst-atexit-common.c (do_test): Test handler inheritance
	by child.
2017-08-29 10:46:44 -07:00
Adhemerval Zanella 319cbbf633 MIPS/o32: Fix internal_syscall5/6/7
Fix a commit cc25c8b4c1 ("New pthread rwlock that is more scalable.")
regression and prevent uncontrolled stack space usage from happening
when a 5-, 6- or 7-argument syscall wrapper is placed in a loop.

The cause of the problem is the use of `alloca' in regular MIPS/Linux
wrappers to force the use of the frame pointer register in any function
using one or more of these wrappers.  Using the frame pointer register
is required so as not to break frame unwinding as the the stack pointer
is lowered within the inline asm used by these wrappers to make room for
the stack arguments, which 5-, 6- and 7-argument syscalls use with the
o32 ABI.

The regular MIPS/Linux wrappers are macros however, expanded inline, and
stack allocations made with `alloca' are not discarded until the return
of the function they are made in.  Consequently if called in a loop,
then virtual memory is wasted, and if the loop goes through enough
iterations, then ultimately available memory can get exhausted causing
the program to crash.

Address the issue by replacing the inline code with standalone assembly
functions, which rely on the compiler arranging syscall arguments
according to the o32 function calling convention, which MIPS/Linux
syscalls also use, except for the syscall number passed and the error
flag returned.  This way there is no need to fiddle with the stack
pointer anymore and all that has to be handled in the new standalone
functions is the special handling of the syscall number and the error
flag.

Redirect 5-, 6- or 7-argument MIPS16/Linux syscall wrappers to these new
functions as well, so as to avoid an unnecessary double call the
existing wrappers would cause with the new arrangement.

	[BZ #21956]
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/Makefile
	[subdir = misc] (sysdep_routines): Remove `mips16-syscall5',
	`mips16-syscall6' and `mips16-syscall7'.
	(CFLAGS-mips16-syscall5.c, CFLAGS-mips16-syscall6.c)
	(CFLAGS-mips16-syscall7.c): Remove.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/Versions (libc):
	Remove `__mips16_syscall5', `__mips16_syscall6' and
	`__mips16_syscall7'.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall0.c
	(__mips16_syscall0): Rename `__mips16_syscall_return' to
	`__mips_syscall_return'.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall1.c
	(__mips16_syscall1): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall2.c
	(__mips16_syscall2): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall3.c
	(__mips16_syscall3): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall4.c
	(__mips16_syscall4): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall5.c:
	Remove.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall6.c:
	Remove.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall7.c:
	Remove.
	* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall.h
	(__mips16_syscall5): Expand to `__mips_syscall5' rather than
	`__mips16_syscall5'.  Remove prototype.
	(__mips16_syscall6): Expand to `__mips_syscall6' rather than
	`__mips16_syscall6'.  Remove prototype.
	(__mips16_syscall7): Expand to `__mips_syscall7' rather than
	`__mips16_syscall7'.  Remove prototype.
	(__nomips16, __mips16_syscall_return): Move to...
	* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
	(__nomips16, __mips_syscall_return): ... here.
	[__mips16] (INTERNAL_SYSCALL_NCS): Rename
	`__mips16_syscall_return' to `__mips_syscall_return'.
	[__mips16] (INTERNAL_SYSCALL_MIPS16): Pass `number' to
	`internal_syscall##nr'.
	[!__mips16] (INTERNAL_SYSCALL): Pass `SYS_ify (name)' to
	`internal_syscall##nr'.
	(FORCE_FRAME_POINTER): Remove.
	(__mips_syscall5): New prototype.
	(internal_syscall5): Rewrite to call `__mips_syscall5'.
	(__mips_syscall6): New prototype.
	(internal_syscall6): Rewrite to call `__mips_syscall6'.
	(__mips_syscall7): New prototype.
	(internal_syscall7): Rewrite to call `__mips_syscall7'.
	* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall5.S: New file.
	* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall6.S: New file.
	* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall7.S: New file.
	* sysdeps/unix/sysv/linux/mips/mips32/Makefile [subdir = misc]
	(sysdep_routines): Add libc-do-syscall.
	* sysdeps/unix/sysv/linux/mips/mips32/Versions (libc): Add
	`__mips_syscall5', `__mips_syscall6' and `__mips_syscall7'.
2017-08-29 18:31:08 +01:00
Adhemerval Zanella 01b87c656f ia64: Fix thread stack allocation permission set (BZ #21672)
This patch fixes ia64 failures on thread exit by madvise the required
area taking in consideration its disjoing stacks
(NEED_SEPARATE_REGISTER_STACK).  Also the snippet that setup the
madvise call to advertise kernel the area won't be used anymore in
near future is reallocated in allocatestack.c (for consistency to
put all stack management function in one place).

Checked on x86_64-linux-gnu and i686-linux-gnu for sanity (since
it is not expected code changes for architecture that do not
define NEED_SEPARATE_REGISTER_STACK) and also got a report that
it fixes ia64-linux-gnu failures from Sergei Trofimovich
<slyfox@gentoo.org>.

	[BZ #21672]
	* nptl/allocatestack.c [_STACK_GROWS_DOWN] (setup_stack_prot):
	Set to use !NEED_SEPARATE_REGISTER_STACK as well.
	(advise_stack_range): New function.
	* nptl/pthread_create.c (START_THREAD_DEFN): Move logic to mark
	stack non required to advise_stack_range at allocatestack.c
2017-08-29 13:29:19 -03:00
Szabolcs Nagy 16f138a49a [AArch64] Fix procfs.h not to expose stdint.h types
Commit 39e7a5a668 added stdint.h
to sys/procfs.h, but it is included into signal.h by default and
there is code that does not expect stdint.h to be visible there,
so use __uint64_t instead of uint64_t.
2017-08-29 16:54:33 +01:00
Florian Weimer 251bccfa1f iconv_open: Fix heap corruption on gconv_init failure [BZ #22026]
Also mangle the __end_fct function pointer on the error handling
path.
2017-08-29 17:33:58 +02:00
Florian Weimer e7c18b9d0a iconv: Mangle __btowc_fct even without __init_fct [BZ #22025] 2017-08-29 17:16:09 +02:00
Joseph Myers 7daada0319 Fix bits/math-finite.h _MSUF_ expansion namespace (bug 22028).
The current bits/math-finite.h approach to defining functions for
different types, involving math.h defining _MSUF_ and _MSUFTO_ for the
function suffixes involved, is not namespace-clean if one of those
suffixes (f, l, f128) is defined as a macro by the user before math.h
is included; too many levels of macro expansion occur.  Instead, those
suffixes should appear directly in the expansion of the macro using ##
so they don't get expanded even if defined as macros by the user (that
is, math.h should be defining __REDIRFROM_X and __REDIRTO_X directly
to use those suffixes rather than suffixes being passed as an argument
by macro callers).  This patch makes that change.

Tested for x86_64.

	[BZ #22028]
	* math/math.h [__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0]
	(_MSUF_): Remove macro.
	[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0] (_MSUFTO_):
	Likewise.
	[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0]
	(__REDIRFROM_X): New macro.
	[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0] (__REDIRTO_X):
	Likewise.
	* math/bits/math-finite.h (__REDIRFROM_X): Remove macro.
	(__REDIRTO_X): Likewise.
	(__MATH_REDIRCALL): Do not pass _MSUF_ or _MSUFTO_ macro
	arguments.
	(__MATH_REDIRCALL_2): Likewise.
	(__MATH_REDIRCALL_INTERNAL): Likewise.
	(__REDIRFROM (lgamma, , _MSUF_)): Likewise.
	(__REDIRFROM (gamma, , _MSUF_)): Likweise.
	(__REDIRFROM (__gamma, _r_finite, _MSUF_)): Likewise.
	(__REDIRFROM (tgamma, , _MSUF_)): Likewise.
	* math/test-finite-macros.c: New file.
	* math/Makefile (tests): Add test-finite-macros.
	(CFLAGS-test-finite-macros.c): New variable.
2017-08-29 14:15:37 +00:00
Patsy Franklin 1cf1232cd4 gconv: Consistently mangle NULL function pointers [BZ #22025]
Not mangling NULL pointers is not safe because with very low
probability, a non-NULL function pointer can turn into a NULL pointer
after mangling.
2017-08-29 15:53:28 +02:00
Akhilesh Kumar f8de9568d8 Add locale for mfe_MU
Add locale for “Morisyen” which is also called “Mauritian Creole”
and is spoken in Mauritius.

	[BZ #21971]
	* localedata/SUPPORTED: Add mfe_MU/UTF-8.
	* localedata/locales/mfe_MU: New File.

	[BZ #21971]
	* locale/iso-639.def: add Morisyen.
2017-08-29 13:56:41 +02:00
Gabriel F. T. Gomes 42496114ec Provide a C++ version of iszero that does not use __MATH_TG (bug 21930)
When signaling nans are enabled (with -fsignaling-nans), the C++ version
of iszero uses the fpclassify macro, which is defined with __MATH_TG.
However, when support for float128 is available, __MATH_TG uses the
builtin __builtin_types_compatible_p, which is only available in C mode.

This patch refactors the C++ version of iszero so that it uses function
overloading to select between the floating-point types, instead of
relying on fpclassify and __MATH_TG.

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

	[BZ #21930]
	* math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__]
	(iszero): New C++ implementation that does not use
	fpclassify/__MATH_TG/__builtin_types_compatible_p, when
	signaling nans are enabled, since __builtin_types_compatible_p
	is a C-only feature.
	* math/test-math-iszero.cc: When __HAVE_DISTINCT_FLOAT128 is
	defined, include ieee754_float128.h for access to the union and
	member ieee854_float128.ieee.
	[__HAVE_DISTINCT_FLOAT128] (do_test): Call check_float128.
	[__HAVE_DISTINCT_FLOAT128] (check_float128): New function.
	* sysdeps/powerpc/powerpc64le/Makefile [subdir == math]
	(CXXFLAGS-test-math-iszero.cc): Add -mfloat128 to the build
	options of test-math-zero on powerpc64le.
2017-08-28 15:22:37 -03:00
H.J. Lu 5e2bc4ff33 x86_64 __redirect_ieee754_expf: Change double to float
__redirect_ieee754_expf has type float, not double.

	* sysdeps/x86_64/fpu/multiarch/e_expf.c (__redirect_ieee754_expf):
	Change double to float.
2017-08-28 08:45:53 -07:00
Joseph Myers a48c0fb4b4 Simplify math-svid-compat code.
Now there are no more assembly wrappers using _LIB_VERSION or
__kernel_standard, the math-svid-compat code can be slighly
simplified.  math-svid-compat.h no longer needs __ASSEMBLER__
conditionals, and the _LIB_VERSION variable no longer needs to be
built for static libm, since all references are now in C code that
includes math-svid-compat.h and so gets the macro definition of
_LIB_VERSION to _POSIX_ outside the compat case.  This patch makes
those cleanups.

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

	* math/math-svid-compat.h [!__ASSEMBLER__]: Make code
	unconditional.
	* sysdeps/ieee754/s_lib_version.c [!defined SHARED]: Remove
	conditional code; define contents only for [LIBM_SVID_COMPAT].
2017-08-28 15:19:52 +00:00
Florian Weimer ee17d4e99a Remove abi-*-options compiler flags
These options are no longer needed since commit
2dba5ce7b8 (<bits/syscall.h>: Use an
arch-independent system call list on Linux).
2017-08-28 17:16:53 +02:00
Samuel Thibault 45a4f49ee5 hurd: Remove duplicate symbol version
* hurd/Versions (GLIBC_2.4): Remove __stack_chk_fail.
* mach/Versions (GLIBC_2.4): Remove __stack_chk_fail.
2017-08-28 14:19:55 +02:00
Florian Weimer 2dba5ce7b8 <bits/syscall.h>: Use an arch-independent system call list on Linux
This commit changes the way the list of SYS_* system call macros is
created on Linux.  glibc now contains a list of all known system
calls, and the generated <bits/syscall.h> file defines the SYS_ macro
only if the correspnding __NR_ macro is defined by the kernel headers.

As a result, glibc does not have to be rebuilt to pick up system calls
if the glibc sources already know about them.  This means that glibc
can be built with older kernel headers, and if the installed kernel
headers are upgraded afterwards, additional SYS_ macros become
available as long as glibc has a record for those system calls.
2017-08-28 11:58:52 +02:00
Paul Pluzhnikov 5f3b183d19 2017-08-27 Paul Pluzhnikov <ppluzhnikov@google.com>
* stdlib/Makefile (tst-atexit, tst-at_quick_exit): New tests.
	(tst-cxa_atexit, tst-on_exit): Likewise.
	* stdlib/Makefile (tests): Add tst-atexit, tst-at_quick_exit,
	tst-cxa_atexit, and tst-on_exit.
	* stdlib/tst-atexit-common.c: New file.
	* stdlib/tst-atexit.c: New file.
	* stdlib/tst-at_quick_exit.c: New file.
	* stdlib/tst-cxa_atexit.c: New file.
	* stdlib/tst-on_exit.c: New file.
2017-08-27 19:10:40 -07:00
Samuel Thibault 99ee4d26dc hurd: Fix static initialization with -fstack-protector-strong
When linked statically, TLS initialization is not achieved before
mach_init and alike, so ssp accesses to tcbhead's stack_guard would
crash.  We can just avoid using ssp in the few functions needed before
TLS is set up.

	* mach/Makefile (CFLAGS-mach_init.o, CFLAGS-RPC_vm_statistics.o,
	CFLAGS-RPC_vm_map.o, CFLAGS-RPC_vm_protect.o,
	CFLAGS-RPC_i386_set_gdt.o, CFLAGS-RPC_i386_set_ldt.o,
	CFLAGS-RPC_task_get_special_port.o): Add $(no-stack-protector).
	* hurd/Makefile (CFLAGS-hurdstartup.o,
	CFLAGS-RPC_exec_startup_get_info.o): Add $(no-stack-protector).
2017-08-27 22:29:43 +02:00
Samuel Thibault 97e02ad233 hurd: fix build with -fstack-protector-strong
libmachuser and libhurduser also need stack_chk_fail_local and they do not
link against libc_nonshared.

       * mach/stack_chk_fail_local.c: New file.
       * hurd/stack_chk_fail_local.c: New file.
       * mach/Machrules ($(interface-library)-routines): Add
       stack_chk_fail_local.
       * mach/Versions (GLIBC_2.4): Add __stack_chk_fail.
       * hurd/Versions (GLIBC_2.4): Add __stack_chk_fail.
2017-08-27 22:10:17 +02:00
Samuel Thibault 2ef8d46913 hurd: Add system-specific sysmacros.h
* sysdeps/mach/hurd/bits/sysmacros.h: New file.
2017-08-27 22:00:23 +02:00
H.J. Lu 7ab70c98e8 x86: Remove assembly versions of index_cpu_*/index_arch_*
Since assembly versions of HAS_CPU_FEATURE and HAS_ARCH_FEATURE have
been removed,  assembly versions of index_cpu_* and index_arch_* can
also be removed.

Tested on i686 and x86-64 with and without --disable-multi-arch.

	* sysdeps/x86/cpu-features.h [__ASSEMBLER__]
	(index_cpu_*, index_arch_*): Removed.
2017-08-25 10:51:04 -07:00
Szabolcs Nagy 39e7a5a668 [AArch64] Fix elf_greg_t on ILP32
Use uint64_t instead of unsigned long.
2017-08-25 18:21:35 +01:00
Joseph Myers a6ccdb0839 Use __HAVE_DISTINCT_FLOAT128 in tgmath.h.
When _Float128 is ABI-equivalent to long double, there is no need for
tgmath.h to have any special _Float128 handling: it's always OK to
call the long double versions of functions for _Float128 arguments in
that case, and the logic to determine return types is generic.  Thus,
this patch changes the use of __HAVE_FLOAT128 to
__HAVE_DISTINCT_FLOAT128, as a minor optimization to reduce the size
of the macro expansions in the ABI-equivalent case.

Tested for x86_64.

	* math/tgmath.h [__HAVE_FLOAT128]: Change conditional to
	[__HAVE_DISTINCT_FLOAT128].
2017-08-25 17:02:33 +00:00
Joseph Myers 23761119fe Clean up bits/math-finite.h for aliasing types.
This patch cleans up how bits/math-finite.h handles types that are
ABI-aliases of other types.

For such types, no __*_finite functions exist; instead,
bits/math-finite.h must redirect calls to a the functions for a
canonical choice of type for each floating-point format.  (For the
actual public interfaces, symbols need exporting for each type, even
those that are ABI-aliases, because of standard requirements that
programs can declare the functions themselves without including
<math.h>, but that does not apply to __*_finite.)

At present, there is a special-case conditional in bits/math-finite.h
on __MATH_DECLARING_LDOUBLE && defined __NO_LONG_DOUBLE_MATH to handle
redirecting long double function calls to double __*_finite.  This
patch replaces this by a more general mechanism.  math.h, before each
inclusion of bits/math-finite.h, defines _MSUFTO_ as the suffix to use
on the target of redirection, in addition to the existing _MSUF_.
This way, __MATH_DECLARING_LDOUBLE can go away, as can the special
conditional in bits/math-finite.h.  With this patch, math.h is now
prepared for the case of supporting float128 functions as aliases of
long double ones on platforms where long double is binary128, with
_MSUFTO_ appropriately defined for that case, and appropriate _MSUFTO_
definitions can easily be included when supporting _Float32 / _Float64
/ _Float32x / _Float64x (which will always be ABI-aliases of another
type when supported).

Tested for x86_64, and did a compilation test for ARM with
build-many-glibcs.py to cover the long double = double case.

	* math/math.h (_MSUFTO_): Define and undefine for each inclusion
	of <bits/math-finite.h>.
	(__MATH_DECLARING_LDOUBLE): Do not define and undefine for each
	inclusion of <bits/math-finite.h>.
	* math/bits/math-finite.h (__REDIRTO_X): Do not define
	conditionally on [__MATH_DECLARING_LDOUBLE && defined
	__NO_LONG_DOUBLE_MATH].
	(__MATH_REDIRCALL): Use _MSUFTO_ in __REDIRTO call.
	(__MATH_REDIRCALL_2): Likewise.
	(__MATH_REDIRCALL_INTERNAL): Likewise.
	(__REDIRFROM (lgamma, , _MSUF_)): Likewise.
	(__REDIRFROM (gamma, , _MSUF_)): Likewise.
	(__REDIRFROM (tgamma, , _MSUF_)): Likewise.
2017-08-25 16:11:13 +00:00
Joseph Myers bba5c93094 Remove powerpc32 sqrt wrappers.
This patch removes the powerpc32-specific wrappers for sqrt and sqrtf.

These wrappers, by adding architecture-specific uses of _LIB_VERSION
and __kernel_standard, unnecessarily complicate cleanups of libm error
handling.  They also do not serve a useful optimization purpose.  GCC
knows about sqrt as a built-in function, and can generate direct calls
to a hardware square root instruction, either on its own, in the
-fno-math-errno case, or together with an inline check for the
argument being negative and a call to the out-of-line sqrt function
for error handling only in that case (and has been able to do so for a
long time).  Thus in practice the wrapper will only be called only in
the case of negative arguments, which is not a case it is useful to
optimize for.

Tested with build-many-glibcs.py for powerpc-linux-gnu-power4.

	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat-power5.S:
	Remove file.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat-ppc32.S:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat-power5.S:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat-ppc32.S:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat.c:
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
	(libm-sysdep-routines): Remove w_sqrt_compat-power5,
	w_sqrt_compat-ppc32, w_sqrtf_compat-power5 and
	w_sqrtf_compat-ppc32.
2017-08-25 11:33:04 +00:00
Gabriel F. T. Gomes 3d7b66f66c Fix the C++ version of issignaling when __NO_LONG_DOUBLE_MATH is defined
When __NO_LONG_DOUBLE_MATH is defined, __issignalingl is not available,
thus issignaling with long double argument should call __issignaling,
instead.

Tested for powerpc64le.

	* math/math.h [defined __cplusplus] (issignaling): In the long
	double case, call __issignalingl only if __NO_LONG_DOUBLE_MATH
	is not defined.  Call __issignaling, otherwise.
2017-08-24 16:06:42 -03:00
Adhemerval Zanella ebd6f0076a Remove cancellation support for syscall generation
This patch removes the cancellation mark from the auto-generation syscall
script.  Now all the cancellable syscalls are done throught C code using
the SYSCALL_CANCEL macro.  It simplifies the assembly required to each
architecture port, since the SYSCALL_CANCEL uses the already defined
INLINE_SYSCALL macros, and allows a more straigh fix on cancellation
machanism (since no more specific assembly fixes will be required).

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.A
Also with build-many-glibc.py with remaning touched architectures.

	* sysdeps/unix/make-syscalls.sh: Remove cancellable tagging for
	syscall definitions.
	* sysdeps/unix/syscall-template.S (SYSCALL_CANCELLABLE): Remove
	definition.
	* sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (__local_enable_asynccancel): Likewise.
	[IS_IN (libpthread)] (__local_disable_asynccancel): Likewise.
	[IS_IN (libc)] (__local_enable_asynccancel): Likewise.
	[IS_IN (libc)] (__local_enable_asynccancel): Likewise.
	[IS_IN (librt)] (__local_disable_asynccancel): Likewise.
	[IS_IN (librt)] (__local_disable_asynccancel): Likewise.
	(CENABLE): Likewise.
	(CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (PSEUDO): Remove
	defintion.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h (PSEUDO):
	Remove definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Remove file.
	* sysdeps/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: New file.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Remove file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: New file.
	* sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
2017-08-24 14:58:35 -03:00
Szabolcs Nagy 8aa48656bb Fix CFLAGS override in sysdeps/ieee754/dbl-64
Use += instead of = to avoid overriding target specific CFLAGS settings.
Ideally the settings in target Makefiles would have precedence, but the
Makefile inclusion order does not allow that, with this fix at least the
target settings are not dropped.
2017-08-24 15:56:11 +01:00
H.J. Lu fcaaca412f x86-64: Regenerate libm-test-ulps for AVX512 mathvec tests
Update libm-test-ulps for AVX512 mathvec tests by running
“make regen-ulps” on Intel Xeon processor with AVX512.

	* sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
2017-08-23 09:11:55 -07:00
H.J. Lu 376b40a27a string/stratcliff.c: Replace int with size_t [BZ #21982]
Fix GCC 7 errors when string/stratcliff.c is compiled with -O3:

stratcliff.c: In function ‘do_test’:
cc1: error: assuming signed overflow does not occur when assuming that (X - c) <= X is always true [-Werror=strict-overflow]

	[BZ #21982]
	* string/stratcliff.c (do_test): Declare size, nchars, inner,
	middle and outer with size_t instead of int.  Repleace %d and
	%Zd with %zu in printf.  Update "MAX (0, nchars - 128)" and
	"MAX (outer, nchars - 64)" to support unsigned outer and
	nchars.  Also exit loop when outer == 0.
2017-08-23 08:23:02 -07:00
Adhemerval Zanella 2b0b9a1c85 Consolidate remaning non cancellable definitions
This patch consolidate the remaning non cancellable syscall definitions
on not-cancel.h header.  They are:

  * __fcntl_nocancel: Moved from fcntl.h to not-cancel.h.
  * __sigsuspend_nocancel: Removed since 988f991b50 it is not used or
    defined anymore.
  * __nanosleep_nocancel: Removed since 6f33fd046b it is defined on
    not-cancel.h.

Now all non-cancellable syscall definition are defined on not-cancel
(the only exceptions is the stdio symbol __fxprintf_nocancel which
uses non cancellable open and it is used on getopt implementation).

Checked on x86_64-linux-gnu and with build-many-glibc.py.

	* include/fcntl.h (__fcntl_nocancel): Remove definition.
	* include/signal.h (__sigsuspend_nocancel): Likewise.
	* include/time.h (__nanosleep_nocancel): Likewise.
	* sysdeps/generic/not-cancel.h (__fcntl_nocancel): New macro.
	* login/utmp_file.c: Include non cancellable syscall header.
	* sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): New
	prototype.
2017-08-23 10:47:03 -03:00
H.J. Lu b9eaca8fa0 x86_64: Replace AVX512F .byte sequences with instructions
Since binutils 2.25 or later is required to build glibc, we can replace
AVX512F .byte sequences with AVX512F instructions.

Tested on x86-64 and x32.  There are no code differences in libmvec.so
and libmvec.a.

	* sysdeps/x86_64/fpu/svml_d_sincos8_core.S: Replace AVX512F
	.byte sequences with AVX512F instructions.
	* sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: Likewise.
	* sysdeps/x86_64/fpu/svml_s_sincosf16_core.S: Likewise.
	* sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S:
	Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S:
	Likewise.
2017-08-23 06:26:44 -07:00
Steve Ellcey 5a706f649d aarch64: Use PTR_REG macro to fix ILP32 bug and make code consistent
* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_dynamic):
	Use PTR_REG macro in cmp instruction.
2017-08-22 16:22:05 -07:00
Gabriel F. T. Gomes b513da7e80 Fix remaining return type of ifunc resolver declaration
Since Martin Sebor's commit

commit ee4e992ebe
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Aug 22 09:35:23 2017 -0600

    Declare ifunc resolver to return a pointer to the same type as the target
    function to help GCC detect incompatibilities between the two when it's
    enhanced to do so.

builds for powerpc64le fail in the declaration of some ifunc resolvers,
because the ifunc is declared with unmatching return types.  One of the
declarations comes from the __ifunc_resolver macro, which was patched by
the aforementioned commit:

    /* Helper / base  macros for indirect function symbols.  */
    #define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
      classifier inhibit_stack_protector                                   \
      __typeof (type_name) *name##_ifunc (arg)                             \

whereas the other comes from the unpatched __ifunc macro when
HAVE_GCC_IFUNC is not defined:

    # define __ifunc(type_name, name, expr, arg, init)                     \
      extern __typeof (type_name) name;                                    \
      void *name##_ifunc (arg) __asm__ (#name);                            \

This patch changes the return type of the ifunc resolver in the __ifunc
macro, so that it matches the return type of the target function,
similarly to what the aforementioned commit does.

Tested for powerpc64le and s390x with unpatched GCC.

	* include/libc-symbols.h: [!defined HAVE_GCC_IFUNC] (__ifunc):
	Change the return type of the ifunc resolver to match the return
	type of the target function.
2017-08-22 19:08:27 -03:00
Adhemerval Zanella b70b6026a0 Remove p{read,write}{v} and fallocate from x86 auto-generation list
With {INLINE,INTERNAL}_SYSCALL macros fixed for 64-bits arguments on x32,
we can remove the p{read,write}{v} from auto-generation list.

Tested on x86_64 and x32.

	* sysdeps/unix/sysv/linux/x86_64/syscalls.list (pread64): Remove.
	(preadv64): Likewise.
	(pwrite64(: Likewise.
	(pwritev64): Likewise.
2017-08-22 17:27:18 -03:00
Adhemerval Zanella 78ca091cdd Fix {INLINE,INTERNAL}_SYSCALL macros for x32
The problem for x32 is the {INTERNAL,INLINE}_SYSCALL C macros explicit
cast the arguments to 'long int', thus passing as 32 bits arguments
that should be passed to 64 bits.

Previous x32 implementation uses the auto-generated syscalls from
assembly macros (syscalls.list), so the {INTERNAL,INLINE}_SYSCALL
macros are never used with 64 bit argument in x32 (which are
internally broken for this ILP).

To fix it I used a strategy similar to MIPS64n32 (although both
ABI differs for some syscalls on how top pass 64-bits arguments)
where argument types for kernel call are defined using GCC extension
'typeof' with a arithmetic operation.  This allows 64-bits arguments
to be defined while 32-bits argument will still passed as 32-bits.

I also cleanup the {INLINE,INTERNAL}_SYSCALL definition by defining
'inline_syscallX' instead of constructing the argument passing using
macros (it adds some readability) and removed the ununsed
INTERNAL_SYSCALL_NCS_TYPES define (since the patch idea is exactly to
avoid requiric explicit types passing).

Tested on x86_64 and x32.

	* sysdeps/unix/sysv/linux/x86_64/sysdep.h
	(INTERNAL_SYSCALL_NCS_TYPES): Remove define.
	(LOAD_ARGS_0): Likewise.
	(LOAD_ARGS_1): Likewise.
	(LOAD_ARGS_2): Likewise.
	(LOAD_ARGS_3): Likewise.
	(LOAD_ARGS_4): Likewise.
	(LOAD_ARGS_5): Likewise.
	(LOAD_ARGS_6): Likewise.
	(LOAD_REGS_0): Likewise.
	(LOAD_REGS_1): Likewise.
	(LOAD_REGS_2): Likewise.
	(LOAD_REGS_3): Likewise.
	(LOAD_REGS_4): Likewise.
	(LOAD_REGS_5): Likewise.
	(LOAD_REGS_6): Likewise.
	(ASM_ARGS_0): Likewise.
	(ASM_ARGS_1): Likewise.
	(ASM_ARGS_2): Likewise.
	(ASM_ARGS_3): Likewise.
	(ASM_ARGS_4): Likewise.
	(ASM_ARGS_5): Likewise.
	(ASM_ARGS_6): Likewise.
	(LOAD_ARGS_TYPES_1): Likewise.
	(LOAD_ARGS_TYPES_2): Likewise.
	(LOAD_ARGS_TYPES_3): Likewise.
	(LOAD_ARGS_TYPES_4): Likewise.
	(LOAD_ARGS_TYPES_5): Likewise.
	(LOAD_ARGS_TYPES_6): Likewise.
	(LOAD_REGS_TYPES_1): Likewise.
	(LOAD_REGS_TYPES_2): Likewise.
	(LOAD_REGS_TYPES_3): Likewise.
	(LOAD_REGS_TYPES_4): Likewise.
	(LOAD_REGS_TYPES_5): Likewise.
	(LOAD_REGS_TYPES_6): Likewise.
	(TYPEFY): New define.
	(ARGIFY): Likewise.
	(internal_syscall0): Likewise.
	(internal_syscall1): Likewise.
	(internal_syscall2): Likewise.
	(internal_syscall3): Likewise.
	(internal_syscall4): Likewise.
	(internal_syscall5): Likewise.
	(internal_syscall6): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/times.c
	(INTERNAL_SYSCALL_NCS): Remove define.
	(internal_syscall1): Add define.
2017-08-22 17:27:02 -03:00
Gabriel F. T. Gomes 453a493d2b Remove duplicate inclusion of header math-svid-compat.h
The header math-svid-compat.h has been unintentionally included twice in
the wrappers for the remainder functions.  This patch removes the
duplicate inclusions.

	* math/w_remainder_compat.c: Remove duplicate inclusion of
	math-svid-compat.h.
	* math/w_remainderf_compat.c: Likewise.
	* math/w_remainderl_compat.c: Likewise.
2017-08-22 15:24:37 -03:00
Gabriel F. T. Gomes f2f048a533 powerpc: Shrink ULPs for float128
During the development of float128 on powerpc64le, the ulps have been
generated since early versions of the patches.  On those versions, the
functions gamma and pow10 were mistakenly thought to be part of the API.
After review, the functions were removed, however the ulps for them were
carried in the ulps file.

This patch removes such entries from the ulps file, as well as it
shrinks the ulps for the cpow and lgamma functions.

Tested for powerpc64le.

	* sysdeps/powerpc/fpu/libm-test-ulps: Update.
2017-08-22 15:04:46 -03:00
Joseph Myers d9bef9c0a4 Fix tgmath.h handling of complex integers (bug 21684).
The tgmath.h macros return a real type not a complex type when an
argument is of complex integer type (a GNU extension) and there are no
arguments of complex floating type.  It seems clear that just as real
integers are mapped to double for tgmath.h, so complex integers should
be mapped to _Complex double.

This patch implements such a mapping.  The main complication in fixing
this bug is that the tgmath.h macros expand their arguments a large
number of times, resulting in exponential blowup of the size of the
expansion when calls to tgmath.h macros are used in the arguments of
such macros; it would be unfortunate for fixing a bug with a fairly
obscure extension to make the macros expand their arguments even more
times.  Thus, this patch optimizes the definitions of the relevant
macros.  __tgmath_real_type previously expanded its argument 7 times
and now expands it 3 times.  __tgmath_complex_type, used in place of
__tgmath_real_type only for functions that might return either real or
complex types, not for complex functions that always return real types
or always return complex types, expands its argument 5 times.  So the
sizes of the macro expansions from nested macro calls are
correspondingly reduced (remembering that each tgmath.h macro expands
__tgmath_real_type, or sometimes now __tgmath_complex_type, several
times).

Sometimes the real return type resulted from calling a complex
function and converting the result to a real type; sometimes it
resulted from calling a real function, because the logic for
determining whether arguments were real or complex, based on sizeof,
was confused by integer promotions applying to e.g. short int but not
_Complex short int.  The relevant tests are converted to use a new
macro __expr_is_real, which, by calling __builtin_classify_type rather
than comparing the results of two calls to sizeof, also reduces the
number of times macros expand their arguments.

Although there are reductions in the number of times macros expand
their arguments, I do not consider this to fix bug 21660, since a
proper fix means each macro expanding its arguments only once (via
using new compiler features designed for that purpose).

Tested for x86_64.

	[BZ #21684]
	* math/tgmath.h (__floating_type): Simplify definitions.
	(__real_integer_type): New macro.
	(__complex_integer_type): Likewise.
	(__expr_is_real): Likewise.
	(__tgmath_real_type_sub): Update comment to describe handling of
	complex types.
	(__tgmath_complex_type_sub): New macro.
	(__tgmath_complex_type): Likewise.
	[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(__TGMATH_CF128): Use __expr_is_real.
	(__TGMATH_UNARY_REAL_IMAG): Use __tgmath_complex_type and
	__expr_is_real.
	(__TGMATH_BINARY_REAL_IMAG): Likewise.
	(__TGMATH_UNARY_REAL_IMAG_RET_REAL): Use __expr_is_real.
	* math/gen-tgmath-tests.py (Type.create_type): Create complex
	integer types.
2017-08-22 17:55:42 +00:00
Adhemerval Zanella 988f991b50 Remove non cancellable sigsuspend definition
There is no current internal usage for non cancellable sigsuspend calls.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (sigsuspend_not_cancel): remove
	macro.
	* sysdeps/mach/hurd/sigsuspend.c (sigsuspend_not_cancel): remove
	alias.
	* sysdeps/unix/sysv/linux/not-cancel.h (sigsuspend_not_cancel):
	likewise.
2017-08-22 14:25:08 -03:00
Adhemerval Zanella 6f33fd046b Consolidate non cancellable nanosleep call
This patch consolidates all the non cancellable nanosleep calls to use
the __nanosleep_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Replace
	nanosleep_not_cancel with __nanosleep_nocancel.
	* sysdeps/generic/not-cancel.h (nanosleep_not_cancel): Remove macro.
	(__nanosleep_nocancel): New macro.
	* sysdeps/unix/sysv/linux/nanosleep.c (__nanosleep_nocancel): New
	function.
	* sysdeps/unix/sysv/linux/not-cancel.h (nanosleep_not_cancel): Remove
	macro.
	(__nanosleep_nocancel): New prototype.
2017-08-22 14:25:08 -03:00
Adhemerval Zanella 08d6eb46ca Consolidate non cancellable pause call
This patch consolidates all the non cancellable pause calls to use
the __pause_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full): Replace
	pause_not_cancel with __pause_nocancel.
	* sysdeps/generic/not-cancel.h (pause_not_cancel): Remove macro.
	(__pause_nocancel): New macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (pause_not_cancel): Remove
	macro.
	(__pause_nocancel): New prototype.
	* sysdeps/unix/sysv/linux/pause.c (__pause_nocancel): New function.
2017-08-22 14:25:03 -03:00
Martin Sebor ee4e992ebe Declare ifunc resolver to return a pointer to the same type as the target
function to help GCC detect incompatibilities between the two when it's
enhanced to do so.
2017-08-22 09:35:23 -06:00
H.J. Lu 20962acbea Hide internal printf functions [BZ #18822/21986]
Hide internal printf functions to allow direct access within libc.so and
libc.a without using GOT nor PLT.

Since __guess_grouping has been changed to take 2 arguments by

commit a1d84548c8
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Fri Feb 11 18:50:36 2000 +0000

the third argument passed to __guess_grouping is removed.

	[BZ #18822]
	[BZ #21986]
	* include/printf.h (__printf_fphex): Add attribute_hidden.
	(__guess_grouping): New prototype.
	* stdio-common/printf_fp.c (__guess_grouping): Removed.
	* stdio-common/reg-printf.c (__register_printf_specifier): Add
	libc_hidden_proto and libc_hidden_def.
	* stdlib/strfmon_l.c (__guess_grouping): Removed.
	(__vstrfmon_l): Remove the third argument passed to
	__guess_grouping.
2017-08-22 07:50:57 -07:00
Gabriel F. T. Gomes a16e8bc08e Provide a C++ version of issignaling that does not use __MATH_TG
The macro __MATH_TG contains the logic to select between long double and
_Float128, when these types are ABI-distinct.  This logic relies on
__builtin_types_compatible_p, which is not available in C++ mode.

On the other hand, C++ function overloading provides the means to
distinguish between the floating-point types.  The overloading
resolution will match the correct parameter regardless of type
qualifiers, i.e.: const and volatile.

Tested for powerpc64le, s390x, and x86_64.

	* math/math.h [defined __cplusplus] (issignaling): Provide a C++
	definition for issignaling that does not rely on __MATH_TG,
	since __MATH_TG uses __builtin_types_compatible_p, which is only
	available in C mode.
	(CFLAGS-test-math-issignaling.cc): New variable.
	* math/Makefile [CXX] (tests): Add test-math-issignaling.
	* math/test-math-issignaling.cc: New test for C++ implementation
	of type-generic issignaling.
	* sysdeps/powerpc/powerpc64le/Makefile [subdir == math]
	(CXXFLAGS-test-math-issignaling.cc): Add -mfloat128 to the build
	options of test-math-issignaling on powerpc64le.
2017-08-22 10:05:41 -03:00
H.J. Lu 8d2ec55329 Add hidden visibility to internal function prototypes
Add hidden visibility to internal function prototypes to allow direct
access to internal functions within libc.a without using GOT when the
compiler defaults to -fPIE.

Size comparison of elf/ldconfig when the compiler defaults to -fPIE:

On x86-64:
        text	   data	    bss	    dec	    hex
Before: 619646	  20132	   5488	 645266	  9d892
After : 619502	  20132	   5488	 645122	  9d802
On i686:
        text	   data	    bss	    dec	    hex
Before: 550333	  10748	   3060	 564141	  89bad
After : 546453	  10732	   3060	 560245	  88c75

	* include/libc-symbols.h (__hidden_proto_hiddenattr): New for
	building libc.a.
	(hidden_proto): Likewise.
	(hidden_tls_proto): Likewise.
	(__hidden_proto): Likewise.

(Reapplied after the revert in df1deda60050cc8a68156cf6c81ad42363647a29.)
2017-08-22 13:50:28 +02:00
Florian Weimer a4d57b7947 math: Statically link tests of internal functionality 2017-08-22 13:50:27 +02:00
Joseph Myers 80f91666fe Fix sparc32 bits/long-double.h (bug 21987).
My refactoring of long double information

commit 0acb8a2a85
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Dec 14 18:27:56 2016 +0000

    Refactor long double information into bits/long-double.h.

resulted in sparc32 configurations installing the ldbl-opt version of
bits/long-double.h instead of the intended
sysdeps/unix/sysv/linux/sparc version.

For sparc32 by itself, this is not a problem, since the ldbl-opt
version is correct for sparc32.  However, both sparc32 and sparc64 are
supposed to install sets of headers that work for both of them, so
that a single sysroot, whichever order the libraries are built and
installed in, works for both.  The effect of having the wrong version
installed is that you end up with a miscompiled sparc64 libstdc++
which fails glibc's configure tests for the C++ compiler.

This patch moves the header from sysdeps/unix/sysv/linux/sparc to
separate copies of the same file for sparc32 and sparc64, to ensure it
comes before ldbl-opt in the sysdeps directory ordering.

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

	[BZ #21987]
	* sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Remove file
	and copy to ...
	* sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h:
	... here.
	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h:
	... and here.
2017-08-22 00:59:43 +00:00
Joseph Myers 75dfe623df Fix position of tests-unsupported definition in assert/Makefile.
tests-unsupported has to be defined before the inclusion of Rules in a
subdirectory Makefile; otherwise it is ineffective.  This patch fixes
the ordering in assert/Makefile, where a recent test addition put
tests-unsupported too late (resulting in build failures when the C++
compiler was missing or broken, and thereby showing up the unrelated
bug 21987).

Incidentally, I don't see why these tests depend on
$(have-cxx-thread_local) rather than just a working C++ compiler.

Tested in such a configuration (broken compiler/libstdc++) with
build-many-glibcs.py.

	* assert/Makefile [$(have-cxx-thread_local)]: Move conditional
	variable definitions above inclusion of ../Rules.
2017-08-22 00:30:51 +00:00
Joseph Myers ea99fcd038 Fix GCC 7 build of k_standard.c.
This patch adds a default case to k_standard.c that calls
__builtin_unreachable, to avoid an uninitialized variable error from
GCC 7 (reported in
<https://sourceware.org/ml/libc-alpha/2017-08/msg01012.html>).

Tested for x86_64 (with GCC 7).

	* sysdeps/ieee754/k_standard.c (__kernel_standard): Add default
	case calling __builtin_unreachable.
2017-08-21 21:43:32 +00:00
Adhemerval Zanella a8410a5fc9 Consolidate non cancellable waitpid call
This patch consolidates all the non cancellable waitpid calls to use
the __waitpid_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* libio/ioopen.c (_IO_waitpid): Replace waitpid_not_cancel with
	__waitpid_nocancel.
	* sysdeps/generic/not-cancel.h (waitpid_not_cancel): Remove macro.
	(__waitpid_nocancel): New macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (waitpid_not_cancel): Remove
	macro.
	(__waitpid_nocancel): Replace macro with a function.
	* sysdeps/unix/sysv/linux/waitpid.c (__waitpid_nocancel): New
	function.
2017-08-21 15:37:45 -03:00
Adhemerval Zanella 7369800c04 Consolidate non cancellable fcntl call
This patch consolidates all the non cancellable fcntl calls to use
the __fcntl_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Since its prototype is already defined at internal fcntl.h header, it
is removed from not-cancel.h one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with
	__fcntl_nocancel.
	* sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise.
2017-08-21 15:37:45 -03:00
Adhemerval Zanella 19926de954 Consolidate non cancellable writev call
This patch consolidates all the non cancellable writev calls to use
the __writev_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* gmon/gmon.c (write_hist): Replace writev_not_cancel_no_status with
	__writev_nocancel_nostatus.
	(write_call_graph): Likewise.
	(write_bb_counts): Likewise.
	* resolv/herror.c (herror): Likewise.
	* sysdeps/generic/not-cancel.h (writev_not_cancel_no_status): Remove
	macro.
	(__writev_nocancel_nostatus): New macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (writev_not_cancel_no_status):
	Remove macro.
	(__writev_nocancel_nostatus): New function.
2017-08-21 15:37:45 -03:00
Joseph Myers df1deda600 Revert "Add hidden visibility to internal function prototypes".
The commit

commit 568ff4296c
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 21 05:50:38 2017 -0700

    Add hidden visibility to internal function prototypes

breaks the build of the testsuite for many platforms:

https://sourceware.org/ml/libc-testresults/2017-q3/msg00300.html

The errors are of the following form, building math/atest-exp:

[...]
/scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc/stdlib/rshift.o: In function `__mpn_rshift':
/scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc-src/stdlib/rshift.c:45: undefined reference to `__assert_fail'
/scratch/jmyers/glibc-bot/install/compilers/aarch64-linux-gnu/lib/gcc/aarch64-glibc-linux-gnu/7.2.1/../../../../aarch64-glibc-linux-gnu/bin/ld: /scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc/math/atest-exp: hidden symbol `__assert_fail' isn't defined
/scratch/jmyers/glibc-bot/install/compilers/aarch64-linux-gnu/lib/gcc/aarch64-glibc-linux-gnu/7.2.1/../../../../aarch64-glibc-linux-gnu/bin/ld: final link failed: Bad value

This test is using various objects from the build of libc.  Some of
those objects contain references to __assert_fail.  Because those
references are hidden, they cannot refer to __assert_fail from
libc.so.  Given the tests using internal objects those symbols in
libc.a can't safely be made hidden, so this patch reverts the problem
commit until any alternative approach that doesn't break the build can
be found.
2017-08-21 17:52:05 +00:00
Joseph Myers 831bbd5527 Remove SPARC sqrt wrappers (bug 21973).
This patch removes the SPARC-specific wrappers for sqrt and sqrtf.

These wrappers, by adding architecture-specific uses of _LIB_VERSION
and __kernel_standard, unnecessarily complicate cleanups of libm error
handling.  They also do not serve a useful optimization purpose.  GCC
knows about sqrt as a built-in function, and can generate direct calls
to a hardware square root instruction, either on its own, in the
-fno-math-errno case, or together with an inline check for the
argument being negative and a call to the out-of-line sqrt function
for error handling only in that case (and has been able to do so for a
long time).  Thus in practice the wrapper will only be called only in
the case of negative arguments, which is not a case it is useful to
optimize for.

The removal of the wrappers also uncovers, and fixes, an old bug.
32-bit SPARC libm used (checked with glibc 2.8 binaries) to have a
sqrtl compat symbol, version GLIBC_2.0, for old binaries when sqrtl
was an alias of sqrt (I don't have pre-glibc-2.4 binaries for SPARC to
hand to check for the sqrtl symbol in those).  This disappeared,
probably with:

commit 8847f03770
Author: David S. Miller <davem@davemloft.net>
Date:   Tue Feb 28 22:37:58 2012 -0800

    Add sparc optimized sqrt{,f}.

Removing the wrappers brings back the generic ldbl-opt logic for
creating such compat symbols, and so restores the compat symbol that
should be there.  This could of course also be fixed in the wrappers -
but as noted above, the wrappers are optimizing a case it's not useful
to optimize, so the bug of the missing compat symbol serves to
illustrate the risks involved with the extra complexity of
architecture-specific function versions where not needed.

Tested with build-many-glibcs.py.

	[BZ #21973]
	* sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Remove file.
	* sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S : Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Add
	GLIBC_2.0 sqrtl symbol.
2017-08-21 17:46:34 +00:00
Joseph Myers 813378e9fe Obsolete matherr, _LIB_VERSION, libieee.a.
This patch obsoletes support for SVID libm error handling (the system
where a user-defined function matherr is called on a libm function
error; only enabled if you also set _LIB_VERSION = _SVID_ or
_LIB_VERSION = _XOPEN_) and the use of the _LIB_VERSION global
variable to control libm error handling.  matherr and _LIB_VERSION are
made into compat symbols, not supported for new ports or for static
linking.  The libieee.a object file (which sets _LIB_VERSION = _IEEE_,
so disabling errno setting for some functions) is also removed, and
all the related definitions are removed from math.h.

The manual already recommends against using matherr, and it's already
not supported for _Float128 functions (those use new wrappers that
don't support matherr, only errno) - this patch means that it becomes
possible to e.g. add sinf32 as an alias to sinf without that resulting
in undesired matherr support in sinf32 for existing glibc ports.
matherr support is not part of any standard supported by glibc (it was
removed in XPG4).

Because matherr is a function to be defined by the user, of course
user programs defining such a function will still continue to link; it
just quietly won't be used.  If they try to write to the library's
copy of _LIB_VERSION to enable SVID error handling, however, they will
get a link error (but if they define their own _LIB_VERSION variable,
they won't).

I expect the most likely case of build failures from this patch to be
programs with unconditional cargo-culted uses of -lieee (based on a
notion of "I want IEEE floating point", not any actual requirement for
that library).

Ideally, the new-port-or-static-linking case would use the new
wrappers used for _Float128.  This is not implemented in this patch,
because of the complication of architecture-specific (powerpc32 and
sparc) sqrt wrappers that use _LIB_VERSION and __kernel_standard
directly.  Thus, the old wrappers and __kernel_standard are still
built unconditionally, and _LIB_VERSION still exists in static libm.
But when the old wrappers and __kernel_standard are built in the
non-compat case, _LIB_VERSION and matherr are defined as macros so
code to support those features isn't actually built into static libm
or new ports' shared libm after this patch.

I intend to move to the new wrappers for static libm and new ports in
followup patches.  I believe the sqrt wrappers for powerpc32 and sparc
can reasonably be removed.  GCC already optimizes the normal case of
sqrt by generating code that uses a hardware instruction and only
calls the sqrt function if the argument was negative (if
-fno-math-errno, of course, it just uses the hardware instruction
without any check for negative argument being needed).  Thus those
wrappers will only actually get called in the case of negative
arguments, which is not a case it makes sense to optimize for.  But
even without removing the powerpc32 and sparc wrappers it should still
be possible to move to the new wrappers for static libm and new ports,
just without having those dubious architecture-specific optimizations
in static libm.

Everything said about matherr equally applies to matherrf and matherrl
(IA64-specific, undocumented), except that the structure of IA64 libm
means it won't be converted to using the new wrappers (it doesn't use
the old ones either, but its own error-handling code instead).

As with other tests of compat symbols, I expect test-matherr and
test-matherr-2 to need to become appropriately conditional once we
have a system for disabling such tests for ports too new to have the
relevant symbols.

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

	* math/math.h [__USE_MISC] (_LIB_VERSION_TYPE): Remove.
	[__USE_MISC] (_LIB_VERSION): Likewise.
	[__USE_MISC] (struct exception): Likewise.
	[__USE_MISC] (matherr): Likewise.
	[__USE_MISC] (DOMAIN): Likewise.
	[__USE_MISC] (SING): Likewise.
	[__USE_MISC] (OVERFLOW): Likewise.
	[__USE_MISC] (UNDERFLOW): Likewise.
	[__USE_MISC] (TLOSS): Likewise.
	[__USE_MISC] (PLOSS): Likewise.
	[__USE_MISC] (HUGE): Likewise.
	[__USE_XOPEN] (MAXFLOAT): Define even if [__USE_MISC].
	* math/math-svid-compat.h: New file.
	* conform/linknamespace.pl (@whitelist): Remove matherr, matherrf
	and matherrl.
	* include/math.h [!_ISOMAC] (__matherr): Remove.
	* manual/arith.texi (FP Exceptions): Do not document matherr.
	* math/Makefile (tests): Change test-matherr to test-matherr-3.
	(tests-internal): New variable.
	(install-lib): Do not add libieee.a.
	(non-lib.a): Likewise.
	(extra-objs): Do not add libieee.a and ieee-math.o.
	(CPPFLAGS-s_lib_version.c): Remove variable.
	($(objpfx)libieee.a): Remove rule.
	($(addprefix $(objpfx), $(tests-internal)): Depend on $(libm).
	* math/ieee-math.c: Remove.
	* math/libm-test-support.c (matherr): Remove.
	* math/test-matherr.c: Use <support/test-driver.c>.  Add copyright
	and license notices.  Include <math-svid-compat.h> and
	<shlib-compat.h>.
	(matherr): Undefine as macro.  Use compat_symbol_reference.
	(_LIB_VERSION): Likewise.
	* math/test-matherr-2.c: New file.
	* math/test-matherr-3.c: Likewise.
	* sysdeps/generic/math_private.h (__kernel_standard): Remove
	declaration.
	(__kernel_standard_f): Likewise.
	(__kernel_standard_l): Likewise.
	* sysdeps/ieee754/s_lib_version.c: Do not include <math.h> or
	<math_private.h>.  Include <math-svid-compat.h>.
	(_LIB_VERSION): Undefine as macro.
	(_LIB_VERSION_INTERNAL): Always initialize to _POSIX_.  Define
	only if [LIBM_SVID_COMPAT || !defined SHARED].  If
	[LIBM_SVID_COMPAT], use compat_symbol.
	* sysdeps/ieee754/s_matherr.c: Do not include <math.h> or
	<math_private.h>.  Include <math-svid-compat.h>.
	(matherr): Undefine as macro.
	(__matherr): Define only if [LIBM_SVID_COMPAT].  Use
	compat_symbol.
	* sysdeps/ia64/fpu/libm_error.c: Include <math-svid-compat.h>.
	[_LIBC && LIBM_SVID_COMPAT] (matherrf): Use
	compat_symbol_reference.
	[_LIBC && LIBM_SVID_COMPAT] (matherrl): Likewise.
	[_LIBC && !LIBM_SVID_COMPAT] (matherrf): Define as macro.
	[_LIBC && !LIBM_SVID_COMPAT] (matherrl): Likewise.
	* sysdeps/ia64/fpu/libm_support.h: Include <math-svid-compat.h>.
	(MATHERR_D): Remove declaration.
	[!_LIBC] (_LIB_VERSION_TYPE): Likewise
	[!LIBM_BUILD] (_LIB_VERSIONIMF): Likewise.
	[LIBM_BUILD] (pmatherrf): Likewise.
	[LIBM_BUILD] (pmatherr): Likewise.
	[LIBM_BUILD] (pmatherrl): Likewise.
	(DOMAIN): Likewise.
	(SING): Likewise.
	(OVERFLOW): Likewise.
	(UNDERFLOW): Likewise.
	(TLOSS): Likewise.
	(PLOSS): Likewise.
	* sysdeps/ia64/fpu/s_matherrf.c: Include <math-svid-compat.h>.
	(__matherrf): Define only if [LIBM_SVID_COMPAT].  Use
	compat_symbol.
	* sysdeps/ia64/fpu/s_matherrl.c: Include <math-svid-compat.h>.
	(__matherrl): Define only if [LIBM_SVID_COMPAT].  Use
	compat_symbol.
	* math/lgamma-compat.h: Include <math-svid-compat.h>.
	* math/w_acos_compat.c: Likewise.
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosh_compat.c: Likewise.
	* math/w_acoshf_compat.c: Likewise.
	* math/w_acoshl_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_atan2_compat.c: Likewise.
	* math/w_atan2f_compat.c: Likewise.
	* math/w_atan2l_compat.c: Likewise.
	* math/w_atanh_compat.c: Likewise.
	* math/w_atanhf_compat.c: Likewise.
	* math/w_atanhl_compat.c: Likewise.
	* math/w_cosh_compat.c: Likewise.
	* math/w_coshf_compat.c: Likewise.
	* math/w_coshl_compat.c: Likewise.
	* math/w_exp10_compat.c: Likewise.
	* math/w_exp10f_compat.c: Likewise.
	* math/w_exp10l_compat.c: Likewise.
	* math/w_exp2_compat.c: Likewise.
	* math/w_exp2f_compat.c: Likewise.
	* math/w_exp2l_compat.c: Likewise.
	* math/w_fmod_compat.c: Likewise.
	* math/w_fmodf_compat.c: Likewise.
	* math/w_fmodl_compat.c: Likewise.
	* math/w_hypot_compat.c: Likewise.
	* math/w_hypotf_compat.c: Likewise.
	* math/w_hypotl_compat.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_jnl_compat.c: Likewise.
	* math/w_lgamma_main.c: Likewise.
	* math/w_lgamma_r_compat.c: Likewise.
	* math/w_lgammaf_main.c: Likewise.
	* math/w_lgammaf_r_compat.c: Likewise.
	* math/w_lgammal_main.c: Likewise.
	* math/w_lgammal_r_compat.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* math/w_pow_compat.c: Likewise.
	* math/w_powf_compat.c: Likewise.
	* math/w_powl_compat.c: Likewise.
	* math/w_remainder_compat.c: Likewise.
	* math/w_remainderf_compat.c: Likewise.
	* math/w_remainderl_compat.c: Likewise.
	* math/w_scalb_compat.c: Likewise.
	* math/w_scalbf_compat.c: Likewise.
	* math/w_scalbl_compat.c: Likewise.
	* math/w_sinh_compat.c: Likewise.
	* math/w_sinhf_compat.c: Likewise.
	* math/w_sinhl_compat.c: Likewise.
	* math/w_sqrt_compat.c: Likewise.
	* math/w_sqrtf_compat.c: Likewise.
	* math/w_sqrtl_compat.c: Likewise.
	* math/w_tgamma_compat.c: Likewise.
	* math/w_tgammaf_compat.c: Likewise.
	* math/w_tgammal_compat.c: Likewise.
	* sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise.
	* sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
	* sysdeps/ieee754/k_standard.c: Likewise.
	* sysdeps/ieee754/k_standardf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
2017-08-21 17:45:10 +00:00
Florian Weimer 4504783c0f benchtests: Do not compile benchmark objects as libc modules [BZ #21864]
Otherwise, this will lead to link failures due to hidden symbol
references.
2017-08-21 19:28:54 +02:00
Florian Weimer b5889d25e9 assert: Support types without operator== (int) [BZ #21972] 2017-08-21 15:33:11 +02:00
H.J. Lu 41e673c1e7 x86-64: Mark internal symbols with attribute_hidden [BZ #18822]
Since __syscall_clock_gettime and __start_context are internal symbols
for Linux/x86-64, mark them with attribute_hidden.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/x86_64/init-first.c
	(__syscall_clock_gettime): Add attribute_hidden.
	* sysdeps/unix/sysv/linux/x86_64/makecontext.c
	(__start_context): Likewise.
2017-08-21 05:58:53 -07:00
H.J. Lu 568ff4296c Add hidden visibility to internal function prototypes
Add hidden visibility to internal function prototypes to allow direct
access to internal functions within libc.a without using GOT when the
compiler defaults to -fPIE.

Size comparison of elf/ldconfig when the compiler defaults to -fPIE:

On x86-64:
        text	   data	    bss	    dec	    hex
Before: 619646	  20132	   5488	 645266	  9d892
After : 619502	  20132	   5488	 645122	  9d802
On i686:
        text	   data	    bss	    dec	    hex
Before: 550333	  10748	   3060	 564141	  89bad
After : 546453	  10732	   3060	 560245	  88c75

	* include/libc-symbols.h (__hidden_proto_hiddenattr): New for
	building libc.a.
	(hidden_proto): Likewise.
	(hidden_tls_proto): Likewise.
	(__hidden_proto): Likewise.
2017-08-21 05:50:52 -07:00
H.J. Lu 7c41b4a131 Enable hidden visibility in libc.a compiled with PIE
When building libc.a with PIE, enable hidden visibility to allow direct
access to definitions within libc.a without using GOT.

Size comparison of elf/ldconfig when the compiler defaults to -fPIE:

On x86-64:
        text	   data	    bss	    dec	    hex
Before: 619206	  20132	   5488	 644826	  9d6da
After : 619062	  20132	   5488	 644682	  9d64a
On i686:
        text	   data	    bss	    dec	    hex
Before: 556305	  10816	   3056	 570177	  8b341
After : 553688	  10756	   3056	 567500	  8a8cc

	* include/libc-symbols.h (attribute_hidden): Enable hidden
	visibility in libc.a compiled with PIE.
2017-08-21 05:47:27 -07:00
H.J. Lu 483d706879 x86: Mark VDSO_SYMBOL(getcpu) with attribute_hidden [BZ #18822]
VDSO_SYMBOL(getcpu) is defined as hidden in Linux/x86_64 init-first.c
and unused for Linux/i386.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/x86/libc-vdso.h (VDSO_SYMBOL(getcpu)):
	Add attribute_hidden.
2017-08-21 05:40:45 -07:00
H.J. Lu 54e4b8f215 Mark __libc_multiple_libcs with attribute_hidden [BZ #18822]
Since __libc_multiple_libcs is defined as hidden symbol in init-first.c,
it should be always marked with attribute_hidden.

	[BZ #18822]
	* csu/libc-start.c (__libc_multiple_libcs): Removed.
	* elf/dl-open.c: Include <libc-internal.h>.
	(__libc_multiple_libcs): Removed.
	* elf/dl-sysdep.c: Include <libc-internal.h> instead of
	<hp-timing.h>.
	* include/libc-internal.h (__libc_multiple_libcs): New.
	* misc/sbrk.c: Include <libc-internal.h>.
	(__libc_multiple_libcs): Removed.
2017-08-21 05:32:39 -07:00
H.J. Lu 1dbbb1ec7a Mark internal nss symbols with attribute_hidden [BZ #18822]
Mark internal nss symbols with attribute_hidden to allow direct access
within libc.so and libc.a without using GOT nor PLT.

Tested on x86-64 with and without --disable-nscd.

	[BZ #18822]
	* grp/initgroups.c (__nss_group_database): Removed.
	(__nss_initgroups_database): Likewise.
	* nscd/gai.c (__nss_hosts_database): Likewise.
	* nss/XXX-lookup.c (DATABASE_NAME_SYMBOL): Likewise.
	* posix/tst-rfc3484-2.c (__nss_hosts_database): Likewise.
	* posix/tst-rfc3484-3.c (__nss_hosts_database): Likewise.
	* posix/tst-rfc3484.c (__nss_hosts_database): Likewise.
	* sysdeps/posix/getaddrinfo.c (__nss_hosts_database): Likewise.
	* nss/getXXent.c (INTERNAL (REENTRANT_GETNAME)): Add
	attribute_hidden.
	* nss/nsswitch.c (__nss_database_custom): Define only if
	USE_NSCD is defined.
	(__nss_configure_lookup): Use __nss_database_custom only if
	USE_NSCD is defined.
	* nss/nsswitch.h (__nss_database_custom): Declare only if
	USE_NSCD is defined.  Add attribute_hidden.
	(__nss_setent): Add attribute_hidden.
	(__nss_endent): Likewise.
	(__nss_getent_r): Likewise.
	(__nss_getent): Likewise.
	(DEFINE_DATABASE): Declare __nss_##arg##_database.
2017-08-21 05:31:19 -07:00
H.J. Lu 2585d7b839 i386: Hide __old_glob64 [BZ #18822]
Hide internal __old_glob64 function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/i386/glob64.c (__old_glob64): Add
	libc_hidden_proto and libc_hidden_def.
2017-08-20 10:47:02 -07:00
H.J. Lu c8dfa99c98 i386: Hide __old_readdir64 [BZ #18822]
Hide internal __old_readdir64 function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/i386/olddirent.h (__old_readdir64):
	Add libc_hidden_proto.
	* sysdeps/unix/sysv/linux/i386/readdir64.c (__old_readdir64):
	Add libc_hidden_def.
2017-08-20 10:46:11 -07:00
H.J. Lu 91695eb14c Remove sysdeps/alpha/bb_init_func.S
Since the generic __bb_init_func has been removed by commit 7ed87317c7,
there is no need for sysdeps/alpha/bb_init_func.S.

	[BZ #21974]
	* sysdeps/alpha/bb_init_func.S: Removed.
2017-08-20 06:51:15 -07:00
H.J. Lu 9476b90470 Update ChangeLog 2017-08-20 06:45:25 -07:00
H.J. Lu 7ed87317c7 Remove __bb_init_func and __bb_exit_func [BZ #21974]
__bb_init_func and __bb_exit_func have been removed from GCC 3.3 in
2002 by

https://gcc.gnu.org/ml/gcc-patches/2002-09/msg00499.html

which also recommended that they should also be removed from glibc. These
functions exist only in libc.a and are used for gcov from versions of GCC
older than GCC 3.3.

	[BZ #21974]
	* gmon/Makefile (routines): Remove bb_init_func and
	bb_exit_func.
	(elide-routines.os): Removed.
	* include/sys/gmon.h (__bb): Likewise.
	(__bb_init_func): Likewise.
	(__bb_exit_func): Likewise.
2017-08-20 06:39:31 -07:00
H.J. Lu 94e6ba153b Move ____longjmp_chk prototype to include/setjmp.h
Move ____longjmp_chk prototype to include/setjmp.h and add
attribute_hidden.

	* debug/longjmp_chk.c (____longjmp_chk): Moved to ...
	* include/setjmp.h (____longjmp_chk): Here.  Add
	attribute_hidden.
2017-08-20 06:30:46 -07:00
H.J. Lu 7550717ed7 Mark internal SSE2 functions with attribute_hidden [BZ #18822]
Mark internal SSE2 functions with attribute_hidden to allow direct
access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/x86_64/multiarch/strcspn-c.c (STRCSPN_SSE2): Add
	attribute_hidden.
	(__strspn_sse2): Likewise.
2017-08-19 16:46:53 -07:00
Adhemerval Zanella c181840c93 Consolidate non cancellable close call
This patch consolidates all the non cancellable close calls to use
the __close_nocancel{_nostatus} identifier.  For non cancellable targets
it will be just a macro to call the default respective symbol while on Linux
will be a internal one.

Also, since it is used on libcrypto it is also exported in GLIBC_PRIVATE
namespace.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (close_not_cancel): Remove macro.
	(close_not_cancel_no_status): Likewise.
	(__close_nocancel): New macro.
	(__close_nocancel_no_status): Likewise.
	* sysdeps/unix/sysv/linux/not-cancel.h (__close_nocancel): Remove
	macro.
	(close_not_cancel): Likewise.
	(close_not_cancel_no_status): Likewise.
	(__close_nocancel): New prototype.
	(__close_nocancel_no_status): New function.
	* sysdeps/unix/sysv/linux/close.c (__close_nocancel): New function.
	* catgets/open_catalog.c (__open_catalog): Replace
	close_not_cancel{_no_status) with __close_nocancel{_nostatus}.
	* gmon/gmon.c (write_gmon): Likewise.
	* iconv/gconv_cache.c (__gconv_load_cache): Likewise.
	* intl/loadmsgcat.c (close): Likewise.
	* io/ftw.c (open_dir_stream): Likewise.
	(ftw_startup): Likewise.
	* libio/fileops.c (_IO_file_open): Likewise.
	(_IO_file_close_mmap): Likewise.
	(_IO_file_close): Likewise.
	* libio/iopopen.c (_IO_dup2): Likewise.
	* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
	* locale/loadlocale.c (_nl_load_locale): Likewise.
	* login/utmp_file.c (pututline_file): Likewise.
	(endutent_file): Likewise.
	* misc/daemon.c (daemon): Likewise.
	* nscd/nscd_getai.c (__nscd_getai): Likewise.
	* nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
	* nscd/nscd_gethst_r.c (nscd_gethst_r): Likewise.
	* nscd/nscd_getpw_r.c (nscd_getpw_r): Likewise.
	* nscd/nscd_getserv_r.c (nscd_getserv_r): Likewise.
	* nscd/nscd_helper.c (open_socket): Likewise.
	(__nscd_open_socket): Likewise.
	* nscd/nscd_initgroups.c (__nscd_getgrouplist): Likewise.
	* nscd/nscd_netgroup.c (__nscd_setnetgrent): Likewise.
	(__nscd_innetgr): Likewise.
	* nss/nss_db/db-open.c (internal_setent): Likewise.
	* resolv/res-close.c (__res_iclose): Likewise.
	* sunrpc/pm_getmaps.c (pmap_getmaps): Likewise.
	* sysdeps/posix/closedir.c (__closedir): Likewise.
	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
	* sysdeps/posix/opendir.c (tryopen_o_directory): Likewise.
	(opendir_tail): Likewise.
	* sysdeps/posix/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/check_native.c (__check_native): Likewise.
	* sysdeps/unix/sysv/linux/check_pf.c (__check_pf): Likewise.
	* sysdeps/unix/sysv/linux/fips-private.h (fips_enabled_p): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
	(gethostid): Likewise.
	* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
	Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Likewise.
	* sysdeps/unix/sysv/linux/grantpt.c (close_all_fds): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
	Likewise.
	* sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps): Likewise.
	* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
	Likewise.
	* sysdeps/unix/sysv/linux/mq_notify.c (init_mq_netlink): Likewise.
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.
2017-08-18 18:38:55 -03:00
Adhemerval Zanella 0bb2fabcb3 Consolidate non cancellable openat call
This patch consolidates all the non cancellable openat{64} calls to use
the __openat{64}_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (openat_not_cancel): Remove macro.
	(openat_not_cancel_3): Likewise.
	(openat64_not_cancel_3): Likewise).
	(openat_not_cancel_3): Likewise).
	* sysdeps/unix/sysv/linux/not-cancel.h (openat_not_cancel): Remove
	macro.
	(openat_not_cancel_3): Likewise.
	(openat64_not_cancel): Likewise.
	(openat64_not_cancel_3): Likewise.
	* sysdeps/unix/sysv/linux/openat.c (__openat_nocancel): New function.
	* sysdeps/unix/sysv/linux/openat64.c (__openat64_nocancel): Likewise.
	* io/ftw.c (open_dir_stream): Replace openat{64}_not_cancel{_3} with
	__open{64}_nocancel.
	* sysdeps/mach/hurd/opendir.c (__opendirat): Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
	* sysdeps/posix/opendir.c (__opendirat): Likewise.
2017-08-18 16:30:05 -03:00
H.J. Lu 65a086db91 Mark internal argz functions with attribute_hidden [BZ #18822]
Move internal argz function prototypes to include/argz.h and mark them
with attribute_hidden to allow direct access within libc.so and libc.a
without using GOT nor PLT.  This also brings string/argz.h closer to the
gnulib version.

	[BZ #18822]
	* include/argz.h (__argz_create_sep): New function prototype.
	(__argz_append): Likewise.
	(__argz_add): Likewise.
	(__argz_add_sep): Likewise.
	(__argz_delete): Likewise.
	(__argz_insert): Likewise.
	(__argz_replace): Likewise.
	* string/argz.h (__argz_create_sep): Removed.
	(__argz_append): Likewise.
	(__argz_add): Likewise.
	(__argz_add_sep): Likewise.
	(__argz_delete): Likewise.
	(__argz_insert): Likewise.
	(__argz_replace): Likewise.
2017-08-18 09:31:33 -07:00
H.J. Lu 62753d2c09 Add NT_GNU_PROPERTY_TYPE_0 macros
Add macros used in GNU .note.gnu.property notes (NT_GNU_PROPERTY_TYPE_0).

	* elf/elf.h (NT_GNU_PROPERTY_TYPE_0): New.
	(NOTE_GNU_PROPERTY_SECTION_NAME): Likewise.
	(GNU_PROPERTY_STACK_SIZE): Likewie.
	(GNU_PROPERTY_NO_COPY_ON_PROTECTED): Likewie.
	(GNU_PROPERTY_LOPROC): Likewise.
	(GNU_PROPERTY_HIPROC): Likewise.
	(GNU_PROPERTY_LOUSER): Likewise.
	(GNU_PROPERTY_HIUSER): Likewise.
	(GNU_PROPERTY_X86_ISA_1_USED): Likwise.
	(GNU_PROPERTY_X86_ISA_1_NEEDED): Likwise.
	(GNU_PROPERTY_X86_FEATURE_1_AND): Likwise.
	(GNU_PROPERTY_X86_ISA_1_486): Likwise.
	(GNU_PROPERTY_X86_ISA_1_586): Likwise.
	(GNU_PROPERTY_X86_ISA_1_686): Likwise.
	(GNU_PROPERTY_X86_ISA_1_SSE): Likwise.
	(GNU_PROPERTY_X86_ISA_1_SSE2): Likwise.
	(GNU_PROPERTY_X86_ISA_1_SSE3): Likwise.
	(GNU_PROPERTY_X86_ISA_1_SSSE3): Likwise.
	(GNU_PROPERTY_X86_ISA_1_SSE4_1): Likwise.
	(GNU_PROPERTY_X86_ISA_1_SSE4_2): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX2): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX512F): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX512CD): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX512ER): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX512PF): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX512VL): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX512DQ): Likwise.
	(GNU_PROPERTY_X86_ISA_1_AVX512BW): Likwise.
	(GNU_PROPERTY_X86_FEATURE_1_IBT): Likwise.
	(GNU_PROPERTY_X86_FEATURE_1_SHSTK): Likwise.
2017-08-18 08:50:42 -07:00
Gabriel F. T. Gomes 6913ad65e0 Do not use generic selection in C++ mode
The logic to protect the use of generic selection (_Generic) does not
check for C or C++ mode, however, generic selection is a C-only
feature.

Tested for powerpc64le.

	* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
	in C++ mode.
2017-08-18 12:19:28 -03:00
Gabriel F. T. Gomes 47a67213a9 Do not use __builtin_types_compatible_p in C++ mode (bug 21930)
The logic to define isinf for float128 depends on the availability of
__builtin_types_compatible_p, which is only available in C mode,
however, the conditionals do not check for C or C++ mode.  This lead to
an error in libstdc++ configure, as reported by bug 21930.

This patch adds a conditional for C mode in the definition of isinf for
float128.  No definition is provided in C++ mode, since libstdc++
headers undefine isinf.

Tested for powerpc64le (glibc test suite and libstdc++-v3 configure).

	[BZ #21930]
	* math/math.h (isinf): Check if in C or C++ mode before using
	__builtin_types_compatible_p, since this is a C mode feature.
2017-08-18 12:18:36 -03:00
Adhemerval Zanella c647fb885c Consolidate non cancellable write call
This patch consolidates all the non cancellable write calls to use
the __write_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (write_not_cancel): Remove macro.
	(__write_nocancel): New macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (__write_nocancel):
	Rewrite as a function prototype.
	(write_not_cancel): Remove macro.
	* sysdeps/unix/sysv/linux/write.c (__write_nocancel): New function.
	* gmon/gmon.c (ERR): Replace write_not_cancel with __write_nocancel.
	(write_gmon): Likewise.
	* libio/fileops.c (_IO_new_file_write): Likewise.
	* login/utmp_file.c (pututline_file): Likewise.
	(updwtmp_file): Likewise.
	* stdio-common/psiginfo.c (psiginfo): Likewise.
	* sysdeps/posix/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
	Likewise.
2017-08-18 10:53:47 -03:00
Adhemerval Zanella a748eb31c1 Consolidate non cancellable read call
This patch consolidates all the non cancellable read calls to use
the __read_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Also, since it is used on libcrypto it is also exported in GLIBC_PRIVATE
namespace.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (read_not_cancel): Remove macro.
	(__read_nocancel): New macro.
	* sysdeps/unix/sysv/linux/Versions (libc) [GLIBC_PRIVATE]: Add
	__read_nocancel.
	* sysdeps/unix/sysv/linux/not-cancel.h (__read_nocancel): Remove
	macro.
	(__read_nocancel): New prototype.
	* sysdeps/unix/sysv/linux/read.c (__read_nocancel): New function.
	* catgets/open_catalog.c (__open_catalog): Replace read_not_cancel
	with __read_nocancel.
	* intl/loadmsgcat.c (read): Likewise.
	* libio/fileops.c (_IO_file_read): Likewise.
	* locale/loadlocale.c (_nl_load_locale): Likewise.
	* login/utmp_file.c (getutent_r_file): Likewise.
	(internal_getut_r): Likewise.
	(getutline_r_file): Likewise.
	* sysdeps/unix/sysv/linux/fips-private.h (fips_enable_p): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (gethostid): Likewise.
	* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
	Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c (next_line): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
	Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
	Likewise.
	* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.
2017-08-18 10:31:16 -03:00
H.J. Lu 098b9dd468 x86-64: Check FMA_Usable in ifunc-mathvec-avx2.h [BZ #21966]
Since the AVX2 version of mathvec functions uses FMA, it can only be
used when FMA is usable.

	[BZ #21966]
	* sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h
	(IFUNC_SELECTOR): Don't use the AVX2 version if FMA isn't
	usable.
2017-08-18 06:19:07 -07:00
DJ Delorie a3fe6a20bf Update nss tests to new skeleton
* bug17079.c: Update to new test harness.
* test-digits-dots.c: Likewise.
* test-netdb.c: Likewise.
* tst-field.c: Likewise.
* tst-nss-getpwent.c: Likewise.
* tst-nss-static.c: Likewise.
* tst-nss-test1.c: Likewise.
* tst-nss-test2.c: Likewise.
* tst-nss-test3.c: Likewise.
* tst-nss-test4.c: Likewise.
* tst-nss-test5.c: Likewise.
2017-08-17 18:00:51 -04:00
Adhemerval Zanella c22845744c Consolidate non cancellable open call
This patch consolidates all the non cancellable open calls to use
the __open_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

To be consistent with the following non cancellable openat call, a
new __open64_nocancel is also added (although not currently used).

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (open_not_cancel): Remove macro.
	(open_not_cancel_2): Likewise.
	(open_nocancel): New macro.
	(open64_nocancel): Likewise.
	* sysdeps/unix/sysv/linux/not-cancel.h (open_not_cancel): Remove macro.
	(open_not_cancel_2): Likewise.
	(__open_nocancel): New prototype.
	(__open64_nocancel): Likewise.
	* sysdeps/unix/sysv/linux/Versions (libc) [GLIBC_PRIVATE]: Add
	__open_nocancel.
	* sysdeps/unix/sysv/linux/open.c (__open_nocancel): New function.
	* sysdeps/unix/sysv/linux/open64.c (__open64_nocancel): Likewise.
	* catgets/open_catalog.c (__open_catalog): Replace open_not_cancel{_2}
	with __open_nocancel.
	* csu/check_fds.c (check_one_fd): Likewise.
	* gmon/gmon.c (write_gmon): Likewise.
	* iconv/gconv_cache.c (__gconv_load_cached): Likewise.
	* intl/loadmsgcat.c (open): Likewise.
	* libio/fileops.c (_IO_file_open): Likewise.
	* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
	* locale/loadlocale.c (_nl_load_locale): Likewise.
	* login/utmp_file.c (setutent_file): Likewise.
	* misc/daemon.c (daemon): Likewise.
	* nss/nss_db/db-open.c (internal_setent): Likewise.
	* sysdeps/mach/hurd/opendir.c (__opendirat): Likewise.
	* sysdeps/posix/libc_fatal.c (__libc_message): Likewise.
	* sysdeps/posix/opendir.c (tryopen_o_directory): Likewise.
	(__opendir): Likewise.
	* sysdeps/posix/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/fips-private.h (fips_enable_p): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
	(gethostid): Likewise.
	* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
	Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Likewise.
	* sysdeps/unix/sysv/linux/grantpt.c (__close_all_fds): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
	Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
	Likewise.
	* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c (__get_clockfreq):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.
2017-08-17 16:50:35 -03:00
Wilco Dijkstra d4505b895f Add math benchmark latency test
This patch further improves math function benchmarking by adding a latency
test in addition to throughput.  This enables more accurate comparisons of the
math functions. The latency test works by creating a dependency on the previous
iteration: func_res = F (func_res * zero + input[i]). The multiply by zero
avoids changing the input.

It reports reciprocal throughput and latency in nanoseconds (depending on the
timing header used) and max/min throughput in iterations per second:

   "workload-spec2006.wrf": {
    "reciprocal-throughput": 100,
    "latency": 200,
    "max-throughput": 1.0e+07,
    "min-throughput": 5.0e+06
   }

	* benchtests/bench-skeleton.c (main): Add support for
	latency benchmarking.
	* benchtests/scripts/bench.py: Add support for latency benchmarking.
2017-08-17 16:27:20 +01:00
H.J. Lu 34d6a3cbf2 Support mcount/gprof test with GCC defaulting to PIE
The mcount/gprof test should be linked with gcrt1.o, not Scrt1.o.

	* Makeconfig (+link-pie-before-libc): Add CRT-* hook to override
	the startup object.
2017-08-17 04:56:01 -07:00
Florian Weimer 038d1cafaf __opensock: Remove internal_function attribute 2017-08-17 10:18:15 +02:00
Joseph Myers 67f0aff0c6 Fix sigval namespace (bug 21944).
XPG4.2 defines the siginfo_t type, but not union sigval or its
contents (which were added in the 1993 edition of POSIX.1), resulting
in namespace violations for sigval, sival_int and sival_ptr for
signal.h and sys/wait.h for that standard because those headers
incorrectly expose those names in that case.

This patch fixes this problem.  The public type in this case is union
sigval, but various places in the headers use the sigval_t name for
it; direct uses of union sigval are already properly guarded or in
headers not in XPG4.2.  Now, sigval_t, although not a standard name,
does seem to be widely used outside glibc.  The approach taken by this
patch is to make installed headers use the name __sigval_t instead.
__sigval_t is then defined to either union sigval or union __sigval
(where union __sigval has __-prefixed member names as well), depending
on whether there are any namespace issues with the union sigval name
and its members.  In the case where union __sigval is used, sigval_t
is not defined at all, to avoid the problem of sigval_t having a C++
mangled name that depends on feature test macros.  sigval_t is still
defined by signal.h if __USE_MISC (reflecting the nonstandard nature
of that name).

Tested for x86_64.

	[BZ #21944]
	* signal/bits/types/__sigval_t.h: New file.
	* signal/Makefile (headers): Add bits/types/__sigval_t.h.
	* signal/bits/types/sigval_t.h: Include <bits/types/__sigval_t.h>
	and define sigval_t using __sigval_t.
	* include/bits/types/__sigval_t.h: New file.
	* bits/types/sigevent_t.h: Include <bits/types/__sigval_t.h>
	instead of <bits/types/__sigval_t.h>.
	(struct sigevent): Use __sigval_t instead of sigval_t.
	* bits/types/siginfo_t.h: Include <bits/types/__sigval_t.h>
	instead of <bits/types/__sigval_t.h>.
	(siginfo_t): Use __sigval_t instead of sigval_t.
	* sysdeps/unix/sysv/linux/bits/types/sigevent_t.h: Include
	<bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>.
	(struct sigevent): Use __sigval_t instead of sigval_t.
	* sysdeps/unix/sysv/linux/bits/types/siginfo_t.h: Include
	<bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>.
	(siginfo_t): Use __sigval_t instead of sigval_t.
	* signal/signal.h [__USE_MISC]: Include <bits/types/sigval_t.h>.
2017-08-16 20:33:59 +00:00
H.J. Lu 87e7bf4d36 Remove "[Add new features here]" for 2.27
* NEWS: Remove "[Add new features here]" for 2.27.
2017-08-16 11:05:55 -07:00
Joseph Myers 5047057ffa Allow abort PLT references in libc.so for SH.
Given my patch
<https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00965.html> for the
ICEs building a glibc string function test for SH, the testsuite can
build completely for SH with GCC 7 and mainline.  However, there is a
test failure that does not appear for GCC 6: check-localplt fails
because of an abort PLT reference in libc.so.

Given the lack of a trap insn pattern for SH, it seems unavoidable
that the compiler might sometimes generate abort calls, and such abort
calls (generated from __builtin_trap when there is no trap insn
pattern) will be unaffected by the normal mapping to __GI_abort for
calls within glibc.  Thus, this patch allows (but does not require) an
abort PLT reference in libc.so for SH.

Tested for sh4-linux-gnu with build-many-glibcs.py (GCC 7, with my
patch applied).

	* sysdeps/unix/sysv/linux/sh/localplt.data: Allow abort in
	libc.so.
2017-08-16 17:01:27 +00:00
H.J. Lu 20c7b195d0 Mention x86-64 FMA optimization in NEWS
* NEWS: Mention x86-64 FMA optimization.
2017-08-16 09:17:49 -07:00
H.J. Lu 24a2e6588d x86-64: Optimize e_expf with FMA [BZ #21912]
FMA optimized e_expf improves performance by more than 50% on Skylake.

	[BZ #21912]
	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
	Add e_expf-fma.
	* sysdeps/x86_64/fpu/multiarch/e_expf-fma.S: New file.
	* sysdeps/x86_64/fpu/multiarch/e_expf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/ifunc-fma.h: Likewise.
2017-08-16 08:43:48 -07:00
Florian Weimer 403143e1df Add ChangeLog reference to bug 16750/CVE-2009-5064 2017-08-16 16:47:20 +02:00
Andreas Schwab eedca9772e ldd: never run file directly 2017-08-16 15:59:55 +02:00
H.J. Lu f59f7adb4a x86-64: Align L(SP_RANGE)/L(SP_INF_0) to 8 bytes [BZ #21955]
sysdeps/x86_64/fpu/e_expf.S has

        lea     L(SP_RANGE)(%rip), %rdx /* load over/underflow bound */
        cmpl    (%rdx,%rax,4), %ecx     /* |x|<under/overflow bound ? */
...
        /* Here if |x| is Inf */
        lea     L(SP_INF_0)(%rip), %rdx /* depending on sign of x: */
        movss   (%rdx,%rax,4), %xmm0    /* return zero or Inf */
        ret
...
         .section .rodata.cst8,"aM",@progbits,8
...
        .p2align 2
L(SP_RANGE): /* single precision overflow/underflow bounds */
        .long   0x42b17217      /* if x>this bound, then result overflows */
        .long   0x42cff1b4      /* if x<this bound, then result underflows */
        .type L(SP_RANGE), @object
        ASM_SIZE_DIRECTIVE(L(SP_RANGE))

        .p2align 2
L(SP_INF_0):
        .long   0x7f800000      /* single precision Inf */
        .long   0               /* single precision zero */
        .type L(SP_INF_0), @object
        ASM_SIZE_DIRECTIVE(L(SP_INF_0))

Since L(SP_RANGE) and L(SP_INF_0) are in .rodata.cst8 section, they must
be aligned to 8 bytes.

	[BZ #21955]
	* sysdeps/x86_64/fpu/e_expf.S (L(SP_RANGE)): Aligned to 8 bytes.
	(L(SP_INF_0)): Likewise.
2017-08-15 14:05:14 -07:00
Florian Weimer 6b11a6ad71 gmon: Run tst-gmon-prof only for run-built-tests=yes 2017-08-15 18:35:42 +02:00
Florian Weimer bbf5c4388a aio: Remove support for BROKEN_THREAD_SIGNALS
This was originally added to support LinuxThreads and is not needed for
NPTL.
2017-08-15 17:54:19 +02:00
Florian Weimer 6014c65de2 gmon: Add test for basic mcount/gprof functionality 2017-08-15 15:49:45 +02:00
Gustavo Romero ee72219a49 powerpc: Add values from Linux 4.8 to <elf.h>
Add powerpc specific note sections available since Linux v4.8.

	* elf/elf.h A (NT_PPC_TAR): New macro.
	(NT_PPC_PPR): Likewise.
	(NT_PPC_DSCR): Likewise.
	(NT_PPC_EBB): Likewise.
	(NT_PPC_PMU): Likewise.
	(NT_PPC_TM_CGPR): Likewise.
	(NT_PPC_TM_CFPR): Likewise.
	(NT_PPC_TM_CVMX): Likewise.
	(NT_PPC_TM_CVSX): Likewise.
	(NT_PPC_TM_SPR): Likewise.
	(NT_PPC_TM_CTAR): Likewise.
	(NT_PPC_TM_CPPR): Likewise.
	(NT_PPC_TM_CDSCR): Likewise.
2017-08-15 10:17:30 -03:00
Florian Weimer 4ebf934e34 i386: Replace internal_function attribute for __mcount_internal
__mcount_internal is called from assembler code.  Use an explicit
regparm attribute to pass both arguments in registers, to match what
used to happen with internal_function before commit
fbdc1e3e8d (i386: Do not set
internal_function).
2017-08-15 14:51:55 +02:00
Stefan Liebler e9f57484aa S390: Add new s390 platform z14.
The new IBM z14 is added to platform string array.
The macro _DL_PLATFORMS_COUNT is incremented.

ChangeLog:

	* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags): Add z14.
	* sysdeps/s390/dl-procinfo.h (_DL_PLATFORMS_COUNT): Increased.
2017-08-15 14:00:07 +02:00
Joseph Myers 88ff4d5561 conformtest: Disable si_value expectation for XPG42.
This patch corrects the conform/ expectations for sys/wait.h not to
expect si_value for XPG4.2.

Tested for x86_64.

	* conform/data/sys/wait.h-data (si_value): Do not expect for
	XPG42.
2017-08-14 17:05:55 +00:00
Florian Weimer c88ffc239e NSS: Replace exported NSS lookup functions with stubs [BZ #21962]
Commit 384ca55174 from 2007 added this to
nss/XXX-lookup.c:

+#ifndef NO_COMPAT
+int
+internal_function attribute_compat_text_section
+DB_COMPAT_FCT (service_user **ni, const char *fct_name, void **fctp)
+{
+  return DB_LOOKUP_FCT (ni, fct_name, NULL, fctp);
+}
+#endif

That is, it adds a pseudo-compat function with an internal_function
attribute.  The function it was supposed to replace did not have the
attribute:

 extern int DB_LOOKUP_FCT (service_user **ni, const char *fct_name,
-			  void **fctp) internal_function;
+			  const char *fct2_name, void **fctp)
+  internal_function;

This changed the calling convention on i386 for the following
functions in the public ABI:

  __nss_passwd_lookup
  __nss_group_lookup
  __nss_hosts_lookup

This commit replaces the functions with always-failing stubs,
with true compat symbols.  Due to a happy accident, the calling
convention of the stub is identical for the internal_function
and non-internal_function case on i386.

In addition, this commit auto-generates the __nss_*_lookup2
function declarations as part of <nsswitch.h>.
2017-08-14 18:13:42 +02:00
Adhemerval Zanella 1f14d0c3dd posix: Fix mmap for m68k and ia64 (BZ#21908)
Default semantic for mmap2 syscall is to take the offset in 4096-byte
units.  However m68k and ia64 mmap2 implementation take in the
configured pageunit units and for both architecture it can be
different values.

This patch fixes the m68k runtime discover of mmap2 offset unit
and adds the ia64 definition to find it at runtime.

Checked the basic tst-mmap and tst-mmap-offset on m68k (the system
is configured with 4k, so current code is already passing on this
system) and a sanity check on x86_64-linux-gnu (which should not be
affected by this change).  Sergei also states that ia64 loader now
work correctly with this change.

	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
	Sergei Trofimovich  <slyfox@inbox.ru>

	* sysdeps/unix/sysv/linux/m68k/mmap_internal.h (MMAP2_PAGE_SHIFT):
	Rename to MMAP2_PAGE_UNIT.
	* sysdeps/unix/sysv/linux/mmap.c: Include mmap_internal iff
	__OFF_T_MATCHES_OFF64_T is not defined.
	* sysdeps/unix/sysv/linux/mmap_internal.h (page_unit): Declare as
	uint64_t.
	(MMAP2_PAGE_UNIT) [MMAP2_PAGE_UNIT == -1]: Redefine to page_unit.
	(page_unit) [MMAP2_PAGE_UNIT != -1]: Remove definition.
2017-08-14 10:35:14 -03:00
Florian Weimer fbdc1e3e8d i386: Do not set internal_function
All calls to functions with the internal_function attribute
have been removed from assembler implementations, which means that
the definition of internal_function can be changed at the C level
without causing ABI issues with assembler code.

_dl_fixup still uses a regparm calling convention on i386, but this
is controlled through ARCH_FIXUP_ATTRIBUTE, not internal_function.
2017-08-14 15:08:48 +02:00
Florian Weimer b3f85fd2e4 _dl_init: Remove internal_function attribute
The function is called from the i386 startup code, which needs minor
adjustments due to the changed ABI.
2017-08-14 15:08:48 +02:00
Florian Weimer 630bf4916f _dl_start: Remove internal_function attribute
The i386 startup code needs adjusting because it calls the function
and the ABI has changed.
2017-08-14 15:08:48 +02:00
Florian Weimer 9fa7449b35 _dl_fini: Remove internal_function attribute
Assembler code passes the address of _dl_fini to __libc_start_main,
whose function pointer argument lacks the attribute.  This means
that calls could use the wrong ABI.  Fortunately, for zero-parameter
void-returning functions, internal_function does not change ABI
on i386 (the only architecture which uses internal_function), so
this inconsistency was harmless (which is why it had not been
noticed so far).
2017-08-14 15:08:48 +02:00
H.J. Lu 73322d5ff6 x86: Add IBT/SHSTK bits to cpu-features
Add IBT/SHSTK bits to cpu-features for Shadow Stack in Intel Control-flow
Enforcement Technology (CET) instructions:

https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf

	* sysdeps/x86/cpu-features.h (bit_cpu_BIT): New.
	(bit_cpu_SHSTK): Likewise.
	(index_cpu_IBT): Likewise.
	(index_cpu_SHSTK): Likewise.
	(reg_IBT): Likewise.
	(reg_SHSTK): Likewise.
	* sysdeps/x86/cpu-tunables.c (TUNABLE_CALLBACK (set_hwcaps)):
	Handle index_cpu_IBT and index_cpu_SHSTK.
2017-08-14 05:54:38 -07:00
Mike FABIAN dbc303ef76 Fix spelling mistake in fr.po
[BZ #19982]
	* po/fr.po: Fix spelling mistake.
2017-08-14 09:30:54 +02:00
Florian Weimer 3012cfb0d2 ld.so: Remove internal_function attribute from various functions
These functions are invoked from other DSOs and should therefore
use the standard calling convention.
2017-08-13 21:11:54 +02:00
Florian Weimer 52bcdf267b Remove internal_function attribute from string-to-float functions
These are called across DSO boundaries and should therefore use
the standard calling convention.
2017-08-13 21:11:47 +02:00
Florian Weimer e1d2ae8d21 NPTL: Remove internal_function from stack marking functions
These are called across DSO boundaries and therefore should use
the ABI calling convention.
2017-08-13 21:11:38 +02:00
Florian Weimer c4ce038287 __netlink_assert_response: Remove internal_function attribute
This function is called from nscd and should not use a non-standard
calling convention.
2017-08-13 21:11:28 +02:00
Florian Weimer c4d767f7f3 __libc_rpc_getport: Remove internal_function attribute
This function has a hidden alias and is therefore expected to be
called across DSO boundaries.
2017-08-13 21:11:06 +02:00
Florian Weimer b22974092d NSS: Do not use internal_function for functions with hidden aliases
Such functions are called across DSO boundaries and should not
use a non-standard ABI.
2017-08-13 21:10:56 +02:00
Florian Weimer 1b0bfc6946 __fortify_fail: Remove internal_function attribute
__fortify_fail is called across DSO boundaries, so it should not
use a non-standard calling convention.
2017-08-13 21:10:44 +02:00
Mike FABIAN a6bd872286 Adapt test case data to the changes in the thousands separators
[BZ #20756]
	* localedata/tst-langinfo.sh: Adapt test case data.
	* stdlib/tst-strfmon_l.c: Likewise.
	* stdlib/tst-strtod4.c: Likewise.
	* stdlib/tst-strtod5i.c: Likewise.
2017-08-12 17:20:24 +02:00
Florian Weimer 8b2c63e4e2 assert: Suppress pedantic warning caused by statement expression 2017-08-11 15:36:08 +02:00
Siddhesh Poyarekar 86c6519ee7 benchtests: Print json in memmove benchmark
Make the memmove benchmarks (bench-memmove and bench-memmove-large)
print their output in JSON so that they can be evaluated using the
compare_strings.py script.

	* benchtests/bench-memmove-large.c: Print output in JSON
	format.
	* benchtests/bench-memmove.c: Likewise.
2017-08-11 12:19:27 +05:30
Siddhesh Poyarekar 61c982910d benchtests: Remove verification runs from benchmark tests
The test run is unnecessary and interferes with the benchmark.  The
tests are done during make check, so they're unnecessary here.

	* benchtests/bench-memccpy.c (do_one_test): Remove checks.
	* benchtests/bench-memchr.c (do_one_test): Likewise.
	* benchtests/bench-memcpy-large.c (do_one_test): Likewise.
	* benchtests/bench-memcpy.c (do_one_test): Likewise.
	* benchtests/bench-memmove-large.c (do_one_test): Likewise.
	* benchtests/bench-memmove.c (do_one_test): Likewise.
	* benchtests/bench-memset-large.c (do_one_test): Likewise.
	* benchtests/bench-memset.c (do_one_test): Likewise.
	* benchtests/bench-string.h (test_init): Remove memsets.
2017-08-11 12:19:26 +05:30
Rical Jasan 925733a913 manual: Rewrite the section on widths of integer types.
The manual contradicted itself by saying the number of bits in an
integer type needed to be computed, and then listing a number of
macros that later standards provided for exactly that.  The entire
section has been reworked to provide those macros first, while
preserving the documentation of CHAR_BIT and the associated examples
within that context.

	* manual/lang.texi
	(Computing the Width of an Integer Data Type): Rename section
	to "Width of an Integer Type".  Remove inaccurate statement
	regarding lack of C language facilities for determining width
	of integer types, and reorder content to improve flow and
	context of discussion.
2017-08-10 20:28:28 -07:00
Rical Jasan 4fcdfbfcf9 manual: Update @standards for [__]va_copy.
The ISO version in which va_copy was introduced is made explicit, and
__va_copy is given @standards.  The description is updated to be more
clear about the origins of each macro, and the reader is informed
these macros are now provided by the compiler (information previously
embedded in a Texinfo @comment).

	* lang.texi (va_copy): Change standard from ISO to C99.
	(__va_copy): Add standard and header annotation.
	Update description for clarity of origins and current use.
2017-08-10 19:58:30 -07:00
Gabriel F. T. Gomes 4d98ace9de powerpc: Restrict xssqrtqp operands to Vector Registers (bug 21941)
POWER ISA 3.0 introduces the xssqrtqp instructions, which expects
operands to be in Vector Registers (Altivec/VMX), even though this
instruction belongs to the Vector-Scalar Instruction Set.

In GCC's Extended Assembly for POWER, the 'wq' register constraint is
provided for use with IEEE 754 128-bit floating-point values.  However,
this constraint does not limit the register allocation to Vector
Registers (Altivec/VMX) and could assign a Vector-Scalar Register (VSX)
to the operands of the instruction.

This patch changes the register constraint used in sqrtf128 from 'wq' to
'v', in order to request a Vector Register (Altivec/VMX) for use with
the xssqrtqp instruction.

Tested for powerpc64le and --with-cpu=power9.

	[BZ #21941]
	* sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since
	xssqrtqp requires operands to be in Vector Registers
	(Altivec/VMX), replace the register constraint 'wq' with 'v'.
	* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
	(__ieee754_sqrtf128): Likewise.
2017-08-10 16:10:21 -03:00